Test Failed
Push — master ( d1298a...6964e3 )
by Stiofan
15:46
created
geodirectory-functions/helper_functions.php 4 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     if (geodir_is_wpml()){
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else{
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else{
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 
203 203
     if (geodir_is_wpml()){
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else{
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else{
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1173,7 +1173,7 @@
 block discarded – undo
1173 1173
  *
1174 1174
  * @param string $str The string being decoded.
1175 1175
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1176
- * @return string The width of string.
1176
+ * @return integer The width of string.
1177 1177
  */
1178 1178
 function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1179 1179
 	if ( function_exists( 'mb_strwidth' ) ) {
Please login to merge, or discard this patch.
Indentation   +395 added lines, -395 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16 16
 function geodir_add_listing_page_id(){
17
-    $gd_page_id = get_option('geodir_add_listing_page');
17
+	$gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19
-    if (geodir_is_wpml()) {
20
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
21
-    }
19
+	if (geodir_is_wpml()) {
20
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
21
+	}
22 22
 
23
-    return $gd_page_id;
23
+	return $gd_page_id;
24 24
 }
25 25
 
26 26
 /**
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33 33
 function geodir_preview_page_id(){
34
-    $gd_page_id = get_option('geodir_preview_page');
34
+	$gd_page_id = get_option('geodir_preview_page');
35 35
 
36
-    if (geodir_is_wpml()) {
37
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
38
-    }
36
+	if (geodir_is_wpml()) {
37
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
38
+	}
39 39
 
40
-    return $gd_page_id;
40
+	return $gd_page_id;
41 41
 }
42 42
 
43 43
 /**
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50 50
 function geodir_success_page_id(){
51
-    $gd_page_id = get_option('geodir_success_page');
51
+	$gd_page_id = get_option('geodir_success_page');
52 52
 
53
-    if (geodir_is_wpml()) {
54
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
55
-    }
53
+	if (geodir_is_wpml()) {
54
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
55
+	}
56 56
 
57
-    return $gd_page_id;
57
+	return $gd_page_id;
58 58
 }
59 59
 
60 60
 /**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67 67
 function geodir_location_page_id(){
68
-    $gd_page_id = get_option('geodir_location_page');
68
+	$gd_page_id = get_option('geodir_location_page');
69 69
 
70
-    if (geodir_is_wpml()) {
71
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
72
-    }
70
+	if (geodir_is_wpml()) {
71
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
72
+	}
73 73
 
74
-    return $gd_page_id;
74
+	return $gd_page_id;
75 75
 }
76 76
 
77 77
 /**
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84 84
 function geodir_home_page_id(){
85
-    $gd_page_id = get_option('geodir_home_page');
85
+	$gd_page_id = get_option('geodir_home_page');
86 86
 
87
-    if (geodir_is_wpml()) {
88
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
89
-    }
87
+	if (geodir_is_wpml()) {
88
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
89
+	}
90 90
 
91
-    return $gd_page_id;
91
+	return $gd_page_id;
92 92
 }
93 93
 
94 94
 /**
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101 101
 function geodir_info_page_id(){
102
-    $gd_page_id = get_option('geodir_info_page');
102
+	$gd_page_id = get_option('geodir_info_page');
103 103
 
104
-    if (geodir_is_wpml()) {
105
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
106
-    }
104
+	if (geodir_is_wpml()) {
105
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
106
+	}
107 107
 
108
-    return $gd_page_id;
108
+	return $gd_page_id;
109 109
 }
110 110
 
111 111
 /**
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118 118
 function geodir_login_page_id(){
119
-    $gd_page_id = get_option('geodir_login_page');
119
+	$gd_page_id = get_option('geodir_login_page');
120 120
 
121
-    if (geodir_is_wpml()) {
122
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
123
-    }
121
+	if (geodir_is_wpml()) {
122
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
123
+	}
124 124
 
125
-    return $gd_page_id;
125
+	return $gd_page_id;
126 126
 }
127 127
 
128 128
 
@@ -134,51 +134,51 @@  discard block
 block discarded – undo
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136 136
 function geodir_login_url($args=array()){
137
-    $gd_page_id = get_option('geodir_login_page');
138
-
139
-    if (geodir_is_wpml()) {
140
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
141
-    }
142
-
143
-    if (function_exists('geodir_location_geo_home_link')) {
144
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
-    }
146
-
147
-    if (geodir_is_wpml()){
148
-        $home_url = icl_get_home_url();
149
-    }else{
150
-        $home_url = home_url();
151
-    }
152
-
153
-    if (function_exists('geodir_location_geo_home_link')) {
154
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
-    }
156
-
157
-    if($gd_page_id){
158
-        $post = get_post($gd_page_id);
159
-        $slug = $post->post_name;
160
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
-        $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
163
-        $login_url = trailingslashit($home_url)."?geodir_signup=true";
164
-    }
165
-
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
168
-    }
169
-
170
-    /**
171
-     * Filter the GeoDirectory login page url.
172
-     *
173
-     * This filter can be used to change the GeoDirectory page url.
174
-     *
175
-     * @since 1.5.3
176
-     * @package GeoDirectory
177
-     * @param string $login_url The url of the login page.
178
-     * @param array $args The array of query args used.
179
-     * @param int $gd_page_id The page id of the GD login page.
180
-     */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
137
+	$gd_page_id = get_option('geodir_login_page');
138
+
139
+	if (geodir_is_wpml()) {
140
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
141
+	}
142
+
143
+	if (function_exists('geodir_location_geo_home_link')) {
144
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145
+	}
146
+
147
+	if (geodir_is_wpml()){
148
+		$home_url = icl_get_home_url();
149
+	}else{
150
+		$home_url = home_url();
151
+	}
152
+
153
+	if (function_exists('geodir_location_geo_home_link')) {
154
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155
+	}
156
+
157
+	if($gd_page_id){
158
+		$post = get_post($gd_page_id);
159
+		$slug = $post->post_name;
160
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161
+		$login_url = trailingslashit($home_url)."$slug/";
162
+	}else{
163
+		$login_url = trailingslashit($home_url)."?geodir_signup=true";
164
+	}
165
+
166
+	if($args){
167
+		$login_url = add_query_arg($args,$login_url );
168
+	}
169
+
170
+	/**
171
+	 * Filter the GeoDirectory login page url.
172
+	 *
173
+	 * This filter can be used to change the GeoDirectory page url.
174
+	 *
175
+	 * @since 1.5.3
176
+	 * @package GeoDirectory
177
+	 * @param string $login_url The url of the login page.
178
+	 * @param array $args The array of query args used.
179
+	 * @param int $gd_page_id The page id of the GD login page.
180
+	 */
181
+		return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -190,40 +190,40 @@  discard block
 block discarded – undo
190 190
  * @return string Info page url.
191 191
  */
192 192
 function geodir_info_url($args=array()){
193
-    $gd_page_id = get_option('geodir_info_page');
194
-
195
-    if (geodir_is_wpml()) {
196
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
197
-    }
198
-
199
-    if (function_exists('geodir_location_geo_home_link')) {
200
-        remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
-    }
202
-
203
-    if (geodir_is_wpml()){
204
-        $home_url = icl_get_home_url();
205
-    }else{
206
-        $home_url = home_url();
207
-    }
208
-
209
-    if (function_exists('geodir_location_geo_home_link')) {
210
-        add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
-    }
212
-
213
-    if($gd_page_id){
214
-        $post = get_post($gd_page_id);
215
-        $slug = $post->post_name;
216
-        //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
-        $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
219
-        $info_url = trailingslashit($home_url);
220
-    }
221
-
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
224
-    }
225
-
226
-    return $info_url;
193
+	$gd_page_id = get_option('geodir_info_page');
194
+
195
+	if (geodir_is_wpml()) {
196
+		$gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
197
+	}
198
+
199
+	if (function_exists('geodir_location_geo_home_link')) {
200
+		remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201
+	}
202
+
203
+	if (geodir_is_wpml()){
204
+		$home_url = icl_get_home_url();
205
+	}else{
206
+		$home_url = home_url();
207
+	}
208
+
209
+	if (function_exists('geodir_location_geo_home_link')) {
210
+		add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211
+	}
212
+
213
+	if($gd_page_id){
214
+		$post = get_post($gd_page_id);
215
+		$slug = $post->post_name;
216
+		//$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217
+		$info_url = trailingslashit($home_url)."$slug/";
218
+	}else{
219
+		$info_url = trailingslashit($home_url);
220
+	}
221
+
222
+	if($args){
223
+		$info_url = add_query_arg($args,$info_url );
224
+	}
225
+
226
+	return $info_url;
227 227
 }
228 228
 
229 229
 /**
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
  * @return string Returns converted string.
240 240
  */
241 241
 function geodir_ucwords($string, $charset='UTF-8') {
242
-    if (function_exists('mb_convert_case')) {
243
-        return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
-    } else {
245
-        return ucwords($string);
246
-    }
242
+	if (function_exists('mb_convert_case')) {
243
+		return mb_convert_case($string, MB_CASE_TITLE, $charset);
244
+	} else {
245
+		return ucwords($string);
246
+	}
247 247
 }
248 248
 
249 249
 /**
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
  * @return string Returns converted string.
260 260
  */
261 261
 function geodir_strtolower($string, $charset='UTF-8') {
262
-    if (function_exists('mb_convert_case')) {
263
-        return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
-    } else {
265
-        return strtolower($string);
266
-    }
262
+	if (function_exists('mb_convert_case')) {
263
+		return mb_convert_case($string, MB_CASE_LOWER, $charset);
264
+	} else {
265
+		return strtolower($string);
266
+	}
267 267
 }
268 268
 
269 269
 /**
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
  * @return string Returns converted string.
280 280
  */
281 281
 function geodir_strtoupper($string, $charset='UTF-8') {
282
-    if (function_exists('mb_convert_case')) {
283
-        return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
-    } else {
285
-        return strtoupper($string);
286
-    }
282
+	if (function_exists('mb_convert_case')) {
283
+		return mb_convert_case($string, MB_CASE_UPPER, $charset);
284
+	} else {
285
+		return strtoupper($string);
286
+	}
287 287
 }
288 288
 
289 289
 /**
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
466
-        return '_gd_die_handler';
467
-    } else {
468
-        die();
469
-    }
465
+	if ( defined( 'GD_TESTING_MODE' ) ) {
466
+		return '_gd_die_handler';
467
+	} else {
468
+		die();
469
+	}
470 470
 }
471 471
 
472 472
 /**
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483 483
 function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
484
+	add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
+	add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
+	wp_die( $message, $title, array( 'response' => $status ));
487 487
 }
488 488
 
489 489
 /*
@@ -660,44 +660,44 @@  discard block
 block discarded – undo
660 660
  * @return string The formatted date.
661 661
  */
662 662
 function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) {
663
-    if ( empty( $date_input ) || empty( $date_to ) ) {
664
-        return NULL;
665
-    }
663
+	if ( empty( $date_input ) || empty( $date_to ) ) {
664
+		return NULL;
665
+	}
666 666
     
667
-    $date_input = geodir_maybe_untranslate_date( $date_input );
667
+	$date_input = geodir_maybe_untranslate_date( $date_input );
668 668
     
669
-    $timestamp = 0;
670
-    if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
-        $datetime = date_create_from_format( $date_from, $date_input );
672
-        if ( !empty( $datetime ) ) {
673
-            $timestamp = $datetime->getTimestamp();
674
-        }
675
-    }
669
+	$timestamp = 0;
670
+	if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
+		$datetime = date_create_from_format( $date_from, $date_input );
672
+		if ( !empty( $datetime ) ) {
673
+			$timestamp = $datetime->getTimestamp();
674
+		}
675
+	}
676 676
     
677
-    if ( empty( $timestamp ) ) {
678
-        $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
-        $timestamp = strtotime( $date );
680
-    }
677
+	if ( empty( $timestamp ) ) {
678
+		$date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
+		$timestamp = strtotime( $date );
680
+	}
681 681
     
682
-    $date = date_i18n( $date_to, $timestamp );
682
+	$date = date_i18n( $date_to, $timestamp );
683 683
     
684
-    if ( !$locale ) {
685
-        $date = geodir_maybe_untranslate_date( $date );
686
-    }
684
+	if ( !$locale ) {
685
+		$date = geodir_maybe_untranslate_date( $date );
686
+	}
687 687
     
688
-    /**
689
-     * Filter the the date format conversion.
690
-     *
691
-     * @since 1.6.7
692
-     * @package GeoDirectory
693
-     *
694
-     * @param string $date The date string.
695
-     * @param string $date_input The date input.
696
-     * @param string $date_to The destination date format.
697
-     * @param string $date_from The source date format.
698
-     * @param bool $locale True to retrieve the date in localized format.
699
-     */
700
-    return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
688
+	/**
689
+	 * Filter the the date format conversion.
690
+	 *
691
+	 * @since 1.6.7
692
+	 * @package GeoDirectory
693
+	 *
694
+	 * @param string $date The date string.
695
+	 * @param string $date_input The date input.
696
+	 * @param string $date_to The destination date format.
697
+	 * @param string $date_from The source date format.
698
+	 * @param bool $locale True to retrieve the date in localized format.
699
+	 */
700
+	return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
701 701
 }
702 702
 
703 703
 /**
@@ -722,91 +722,91 @@  discard block
 block discarded – undo
722 722
  * @return string Trimmed string.
723 723
  */
724 724
 function geodir_excerpt($text, $length = 100, $options = array()) {
725
-    if (!(int)$length > 0) {
726
-        return $text;
727
-    }
728
-    $default = array(
729
-        'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
725
+	if (!(int)$length > 0) {
726
+		return $text;
727
+	}
728
+	$default = array(
729
+		'ellipsis' => '', 'exact' => true, 'html' => true, 'trimWidth' => false,
730 730
 	);
731
-    if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
732
-        $default['ellipsis'] = "";
733
-    }
734
-    $options += $default;
735
-
736
-    $prefix = '';
737
-    $suffix = $options['ellipsis'];
738
-
739
-    if ($options['html']) {
740
-        $ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
741
-
742
-        $truncateLength = 0;
743
-        $totalLength = 0;
744
-        $openTags = array();
745
-        $truncate = '';
746
-
747
-        preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
748
-        foreach ($tags as $tag) {
749
-            $contentLength = geodir_strlen($tag[3], $options);
750
-
751
-            if ($truncate === '') {
752
-                if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
753
-                    if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
754
-                        array_unshift($openTags, $tag[2]);
755
-                    } elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
756
-                        $pos = array_search($closeTag[1], $openTags);
757
-                        if ($pos !== false) {
758
-                            array_splice($openTags, $pos, 1);
759
-                        }
760
-                    }
761
-                }
762
-
763
-                $prefix .= $tag[1];
764
-
765
-                if ($totalLength + $contentLength + $ellipsisLength > $length) {
766
-                    $truncate = $tag[3];
767
-                    $truncateLength = $length - $totalLength;
768
-                } else {
769
-                    $prefix .= $tag[3];
770
-                }
771
-            }
772
-
773
-            $totalLength += $contentLength;
774
-            if ($totalLength > $length) {
775
-                break;
776
-            }
777
-        }
778
-
779
-        if ($totalLength <= $length) {
780
-            return $text;
781
-        }
782
-
783
-        $text = $truncate;
784
-        $length = $truncateLength;
785
-
786
-        foreach ($openTags as $tag) {
787
-            $suffix .= '</' . $tag . '>';
788
-        }
789
-    } else {
790
-        if (geodir_strlen($text, $options) <= $length) {
791
-            return $text;
792
-        }
793
-        $ellipsisLength = geodir_strlen($options['ellipsis'], $options);
794
-    }
795
-
796
-    $result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
797
-
798
-    if (!$options['exact']) {
799
-        if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
800
-            $result = geodir_remove_last_word($result);
801
-        }
802
-
803
-        // Do not need to count ellipsis in the cut, if result is empty.
804
-        if (!strlen($result)) {
805
-            $result = geodir_substr($text, 0, $length, $options);
806
-        }
807
-    }
808
-
809
-    return $prefix . $result . $suffix;
731
+	if (!empty($options['html']) && function_exists('mb_internal_encoding') && strtolower(mb_internal_encoding()) === 'utf-8') {
732
+		$default['ellipsis'] = "";
733
+	}
734
+	$options += $default;
735
+
736
+	$prefix = '';
737
+	$suffix = $options['ellipsis'];
738
+
739
+	if ($options['html']) {
740
+		$ellipsisLength = geodir_strlen(strip_tags($options['ellipsis']), $options);
741
+
742
+		$truncateLength = 0;
743
+		$totalLength = 0;
744
+		$openTags = array();
745
+		$truncate = '';
746
+
747
+		preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $text, $tags, PREG_SET_ORDER);
748
+		foreach ($tags as $tag) {
749
+			$contentLength = geodir_strlen($tag[3], $options);
750
+
751
+			if ($truncate === '') {
752
+				if (!preg_match('/img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param/i', $tag[2])) {
753
+					if (preg_match('/<[\w]+[^>]*>/', $tag[0])) {
754
+						array_unshift($openTags, $tag[2]);
755
+					} elseif (preg_match('/<\/([\w]+)[^>]*>/', $tag[0], $closeTag)) {
756
+						$pos = array_search($closeTag[1], $openTags);
757
+						if ($pos !== false) {
758
+							array_splice($openTags, $pos, 1);
759
+						}
760
+					}
761
+				}
762
+
763
+				$prefix .= $tag[1];
764
+
765
+				if ($totalLength + $contentLength + $ellipsisLength > $length) {
766
+					$truncate = $tag[3];
767
+					$truncateLength = $length - $totalLength;
768
+				} else {
769
+					$prefix .= $tag[3];
770
+				}
771
+			}
772
+
773
+			$totalLength += $contentLength;
774
+			if ($totalLength > $length) {
775
+				break;
776
+			}
777
+		}
778
+
779
+		if ($totalLength <= $length) {
780
+			return $text;
781
+		}
782
+
783
+		$text = $truncate;
784
+		$length = $truncateLength;
785
+
786
+		foreach ($openTags as $tag) {
787
+			$suffix .= '</' . $tag . '>';
788
+		}
789
+	} else {
790
+		if (geodir_strlen($text, $options) <= $length) {
791
+			return $text;
792
+		}
793
+		$ellipsisLength = geodir_strlen($options['ellipsis'], $options);
794
+	}
795
+
796
+	$result = geodir_substr($text, 0, $length - $ellipsisLength, $options);
797
+
798
+	if (!$options['exact']) {
799
+		if (geodir_substr($text, $length - $ellipsisLength, 1, $options) !== ' ') {
800
+			$result = geodir_remove_last_word($result);
801
+		}
802
+
803
+		// Do not need to count ellipsis in the cut, if result is empty.
804
+		if (!strlen($result)) {
805
+			$result = geodir_substr($text, 0, $length, $options);
806
+		}
807
+	}
808
+
809
+	return $prefix . $result . $suffix;
810 810
 }
811 811
 
812 812
 /**
@@ -830,28 +830,28 @@  discard block
 block discarded – undo
830 830
  * @return int
831 831
  */
832 832
 function geodir_strlen($text, array $options) {
833
-    if (empty($options['trimWidth'])) {
834
-        $strlen = 'geodir_utf8_strlen';
835
-    } else {
836
-        $strlen = 'geodir_utf8_strwidth';
837
-    }
838
-
839
-    if (empty($options['html'])) {
840
-        return $strlen($text);
841
-    }
842
-
843
-    $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844
-    $replace = preg_replace_callback(
845
-        $pattern,
846
-        function ($match) use ($strlen) {
847
-            $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848
-
849
-            return str_repeat(' ', $strlen($utf8, 'UTF-8'));
850
-        },
851
-        $text
852
-    );
853
-
854
-    return $strlen($replace);
833
+	if (empty($options['trimWidth'])) {
834
+		$strlen = 'geodir_utf8_strlen';
835
+	} else {
836
+		$strlen = 'geodir_utf8_strwidth';
837
+	}
838
+
839
+	if (empty($options['html'])) {
840
+		return $strlen($text);
841
+	}
842
+
843
+	$pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844
+	$replace = preg_replace_callback(
845
+		$pattern,
846
+		function ($match) use ($strlen) {
847
+			$utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848
+
849
+			return str_repeat(' ', $strlen($utf8, 'UTF-8'));
850
+		},
851
+		$text
852
+	);
853
+
854
+	return $strlen($replace);
855 855
 }
856 856
 
857 857
 /**
@@ -872,80 +872,80 @@  discard block
 block discarded – undo
872 872
  * @return string
873 873
  */
874 874
 function geodir_substr($text, $start, $length, array $options) {
875
-    if (empty($options['trimWidth'])) {
876
-        $substr = 'geodir_utf8_substr';
877
-    } else {
878
-        $substr = 'geodir_utf8_strimwidth';
879
-    }
880
-
881
-    $maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
882
-    if ($start < 0) {
883
-        $start += $maxPosition;
884
-        if ($start < 0) {
885
-            $start = 0;
886
-        }
887
-    }
888
-    if ($start >= $maxPosition) {
889
-        return '';
890
-    }
891
-
892
-    if ($length === null) {
893
-        $length = geodir_strlen($text, $options);
894
-    }
895
-
896
-    if ($length < 0) {
897
-        $text = geodir_substr($text, $start, null, $options);
898
-        $start = 0;
899
-        $length += geodir_strlen($text, $options);
900
-    }
901
-
902
-    if ($length <= 0) {
903
-        return '';
904
-    }
905
-
906
-    if (empty($options['html'])) {
907
-        return (string)$substr($text, $start, $length);
908
-    }
909
-
910
-    $totalOffset = 0;
911
-    $totalLength = 0;
912
-    $result = '';
913
-
914
-    $pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
915
-    $parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
916
-    foreach ($parts as $part) {
917
-        $offset = 0;
918
-
919
-        if ($totalOffset < $start) {
920
-            $len = geodir_strlen($part, array('trimWidth' => false) + $options);
921
-            if ($totalOffset + $len <= $start) {
922
-                $totalOffset += $len;
923
-                continue;
924
-            }
925
-
926
-            $offset = $start - $totalOffset;
927
-            $totalOffset = $start;
928
-        }
929
-
930
-        $len = geodir_strlen($part, $options);
931
-        if ($offset !== 0 || $totalLength + $len > $length) {
932
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
933
-                // Entities cannot be passed substr.
934
-                continue;
935
-            }
936
-
937
-            $part = $substr($part, $offset, $length - $totalLength);
938
-            $len = geodir_strlen($part, $options);
939
-        }
940
-
941
-        $result .= $part;
942
-        $totalLength += $len;
943
-        if ($totalLength >= $length) {
944
-            break;
945
-        }
946
-    }
947
-
948
-    return $result;
875
+	if (empty($options['trimWidth'])) {
876
+		$substr = 'geodir_utf8_substr';
877
+	} else {
878
+		$substr = 'geodir_utf8_strimwidth';
879
+	}
880
+
881
+	$maxPosition = geodir_strlen($text, array('trimWidth' => false) + $options);
882
+	if ($start < 0) {
883
+		$start += $maxPosition;
884
+		if ($start < 0) {
885
+			$start = 0;
886
+		}
887
+	}
888
+	if ($start >= $maxPosition) {
889
+		return '';
890
+	}
891
+
892
+	if ($length === null) {
893
+		$length = geodir_strlen($text, $options);
894
+	}
895
+
896
+	if ($length < 0) {
897
+		$text = geodir_substr($text, $start, null, $options);
898
+		$start = 0;
899
+		$length += geodir_strlen($text, $options);
900
+	}
901
+
902
+	if ($length <= 0) {
903
+		return '';
904
+	}
905
+
906
+	if (empty($options['html'])) {
907
+		return (string)$substr($text, $start, $length);
908
+	}
909
+
910
+	$totalOffset = 0;
911
+	$totalLength = 0;
912
+	$result = '';
913
+
914
+	$pattern = '/(&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};)/i';
915
+	$parts = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
916
+	foreach ($parts as $part) {
917
+		$offset = 0;
918
+
919
+		if ($totalOffset < $start) {
920
+			$len = geodir_strlen($part, array('trimWidth' => false) + $options);
921
+			if ($totalOffset + $len <= $start) {
922
+				$totalOffset += $len;
923
+				continue;
924
+			}
925
+
926
+			$offset = $start - $totalOffset;
927
+			$totalOffset = $start;
928
+		}
929
+
930
+		$len = geodir_strlen($part, $options);
931
+		if ($offset !== 0 || $totalLength + $len > $length) {
932
+			if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
933
+				// Entities cannot be passed substr.
934
+				continue;
935
+			}
936
+
937
+			$part = $substr($part, $offset, $length - $totalLength);
938
+			$len = geodir_strlen($part, $options);
939
+		}
940
+
941
+		$result .= $part;
942
+		$totalLength += $len;
943
+		if ($totalLength >= $length) {
944
+			break;
945
+		}
946
+	}
947
+
948
+	return $result;
949 949
 }
950 950
 
951 951
 /**
@@ -958,21 +958,21 @@  discard block
 block discarded – undo
958 958
  * @return string
959 959
  */
960 960
 function geodir_remove_last_word($text) {
961
-    $spacepos = geodir_utf8_strrpos($text, ' ');
961
+	$spacepos = geodir_utf8_strrpos($text, ' ');
962 962
 
963
-    if ($spacepos !== false) {
964
-        $lastWord = geodir_utf8_strrpos($text, $spacepos);
963
+	if ($spacepos !== false) {
964
+		$lastWord = geodir_utf8_strrpos($text, $spacepos);
965 965
 
966
-        // Some languages are written without word separation.
967
-        // We recognize a string as a word if it does not contain any full-width characters.
968
-        if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
969
-            $text = geodir_utf8_substr($text, 0, $spacepos);
970
-        }
966
+		// Some languages are written without word separation.
967
+		// We recognize a string as a word if it does not contain any full-width characters.
968
+		if (geodir_utf8_strwidth($lastWord) === geodir_utf8_strlen($lastWord)) {
969
+			$text = geodir_utf8_substr($text, 0, $spacepos);
970
+		}
971 971
 
972
-        return $text;
973
-    }
972
+		return $text;
973
+	}
974 974
 
975
-    return '';
975
+	return '';
976 976
 }
977 977
 
978 978
 function geodir_tool_restore_cpt_from_taxonomies(){
@@ -1090,11 +1090,11 @@  discard block
 block discarded – undo
1090 1090
  * @return string
1091 1091
  */
1092 1092
 function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1093
-    if ( function_exists( 'mb_strimwidth' ) ) {
1094
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1095
-    }
1093
+	if ( function_exists( 'mb_strimwidth' ) ) {
1094
+		return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1095
+	}
1096 1096
     
1097
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1097
+	return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1108,11 +1108,11 @@  discard block
 block discarded – undo
1108 1108
  * @return int Returns the number of characters in string.
1109 1109
  */
1110 1110
 function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1111
-    if ( function_exists( 'mb_strlen' ) ) {
1112
-        return mb_strlen( $str, $encoding );
1113
-    }
1111
+	if ( function_exists( 'mb_strlen' ) ) {
1112
+		return mb_strlen( $str, $encoding );
1113
+	}
1114 1114
         
1115
-    return strlen( $str );
1115
+	return strlen( $str );
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
  * @return int Returns the position of the first occurrence of search in the string.
1129 1129
  */
1130 1130
 function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1131
-    if ( function_exists( 'mb_strpos' ) ) {
1132
-        return mb_strpos( $str, $find, $offset, $encoding );
1133
-    }
1131
+	if ( function_exists( 'mb_strpos' ) ) {
1132
+		return mb_strpos( $str, $find, $offset, $encoding );
1133
+	}
1134 1134
         
1135
-    return strpos( $str, $find, $offset );
1135
+	return strpos( $str, $find, $offset );
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1148,11 +1148,11 @@  discard block
 block discarded – undo
1148 1148
  * @return int Returns the position of the last occurrence of search.
1149 1149
  */
1150 1150
 function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1151
-    if ( function_exists( 'mb_strrpos' ) ) {
1152
-        return mb_strrpos( $str, $find, $offset, $encoding );
1153
-    }
1151
+	if ( function_exists( 'mb_strrpos' ) ) {
1152
+		return mb_strrpos( $str, $find, $offset, $encoding );
1153
+	}
1154 1154
         
1155
-    return strrpos( $str, $find, $offset );
1155
+	return strrpos( $str, $find, $offset );
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1169,15 +1169,15 @@  discard block
 block discarded – undo
1169 1169
  * @return string
1170 1170
  */
1171 1171
 function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1172
-    if ( function_exists( 'mb_substr' ) ) {
1173
-        if ( $length === null ) {
1174
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1175
-        } else {
1176
-            return mb_substr( $str, $start, $length, $encoding );
1177
-        }
1178
-    }
1172
+	if ( function_exists( 'mb_substr' ) ) {
1173
+		if ( $length === null ) {
1174
+			return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1175
+		} else {
1176
+			return mb_substr( $str, $start, $length, $encoding );
1177
+		}
1178
+	}
1179 1179
         
1180
-    return substr( $str, $start, $length );
1180
+	return substr( $str, $start, $length );
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1210,20 +1210,20 @@  discard block
 block discarded – undo
1210 1210
  * @return string The resulting string.
1211 1211
  */
1212 1212
 function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1213
-    if ( function_exists( 'mb_strlen' ) ) {
1214
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1215
-        $str_end = "";
1213
+	if ( function_exists( 'mb_strlen' ) ) {
1214
+		$first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1215
+		$str_end = "";
1216 1216
         
1217
-        if ( $lower_str_end ) {
1218
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1219
-        } else {
1220
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1221
-        }
1217
+		if ( $lower_str_end ) {
1218
+			$str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1219
+		} else {
1220
+			$str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1221
+		}
1222 1222
         
1223
-        return $first_letter . $str_end;
1224
-    }
1223
+		return $first_letter . $str_end;
1224
+	}
1225 1225
 
1226
-    return ucfirst( $str );
1226
+	return ucfirst( $str );
1227 1227
 }
1228 1228
 
1229 1229
 function geodir_total_listings_count($post_type = false)
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since 1.4.6
14 14
  * @return int|null Return the page ID if present or null if not.
15 15
  */
16
-function geodir_add_listing_page_id(){
16
+function geodir_add_listing_page_id() {
17 17
     $gd_page_id = get_option('geodir_add_listing_page');
18 18
 
19 19
     if (geodir_is_wpml()) {
20
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
20
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
21 21
     }
22 22
 
23 23
     return $gd_page_id;
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
  * @since 1.4.6
31 31
  * @return int|null Return the page ID if present or null if not.
32 32
  */
33
-function geodir_preview_page_id(){
33
+function geodir_preview_page_id() {
34 34
     $gd_page_id = get_option('geodir_preview_page');
35 35
 
36 36
     if (geodir_is_wpml()) {
37
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
37
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
38 38
     }
39 39
 
40 40
     return $gd_page_id;
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * @since 1.4.6
48 48
  * @return int|null Return the page ID if present or null if not.
49 49
  */
50
-function geodir_success_page_id(){
50
+function geodir_success_page_id() {
51 51
     $gd_page_id = get_option('geodir_success_page');
52 52
 
53 53
     if (geodir_is_wpml()) {
54
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
54
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
55 55
     }
56 56
 
57 57
     return $gd_page_id;
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
  * @since 1.4.6
65 65
  * @return int|null Return the page ID if present or null if not.
66 66
  */
67
-function geodir_location_page_id(){
67
+function geodir_location_page_id() {
68 68
     $gd_page_id = get_option('geodir_location_page');
69 69
 
70 70
     if (geodir_is_wpml()) {
71
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
71
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
72 72
     }
73 73
 
74 74
     return $gd_page_id;
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
  * @since 1.5.4
82 82
  * @return int|null Return the page ID if present or null if not.
83 83
  */
84
-function geodir_home_page_id(){
84
+function geodir_home_page_id() {
85 85
     $gd_page_id = get_option('geodir_home_page');
86 86
 
87 87
     if (geodir_is_wpml()) {
88
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
88
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
89 89
     }
90 90
 
91 91
     return $gd_page_id;
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
  * @since 1.5.3
99 99
  * @return int|null Return the page ID if present or null if not.
100 100
  */
101
-function geodir_info_page_id(){
101
+function geodir_info_page_id() {
102 102
     $gd_page_id = get_option('geodir_info_page');
103 103
 
104 104
     if (geodir_is_wpml()) {
105
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
105
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
106 106
     }
107 107
 
108 108
     return $gd_page_id;
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
  * @since 1.5.3
116 116
  * @return int|null Return the page ID if present or null if not.
117 117
  */
118
-function geodir_login_page_id(){
118
+function geodir_login_page_id() {
119 119
     $gd_page_id = get_option('geodir_login_page');
120 120
 
121 121
     if (geodir_is_wpml()) {
122
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
122
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
123 123
     }
124 124
 
125 125
     return $gd_page_id;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
  * @since 1.5.3
134 134
  * @return int|null Return the page ID if present or null if not.
135 135
  */
136
-function geodir_login_url($args=array()){
136
+function geodir_login_url($args = array()) {
137 137
     $gd_page_id = get_option('geodir_login_page');
138 138
 
139 139
     if (geodir_is_wpml()) {
140
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
140
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
141 141
     }
142 142
 
143 143
     if (function_exists('geodir_location_geo_home_link')) {
144 144
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
145 145
     }
146 146
 
147
-    if (geodir_is_wpml()){
147
+    if (geodir_is_wpml()) {
148 148
         $home_url = icl_get_home_url();
149
-    }else{
149
+    } else {
150 150
         $home_url = home_url();
151 151
     }
152 152
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
155 155
     }
156 156
 
157
-    if($gd_page_id){
157
+    if ($gd_page_id) {
158 158
         $post = get_post($gd_page_id);
159 159
         $slug = $post->post_name;
160 160
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
161 161
         $login_url = trailingslashit($home_url)."$slug/";
162
-    }else{
162
+    } else {
163 163
         $login_url = trailingslashit($home_url)."?geodir_signup=true";
164 164
     }
165 165
 
166
-    if($args){
167
-        $login_url = add_query_arg($args,$login_url );
166
+    if ($args) {
167
+        $login_url = add_query_arg($args, $login_url);
168 168
     }
169 169
 
170 170
     /**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      * @param array $args The array of query args used.
179 179
      * @param int $gd_page_id The page id of the GD login page.
180 180
      */
181
-	    return apply_filters('geodir_login_url',$login_url,$args,$gd_page_id);
181
+	    return apply_filters('geodir_login_url', $login_url, $args, $gd_page_id);
182 182
 }
183 183
 
184 184
 /**
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
  * @since 1.5.16 Added WPML lang code to url.
190 190
  * @return string Info page url.
191 191
  */
192
-function geodir_info_url($args=array()){
192
+function geodir_info_url($args = array()) {
193 193
     $gd_page_id = get_option('geodir_info_page');
194 194
 
195 195
     if (geodir_is_wpml()) {
196
-        $gd_page_id =  geodir_wpml_object_id($gd_page_id, 'page', true);
196
+        $gd_page_id = geodir_wpml_object_id($gd_page_id, 'page', true);
197 197
     }
198 198
 
199 199
     if (function_exists('geodir_location_geo_home_link')) {
200 200
         remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
201 201
     }
202 202
 
203
-    if (geodir_is_wpml()){
203
+    if (geodir_is_wpml()) {
204 204
         $home_url = icl_get_home_url();
205
-    }else{
205
+    } else {
206 206
         $home_url = home_url();
207 207
     }
208 208
 
@@ -210,17 +210,17 @@  discard block
 block discarded – undo
210 210
         add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
211 211
     }
212 212
 
213
-    if($gd_page_id){
213
+    if ($gd_page_id) {
214 214
         $post = get_post($gd_page_id);
215 215
         $slug = $post->post_name;
216 216
         //$login_url = get_permalink($gd_page_id );// get_permalink can only be user after theme-Setup hook, any earlier and it errors
217 217
         $info_url = trailingslashit($home_url)."$slug/";
218
-    }else{
218
+    } else {
219 219
         $info_url = trailingslashit($home_url);
220 220
     }
221 221
 
222
-    if($args){
223
-        $info_url = add_query_arg($args,$info_url );
222
+    if ($args) {
223
+        $info_url = add_query_arg($args, $info_url);
224 224
     }
225 225
 
226 226
     return $info_url;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
  * @param string $charset Character set to use for conversion.
239 239
  * @return string Returns converted string.
240 240
  */
241
-function geodir_ucwords($string, $charset='UTF-8') {
241
+function geodir_ucwords($string, $charset = 'UTF-8') {
242 242
     if (function_exists('mb_convert_case')) {
243 243
         return mb_convert_case($string, MB_CASE_TITLE, $charset);
244 244
     } else {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
  * @param string $charset Character set to use for conversion.
259 259
  * @return string Returns converted string.
260 260
  */
261
-function geodir_strtolower($string, $charset='UTF-8') {
261
+function geodir_strtolower($string, $charset = 'UTF-8') {
262 262
     if (function_exists('mb_convert_case')) {
263 263
         return mb_convert_case($string, MB_CASE_LOWER, $charset);
264 264
     } else {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
  * @param string $charset Character set to use for conversion.
279 279
  * @return string Returns converted string.
280 280
  */
281
-function geodir_strtoupper($string, $charset='UTF-8') {
281
+function geodir_strtoupper($string, $charset = 'UTF-8') {
282 282
     if (function_exists('mb_convert_case')) {
283 283
         return mb_convert_case($string, MB_CASE_UPPER, $charset);
284 284
     } else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	
310 310
 	$url = trim($parts[0]);
311 311
 	if ($formatted && $url != '') {
312
-		$url = str_replace( ' ', '%20', $url );
312
+		$url = str_replace(' ', '%20', $url);
313 313
 		$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url);
314 314
 		
315 315
 		if (0 !== stripos($url, 'mailto:')) {
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 		
320 320
 		$url = str_replace(';//', '://', $url);
321 321
 		
322
-		if (strpos($url, ':') === false && ! in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
-			$url = 'http://' . $url;
322
+		if (strpos($url, ':') === false && !in_array($url[0], array('/', '#', '?')) && !preg_match('/^[a-z0-9-]+?\.php/i', $url)) {
323
+			$url = 'http://'.$url;
324 324
 		}
325 325
 		
326 326
 		$url = wp_kses_normalize_entities($url);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @package GeoDirectory
463 463
  */
464 464
 function _gd_die_handler() {
465
-    if ( defined( 'GD_TESTING_MODE' ) ) {
465
+    if (defined('GD_TESTING_MODE')) {
466 466
         return '_gd_die_handler';
467 467
     } else {
468 468
         die();
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
  * @param string $title   Optional. Error title.
481 481
  * @param int $status     Optional. Status code.
482 482
  */
483
-function gd_die( $message = '', $title = '', $status = 400 ) {
484
-    add_filter( 'wp_die_ajax_handler', '_gd_die_handler', 10, 3 );
485
-    add_filter( 'wp_die_handler', '_gd_die_handler', 10, 3 );
486
-    wp_die( $message, $title, array( 'response' => $status ));
483
+function gd_die($message = '', $title = '', $status = 400) {
484
+    add_filter('wp_die_ajax_handler', '_gd_die_handler', 10, 3);
485
+    add_filter('wp_die_handler', '_gd_die_handler', 10, 3);
486
+    wp_die($message, $title, array('response' => $status));
487 487
 }
488 488
 
489 489
 /*
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  * @param string $php_format The PHP date format.
494 494
  * @return string The jQuery format date string.
495 495
  */
496
-function geodir_date_format_php_to_jqueryui( $php_format ) {
496
+function geodir_date_format_php_to_jqueryui($php_format) {
497 497
 	$symbols = array(
498 498
 		// Day
499 499
 		'd' => 'dd',
@@ -533,27 +533,27 @@  discard block
 block discarded – undo
533 533
 	$jqueryui_format = "";
534 534
 	$escaping = false;
535 535
 
536
-	for ( $i = 0; $i < strlen( $php_format ); $i++ ) {
536
+	for ($i = 0; $i < strlen($php_format); $i++) {
537 537
 		$char = $php_format[$i];
538 538
 
539 539
 		// PHP date format escaping character
540
-		if ( $char === '\\' ) {
540
+		if ($char === '\\') {
541 541
 			$i++;
542 542
 
543
-			if ( $escaping ) {
543
+			if ($escaping) {
544 544
 				$jqueryui_format .= $php_format[$i];
545 545
 			} else {
546
-				$jqueryui_format .= '\'' . $php_format[$i];
546
+				$jqueryui_format .= '\''.$php_format[$i];
547 547
 			}
548 548
 
549 549
 			$escaping = true;
550 550
 		} else {
551
-			if ( $escaping ) {
551
+			if ($escaping) {
552 552
 				$jqueryui_format .= "'";
553 553
 				$escaping = false;
554 554
 			}
555 555
 
556
-			if ( isset( $symbols[$char] ) ) {
556
+			if (isset($symbols[$char])) {
557 557
 				$jqueryui_format .= $symbols[$char];
558 558
 			} else {
559 559
 				$jqueryui_format .= $char;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		'December',
592 592
 	);
593 593
 
594
-	$non_english_long_months  = array(
594
+	$non_english_long_months = array(
595 595
 		__('January'),
596 596
 		__('February'),
597 597
 		__('March'),
@@ -605,10 +605,10 @@  discard block
 block discarded – undo
605 605
 		__('November'),
606 606
 		__('December'),
607 607
 	);
608
-	$date = str_replace($non_english_long_months,$english_long_months,$date);
608
+	$date = str_replace($non_english_long_months, $english_long_months, $date);
609 609
     
610
-	if ( !empty( $wp_locale ) ) {
611
-		$date = str_replace( array_values( $wp_locale->month_genitive ), $english_long_months, $date );
610
+	if (!empty($wp_locale)) {
611
+		$date = str_replace(array_values($wp_locale->month_genitive), $english_long_months, $date);
612 612
 	}
613 613
 
614 614
 	$english_short_months = array(
@@ -627,21 +627,21 @@  discard block
 block discarded – undo
627 627
 	);
628 628
 
629 629
 	$non_english_short_months = array(
630
-		' '._x( 'Jan', 'January abbreviation' ).' ',
631
-		' '._x( 'Feb', 'February abbreviation' ).' ',
632
-		' '._x( 'Mar', 'March abbreviation' ).' ',
633
-		' '._x( 'Apr', 'April abbreviation' ).' ',
634
-		' '._x( 'May', 'May abbreviation' ).' ',
635
-		' '._x( 'Jun', 'June abbreviation' ).' ',
636
-		' '._x( 'Jul', 'July abbreviation' ).' ',
637
-		' '._x( 'Aug', 'August abbreviation' ).' ',
638
-		' '._x( 'Sep', 'September abbreviation' ).' ',
639
-		' '._x( 'Oct', 'October abbreviation' ).' ',
640
-		' '._x( 'Nov', 'November abbreviation' ).' ',
641
-		' '._x( 'Dec', 'December abbreviation' ).' ',
630
+		' '._x('Jan', 'January abbreviation').' ',
631
+		' '._x('Feb', 'February abbreviation').' ',
632
+		' '._x('Mar', 'March abbreviation').' ',
633
+		' '._x('Apr', 'April abbreviation').' ',
634
+		' '._x('May', 'May abbreviation').' ',
635
+		' '._x('Jun', 'June abbreviation').' ',
636
+		' '._x('Jul', 'July abbreviation').' ',
637
+		' '._x('Aug', 'August abbreviation').' ',
638
+		' '._x('Sep', 'September abbreviation').' ',
639
+		' '._x('Oct', 'October abbreviation').' ',
640
+		' '._x('Nov', 'November abbreviation').' ',
641
+		' '._x('Dec', 'December abbreviation').' ',
642 642
 	);
643 643
 
644
-	$date = str_replace($non_english_short_months,$english_short_months,$date);
644
+	$date = str_replace($non_english_short_months, $english_short_months, $date);
645 645
 
646 646
 
647 647
 	return $date;
@@ -659,30 +659,30 @@  discard block
 block discarded – undo
659 659
  * @param bool $locale True to retrieve the date in localized format. Default false.
660 660
  * @return string The formatted date.
661 661
  */
662
-function geodir_date( $date_input, $date_to, $date_from = '', $locale = false ) {
663
-    if ( empty( $date_input ) || empty( $date_to ) ) {
662
+function geodir_date($date_input, $date_to, $date_from = '', $locale = false) {
663
+    if (empty($date_input) || empty($date_to)) {
664 664
         return NULL;
665 665
     }
666 666
     
667
-    $date_input = geodir_maybe_untranslate_date( $date_input );
667
+    $date_input = geodir_maybe_untranslate_date($date_input);
668 668
     
669 669
     $timestamp = 0;
670
-    if (!empty( $date_from ) && function_exists( 'date_create_from_format' ) ) {
671
-        $datetime = date_create_from_format( $date_from, $date_input );
672
-        if ( !empty( $datetime ) ) {
670
+    if (!empty($date_from) && function_exists('date_create_from_format')) {
671
+        $datetime = date_create_from_format($date_from, $date_input);
672
+        if (!empty($datetime)) {
673 673
             $timestamp = $datetime->getTimestamp();
674 674
         }
675 675
     }
676 676
     
677
-    if ( empty( $timestamp ) ) {
678
-        $date = strpos( $date_input, '/' ) !== false ? str_replace( '/', '-', $date_input ) : $date_input;
679
-        $timestamp = strtotime( $date );
677
+    if (empty($timestamp)) {
678
+        $date = strpos($date_input, '/') !== false ? str_replace('/', '-', $date_input) : $date_input;
679
+        $timestamp = strtotime($date);
680 680
     }
681 681
     
682
-    $date = date_i18n( $date_to, $timestamp );
682
+    $date = date_i18n($date_to, $timestamp);
683 683
     
684
-    if ( !$locale ) {
685
-        $date = geodir_maybe_untranslate_date( $date );
684
+    if (!$locale) {
685
+        $date = geodir_maybe_untranslate_date($date);
686 686
     }
687 687
     
688 688
     /**
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
      * @param string $date_from The source date format.
698 698
      * @param bool $locale True to retrieve the date in localized format.
699 699
      */
700
-    return apply_filters( 'geodir_date', $date, $date_input, $date_to, $date_from, $locale );
700
+    return apply_filters('geodir_date', $date, $date_input, $date_to, $date_from, $locale);
701 701
 }
702 702
 
703 703
 /**
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
  * @return string Trimmed string.
723 723
  */
724 724
 function geodir_excerpt($text, $length = 100, $options = array()) {
725
-    if (!(int)$length > 0) {
725
+    if (!(int) $length > 0) {
726 726
         return $text;
727 727
     }
728 728
     $default = array(
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
         $length = $truncateLength;
785 785
 
786 786
         foreach ($openTags as $tag) {
787
-            $suffix .= '</' . $tag . '>';
787
+            $suffix .= '</'.$tag.'>';
788 788
         }
789 789
     } else {
790 790
         if (geodir_strlen($text, $options) <= $length) {
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
         }
807 807
     }
808 808
 
809
-    return $prefix . $result . $suffix;
809
+    return $prefix.$result.$suffix;
810 810
 }
811 811
 
812 812
 /**
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
     $pattern = '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|&#x[0-9a-f]{1,6};/i';
844 844
     $replace = preg_replace_callback(
845 845
         $pattern,
846
-        function ($match) use ($strlen) {
846
+        function($match) use ($strlen) {
847 847
             $utf8 = html_entity_decode($match[0], ENT_HTML5 | ENT_QUOTES, 'UTF-8');
848 848
 
849 849
             return str_repeat(' ', $strlen($utf8, 'UTF-8'));
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
     }
905 905
 
906 906
     if (empty($options['html'])) {
907
-        return (string)$substr($text, $start, $length);
907
+        return (string) $substr($text, $start, $length);
908 908
     }
909 909
 
910 910
     $totalOffset = 0;
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
         $len = geodir_strlen($part, $options);
931 931
         if ($offset !== 0 || $totalLength + $len > $length) {
932
-            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8') ) {
932
+            if (strpos($part, '&') === 0 && preg_match($pattern, $part) && $part !== html_entity_decode($part, ENT_HTML5 | ENT_QUOTES, 'UTF-8')) {
933 933
                 // Entities cannot be passed substr.
934 934
                 continue;
935 935
             }
@@ -975,39 +975,39 @@  discard block
 block discarded – undo
975 975
     return '';
976 976
 }
977 977
 
978
-function geodir_tool_restore_cpt_from_taxonomies(){
978
+function geodir_tool_restore_cpt_from_taxonomies() {
979 979
 
980 980
 	$cpts = get_option('geodir_post_types');
981 981
 
982
-	if(!empty($cpts)){return;}
982
+	if (!empty($cpts)) {return; }
983 983
 
984 984
 	$taxonomies = get_option('geodir_taxonomies');
985 985
 
986
-	if(empty($taxonomies)){return;}
986
+	if (empty($taxonomies)) {return; }
987 987
 
988 988
 	$cpts = array();
989 989
 
990
-	foreach($taxonomies as $key => $val){
990
+	foreach ($taxonomies as $key => $val) {
991 991
 
992
-		if(strpos($val['listing_slug'], '/') === false) {
993
-			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'],'slug'=>$val['listing_slug']);
992
+		if (strpos($val['listing_slug'], '/') === false) {
993
+			$cpts[$val['object_type']] = array('cpt'=>$val['object_type'], 'slug'=>$val['listing_slug']);
994 994
 		}
995 995
 
996 996
 	}
997 997
 
998
-	if(empty($cpts)){return;}
998
+	if (empty($cpts)) {return; }
999 999
 
1000 1000
 
1001 1001
 	$cpts_restore = $cpts;
1002 1002
 
1003
-	foreach($cpts as $cpt){
1003
+	foreach ($cpts as $cpt) {
1004 1004
 
1005 1005
 
1006
-		$is_custom = $cpt['cpt']=='gd_place' ? 0 : 1;
1006
+		$is_custom = $cpt['cpt'] == 'gd_place' ? 0 : 1;
1007 1007
 
1008
-		$cpts_restore[$cpt['cpt']] = array (
1008
+		$cpts_restore[$cpt['cpt']] = array(
1009 1009
 				'labels' =>
1010
-					array (
1010
+					array(
1011 1011
 						'name' => $cpt['slug'],
1012 1012
 						'singular_name' => $cpt['slug'],
1013 1013
 						'add_new' => 'Add New',
@@ -1035,14 +1035,14 @@  discard block
 block discarded – undo
1035 1035
 				'public' => true,
1036 1036
 				'query_var' => true,
1037 1037
 				'rewrite' =>
1038
-					array (
1038
+					array(
1039 1039
 						'slug' => $cpt['slug'],
1040 1040
 						'with_front' => false,
1041 1041
 						'hierarchical' => true,
1042 1042
 						'feeds' => true,
1043 1043
 					),
1044 1044
 				'supports' =>
1045
-					array (
1045
+					array(
1046 1046
 						0 => 'title',
1047 1047
 						1 => 'editor',
1048 1048
 						2 => 'author',
@@ -1052,14 +1052,14 @@  discard block
 block discarded – undo
1052 1052
 						6 => 'comments',
1053 1053
 					),
1054 1054
 				'taxonomies' =>
1055
-					array (
1055
+					array(
1056 1056
 						0 => $cpt['cpt'].'category',
1057 1057
 						1 => $cpt['cpt'].'_tags',
1058 1058
 					),
1059 1059
 				'is_custom' => $is_custom,
1060 1060
 				'listing_order' => '1',
1061 1061
 				'seo' =>
1062
-					array (
1062
+					array(
1063 1063
 						'meta_keyword' => '',
1064 1064
 						'meta_description' => '',
1065 1065
 					),
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 	}
1072 1072
 
1073 1073
 
1074
-	update_option('geodir_post_types',$cpts_restore);
1074
+	update_option('geodir_post_types', $cpts_restore);
1075 1075
 
1076 1076
 }
1077 1077
 
@@ -1089,12 +1089,12 @@  discard block
 block discarded – undo
1089 1089
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1090 1090
  * @return string
1091 1091
  */
1092
-function geodir_utf8_strimwidth( $str, $start, $width, $trimmaker = '', $encoding = 'UTF-8' ) {
1093
-    if ( function_exists( 'mb_strimwidth' ) ) {
1094
-        return mb_strimwidth( $str, $start, $width, $trimmaker, $encoding );
1092
+function geodir_utf8_strimwidth($str, $start, $width, $trimmaker = '', $encoding = 'UTF-8') {
1093
+    if (function_exists('mb_strimwidth')) {
1094
+        return mb_strimwidth($str, $start, $width, $trimmaker, $encoding);
1095 1095
     }
1096 1096
     
1097
-    return geodir_utf8_substr( $str, $start, $width, $encoding ) . $trimmaker;
1097
+    return geodir_utf8_substr($str, $start, $width, $encoding).$trimmaker;
1098 1098
 }
1099 1099
 
1100 1100
 /**
@@ -1107,12 +1107,12 @@  discard block
 block discarded – undo
1107 1107
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1108 1108
  * @return int Returns the number of characters in string.
1109 1109
  */
1110
-function geodir_utf8_strlen( $str, $encoding = 'UTF-8' ) {
1111
-    if ( function_exists( 'mb_strlen' ) ) {
1112
-        return mb_strlen( $str, $encoding );
1110
+function geodir_utf8_strlen($str, $encoding = 'UTF-8') {
1111
+    if (function_exists('mb_strlen')) {
1112
+        return mb_strlen($str, $encoding);
1113 1113
     }
1114 1114
         
1115
-    return strlen( $str );
1115
+    return strlen($str);
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1127,12 +1127,12 @@  discard block
 block discarded – undo
1127 1127
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1128 1128
  * @return int Returns the position of the first occurrence of search in the string.
1129 1129
  */
1130
-function geodir_utf8_strpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1131
-    if ( function_exists( 'mb_strpos' ) ) {
1132
-        return mb_strpos( $str, $find, $offset, $encoding );
1130
+function geodir_utf8_strpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1131
+    if (function_exists('mb_strpos')) {
1132
+        return mb_strpos($str, $find, $offset, $encoding);
1133 1133
     }
1134 1134
         
1135
-    return strpos( $str, $find, $offset );
1135
+    return strpos($str, $find, $offset);
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1147,12 +1147,12 @@  discard block
 block discarded – undo
1147 1147
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1148 1148
  * @return int Returns the position of the last occurrence of search.
1149 1149
  */
1150
-function geodir_utf8_strrpos( $str, $find, $offset = 0, $encoding = 'UTF-8' ) {
1151
-    if ( function_exists( 'mb_strrpos' ) ) {
1152
-        return mb_strrpos( $str, $find, $offset, $encoding );
1150
+function geodir_utf8_strrpos($str, $find, $offset = 0, $encoding = 'UTF-8') {
1151
+    if (function_exists('mb_strrpos')) {
1152
+        return mb_strrpos($str, $find, $offset, $encoding);
1153 1153
     }
1154 1154
         
1155
-    return strrpos( $str, $find, $offset );
1155
+    return strrpos($str, $find, $offset);
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1168,16 +1168,16 @@  discard block
 block discarded – undo
1168 1168
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1169 1169
  * @return string
1170 1170
  */
1171
-function geodir_utf8_substr( $str, $start, $length = null, $encoding = 'UTF-8' ) {
1172
-    if ( function_exists( 'mb_substr' ) ) {
1173
-        if ( $length === null ) {
1174
-            return mb_substr( $str, $start, geodir_utf8_strlen( $str, $encoding ), $encoding );
1171
+function geodir_utf8_substr($str, $start, $length = null, $encoding = 'UTF-8') {
1172
+    if (function_exists('mb_substr')) {
1173
+        if ($length === null) {
1174
+            return mb_substr($str, $start, geodir_utf8_strlen($str, $encoding), $encoding);
1175 1175
         } else {
1176
-            return mb_substr( $str, $start, $length, $encoding );
1176
+            return mb_substr($str, $start, $length, $encoding);
1177 1177
         }
1178 1178
     }
1179 1179
         
1180
-    return substr( $str, $start, $length );
1180
+    return substr($str, $start, $length);
1181 1181
 }
1182 1182
 
1183 1183
 /**
@@ -1190,12 +1190,12 @@  discard block
 block discarded – undo
1190 1190
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1191 1191
  * @return string The width of string.
1192 1192
  */
1193
-function geodir_utf8_strwidth( $str, $encoding = 'UTF-8' ) {
1194
-	if ( function_exists( 'mb_strwidth' ) ) {
1195
-		return mb_strwidth( $str, $encoding );
1193
+function geodir_utf8_strwidth($str, $encoding = 'UTF-8') {
1194
+	if (function_exists('mb_strwidth')) {
1195
+		return mb_strwidth($str, $encoding);
1196 1196
 	}
1197 1197
 
1198
-	return geodir_utf8_strlen( $str, $encoding );
1198
+	return geodir_utf8_strlen($str, $encoding);
1199 1199
 }
1200 1200
 
1201 1201
 /**
@@ -1209,21 +1209,21 @@  discard block
 block discarded – undo
1209 1209
  * @param string $encoding The encoding parameter is the character encoding. Default "UTF-8".
1210 1210
  * @return string The resulting string.
1211 1211
  */
1212
-function geodir_utf8_ucfirst( $str, $lower_str_end = false, $encoding = 'UTF-8' ) {
1213
-    if ( function_exists( 'mb_strlen' ) ) {
1214
-        $first_letter = geodir_strtoupper( geodir_utf8_substr( $str, 0, 1, $encoding ), $encoding );
1212
+function geodir_utf8_ucfirst($str, $lower_str_end = false, $encoding = 'UTF-8') {
1213
+    if (function_exists('mb_strlen')) {
1214
+        $first_letter = geodir_strtoupper(geodir_utf8_substr($str, 0, 1, $encoding), $encoding);
1215 1215
         $str_end = "";
1216 1216
         
1217
-        if ( $lower_str_end ) {
1218
-            $str_end = geodir_strtolower( geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding ), $encoding );
1217
+        if ($lower_str_end) {
1218
+            $str_end = geodir_strtolower(geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding), $encoding);
1219 1219
         } else {
1220
-            $str_end = geodir_utf8_substr( $str, 1, geodir_utf8_strlen( $str, $encoding ), $encoding );
1220
+            $str_end = geodir_utf8_substr($str, 1, geodir_utf8_strlen($str, $encoding), $encoding);
1221 1221
         }
1222 1222
         
1223
-        return $first_letter . $str_end;
1223
+        return $first_letter.$str_end;
1224 1224
     }
1225 1225
 
1226
-    return ucfirst( $str );
1226
+    return ucfirst($str);
1227 1227
 }
1228 1228
 
1229 1229
 function geodir_total_listings_count($post_type = false)
@@ -1233,13 +1233,13 @@  discard block
 block discarded – undo
1233 1233
 	$count = 0;
1234 1234
 	
1235 1235
 	if ($post_type) {
1236
-		$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $post_type . "_detail");
1236
+		$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$post_type."_detail");
1237 1237
 	} else {
1238 1238
 		$all_postypes = geodir_get_posttypes();
1239 1239
 
1240 1240
 		if (!empty($all_postypes)) {
1241 1241
 			foreach ($all_postypes as $key) {
1242
-				$count = $count + $wpdb->get_var("select count(post_id) from " . $wpdb->prefix . "geodir_" . $key . "_detail");
1242
+				$count = $count + $wpdb->get_var("select count(post_id) from ".$wpdb->prefix."geodir_".$key."_detail");
1243 1243
 			}
1244 1244
 		}	
1245 1245
 	}
Please login to merge, or discard this patch.
geodirectory-templates/listing-filter-form.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,26 +13,26 @@  discard block
 block discarded – undo
13 13
 global $wp_query, $current_term, $query;
14 14
 
15 15
 if (function_exists('geodir_location_geo_home_link')) {
16
-    remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
16
+	remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17 17
 }
18 18
 
19 19
 if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
20
-    $search_url = icl_get_home_url();
20
+	$search_url = icl_get_home_url();
21 21
 } else {
22
-    $search_url = get_home_url();
22
+	$search_url = get_home_url();
23 23
 }
24 24
 
25 25
 $search_url = trailingslashit($search_url);
26 26
 
27 27
 if (function_exists('geodir_location_geo_home_link')) {
28
-    add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
28
+	add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2);
29 29
 }
30 30
 
31 31
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
32 32
 $form_class = 'geodir-listing-search';
33 33
 
34 34
 if($new_style){
35
-    $form_class .= ' gd-search-bar-style';
35
+	$form_class .= ' gd-search-bar-style';
36 36
 }
37 37
 ?>
38 38
 <form class="<?php
@@ -49,56 +49,56 @@  discard block
 block discarded – undo
49 49
     <div class="geodir-loc-bar">
50 50
 
51 51
         <?php
52
-        /**
53
-         * Called inside the search form but before any of the fields.
54
-         *
55
-         * @since 1.0.0
56
-         */
57
-        do_action('geodir_before_search_form') ?>
52
+		/**
53
+		 * Called inside the search form but before any of the fields.
54
+		 *
55
+		 * @since 1.0.0
56
+		 */
57
+		do_action('geodir_before_search_form') ?>
58 58
 
59 59
         <div class="clearfix geodir-loc-bar-in">
60 60
             <div class="geodir-search">
61 61
 
62 62
                 <?php
63 63
 
64
-                /**
65
-                 * Adds the input fields to the search form.
66
-                 *
67
-                 * @since 1.6.9
68
-                 */
69
-                do_action('geodir_search_form_inputs');
64
+				/**
65
+				 * Adds the input fields to the search form.
66
+				 *
67
+				 * @since 1.6.9
68
+				 */
69
+				do_action('geodir_search_form_inputs');
70 70
 
71 71
 
72 72
 
73
-                /**
74
-                 * Called on the GD search form just before the search button.
75
-                 *
76
-                 * @since 1.0.0
77
-                 */
78
-                do_action('geodir_before_search_button');
73
+				/**
74
+				 * Called on the GD search form just before the search button.
75
+				 *
76
+				 * @since 1.0.0
77
+				 */
78
+				do_action('geodir_before_search_button');
79 79
 
80 80
                 
81
-                /**
82
-                 * Called on the GD search form just after the search button.
83
-                 *
84
-                 * @since 1.0.0
85
-                 */
86
-                do_action('geodir_after_search_button');
81
+				/**
82
+				 * Called on the GD search form just after the search button.
83
+				 *
84
+				 * @since 1.0.0
85
+				 */
86
+				do_action('geodir_after_search_button');
87 87
 
88 88
                 
89
-                ?>
89
+				?>
90 90
             </div>
91 91
 
92 92
 
93 93
         </div>
94 94
 
95 95
         <?php
96
-        /**
97
-         * Called inside the search form but after all the input fields.
98
-         *
99
-         * @since 1.0.0
100
-         */
101
-        do_action('geodir_after_search_form') ?>
96
+		/**
97
+		 * Called inside the search form but after all the input fields.
98
+		 *
99
+		 * @since 1.0.0
100
+		 */
101
+		do_action('geodir_after_search_form') ?>
102 102
 
103 103
 
104 104
     </div>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     remove_filter('home_url', 'geodir_location_geo_home_link', 100000);
17 17
 }
18 18
 
19
-if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX){
19
+if (geodir_is_wpml() && defined('DOING_AJAX') && DOING_AJAX) {
20 20
     $search_url = icl_get_home_url();
21 21
 } else {
22 22
     $search_url = get_home_url();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $new_style = get_option('geodir_show_search_old_search_from') ? false : true;
32 32
 $form_class = 'geodir-listing-search';
33 33
 
34
-if($new_style){
34
+if ($new_style) {
35 35
     $form_class .= ' gd-search-bar-style';
36 36
 }
37 37
 ?>
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/title_meta_settings_array.php 2 patches
Indentation   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $gd_wpseo_use = '';
12 12
 if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
13
-    $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />";
13
+	$gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />";
14 14
 }
15 15
 
16 16
 /**
@@ -21,375 +21,375 @@  discard block
 block discarded – undo
21 21
  */
22 22
 $geodir_settings['title_meta_settings'] = apply_filters('geodir_title_meta_settings', array(
23 23
 
24
-    /* Listing Permalink Settings start */
25
-    array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '),
24
+	/* Listing Permalink Settings start */
25
+	array('name' => __('Title / Meta', 'geodirectory'), 'type' => 'no_tabs', 'desc' => 'Settings to set page title and meta', 'id' => 'geodir_title_meta_settings '),
26 26
 
27
-    array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'),
28
-        'desc' => '%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%location_country%%, %%in_location_country%%, %%location_region%%, %%in_location_region%%, %%location_city%%, %%in_location_city%%, %%location_sep%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%',
29
-        'type' => 'sectionstart',
30
-        'id' => 'geodir_meta_vars'),
27
+	array('name' => $gd_wpseo_use.__('Available Variables', 'geodirectory'),
28
+		'desc' => '%%title%%, %%sitename%%, %%sitedesc%%, %%excerpt%%, %%pt_single%%, %%pt_plural%%, %%category%%, %%id%%, %%sep%%, %%location%%, %%in_location%%, %%in_location_single%%, %%location_single%%, %%location_country%%, %%in_location_country%%, %%location_region%%, %%in_location_region%%, %%location_city%%, %%in_location_city%%, %%location_sep%%, %%search_term%%, %%search_near%%, %%name%%, %%page%%, %%pagenumber%%, %%pagetotal%%',
29
+		'type' => 'sectionstart',
30
+		'id' => 'geodir_meta_vars'),
31 31
 
32
-    array('type' => 'sectionend', 'id' => 'geodir_meta_vars'),
32
+	array('type' => 'sectionend', 'id' => 'geodir_meta_vars'),
33 33
     
34
-    array('name' => __('Title & Metas Settings', 'geodirectory'),
35
-        'type' => 'sectionstart',
36
-        'desc' => '',
37
-        'id' => 'geodir_titles_and_metas'),
38
-
39
-    array(  
40
-        'name' => __( 'Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory' ),
41
-        'desc' => __( 'This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory' ),
42
-        'id' => 'geodir_disable_yoast_meta',
43
-        'type' => 'checkbox',
44
-        'std' => '0'
45
-    ),
46
-
47
-    array('type' => 'sectionend', 'id' => 'geodir_titles_and_metas'),
48
-
49
-    array('name' => __('Homepage Meta Settings', 'geodirectory'),
50
-        'type' => 'sectionstart',
51
-        'desc' => '',
52
-        'id' => 'geodir_home_meta'),
53
-
54
-    array(
55
-        'name' => __('Homepage meta title', 'geodirectory'),
56
-        'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'),
57
-        'id' => 'geodir_meta_title_homepage',
58
-        'type' => 'text',
59
-        'css' => 'width:100%;',
60
-        'std' => '',
61
-        'placeholder' => ''
62
-    ),
63
-
64
-    array(
65
-        'name' => __('Homepage meta description', 'geodirectory'),
66
-        'desc' => __('Enter the meta description for the homepage.', 'geodirectory'),
67
-        'id' => 'geodir_meta_desc_homepage',
68
-        'type' => 'textarea',
69
-        'css' => 'width:100%;',
70
-        'std' => ''
71
-    ),
72
-
73
-    array('type' => 'sectionend', 'id' => 'geodir_home_meta'),
74
-
75
-    // details page meta
76
-    array('name' => __('Details Page Meta Settings', 'geodirectory'),
77
-        'type' => 'sectionstart',
78
-        'desc' => '',
79
-        'id' => 'geodir_details_meta'),
80
-
81
-    array(
82
-        'name' => __('Details page meta title', 'geodirectory'),
83
-        'desc' => __('Enter the meta title for the details page.', 'geodirectory'),
84
-        'id' => 'geodir_meta_title_detail',
85
-        'type' => 'text',
86
-        'css' => 'width:100%;',
87
-        'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
88
-        'placeholder' => '%%title%% %%sep%% %%sitename%%'
89
-    ),
90
-
91
-    array(
92
-        'name' => __('Details page meta description', 'geodirectory'),
93
-        'desc' => __('Enter the meta description for the details page.', 'geodirectory'),
94
-        'id' => 'geodir_meta_desc_detail',
95
-        'type' => 'textarea',
96
-        'css' => 'width:100%;',
97
-        'std' => __('%%excerpt%%', 'geodirectory'),
98
-        'placeholder' => '%%excerpt%%'
99
-    ),
100
-
101
-    array('type' => 'sectionend', 'id' => 'geodir_details_meta'),
102
-
103
-    // CPT page meta
104
-    array('name' => __('Post Type Page Meta Settings', 'geodirectory'),
105
-        'type' => 'sectionstart',
106
-        'desc' => '',
107
-        'id' => 'geodir_pt_meta'),
108
-
109
-    array(
110
-        'name' => __('Post type page meta title', 'geodirectory'),
111
-        'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'),
112
-        'id' => 'geodir_meta_title_pt',
113
-        'type' => 'text',
114
-        'css' => 'width:100%;',
115
-        'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
116
-        'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%'
117
-    ),
118
-
119
-    array(
120
-        'name' => __('Post type page meta description', 'geodirectory'),
121
-        'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'),
122
-        'id' => 'geodir_meta_desc_pt',
123
-        'type' => 'textarea',
124
-        'css' => 'width:100%;',
125
-        'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'),
126
-        'placeholder' => '%%pt_plural%% %%in_location%%'
127
-    ),
128
-
129
-    array(
130
-        'name' => __('Post type page title', 'geodirectory'),
131
-        'desc' => __('Enter the title for the post type pages.', 'geodirectory'),
132
-        'id' => 'geodir_page_title_pt',
133
-        'type' => 'text',
134
-        'css' => 'width:100%;',
135
-        'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'),
136
-        'placeholder' => 'All %%pt_plural%% %%in_location_single%%'
137
-    ),
138
-
139
-    array('type' => 'sectionend', 'id' => 'geodir_pt_meta'),
140
-
141
-    // Cat listing page meta
142
-    array('name' => __('Listing Page Meta Settings', 'geodirectory'),
143
-        'type' => 'sectionstart',
144
-        'desc' => '',
145
-        'id' => 'geodir_pt_meta'),
146
-
147
-    array(
148
-        'name' => __('Listing page meta title', 'geodirectory'),
149
-        'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'),
150
-        'id' => 'geodir_meta_title_listing',
151
-        'type' => 'text',
152
-        'css' => 'width:100%;',
153
-        'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
154
-        'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%'
155
-    ),
156
-
157
-    array(
158
-        'name' => __('Listing page meta description', 'geodirectory'),
159
-        'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'),
160
-        'id' => 'geodir_meta_desc_listing',
161
-        'type' => 'textarea',
162
-        'css' => 'width:100%;',
163
-        'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'),
164
-        'placeholder' => 'Posts related to Category: %%category%% %%in_location%%'
165
-    ),
166
-
167
-    array(
168
-        'name' => __('Category listing page title', 'geodirectory'),
169
-        'desc' => __('Enter the title for the category listing pages.', 'geodirectory'),
170
-        'id' => 'geodir_page_title_cat-listing',
171
-        'type' => 'text',
172
-        'css' => 'width:100%;',
173
-        'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'),
174
-        'placeholder' => 'All %%category%% %%in_location_single%%'
175
-    ),
176
-
177
-    array(
178
-        'name' => __('Tag listing page title', 'geodirectory'),
179
-        'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'),
180
-        'id' => 'geodir_page_title_tag-listing',
181
-        'type' => 'text',
182
-        'css' => 'width:100%;',
183
-        'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'),
184
-        'placeholder' => 'Tag: %%tag%% %%in_location_single%%'
185
-    ),
186
-
187
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
188
-
189
-    // location page meta
190
-    array('name' => __('Location Page Meta Settings', 'geodirectory'),
191
-        'type' => 'sectionstart',
192
-        'desc' => '',
193
-        'id' => 'geodir_pt_meta'),
194
-
195
-    array(
196
-        'name' => __('Location page meta title', 'geodirectory'),
197
-        'desc' => __('Enter the meta title for the location pages.', 'geodirectory'),
198
-        'id' => 'geodir_meta_title_location',
199
-        'type' => 'text',
200
-        'css' => 'width:100%;',
201
-        'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'),
202
-        'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%'
203
-    ),
204
-
205
-    array(
206
-        'name' => __('Location page meta description', 'geodirectory'),
207
-        'desc' => __('Enter the meta description for the location pages.', 'geodirectory'),
208
-        'id' => 'geodir_meta_desc_location',
209
-        'type' => 'textarea',
210
-        'css' => 'width:100%;',
211
-        'std' => __('%%location%%', 'geodirectory'),
212
-        'placeholder' => '%%location%%'
213
-    ),
214
-
215
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
216
-
217
-    // Search page meta
218
-    array('name' => __('Search Page Meta Settings', 'geodirectory'),
219
-        'type' => 'sectionstart',
220
-        'desc' => '',
221
-        'id' => 'geodir_pt_meta'),
222
-
223
-    array(
224
-        'name' => __('Search page meta title', 'geodirectory'),
225
-        'desc' => __('Enter the meta title for the search page.', 'geodirectory'),
226
-        'id' => 'geodir_meta_title_search',
227
-        'type' => 'text',
228
-        'css' => 'width:100%;',
229
-        'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'),
230
-        'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%'
231
-    ),
232
-
233
-    array(
234
-        'name' => __('Search page meta description', 'geodirectory'),
235
-        'desc' => __('Enter the meta description for the search page.', 'geodirectory'),
236
-        'id' => 'geodir_meta_desc_search',
237
-        'type' => 'textarea',
238
-        'css' => 'width:100%;',
239
-        'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'),
240
-        'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%'
241
-    ),
242
-
243
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
244
-
245
-    //Add listing page meta
246
-    array('name' => __('Add Listing Page Meta Settings', 'geodirectory'),
247
-        'type' => 'sectionstart',
248
-        'desc' => '',
249
-        'id' => 'geodir_pt_meta'),
250
-
251
-    array(
252
-        'name' => __('Add listing page meta title', 'geodirectory'),
253
-        'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'),
254
-        'id' => 'geodir_meta_title_add-listing',
255
-        'type' => 'text',
256
-        'css' => 'width:100%;',
257
-        'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'),
258
-        'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%'
259
-    ),
260
-
261
-    array(
262
-        'name' => __('Add listing page meta description', 'geodirectory'),
263
-        'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'),
264
-        'id' => 'geodir_meta_desc_add-listing',
265
-        'type' => 'textarea',
266
-        'css' => 'width:100%;',
267
-        'std' => __('Add %%pt_single%%', 'geodirectory'),
268
-        'placeholder' => 'Add %%pt_single%%'
269
-    ),
270
-
271
-    array(
272
-        'name' => __('Add listing page title', 'geodirectory'),
273
-        'desc' => __('Enter the title for the add listing page.', 'geodirectory'),
274
-        'id' => 'geodir_page_title_add-listing',
275
-        'type' => 'text',
276
-        'css' => 'width:100%;',
277
-        'std' => __('Add %%pt_single%%', 'geodirectory'),
278
-        'placeholder' => 'Add %%pt_single%%'
279
-    ),
280
-
281
-    array(
282
-        'name' => __('Edit listing page title', 'geodirectory'),
283
-        'desc' => __('Enter the title for the edit listing page.', 'geodirectory'),
284
-        'id' => 'geodir_page_title_edit-listing',
285
-        'type' => 'text',
286
-        'css' => 'width:100%;',
287
-        'std' => __('Edit %%pt_single%%', 'geodirectory'),
288
-        'placeholder' => 'Edit %%pt_single%%'
289
-    ),
290
-
291
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
292
-
293
-    //Author page meta
294
-    array('name' => __('Author Page Meta Settings', 'geodirectory'),
295
-        'type' => 'sectionstart',
296
-        'desc' => '',
297
-        'id' => 'geodir_pt_meta'),
298
-
299
-    array(
300
-        'name' => __('Author page meta title', 'geodirectory'),
301
-        'desc' => __('Enter the meta title for the author page.', 'geodirectory'),
302
-        'id' => 'geodir_meta_title_author',
303
-        'type' => 'text',
304
-        'css' => 'width:100%;',
305
-        'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'),
306
-        'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%'
307
-    ),
308
-
309
-    array(
310
-        'name' => __('Author page meta description', 'geodirectory'),
311
-        'desc' => __('Enter the meta description for the author page.', 'geodirectory'),
312
-        'id' => 'geodir_meta_desc_author',
313
-        'type' => 'textarea',
314
-        'css' => 'width:100%;',
315
-        'std' => ''
316
-    ),
317
-
318
-    array(
319
-        'name' => __('Author page title', 'geodirectory'),
320
-        'desc' => __('Enter the title for the author page.', 'geodirectory'),
321
-        'id' => 'geodir_page_title_author',
322
-        'type' => 'text',
323
-        'css' => 'width:100%;',
324
-        'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'),
325
-        'placeholder' => '%%pt_plural%% by: %%name%%'
326
-    ),
327
-
328
-    array(
329
-        'name' => __('Author favorite page title', 'geodirectory'),
330
-        'desc' => __('Enter the title for the author favorite page.', 'geodirectory'),
331
-        'id' => 'geodir_page_title_favorite',
332
-        'type' => 'text',
333
-        'css' => 'width:100%;',
334
-        'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'),
335
-        'placeholder' => '%%name%%: Favorite %%pt_plural%%'
336
-    ),
337
-
338
-    array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
339
-
340
-    //Login page meta
341
-    array('name' => __('Login Page Meta Settings', 'geodirectory'),
342
-        'type' => 'sectionstart',
343
-        'desc' => '',
344
-        'id' => 'geodir_login_meta'),
345
-
346
-    array(
347
-        'name' => __('Login page meta title', 'geodirectory'),
348
-        'desc' => __('Enter the meta title for the login page.', 'geodirectory'),
349
-        'id' => 'geodir_meta_title_login',
350
-        'type' => 'text',
351
-        'css' => 'width:100%;',
352
-        'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
353
-        'placeholder' => '%%title%% %%sep%% %%sitename%%'
354
-    ),
355
-
356
-    array(
357
-        'name' => __('Login page meta description', 'geodirectory'),
358
-        'desc' => __('Enter the meta description for the login page.', 'geodirectory'),
359
-        'id' => 'geodir_meta_desc_login',
360
-        'type' => 'textarea',
361
-        'css' => 'width:100%;',
362
-        'std' => ''
363
-    ),
364
-
365
-    array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
366
-
367
-    //Listing success page meta
368
-    array('name' => __('Listing Success Page Meta Settings', 'geodirectory'),
369
-        'type' => 'sectionstart',
370
-        'desc' => '',
371
-        'id' => 'geodir_login_meta'),
372
-
373
-    array(
374
-        'name' => __('Listing success page meta title', 'geodirectory'),
375
-        'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'),
376
-        'id' => 'geodir_meta_title_listing-success',
377
-        'type' => 'text',
378
-        'css' => 'width:100%;',
379
-        'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
380
-        'placeholder' => '%%title%% %%sep%% %%sitename%%'
381
-    ),
382
-
383
-    array(
384
-        'name' => __('Listing success page meta description', 'geodirectory'),
385
-        'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'),
386
-        'id' => 'geodir_meta_desc_listing-success',
387
-        'type' => 'textarea',
388
-        'css' => 'width:100%;',
389
-        'std' => ''
390
-    ),
391
-
392
-    array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
34
+	array('name' => __('Title & Metas Settings', 'geodirectory'),
35
+		'type' => 'sectionstart',
36
+		'desc' => '',
37
+		'id' => 'geodir_titles_and_metas'),
38
+
39
+	array(  
40
+		'name' => __( 'Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory' ),
41
+		'desc' => __( 'This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory' ),
42
+		'id' => 'geodir_disable_yoast_meta',
43
+		'type' => 'checkbox',
44
+		'std' => '0'
45
+	),
46
+
47
+	array('type' => 'sectionend', 'id' => 'geodir_titles_and_metas'),
48
+
49
+	array('name' => __('Homepage Meta Settings', 'geodirectory'),
50
+		'type' => 'sectionstart',
51
+		'desc' => '',
52
+		'id' => 'geodir_home_meta'),
53
+
54
+	array(
55
+		'name' => __('Homepage meta title', 'geodirectory'),
56
+		'desc' => __('This will use the title of the page set as frontpage if left blank.', 'geodirectory'),
57
+		'id' => 'geodir_meta_title_homepage',
58
+		'type' => 'text',
59
+		'css' => 'width:100%;',
60
+		'std' => '',
61
+		'placeholder' => ''
62
+	),
63
+
64
+	array(
65
+		'name' => __('Homepage meta description', 'geodirectory'),
66
+		'desc' => __('Enter the meta description for the homepage.', 'geodirectory'),
67
+		'id' => 'geodir_meta_desc_homepage',
68
+		'type' => 'textarea',
69
+		'css' => 'width:100%;',
70
+		'std' => ''
71
+	),
72
+
73
+	array('type' => 'sectionend', 'id' => 'geodir_home_meta'),
74
+
75
+	// details page meta
76
+	array('name' => __('Details Page Meta Settings', 'geodirectory'),
77
+		'type' => 'sectionstart',
78
+		'desc' => '',
79
+		'id' => 'geodir_details_meta'),
80
+
81
+	array(
82
+		'name' => __('Details page meta title', 'geodirectory'),
83
+		'desc' => __('Enter the meta title for the details page.', 'geodirectory'),
84
+		'id' => 'geodir_meta_title_detail',
85
+		'type' => 'text',
86
+		'css' => 'width:100%;',
87
+		'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
88
+		'placeholder' => '%%title%% %%sep%% %%sitename%%'
89
+	),
90
+
91
+	array(
92
+		'name' => __('Details page meta description', 'geodirectory'),
93
+		'desc' => __('Enter the meta description for the details page.', 'geodirectory'),
94
+		'id' => 'geodir_meta_desc_detail',
95
+		'type' => 'textarea',
96
+		'css' => 'width:100%;',
97
+		'std' => __('%%excerpt%%', 'geodirectory'),
98
+		'placeholder' => '%%excerpt%%'
99
+	),
100
+
101
+	array('type' => 'sectionend', 'id' => 'geodir_details_meta'),
102
+
103
+	// CPT page meta
104
+	array('name' => __('Post Type Page Meta Settings', 'geodirectory'),
105
+		'type' => 'sectionstart',
106
+		'desc' => '',
107
+		'id' => 'geodir_pt_meta'),
108
+
109
+	array(
110
+		'name' => __('Post type page meta title', 'geodirectory'),
111
+		'desc' => __('Enter the meta title for the post type pages.', 'geodirectory'),
112
+		'id' => 'geodir_meta_title_pt',
113
+		'type' => 'text',
114
+		'css' => 'width:100%;',
115
+		'std' => __('%%pt_plural%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
116
+		'placeholder' => '%%pt_plural%% %%in_location%% %%sep%% %%sitename%%'
117
+	),
118
+
119
+	array(
120
+		'name' => __('Post type page meta description', 'geodirectory'),
121
+		'desc' => __('Enter the meta description for the post type pages.', 'geodirectory'),
122
+		'id' => 'geodir_meta_desc_pt',
123
+		'type' => 'textarea',
124
+		'css' => 'width:100%;',
125
+		'std' => __('%%pt_plural%% %%in_location%%', 'geodirectory'),
126
+		'placeholder' => '%%pt_plural%% %%in_location%%'
127
+	),
128
+
129
+	array(
130
+		'name' => __('Post type page title', 'geodirectory'),
131
+		'desc' => __('Enter the title for the post type pages.', 'geodirectory'),
132
+		'id' => 'geodir_page_title_pt',
133
+		'type' => 'text',
134
+		'css' => 'width:100%;',
135
+		'std' => __('All %%pt_plural%% %%in_location_single%%', 'geodirectory'),
136
+		'placeholder' => 'All %%pt_plural%% %%in_location_single%%'
137
+	),
138
+
139
+	array('type' => 'sectionend', 'id' => 'geodir_pt_meta'),
140
+
141
+	// Cat listing page meta
142
+	array('name' => __('Listing Page Meta Settings', 'geodirectory'),
143
+		'type' => 'sectionstart',
144
+		'desc' => '',
145
+		'id' => 'geodir_pt_meta'),
146
+
147
+	array(
148
+		'name' => __('Listing page meta title', 'geodirectory'),
149
+		'desc' => __('Enter the meta title for the category listing pages.', 'geodirectory'),
150
+		'id' => 'geodir_meta_title_listing',
151
+		'type' => 'text',
152
+		'css' => 'width:100%;',
153
+		'std' => __('%%category%% %%in_location%% %%sep%% %%sitename%%', 'geodirectory'),
154
+		'placeholder' => '%%category%% %%in_location%% %%sep%% %%sitename%%'
155
+	),
156
+
157
+	array(
158
+		'name' => __('Listing page meta description', 'geodirectory'),
159
+		'desc' => __('Enter the meta description for the category listing pages.', 'geodirectory'),
160
+		'id' => 'geodir_meta_desc_listing',
161
+		'type' => 'textarea',
162
+		'css' => 'width:100%;',
163
+		'std' => __('Posts related to Category: %%category%% %%in_location%%', 'geodirectory'),
164
+		'placeholder' => 'Posts related to Category: %%category%% %%in_location%%'
165
+	),
166
+
167
+	array(
168
+		'name' => __('Category listing page title', 'geodirectory'),
169
+		'desc' => __('Enter the title for the category listing pages.', 'geodirectory'),
170
+		'id' => 'geodir_page_title_cat-listing',
171
+		'type' => 'text',
172
+		'css' => 'width:100%;',
173
+		'std' => __('All %%category%% %%in_location_single%%', 'geodirectory'),
174
+		'placeholder' => 'All %%category%% %%in_location_single%%'
175
+	),
176
+
177
+	array(
178
+		'name' => __('Tag listing page title', 'geodirectory'),
179
+		'desc' => __('Enter the title for the tag listing pages.', 'geodirectory'),
180
+		'id' => 'geodir_page_title_tag-listing',
181
+		'type' => 'text',
182
+		'css' => 'width:100%;',
183
+		'std' => __('Tag: %%tag%% %%in_location_single%%', 'geodirectory'),
184
+		'placeholder' => 'Tag: %%tag%% %%in_location_single%%'
185
+	),
186
+
187
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
188
+
189
+	// location page meta
190
+	array('name' => __('Location Page Meta Settings', 'geodirectory'),
191
+		'type' => 'sectionstart',
192
+		'desc' => '',
193
+		'id' => 'geodir_pt_meta'),
194
+
195
+	array(
196
+		'name' => __('Location page meta title', 'geodirectory'),
197
+		'desc' => __('Enter the meta title for the location pages.', 'geodirectory'),
198
+		'id' => 'geodir_meta_title_location',
199
+		'type' => 'text',
200
+		'css' => 'width:100%;',
201
+		'std' => __('%%title%% %%location%% %%sep%% %%sitename%%', 'geodirectory'),
202
+		'placeholder' => '%%title%% %%location%% %%sep%% %%sitename%%'
203
+	),
204
+
205
+	array(
206
+		'name' => __('Location page meta description', 'geodirectory'),
207
+		'desc' => __('Enter the meta description for the location pages.', 'geodirectory'),
208
+		'id' => 'geodir_meta_desc_location',
209
+		'type' => 'textarea',
210
+		'css' => 'width:100%;',
211
+		'std' => __('%%location%%', 'geodirectory'),
212
+		'placeholder' => '%%location%%'
213
+	),
214
+
215
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
216
+
217
+	// Search page meta
218
+	array('name' => __('Search Page Meta Settings', 'geodirectory'),
219
+		'type' => 'sectionstart',
220
+		'desc' => '',
221
+		'id' => 'geodir_pt_meta'),
222
+
223
+	array(
224
+		'name' => __('Search page meta title', 'geodirectory'),
225
+		'desc' => __('Enter the meta title for the search page.', 'geodirectory'),
226
+		'id' => 'geodir_meta_title_search',
227
+		'type' => 'text',
228
+		'css' => 'width:100%;',
229
+		'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%', 'geodirectory'),
230
+		'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%% %%sep%% %%sitename%%'
231
+	),
232
+
233
+	array(
234
+		'name' => __('Search page meta description', 'geodirectory'),
235
+		'desc' => __('Enter the meta description for the search page.', 'geodirectory'),
236
+		'id' => 'geodir_meta_desc_search',
237
+		'type' => 'textarea',
238
+		'css' => 'width:100%;',
239
+		'std' => __('%%pt_plural%% search results for %%search_term%%, Near %%search_near%%', 'geodirectory'),
240
+		'placeholder' => '%%pt_plural%% search results for %%search_term%%, Near %%search_near%%'
241
+	),
242
+
243
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
244
+
245
+	//Add listing page meta
246
+	array('name' => __('Add Listing Page Meta Settings', 'geodirectory'),
247
+		'type' => 'sectionstart',
248
+		'desc' => '',
249
+		'id' => 'geodir_pt_meta'),
250
+
251
+	array(
252
+		'name' => __('Add listing page meta title', 'geodirectory'),
253
+		'desc' => __('Enter the meta title for the add listing page.', 'geodirectory'),
254
+		'id' => 'geodir_meta_title_add-listing',
255
+		'type' => 'text',
256
+		'css' => 'width:100%;',
257
+		'std' => __('Add %%pt_single%% %%sep%% %%sitename%%', 'geodirectory'),
258
+		'placeholder' => 'Add %%pt_single%% %%sep%% %%sitename%%'
259
+	),
260
+
261
+	array(
262
+		'name' => __('Add listing page meta description', 'geodirectory'),
263
+		'desc' => __('Enter the meta description for the add listing page.', 'geodirectory'),
264
+		'id' => 'geodir_meta_desc_add-listing',
265
+		'type' => 'textarea',
266
+		'css' => 'width:100%;',
267
+		'std' => __('Add %%pt_single%%', 'geodirectory'),
268
+		'placeholder' => 'Add %%pt_single%%'
269
+	),
270
+
271
+	array(
272
+		'name' => __('Add listing page title', 'geodirectory'),
273
+		'desc' => __('Enter the title for the add listing page.', 'geodirectory'),
274
+		'id' => 'geodir_page_title_add-listing',
275
+		'type' => 'text',
276
+		'css' => 'width:100%;',
277
+		'std' => __('Add %%pt_single%%', 'geodirectory'),
278
+		'placeholder' => 'Add %%pt_single%%'
279
+	),
280
+
281
+	array(
282
+		'name' => __('Edit listing page title', 'geodirectory'),
283
+		'desc' => __('Enter the title for the edit listing page.', 'geodirectory'),
284
+		'id' => 'geodir_page_title_edit-listing',
285
+		'type' => 'text',
286
+		'css' => 'width:100%;',
287
+		'std' => __('Edit %%pt_single%%', 'geodirectory'),
288
+		'placeholder' => 'Edit %%pt_single%%'
289
+	),
290
+
291
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
292
+
293
+	//Author page meta
294
+	array('name' => __('Author Page Meta Settings', 'geodirectory'),
295
+		'type' => 'sectionstart',
296
+		'desc' => '',
297
+		'id' => 'geodir_pt_meta'),
298
+
299
+	array(
300
+		'name' => __('Author page meta title', 'geodirectory'),
301
+		'desc' => __('Enter the meta title for the author page.', 'geodirectory'),
302
+		'id' => 'geodir_meta_title_author',
303
+		'type' => 'text',
304
+		'css' => 'width:100%;',
305
+		'std' => __('Author: %%name%% %%sep%% %%sitename%%', 'geodirectory'),
306
+		'placeholder' => 'Author: %%name%% %%sep%% %%sitename%%'
307
+	),
308
+
309
+	array(
310
+		'name' => __('Author page meta description', 'geodirectory'),
311
+		'desc' => __('Enter the meta description for the author page.', 'geodirectory'),
312
+		'id' => 'geodir_meta_desc_author',
313
+		'type' => 'textarea',
314
+		'css' => 'width:100%;',
315
+		'std' => ''
316
+	),
317
+
318
+	array(
319
+		'name' => __('Author page title', 'geodirectory'),
320
+		'desc' => __('Enter the title for the author page.', 'geodirectory'),
321
+		'id' => 'geodir_page_title_author',
322
+		'type' => 'text',
323
+		'css' => 'width:100%;',
324
+		'std' => __('%%pt_plural%% by: %%name%%', 'geodirectory'),
325
+		'placeholder' => '%%pt_plural%% by: %%name%%'
326
+	),
327
+
328
+	array(
329
+		'name' => __('Author favorite page title', 'geodirectory'),
330
+		'desc' => __('Enter the title for the author favorite page.', 'geodirectory'),
331
+		'id' => 'geodir_page_title_favorite',
332
+		'type' => 'text',
333
+		'css' => 'width:100%;',
334
+		'std' => __('%%name%%: Favorite %%pt_plural%%', 'geodirectory'),
335
+		'placeholder' => '%%name%%: Favorite %%pt_plural%%'
336
+	),
337
+
338
+	array('type' => 'sectionend', 'id' => 'geodir_location_meta'),
339
+
340
+	//Login page meta
341
+	array('name' => __('Login Page Meta Settings', 'geodirectory'),
342
+		'type' => 'sectionstart',
343
+		'desc' => '',
344
+		'id' => 'geodir_login_meta'),
345
+
346
+	array(
347
+		'name' => __('Login page meta title', 'geodirectory'),
348
+		'desc' => __('Enter the meta title for the login page.', 'geodirectory'),
349
+		'id' => 'geodir_meta_title_login',
350
+		'type' => 'text',
351
+		'css' => 'width:100%;',
352
+		'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
353
+		'placeholder' => '%%title%% %%sep%% %%sitename%%'
354
+	),
355
+
356
+	array(
357
+		'name' => __('Login page meta description', 'geodirectory'),
358
+		'desc' => __('Enter the meta description for the login page.', 'geodirectory'),
359
+		'id' => 'geodir_meta_desc_login',
360
+		'type' => 'textarea',
361
+		'css' => 'width:100%;',
362
+		'std' => ''
363
+	),
364
+
365
+	array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
366
+
367
+	//Listing success page meta
368
+	array('name' => __('Listing Success Page Meta Settings', 'geodirectory'),
369
+		'type' => 'sectionstart',
370
+		'desc' => '',
371
+		'id' => 'geodir_login_meta'),
372
+
373
+	array(
374
+		'name' => __('Listing success page meta title', 'geodirectory'),
375
+		'desc' => __('Enter the meta title for the listing success page.', 'geodirectory'),
376
+		'id' => 'geodir_meta_title_listing-success',
377
+		'type' => 'text',
378
+		'css' => 'width:100%;',
379
+		'std' => __('%%title%% %%sep%% %%sitename%%', 'geodirectory'),
380
+		'placeholder' => '%%title%% %%sep%% %%sitename%%'
381
+	),
382
+
383
+	array(
384
+		'name' => __('Listing success page meta description', 'geodirectory'),
385
+		'desc' => __('Enter the meta description for the listing success page.', 'geodirectory'),
386
+		'id' => 'geodir_meta_desc_listing-success',
387
+		'type' => 'textarea',
388
+		'css' => 'width:100%;',
389
+		'std' => ''
390
+	),
391
+
392
+	array('type' => 'sectionend', 'id' => 'geodir_login_meta'),
393 393
 
394 394
 
395 395
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $gd_wpseo_use = '';
12 12
 if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) {
13
-    $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.','geodirectory')."</b><br />";
13
+    $gd_wpseo_use = "<b style='color:red;'>".__('Please use the WPSEO settings instead.', 'geodirectory')."</b><br />";
14 14
 }
15 15
 
16 16
 /**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
         'id' => 'geodir_titles_and_metas'),
38 38
 
39 39
     array(  
40
-        'name' => __( 'Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory' ),
41
-        'desc' => __( 'This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory' ),
40
+        'name' => __('Disable overwrite by Yoast SEO titles & metas on GD pages', 'geodirectory'),
41
+        'desc' => __('This allows to disable overwriting by Yoast SEO titles & metas on GD pages. If ticked then GD pages will use titles & metas settings from GeoDirectory > Titles & Metas. Otherwise it will use titles & metas settings from SEO > Titles & Metas.', 'geodirectory'),
42 42
         'id' => 'geodir_disable_yoast_meta',
43 43
         'type' => 'checkbox',
44 44
         'std' => '0'
Please login to merge, or discard this patch.
geodirectory-functions/user_functions.php 3 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
                 if($output_type=='select'){
82 82
                     $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
83
-                }elseif($output_type=='link'){
83
+                } elseif($output_type=='link'){
84 84
                     $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
85 85
                 }
86 86
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                     </select>
103 103
                 </li>
104 104
             <?php
105
-            }elseif($output_type=='link'){
105
+            } elseif($output_type=='link'){
106 106
                 if(!empty($favourite_links)){
107 107
                     echo implode(" | ",$favourite_links);
108 108
                 }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
149 149
                 if($output_type=='select') {
150 150
                     $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
151
-                }elseif($output_type=='link'){
151
+                } elseif($output_type=='link'){
152 152
                     $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
153 153
                 }
154 154
             }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                     </select>
169 169
                 </li>
170 170
             <?php
171
-            }elseif($output_type=='link'){
171
+            } elseif($output_type=='link'){
172 172
                 if(!empty($listing_links )){
173 173
                     echo implode(" | ",$listing_links );
174 174
                 }
Please login to merge, or discard this patch.
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -13,34 +13,34 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function geodir_user_favourite_listing_count($user_id=false)
15 15
 {
16
-    global $wpdb, $plugin_prefix, $current_user;
16
+	global $wpdb, $plugin_prefix, $current_user;
17 17
 
18
-    if(!$user_id){$user_id = $current_user->ID;}
19
-    if(!$user_id){return array();}
18
+	if(!$user_id){$user_id = $current_user->ID;}
19
+	if(!$user_id){return array();}
20 20
 
21
-    $site_id = '';
22
-    if ( is_multisite() ) {
23
-        $blog_id = get_current_blog_id();
24
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
25
-    }
21
+	$site_id = '';
22
+	if ( is_multisite() ) {
23
+		$blog_id = get_current_blog_id();
24
+		if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
25
+	}
26 26
 
27
-    $user_favorites = geodir_get_user_favourites($user_id);
28
-    $all_posts = get_option('geodir_favorite_link_user_dashboard');
27
+	$user_favorites = geodir_get_user_favourites($user_id);
28
+	$all_posts = get_option('geodir_favorite_link_user_dashboard');
29 29
 
30
-    $user_listing = array();
31
-    if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
32
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
30
+	$user_listing = array();
31
+	if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
32
+		$user_favorites = "'" . implode("','", $user_favorites) . "'";
33 33
 
34
-        foreach ($all_posts as $ptype) {
35
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
34
+		foreach ($all_posts as $ptype) {
35
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
36 36
 
37
-            if ($total_posts > 0) {
38
-                $user_listing[$ptype] = $total_posts;
39
-            }
40
-        }
41
-    }
37
+			if ($total_posts > 0) {
38
+				$user_listing[$ptype] = $total_posts;
39
+			}
40
+		}
41
+	}
42 42
 
43
-    return $user_listing;
43
+	return $user_listing;
44 44
 }
45 45
 
46 46
 
@@ -53,51 +53,51 @@  discard block
 block discarded – undo
53 53
  */
54 54
 
55 55
 function geodir_user_show_favourites($user_id='',$output_type='select'){
56
-    // My Favourites in Dashboard
57
-    $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
58
-    $user_favourite = geodir_user_favourite_listing_count($user_id);
59
-
60
-    if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
61
-        $favourite_links = '';
62
-        $post_types = geodir_get_posttypes('object');
63
-
64
-        $author_link = get_author_posts_url($user_id);
65
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
66
-
67
-        foreach ($post_types as $key => $postobj) {
68
-            if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
69
-                $name = $postobj->labels->name;
70
-                $post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
71
-
72
-                $selected = '';
73
-
74
-                if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
75
-                    $selected = 'selected="selected"';
76
-                }
77
-                /**
78
-                 * Filter favorite listing link.
79
-                 *
80
-                 * @since 1.0.0
81
-                 * @param string $post_type_link Favorite listing link.
82
-                 * @param string $key Favorite listing array key.
83
-                 * @param int $current_user->ID Current user ID.
84
-                 */
85
-                $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id);
86
-
87
-                if($output_type=='select'){
88
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
89
-                }elseif($output_type=='link'){
90
-                    $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
91
-                }
92
-
93
-
94
-            }
95
-        }
96
-
97
-        if ($favourite_links != '') {
98
-            $user = get_user_by( 'ID', $user_id );
99
-            if($output_type=='select') {
100
-                ?>
56
+	// My Favourites in Dashboard
57
+	$show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
58
+	$user_favourite = geodir_user_favourite_listing_count($user_id);
59
+
60
+	if (!empty($show_favorite_link_user_dashboard) && !empty($user_favourite)) {
61
+		$favourite_links = '';
62
+		$post_types = geodir_get_posttypes('object');
63
+
64
+		$author_link = get_author_posts_url($user_id);
65
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
66
+
67
+		foreach ($post_types as $key => $postobj) {
68
+			if (in_array($key, $show_favorite_link_user_dashboard) && array_key_exists($key, $user_favourite)) {
69
+				$name = $postobj->labels->name;
70
+				$post_type_link = geodir_getlink($author_link, array('stype' => $key, 'list' => 'favourite'), false);
71
+
72
+				$selected = '';
73
+
74
+				if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite' && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key && isset($_REQUEST['geodir_dashbord'])) {
75
+					$selected = 'selected="selected"';
76
+				}
77
+				/**
78
+				 * Filter favorite listing link.
79
+				 *
80
+				 * @since 1.0.0
81
+				 * @param string $post_type_link Favorite listing link.
82
+				 * @param string $key Favorite listing array key.
83
+				 * @param int $current_user->ID Current user ID.
84
+				 */
85
+				$post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id);
86
+
87
+				if($output_type=='select'){
88
+					$favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
89
+				}elseif($output_type=='link'){
90
+					$favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
91
+				}
92
+
93
+
94
+			}
95
+		}
96
+
97
+		if ($favourite_links != '') {
98
+			$user = get_user_by( 'ID', $user_id );
99
+			if($output_type=='select') {
100
+				?>
101 101
                 <li>
102 102
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
103 103
                             option-autoredirect="1" name="geodir_my_favourites" option-ajaxchosen="false"
@@ -108,62 +108,62 @@  discard block
 block discarded – undo
108 108
                     </select>
109 109
                 </li>
110 110
             <?php
111
-            }elseif($output_type=='link'){
112
-                if(!empty($favourite_links)){
113
-                    echo implode(" | ",$favourite_links);
114
-                }
115
-
116
-            }
117
-        }
118
-    }
111
+			}elseif($output_type=='link'){
112
+				if(!empty($favourite_links)){
113
+					echo implode(" | ",$favourite_links);
114
+				}
115
+
116
+			}
117
+		}
118
+	}
119 119
 }
120 120
 
121 121
 
122 122
 
123 123
 function geodir_user_show_listings($user_id='',$output_type='select'){
124 124
 
125
-    $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
126
-    $user_listing = geodir_user_post_listing_count($user_id);
127
-
128
-    if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
129
-        $listing_links = array();
130
-
131
-        $post_types = geodir_get_posttypes('object');
132
-
133
-        $author_link = get_author_posts_url($user_id);
134
-        $author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
135
-
136
-        foreach ($post_types as $key => $postobj) {
137
-            if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
138
-                $name = $postobj->labels->name;
139
-                $listing_link = geodir_getlink($author_link, array('stype' => $key), false);
140
-
141
-                $selected = '';
142
-                if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
143
-                    $selected = 'selected="selected"';
144
-                }
145
-
146
-                /**
147
-                 * Filter my listing link.
148
-                 *
149
-                 * @since 1.0.0
150
-                 * @param string $listing_link My listing link.
151
-                 * @param string $key My listing array key.
152
-                 * @param int $current_user->ID Current user ID.
153
-                 */
154
-                $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
155
-                if($output_type=='select') {
156
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
157
-                }elseif($output_type=='link'){
158
-                    $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
159
-                }
160
-            }
161
-        }
162
-
163
-        if ($listing_links != '') {
164
-            $user = get_user_by( 'ID', $user_id );
165
-            if($output_type=='select') {
166
-                ?>
125
+	$show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
126
+	$user_listing = geodir_user_post_listing_count($user_id);
127
+
128
+	if (!empty($show_listing_link_user_dashboard) && !empty($user_listing)) {
129
+		$listing_links = array();
130
+
131
+		$post_types = geodir_get_posttypes('object');
132
+
133
+		$author_link = get_author_posts_url($user_id);
134
+		$author_link = geodir_getlink($author_link, array('geodir_dashbord' => 'true'), false);
135
+
136
+		foreach ($post_types as $key => $postobj) {
137
+			if (in_array($key, $show_listing_link_user_dashboard) && array_key_exists($key, $user_listing)) {
138
+				$name = $postobj->labels->name;
139
+				$listing_link = geodir_getlink($author_link, array('stype' => $key), false);
140
+
141
+				$selected = '';
142
+				if (!isset($_REQUEST['list']) && isset($_REQUEST['geodir_dashbord']) && isset($_REQUEST['stype']) && $_REQUEST['stype'] == $key) {
143
+					$selected = 'selected="selected"';
144
+				}
145
+
146
+				/**
147
+				 * Filter my listing link.
148
+				 *
149
+				 * @since 1.0.0
150
+				 * @param string $listing_link My listing link.
151
+				 * @param string $key My listing array key.
152
+				 * @param int $current_user->ID Current user ID.
153
+				 */
154
+				$listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
155
+				if($output_type=='select') {
156
+					$listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
157
+				}elseif($output_type=='link'){
158
+					$listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
159
+				}
160
+			}
161
+		}
162
+
163
+		if ($listing_links != '') {
164
+			$user = get_user_by( 'ID', $user_id );
165
+			if($output_type=='select') {
166
+				?>
167 167
                 <li>
168 168
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
169 169
                             option-autoredirect="1" name="geodir_my_listings" option-ajaxchosen="false"
@@ -174,14 +174,14 @@  discard block
 block discarded – undo
174 174
                     </select>
175 175
                 </li>
176 176
             <?php
177
-            }elseif($output_type=='link'){
178
-                if(!empty($listing_links )){
179
-                    echo implode(" | ",$listing_links );
180
-                }
177
+			}elseif($output_type=='link'){
178
+				if(!empty($listing_links )){
179
+					echo implode(" | ",$listing_links );
180
+				}
181 181
 
182
-            }
183
-        }
184
-    }
182
+			}
183
+		}
184
+	}
185 185
 
186 186
 }
187 187
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  * @return mixed
194 194
  */
195 195
 function geodir_get_user_favourites($user_id=''){
196
-    if(!$user_id){$user_id = get_current_user_id();}
197
-    $site_id = '';
198
-    if ( is_multisite() ) {
199
-        $blog_id = get_current_blog_id();
200
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
201
-    }
202
-
203
-    return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true);
196
+	if(!$user_id){$user_id = get_current_user_id();}
197
+	$site_id = '';
198
+	if ( is_multisite() ) {
199
+		$blog_id = get_current_blog_id();
200
+		if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
201
+	}
202
+
203
+	return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true);
204 204
 }
205 205
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
  * @global string $plugin_prefix Geodirectory plugin table prefix.
12 12
  * @return array User listing count for each post type.
13 13
  */
14
-function geodir_user_favourite_listing_count($user_id=false)
14
+function geodir_user_favourite_listing_count($user_id = false)
15 15
 {
16 16
     global $wpdb, $plugin_prefix, $current_user;
17 17
 
18
-    if(!$user_id){$user_id = $current_user->ID;}
19
-    if(!$user_id){return array();}
18
+    if (!$user_id) {$user_id = $current_user->ID; }
19
+    if (!$user_id) {return array(); }
20 20
 
21 21
     $site_id = '';
22
-    if ( is_multisite() ) {
22
+    if (is_multisite()) {
23 23
         $blog_id = get_current_blog_id();
24
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
24
+        if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; }
25 25
     }
26 26
 
27 27
     $user_favorites = geodir_get_user_favourites($user_id);
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 
30 30
     $user_listing = array();
31 31
     if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
32
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
32
+        $user_favorites = "'".implode("','", $user_favorites)."'";
33 33
 
34 34
         foreach ($all_posts as $ptype) {
35
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE  post_type='" . $ptype . "' AND post_status = 'publish' AND ID IN (" . $user_favorites . ")");
35
+            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE  post_type='".$ptype."' AND post_status = 'publish' AND ID IN (".$user_favorites.")");
36 36
 
37 37
             if ($total_posts > 0) {
38 38
                 $user_listing[$ptype] = $total_posts;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  * @package GeoDirectory
53 53
  */
54 54
 
55
-function geodir_user_show_favourites($user_id='',$output_type='select'){
55
+function geodir_user_show_favourites($user_id = '', $output_type = 'select') {
56 56
     // My Favourites in Dashboard
57 57
     $show_favorite_link_user_dashboard = get_option('geodir_favorite_link_user_dashboard');
58 58
     $user_favourite = geodir_user_favourite_listing_count($user_id);
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
                  */
85 85
                 $post_type_link = apply_filters('geodir_dashboard_link_favorite_listing', $post_type_link, $key, $user_id);
86 86
 
87
-                if($output_type=='select'){
88
-                    $favourite_links .= '<option ' . $selected . ' value="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
89
-                }elseif($output_type=='link'){
90
-                    $favourite_links[] = '<a href="' . $post_type_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
87
+                if ($output_type == 'select') {
88
+                    $favourite_links .= '<option '.$selected.' value="'.$post_type_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>';
89
+                }elseif ($output_type == 'link') {
90
+                    $favourite_links[] = '<a href="'.$post_type_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</a>';
91 91
                 }
92 92
 
93 93
 
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
         }
96 96
 
97 97
         if ($favourite_links != '') {
98
-            $user = get_user_by( 'ID', $user_id );
99
-            if($output_type=='select') {
98
+            $user = get_user_by('ID', $user_id);
99
+            if ($output_type == 'select') {
100 100
                 ?>
101 101
                 <li>
102 102
                     <select id="geodir_my_favourites" class="chosen_select" onchange="window.location.href=this.value"
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
                     </select>
109 109
                 </li>
110 110
             <?php
111
-            }elseif($output_type=='link'){
112
-                if(!empty($favourite_links)){
113
-                    echo implode(" | ",$favourite_links);
111
+            }elseif ($output_type == 'link') {
112
+                if (!empty($favourite_links)) {
113
+                    echo implode(" | ", $favourite_links);
114 114
                 }
115 115
 
116 116
             }
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 
123
-function geodir_user_show_listings($user_id='',$output_type='select'){
123
+function geodir_user_show_listings($user_id = '', $output_type = 'select') {
124 124
 
125 125
     $show_listing_link_user_dashboard = get_option('geodir_listing_link_user_dashboard');
126 126
     $user_listing = geodir_user_post_listing_count($user_id);
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
                  * @param int $current_user->ID Current user ID.
153 153
                  */
154 154
                 $listing_link = apply_filters('geodir_dashboard_link_my_listing', $listing_link, $key, $user_id);
155
-                if($output_type=='select') {
156
-                    $listing_links .= '<option ' . $selected . ' value="' . $listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</option>';
157
-                }elseif($output_type=='link'){
158
-                    $listing_links[] = '<a href="' .$listing_link . '">' . __(geodir_utf8_ucfirst($name), 'geodirectory') . '</a>';
155
+                if ($output_type == 'select') {
156
+                    $listing_links .= '<option '.$selected.' value="'.$listing_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</option>';
157
+                }elseif ($output_type == 'link') {
158
+                    $listing_links[] = '<a href="'.$listing_link.'">'.__(geodir_utf8_ucfirst($name), 'geodirectory').'</a>';
159 159
                 }
160 160
             }
161 161
         }
162 162
 
163 163
         if ($listing_links != '') {
164
-            $user = get_user_by( 'ID', $user_id );
165
-            if($output_type=='select') {
164
+            $user = get_user_by('ID', $user_id);
165
+            if ($output_type == 'select') {
166 166
                 ?>
167 167
                 <li>
168 168
                     <select id="geodir_my_listings" class="chosen_select" onchange="window.location.href=this.value"
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
                     </select>
175 175
                 </li>
176 176
             <?php
177
-            }elseif($output_type=='link'){
178
-                if(!empty($listing_links )){
179
-                    echo implode(" | ",$listing_links );
177
+            }elseif ($output_type == 'link') {
178
+                if (!empty($listing_links)) {
179
+                    echo implode(" | ", $listing_links);
180 180
                 }
181 181
 
182 182
             }
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
  * @since 1.6.24
193 193
  * @return mixed
194 194
  */
195
-function geodir_get_user_favourites($user_id=''){
196
-    if(!$user_id){$user_id = get_current_user_id();}
195
+function geodir_get_user_favourites($user_id = '') {
196
+    if (!$user_id) {$user_id = get_current_user_id(); }
197 197
     $site_id = '';
198
-    if ( is_multisite() ) {
198
+    if (is_multisite()) {
199 199
         $blog_id = get_current_blog_id();
200
-        if($blog_id && $blog_id!='1'){$site_id  = '_' . $blog_id ;}
200
+        if ($blog_id && $blog_id != '1') {$site_id = '_'.$blog_id; }
201 201
     }
202 202
 
203 203
     return get_user_meta($user_id, 'gd_user_favourite_post'.$site_id, true);
Please login to merge, or discard this patch.
geodirectory-functions/compatibility/BuddyBoss.php 3 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -12,77 +12,77 @@
 block discarded – undo
12 12
 
13 13
 remove_action('geodir_page_title', 'geodir_action_page_title', 10);
14 14
 function gd_buddyboss_action_calls(){
15
-    // listings page remove
16
-    remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
17
-    remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
18
-    remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
19
-    remove_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
20
-    remove_action('geodir_listings_page_description', 'geodir_location_action_listings_description', 100); // for location manager
21
-    remove_action('geodir_listings_page_description', 'geodir_cpt_pt_desc', 10); //CPT manager
15
+	// listings page remove
16
+	remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
17
+	remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
18
+	remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20);
19
+	remove_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
20
+	remove_action('geodir_listings_page_description', 'geodir_location_action_listings_description', 100); // for location manager
21
+	remove_action('geodir_listings_page_description', 'geodir_cpt_pt_desc', 10); //CPT manager
22 22
 
23
-    //listing page add
24
-    add_action('geodir_listings_content', 'geodir_breadcrumb', 3);
25
-    add_action('geodir_listings_content', 'geodir_action_geodir_sidebar_listings_top', 4);
26
-    add_action('geodir_listings_content', 'geodir_cpt_pt_desc', 5); //CPT manager
27
-    if(defined("GEODIRLOCATION_VERSION")){
28
-        add_action('geodir_listings_content', 'geodir_location_action_listings_description', 5);
29
-    }else{
30
-        add_action('geodir_listings_content', 'geodir_action_listings_description', 5);
31
-    }
32
-    add_action('geodir_listings_content', 'geodir_action_listings_title', 9);
23
+	//listing page add
24
+	add_action('geodir_listings_content', 'geodir_breadcrumb', 3);
25
+	add_action('geodir_listings_content', 'geodir_action_geodir_sidebar_listings_top', 4);
26
+	add_action('geodir_listings_content', 'geodir_cpt_pt_desc', 5); //CPT manager
27
+	if(defined("GEODIRLOCATION_VERSION")){
28
+		add_action('geodir_listings_content', 'geodir_location_action_listings_description', 5);
29
+	}else{
30
+		add_action('geodir_listings_content', 'geodir_action_listings_description', 5);
31
+	}
32
+	add_action('geodir_listings_content', 'geodir_action_listings_title', 9);
33 33
 
34 34
 
35
-    // details page remove
36
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_set_preview_post', 8);
37
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_preview_code', 9);
38
-    remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
39
-    remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
35
+	// details page remove
36
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_set_preview_post', 8);
37
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_preview_code', 9);
38
+	remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10);
39
+	remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20);
40 40
 
41 41
 
42
-    //details page add
43
-    add_action('geodir_article_open', 'geodir_action_geodir_set_preview_post', 1);
44
-    add_action('geodir_article_open','geodir_action_geodir_preview_code', 2);
45
-    add_action('geodir_article_open', 'geodir_breadcrumb', 3);
46
-    add_action('geodir_article_open', 'geodir_action_geodir_sidebar_detail_top', 5);
42
+	//details page add
43
+	add_action('geodir_article_open', 'geodir_action_geodir_set_preview_post', 1);
44
+	add_action('geodir_article_open','geodir_action_geodir_preview_code', 2);
45
+	add_action('geodir_article_open', 'geodir_breadcrumb', 3);
46
+	add_action('geodir_article_open', 'geodir_action_geodir_sidebar_detail_top', 5);
47 47
 
48 48
 
49 49
 
50
-    //location/home remove
51
-    remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
52
-    remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
50
+	//location/home remove
51
+	remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
52
+	remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20);
53 53
 
54
-    remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
55
-    remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
54
+	remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10);
55
+	remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20);
56 56
 
57
-    //location/home add
58
-    add_action('geodir_home_content', 'geodir_breadcrumb', 3);
59
-    add_action('geodir_location_content', 'geodir_breadcrumb', 3);
57
+	//location/home add
58
+	add_action('geodir_home_content', 'geodir_breadcrumb', 3);
59
+	add_action('geodir_location_content', 'geodir_breadcrumb', 3);
60 60
 
61
-    add_action('geodir_home_content', 'geodir_action_geodir_sidebar_home_top', 5);
62
-    add_action('geodir_location_content', 'geodir_action_geodir_sidebar_home_top', 5);
61
+	add_action('geodir_home_content', 'geodir_action_geodir_sidebar_home_top', 5);
62
+	add_action('geodir_location_content', 'geodir_action_geodir_sidebar_home_top', 5);
63 63
 
64
-    // search remove
65
-    remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
66
-    remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
67
-    remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
64
+	// search remove
65
+	remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10);
66
+	remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20);
67
+	remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10);
68 68
 
69
-    //search add
70
-    add_action('geodir_search_content', 'geodir_action_geodir_sidebar_search_top', 5);
71
-    add_action('geodir_search_content', 'geodir_breadcrumb', 3);
72
-    add_action('geodir_search_content', 'geodir_action_search_page_title', 6);
69
+	//search add
70
+	add_action('geodir_search_content', 'geodir_action_geodir_sidebar_search_top', 5);
71
+	add_action('geodir_search_content', 'geodir_breadcrumb', 3);
72
+	add_action('geodir_search_content', 'geodir_action_search_page_title', 6);
73 73
 
74 74
 
75 75
 
76 76
 }
77 77
 
78 78
 function gd_bb__dequeue_script() {
79
-    if(geodir_is_geodir_page()){
80
-        wp_dequeue_script( 'selectboxes');
81
-    }
79
+	if(geodir_is_geodir_page()){
80
+		wp_dequeue_script( 'selectboxes');
81
+	}
82 82
 }
83 83
 add_action( 'wp_print_scripts', 'gd_bb__dequeue_script', 100 );
84 84
 
85 85
 add_action('geodir_listings_content','_bb_do_geodir_listings_page_description',11);
86 86
 function _bb_do_geodir_listings_page_description(){
87
-    do_action('geodir_listings_page_description');
87
+	do_action('geodir_listings_page_description');
88 88
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 add_action('after_setup_theme', 'gd_buddyboss_action_calls', 11);
12 12
 
13 13
 remove_action('geodir_page_title', 'geodir_action_page_title', 10);
14
-function gd_buddyboss_action_calls(){
14
+function gd_buddyboss_action_calls() {
15 15
     // listings page remove
16 16
     remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10);
17 17
     remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10);
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
     add_action('geodir_listings_content', 'geodir_breadcrumb', 3);
25 25
     add_action('geodir_listings_content', 'geodir_action_geodir_sidebar_listings_top', 4);
26 26
     add_action('geodir_listings_content', 'geodir_cpt_pt_desc', 5); //CPT manager
27
-    if(defined("GEODIRLOCATION_VERSION")){
27
+    if (defined("GEODIRLOCATION_VERSION")) {
28 28
         add_action('geodir_listings_content', 'geodir_location_action_listings_description', 5);
29
-    }else{
29
+    } else {
30 30
         add_action('geodir_listings_content', 'geodir_action_listings_description', 5);
31 31
     }
32 32
     add_action('geodir_listings_content', 'geodir_action_listings_title', 9);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
     //details page add
43 43
     add_action('geodir_article_open', 'geodir_action_geodir_set_preview_post', 1);
44
-    add_action('geodir_article_open','geodir_action_geodir_preview_code', 2);
44
+    add_action('geodir_article_open', 'geodir_action_geodir_preview_code', 2);
45 45
     add_action('geodir_article_open', 'geodir_breadcrumb', 3);
46 46
     add_action('geodir_article_open', 'geodir_action_geodir_sidebar_detail_top', 5);
47 47
 
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 }
77 77
 
78 78
 function gd_bb__dequeue_script() {
79
-    if(geodir_is_geodir_page()){
80
-        wp_dequeue_script( 'selectboxes');
79
+    if (geodir_is_geodir_page()) {
80
+        wp_dequeue_script('selectboxes');
81 81
     }
82 82
 }
83
-add_action( 'wp_print_scripts', 'gd_bb__dequeue_script', 100 );
83
+add_action('wp_print_scripts', 'gd_bb__dequeue_script', 100);
84 84
 
85
-add_action('geodir_listings_content','_bb_do_geodir_listings_page_description',11);
86
-function _bb_do_geodir_listings_page_description(){
85
+add_action('geodir_listings_content', '_bb_do_geodir_listings_page_description', 11);
86
+function _bb_do_geodir_listings_page_description() {
87 87
     do_action('geodir_listings_page_description');
88 88
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     add_action('geodir_listings_content', 'geodir_cpt_pt_desc', 5); //CPT manager
27 27
     if(defined("GEODIRLOCATION_VERSION")){
28 28
         add_action('geodir_listings_content', 'geodir_location_action_listings_description', 5);
29
-    }else{
29
+    } else{
30 30
         add_action('geodir_listings_content', 'geodir_action_listings_description', 5);
31 31
     }
32 32
     add_action('geodir_listings_content', 'geodir_action_listings_title', 9);
Please login to merge, or discard this patch.
geodirectory-admin/admin_functions.php 3 patches
Braces   +230 added lines, -127 removed lines patch added patch discarded remove patch
@@ -184,8 +184,9 @@  discard block
 block discarded – undo
184 184
 
185 185
         $thumb_img_arr = array();
186 186
 
187
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
188
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
187
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
188
+                    $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
189
+        }
189 190
 
190 191
         $totImg = '';
191 192
         $image_limit = '';
@@ -236,7 +237,9 @@  discard block
 block discarded – undo
236 237
     {
237 238
         global $menu, $geodirectory;
238 239
 
239
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
240
+        if (current_user_can('manage_options')) {
241
+        	$menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
242
+        }
240 243
 
241 244
         add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
242 245
 
@@ -300,7 +303,9 @@  discard block
 block discarded – undo
300 303
      */
301 304
     function geodir_admin_custom_menu_order()
302 305
     {
303
-        if (!current_user_can('manage_options')) return false;
306
+        if (!current_user_can('manage_options')) {
307
+        	return false;
308
+        }
304 309
         return true;
305 310
     }
306 311
 }
@@ -331,10 +336,11 @@  discard block
 block discarded – undo
331 336
 			case 'fail':
332 337
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
333 338
 				
334
-				if ($gderr == 21)
335
-			    	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>';
336
-				else
337
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
339
+				if ($gderr == 21) {
340
+							    	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>';
341
+				} else {
342
+									echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
343
+				}
338 344
                 break;
339 345
         }
340 346
     }
@@ -385,8 +391,12 @@  discard block
 block discarded – undo
385 391
         include_once('option-pages/' . $current_tab . '_array.php');
386 392
     }
387 393
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
388
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
389
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
394
+        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) {
395
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
396
+        }
397
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) {
398
+        	die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
399
+        }
390 400
 		
391 401
 		/**
392 402
 		 * Fires before updating geodirectory admin settings.
@@ -398,8 +408,9 @@  discard block
 block discarded – undo
398 408
 		 */
399 409
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
400 410
 		
401
-        if (!empty($geodir_settings[$current_tab]))
402
-            geodir_update_options($geodir_settings[$current_tab]);
411
+        if (!empty($geodir_settings[$current_tab])) {
412
+                    geodir_update_options($geodir_settings[$current_tab]);
413
+        }
403 414
 
404 415
         /**
405 416
          * Called after GeoDirectory options settings are updated.
@@ -447,11 +458,14 @@  discard block
 block discarded – undo
447 458
  * @return bool Returns true if saved.
448 459
  */
449 460
 function geodir_update_options($options, $dummy = false) {
450
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
461
+    if ((!isset($_POST) || !$_POST) && !$dummy) {
462
+    	return false;
463
+    }
451 464
 
452 465
     foreach ($options as $value) {
453
-        if ($dummy && isset($value['std']))
454
-            $_POST[$value['id']] = $value['std'];
466
+        if ($dummy && isset($value['std'])) {
467
+                    $_POST[$value['id']] = $value['std'];
468
+        }
455 469
 
456 470
 
457 471
         if (isset($value['type']) && $value['type'] == 'checkbox') :
@@ -460,25 +474,23 @@  discard block
 block discarded – undo
460 474
                 update_option($value['id'], $_POST[$value['id']]);
461 475
             } else {
462 476
                 update_option($value['id'], 0);
463
-            }
464
-
465
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
477
+            } elseif (isset($value['type']) && $value['type'] == 'image_width') :
466 478
 
467 479
             if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
468 480
                 update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
469 481
                 update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
470 482
                 if (isset($_POST[$value['id'] . '_crop'])) :
471 483
                     update_option($value['id'] . '_crop', 1);
472
-                else :
473
-                    update_option($value['id'] . '_crop', 0);
484
+                else {
485
+                	:
486
+                    update_option($value['id'] . '_crop', 0);
487
+                }
474 488
                 endif;
475 489
             } else {
476 490
                 update_option($value['id'] . '_width', $value['std']);
477 491
                 update_option($value['id'] . '_height', $value['std']);
478 492
                 update_option($value['id'] . '_crop', 1);
479
-            }
480
-
481
-        elseif (isset($value['type']) && $value['type'] == 'map') :
493
+            } elseif (isset($value['type']) && $value['type'] == 'map') :
482 494
             $post_types = array();
483 495
             $categories = array();
484 496
 
@@ -523,8 +535,9 @@  discard block
 block discarded – undo
523 535
                     $image_name_arr = explode('/', get_option($value['id']));
524 536
                     $noimg_name = end($image_name_arr);
525 537
                     $img_path = $uploads['path'] . '/' . $noimg_name;
526
-                    if (file_exists($img_path))
527
-                        unlink($img_path);
538
+                    if (file_exists($img_path)) {
539
+                                            unlink($img_path);
540
+                    }
528 541
                 }
529 542
 
530 543
                 update_option($value['id'], '');
@@ -540,8 +553,10 @@  discard block
 block discarded – undo
540 553
                 foreach ($uploadedfile as $key => $uplaod):
541 554
                     if ($key == 'name'):
542 555
                         $uplaods[$key] = $filename;
543
-                    else :
544
-                        $uplaods[$key] = $uplaod;
556
+                    else {
557
+                    	:
558
+                        $uplaods[$key] = $uplaod;
559
+                    }
545 560
                     endif;
546 561
                 endforeach;
547 562
 
@@ -551,8 +566,9 @@  discard block
 block discarded – undo
551 566
                     $image_name_arr = explode('/', get_option($value['id']));
552 567
                     $noimg_name = end($image_name_arr);
553 568
                     $img_path = $uploads['path'] . '/' . $noimg_name;
554
-                    if (file_exists($img_path))
555
-                        unlink($img_path);
569
+                    if (file_exists($img_path)) {
570
+                                            unlink($img_path);
571
+                    }
556 572
                 }
557 573
 
558 574
                 $upload_overrides = array('test_form' => false);
@@ -567,10 +583,12 @@  discard block
 block discarded – undo
567 583
             endif;
568 584
 
569 585
 
570
-        else :
586
+        else {
587
+        	:
571 588
             // same menu setting per theme.
572 589
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
573
-                $theme = wp_get_theme();
590
+                $theme = wp_get_theme();
591
+        }
574 592
                 update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
575 593
             }
576 594
 
@@ -582,8 +600,9 @@  discard block
 block discarded – undo
582 600
 
583 601
         endif;
584 602
     }
585
-    if ($dummy)
586
-        $_POST = array();
603
+    if ($dummy) {
604
+            $_POST = array();
605
+    }
587 606
     return true;
588 607
 
589 608
 }
@@ -729,9 +748,12 @@  discard block
 block discarded – undo
729 748
         $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
730 749
             'categorys' => __('Categories', 'geodirectory'));
731 750
 
732
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
751
+        if (($offset = array_search('author', array_keys($columns))) === false) {
752
+        	// if the key doesn't exist
733 753
         {
734
-            $offset = 0; // should we prepend $array with $data?
754
+            $offset = 0;
755
+        }
756
+        // should we prepend $array with $data?
735 757
             $offset = count($columns); // or should we append $array with $data? lets pick this one...
736 758
         }
737 759
 
@@ -791,11 +813,13 @@  discard block
 block discarded – undo
791 813
                     $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
792 814
                 }
793 815
                 /* If no expire_date is found, output a default message. */
794
-                if (empty($expire_date))
795
-                    echo __('Unknown', 'geodirectory');
816
+                if (empty($expire_date)) {
817
+                                    echo __('Unknown', 'geodirectory');
818
+                }
796 819
                 /* If there is a expire_date, append 'days left' to the text string. */
797
-                else
798
-                    echo $expire_date . $date_diff_text;
820
+                else {
821
+                                    echo $expire_date . $date_diff_text;
822
+                }
799 823
                 break;
800 824
 
801 825
             /* If displaying the 'categorys' column. */
@@ -868,21 +892,26 @@  discard block
 block discarded – undo
868 892
 
869 893
     $geodir_posttypes = geodir_get_posttypes();
870 894
 
871
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
872
-        return;
895
+    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
896
+            return;
897
+    }
873 898
 
874 899
     if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
875
-        if (isset($_REQUEST['_status']))
876
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
900
+        if (isset($_REQUEST['_status'])) {
901
+                    geodir_change_post_status($post_id, $_REQUEST['_status']);
902
+        }
877 903
 
878
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
879
-            return;
904
+        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash')) {
905
+                    return;
906
+        }
880 907
 
881
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
882
-            return;
908
+        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__))) {
909
+                    return;
910
+        }
883 911
 
884
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
885
-            return;
912
+        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__))) {
913
+                    return;
914
+        }
886 915
 
887 916
         geodir_save_listing($_REQUEST);
888 917
     }
@@ -907,10 +936,18 @@  discard block
 block discarded – undo
907 936
     $tab_id = '';
908 937
     $i = 0;
909 938
     foreach ($options as $value) :
910
-        if (!isset($value['name'])) $value['name'] = '';
911
-        if (!isset($value['class'])) $value['class'] = '';
912
-        if (!isset($value['css'])) $value['css'] = '';
913
-        if (!isset($value['std'])) $value['std'] = '';
939
+        if (!isset($value['name'])) {
940
+        	$value['name'] = '';
941
+        }
942
+        if (!isset($value['class'])) {
943
+        	$value['class'] = '';
944
+        }
945
+        if (!isset($value['css'])) {
946
+        	$value['css'] = '';
947
+        }
948
+        if (!isset($value['std'])) {
949
+        	$value['std'] = '';
950
+        }
914 951
         $desc = '';
915 952
         switch ($value['type']) :
916 953
             case 'dummy_installer':
@@ -926,11 +963,13 @@  discard block
 block discarded – undo
926 963
 
927 964
                 $i++;
928 965
 
929
-                if (isset($value['id']) && $value['id'])
930
-                    $tab_id = $value['id'];
966
+                if (isset($value['id']) && $value['id']) {
967
+                                    $tab_id = $value['id'];
968
+                }
931 969
 
932
-                if (isset($value['desc']) && $value['desc'])
933
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
970
+                if (isset($value['desc']) && $value['desc']) {
971
+                                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
972
+                }
934 973
 
935 974
                 if (isset($value['name']) && $value['name']) {
936 975
                     if ($first_title === true) {
@@ -961,10 +1000,12 @@  discard block
 block discarded – undo
961 1000
                 break;
962 1001
 
963 1002
             case 'sectionstart':
964
-                if (isset($value['desc']) && $value['desc'])
965
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
966
-                if (isset($value['name']) && $value['name'])
967
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1003
+                if (isset($value['desc']) && $value['desc']) {
1004
+                                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
1005
+                }
1006
+                if (isset($value['name']) && $value['name']) {
1007
+                                    echo '<h3>' . $value['name'] . $desc . '</h3>';
1008
+                }
968 1009
                 /**
969 1010
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
970 1011
                  *
@@ -972,7 +1013,9 @@  discard block
 block discarded – undo
972 1013
                  *
973 1014
                  * @since 1.0.0
974 1015
                  */
975
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1016
+                if (isset($value['id']) && $value['id']) {
1017
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
1018
+                }
976 1019
                 echo '<table class="form-table">' . "\n\n";
977 1020
 
978 1021
                 break;
@@ -984,7 +1027,9 @@  discard block
 block discarded – undo
984 1027
                  *
985 1028
                  * @since 1.0.0
986 1029
                  */
987
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1030
+                if (isset($value['id']) && $value['id']) {
1031
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
1032
+                }
988 1033
                 echo '</table>';
989 1034
                 /**
990 1035
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -993,7 +1038,9 @@  discard block
 block discarded – undo
993 1038
                  *
994 1039
                  * @since 1.0.0
995 1040
                  */
996
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1041
+                if (isset($value['id']) && $value['id']) {
1042
+                	do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1043
+                }
997 1044
                 break;
998 1045
             case 'text':
999 1046
                 ?>
@@ -1084,17 +1131,32 @@  discard block
 block discarded – undo
1084 1131
                     <?php _e('Width', 'geodirectory'); ?> <input
1085 1132
                         name="<?php echo esc_attr($value['id']); ?>_width"
1086 1133
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1087
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1134
+                        value="<?php if ($size = get_option($value['id'] . '_width')) {
1135
+	echo stripslashes($size);
1136
+} else {
1137
+	echo $value['std'];
1138
+}
1139
+?>"/>
1088 1140
 
1089 1141
                     <?php _e('Height', 'geodirectory'); ?> <input
1090 1142
                         name="<?php echo esc_attr($value['id']); ?>_height"
1091 1143
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1092
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1144
+                        value="<?php if ($size = get_option($value['id'] . '_height')) {
1145
+	echo stripslashes($size);
1146
+} else {
1147
+	echo $value['std'];
1148
+}
1149
+?>"/>
1093 1150
 
1094 1151
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1095 1152
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1096 1153
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1097
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1154
+                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') {
1155
+	checked(get_option($value['id'] . '_crop'), 1);
1156
+} else {
1157
+	checked(1);
1158
+}
1159
+?> /></label>
1098 1160
 
1099 1161
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1100 1162
                 </tr><?php
@@ -1108,17 +1170,22 @@  discard block
 block discarded – undo
1108 1170
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
1109 1171
                                             id="<?php echo esc_attr($value['id']); ?>"
1110 1172
                                             style="<?php echo esc_attr($value['css']); ?>"
1111
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1173
+                                            class="<?php if (isset($value['class'])) {
1174
+	echo $value['class'];
1175
+}
1176
+?>"
1112 1177
                                             option-ajaxchosen="false">
1113 1178
                         <?php
1114 1179
                         foreach ($value['options'] as $key => $val) {
1115 1180
                             $geodir_select_value = '';
1116 1181
                             if ($option_value != '') {
1117
-                                if ($option_value != '' && $option_value == $key)
1118
-                                    $geodir_select_value = ' selected="selected" ';
1182
+                                if ($option_value != '' && $option_value == $key) {
1183
+                                                                    $geodir_select_value = ' selected="selected" ';
1184
+                                }
1119 1185
                             } else {
1120
-                                if ($value['std'] == $key)
1121
-                                    $geodir_select_value = ' selected="selected" ';
1186
+                                if ($value['std'] == $key) {
1187
+                                                                    $geodir_select_value = ' selected="selected" ';
1188
+                                }
1122 1189
                             }
1123 1190
                             ?>
1124 1191
                             <option
@@ -1143,8 +1210,14 @@  discard block
 block discarded – undo
1143 1210
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
1144 1211
                                             id="<?php echo esc_attr($value['id']); ?>"
1145 1212
                                             style="<?php echo esc_attr($value['css']); ?>"
1146
-                                            class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1147
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1213
+                                            class="<?php if (isset($value['class'])) {
1214
+	echo $value['class'];
1215
+}
1216
+?>"
1217
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) {
1218
+	echo $value['placeholder_text'];
1219
+}
1220
+?>"
1148 1221
                                             option-ajaxchosen="false">
1149 1222
                         <?php
1150 1223
                         foreach ($value['options'] as $key => $val) {
@@ -1172,7 +1245,10 @@  discard block
 block discarded – undo
1172 1245
                 <td class="forminp">
1173 1246
                     <input type="file" name="<?php echo esc_attr($value['id']); ?>"
1174 1247
                            id="<?php echo esc_attr($value['id']); ?>" style="<?php echo esc_attr($value['css']); ?>"
1175
-                           class="<?php if (isset($value['class'])) echo $value['class']; ?>"/>
1248
+                           class="<?php if (isset($value['class'])) {
1249
+	echo $value['class'];
1250
+}
1251
+?>"/>
1176 1252
                     <?php if (get_option($value['id'])) { ?>
1177 1253
                         <input type="hidden" name="<?php echo esc_attr($value['id']); ?>_remove"
1178 1254
                                id="<?php echo esc_attr($value['id']); ?>_remove" value="0">
@@ -1253,13 +1329,15 @@  discard block
 block discarded – undo
1253 1329
                                 'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1254 1330
                             );
1255 1331
                             $geodir_default_map_language = get_option('geodir_default_map_language');
1256
-                            if (empty($geodir_default_map_language))
1257
-                                $geodir_default_map_language = 'en';
1332
+                            if (empty($geodir_default_map_language)) {
1333
+                                                            $geodir_default_map_language = 'en';
1334
+                            }
1258 1335
                             foreach ($arr_map_langages as $language_key => $language_txt) {
1259
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1260
-                                    $geodir_default_language_selected = "selected='selected'";
1261
-                                else
1262
-                                    $geodir_default_language_selected = '';
1336
+                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language) {
1337
+                                                                    $geodir_default_language_selected = "selected='selected'";
1338
+                                } else {
1339
+                                                                    $geodir_default_language_selected = '';
1340
+                                }
1263 1341
 
1264 1342
                                 ?>
1265 1343
                                 <option
@@ -1279,14 +1357,16 @@  discard block
 block discarded – undo
1279 1357
                             <?php
1280 1358
                             $post_types = geodir_get_posttypes('array');
1281 1359
                             $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1282
-                            if (empty($geodir_default_map_search_pt))
1283
-                                $geodir_default_map_search_pt = 'gd_place';
1360
+                            if (empty($geodir_default_map_search_pt)) {
1361
+                                                            $geodir_default_map_search_pt = 'gd_place';
1362
+                            }
1284 1363
                             if (is_array($post_types)) {
1285 1364
                                 foreach ($post_types as $key => $post_types_obj) {
1286
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1287
-                                        $geodir_search_pt_selected = "selected='selected'";
1288
-                                    else
1289
-                                        $geodir_search_pt_selected = '';
1365
+                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt) {
1366
+                                                                            $geodir_search_pt_selected = "selected='selected'";
1367
+                                    } else {
1368
+                                                                            $geodir_search_pt_selected = '';
1369
+                                    }
1290 1370
 
1291 1371
                                     ?>
1292 1372
                                     <option
@@ -1406,7 +1486,7 @@  discard block
 block discarded – undo
1406 1486
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1407 1487
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1408 1488
                             echo 'checked="checked"';
1409
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1489
+                        } elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1410 1490
                         <?php echo $value['desc']; ?></label><br>
1411 1491
                 </fieldset>
1412 1492
                 <?php
@@ -1426,10 +1506,18 @@  discard block
 block discarded – undo
1426 1506
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1427 1507
                 <td class="forminp">
1428 1508
                     <textarea
1429
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1509
+                        <?php if (isset($value['args'])) {
1510
+	echo $value['args'] . ' ';
1511
+}
1512
+?>name="<?php echo esc_attr($value['id']); ?>"
1430 1513
                         id="<?php echo esc_attr($value['id']); ?>"
1431 1514
                         <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1432
-                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1515
+                        style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) {
1516
+	echo esc_textarea(stripslashes(get_option($value['id'])));
1517
+} else {
1518
+	echo esc_textarea($value['std']);
1519
+}
1520
+?></textarea><span
1433 1521
                         class="description"><?php echo $value['desc'] ?></span>
1434 1522
 
1435 1523
                 </td>
@@ -1441,10 +1529,11 @@  discard block
 block discarded – undo
1441 1529
                 <tr valign="top">
1442 1530
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1443 1531
                 <td class="forminp"><?php
1444
-                    if (get_option($value['id']))
1445
-                        $content = stripslashes(get_option($value['id']));
1446
-                    else
1447
-                        $content = $value['std'];
1532
+                    if (get_option($value['id'])) {
1533
+                                            $content = stripslashes(get_option($value['id']));
1534
+                    } else {
1535
+                                            $content = $value['std'];
1536
+                    }
1448 1537
 
1449 1538
                     $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1450 1539
 
@@ -1484,7 +1573,9 @@  discard block
 block discarded – undo
1484 1573
                     'echo' => false,
1485 1574
                     'selected' => $page_setting);
1486 1575
 
1487
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1576
+                if (isset($value['args'])) {
1577
+                	$args = wp_parse_args($value['args'], $args);
1578
+                }
1488 1579
 
1489 1580
                 ?>
1490 1581
                 <tr valign="top" class="single_select_page">
@@ -1503,8 +1594,10 @@  discard block
 block discarded – undo
1503 1594
                 if (strstr($country_setting, ':')) :
1504 1595
                     $country = current(explode(':', $country_setting));
1505 1596
                     $state = end(explode(':', $country_setting));
1506
-                else :
1507
-                    $country = $country_setting;
1597
+                else {
1598
+                	:
1599
+                    $country = $country_setting;
1600
+                }
1508 1601
                     $state = '*';
1509 1602
                 endif;
1510 1603
                 ?>
@@ -1531,8 +1624,10 @@  discard block
 block discarded – undo
1531 1624
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1532 1625
                             title="Country" class="chosen_select">
1533 1626
                         <?php
1534
-                        if ($countries) foreach ($countries as $key => $val) :
1535
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1627
+                        if ($countries) {
1628
+                        	foreach ($countries as $key => $val) :
1629
+                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1630
+                        }
1536 1631
                         endforeach;
1537 1632
                         ?>
1538 1633
                     </select>
@@ -1770,8 +1865,9 @@  discard block
 block discarded – undo
1770 1865
         endforeach;
1771 1866
     endif;
1772 1867
 
1773
-    if (!empty($place_img_array))
1774
-        $curImages = implode(',', $place_img_array);
1868
+    if (!empty($place_img_array)) {
1869
+            $curImages = implode(',', $place_img_array);
1870
+    }
1775 1871
 
1776 1872
 
1777 1873
     // adjust values here
@@ -2117,16 +2213,17 @@  discard block
 block discarded – undo
2117 2213
 	global $post, $typenow, $current_screen;
2118 2214
 	
2119 2215
 	$post_type = NULL;
2120
-    if (isset($_REQUEST['post_type']))
2121
-		$post_type = sanitize_key($_REQUEST['post_type']);
2122
-    elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2123
-		$post_type = get_post_type($_REQUEST['post']);
2124
-    elseif ($post && isset($post->post_type))
2125
-		$post_type = $post->post_type;
2126
-	elseif ($typenow)
2127
-		$post_type = $typenow;
2128
-	elseif ($current_screen && isset($current_screen->post_type))
2129
-		$post_type = $current_screen->post_type;
2216
+    if (isset($_REQUEST['post_type'])) {
2217
+    		$post_type = sanitize_key($_REQUEST['post_type']);
2218
+    } elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post'])) {
2219
+    		$post_type = get_post_type($_REQUEST['post']);
2220
+    } elseif ($post && isset($post->post_type)) {
2221
+    		$post_type = $post->post_type;
2222
+    } elseif ($typenow) {
2223
+			$post_type = $typenow;
2224
+	} elseif ($current_screen && isset($current_screen->post_type)) {
2225
+			$post_type = $current_screen->post_type;
2226
+	}
2130 2227
 
2131 2228
 
2132 2229
 
@@ -2187,9 +2284,10 @@  discard block
 block discarded – undo
2187 2284
 function geodir_hide_admin_preview_button() {
2188 2285
     global $post_type;
2189 2286
     $post_types = geodir_get_posttypes();
2190
-    if(in_array($post_type, $post_types))
2191
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2192
-}
2287
+    if(in_array($post_type, $post_types)) {
2288
+            echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2289
+    }
2290
+    }
2193 2291
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2194 2292
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2195 2293
 
@@ -5419,8 +5517,9 @@  discard block
 block discarded – undo
5419 5517
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5420 5518
     global $wpdb, $plugin_prefix;
5421 5519
 
5422
-    if ( ! post_type_exists( $post_type ) )
5423
-        return new stdClass;
5520
+    if ( ! post_type_exists( $post_type ) ) {
5521
+            return new stdClass;
5522
+    }
5424 5523
         
5425 5524
     $table = $plugin_prefix . $post_type . '_detail';
5426 5525
 
@@ -6077,7 +6176,9 @@  discard block
 block discarded – undo
6077 6176
 
6078 6177
     if ($page_found) :
6079 6178
         // Page exists
6080
-        if (!$option_value) update_option($option, $page_found);
6179
+        if (!$option_value) {
6180
+        	update_option($option, $page_found);
6181
+        }
6081 6182
         return;
6082 6183
     endif;
6083 6184
 
@@ -6488,7 +6589,7 @@  discard block
 block discarded – undo
6488 6589
         
6489 6590
         if(is_array($accounts)){
6490 6591
             $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6491
-        }elseif(get_option('geodir_ga_account_id')){
6592
+        } elseif(get_option('geodir_ga_account_id')){
6492 6593
             $accounts = array();
6493 6594
             $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6494 6595
         }
@@ -6509,14 +6610,16 @@  discard block
 block discarded – undo
6509 6610
     }
6510 6611
 
6511 6612
     # Create a new Gdata call
6512
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6513
-        $stats = new GDGoogleAnalyticsStats();
6514
-    else
6515
-        return false;
6613
+    if ( trim(get_option('geodir_ga_auth_code')) != '' ) {
6614
+            $stats = new GDGoogleAnalyticsStats();
6615
+    } else {
6616
+            return false;
6617
+    }
6516 6618
 
6517 6619
     # Check if Google sucessfully logged in
6518
-    if ( ! $stats->checkLogin() )
6519
-        return false;
6620
+    if ( ! $stats->checkLogin() ) {
6621
+            return false;
6622
+    }
6520 6623
 
6521 6624
     # Get a list of accounts
6522 6625
     try {
@@ -6533,10 +6636,10 @@  discard block
 block discarded – undo
6533 6636
     if ( count($accounts) > 0 ){
6534 6637
         update_option('geodir_gd_uids',$accounts);
6535 6638
         return $accounts;
6639
+    } else {
6640
+            return false;
6641
+    }
6536 6642
     }
6537
-    else
6538
-        return false;
6539
-}
6540 6643
 
6541 6644
 add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6542 6645
 function geodir_ga_deauthorize(){
Please login to merge, or discard this patch.
Spacing   +960 added lines, -960 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
      * @package GeoDirectory
29 29
      */
30 30
     function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
31
+        wp_register_style('geodirectory-admin-css', geodir_plugin_url().'/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32 32
         wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
34
+        wp_register_style('geodirectory-frontend-style', geodir_plugin_url().'/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35 35
         wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
37
+        wp_register_style('geodir-chosen-style', geodir_plugin_url().'/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38 38
         wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
40
+        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url().'/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41 41
         wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
43
+        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url().'/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44 44
         wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
46
+        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url().'/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47 47
         wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
49
+        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url().'/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50 50
         wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
52
+        wp_register_style('geodir-rating-style', geodir_plugin_url().'/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53 53
         wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
55
+        wp_register_style('geodir-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56 56
         wp_enqueue_style('geodir-rtl-style');
57 57
     }
58 58
 }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
71 71
         wp_enqueue_style('font-awesome');
72 72
 
73
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
73
+        wp_register_script('geodirectory-admin', geodir_plugin_url().'/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74 74
         wp_enqueue_script('geodirectory-admin');
75 75
 
76 76
     }
@@ -89,68 +89,68 @@  discard block
 block discarded – undo
89 89
         
90 90
         wp_enqueue_script('jquery');
91 91
 
92
-        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);
92
+        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);
93 93
 
94
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
94
+        wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95 95
         wp_enqueue_script('chosen');
96 96
 
97
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
97
+        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98 98
         wp_enqueue_script('geodirectory-choose-ajax');
99 99
 
100 100
         if (isset($_REQUEST['listing_type'])) {
101
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
101
+            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url().'/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102 102
         }
103 103
 
104 104
         wp_enqueue_script('geodirectory-custom-fields-script');
105
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
105
+        $plugin_path = geodir_plugin_url().'/geodirectory-functions/cat-meta-functions';
106 106
 
107
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
107
+        wp_enqueue_script('tax-meta-clss', $plugin_path.'/js/tax-meta-clss.js', array('jquery'), null, true);
108 108
 
109 109
         if (in_array($geodir_map_name, array('auto', 'google'))) {
110
-            $map_lang = "&language=" . geodir_get_map_default_language();
111
-            $map_key = "&key=" . geodir_get_map_api_key();
110
+            $map_lang = "&language=".geodir_get_map_default_language();
111
+            $map_key = "&key=".geodir_get_map_api_key();
112 112
             /** This filter is documented in geodirectory_template_tags.php */
113 113
             $map_extra = apply_filters('geodir_googlemap_script_extra', '');
114
-            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
114
+            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL);
115 115
             
116 116
             // Overlapping Marker Spiderfier
117
-            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
117
+            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
118 118
             wp_enqueue_script('geodirectory-g-overlappingmarker-script');
119 119
         }
120 120
         
121 121
         if ($geodir_map_name == 'osm') {
122 122
             // Leaflet OpenStreetMap
123
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
123
+            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
124 124
             wp_enqueue_style('geodirectory-leaflet-style');
125 125
                 
126
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
126
+            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
127 127
             wp_enqueue_script('geodirectory-leaflet-script');
128 128
             
129
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
129
+            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
130 130
             wp_enqueue_script('geodirectory-leaflet-geo-script');
131 131
             
132 132
             // Overlapping Marker Spiderfier Leaflet
133
-            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
133
+            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134 134
             wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135 135
         }
136
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
136
+        wp_enqueue_script('jquery-ui-autocomplete');
137 137
         
138
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
138
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true);
139 139
         wp_enqueue_script('geodirectory-goMap-script');
140 140
 
141
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
141
+        wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
142 142
         wp_enqueue_script('geodirectory-goMap-script');
143 143
 
144 144
 		// font awesome rating script
145 145
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
146
-			wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
146
+			wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION);
147 147
 			wp_enqueue_script('geodir-barrating-js');
148 148
 		} else { // default rating script
149
-			wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
149
+			wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.js', array(), GEODIRECTORY_VERSION);
150 150
 			wp_enqueue_script('geodir-jRating-js');
151 151
 		}
152 152
 
153
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
153
+        wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
154 154
         wp_enqueue_script('geodir-on-document-load');
155 155
 
156 156
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         wp_enqueue_script('plupload-all');
159 159
         wp_enqueue_script('jquery-ui-sortable');
160 160
 
161
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
161
+        wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
162 162
         wp_enqueue_script('geodirectory-plupload-script');
163 163
 
164 164
         // SCRIPT FOR UPLOAD END
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
213 213
 
214 214
 
215
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
215
+        wp_register_script('geodirectory-admin-script', geodir_plugin_url().'/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
216 216
         wp_enqueue_script('geodirectory-admin-script');
217 217
 
218 218
         wp_enqueue_style('farbtastic');
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 
221 221
         $screen = get_current_screen();
222 222
         if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
223
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
223
+            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation_admin.js');
224 224
         }
225 225
 
226
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
226
+        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl').'?geodir_ajax=true')));
227 227
         wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
228 228
 
229 229
     }
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
248 248
 
249
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
249
+        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url().'/geodirectory-assets/images/favicon.ico', '55.1984');
250 250
 
251 251
 
252 252
     }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 $geodir_menu_order[] = 'separator-geodirectory';
281 281
                 if (!empty($post_types)) {
282 282
                     foreach ($post_types as $post_type) {
283
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
283
+                        $geodir_menu_order[] = 'edit.php?post_type='.$post_type;
284 284
                     }
285 285
                 }
286 286
                 $geodir_menu_order[] = $item;
@@ -323,8 +323,8 @@  discard block
 block discarded – undo
323 323
 {
324 324
     if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
325 325
         echo '<div id="message" class="updated fade">
326
-                        <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>
327
-                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
326
+                        <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>
327
+                        <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory').'</strong></p>
328 328
                 </div>';
329 329
 
330 330
     }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
     if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
333 333
         switch ($_REQUEST['msg']) {
334 334
             case 'success':
335
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
335
+                echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.', 'geodirectory').'</strong></p></div>';
336 336
                 flush_rewrite_rules(false);
337 337
 
338 338
                 break;
@@ -340,30 +340,30 @@  discard block
 block discarded – undo
340 340
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
341 341
 				
342 342
 				if ($gderr == 21)
343
-			    	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>';
343
+			    	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>';
344 344
 				else
345
-					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
345
+					echo '<div id="message" class="error fade"><p><strong>'.__('Error: Your settings have not been saved, please try again.', 'geodirectory').'</strong></p></div>';
346 346
                 break;
347 347
         }
348 348
     }
349 349
 
350 350
     $geodir_load_map = get_option('geodir_load_map');
351 351
     $need_map_key = false;
352
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
352
+    if ($geodir_load_map == '' || $geodir_load_map == 'google' || $geodir_load_map == 'auto') {
353 353
         $need_map_key = true;
354 354
     }
355 355
 
356 356
     if (!geodir_get_map_api_key() && $need_map_key) {
357
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
357
+        echo '<div class="error"><p><strong>'.sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings').'\'>', '</a>').'</strong></p></div>';
358 358
     }
359 359
 
360 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>';
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 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>';
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
 
@@ -383,18 +383,18 @@  discard block
 block discarded – undo
383 383
 function geodir_handle_option_form_submit($current_tab)
384 384
 {
385 385
     global $geodir_settings;
386
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
386
+    if (file_exists(dirname(__FILE__).'/option-pages/'.$current_tab.'_array.php')) {
387 387
         /**
388 388
          * Contains settings array for current tab.
389 389
          *
390 390
          * @since 1.0.0
391 391
          * @package GeoDirectory
392 392
          */
393
-        include_once('option-pages/' . $current_tab . '_array.php');
393
+        include_once('option-pages/'.$current_tab.'_array.php');
394 394
     }
395 395
     if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
396 396
         if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
397
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
397
+        if (!wp_verify_nonce($_REQUEST['_wpnonce-'.$current_tab], 'geodir-settings-'.$current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
398 398
 		
399 399
 		/**
400 400
 		 * Fires before updating geodirectory admin settings.
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
          * @param string $current_tab The current settings tab name.
428 428
          * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
429 429
          */
430
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
430
+        do_action('geodir_update_options_'.$current_tab, $geodir_settings[$current_tab]);
431 431
 
432 432
         flush_rewrite_rules(false);
433 433
 
434 434
         $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
435 435
 
436
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
436
+        $redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$_REQUEST['active_tab'].'&msg=success');
437 437
 
438 438
         wp_redirect($redirect_url);
439 439
         exit();
@@ -472,18 +472,18 @@  discard block
 block discarded – undo
472 472
 
473 473
         elseif (isset($value['type']) && $value['type'] == 'image_width') :
474 474
 
475
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
476
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
477
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
478
-                if (isset($_POST[$value['id'] . '_crop'])) :
479
-                    update_option($value['id'] . '_crop', 1);
475
+            if (isset($value['id']) && isset($_POST[$value['id'].'_width'])) {
476
+                update_option($value['id'].'_width', $_POST[$value['id'].'_width']);
477
+                update_option($value['id'].'_height', $_POST[$value['id'].'_height']);
478
+                if (isset($_POST[$value['id'].'_crop'])) :
479
+                    update_option($value['id'].'_crop', 1);
480 480
                 else :
481
-                    update_option($value['id'] . '_crop', 0);
481
+                    update_option($value['id'].'_crop', 0);
482 482
                 endif;
483 483
             } else {
484
-                update_option($value['id'] . '_width', $value['std']);
485
-                update_option($value['id'] . '_height', $value['std']);
486
-                update_option($value['id'] . '_crop', 1);
484
+                update_option($value['id'].'_width', $value['std']);
485
+                update_option($value['id'].'_height', $value['std']);
486
+                update_option($value['id'].'_crop', 1);
487 487
             }
488 488
 
489 489
         elseif (isset($value['type']) && $value['type'] == 'map') :
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
         elseif (isset($value['type']) && $value['type'] == 'file') :
526 526
 
527 527
 
528
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
528
+            if (isset($_POST[$value['id'].'_remove']) && $_POST[$value['id'].'_remove']) {// if remove is set then remove the file
529 529
 
530 530
                 if (get_option($value['id'])) {
531 531
                     $image_name_arr = explode('/', get_option($value['id']));
532 532
                     $noimg_name = end($image_name_arr);
533
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
533
+                    $img_path = $uploads['path'].'/'.$noimg_name;
534 534
                     if (file_exists($img_path))
535 535
                         unlink($img_path);
536 536
                 }
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
                 if (get_option($value['id'])) {
559 559
                     $image_name_arr = explode('/', get_option($value['id']));
560 560
                     $noimg_name = end($image_name_arr);
561
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
561
+                    $img_path = $uploads['path'].'/'.$noimg_name;
562 562
                     if (file_exists($img_path))
563 563
                         unlink($img_path);
564 564
                 }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
             // same menu setting per theme.
580 580
             if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
581 581
                 $theme = wp_get_theme();
582
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
582
+                update_option('geodir_theme_location_nav_'.$theme->name, $_POST[$value['id']]);
583 583
             }
584 584
 
585 585
             if (isset($value['id']) && isset($_POST[$value['id']])) {
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 
650 650
             $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
651 651
 
652
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
652
+            $tabs[$geodir_post_type.'_fields_settings'] = array(
653 653
                 'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
654 654
                 'subtabs' => array(
655 655
                     array('subtab' => 'custom_fields',
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
  */
684 684
 function geodir_tools_setting_tab($tabs)
685 685
 {
686
-    wp_enqueue_script( 'jquery-ui-progressbar' );
686
+    wp_enqueue_script('jquery-ui-progressbar');
687 687
     $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
688 688
     return $tabs;
689 689
 }
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
  */
718 718
 function geodir_extend_geodirectory_setting_tab($tabs)
719 719
 {
720
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
720
+    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory').' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
721 721
     return $tabs;
722 722
 }
723 723
 
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
                     _e('Unknown', 'geodirectory');
778 778
                 } else {
779 779
                     /* If there is a city id, append 'city name' to the text string. */
780
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
781
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
780
+                    $add_location_id = $location_id > 0 ? ' ('.$location_id.')' : '';
781
+                    echo(__($location->country, 'geodirectory').'-'.$location->region.'-'.$location->city.$add_location_id);
782 782
                 }
783 783
                 break;
784 784
 
@@ -796,14 +796,14 @@  discard block
 block discarded – undo
796 796
                         $expire_class = 'expire_over';
797 797
                     }
798 798
                     $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
799
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
799
+                    $date_diff_text = '<br /><span class="'.$expire_class.'">('.$date_diff.' '.$state.')</span>';
800 800
                 }
801 801
                 /* If no expire_date is found, output a default message. */
802 802
                 if (empty($expire_date))
803 803
                     echo __('Unknown', 'geodirectory');
804 804
                 /* If there is a expire_date, append 'days left' to the text string. */
805 805
                 else
806
-                    echo $expire_date . $date_diff_text;
806
+                    echo $expire_date.$date_diff_text;
807 807
                 break;
808 808
 
809 809
             /* If displaying the 'categorys' column. */
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 function geodir_post_information_save($post_id, $post) {
871 871
     global $wpdb, $current_user;
872 872
 
873
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
873
+    if (isset($post->post_type) && ($post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post')) {
874 874
         return;
875 875
     }
876 876
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
                     $tab_id = $value['id'];
939 939
 
940 940
                 if (isset($value['desc']) && $value['desc'])
941
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
941
+                    $desc = '<span style=" text-transform:none;">:- '.$value['desc'].'</span>';
942 942
 
943 943
                 if (isset($value['name']) && $value['name']) {
944 944
                     if ($first_title === true) {
@@ -946,9 +946,9 @@  discard block
 block discarded – undo
946 946
                     } else {
947 947
                         echo '</div>';
948 948
                     }
949
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
949
+                    echo '<dd id="'.trim($tab_id).'" class="geodir_option_tabs" ><a href="javascript:void(0);">'.$value['name'].'</a></dd>';
950 950
 
951
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
951
+                    echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
952 952
                 }
953 953
 
954 954
                 /**
@@ -958,21 +958,21 @@  discard block
 block discarded – undo
958 958
                  *
959 959
                  * @since 1.0.0
960 960
                  */
961
-                do_action('geodir_settings_' . sanitize_title($value['id']));
961
+                do_action('geodir_settings_'.sanitize_title($value['id']));
962 962
                 break;
963 963
 
964 964
             case 'no_tabs':
965 965
 
966 966
                 echo '<div class="inner_content_tab_main">';
967
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
967
+                echo '<div id="sub_'.trim($tab_id).'" class="gd-content-heading" style=" margin-bottom:10px;" >';
968 968
 
969 969
                 break;
970 970
 
971 971
             case 'sectionstart':
972 972
                 if (isset($value['desc']) && $value['desc'])
973
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
973
+                    $desc = '<span style=" text-transform:none;"> - '.$value['desc'].'</span>';
974 974
                 if (isset($value['name']) && $value['name'])
975
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
975
+                    echo '<h3>'.$value['name'].$desc.'</h3>';
976 976
                 /**
977 977
                  * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
978 978
                  *
@@ -980,8 +980,8 @@  discard block
 block discarded – undo
980 980
                  *
981 981
                  * @since 1.0.0
982 982
                  */
983
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
984
-                echo '<table class="form-table">' . "\n\n";
983
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_start');
984
+                echo '<table class="form-table">'."\n\n";
985 985
 
986 986
                 break;
987 987
             case 'sectionend':
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
                  *
993 993
                  * @since 1.0.0
994 994
                  */
995
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
995
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_end');
996 996
                 echo '</table>';
997 997
                 /**
998 998
                  * Called after a GeoDirectory settings sectionend is output in the GD settings page.
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
                  *
1002 1002
                  * @since 1.0.0
1003 1003
                  */
1004
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1004
+                if (isset($value['id']) && $value['id']) do_action('geodir_settings_'.sanitize_title($value['id']).'_after');
1005 1005
                 break;
1006 1006
             case 'text':
1007 1007
                 ?>
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1011 1011
                                            id="<?php echo esc_attr($value['id']); ?>"
1012 1012
                                            type="<?php echo esc_attr($value['type']); ?>"
1013
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1013
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1014 1014
                                            style=" <?php echo esc_attr($value['css']); ?>"
1015 1015
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1016 1016
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1027,14 +1027,14 @@  discard block
 block discarded – undo
1027 1027
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1028 1028
                                            id="<?php echo esc_attr($value['id']); ?>"
1029 1029
                                            type="<?php echo esc_attr($value['type']); ?>"
1030
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1030
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1031 1031
                                            style=" <?php echo esc_attr($value['css']); ?>"
1032 1032
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1033 1033
                                                echo esc_attr(stripslashes(get_option($value['id'])));
1034 1034
                                            } else {
1035 1035
                                                echo esc_attr($value['std']);
1036 1036
                                            } ?>"/>
1037
-                    <a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]&TB_iframe=true&width=600&height=400' class="thickbox button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1037
+                    <a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]&TB_iframe=true&width=600&height=400' class="thickbox button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )', 'geodirectory'); ?>" ><?php _e('Generate API Key', 'geodirectory'); ?></a>
1038 1038
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1039 1039
                 </tr><?php
1040 1040
                 break;
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1047 1047
                                            id="<?php echo esc_attr($value['id']); ?>"
1048 1048
                                            type="<?php echo esc_attr($value['type']); ?>"
1049
-                                           <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1049
+                                           <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1050 1050
                                            style="<?php echo esc_attr($value['css']); ?>"
1051 1051
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1052 1052
                                                echo esc_attr(stripslashes(get_option($value['id'])));
@@ -1092,17 +1092,17 @@  discard block
 block discarded – undo
1092 1092
                     <?php _e('Width', 'geodirectory'); ?> <input
1093 1093
                         name="<?php echo esc_attr($value['id']); ?>_width"
1094 1094
                         id="<?php echo esc_attr($value['id']); ?>_width" type="text" size="3"
1095
-                        value="<?php if ($size = get_option($value['id'] . '_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1095
+                        value="<?php if ($size = get_option($value['id'].'_width')) echo stripslashes($size); else echo $value['std']; ?>"/>
1096 1096
 
1097 1097
                     <?php _e('Height', 'geodirectory'); ?> <input
1098 1098
                         name="<?php echo esc_attr($value['id']); ?>_height"
1099 1099
                         id="<?php echo esc_attr($value['id']); ?>_height" type="text" size="3"
1100
-                        value="<?php if ($size = get_option($value['id'] . '_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1100
+                        value="<?php if ($size = get_option($value['id'].'_height')) echo stripslashes($size); else echo $value['std']; ?>"/>
1101 1101
 
1102 1102
                     <label><?php _e('Hard Crop', 'geodirectory'); ?> <input
1103 1103
                             name="<?php echo esc_attr($value['id']); ?>_crop"
1104 1104
                             id="<?php echo esc_attr($value['id']); ?>_crop"
1105
-                            type="checkbox" <?php if (get_option($value['id'] . '_crop') != '') checked(get_option($value['id'] . '_crop'), 1); else checked(1); ?> /></label>
1105
+                            type="checkbox" <?php if (get_option($value['id'].'_crop') != '') checked(get_option($value['id'].'_crop'), 1); else checked(1); ?> /></label>
1106 1106
 
1107 1107
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1108 1108
                 </tr><?php
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
                                             id="<?php echo esc_attr($value['id']); ?>"
1153 1153
                                             style="<?php echo esc_attr($value['css']); ?>"
1154 1154
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1155
-                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1155
+                                            data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text']; ?>"
1156 1156
                                             option-ajaxchosen="false">
1157 1157
                         <?php
1158 1158
                         foreach ($value['options'] as $key => $val) {
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
                                 ?></optgroup><?php
1163 1163
                             } else {
1164 1164
                                 ?>
1165
-                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1165
+                                <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values))); ?>>
1166 1166
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1167 1167
                                 </option>
1168 1168
                             <?php
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
                 ?>
1200 1200
 
1201 1201
                 <tr valign="top">
1202
-                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1202
+                    <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory'); ?></th>
1203 1203
                     <td width="60%">
1204 1204
                         <select name="geodir_default_map_language" style="width:60%">
1205 1205
                             <?php
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 
1282 1282
                 <tr valign="top">
1283 1283
                     <th class="titledesc"
1284
-                        width="40%"><?php _e('Default post type search on map', 'geodirectory');?></th>
1284
+                        width="40%"><?php _e('Default post type search on map', 'geodirectory'); ?></th>
1285 1285
                     <td width="60%">
1286 1286
                         <select name="geodir_default_map_search_pt" style="width:60%">
1287 1287
                             <?php
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
                         $cat_display = 'checkbox';
1323 1323
                         $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1324 1324
                         $gd_cats = get_option('geodir_exclude_cat_on_map');
1325
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1325
+                        $gd_cats_upgrade = (int) get_option('geodir_exclude_cat_on_map_upgrade');
1326 1326
                         $count = 1;
1327 1327
                         ?>
1328 1328
                         <table width="70%" class="widefat">
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
                                                                                            name="home_map_post_types[]"
1352 1352
                                                                                            id="<?php echo esc_attr($value['id']); ?>"
1353 1353
                                                                                            value="<?php echo $key; ?>"
1354
-                                                                                           class="map_post_type" <?php echo $checked;?> />
1354
+                                                                                           class="map_post_type" <?php echo $checked; ?> />
1355 1355
                                         <?php echo __($post_types_obj->labels->singular_name, 'geodirectory'); ?></td>
1356 1356
                                     <td width="40%">
1357 1357
                                         <div class="home_map_category" style="overflow:auto;width:200px;height:100px;"
@@ -1409,12 +1409,12 @@  discard block
 block discarded – undo
1409 1409
                 ?>
1410 1410
                 <fieldset>
1411 1411
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1412
-                    <label for="<?php echo $value['id'];?>">
1412
+                    <label for="<?php echo $value['id']; ?>">
1413 1413
                         <input name="<?php echo esc_attr($value['id']); ?>"
1414
-                               id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1414
+                               id="<?php echo esc_attr($value['id'].$value['value']); ?>" type="radio"
1415 1415
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1416 1416
                             echo 'checked="checked"';
1417
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1417
+                        }elseif (get_option($value['id']) == '' && $value['std'] == $value['value']) {echo 'checked="checked"'; } ?> />
1418 1418
                         <?php echo $value['desc']; ?></label><br>
1419 1419
                 </fieldset>
1420 1420
                 <?php
@@ -1434,9 +1434,9 @@  discard block
 block discarded – undo
1434 1434
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1435 1435
                 <td class="forminp">
1436 1436
                     <textarea
1437
-                        <?php if (isset($value['args'])) echo $value['args'] . ' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1437
+                        <?php if (isset($value['args'])) echo $value['args'].' '; ?>name="<?php echo esc_attr($value['id']); ?>"
1438 1438
                         id="<?php echo esc_attr($value['id']); ?>"
1439
-                        <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1439
+                        <?php if (isset($value['placeholder'])) {?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1440 1440
                         style="<?php echo esc_attr($value['css']); ?>"><?php if (get_option($value['id'])) echo esc_textarea(stripslashes(get_option($value['id']))); else echo esc_textarea($value['std']); ?></textarea><span
1441 1441
                         class="description"><?php echo $value['desc'] ?></span>
1442 1442
 
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
 					}
1482 1482
 				}
1483 1483
 				//
1484
-				$page_setting = (int)get_option($value['id']);
1484
+				$page_setting = (int) get_option($value['id']);
1485 1485
 
1486 1486
                 $args = array('name' => $value['id'],
1487 1487
                     'id' => $value['id'],
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
                 <tr valign="top" class="single_select_page">
1499 1499
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1500 1500
                 <td class="forminp">
1501
-                    <?php echo str_replace(' id=', " data-placeholder='" . __('Select a page...', 'geodirectory') . "' style='" . $value['css'] . "' class='" . $value['class'] . "' " . $disabled . " id=", wp_dropdown_pages($args)); ?>
1501
+                    <?php echo str_replace(' id=', " data-placeholder='".__('Select a page...', 'geodirectory')."' style='".$value['css']."' class='".$value['class']."' ".$disabled." id=", wp_dropdown_pages($args)); ?>
1502 1502
                     <span class="description"><?php echo $value['desc'] ?></span>
1503 1503
                 </td>
1504 1504
                 </tr><?php
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
 				}
1508 1508
                 break;
1509 1509
             case 'single_select_country' :
1510
-                $country_setting = (string)get_option($value['id']);
1510
+                $country_setting = (string) get_option($value['id']);
1511 1511
                 if (strstr($country_setting, ':')) :
1512 1512
                     $country = current(explode(':', $country_setting));
1513 1513
                     $state = end(explode(':', $country_setting));
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
             case 'multi_select_countries' :
1531 1531
                 $countries = $geodirectory->countries->countries;
1532 1532
                 asort($countries);
1533
-                $selections = (array)get_option($value['id']);
1533
+                $selections = (array) get_option($value['id']);
1534 1534
                 ?>
1535 1535
                 <tr valign="top">
1536 1536
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
                             title="Country" class="chosen_select">
1541 1541
                         <?php
1542 1542
                         if ($countries) foreach ($countries as $key => $val) :
1543
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1543
+                            echo '<option value="'.$key.'" '.selected(in_array($key, $selections), true, false).'>'.$val.'</option>';
1544 1544
                         endforeach;
1545 1545
                         ?>
1546 1546
                     </select>
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
                 break;
1553 1553
 
1554 1554
             case 'google_analytics' :
1555
-                $selections = (array)get_option($value['id']);
1555
+                $selections = (array) get_option($value['id']);
1556 1556
                     ?>
1557 1557
                     <tr valign="top">
1558 1558
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
@@ -1563,30 +1563,30 @@  discard block
 block discarded – undo
1563 1563
 
1564 1564
                             $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1565 1565
                             $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1566
-                            $state = "&state=123";//any string
1567
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1566
+                            $state = "&state=123"; //any string
1567
+                            $redirect_uri = "&redirect_uri=".admin_url('admin-ajax.php')."?action=geodir_ga_callback";
1568 1568
                             $response_type = "&response_type=code";
1569 1569
                             $client_id = "&client_id=".get_option('geodir_ga_client_id');
1570 1570
                             $access_type = "&access_type=offline";
1571 1571
                             $approval_prompt = "&approval_prompt=force";
1572 1572
 
1573
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1573
+                            $auth_url = $oAuthURL.$scope.$state.$redirect_uri.$response_type.$client_id.$access_type.$approval_prompt;
1574 1574
 
1575 1575
 
1576 1576
                             if (get_option('geodir_ga_auth_token')) {
1577 1577
                                 ?>
1578 1578
                                 <span class="button-primary"
1579
-                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1579
+                                      onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize'); ?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1580 1580
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1581 1581
                             <?php
1582 1582
                                 global $gd_ga_errors;
1583
-                                if(!empty($gd_ga_errors)){
1583
+                                if (!empty($gd_ga_errors)) {
1584 1584
                                     print_r($gd_ga_errors);
1585 1585
                                 }
1586 1586
                             } else {
1587 1587
                                 ?>
1588 1588
                                 <span class="button-primary"
1589
-                                      onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1589
+                                      onclick="window.open('<?php echo  geodir_ga_activation_url(); ?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory'); ?></span>
1590 1590
                             <?php
1591 1591
                             }
1592 1592
                             ?>
@@ -1657,9 +1657,9 @@  discard block
 block discarded – undo
1657 1657
 
1658 1658
             <?php if (isset($_REQUEST['active_tab']) && $_REQUEST['active_tab'] != '') { ?>
1659 1659
             jQuery('.geodir_option_tabs').removeClass('gd-tab-active');
1660
-            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').addClass('gd-tab-active');
1660
+            jQuery('#<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').addClass('gd-tab-active');
1661 1661
             jQuery('.gd-content-heading').hide();
1662
-            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']);?>').show();
1662
+            jQuery('#sub_<?php echo sanitize_text_field($_REQUEST['active_tab']); ?>').show();
1663 1663
             <?php } ?>
1664 1664
         });
1665 1665
     </script>
@@ -1745,7 +1745,7 @@  discard block
 block discarded – undo
1745 1745
     wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1746 1746
 
1747 1747
     if (geodir_get_featured_image($post_id, 'thumbnail')) {
1748
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1748
+        echo '<h4>'.__('Featured Image', 'geodirectory').'</h4>';
1749 1749
         geodir_show_featured_image($post_id, 'thumbnail');
1750 1750
     }
1751 1751
 
@@ -1756,13 +1756,13 @@  discard block
 block discarded – undo
1756 1756
 
1757 1757
     <h5 class="form_title">
1758 1758
         <?php if ($image_limit != 0 && $image_limit == 1) {
1759
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1759
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
1760 1760
         } ?>
1761 1761
         <?php if ($image_limit != 0 && $image_limit > 1) {
1762
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1762
+            echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
1763 1763
         } ?>
1764 1764
         <?php if ($image_limit == 0) {
1765
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1765
+            echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
1766 1766
         } ?>
1767 1767
     </h5>
1768 1768
 
@@ -1801,10 +1801,10 @@  discard block
 block discarded – undo
1801 1801
         <div
1802 1802
             class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1803 1803
             id="<?php echo $id; ?>plupload-upload-ui">
1804
-            <h4><?php _e('Drop files to upload', 'geodirectory');?></h4>
1804
+            <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4>
1805 1805
             <input id="<?php echo $id; ?>plupload-browse-button" type="button"
1806 1806
                    value="<?php _e('Select Files', 'geodirectory'); ?>" class="button"/>
1807
-            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
1807
+            <span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
1808 1808
             <?php if ($width && $height): ?>
1809 1809
                 <span class="plupload-resize"></span>
1810 1810
                 <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
              id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
1817 1817
         </div>
1818 1818
         <span
1819
-            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
1819
+            id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
1820 1820
         <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
1821 1821
     </div>
1822 1822
 
@@ -2026,9 +2026,9 @@  discard block
 block discarded – undo
2026 2026
     $plugin = 'avada-nag';
2027 2027
     $timestamp = 'avada-nag1234';
2028 2028
     $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');
2029
-    echo '<div id="' . $timestamp . '"  class="error">';
2030
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2031
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2029
+    echo '<div id="'.$timestamp.'"  class="error">';
2030
+    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\''.$plugin.'\',\''.$timestamp.'\');" ><i class="fa fa-times"></i></span>';
2031
+    echo "<img class='gd-icon-noti' src='".plugin_dir_url('')."geodirectory/geodirectory-assets/images/favicon.ico' > ";
2032 2032
     echo "<p>$message</p>";
2033 2033
     echo "</div>";
2034 2034
 
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
 		
2163 2163
 		// Don't allow same slug url for listing and location
2164 2164
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2165
-			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2165
+			$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab.'&msg=fail&gderr=21');
2166 2166
         	wp_redirect($redirect_url);
2167 2167
 			exit;
2168 2168
 		}
@@ -2174,7 +2174,7 @@  discard block
 block discarded – undo
2174 2174
 			$default_language = $sitepress->get_default_language();
2175 2175
 			
2176 2176
 			if ($current_language != 'all' && $current_language != $default_language) {
2177
-				$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab);
2177
+				$redirect_url = admin_url('admin.php?page=geodirectory&tab='.$current_tab.'&active_tab='.$active_tab);
2178 2178
 				wp_redirect($redirect_url);
2179 2179
 				exit;
2180 2180
 			}
@@ -2195,11 +2195,11 @@  discard block
 block discarded – undo
2195 2195
 function geodir_hide_admin_preview_button() {
2196 2196
     global $post_type;
2197 2197
     $post_types = geodir_get_posttypes();
2198
-    if(in_array($post_type, $post_types))
2198
+    if (in_array($post_type, $post_types))
2199 2199
         echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2200 2200
 }
2201
-add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2202
-add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
2201
+add_action('admin_head-post-new.php', 'geodir_hide_admin_preview_button');
2202
+add_action('admin_head-post.php', 'geodir_hide_admin_preview_button');
2203 2203
 
2204 2204
 /**
2205 2205
  * Add the tab in left sidebar menu fro import & export page.
@@ -2209,8 +2209,8 @@  discard block
 block discarded – undo
2209 2209
  *
2210 2210
  * @return array Array of tab data.
2211 2211
  */
2212
-function geodir_import_export_tab( $tabs ) {
2213
-	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2212
+function geodir_import_export_tab($tabs) {
2213
+	$tabs['import_export'] = array('label' => __('Import & Export', 'geodirectory'));
2214 2214
     return $tabs;
2215 2215
 }
2216 2216
 
@@ -2224,8 +2224,8 @@  discard block
 block discarded – undo
2224 2224
  * @return string Html content.
2225 2225
  */
2226 2226
 function geodir_import_export_page() {
2227
-	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2228
-	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2227
+	$nonce = wp_create_nonce('geodir_import_export_nonce');
2228
+	$gd_cats_sample_csv = geodir_plugin_url().'/geodirectory-assets/gd_sample_categories.csv';
2229 2229
     /**
2230 2230
      * Filter sample category data csv file url.
2231 2231
      *
@@ -2234,9 +2234,9 @@  discard block
 block discarded – undo
2234 2234
      *
2235 2235
      * @param string $gd_cats_sample_csv Sample category data csv file url.
2236 2236
      */
2237
-	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2237
+	$gd_cats_sample_csv = apply_filters('geodir_export_cats_sample_csv', $gd_cats_sample_csv);
2238 2238
 	
2239
-	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2239
+	$gd_posts_sample_csv = geodir_plugin_url().'/geodirectory-assets/place_listing.csv';
2240 2240
     /**
2241 2241
      * Filter sample post data csv file url.
2242 2242
      *
@@ -2245,15 +2245,15 @@  discard block
 block discarded – undo
2245 2245
      *
2246 2246
      * @param string $gd_posts_sample_csv Sample post data csv file url.
2247 2247
      */
2248
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2248
+    $gd_posts_sample_csv = apply_filters('geodir_export_posts_sample_csv', $gd_posts_sample_csv);
2249 2249
 	
2250
-	$gd_posttypes = geodir_get_posttypes( 'array' );
2250
+	$gd_posttypes = geodir_get_posttypes('array');
2251 2251
 	
2252 2252
 	$gd_posttypes_option = '';
2253
-	foreach ( $gd_posttypes as $gd_posttype => $row ) {
2254
-		$gd_posttypes_option .= '<option value="' . $gd_posttype . '" data-cats="' . (int)geodir_get_terms_count( $gd_posttype ) . '" data-posts="' . (int)geodir_get_posts_count( $gd_posttype ) . '">' . __( $row['labels']['name'], 'geodirectory' ) . '</option>';
2253
+	foreach ($gd_posttypes as $gd_posttype => $row) {
2254
+		$gd_posttypes_option .= '<option value="'.$gd_posttype.'" data-cats="'.(int) geodir_get_terms_count($gd_posttype).'" data-posts="'.(int) geodir_get_posts_count($gd_posttype).'">'.__($row['labels']['name'], 'geodirectory').'</option>';
2255 2255
 	}
2256
-	wp_enqueue_script( 'jquery-ui-progressbar' );
2256
+	wp_enqueue_script('jquery-ui-progressbar');
2257 2257
 	
2258 2258
 	$gd_chunksize_options = array();
2259 2259
 	$gd_chunksize_options[100] = 100;
@@ -2275,50 +2275,50 @@  discard block
 block discarded – undo
2275 2275
      *
2276 2276
      * @param string $gd_chunksize_options Entries options.
2277 2277
      */
2278
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2278
+    $gd_chunksize_options = apply_filters('geodir_export_csv_chunksize_options', $gd_chunksize_options);
2279 2279
 	
2280 2280
 	$gd_chunksize_option = '';
2281 2281
 	foreach ($gd_chunksize_options as $value => $title) {
2282
-		$gd_chunksize_option .= '<option value="' . $value . '" ' . selected($value, 5000, false) . '>' . $title . '</option>';
2282
+		$gd_chunksize_option .= '<option value="'.$value.'" '.selected($value, 5000, false).'>'.$title.'</option>';
2283 2283
 	}
2284 2284
 	
2285 2285
 	$uploads = wp_upload_dir();
2286
-	$upload_dir = wp_sprintf( CSV_TRANSFER_IMG_FOLDER, str_replace( ABSPATH, '', $uploads['path'] ) );
2286
+	$upload_dir = wp_sprintf(CSV_TRANSFER_IMG_FOLDER, str_replace(ABSPATH, '', $uploads['path']));
2287 2287
 ?>
2288 2288
 </form>
2289 2289
 <div class="inner_content_tab_main gd-import-export">
2290
-  <h3><?php _e( 'GD Import & Export CSV', 'geodirectory' ) ;?></h3>
2291
-  <span class="description"><?php _e( 'Import & export csv for GD listings & categories.', 'geodirectory' ) ;?></span>
2290
+  <h3><?php _e('GD Import & Export CSV', 'geodirectory'); ?></h3>
2291
+  <span class="description"><?php _e('Import & export csv for GD listings & categories.', 'geodirectory'); ?></span>
2292 2292
   <div class="gd-content-heading">
2293 2293
 
2294 2294
   <?php
2295 2295
     ini_set('max_execution_time', 999999);
2296
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2296
+    $ini_max_execution_time_check = @ini_get('max_execution_time');
2297 2297
     ini_restore('max_execution_time');
2298 2298
 
2299
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2299
+    if ($ini_max_execution_time_check != 999999) { // only show these setting to the user if we can't change the ini setting
2300 2300
         ?>
2301 2301
 	<div id="gd_ie_reqs" class="metabox-holder">
2302 2302
       <div class="meta-box-sortables ui-sortable">
2303 2303
         <div class="postbox">
2304
-          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __( 'PHP Requirements for GD Import & Export CSV', 'geodirectory' );?></span></h3>
2304
+          <h3 class="hndle"><span style='vertical-align:top;'><?php echo __('PHP Requirements for GD Import & Export CSV', 'geodirectory'); ?></span></h3>
2305 2305
           <div class="inside">
2306
-            <span class="description"><?php echo __( 'Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory' );?></span>
2306
+            <span class="description"><?php echo __('Note: In case GD import & export csv not working for larger data then please check and configure following php settings.', 'geodirectory'); ?></span>
2307 2307
 			<table class="form-table">
2308 2308
 				<thead>
2309 2309
 				  <tr>
2310
-				  	<th><?php _e( 'PHP Settings', 'geodirectory' );?></th><th><?php _e( 'Current Value', 'geodirectory' );?></th><th><?php _e( 'Recommended Value', 'geodirectory' );?></th>
2310
+				  	<th><?php _e('PHP Settings', 'geodirectory'); ?></th><th><?php _e('Current Value', 'geodirectory'); ?></th><th><?php _e('Recommended Value', 'geodirectory'); ?></th>
2311 2311
 				  </tr>
2312 2312
 				</thead>
2313 2313
 				<tbody>
2314 2314
 				  <tr>
2315
-				  	<td>max_input_time</td><td><?php echo @ini_get( 'max_input_time' );?></td><td>3000</td>
2315
+				  	<td>max_input_time</td><td><?php echo @ini_get('max_input_time'); ?></td><td>3000</td>
2316 2316
 				  </tr>
2317 2317
 				  <tr>
2318
-				  	<td>max_execution_time</td><td><?php  echo @ini_get( 'max_execution_time' );?></td><td>3000</td>
2318
+				  	<td>max_execution_time</td><td><?php  echo @ini_get('max_execution_time'); ?></td><td>3000</td>
2319 2319
 				  </tr>
2320 2320
 				  <tr>
2321
-				  	<td>memory_limit</td><td><?php echo @ini_get( 'memory_limit' );?></td><td>256M</td>
2321
+				  	<td>memory_limit</td><td><?php echo @ini_get('memory_limit'); ?></td><td>256M</td>
2322 2322
 				  </tr>
2323 2323
 				</tbody>
2324 2324
 		    </table>
@@ -2330,21 +2330,21 @@  discard block
 block discarded – undo
2330 2330
 	<div id="gd_ie_imposts" class="metabox-holder">
2331 2331
       <div class="meta-box-sortables ui-sortable">
2332 2332
         <div id="gd_ie_im_posts" class="postbox gd-hndle-pbox">
2333
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Listings: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2334
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Import CSV', 'geodirectory' );?></span></h3>
2333
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Listings: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2334
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Import CSV', 'geodirectory'); ?></span></h3>
2335 2335
           <div class="inside">
2336 2336
             <table class="form-table">
2337 2337
 				<tbody>
2338 2338
 				  <tr>
2339 2339
 					<td class="gd-imex-box">
2340 2340
 						<div class="gd-im-choices">
2341
-						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e( 'Update listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2342
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e( 'Ignore listing if post with post_id already exists.', 'geodirectory' );?></label></p>
2341
+						<p><input type="radio" value="update" name="gd_im_choicepost" id="gd_im_pchoice_u" /><label for="gd_im_pchoice_u"><?php _e('Update listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2342
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicepost" id="gd_im_pchoice_s" /><label for="gd_im_pchoice_s"><?php _e('Ignore listing if post with post_id already exists.', 'geodirectory'); ?></label></p>
2343 2343
 						</div>
2344 2344
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_postplupload-upload-ui">
2345 2345
 							<input type="text" readonly="readonly" name="gd_im_post_file" class="gd-imex-file gd_im_post_file" id="gd_im_post" onclick="jQuery('#gd_im_postplupload-browse-button').trigger('click');" />
2346
-							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2347
-						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv;?>" />
2346
+							<input id="gd_im_postplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-pupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imposts_sample" id="gd_ie_imposts_sample">
2347
+						<input type="hidden" id="gd_ie_imposts_csv" value="<?php echo $gd_posts_sample_csv; ?>" />
2348 2348
 						<input type="hidden" id="gd_im_post_allowed_types" data-exts=".csv" value="csv" />
2349 2349
 							<?php
2350 2350
 							/**
@@ -2354,7 +2354,7 @@  discard block
 block discarded – undo
2354 2354
 							 */
2355 2355
 							do_action('geodir_sample_csv_download_link');
2356 2356
 							?>
2357
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_postpluploadan' ); ?>"></span>
2357
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_postpluploadan'); ?>"></span>
2358 2358
 							<div class="filelist"></div>
2359 2359
 						</div>
2360 2360
 						<span id="gd_im_postupload-error" style="display:none"></span>
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2373 2373
 						</div>
2374 2374
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2375
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2375
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2376 2376
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2377 2377
 									id="gd-import-perc">0%</font> )
2378 2378
 								<div class="gd-fileprogress"></div>
@@ -2384,10 +2384,10 @@  discard block
 block discarded – undo
2384 2384
                     	<div class="gd-imex-btns" style="display:none;">
2385 2385
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2386 2386
                         	<input onclick="gd_imex_PrepareImport(this, 'post')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2387
-                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2388
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2387
+                        	<input onclick="gd_imex_ContinueImport(this, 'post')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2388
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'post')"/>
2389 2389
 							<div id="gd_process_data" style="display:none">
2390
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2390
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2391 2391
 							</div>
2392 2392
 						</div>
2393 2393
 					</td>
@@ -2401,30 +2401,30 @@  discard block
 block discarded – undo
2401 2401
 	<div id="gd_ie_excategs" class="metabox-holder">
2402 2402
 	  <div class="meta-box-sortables ui-sortable">
2403 2403
 		<div id="gd_ie_ex_posts" class="postbox gd-hndle-pbox">
2404
-		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - Listings: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2405
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Listings: Export CSV', 'geodirectory' );?></span></h3>
2404
+		  <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - Listings: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2405
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Listings: Export CSV', 'geodirectory'); ?></span></h3>
2406 2406
 		  <div class="inside">
2407 2407
 			<table class="form-table">
2408 2408
 			  <tbody>
2409 2409
 				<tr>
2410 2410
 				  <td class="fld"><label for="gd_post_type">
2411
-					<?php _e( 'Post Type:', 'geodirectory' );?>
2411
+					<?php _e('Post Type:', 'geodirectory'); ?>
2412 2412
 					</label></td>
2413 2413
 				  <td><select name="gd_post_type" id="gd_post_type" style="min-width:140px">
2414
-					  <?php echo $gd_posttypes_option;?>
2414
+					  <?php echo $gd_posttypes_option; ?>
2415 2415
 					</select></td>
2416 2416
 				</tr>
2417 2417
 				<tr>
2418
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2419
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2418
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2419
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2420 2420
 				</tr>
2421 2421
                 <tr class="gd-imex-dates">
2422
-					<td class="fld"><label><?php _e( 'Published Date:', 'geodirectory' );?></label></td>
2423
-					<td><label><span class="label-responsive"><?php _e( 'Start date:', 'geodirectory' );?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e( 'End date:', 'geodirectory' );?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2422
+					<td class="fld"><label><?php _e('Published Date:', 'geodirectory'); ?></label></td>
2423
+					<td><label><span class="label-responsive"><?php _e('Start date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_start_date" name="gd_imex[start_date]" data-type="date" /></label><label><span class="label-responsive"><?php _e('End date:', 'geodirectory'); ?></span><input type="text" id="gd_imex_end_date" name="gd_imex[end_date]" data-type="date" /></label></td>
2424 2424
 				</tr>
2425 2425
 				<tr>
2426 2426
 				  <td class="fld" style="vertical-align:top"><label>
2427
-					<?php _e( 'Progress:', 'geodirectory' );?>
2427
+					<?php _e('Progress:', 'geodirectory'); ?>
2428 2428
 					</label></td>
2429 2429
 				  <td><div id='gd_progressbar_box'>
2430 2430
 					  <div id="gd_progressbar" class="gd_progressbar">
@@ -2432,13 +2432,13 @@  discard block
 block discarded – undo
2432 2432
 					  </div>
2433 2433
 					</div>
2434 2434
 					<p style="display:inline-block">
2435
-					  <?php _e( 'Elapsed Time:', 'geodirectory' );?>
2435
+					  <?php _e('Elapsed Time:', 'geodirectory'); ?>
2436 2436
 					</p>
2437 2437
 					  
2438 2438
 					<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2439 2439
 				</tr>
2440 2440
 				<tr class="gd-ie-actions">
2441
-				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2441
+				  <td style="vertical-align:top"><input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_exposts_submit" id="gd_ie_exposts_submit">
2442 2442
 				  </td>
2443 2443
 				  <td id="gd_ie_ex_files" class="gd-ie-files"></td>
2444 2444
 				</tr>
@@ -2451,21 +2451,21 @@  discard block
 block discarded – undo
2451 2451
 	<div id="gd_ie_imcategs" class="metabox-holder">
2452 2452
       <div class="meta-box-sortables ui-sortable">
2453 2453
         <div id="gd_ie_imcats" class="postbox gd-hndle-pbox">
2454
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Import CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2455
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Import CSV', 'geodirectory' );?></span></h3>
2454
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Import CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2455
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Import CSV', 'geodirectory'); ?></span></h3>
2456 2456
           <div class="inside">
2457 2457
             <table class="form-table">
2458 2458
 				<tbody>
2459 2459
 				  <tr>
2460 2460
 					<td class="gd-imex-box">
2461 2461
 						<div class="gd-im-choices">
2462
-						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e( 'Update item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2463
-						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e( 'Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory' );?></label></p>
2462
+						<p><input type="radio" value="update" name="gd_im_choicecat" id="gd_im_cchoice_u" /><label for="gd_im_cchoice_u"><?php _e('Update item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2463
+						<p><input type="radio" checked="checked" value="skip" name="gd_im_choicecat" id="gd_im_cchoice_s" /><label for="gd_im_cchoice_s"><?php _e('Ignore item if item with cat_id/cat_slug already exists.', 'geodirectory'); ?></label></p>
2464 2464
 						</div>
2465 2465
 						<div class="plupload-upload-uic hide-if-no-js" id="gd_im_catplupload-upload-ui">
2466 2466
 							<input type="text" readonly="readonly" name="gd_im_cat_file" class="gd-imex-file gd_im_cat_file" id="gd_im_cat" onclick="jQuery('#gd_im_catplupload-browse-button').trigger('click');" />
2467
-							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr( __( 'Download Sample CSV', 'geodirectory' ) );?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2468
-						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv;?>" />
2467
+							<input id="gd_im_catplupload-browse-button" type="button" value="<?php echo SELECT_UPLOAD_CSV; ?>" class="gd-imex-cupload button-primary" /><input type="button" value="<?php echo esc_attr(__('Download Sample CSV', 'geodirectory')); ?>" class="button-secondary" name="gd_ie_imcats_sample" id="gd_ie_imcats_sample">
2468
+						<input type="hidden" id="gd_ie_imcats_csv" value="<?php echo $gd_cats_sample_csv; ?>" />
2469 2469
 						<input type="hidden" id="gd_im_cat_allowed_types" data-exts=".csv" value="csv" />
2470 2470
 						<?php
2471 2471
 						/**
@@ -2476,7 +2476,7 @@  discard block
 block discarded – undo
2476 2476
 						 */
2477 2477
 						do_action('geodir_sample_cats_csv_download_link');
2478 2478
 						?>
2479
-							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce( 'gd_im_catpluploadan' ); ?>"></span>
2479
+							<span class="ajaxnonceplu" id="ajaxnonceplu<?php echo wp_create_nonce('gd_im_catpluploadan'); ?>"></span>
2480 2480
 							<div class="filelist"></div>
2481 2481
 						</div>
2482 2482
 						<span id="gd_im_catupload-error" style="display:none"></span>
@@ -2493,7 +2493,7 @@  discard block
 block discarded – undo
2493 2493
 							<input type="hidden" id="gd_terminateaction" value="continue"/>
2494 2494
 						</div>
2495 2495
 						<div class="gd-import-progress" id="gd-import-progress" style="display:none">
2496
-							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory');?> </b><font
2496
+							<div class="gd-import-file"><b><?php _e("Import Data Status :", 'geodirectory'); ?> </b><font
2497 2497
 									id="gd-import-done">0</font> / <font id="gd-import-total">0</font>&nbsp;( <font
2498 2498
 									id="gd-import-perc">0%</font> )
2499 2499
 								<div class="gd-fileprogress"></div>
@@ -2505,10 +2505,10 @@  discard block
 block discarded – undo
2505 2505
                     	<div class="gd-imex-btns" style="display:none;">
2506 2506
                         	<input type="hidden" class="geodir_import_file" name="geodir_import_file" value="save"/>
2507 2507
                         	<input onclick="gd_imex_PrepareImport(this, 'cat')" type="button" value="<?php echo CSV_IMPORT_DATA; ?>" id="gd_import_data" class="button-primary" />
2508
-                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e( "Continue Import Data", 'geodirectory' );?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2509
-                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory');?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2508
+                        	<input onclick="gd_imex_ContinueImport(this, 'cat')" type="button" value="<?php _e("Continue Import Data", 'geodirectory'); ?>" id="gd_continue_data" class="button-primary" style="display:none"/>
2509
+                        	<input type="button" value="<?php _e("Terminate Import Data", 'geodirectory'); ?>" id="gd_stop_import" class="button-primary" name="gd_stop_import" style="display:none" onclick="gd_imex_TerminateImport(this, 'cat')"/>
2510 2510
 							<div id="gd_process_data" style="display:none">
2511
-								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory');?>
2511
+								<span class="spinner is-active" style="display:inline-block;margin:0 5px 0 5px;float:left"></span><?php _e("Wait, processing import data...", 'geodirectory'); ?>
2512 2512
 							</div>
2513 2513
 						</div>
2514 2514
 					</td>
@@ -2522,26 +2522,26 @@  discard block
 block discarded – undo
2522 2522
 	<div id="gd_ie_excategs" class="metabox-holder">
2523 2523
       <div class="meta-box-sortables ui-sortable">
2524 2524
         <div id="gd_ie_ex_cats" class="postbox gd-hndle-pbox">
2525
-          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e( 'Toggle panel - GD Categories: Export CSV', 'geodirectory' );?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2526
-          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __( 'GD Categories: Export CSV', 'geodirectory' );?></span></h3>
2525
+          <button class="handlediv button-link" type="button"><span class="screen-reader-text"><?php _e('Toggle panel - GD Categories: Export CSV', 'geodirectory'); ?></span><span aria-hidden="true" class="toggle-indicator"></span></button>
2526
+          <h3 class="hndle gd-hndle-click"><span style='vertical-align:top;'><?php echo __('GD Categories: Export CSV', 'geodirectory'); ?></span></h3>
2527 2527
           <div class="inside">
2528 2528
             <table class="form-table">
2529 2529
 				<tbody>
2530 2530
 				  <tr>
2531
-					<td class="fld"><label for="gd_post_type"><?php _e( 'Post Type:', 'geodirectory' );?></label></td>
2532
-					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option;?></select></td>
2531
+					<td class="fld"><label for="gd_post_type"><?php _e('Post Type:', 'geodirectory'); ?></label></td>
2532
+					<td><select name="gd_post_type" id="gd_post_type" style="min-width:140px"><?php echo $gd_posttypes_option; ?></select></td>
2533 2533
 				  </tr>
2534 2534
 				   <tr>
2535
-					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e( 'Max entries per csv file:', 'geodirectory' );?></label></td>
2536
-					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option;?></select><span class="description"><?php _e( 'Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory' );?></span></td>
2535
+					<td class="fld" style="vertical-align:top"><label for="gd_chunk_size"><?php _e('Max entries per csv file:', 'geodirectory'); ?></label></td>
2536
+					<td><select name="gd_chunk_size" id="gd_chunk_size" style="min-width:140px"><?php echo $gd_chunksize_option; ?></select><span class="description"><?php _e('Please select the maximum number of entries per csv file (defaults to 5000, you might want to lower this to prevent memory issues on some installs)', 'geodirectory'); ?></span></td>
2537 2537
 				  </tr>
2538 2538
 				  <tr>
2539
-					<td class="fld" style="vertical-align:top"><label><?php _e( 'Progress:', 'geodirectory' );?></label></td>
2540
-					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e( 'Elapsed Time:', 'geodirectory' );?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2539
+					<td class="fld" style="vertical-align:top"><label><?php _e('Progress:', 'geodirectory'); ?></label></td>
2540
+					<td><div id='gd_progressbar_box'><div id="gd_progressbar" class="gd_progressbar"><div class="gd-progress-label"></div></div></div><p style="display:inline-block"><?php _e('Elapsed Time:', 'geodirectory'); ?></p>&nbsp;&nbsp;<p id="gd_timer" class="gd_timer">00:00:00</p></td>
2541 2541
 				  </tr>
2542 2542
 				  <tr class="gd-ie-actions">
2543 2543
 					<td style="vertical-align:top">
2544
-						<input type="submit" value="<?php echo esc_attr( __( 'Export CSV', 'geodirectory' ) );?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2544
+						<input type="submit" value="<?php echo esc_attr(__('Export CSV', 'geodirectory')); ?>" class="button-primary" name="gd_ie_excats_submit" id="gd_ie_excats_submit">
2545 2545
 					</td>
2546 2546
 					<td id="gd_ie_ex_files" class="gd-ie-files"></td>
2547 2547
 				  </tr>
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
      * @param array $gd_chunksize_options File chunk size options.
2564 2564
      * @param string $nonce Wordpress security token for GD import & export.
2565 2565
 	 */
2566
-	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2566
+	do_action('geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce);
2567 2567
 	?>
2568 2568
   </div>
2569 2569
 </div>
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
         jQuery.ajax({
2583 2583
             url: ajaxurl,
2584 2584
             type: "POST",
2585
-            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce;?>',
2585
+            data: 'action=geodir_import_export&task=prepare_import&_pt=' + type + '&_file=' + uploadedFile + '&_nonce=<?php echo $nonce; ?>',
2586 2586
             dataType: 'json',
2587 2587
             cache: false,
2588 2588
             success: function(data) {
@@ -2634,7 +2634,7 @@  discard block
 block discarded – undo
2634 2634
 
2635 2635
         jQuery(cont).find('.filelist .file').remove();
2636 2636
         
2637
-        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr( PLZ_SELECT_CSV_FILE );?></p>");
2637
+        jQuery('#gd-import-msg', cont).find('#message').removeClass('updated').addClass('error').html("<p><?php echo esc_attr(PLZ_SELECT_CSV_FILE); ?></p>");
2638 2638
         jQuery('#gd-import-msg', cont).show();
2639 2639
         
2640 2640
         return false;
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
     jQuery.ajax({
2694 2694
         url: ajaxurl,
2695 2695
         type: "POST",
2696
-        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce;?>',
2696
+        data: 'action=geodir_import_export&task=import_' + type + '&_pt=' + type + '&_file=' + uploadedFile + gddata + '&_ch=' + choice + '&_nonce=<?php echo $nonce; ?>',
2697 2697
         dataType : 'json',
2698 2698
         cache: false,
2699 2699
         success: function (data) {
@@ -2882,27 +2882,27 @@  discard block
 block discarded – undo
2882 2882
 
2883 2883
     var gdMsg = '<p></p>';
2884 2884
     if ( processed > 0 ) {
2885
-        var msgParse = '<p><?php echo addslashes( sprintf( __( 'Total %s item(s) found.', 'geodirectory' ), '%s' ) );?></p>';
2885
+        var msgParse = '<p><?php echo addslashes(sprintf(__('Total %s item(s) found.', 'geodirectory'), '%s')); ?></p>';
2886 2886
         msgParse = msgParse.replace("%s", processed);
2887 2887
         gdMsg += msgParse;
2888 2888
     }
2889 2889
 
2890 2890
     if ( updated > 0 ) {
2891
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) updated.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2891
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) updated.', 'geodirectory'), '%s', '%d')); ?></p>';
2892 2892
         msgParse = msgParse.replace("%s", updated);
2893 2893
         msgParse = msgParse.replace("%d", processed);
2894 2894
         gdMsg += msgParse;
2895 2895
     }
2896 2896
 
2897 2897
     if ( created > 0 ) {
2898
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) added.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2898
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) added.', 'geodirectory'), '%s', '%d')); ?></p>';
2899 2899
         msgParse = msgParse.replace("%s", created);
2900 2900
         msgParse = msgParse.replace("%d", processed);
2901 2901
         gdMsg += msgParse;
2902 2902
     }
2903 2903
 
2904 2904
     if ( skipped > 0 ) {
2905
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) ignored due to already exists.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2905
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) ignored due to already exists.', 'geodirectory'), '%s', '%d')); ?></p>';
2906 2906
         msgParse = msgParse.replace("%s", skipped);
2907 2907
         msgParse = msgParse.replace("%d", processed);
2908 2908
         gdMsg += msgParse;
@@ -2912,17 +2912,17 @@  discard block
 block discarded – undo
2912 2912
         if (type=='loc') {
2913 2913
             invalid_addr = invalid;
2914 2914
         }
2915
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory' ), '%s', '%d' ) );?></p>';
2915
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank/invalid address(city, region, country, latitude, longitude).', 'geodirectory'), '%s', '%d')); ?></p>';
2916 2916
         msgParse = msgParse.replace("%s", invalid_addr);
2917 2917
         msgParse = msgParse.replace("%d", total);
2918 2918
         gdMsg += msgParse;
2919 2919
     }
2920 2920
 
2921 2921
     if (invalid > 0 && type!='loc') {
2922
-        var msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory' ), '%s', '%d' ) );?></p>';
2922
+        var msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to blank title/invalid post type/invalid characters used in data.', 'geodirectory'), '%s', '%d')); ?></p>';
2923 2923
         
2924 2924
         if (type=='hood') {
2925
-            msgParse = '<p><?php echo addslashes( sprintf( __( '%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory' ), '%s', '%d' ) );?></p>';
2925
+            msgParse = '<p><?php echo addslashes(sprintf(__('%s / %s item(s) could not be added due to invalid neighbourhood data(name, latitude, longitude) or invalid location data(either location_id or city/region/country is empty)', 'geodirectory'), '%s', '%d')); ?></p>';
2926 2926
         }
2927 2927
         msgParse = msgParse.replace("%s", invalid);
2928 2928
         msgParse = msgParse.replace("%d", total);
@@ -2930,7 +2930,7 @@  discard block
 block discarded – undo
2930 2930
     }
2931 2931
 
2932 2932
     if (images > 0) {
2933
-        gdMsg += '<p><?php echo addslashes( $upload_dir );?></p>';
2933
+        gdMsg += '<p><?php echo addslashes($upload_dir); ?></p>';
2934 2934
     }
2935 2935
     gdMsg += '<p></p>';
2936 2936
     jQuery('#gd-import-msg', cont).find('#message').removeClass('error').addClass('updated').html(gdMsg);
@@ -3094,9 +3094,9 @@  discard block
 block discarded – undo
3094 3094
             if (typeof filters !== 'undefined' && filters && doFilter) {
3095 3095
                 getTotal = true;
3096 3096
                 attach += '&_c=1';
3097
-                gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Preparing...', 'geodirectory' ) );?>');
3097
+                gd_progressbar(el, 0, '<i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Preparing...', 'geodirectory')); ?>');
3098 3098
             } else {
3099
-                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3099
+                gd_progressbar(el, 0, '0% (0 / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3100 3100
             }
3101 3101
             jQuery(el).find('#gd_timer').text('00:00:01');
3102 3102
             jQuery('#gd_ie_ex_files', el).html('');
@@ -3105,7 +3105,7 @@  discard block
 block discarded – undo
3105 3105
         jQuery.ajax({
3106 3106
             url: ajaxurl,
3107 3107
             type: "POST",
3108
-            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page + attach,
3108
+            data: 'action=geodir_import_export&task=export_posts&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page + attach,
3109 3109
             dataType : 'json',
3110 3110
             cache: false,
3111 3111
             beforeSend: function (jqXHR, settings) {},
@@ -3130,11 +3130,11 @@  discard block
 block discarded – undo
3130 3130
                         } else {
3131 3131
                             if (pages < page || pages == page) {
3132 3132
                                 window.clearInterval(timer_posts);
3133
-                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3133
+                                gd_progressbar(el, 100, '100% (' + total_posts + ' / ' + total_posts + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3134 3134
                             } else {
3135 3135
                                 var percentage = Math.round(((page * chunk_size) / total_posts) * 100);
3136 3136
                                 percentage = percentage > 100 ? 100 : percentage;
3137
-                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3137
+                                gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_posts + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3138 3138
                             }
3139 3139
                             if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3140 3140
                                 var obj_files = data.files;
@@ -3165,7 +3165,7 @@  discard block
 block discarded – undo
3165 3165
 
3166 3166
     function gd_process_export_cats(el, post_type, total_cats, chunk_size, pages, page) {
3167 3167
         if (page < 2) {
3168
-            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr( __( 'Exporting...', 'geodirectory' ) );?>');
3168
+            gd_progressbar(el, 0, '0% (0 / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php echo esc_attr(__('Exporting...', 'geodirectory')); ?>');
3169 3169
             jQuery(el).find('#gd_timer').text('00:00:01');
3170 3170
             jQuery('#gd_ie_ex_files', el).html('');
3171 3171
         }
@@ -3173,7 +3173,7 @@  discard block
 block discarded – undo
3173 3173
         jQuery.ajax({
3174 3174
             url: ajaxurl,
3175 3175
             type: "POST",
3176
-            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce;?>&_p=' + page,
3176
+            data: 'action=geodir_import_export&task=export_cats&_pt=' + post_type + '&_n=' + chunk_size + '&_nonce=<?php echo $nonce; ?>&_p=' + page,
3177 3177
             dataType : 'json',
3178 3178
             cache: false,
3179 3179
             beforeSend: function (jqXHR, settings) {},
@@ -3187,11 +3187,11 @@  discard block
 block discarded – undo
3187 3187
                     } else {
3188 3188
                         if (pages < page || pages == page) {
3189 3189
                             window.clearInterval(timer_cats);
3190
-                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr( __( 'Complete!', 'geodirectory' ) );?>');
3190
+                            gd_progressbar(el, 100, '100% (' + total_cats + ' / ' + total_cats + ') <i class="fa fa-check"></i><?php echo esc_attr(__('Complete!', 'geodirectory')); ?>');
3191 3191
                         } else {
3192 3192
                             var percentage = Math.round(((page * chunk_size) / total_cats) * 100);
3193 3193
                             percentage = percentage > 100 ? 100 : percentage;
3194
-                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e( 'Exporting...', 'geodirectory' );?>');
3194
+                            gd_progressbar(el, percentage, '' + percentage + '% (' + ( page * chunk_size ) + ' / ' + total_cats + ') <i class="fa fa-refresh fa-spin"></i><?php esc_attr_e('Exporting...', 'geodirectory'); ?>');
3195 3195
                         }
3196 3196
                         if (typeof data.files != 'undefined' && jQuery(data.files).length ) {
3197 3197
                             var obj_files = data.files;
@@ -3248,13 +3248,13 @@  discard block
 block discarded – undo
3248 3248
 function geodir_init_filesystem()
3249 3249
 {
3250 3250
 
3251
-    if(!function_exists('get_filesystem_method')){
3251
+    if (!function_exists('get_filesystem_method')) {
3252 3252
         require_once(ABSPATH."/wp-admin/includes/file.php");
3253 3253
     }
3254 3254
     $access_type = get_filesystem_method();
3255 3255
     if ($access_type === 'direct') {
3256 3256
         /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3257
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3257
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3258 3258
 
3259 3259
         /* initialize the API */
3260 3260
         if (!WP_Filesystem($creds)) {
@@ -3267,7 +3267,7 @@  discard block
 block discarded – undo
3267 3267
         return $wp_filesystem;
3268 3268
         /* do our file manipulations below */
3269 3269
     } elseif (defined('FTP_USER')) {
3270
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3270
+        $creds = request_filesystem_credentials(trailingslashit(site_url()).'wp-admin/', '', false, false, array());
3271 3271
 
3272 3272
         /* initialize the API */
3273 3273
         if (!WP_Filesystem($creds)) {
@@ -3302,7 +3302,7 @@  discard block
 block discarded – undo
3302 3302
  * @package GeoDirectory
3303 3303
  */
3304 3304
 function geodir_filesystem_notice()
3305
-{   if ( defined( 'DOING_AJAX' ) ){return;}
3305
+{   if (defined('DOING_AJAX')) {return; }
3306 3306
     $access_type = get_filesystem_method();
3307 3307
     if ($access_type === 'direct') {
3308 3308
     } elseif (!defined('FTP_USER')) {
@@ -3343,64 +3343,64 @@  discard block
 block discarded – undo
3343 3343
     // try to set higher limits for import
3344 3344
     $max_input_time = ini_get('max_input_time');
3345 3345
     $max_execution_time = ini_get('max_execution_time');
3346
-    $memory_limit= ini_get('memory_limit');
3346
+    $memory_limit = ini_get('memory_limit');
3347 3347
 
3348
-    if(!$max_input_time || $max_input_time<3000){
3348
+    if (!$max_input_time || $max_input_time < 3000) {
3349 3349
         ini_set('max_input_time', 3000);
3350 3350
     }
3351 3351
 
3352
-    if(!$max_execution_time || $max_execution_time<3000){
3352
+    if (!$max_execution_time || $max_execution_time < 3000) {
3353 3353
         ini_set('max_execution_time', 3000);
3354 3354
     }
3355 3355
 
3356
-    if($memory_limit && str_replace('M','',$memory_limit)){
3357
-        if(str_replace('M','',$memory_limit)<256){
3356
+    if ($memory_limit && str_replace('M', '', $memory_limit)) {
3357
+        if (str_replace('M', '', $memory_limit) < 256) {
3358 3358
             ini_set('memory_limit', '256M');
3359 3359
         }
3360 3360
     }
3361 3361
 
3362 3362
     $json = array();
3363 3363
 
3364
-    if ( !current_user_can( 'manage_options' ) ) {
3365
-        wp_send_json( $json );
3364
+    if (!current_user_can('manage_options')) {
3365
+        wp_send_json($json);
3366 3366
     }
3367 3367
 
3368
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3369
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3370
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3368
+    $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : NULL;
3369
+    $nonce = isset($_REQUEST['_nonce']) ? $_REQUEST['_nonce'] : NULL;
3370
+    $stat = isset($_REQUEST['_st']) ? $_REQUEST['_st'] : false;
3371 3371
 
3372
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3373
-        wp_send_json( $json );
3372
+    if (!wp_verify_nonce($nonce, 'geodir_import_export_nonce')) {
3373
+        wp_send_json($json);
3374 3374
     }
3375 3375
 
3376
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3377
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3376
+    $post_type = isset($_REQUEST['_pt']) ? $_REQUEST['_pt'] : NULL;
3377
+    $chunk_per_page = isset($_REQUEST['_n']) ? absint($_REQUEST['_n']) : NULL;
3378 3378
     $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3379
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3379
+    $chunk_page_no = isset($_REQUEST['_p']) ? absint($_REQUEST['_p']) : 1;
3380 3380
 
3381 3381
     $wp_filesystem = geodir_init_filesystem();
3382 3382
     if (!$wp_filesystem) {
3383
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3384
-        wp_send_json( $json );
3383
+        $json['error'] = __('Filesystem ERROR: Could not access filesystem.', 'geodirectory');
3384
+        wp_send_json($json);
3385 3385
     }
3386 3386
 
3387 3387
     if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3388
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3389
-        wp_send_json( $json );
3388
+        $json['error'] = __('Filesystem ERROR: '.$wp_filesystem->errors->get_error_message(), 'geodirectory');
3389
+        wp_send_json($json);
3390 3390
     }
3391 3391
 
3392
-    $csv_file_dir = geodir_path_import_export( false );
3393
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3394
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3395
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3396
-            wp_send_json( $json );
3392
+    $csv_file_dir = geodir_path_import_export(false);
3393
+    if (!$wp_filesystem->is_dir($csv_file_dir)) {
3394
+        if (!$wp_filesystem->mkdir($csv_file_dir, FS_CHMOD_DIR)) {
3395
+            $json['error'] = __('ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory');
3396
+            wp_send_json($json);
3397 3397
         }
3398 3398
     }
3399 3399
     
3400 3400
     $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3401 3401
     $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3402 3402
 
3403
-    switch ( $task ) {
3403
+    switch ($task) {
3404 3404
         case 'export_posts': {
3405 3405
             // WPML
3406 3406
             $is_wpml = geodir_is_wpml();
@@ -3411,36 +3411,36 @@  discard block
 block discarded – undo
3411 3411
                 $sitepress->switch_lang('all', true);
3412 3412
             }
3413 3413
             // WPML
3414
-            if ( $post_type == 'gd_event' ) {
3415
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3414
+            if ($post_type == 'gd_event') {
3415
+                add_filter('geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2);
3416 3416
             }
3417
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3417
+            $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
3418 3418
             
3419
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3420
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3421
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3419
+            $file_name = $post_type.'_'.date('dmyHi');
3420
+            if ($filters && isset($filters['start_date']) && isset($filters['end_date'])) {
3421
+                $file_name = $post_type.'_'.date_i18n('dmy', strtotime($filters['start_date'])).'_'.date_i18n('dmy', strtotime($filters['end_date']));
3422 3422
             }
3423
-            $posts_count = geodir_get_posts_count( $post_type );
3424
-            $file_url_base = geodir_path_import_export() . '/';
3425
-            $file_url = $file_url_base . $file_name . '.csv';
3426
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3427
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3423
+            $posts_count = geodir_get_posts_count($post_type);
3424
+            $file_url_base = geodir_path_import_export().'/';
3425
+            $file_url = $file_url_base.$file_name.'.csv';
3426
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3427
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'_'.$nonce.'.csv';
3428 3428
             
3429 3429
             $chunk_file_paths = array();
3430 3430
 
3431
-            if ( isset( $_REQUEST['_c'] ) ) {
3431
+            if (isset($_REQUEST['_c'])) {
3432 3432
                 $json['total'] = $posts_count;
3433 3433
                 // WPML
3434 3434
                 if ($is_wpml) {
3435 3435
                     $sitepress->switch_lang($active_lang, true);
3436 3436
                 }
3437 3437
                 // WPML
3438
-                wp_send_json( $json );
3438
+                wp_send_json($json);
3439 3439
                 gd_die();
3440
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3441
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3442
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3443
-                $percentage = min( $percentage, 100 );
3440
+            } else if (isset($_REQUEST['_st'])) {
3441
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3442
+                $percentage = count($posts_count) > 0 && $line_count > 0 ? ceil($line_count / $posts_count) * 100 : 0;
3443
+                $percentage = min($percentage, 100);
3444 3444
                 
3445 3445
                 $json['percentage'] = $percentage;
3446 3446
                 // WPML
@@ -3448,45 +3448,45 @@  discard block
 block discarded – undo
3448 3448
                     $sitepress->switch_lang($active_lang, true);
3449 3449
                 }
3450 3450
                 // WPML
3451
-                wp_send_json( $json );
3451
+                wp_send_json($json);
3452 3452
                 gd_die();
3453 3453
             } else {
3454
-                if ( !$posts_count > 0 ) {
3455
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3454
+                if (!$posts_count > 0) {
3455
+                    $json['error'] = __('No records to export.', 'geodirectory');
3456 3456
                 } else {
3457 3457
                     $total_posts = $posts_count;
3458 3458
                     if ($chunk_per_page > $total_posts) {
3459 3459
                         $chunk_per_page = $total_posts;
3460 3460
                     }
3461
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3461
+                    $chunk_total_pages = ceil($total_posts / $chunk_per_page);
3462 3462
                     
3463 3463
                     $j = $chunk_page_no;
3464
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3464
+                    $chunk_save_posts = geodir_imex_get_posts($post_type, $chunk_per_page, $j);
3465 3465
                     
3466 3466
                     $per_page = 500;
3467 3467
                     if ($per_page > $chunk_per_page) {
3468 3468
                         $per_page = $chunk_per_page;
3469 3469
                     }
3470
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3470
+                    $total_pages = ceil($chunk_per_page / $per_page);
3471 3471
                     
3472
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3473
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3472
+                    for ($i = 0; $i <= $total_pages; $i++) {
3473
+                        $save_posts = array_slice($chunk_save_posts, ($i * $per_page), $per_page);
3474 3474
                         
3475 3475
                         $clear = $i == 0 ? true : false;
3476
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3476
+                        geodir_save_csv_data($file_path_temp, $save_posts, $clear);
3477 3477
                     }
3478 3478
                         
3479
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3480
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3481
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3482
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3483
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3479
+                    if ($wp_filesystem->exists($file_path_temp)) {
3480
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3481
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3482
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3483
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3484 3484
                         
3485
-                        $file_url = $file_url_base . $chunk_file_name;
3486
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3485
+                        $file_url = $file_url_base.$chunk_file_name;
3486
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3487 3487
                     }
3488 3488
                     
3489
-                    if ( !empty($chunk_file_paths) ) {
3489
+                    if (!empty($chunk_file_paths)) {
3490 3490
                         $json['total'] = $posts_count;
3491 3491
                         $json['files'] = $chunk_file_paths;
3492 3492
                     } else {
@@ -3494,7 +3494,7 @@  discard block
 block discarded – undo
3494 3494
                             $json['total'] = $posts_count;
3495 3495
                             $json['files'] = array();
3496 3496
                         } else {
3497
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3497
+                            $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3498 3498
                         }
3499 3499
                     }
3500 3500
                 }
@@ -3503,7 +3503,7 @@  discard block
 block discarded – undo
3503 3503
                     $sitepress->switch_lang($active_lang, true);
3504 3504
                 }
3505 3505
                 // WPML
3506
-                wp_send_json( $json );
3506
+                wp_send_json($json);
3507 3507
             }
3508 3508
         }
3509 3509
         break;
@@ -3517,20 +3517,20 @@  discard block
 block discarded – undo
3517 3517
                 $sitepress->switch_lang('all', true);
3518 3518
             }
3519 3519
             // WPML
3520
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3520
+            $file_name = $post_type.'category_'.date('dmyHi');
3521 3521
             
3522
-            $terms_count = geodir_get_terms_count( $post_type );
3523
-            $file_url_base = geodir_path_import_export() . '/';
3524
-            $file_url = $file_url_base . $file_name . '.csv';
3525
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3526
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3522
+            $terms_count = geodir_get_terms_count($post_type);
3523
+            $file_url_base = geodir_path_import_export().'/';
3524
+            $file_url = $file_url_base.$file_name.'.csv';
3525
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3526
+            $file_path_temp = $csv_file_dir.'/'.$post_type.'category_'.$nonce.'.csv';
3527 3527
             
3528 3528
             $chunk_file_paths = array();
3529 3529
             
3530
-            if ( isset( $_REQUEST['_st'] ) ) {
3531
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3532
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3533
-                $percentage = min( $percentage, 100 );
3530
+            if (isset($_REQUEST['_st'])) {
3531
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3532
+                $percentage = count($terms_count) > 0 && $line_count > 0 ? ceil($line_count / $terms_count) * 100 : 0;
3533
+                $percentage = min($percentage, 100);
3534 3534
                 
3535 3535
                 $json['percentage'] = $percentage;
3536 3536
                 // WPML
@@ -3538,48 +3538,48 @@  discard block
 block discarded – undo
3538 3538
                     $sitepress->switch_lang($active_lang, true);
3539 3539
                 }
3540 3540
                 // WPML
3541
-                wp_send_json( $json );
3541
+                wp_send_json($json);
3542 3542
             } else {
3543
-                if ( !$terms_count > 0 ) {
3544
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3543
+                if (!$terms_count > 0) {
3544
+                    $json['error'] = __('No records to export.', 'geodirectory');
3545 3545
                 } else {
3546 3546
                     $total_terms = $terms_count;
3547 3547
                     if ($chunk_per_page > $terms_count) {
3548 3548
                         $chunk_per_page = $terms_count;
3549 3549
                     }
3550
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3550
+                    $chunk_total_pages = ceil($total_terms / $chunk_per_page);
3551 3551
                     
3552 3552
                     $j = $chunk_page_no;
3553
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3553
+                    $chunk_save_terms = geodir_imex_get_terms($post_type, $chunk_per_page, $j);
3554 3554
                     
3555 3555
                     $per_page = 500;
3556 3556
                     if ($per_page > $chunk_per_page) {
3557 3557
                         $per_page = $chunk_per_page;
3558 3558
                     }
3559
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3559
+                    $total_pages = ceil($chunk_per_page / $per_page);
3560 3560
                     
3561
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3562
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3561
+                    for ($i = 0; $i <= $total_pages; $i++) {
3562
+                        $save_terms = array_slice($chunk_save_terms, ($i * $per_page), $per_page);
3563 3563
                         
3564 3564
                         $clear = $i == 0 ? true : false;
3565
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3565
+                        geodir_save_csv_data($file_path_temp, $save_terms, $clear);
3566 3566
                     }
3567 3567
                     
3568
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3569
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3570
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3571
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3572
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3568
+                    if ($wp_filesystem->exists($file_path_temp)) {
3569
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3570
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3571
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3572
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3573 3573
                         
3574
-                        $file_url = $file_url_base . $chunk_file_name;
3575
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3574
+                        $file_url = $file_url_base.$chunk_file_name;
3575
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3576 3576
                     }
3577 3577
                     
3578
-                    if ( !empty($chunk_file_paths) ) {
3578
+                    if (!empty($chunk_file_paths)) {
3579 3579
                         $json['total'] = $terms_count;
3580 3580
                         $json['files'] = $chunk_file_paths;
3581 3581
                     } else {
3582
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3582
+                        $json['error'] = __('ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory');
3583 3583
                     }
3584 3584
                 }
3585 3585
                 // WPML
@@ -3587,127 +3587,127 @@  discard block
 block discarded – undo
3587 3587
                     $sitepress->switch_lang($active_lang, true);
3588 3588
                 }
3589 3589
                 // WPML
3590
-                wp_send_json( $json );
3590
+                wp_send_json($json);
3591 3591
             }
3592 3592
         }
3593 3593
         break;
3594 3594
         case 'export_locations': {
3595
-            $file_url_base = geodir_path_import_export() . '/';
3596
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3597
-            $file_url = $file_url_base . $file_name . '.csv';
3598
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3599
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3595
+            $file_url_base = geodir_path_import_export().'/';
3596
+            $file_name = 'gd_locations_'.date('dmyHi');
3597
+            $file_url = $file_url_base.$file_name.'.csv';
3598
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3599
+            $file_path_temp = $csv_file_dir.'/gd_locations_'.$nonce.'.csv';
3600 3600
             
3601
-            $items_count = (int)geodir_location_imex_count_locations();
3601
+            $items_count = (int) geodir_location_imex_count_locations();
3602 3602
             
3603
-            if ( isset( $_REQUEST['_st'] ) ) {
3604
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3605
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3606
-                $percentage = min( $percentage, 100 );
3603
+            if (isset($_REQUEST['_st'])) {
3604
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3605
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3606
+                $percentage = min($percentage, 100);
3607 3607
                 
3608 3608
                 $json['percentage'] = $percentage;
3609
-                wp_send_json( $json );
3609
+                wp_send_json($json);
3610 3610
             } else {
3611 3611
                 $chunk_file_paths = array();
3612 3612
                 
3613
-                if ( !$items_count > 0 ) {
3614
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3613
+                if (!$items_count > 0) {
3614
+                    $json['error'] = __('No records to export.', 'geodirectory');
3615 3615
                 } else {
3616
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3617
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3616
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3617
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3618 3618
                     
3619 3619
                     $j = $chunk_page_no;
3620
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3620
+                    $chunk_save_items = geodir_location_imex_locations_data($chunk_per_page, $j);
3621 3621
                     
3622 3622
                     $per_page = 500;
3623
-                    $per_page = min( $per_page, $chunk_per_page );
3624
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3623
+                    $per_page = min($per_page, $chunk_per_page);
3624
+                    $total_pages = ceil($chunk_per_page / $per_page);
3625 3625
                     
3626
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3627
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3626
+                    for ($i = 0; $i <= $total_pages; $i++) {
3627
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3628 3628
                         
3629 3629
                         $clear = $i == 0 ? true : false;
3630
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3630
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3631 3631
                     }
3632 3632
                     
3633
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3634
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3635
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3636
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3637
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3633
+                    if ($wp_filesystem->exists($file_path_temp)) {
3634
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3635
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3636
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3637
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3638 3638
                         
3639
-                        $file_url = $file_url_base . $chunk_file_name;
3640
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3639
+                        $file_url = $file_url_base.$chunk_file_name;
3640
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3641 3641
                     }
3642 3642
                     
3643
-                    if ( !empty($chunk_file_paths) ) {
3643
+                    if (!empty($chunk_file_paths)) {
3644 3644
                         $json['total'] = $items_count;
3645 3645
                         $json['files'] = $chunk_file_paths;
3646 3646
                     } else {
3647
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3647
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3648 3648
                     }
3649 3649
                 }
3650
-                wp_send_json( $json );
3650
+                wp_send_json($json);
3651 3651
             }
3652 3652
         }
3653 3653
         break;
3654 3654
         case 'export_hoods': {
3655
-            $file_url_base = geodir_path_import_export() . '/';
3656
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3657
-            $file_url = $file_url_base . $file_name . '.csv';
3658
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3659
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3655
+            $file_url_base = geodir_path_import_export().'/';
3656
+            $file_name = 'gd_neighbourhoods_'.date('dmyHi');
3657
+            $file_url = $file_url_base.$file_name.'.csv';
3658
+            $file_path = $csv_file_dir.'/'.$file_name.'.csv';
3659
+            $file_path_temp = $csv_file_dir.'/gd_neighbourhoods_'.$nonce.'.csv';
3660 3660
             
3661
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3661
+            $items_count = (int) geodir_location_imex_count_neighbourhoods();
3662 3662
             
3663
-            if ( isset( $_REQUEST['_st'] ) ) {
3664
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3665
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3666
-                $percentage = min( $percentage, 100 );
3663
+            if (isset($_REQUEST['_st'])) {
3664
+                $line_count = (int) geodir_import_export_line_count($file_path_temp);
3665
+                $percentage = count($items_count) > 0 && $line_count > 0 ? ceil($line_count / $items_count) * 100 : 0;
3666
+                $percentage = min($percentage, 100);
3667 3667
                 
3668 3668
                 $json['percentage'] = $percentage;
3669
-                wp_send_json( $json );
3669
+                wp_send_json($json);
3670 3670
             } else {
3671 3671
                 $chunk_file_paths = array();
3672 3672
                 
3673
-                if ( !$items_count > 0 ) {
3674
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3673
+                if (!$items_count > 0) {
3674
+                    $json['error'] = __('No records to export.', 'geodirectory');
3675 3675
                 } else {
3676
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3677
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3676
+                    $chunk_per_page = min($chunk_per_page, $items_count);
3677
+                    $chunk_total_pages = ceil($items_count / $chunk_per_page);
3678 3678
                     
3679 3679
                     $j = $chunk_page_no;
3680
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3680
+                    $chunk_save_items = geodir_location_imex_neighbourhoods_data($chunk_per_page, $j);
3681 3681
                     
3682 3682
                     $per_page = 500;
3683
-                    $per_page = min( $per_page, $chunk_per_page );
3684
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3683
+                    $per_page = min($per_page, $chunk_per_page);
3684
+                    $total_pages = ceil($chunk_per_page / $per_page);
3685 3685
                     
3686
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3687
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3686
+                    for ($i = 0; $i <= $total_pages; $i++) {
3687
+                        $save_items = array_slice($chunk_save_items, ($i * $per_page), $per_page);
3688 3688
                         
3689 3689
                         $clear = $i == 0 ? true : false;
3690
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3690
+                        geodir_save_csv_data($file_path_temp, $save_items, $clear);
3691 3691
                     }
3692 3692
                     
3693
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3694
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3695
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3696
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3697
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3693
+                    if ($wp_filesystem->exists($file_path_temp)) {
3694
+                        $chunk_page_no = $chunk_total_pages > 1 ? '-'.$j : '';
3695
+                        $chunk_file_name = $file_name.$chunk_page_no.'.csv';
3696
+                        $file_path = $csv_file_dir.'/'.$chunk_file_name;
3697
+                        $wp_filesystem->move($file_path_temp, $file_path, true);
3698 3698
                         
3699
-                        $file_url = $file_url_base . $chunk_file_name;
3700
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3699
+                        $file_url = $file_url_base.$chunk_file_name;
3700
+                        $chunk_file_paths[] = array('i' => $j.'.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3701 3701
                     }
3702 3702
                     
3703
-                    if ( !empty($chunk_file_paths) ) {
3703
+                    if (!empty($chunk_file_paths)) {
3704 3704
                         $json['total'] = $items_count;
3705 3705
                         $json['files'] = $chunk_file_paths;
3706 3706
                     } else {
3707
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3707
+                        $json['error'] = __('Fail, something wrong to create csv file.', 'geodirectory');
3708 3708
                     }
3709 3709
                 }
3710
-                wp_send_json( $json );
3710
+                wp_send_json($json);
3711 3711
             }
3712 3712
         }
3713 3713
         break;
@@ -3724,34 +3724,34 @@  discard block
 block discarded – undo
3724 3724
             }
3725 3725
             // WPML
3726 3726
             
3727
-            ini_set( 'auto_detect_line_endings', true );
3727
+            ini_set('auto_detect_line_endings', true);
3728 3728
             
3729 3729
             $uploads = wp_upload_dir();
3730 3730
             $uploads_dir = $uploads['path'];
3731 3731
             $uploads_subdir = $uploads['subdir'];
3732 3732
             
3733
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3734
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3733
+            $csv_file = isset($_POST['_file']) ? $_POST['_file'] : NULL;
3734
+            $import_choice = isset($_REQUEST['_ch']) ? $_REQUEST['_ch'] : 'skip';
3735 3735
             
3736
-            $csv_file_arr = explode( '/', $csv_file );
3737
-            $csv_filename = end( $csv_file_arr );
3738
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3736
+            $csv_file_arr = explode('/', $csv_file);
3737
+            $csv_filename = end($csv_file_arr);
3738
+            $target_path = $uploads_dir.'/temp_'.$current_user->data->ID.'/'.$csv_filename;
3739 3739
             
3740 3740
             $json['file'] = $csv_file;
3741
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3741
+            $json['error'] = __('The uploaded file is not a valid csv file. Please try again.', 'geodirectory');
3742 3742
             $file = array();
3743 3743
 
3744
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3745
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3744
+            if ($csv_file && $wp_filesystem->is_file($target_path) && $wp_filesystem->exists($target_path)) {
3745
+                $wp_filetype = wp_check_filetype_and_ext($target_path, $csv_filename);
3746 3746
                 
3747 3747
                 if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3748 3748
                     $json['error'] = NULL;
3749 3749
 
3750 3750
                     $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3751 3751
                     setlocale(LC_ALL, 'en_US.UTF-8');
3752
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3753
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3754
-                            if ( !empty( $data ) ) {
3752
+                    if (($handle = fopen($target_path, "r")) !== FALSE) {
3753
+                        while (($data = fgetcsv($handle, 100000, ",")) !== FALSE) {
3754
+                            if (!empty($data)) {
3755 3755
                                 $file[] = $data;
3756 3756
                             }
3757 3757
                         }
@@ -3765,19 +3765,19 @@  discard block
 block discarded – undo
3765 3765
                         $json['error'] = __('No data found in csv file.', 'geodirectory');
3766 3766
                     }
3767 3767
                 } else {
3768
-                    wp_send_json( $json );
3768
+                    wp_send_json($json);
3769 3769
                 }
3770 3770
             } else {
3771
-                wp_send_json( $json );
3771
+                wp_send_json($json);
3772 3772
             }
3773 3773
             
3774
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3775
-                wp_send_json( $json );
3774
+            if ($task == 'prepare_import' || !empty($json['error'])) {
3775
+                wp_send_json($json);
3776 3776
             }
3777 3777
             
3778 3778
             $total = $json['rows'];
3779
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3780
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3779
+            $limit = isset($_POST['limit']) ? (int) $_POST['limit'] : 1;
3780
+            $processed = isset($_POST['processed']) ? (int) $_POST['processed'] : 0;
3781 3781
             
3782 3782
             $count = $limit;
3783 3783
             
@@ -3802,13 +3802,13 @@  discard block
 block discarded – undo
3802 3802
             
3803 3803
             $post_types = geodir_get_posttypes();
3804 3804
 
3805
-            if ( $task == 'import_cat' ) {
3805
+            if ($task == 'import_cat') {
3806 3806
                 if (!empty($file)) {
3807 3807
                     $columns = isset($file[0]) ? $file[0] : NULL;
3808 3808
                     
3809 3809
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3810 3810
                         $json['error'] = CSV_INVAILD_FILE;
3811
-                        wp_send_json( $json );
3811
+                        wp_send_json($json);
3812 3812
                         exit;
3813 3813
                     }
3814 3814
                     
@@ -3819,7 +3819,7 @@  discard block
 block discarded – undo
3819 3819
                         
3820 3820
                         if (isset($file[$index])) {
3821 3821
                             $row = $file[$index];
3822
-                            $row = array_map( 'trim', $row );
3822
+                            $row = array_map('trim', $row);
3823 3823
                             //$row = array_map( 'utf8_encode', $row );
3824 3824
                             
3825 3825
                             $cat_id = '';
@@ -3836,42 +3836,42 @@  discard block
 block discarded – undo
3836 3836
                             $cat_id_original = '';
3837 3837
                             
3838 3838
                             $c = 0;
3839
-                            foreach ($columns as $column ) {
3840
-                                if ( $column == 'cat_id' ) {
3841
-                                    $cat_id = (int)$row[$c];
3842
-                                } else if ( $column == 'cat_name' ) {
3839
+                            foreach ($columns as $column) {
3840
+                                if ($column == 'cat_id') {
3841
+                                    $cat_id = (int) $row[$c];
3842
+                                } else if ($column == 'cat_name') {
3843 3843
                                     $cat_name = $row[$c];
3844
-                                } else if ( $column == 'cat_slug' ) {
3844
+                                } else if ($column == 'cat_slug') {
3845 3845
                                     $cat_slug = $row[$c];
3846
-                                } else if ( $column == 'cat_posttype' ) {
3846
+                                } else if ($column == 'cat_posttype') {
3847 3847
                                     $cat_posttype = $row[$c];
3848
-                                } else if ( $column == 'cat_parent' ) {
3848
+                                } else if ($column == 'cat_parent') {
3849 3849
                                     $cat_parent = trim($row[$c]);
3850
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3850
+                                } else if ($column == 'cat_schema' && $row[$c] != '') {
3851 3851
                                     $cat_schema = $row[$c];
3852
-                                } else if ( $column == 'cat_description' ) {
3852
+                                } else if ($column == 'cat_description') {
3853 3853
                                     $cat_description = $row[$c];
3854
-                                } else if ( $column == 'cat_top_description' ) {
3854
+                                } else if ($column == 'cat_top_description') {
3855 3855
                                     $cat_top_description = $row[$c];
3856
-                                } else if ( $column == 'cat_image' ) {
3856
+                                } else if ($column == 'cat_image') {
3857 3857
                                     $cat_image = $row[$c];
3858
-                                } else if ( $column == 'cat_icon' ) {
3858
+                                } else if ($column == 'cat_icon') {
3859 3859
                                     $cat_icon = $row[$c];
3860 3860
                                 }
3861 3861
                                 // WPML
3862
-                                if ( $is_wpml ) {
3863
-                                    if ( $column == 'cat_language' ) {
3864
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3865
-                                    } else if ( $column == 'cat_id_original' ) {
3866
-                                        $cat_id_original = (int)$row[$c];
3862
+                                if ($is_wpml) {
3863
+                                    if ($column == 'cat_language') {
3864
+                                        $cat_language = geodir_strtolower(trim($row[$c]));
3865
+                                    } else if ($column == 'cat_id_original') {
3866
+                                        $cat_id_original = (int) $row[$c];
3867 3867
                                     }
3868 3868
                                 }
3869 3869
                                 // WPML
3870 3870
                                 $c++;
3871 3871
                             }
3872 3872
                             
3873
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3874
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3873
+                            if ($cat_name == '' || !in_array($cat_posttype, $post_types)) {
3874
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
3875 3875
                                 
3876 3876
                                 $invalid++;
3877 3877
                                 continue;
@@ -3889,24 +3889,24 @@  discard block
 block discarded – undo
3889 3889
                             $term_data['description'] = $cat_description;
3890 3890
                             $term_data['cat_schema'] = $cat_schema;
3891 3891
                             $term_data['top_description'] = $cat_top_description;
3892
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3893
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3892
+                            $term_data['image'] = $cat_image != '' ? basename($cat_image) : '';
3893
+                            $term_data['icon'] = $cat_icon != '' ? basename($cat_icon) : '';
3894 3894
                             
3895 3895
                             //$term_data = array_map( 'utf8_encode', $term_data );
3896 3896
                             
3897
-                            $taxonomy = $cat_posttype . 'category';
3897
+                            $taxonomy = $cat_posttype.'category';
3898 3898
                             
3899 3899
                             $term_data['taxonomy'] = $taxonomy;
3900 3900
 
3901 3901
                             $term_parent_id = 0;
3902
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3902
+                            if ($cat_parent != "" || (int) $cat_parent > 0) {
3903 3903
                                 $term_parent = '';
3904 3904
                                 
3905
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3905
+                                if ($term_parent = get_term_by('name', $cat_parent, $taxonomy)) {
3906 3906
                                     //
3907
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3907
+                                } else if ($term_parent = get_term_by('slug', $cat_parent, $taxonomy)) {
3908 3908
                                     //
3909
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3909
+                                } else if ($term_parent = get_term_by('id', $cat_parent, $taxonomy)) {
3910 3910
                                     //
3911 3911
                                 } else {
3912 3912
                                     $term_parent_data = array();
@@ -3914,104 +3914,104 @@  discard block
 block discarded – undo
3914 3914
                                     //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3915 3915
                                     $term_parent_data['taxonomy'] = $taxonomy;
3916 3916
                                     
3917
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3917
+                                    $term_parent_id = (int) geodir_imex_insert_term($taxonomy, $term_parent_data);
3918 3918
                                 }
3919 3919
                                 
3920
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3921
-                                    $term_parent_id = (int)$term_parent->term_id;
3920
+                                if (!empty($term_parent) && !is_wp_error($term_parent)) {
3921
+                                    $term_parent_id = (int) $term_parent->term_id;
3922 3922
                                 }
3923 3923
                             }
3924
-                            $term_data['parent'] = (int)$term_parent_id;
3924
+                            $term_data['parent'] = (int) $term_parent_id;
3925 3925
 
3926 3926
                             $term_id = NULL;
3927
-                            if ( $import_choice == 'update' ) {
3928
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3927
+                            if ($import_choice == 'update') {
3928
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3929 3929
                                     $term_data['term_id'] = $term['term_id'];
3930 3930
                                     
3931
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3931
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3932 3932
                                         $updated++;
3933 3933
                                     } else {
3934 3934
                                         $invalid++;
3935
-                                        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' ) );
3935
+                                        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'));
3936 3936
                                     }
3937
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3937
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3938 3938
                                     $term_data['term_id'] = $term['term_id'];
3939 3939
                                     
3940
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3940
+                                    if ($term_id = geodir_imex_update_term($taxonomy, $term_data)) {
3941 3941
                                         $updated++;
3942 3942
                                     } else {
3943 3943
                                         $invalid++;
3944
-                                        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' ) );
3944
+                                        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'));
3945 3945
                                     }
3946 3946
                                 } else {
3947
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3947
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3948 3948
                                         $created++;
3949 3949
                                     } else {
3950 3950
                                         $invalid++;
3951
-                                        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' ) );
3951
+                                        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'));
3952 3952
                                     }
3953 3953
                                 }
3954
-                            } else if ( $import_choice == 'skip' ) {
3955
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3954
+                            } else if ($import_choice == 'skip') {
3955
+                                if ($cat_id > 0 && $term = (array) term_exists($cat_id, $taxonomy)) {
3956 3956
                                     $skipped++;
3957
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3957
+                                } else if ($term_data['slug'] != '' && $term = (array) term_exists($term_data['slug'], $taxonomy)) {
3958 3958
                                     $skipped++;
3959 3959
                                 } else {
3960
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3960
+                                    if ($term_id = geodir_imex_insert_term($taxonomy, $term_data)) {
3961 3961
                                         $created++;
3962 3962
                                     } else {
3963 3963
                                         $invalid++;
3964
-                                        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' ) );
3964
+                                        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'));
3965 3965
                                     }
3966 3966
                                 }
3967 3967
                             } else {
3968 3968
                                 $invalid++;
3969
-                                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' ) );
3969
+                                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'));
3970 3970
                             }
3971 3971
                             
3972
-                            if ( $term_id ) {
3972
+                            if ($term_id) {
3973 3973
                                 // WPML
3974 3974
                                 if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3975
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3976
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3975
+                                    $wpml_element_type = 'tax_'.$taxonomy;
3976
+                                    $source_language = geodir_get_language_for_element($cat_id_original, $wpml_element_type);
3977 3977
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3978 3978
 
3979
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3979
+                                    $trid = $sitepress->get_element_trid($cat_id_original, $wpml_element_type);
3980 3980
                                     
3981
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3981
+                                    $sitepress->set_element_language_details($term_id, $wpml_element_type, $trid, $cat_language, $source_language);
3982 3982
                                 }
3983 3983
                                 // WPML
3984 3984
                                 
3985
-                                if ( isset( $term_data['top_description'] ) ) {
3986
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3985
+                                if (isset($term_data['top_description'])) {
3986
+                                    geodir_update_tax_meta($term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype);
3987 3987
                                 }
3988 3988
                                 
3989
-                                if ( isset( $term_data['cat_schema'] ) ) {
3990
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3989
+                                if (isset($term_data['cat_schema'])) {
3990
+                                    geodir_update_tax_meta($term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype);
3991 3991
                                 }
3992 3992
             
3993 3993
                                 $attachment = false;
3994
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3995
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3996
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3994
+                                if (isset($term_data['image']) && $term_data['image'] != '') {
3995
+                                    $cat_image = geodir_get_default_catimage($term_id, $cat_posttype);
3996
+                                    $cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : '';
3997 3997
                                     
3998
-                                    if ( basename($cat_image) != $term_data['image'] ) {
3998
+                                    if (basename($cat_image) != $term_data['image']) {
3999 3999
                                         $attachment = true;
4000
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4000
+                                        geodir_update_tax_meta($term_id, 'ct_cat_default_img', array('id' => 'image', 'src' => $uploads['url'].'/'.$term_data['image']), $cat_posttype);
4001 4001
                                     }
4002 4002
                                 }
4003 4003
                                 
4004
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4005
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4006
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4004
+                                if (isset($term_data['icon']) && $term_data['icon'] != '') {
4005
+                                    $cat_icon = geodir_get_tax_meta($term_id, 'ct_cat_icon', false, $cat_posttype);
4006
+                                    $cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
4007 4007
 
4008
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4008
+                                    if (basename($cat_icon) != $term_data['icon']) {
4009 4009
                                         $attachment = true;
4010
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4010
+                                        geodir_update_tax_meta($term_id, 'ct_cat_icon', array('id' => 'icon', 'src' => $uploads['url'].'/'.$term_data['icon']), $cat_posttype);
4011 4011
                                     }
4012 4012
                                 }
4013 4013
                                 
4014
-                                if ( $attachment ) {
4014
+                                if ($attachment) {
4015 4015
                                     $images++;
4016 4016
                                 }
4017 4017
                             }
@@ -4033,35 +4033,35 @@  discard block
 block discarded – undo
4033 4033
                 $json['invalid'] = $invalid;
4034 4034
                 $json['images'] = $images;
4035 4035
                 
4036
-                wp_send_json( $json );
4036
+                wp_send_json($json);
4037 4037
                 exit;
4038
-            } else if ( $task == 'import_post' ) {
4039
-                $xtimings['###1'] = microtime(true)-$xstart;
4038
+            } else if ($task == 'import_post') {
4039
+                $xtimings['###1'] = microtime(true) - $xstart;
4040 4040
                 //run some stuff to make the import quicker
4041
-                wp_defer_term_counting( true );
4042
-                wp_defer_comment_counting( true );
4043
-                $wpdb->query( 'SET autocommit = 0;' );
4041
+                wp_defer_term_counting(true);
4042
+                wp_defer_comment_counting(true);
4043
+                $wpdb->query('SET autocommit = 0;');
4044 4044
 //
4045 4045
 //                remove_all_actions('publish_post');
4046 4046
 //                remove_all_actions('transition_post_status');
4047 4047
 //                remove_all_actions('publish_future_post');
4048 4048
 
4049 4049
                 if (!empty($file)) {
4050
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4050
+                    $is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
4051 4051
                     $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4052 4052
                     $default_status = 'publish';
4053
-                    $current_date = date_i18n( 'Y-m-d', time() );
4053
+                    $current_date = date_i18n('Y-m-d', time());
4054 4054
                     
4055 4055
                     $columns = isset($file[0]) ? $file[0] : NULL;
4056 4056
                     
4057 4057
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4058 4058
                         $json['error'] = CSV_INVAILD_FILE;
4059
-                        wp_send_json( $json );
4059
+                        wp_send_json($json);
4060 4060
                         exit;
4061 4061
                     }
4062
-                    $xtimings['###2'] = microtime(true)-$xstart;
4062
+                    $xtimings['###2'] = microtime(true) - $xstart;
4063 4063
                     $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4064
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4064
+                    $wp_chars_error = __('(check & remove if any invalid characters used in data)', 'geodirectory');
4065 4065
                     $processed_actual = 0;
4066 4066
                     for ($i = 1; $i <= $limit; $i++) {
4067 4067
                         $index = $processed + $i;
@@ -4070,9 +4070,9 @@  discard block
 block discarded – undo
4070 4070
                         if (isset($file[$index])) {
4071 4071
                             $processed_actual++;
4072 4072
                             $row = $file[$index];
4073
-                            $row = array_map( 'trim', $row );
4073
+                            $row = array_map('trim', $row);
4074 4074
                             //$row = array_map( 'utf8_encode', $row );
4075
-                            $row = array_map( 'addslashes_gpc', $row );
4075
+                            $row = array_map('addslashes_gpc', $row);
4076 4076
                             
4077 4077
                             $post_id = '';
4078 4078
                             $post_title = '';
@@ -4112,82 +4112,82 @@  discard block
 block discarded – undo
4112 4112
                             $original_post_id = '';
4113 4113
                             
4114 4114
                             $c = 0;
4115
-                            foreach ($columns as $column ) {
4115
+                            foreach ($columns as $column) {
4116 4116
                                 $gd_post[$column] = $row[$c];
4117 4117
                                 
4118
-                                if ( $column == 'post_id' ) {
4118
+                                if ($column == 'post_id') {
4119 4119
                                     $post_id = $row[$c];
4120
-                                } else if ( $column == 'post_title' ) {
4120
+                                } else if ($column == 'post_title') {
4121 4121
                                     $post_title = sanitize_text_field($row[$c]);
4122
-                                } else if ( $column == 'post_author' ) {
4122
+                                } else if ($column == 'post_author') {
4123 4123
                                     $post_author = $row[$c];
4124
-                                } else if ( $column == 'post_date' ) {
4124
+                                } else if ($column == 'post_date') {
4125 4125
                                     $post_date = $row[$c];
4126
-                                } else if ( $column == 'post_content' ) {
4126
+                                } else if ($column == 'post_content') {
4127 4127
                                     $post_content = $row[$c];
4128
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4129
-                                    $post_category_arr = explode( ',', $row[$c] );
4130
-                                } else if ( $column == 'default_category' ) {
4128
+                                } else if ($column == 'post_category' && $row[$c] != '') {
4129
+                                    $post_category_arr = explode(',', $row[$c]);
4130
+                                } else if ($column == 'default_category') {
4131 4131
                                     $default_category = wp_kses_normalize_entities($row[$c]);
4132
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4133
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4134
-                                } else if ( $column == 'post_type' ) {
4132
+                                } else if ($column == 'post_tags' && $row[$c] != '') {
4133
+                                    $post_tags = explode(',', sanitize_text_field($row[$c]));
4134
+                                } else if ($column == 'post_type') {
4135 4135
                                     $post_type = $row[$c];
4136
-                                } else if ( $column == 'post_status' ) {
4137
-                                    $post_status = sanitize_key( $row[$c] );
4138
-                                } else if ( $column == 'is_featured' ) {
4139
-                                    $is_featured = (int)$row[$c];
4140
-                                } else if ( $column == 'geodir_video' ) {
4136
+                                } else if ($column == 'post_status') {
4137
+                                    $post_status = sanitize_key($row[$c]);
4138
+                                } else if ($column == 'is_featured') {
4139
+                                    $is_featured = (int) $row[$c];
4140
+                                } else if ($column == 'geodir_video') {
4141 4141
                                     $geodir_video = $row[$c];
4142
-                                } else if ( $column == 'post_address' ) {
4142
+                                } else if ($column == 'post_address') {
4143 4143
                                     $post_address = sanitize_text_field($row[$c]);
4144
-                                } else if ( $column == 'post_city' ) {
4144
+                                } else if ($column == 'post_city') {
4145 4145
                                     $post_city = sanitize_text_field($row[$c]);
4146
-                                } else if ( $column == 'post_region' ) {
4146
+                                } else if ($column == 'post_region') {
4147 4147
                                     $post_region = sanitize_text_field($row[$c]);
4148
-                                } else if ( $column == 'post_country' ) {
4148
+                                } else if ($column == 'post_country') {
4149 4149
                                     $post_country = sanitize_text_field($row[$c]);
4150
-                                } else if ( $column == 'post_zip' ) {
4150
+                                } else if ($column == 'post_zip') {
4151 4151
                                     $post_zip = sanitize_text_field($row[$c]);
4152
-                                } else if ( $column == 'post_latitude' ) {
4152
+                                } else if ($column == 'post_latitude') {
4153 4153
                                     $post_latitude = sanitize_text_field($row[$c]);
4154
-                                } else if ( $column == 'post_longitude' ) {
4154
+                                } else if ($column == 'post_longitude') {
4155 4155
                                     $post_longitude = sanitize_text_field($row[$c]);
4156
-                                } else if ( $column == 'post_neighbourhood' ) {
4156
+                                } else if ($column == 'post_neighbourhood') {
4157 4157
                                     $post_neighbourhood = sanitize_text_field($row[$c]);
4158 4158
                                     unset($gd_post[$column]);
4159
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4159
+                                } else if ($column == 'neighbourhood_latitude') {
4160 4160
                                     $neighbourhood_latitude = sanitize_text_field($row[$c]);
4161
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4161
+                                } else if ($column == 'neighbourhood_longitude') {
4162 4162
                                     $neighbourhood_longitude = sanitize_text_field($row[$c]);
4163
-                                } else if ( $column == 'geodir_timing' ) {
4163
+                                } else if ($column == 'geodir_timing') {
4164 4164
                                     $geodir_timing = sanitize_text_field($row[$c]);
4165
-                                } else if ( $column == 'geodir_contact' ) {
4165
+                                } else if ($column == 'geodir_contact') {
4166 4166
                                     $geodir_contact = sanitize_text_field($row[$c]);
4167
-                                } else if ( $column == 'geodir_email' ) {
4167
+                                } else if ($column == 'geodir_email') {
4168 4168
                                     $geodir_email = sanitize_email($row[$c]);
4169
-                                } else if ( $column == 'geodir_website' ) {
4169
+                                } else if ($column == 'geodir_website') {
4170 4170
                                     $geodir_website = sanitize_text_field($row[$c]);
4171
-                                } else if ( $column == 'geodir_twitter' ) {
4171
+                                } else if ($column == 'geodir_twitter') {
4172 4172
                                     $geodir_twitter = sanitize_text_field($row[$c]);
4173
-                                } else if ( $column == 'geodir_facebook' ) {
4173
+                                } else if ($column == 'geodir_facebook') {
4174 4174
                                     $geodir_facebook = sanitize_text_field($row[$c]);
4175
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4175
+                                } else if ($column == 'IMAGE' && !empty($row[$c]) && $row[$c] != '') {
4176 4176
                                     $post_images[] = $row[$c];
4177
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4178
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4179
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4177
+                                } else if ($column == 'alive_days' && (int) $row[$c] > 0) {
4178
+                                    $expire_date = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $row[$c].' days'));
4179
+                                } else if ($column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never') {
4180 4180
                                     $row[$c] = str_replace('/', '-', $row[$c]);
4181
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4182
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4183
-                                    $geodir_link_business = (int)$row[$c];
4181
+                                    $expire_date = date_i18n('Y-m-d', strtotime($row[$c]));
4182
+                                } else if (strpos($column, 'linked_') === 0) {
4183
+                                    $geodir_link_business = (int) $row[$c];
4184 4184
                                 }
4185 4185
                                 // WPML
4186 4186
                                 if ($is_wpml) {
4187 4187
                                     if ($column == 'language') {
4188 4188
                                         $language = geodir_strtolower(trim($row[$c]));
4189 4189
                                     } else if ($column == 'original_post_id') {
4190
-                                        $original_post_id = (int)$row[$c];
4190
+                                        $original_post_id = (int) $row[$c];
4191 4191
                                     }
4192 4192
                                 }
4193 4193
                                 // WPML
@@ -4195,7 +4195,7 @@  discard block
 block discarded – undo
4195 4195
                             }
4196 4196
                             // listing claimed or not
4197 4197
                             if ($is_claim_active && isset($gd_post['claimed'])) {
4198
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4198
+                                $gd_post['claimed'] = (int) $gd_post['claimed'] == 1 ? 1 : 0;
4199 4199
                             }
4200 4200
                             
4201 4201
                             // WPML
@@ -4206,43 +4206,43 @@  discard block
 block discarded – undo
4206 4206
 
4207 4207
                             $gd_post['IMAGE'] = $post_images;
4208 4208
                             
4209
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4210
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4209
+                            $post_status = !empty($post_status) ? sanitize_key($post_status) : $default_status;
4210
+                            $post_status = !empty($wp_post_statuses) && !isset($wp_post_statuses[$post_status]) ? $default_status : $post_status;
4211 4211
                                                                                                                 
4212 4212
                             $valid = true;
4213 4213
                             
4214
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4214
+                            if ($post_title == '' || !in_array($post_type, $post_types)) {
4215 4215
                                 $invalid++;
4216 4216
                                 $valid = false;
4217
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4217
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.__('Could not be added due to blank title/invalid post type', 'geodirectory'));
4218 4218
                             }
4219
-                            $xtimings['###3'] = microtime(true)-$xstart;
4220
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4221
-                            if ( $location_allowed ) {
4219
+                            $xtimings['###3'] = microtime(true) - $xstart;
4220
+                            $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
4221
+                            if ($location_allowed) {
4222 4222
                                 $location_result = geodir_get_default_location();
4223
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4223
+                                if ($post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '') {
4224 4224
                                     $invalid_addr++;
4225 4225
                                     $valid = false;
4226
-                                    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' ) );
4227
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4228
-                                    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 ) ) ) {
4226
+                                    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'));
4227
+                                } else if (!empty($location_result) && $location_result->location_id == 0) {
4228
+                                    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))) {
4229 4229
                                         $invalid_addr++;
4230 4230
                                         $valid = false;
4231
-                                        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' ) );
4231
+                                        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'));
4232 4232
                                     } else {
4233 4233
                                         if (!$location_manager) {
4234
-                                            $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.
4234
+                                            $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.
4235 4235
                                         }
4236 4236
                                     }
4237 4237
                                 }
4238 4238
                             }
4239
-                            $xtimings['###4']   = microtime(true)-$xstart;
4240
-                            if ( !$valid ) {
4239
+                            $xtimings['###4'] = microtime(true) - $xstart;
4240
+                            if (!$valid) {
4241 4241
                                 continue;
4242 4242
                             }
4243 4243
 
4244
-                            $cat_taxonomy = $post_type . 'category';
4245
-                            $tags_taxonomy = $post_type . '_tags';
4244
+                            $cat_taxonomy = $post_type.'category';
4245
+                            $tags_taxonomy = $post_type.'_tags';
4246 4246
                             
4247 4247
                             if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4248 4248
                                 $post_category_arr = array_merge(array($default_category), $post_category_arr);
@@ -4250,29 +4250,29 @@  discard block
 block discarded – undo
4250 4250
 
4251 4251
                             $post_category = array();
4252 4252
                             $default_category_id = NULL;
4253
-                            if ( !empty( $post_category_arr ) ) {
4254
-                                foreach ( $post_category_arr as $value ) {
4255
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4253
+                            if (!empty($post_category_arr)) {
4254
+                                foreach ($post_category_arr as $value) {
4255
+                                    $category_name = wp_kses_normalize_entities(trim($value));
4256 4256
                                     
4257
-                                    if ( $category_name != '' ) {
4257
+                                    if ($category_name != '') {
4258 4258
                                         $term_category = array();
4259 4259
                                         
4260
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4260
+                                        if ($term = get_term_by('name', $category_name, $cat_taxonomy)) {
4261 4261
                                             $term_category = $term;
4262
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4262
+                                        } else if ($term = get_term_by('slug', $category_name, $cat_taxonomy)) {
4263 4263
                                             $term_category = $term;
4264 4264
                                         } else {
4265 4265
                                             $term_data = array();
4266 4266
                                             $term_data['name'] = $category_name;
4267 4267
                                             $term_data['taxonomy'] = $cat_taxonomy;
4268 4268
                                             
4269
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4270
-                                            if ( $term_id ) {
4271
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4269
+                                            $term_id = geodir_imex_insert_term($cat_taxonomy, $term_data);
4270
+                                            if ($term_id) {
4271
+                                                $term_category = get_term($term_id, $cat_taxonomy);
4272 4272
                                             }
4273 4273
                                         }
4274 4274
                                         
4275
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4275
+                                        if (!empty($term_category) && !is_wp_error($term_category)) {
4276 4276
                                             $post_category[] = intval($term_category->term_id);
4277 4277
                                             
4278 4278
                                             if ($category_name == $default_category) {
@@ -4282,14 +4282,14 @@  discard block
 block discarded – undo
4282 4282
                                     }
4283 4283
                                 }
4284 4284
                             }
4285
-                            $xtimings['###5'] = microtime(true)-$xstart;
4285
+                            $xtimings['###5'] = microtime(true) - $xstart;
4286 4286
                             $save_post = array();
4287 4287
                             $save_post['post_title'] = $post_title;
4288 4288
                             if (!empty($post_date)) {
4289
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4289
+                                $post_date = geodir_date($post_date, 'Y-m-d H:i:s'); // convert to mysql date format.
4290 4290
                                 
4291 4291
                                 $save_post['post_date'] = $post_date;
4292
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4292
+                                $save_post['post_date_gmt'] = get_gmt_from_date($post_date);
4293 4293
                             }
4294 4294
                             $save_post['post_content'] = $post_content;
4295 4295
                             $save_post['post_type'] = $post_type;
@@ -4299,15 +4299,15 @@  discard block
 block discarded – undo
4299 4299
                             $save_post['post_tags'] = $post_tags;
4300 4300
 
4301 4301
                             $saved_post_id = NULL;
4302
-                            if ( $import_choice == 'update' ) {
4303
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4302
+                            if ($import_choice == 'update') {
4303
+                                $gd_wp_error = __('Unable to add listing, please check the listing data.', 'geodirectory');
4304 4304
                                 
4305
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4305
+                                if ($post_id > 0 && get_post($post_id)) {
4306 4306
                                     $save_post['ID'] = $post_id;
4307 4307
                                     
4308
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4309
-                                        if ( is_wp_error( $saved_post_id ) ) {
4310
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4308
+                                    if ($saved_post_id = wp_update_post($save_post, true)) {
4309
+                                        if (is_wp_error($saved_post_id)) {
4310
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4311 4311
                                             $saved_post_id = 0;
4312 4312
                                         } else {
4313 4313
                                             $saved_post_id = $post_id;
@@ -4315,9 +4315,9 @@  discard block
 block discarded – undo
4315 4315
                                         }
4316 4316
                                     }
4317 4317
                                 } else {
4318
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4319
-                                        if ( is_wp_error( $saved_post_id ) ) {
4320
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4318
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4319
+                                        if (is_wp_error($saved_post_id)) {
4320
+                                            $gd_wp_error = $saved_post_id->get_error_message().' '.$wp_chars_error;
4321 4321
                                             $saved_post_id = 0;
4322 4322
                                         } else {
4323 4323
                                             $created++;
@@ -4325,19 +4325,19 @@  discard block
 block discarded – undo
4325 4325
                                     }
4326 4326
                                 }
4327 4327
                                 
4328
-                                if ( !$saved_post_id > 0 ) {
4328
+                                if (!$saved_post_id > 0) {
4329 4329
                                     $invalid++;
4330
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4330
+                                    geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_wp_error);
4331 4331
                                 }
4332
-                            } else if ( $import_choice == 'skip' ) {
4333
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4332
+                            } else if ($import_choice == 'skip') {
4333
+                                if ($post_id > 0 && get_post($post_id)) {
4334 4334
                                     $skipped++;	
4335 4335
                                 } else {
4336
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4337
-                                        if ( is_wp_error( $saved_post_id ) ) {
4336
+                                    if ($saved_post_id = wp_insert_post($save_post, true)) {
4337
+                                        if (is_wp_error($saved_post_id)) {
4338 4338
                                             $invalid++;
4339 4339
                                             
4340
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4340
+                                            geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$saved_post_id->get_error_message().' '.$wp_chars_error);
4341 4341
                                             $saved_post_id = 0;
4342 4342
                                         } else {
4343 4343
                                             $created++;
@@ -4345,28 +4345,28 @@  discard block
 block discarded – undo
4345 4345
                                     } else {
4346 4346
                                         $invalid++;
4347 4347
                                         
4348
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4348
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4349 4349
                                     }
4350 4350
                                 }
4351 4351
                             } else {
4352 4352
                                 $invalid++;
4353 4353
                                 
4354
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4354
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$wp_chars_error);
4355 4355
                             }
4356
-                            $xtimings['###6'] = microtime(true)-$xstart;
4357
-                            if ( (int)$saved_post_id > 0 ) {
4356
+                            $xtimings['###6'] = microtime(true) - $xstart;
4357
+                            if ((int) $saved_post_id > 0) {
4358 4358
                                 // WPML
4359 4359
                                 if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4360
-                                    $wpml_post_type = 'post_' . $post_type;
4361
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4360
+                                    $wpml_post_type = 'post_'.$post_type;
4361
+                                    $source_language = geodir_get_language_for_element($original_post_id, $wpml_post_type);
4362 4362
                                     $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4363 4363
 
4364
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4364
+                                    $trid = $sitepress->get_element_trid($original_post_id, $wpml_post_type);
4365 4365
                                     
4366
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4366
+                                    $sitepress->set_element_language_details($saved_post_id, $wpml_post_type, $trid, $language, $source_language);
4367 4367
                                 }
4368 4368
                                 // WPML
4369
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4369
+                                $gd_post_info = geodir_get_post_info($saved_post_id);
4370 4370
                                 
4371 4371
                                 $gd_post['post_id'] = $saved_post_id;
4372 4372
                                 $gd_post['ID'] = $saved_post_id;
@@ -4378,7 +4378,7 @@  discard block
 block discarded – undo
4378 4378
                                                     
4379 4379
                                 // post location
4380 4380
                                 $post_location_id = 0;
4381
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4381
+                                if ($location_allowed && !empty($location_result) && $location_result->location_id > 0) {
4382 4382
                                     $gd_post['post_neighbourhood'] = '';
4383 4383
                                     
4384 4384
                                     $post_location_info = array(
@@ -4388,7 +4388,7 @@  discard block
 block discarded – undo
4388 4388
                                                                 'geo_lat' => $post_latitude,
4389 4389
                                                                 'geo_lng' => $post_longitude
4390 4390
                                                             );
4391
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4391
+                                    if ($location_id = (int) geodir_add_new_location($post_location_info)) {
4392 4392
                                         $post_location_id = $location_id;
4393 4393
                                     }
4394 4394
                                     
@@ -4430,14 +4430,14 @@  discard block
 block discarded – undo
4430 4430
                                 }
4431 4431
                                 
4432 4432
                                 // post package info
4433
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4433
+                                $package_id = isset($gd_post['package_id']) && !empty($gd_post['package_id']) ? (int) $gd_post['package_id'] : 0;
4434 4434
                                 if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4435 4435
                                     $package_id = $gd_post_info->package_id;
4436 4436
                                 }
4437 4437
                                 
4438 4438
                                 $package_info = array();
4439 4439
                                 if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4440
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4440
+                                    $package_info = (array) geodir_get_package_info_by_id($package_id);
4441 4441
                                     
4442 4442
                                     if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4443 4443
                                         $package_info = array();
@@ -4445,18 +4445,18 @@  discard block
 block discarded – undo
4445 4445
                                 }
4446 4446
                                 
4447 4447
                                 if (empty($package_info)) {
4448
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4448
+                                    $package_info = (array) geodir_post_package_info(array(), '', $post_type);
4449 4449
                                 }
4450 4450
                                  
4451
-                                if (!empty($package_info))	 {
4451
+                                if (!empty($package_info)) {
4452 4452
                                     $package_id = $package_info['pid'];
4453 4453
                                     
4454 4454
                                     if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4455 4455
                                         $gd_post['expire_date'] = $expire_date;
4456 4456
                                     } else {
4457
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4458
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4459
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4457
+                                        if (isset($package_info['days']) && (int) $package_info['days'] > 0) {
4458
+                                            $gd_post['alive_days'] = (int) $package_info['days'];
4459
+                                            $gd_post['expire_date'] = date_i18n('Y-m-d', strtotime($current_date.'+'.(int) $package_info['days'].' days'));
4460 4460
                                         } else {
4461 4461
                                             $gd_post['expire_date'] = 'Never';
4462 4462
                                         }
@@ -4465,7 +4465,7 @@  discard block
 block discarded – undo
4465 4465
                                     $gd_post['package_id'] = $package_id;
4466 4466
                                 }
4467 4467
 
4468
-                                $table = $plugin_prefix . $post_type . '_detail';
4468
+                                $table = $plugin_prefix.$post_type.'_detail';
4469 4469
                                 
4470 4470
                                 if ($post_type == 'gd_event') {
4471 4471
                                     $gd_post = geodir_imex_process_event_data($gd_post);
@@ -4476,71 +4476,71 @@  discard block
 block discarded – undo
4476 4476
                                 }
4477 4477
 
4478 4478
                                 // Export franchise fields
4479
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4479
+                                $is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
4480 4480
                                 if ($is_franchise_active) {
4481
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4482
-                                        if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4481
+                                    if (isset($gd_post['gd_is_franchise']) && empty($gd_post['franchise'])) {
4482
+                                        if (absint($gd_post['gd_is_franchise']) != 0) {
4483 4483
                                             $gd_franchise_lock = array();
4484 4484
                                             
4485
-                                            if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4486
-                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4487
-                                                $gd_franchise_lock = trim( $gd_franchise_lock );
4488
-                                                $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4485
+                                            if (isset($gd_post['gd_franchise_lock'])) {
4486
+                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock']);
4487
+                                                $gd_franchise_lock = trim($gd_franchise_lock);
4488
+                                                $gd_franchise_lock = explode(",", $gd_franchise_lock);
4489 4489
                                             }
4490 4490
                                             
4491
-                                            update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4492
-                                            update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4491
+                                            update_post_meta($saved_post_id, 'gd_is_franchise', 1);
4492
+                                            update_post_meta($saved_post_id, 'gd_franchise_lock', $gd_franchise_lock);
4493 4493
                                         } else {
4494
-                                            if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4495
-                                                geodir_franchise_remove_franchise( $saved_post_id );
4494
+                                            if (function_exists('geodir_franchise_remove_franchise')) {
4495
+                                                geodir_franchise_remove_franchise($saved_post_id);
4496 4496
                                             }
4497 4497
                                         }
4498 4498
                                     } else {
4499
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4500
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4499
+                                        if (isset($gd_post['franchise']) && (int) $gd_post['franchise'] > 0 && geodir_franchise_check((int) $gd_post['franchise'])) {
4500
+                                            geodir_save_post_meta($saved_post_id, 'franchise', (int) $gd_post['franchise']);
4501 4501
                                         }
4502 4502
                                     }
4503 4503
                                 }
4504 4504
                                 
4505 4505
                                 if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4506
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4506
+                                    $save_post['post_category'] = array_unique(array_map('intval', $save_post['post_category']));
4507 4507
                                     if ($default_category_id) {
4508 4508
                                         $save_post['post_default_category'] = $default_category_id;
4509 4509
                                         $gd_post['default_category'] = $default_category_id;
4510 4510
                                     }
4511 4511
                                     $gd_post[$cat_taxonomy] = $save_post['post_category'];
4512 4512
                                 }
4513
-                                $xtimings['###7'] = microtime(true)-$xstart;
4513
+                                $xtimings['###7'] = microtime(true) - $xstart;
4514 4514
                                 // Save post info
4515
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4516
-                                $xtimings['###8'] = microtime(true)-$xstart;
4515
+                                geodir_save_post_info($saved_post_id, $gd_post);
4516
+                                $xtimings['###8'] = microtime(true) - $xstart;
4517 4517
                                 // post taxonomies
4518
-                                if ( !empty( $save_post['post_category'] ) ) {
4519
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4518
+                                if (!empty($save_post['post_category'])) {
4519
+                                    wp_set_object_terms($saved_post_id, $save_post['post_category'], $cat_taxonomy);
4520 4520
                                     
4521
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4521
+                                    $post_default_category = isset($save_post['post_default_category']) ? $save_post['post_default_category'] : '';
4522 4522
                                     if ($default_category_id) {
4523 4523
                                         $post_default_category = $default_category_id;
4524 4524
                                     }
4525 4525
                                     $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4526 4526
                                     $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4527
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4527
+                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']).',y:' : '';
4528 4528
                                     
4529 4529
                                     if ($post_category_str != '' && $post_default_category) {
4530
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4530
+                                        $post_category_str = str_replace($post_default_category.',y:', $post_default_category.',y,d:', $post_category_str);
4531 4531
                                     }
4532 4532
                                     
4533 4533
                                     $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4534 4534
                                     
4535
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4535
+                                    geodir_set_postcat_structure($saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str);
4536 4536
                                 }
4537
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4538
-                                if ( !empty( $save_post['post_tags'] ) ) {
4539
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4537
+                                $xtimings['###8.1'] = microtime(true) - $xstart;
4538
+                                if (!empty($save_post['post_tags'])) {
4539
+                                    wp_set_object_terms($saved_post_id, $save_post['post_tags'], $tags_taxonomy);
4540 4540
                                 }
4541
-                                $xtimings['###9'] = microtime(true)-$xstart;
4541
+                                $xtimings['###9'] = microtime(true) - $xstart;
4542 4542
                                 // Post images
4543
-                                if ( !empty( $post_images ) ) {
4543
+                                if (!empty($post_images)) {
4544 4544
                                     $post_images = array_unique($post_images);
4545 4545
                                     
4546 4546
                                     $old_post_images_arr = array();
@@ -4548,65 +4548,65 @@  discard block
 block discarded – undo
4548 4548
                                     
4549 4549
                                     $order = 1;
4550 4550
                                     
4551
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4552
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4551
+                                    $old_post_images = geodir_get_images($saved_post_id);
4552
+                                    $xtimings['###9.1'] = microtime(true) - $xstart;
4553 4553
                                     if (!empty($old_post_images)) {
4554
-                                        foreach( $old_post_images as $old_post_image ) {
4554
+                                        foreach ($old_post_images as $old_post_image) {
4555 4555
                                             if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4556 4556
                                                 $old_post_images_arr[] = $old_post_image->file;
4557 4557
                                             }
4558 4558
                                         }
4559 4559
                                     }
4560 4560
 
4561
-                                    foreach ( $post_images as $post_image ) {
4562
-                                        $image_name = basename( $post_image );
4561
+                                    foreach ($post_images as $post_image) {
4562
+                                        $image_name = basename($post_image);
4563 4563
                                         $saved_post_images_arr[] = $image_name;
4564 4564
                                         
4565
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4565
+                                        if (!empty($old_post_images_arr) && in_array($image_name, $old_post_images_arr)) {
4566 4566
                                             continue; // Skip if image already exists.
4567 4567
                                         }
4568 4568
                                         
4569
-                                        $image_name_parts = explode( '.', $image_name );
4570
-                                        array_pop( $image_name_parts );
4571
-                                        $proper_image_name = implode( '.', $image_name_parts );
4572
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4573
-                                        $arr_file_type = wp_check_filetype( $image_name );
4574
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4575
-                                        if ( !empty( $arr_file_type ) ) {
4569
+                                        $image_name_parts = explode('.', $image_name);
4570
+                                        array_pop($image_name_parts);
4571
+                                        $proper_image_name = implode('.', $image_name_parts);
4572
+                                        $xtimings['###9.2'] = microtime(true) - $xstart;
4573
+                                        $arr_file_type = wp_check_filetype($image_name);
4574
+                                        $xtimings['###9.3'] = microtime(true) - $xstart;
4575
+                                        if (!empty($arr_file_type)) {
4576 4576
                                             $uploaded_file_type = $arr_file_type['type'];
4577 4577
                                             
4578 4578
                                             $attachment = array();
4579 4579
                                             $attachment['post_id'] = $saved_post_id;
4580 4580
                                             $attachment['title'] = $proper_image_name;
4581 4581
                                             $attachment['content'] = '';
4582
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4582
+                                            $attachment['file'] = $uploads_subdir.'/'.$image_name;
4583 4583
                                             $attachment['mime_type'] = $uploaded_file_type;
4584 4584
                                             $attachment['menu_order'] = $order;
4585 4585
                                             $attachment['is_featured'] = 0;
4586 4586
 
4587 4587
                                             $attachment_set = '';
4588
-                                            foreach ( $attachment as $key => $val ) {
4589
-                                                if ( $val != '' ) {
4590
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4588
+                                            foreach ($attachment as $key => $val) {
4589
+                                                if ($val != '') {
4590
+                                                    $attachment_set .= $key." = '".$val."', ";
4591 4591
                                                 }
4592 4592
                                             }
4593
-                                            $attachment_set = trim( $attachment_set, ", " );
4593
+                                            $attachment_set = trim($attachment_set, ", ");
4594 4594
                                                                                         
4595 4595
                                             // Add new attachment
4596
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4597
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4598
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4596
+                                            $xtimings['###9.4'] = microtime(true) - $xstart;
4597
+                                            $wpdb->query("INSERT INTO ".GEODIR_ATTACHMENT_TABLE." SET ".$attachment_set);
4598
+                                            $xtimings['###9.5'] = microtime(true) - $xstart;
4599 4599
                                             $order++;
4600 4600
                                         }
4601 4601
                                     }
4602 4602
 
4603
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4603
+                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/".implode("' AND file NOT LIKE '%/", $saved_post_images_arr)."' )" : '';
4604 4604
                                     // Remove previous attachment
4605
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4606
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4607
-                                    if ( !empty( $saved_post_images_arr ) ) {
4605
+                                    $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = ".(int) $saved_post_id." ".$saved_post_images_sql);
4606
+                                    $xtimings['###9.6'] = microtime(true) - $xstart;
4607
+                                    if (!empty($saved_post_images_arr)) {
4608 4608
                                         geodir_set_wp_featured_image($saved_post_id);
4609
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4609
+                                        $xtimings['###9.7'] = microtime(true) - $xstart;
4610 4610
                                         /*
4611 4611
                                         $menu_order = 1;
4612 4612
                                         
@@ -4622,14 +4622,14 @@  discard block
 block discarded – undo
4622 4622
                                         }*/
4623 4623
                                     }
4624 4624
                                     
4625
-                                    if ( $order > 1 ) {
4625
+                                    if ($order > 1) {
4626 4626
                                         $images++;
4627 4627
                                     }
4628 4628
                                 }
4629
-                                $xtimings['###10'] = microtime(true)-$xstart;
4629
+                                $xtimings['###10'] = microtime(true) - $xstart;
4630 4630
                                 /** This action is documented in geodirectory-functions/post-functions.php */
4631
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4632
-                                $xtimings['###11'] = microtime(true)-$xstart;
4631
+                                do_action('geodir_after_save_listing', $saved_post_id, $gd_post);
4632
+                                $xtimings['###11'] = microtime(true) - $xstart;
4633 4633
                                 if (isset($is_featured)) {
4634 4634
                                     geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4635 4635
                                 }
@@ -4639,7 +4639,7 @@  discard block
 block discarded – undo
4639 4639
                                 if (isset($gd_post['expire_date'])) {
4640 4640
                                     geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4641 4641
                                 }
4642
-                                $xtimings['###12'] = microtime(true)-$xstart;
4642
+                                $xtimings['###12'] = microtime(true) - $xstart;
4643 4643
                             }
4644 4644
                             
4645 4645
                             // WPML
@@ -4652,11 +4652,11 @@  discard block
 block discarded – undo
4652 4652
                 }
4653 4653
 
4654 4654
                 //undo some stuff to make the import quicker
4655
-                wp_defer_term_counting( false );
4656
-                wp_defer_comment_counting( false );
4657
-                $wpdb->query( 'COMMIT;' );
4658
-                $wpdb->query( 'SET autocommit = 1;' );
4659
-                $xtimings['###13'] = microtime(true)-$xstart;
4655
+                wp_defer_term_counting(false);
4656
+                wp_defer_comment_counting(false);
4657
+                $wpdb->query('COMMIT;');
4658
+                $wpdb->query('SET autocommit = 1;');
4659
+                $xtimings['###13'] = microtime(true) - $xstart;
4660 4660
                 $json = array();
4661 4661
                 $json['processed'] = $processed_actual;
4662 4662
                 $json['created'] = $created;
@@ -4665,13 +4665,13 @@  discard block
 block discarded – undo
4665 4665
                 $json['invalid'] = $invalid;
4666 4666
                 $json['invalid_addr'] = $invalid_addr;
4667 4667
                 $json['images'] = $images;
4668
-                $json['timing'] = microtime(true)-$xstart;
4668
+                $json['timing'] = microtime(true) - $xstart;
4669 4669
                 $json['timings'] = $xtimings;
4670 4670
                 
4671 4671
 
4672
-                wp_send_json( $json );
4672
+                wp_send_json($json);
4673 4673
                 exit;
4674
-            } else if ( $task == 'import_loc' ) {
4674
+            } else if ($task == 'import_loc') {
4675 4675
                 global $gd_post_types;
4676 4676
                 $gd_post_types = $post_types;
4677 4677
                 
@@ -4680,82 +4680,82 @@  discard block
 block discarded – undo
4680 4680
                     
4681 4681
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4682 4682
                         $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4683
-                        wp_send_json( $json );
4683
+                        wp_send_json($json);
4684 4684
                     }
4685 4685
                     
4686 4686
                     $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4687
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4687
+                    $gd_error_location = __('Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory');
4688 4688
                     for ($i = 1; $i <= $limit; $i++) {
4689 4689
                         $index = $processed + $i;
4690 4690
                         
4691 4691
                         if (isset($file[$index])) {
4692 4692
                             $row = $file[$index];
4693
-                            $row = array_map( 'trim', $row );
4693
+                            $row = array_map('trim', $row);
4694 4694
                             $data = array();
4695 4695
                             
4696
-                            foreach ($columns as $c => $column ) {
4696
+                            foreach ($columns as $c => $column) {
4697 4697
                                 if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4698 4698
                                     $data[$column] = $row[$c];
4699 4699
                                 }
4700 4700
                             }
4701 4701
 
4702
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4702
+                            if (empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude'])) {
4703 4703
                                 $invalid++;
4704
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4704
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4705 4705
                                 continue;
4706 4706
                             }
4707 4707
                             
4708 4708
                             $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4709 4709
                             
4710
-                            if ( $import_choice == 'update' ) {
4711
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4712
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4710
+                            if ($import_choice == 'update') {
4711
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4712
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4713 4713
                                         $updated++;
4714 4714
                                     } else {
4715 4715
                                         $invalid++;
4716
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4716
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4717 4717
                                     }
4718
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4719
-                                    $data['location_id'] = (int)$location->location_id;
4718
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4719
+                                    $data['location_id'] = (int) $location->location_id;
4720 4720
                                     
4721
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4722
-                                        $data['location_id'] = (int)$location->location_id;
4723
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4724
-                                        $data['location_id'] = (int)$location->location_id;
4725
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4726
-                                        $data['location_id'] = (int)$location->location_id;
4721
+                                    if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region']))) {
4722
+                                        $data['location_id'] = (int) $location->location_id;
4723
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'region' => $data['region']))) {
4724
+                                        $data['location_id'] = (int) $location->location_id;
4725
+                                    } else if ($location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug'], 'country' => $data['country']))) {
4726
+                                        $data['location_id'] = (int) $location->location_id;
4727 4727
                                     }
4728 4728
                                     
4729
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4729
+                                    if ($location_id = geodir_location_update_city($data, true, $location)) {
4730 4730
                                         $updated++;
4731 4731
                                     } else {
4732 4732
                                         $invalid++;
4733
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4733
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4734 4734
                                     }
4735 4735
                                 } else {
4736
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4736
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4737 4737
                                         $created++;
4738 4738
                                     } else {
4739 4739
                                         $invalid++;
4740
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4740
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4741 4741
                                     }
4742 4742
                                 }
4743
-                            } elseif ( $import_choice == 'skip' ) {
4744
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4743
+                            } elseif ($import_choice == 'skip') {
4744
+                                if ((int) $data['location_id'] > 0 && $location = geodir_get_location_by_id('', (int) $data['location_id'])) {
4745 4745
                                     $skipped++;
4746
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4746
+                                } else if (!empty($data['city_slug']) && $location = geodir_get_location_by_slug('city', array('city_slug' => $data['city_slug']))) {
4747 4747
                                     $skipped++;
4748 4748
                                 } else {
4749
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4749
+                                    if ($location_id = geodir_location_insert_city($data, true)) {
4750 4750
                                         $created++;
4751 4751
                                     } else {
4752 4752
                                         $invalid++;
4753
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4753
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4754 4754
                                     }
4755 4755
                                 }
4756 4756
                             } else {
4757 4757
                                 $invalid++;
4758
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4758
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_location);
4759 4759
                             }
4760 4760
                         }
4761 4761
                     }
@@ -4769,24 +4769,24 @@  discard block
 block discarded – undo
4769 4769
                 $json['invalid'] = $invalid;
4770 4770
                 $json['images'] = $images;
4771 4771
                 
4772
-                wp_send_json( $json );
4773
-            } else if ( $task == 'import_hood' ) {               
4772
+                wp_send_json($json);
4773
+            } else if ($task == 'import_hood') {               
4774 4774
                 if (!empty($file)) {
4775 4775
                     $columns = isset($file[0]) ? $file[0] : NULL;
4776 4776
                     
4777 4777
                     if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4778 4778
                         $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4779
-                        wp_send_json( $json );
4779
+                        wp_send_json($json);
4780 4780
                     }
4781 4781
                     
4782 4782
                     $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4783
-                    $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' );
4783
+                    $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');
4784 4784
                     for ($i = 1; $i <= $limit; $i++) {
4785 4785
                         $index = $processed + $i;
4786 4786
                         
4787 4787
                         if (isset($file[$index])) {
4788 4788
                             $row = $file[$index];
4789
-                            $row = array_map( 'trim', $row );
4789
+                            $row = array_map('trim', $row);
4790 4790
                             $data = array();
4791 4791
                             
4792 4792
                             foreach ($columns as $c => $column) {
@@ -4797,20 +4797,20 @@  discard block
 block discarded – undo
4797 4797
 
4798 4798
                             if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4799 4799
                                 $invalid++;
4800
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4800
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4801 4801
                                 continue;
4802 4802
                             }
4803 4803
                             
4804 4804
                             $location_info = array();
4805
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4806
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4805
+                            if (!empty($data['location_id']) && (int) $data['location_id'] > 0) {
4806
+                                $location_info = geodir_get_location_by_id('', (int) $data['location_id']);
4807 4807
                             } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4808 4808
                                 $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4809 4809
                             }
4810 4810
 
4811 4811
                             if (empty($location_info)) {
4812 4812
                                 $invalid++;
4813
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4813
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4814 4814
                                 continue;
4815 4815
                             }
4816 4816
                             
@@ -4825,35 +4825,35 @@  discard block
 block discarded – undo
4825 4825
                             $hood_data['hood_longitude'] = $data['longitude'];
4826 4826
                             $hood_data['hood_location_id'] = $location_id;
4827 4827
                                     
4828
-                            if ( $import_choice == 'update' ) {
4829
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4830
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4828
+                            if ($import_choice == 'update') {
4829
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4830
+                                    $hood_data['hood_id'] = (int) $data['neighbourhood_id'];
4831 4831
                                     
4832 4832
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4833 4833
                                         $updated++;
4834 4834
                                     } else {
4835 4835
                                         $invalid++;
4836
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4836
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4837 4837
                                     }
4838 4838
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4839
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4839
+                                    $hood_data['hood_id'] = (int) $neighbourhood->hood_id;
4840 4840
                                     
4841 4841
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4842 4842
                                         $updated++;
4843 4843
                                     } else {
4844 4844
                                         $invalid++;
4845
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4845
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4846 4846
                                     }
4847 4847
                                 } else {
4848 4848
                                     if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4849 4849
                                         $created++;
4850 4850
                                     } else {
4851 4851
                                         $invalid++;
4852
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4852
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4853 4853
                                     }
4854 4854
                                 }
4855
-                            } elseif ( $import_choice == 'skip' ) {
4856
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4855
+                            } elseif ($import_choice == 'skip') {
4856
+                                if ((int) $data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int) $data['neighbourhood_id']))) {
4857 4857
                                     $skipped++;
4858 4858
                                 } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4859 4859
                                     $skipped++;
@@ -4863,12 +4863,12 @@  discard block
 block discarded – undo
4863 4863
                                         $created++;
4864 4864
                                     } else {
4865 4865
                                         $invalid++;
4866
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4866
+                                        geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4867 4867
                                     }
4868 4868
                                 }
4869 4869
                             } else {
4870 4870
                                 $invalid++;
4871
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4871
+                                geodir_error_log(wp_sprintf($gd_error_log, ($index + 1)).' '.$gd_error_hood);
4872 4872
                             }
4873 4873
                         }
4874 4874
                     }
@@ -4882,7 +4882,7 @@  discard block
 block discarded – undo
4882 4882
                 $json['invalid'] = $invalid;
4883 4883
                 $json['images'] = $images;
4884 4884
                 
4885
-                wp_send_json( $json );
4885
+                wp_send_json($json);
4886 4886
             }
4887 4887
         }
4888 4888
         break;
@@ -4926,29 +4926,29 @@  discard block
 block discarded – undo
4926 4926
  * }
4927 4927
  * @return int|bool Term id when success, false when fail.
4928 4928
  */
4929
-function geodir_imex_insert_term( $taxonomy, $term_data ) {
4930
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4929
+function geodir_imex_insert_term($taxonomy, $term_data) {
4930
+	if (empty($taxonomy) || empty($term_data)) {
4931 4931
 		return false;
4932 4932
 	}
4933 4933
 	
4934
-	$term = isset( $term_data['name'] ) && !empty( $term_data['name'] ) ? $term_data['name'] : '';
4934
+	$term = isset($term_data['name']) && !empty($term_data['name']) ? $term_data['name'] : '';
4935 4935
 	$args = array();
4936
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4937
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4938
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4936
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4937
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4938
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4939 4939
 	
4940
-	if ( ( !empty( $args['slug'] ) && term_exists( $args['slug'], $taxonomy ) ) || empty( $args['slug'] ) ) {
4941
-		$term_args = array_merge( $term_data, $args );
4942
-		$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4943
-		$term_args = wp_parse_args( $term_args, $defaults );
4944
-		$term_args = sanitize_term( $term_args, $taxonomy, 'db' );
4945
-		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4940
+	if ((!empty($args['slug']) && term_exists($args['slug'], $taxonomy)) || empty($args['slug'])) {
4941
+		$term_args = array_merge($term_data, $args);
4942
+		$defaults = array('alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
4943
+		$term_args = wp_parse_args($term_args, $defaults);
4944
+		$term_args = sanitize_term($term_args, $taxonomy, 'db');
4945
+		$args['slug'] = wp_unique_term_slug($args['slug'], (object) $term_args);
4946 4946
 	}
4947 4947
 	
4948
-    if( !empty( $term ) ) {
4949
-		$result = wp_insert_term( $term, $taxonomy, $args );
4950
-        if( !is_wp_error( $result ) ) {
4951
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4948
+    if (!empty($term)) {
4949
+		$result = wp_insert_term($term, $taxonomy, $args);
4950
+        if (!is_wp_error($result)) {
4951
+            return isset($result['term_id']) ? $result['term_id'] : 0;
4952 4952
         }
4953 4953
     }
4954 4954
 	
@@ -4978,36 +4978,36 @@  discard block
 block discarded – undo
4978 4978
  * }
4979 4979
  * @return int|bool Term id when success, false when fail.
4980 4980
  */
4981
-function geodir_imex_update_term( $taxonomy, $term_data ) {
4982
-	if ( empty( $taxonomy ) || empty( $term_data ) ) {
4981
+function geodir_imex_update_term($taxonomy, $term_data) {
4982
+	if (empty($taxonomy) || empty($term_data)) {
4983 4983
 		return false;
4984 4984
 	}
4985 4985
 	
4986
-	$term_id = isset( $term_data['term_id'] ) && !empty( $term_data['term_id'] ) ? $term_data['term_id'] : 0;
4986
+	$term_id = isset($term_data['term_id']) && !empty($term_data['term_id']) ? $term_data['term_id'] : 0;
4987 4987
 	
4988 4988
 	$args = array();
4989
-	$args['description'] = isset( $term_data['description'] ) ? $term_data['description'] : '';
4990
-	$args['slug'] = isset( $term_data['slug'] ) ? $term_data['slug'] : '';
4991
-	$args['parent'] = isset( $term_data['parent'] ) ? (int)$term_data['parent'] : '';
4989
+	$args['description'] = isset($term_data['description']) ? $term_data['description'] : '';
4990
+	$args['slug'] = isset($term_data['slug']) ? $term_data['slug'] : '';
4991
+	$args['parent'] = isset($term_data['parent']) ? (int) $term_data['parent'] : '';
4992 4992
 	
4993
-	if ( $term_id > 0 && $term_info = (array)get_term( $term_id, $taxonomy ) ) {
4993
+	if ($term_id > 0 && $term_info = (array) get_term($term_id, $taxonomy)) {
4994 4994
 		$term_data['term_id'] = $term_info['term_id'];
4995 4995
 		
4996
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4996
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
4997 4997
 		
4998
-		if( !is_wp_error( $result ) ) {
4999
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4998
+		if (!is_wp_error($result)) {
4999
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5000 5000
         }
5001
-	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5001
+	} else if ($term_data['slug'] != '' && $term_info = (array) term_exists($term_data['slug'], $taxonomy)) {
5002 5002
 		$term_data['term_id'] = $term_info['term_id'];
5003 5003
 		
5004
-		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5004
+		$result = wp_update_term($term_data['term_id'], $taxonomy, $term_data);
5005 5005
 		
5006
-		if( !is_wp_error( $result ) ) {
5007
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5006
+		if (!is_wp_error($result)) {
5007
+            return isset($result['term_id']) ? $result['term_id'] : 0;
5008 5008
         }
5009 5009
 	} else {
5010
-		return geodir_imex_insert_term( $taxonomy, $term_data );
5010
+		return geodir_imex_insert_term($taxonomy, $term_data);
5011 5011
 	}
5012 5012
 	
5013 5013
 	return false;
@@ -5026,20 +5026,20 @@  discard block
 block discarded – undo
5026 5026
  * @param string $post_type Post type.
5027 5027
  * @return int Posts count.
5028 5028
  */
5029
-function geodir_get_posts_count( $post_type ) {
5029
+function geodir_get_posts_count($post_type) {
5030 5030
     global $wpdb, $plugin_prefix;
5031 5031
 
5032
-    if ( !post_type_exists( $post_type ) ) {
5032
+    if (!post_type_exists($post_type)) {
5033 5033
         return 0;
5034 5034
     }
5035 5035
         
5036
-    $table = $plugin_prefix . $post_type . '_detail';
5036
+    $table = $plugin_prefix.$post_type.'_detail';
5037 5037
 
5038 5038
     // Skip listing with statuses trash, auto-draft etc...
5039 5039
     $skip_statuses = geodir_imex_export_skip_statuses();
5040 5040
     $where_statuses = '';
5041
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5042
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5041
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5042
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5043 5043
     }
5044 5044
     
5045 5045
     /**
@@ -5050,11 +5050,11 @@  discard block
 block discarded – undo
5050 5050
      *
5051 5051
      * @param string $where SQL where clause part.
5052 5052
      */
5053
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5053
+    $where_statuses = apply_filters('geodir_get_posts_count', $where_statuses, $post_type);
5054 5054
 
5055
-    $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 );
5055
+    $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);
5056 5056
 
5057
-    $posts_count = (int)$wpdb->get_var( $query );
5057
+    $posts_count = (int) $wpdb->get_var($query);
5058 5058
     
5059 5059
     /**
5060 5060
      * Modify returned post counts for the current post type.
@@ -5065,7 +5065,7 @@  discard block
 block discarded – undo
5065 5065
      * @param int $posts_count Post counts.
5066 5066
      * @param string $post_type Post type.
5067 5067
      */
5068
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5068
+    $posts_count = apply_filters('geodir_imex_count_posts', $posts_count, $post_type);
5069 5069
 
5070 5070
     return $posts_count;
5071 5071
 }
@@ -5087,19 +5087,19 @@  discard block
 block discarded – undo
5087 5087
  * @param int $page_no Page number. Default 0.
5088 5088
  * @return array Array of posts data.
5089 5089
  */
5090
-function geodir_imex_get_posts( $post_type, $per_page = 0, $page_no = 0 ) {	
5090
+function geodir_imex_get_posts($post_type, $per_page = 0, $page_no = 0) {	
5091 5091
 	global $wp_filesystem;
5092 5092
 
5093
-	$posts = geodir_get_export_posts( $post_type, $per_page, $page_no );
5093
+	$posts = geodir_get_export_posts($post_type, $per_page, $page_no);
5094 5094
 
5095 5095
 	$csv_rows = array();
5096 5096
 	
5097
-	if ( !empty( $posts ) ) {
5098
-		$is_payment_plugin = is_plugin_active( 'geodir_payment_manager/geodir_payment_manager.php' );
5097
+	if (!empty($posts)) {
5098
+		$is_payment_plugin = is_plugin_active('geodir_payment_manager/geodir_payment_manager.php');
5099 5099
 		$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
5100
-		$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
5100
+		$location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true;
5101 5101
 		$neighbourhood_active = $location_manager && $location_allowed && get_option('location_neighbourhoods') ? true : false;
5102
-		$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
5102
+		$is_claim_active = is_plugin_active('geodir_claim_listing/geodir_claim_listing.php') && get_option('geodir_claim_enable') === 'yes' ? true : false;
5103 5103
 		$is_events_active = function_exists('geodir_event_plugin_activated') ? true : false;
5104 5104
 		$is_custom_posts_active = function_exists('geodir_custom_post_type_plugin_activated') ? true : false;
5105 5105
 		
@@ -5114,7 +5114,7 @@  discard block
 block discarded – undo
5114 5114
 		$csv_row[] = 'default_category';
5115 5115
 		$csv_row[] = 'post_tags';
5116 5116
 		$csv_row[] = 'post_type';
5117
-		if ( $post_type == 'gd_event' ) {
5117
+		if ($post_type == 'gd_event') {
5118 5118
 			$csv_row[] = 'event_date';
5119 5119
 			$csv_row[] = 'event_enddate';
5120 5120
 			$csv_row[] = 'starttime';
@@ -5166,25 +5166,25 @@  discard block
 block discarded – undo
5166 5166
 		$csv_row[] = 'geodir_video';
5167 5167
 		$csv_row[] = 'geodir_special_offers';
5168 5168
 		if ($is_events_active || $is_custom_posts_active) {
5169
-			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_' . $post_ypes[$post_type]['linkable_to'] . '_ID' : 'linked_cpt_ID';
5169
+			$csv_row[] = !empty($post_ypes[$post_type]['linkable_to']) ? 'linked_'.$post_ypes[$post_type]['linkable_to'].'_ID' : 'linked_cpt_ID';
5170 5170
 		}
5171 5171
 		// WPML
5172
-		$is_wpml = geodir_wpml_is_post_type_translated( $post_type );
5172
+		$is_wpml = geodir_wpml_is_post_type_translated($post_type);
5173 5173
 		if ($is_wpml) {
5174 5174
 			$csv_row[] = 'language';
5175 5175
 			$csv_row[] = 'original_post_id';
5176 5176
 		}
5177 5177
 		// WPML
5178 5178
 
5179
-		$custom_fields = geodir_imex_get_custom_fields( $post_type );
5180
-		if ( !empty( $custom_fields ) ) {
5181
-			foreach ( $custom_fields as $custom_field ) {
5179
+		$custom_fields = geodir_imex_get_custom_fields($post_type);
5180
+		if (!empty($custom_fields)) {
5181
+			foreach ($custom_fields as $custom_field) {
5182 5182
 				$csv_row[] = $custom_field->htmlvar_name;
5183 5183
 			}
5184 5184
 		}
5185 5185
 
5186 5186
 		// Export franchise fields
5187
-		$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
5187
+		$is_franchise_active = is_plugin_active('geodir_franchise/geodir_franchise.php') && geodir_franchise_enabled($post_type) ? true : false;
5188 5188
 		if ($is_franchise_active) {
5189 5189
 			$csv_row[] = 'gd_is_franchise';
5190 5190
 			$csv_row[] = 'gd_franchise_lock';
@@ -5205,28 +5205,28 @@  discard block
 block discarded – undo
5205 5205
 		$csv_rows[] = $csv_row;
5206 5206
 
5207 5207
 		$images_count = 5;
5208
-        $xx=0;
5209
-		foreach ( $posts as $post ) {$xx++;
5208
+        $xx = 0;
5209
+		foreach ($posts as $post) {$xx++;
5210 5210
 			$post_id = $post['ID'];
5211 5211
 			
5212
-			$gd_post_info = geodir_get_post_info( $post_id );
5213
-			$post_info = (array)$gd_post_info;
5212
+			$gd_post_info = geodir_get_post_info($post_id);
5213
+			$post_info = (array) $gd_post_info;
5214 5214
 			
5215
-			$taxonomy_category = $post_type . 'category';
5216
-			$taxonomy_tags = $post_type . '_tags';
5215
+			$taxonomy_category = $post_type.'category';
5216
+			$taxonomy_tags = $post_type.'_tags';
5217 5217
 			
5218 5218
 			$post_category = '';
5219 5219
 			$default_category_id = $gd_post_info->default_category;
5220 5220
 			$default_category = '';
5221 5221
 			$post_tags = '';
5222
-			$terms = wp_get_post_terms( $post_id, array( $taxonomy_category, $taxonomy_tags ) );
5222
+			$terms = wp_get_post_terms($post_id, array($taxonomy_category, $taxonomy_tags));
5223 5223
 			
5224
-			if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
5224
+			if (!empty($terms) && !is_wp_error($terms)) {
5225 5225
 				$post_category = array();
5226 5226
 				$post_tags = array();
5227 5227
 			
5228
-				foreach ( $terms as $term ) {
5229
-					if ( $term->taxonomy == $taxonomy_category ) {
5228
+				foreach ($terms as $term) {
5229
+					if ($term->taxonomy == $taxonomy_category) {
5230 5230
 						$post_category[] = $term->name;
5231 5231
 						
5232 5232
 						if ($default_category_id == $term->term_id) {
@@ -5234,7 +5234,7 @@  discard block
 block discarded – undo
5234 5234
 						}
5235 5235
 					}
5236 5236
 					
5237
-					if ( $term->taxonomy == $taxonomy_tags ) {
5237
+					if ($term->taxonomy == $taxonomy_tags) {
5238 5238
 						$post_tags[] = $term->name;
5239 5239
 					}
5240 5240
 				}
@@ -5242,47 +5242,47 @@  discard block
 block discarded – undo
5242 5242
 				if (empty($default_category) && !empty($post_category)) {
5243 5243
 					$default_category = $post_category[0]; // Set first one as default category.
5244 5244
 				}
5245
-				$post_category = !empty( $post_category ) ? implode( ',', $post_category ) : '';
5246
-				$post_tags = !empty( $post_tags ) ? implode( ',', $post_tags ) : '';
5245
+				$post_category = !empty($post_category) ? implode(',', $post_category) : '';
5246
+				$post_tags = !empty($post_tags) ? implode(',', $post_tags) : '';
5247 5247
 			}
5248 5248
 
5249 5249
 			// Franchise data
5250
-			if ($is_franchise_active && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 && geodir_franchise_check((int)$post_info['franchise'])) {
5250
+			if ($is_franchise_active && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 && geodir_franchise_check((int) $post_info['franchise'])) {
5251 5251
 				$franchise_id = $post_info['franchise'];
5252 5252
 				$gd_franchise_info = geodir_get_post_info($franchise_id);
5253 5253
 
5254 5254
 				if (geodir_franchise_pkg_is_active($gd_franchise_info)) {
5255
-					$franchise_info = (array)$gd_franchise_info;
5255
+					$franchise_info = (array) $gd_franchise_info;
5256 5256
 					$locked_fields = geodir_franchise_get_locked_fields($franchise_id, true);
5257 5257
 					
5258 5258
 					if (!empty($locked_fields)) {
5259
-						foreach( $locked_fields as $locked_field) {
5259
+						foreach ($locked_fields as $locked_field) {
5260 5260
 							if (isset($post_info[$locked_field]) && isset($franchise_info[$locked_field])) {
5261 5261
 								$post_info[$locked_field] = $franchise_info[$locked_field];
5262 5262
 							}
5263 5263
 							
5264 5264
 							if (in_array($taxonomy_category, $locked_fields) || in_array('post_tags', $locked_fields)) {
5265
-								$franchise_terms = wp_get_post_terms( $franchise_id, array( $taxonomy_category, $taxonomy_tags ) );
5265
+								$franchise_terms = wp_get_post_terms($franchise_id, array($taxonomy_category, $taxonomy_tags));
5266 5266
 			
5267
-								if ( !empty( $franchise_terms ) && !is_wp_error( $franchise_terms ) ) {
5267
+								if (!empty($franchise_terms) && !is_wp_error($franchise_terms)) {
5268 5268
 									$franchise_post_category = array();
5269 5269
 									$franchise_post_tags = array();
5270 5270
 								
5271
-									foreach ( $franchise_terms as $franchise_term ) {
5272
-										if ( $franchise_term->taxonomy == $taxonomy_category ) {
5271
+									foreach ($franchise_terms as $franchise_term) {
5272
+										if ($franchise_term->taxonomy == $taxonomy_category) {
5273 5273
 											$franchise_post_category[] = $franchise_term->name;
5274 5274
 										}
5275 5275
 										
5276
-										if ( $franchise_term->taxonomy == $taxonomy_tags ) {
5276
+										if ($franchise_term->taxonomy == $taxonomy_tags) {
5277 5277
 											$franchise_post_tags[] = $franchise_term->name;
5278 5278
 										}
5279 5279
 									}
5280 5280
 									
5281 5281
 									if (in_array($taxonomy_category, $locked_fields)) {
5282
-										$post_category = !empty( $franchise_post_category ) ? implode( ',', $franchise_post_category ) : '';
5282
+										$post_category = !empty($franchise_post_category) ? implode(',', $franchise_post_category) : '';
5283 5283
 									}
5284 5284
 									if (in_array('post_tags', $locked_fields)) {
5285
-										$post_tags = !empty( $franchise_post_tags ) ? implode( ',', $franchise_post_tags ) : '';
5285
+										$post_tags = !empty($franchise_post_tags) ? implode(',', $franchise_post_tags) : '';
5286 5286
 									}
5287 5287
 								}
5288 5288
 							}
@@ -5291,18 +5291,18 @@  discard block
 block discarded – undo
5291 5291
 				}
5292 5292
 			}
5293 5293
 						
5294
-			$post_images = geodir_get_images( $post_id );
5294
+			$post_images = geodir_get_images($post_id);
5295 5295
 			$current_images = array();
5296
-			if ( !empty( $post_images ) ) {
5297
-				foreach ( $post_images as $post_image ) {
5298
-					$post_image = (array)$post_image;
5299
-					$image = !empty( $post_image ) && isset( $post_image['path'] ) && $wp_filesystem->is_file( $post_image['path'] ) && $wp_filesystem->exists( $post_image['path'] ) ? $post_image['src'] : '';
5300
-					if ( $image ) {
5296
+			if (!empty($post_images)) {
5297
+				foreach ($post_images as $post_image) {
5298
+					$post_image = (array) $post_image;
5299
+					$image = !empty($post_image) && isset($post_image['path']) && $wp_filesystem->is_file($post_image['path']) && $wp_filesystem->exists($post_image['path']) ? $post_image['src'] : '';
5300
+					if ($image) {
5301 5301
 						$current_images[] = $image;
5302 5302
 					}
5303 5303
 				}
5304 5304
 				
5305
-				$images_count = max( $images_count, count( $current_images ) );
5305
+				$images_count = max($images_count, count($current_images));
5306 5306
 			}
5307 5307
 
5308 5308
 			$csv_row = array();
@@ -5314,7 +5314,7 @@  discard block
 block discarded – undo
5314 5314
 			$csv_row[] = $default_category; // default_category
5315 5315
 			$csv_row[] = $post_tags; // post_tags
5316 5316
 			$csv_row[] = $post_type; // post_type
5317
-			if ( $post_type == 'gd_event' ) {
5317
+			if ($post_type == 'gd_event') {
5318 5318
 				$event_data = geodir_imex_get_event_data($post, $gd_post_info);
5319 5319
 				$csv_row[] = $event_data['event_date']; // event_date
5320 5320
 				$csv_row[] = $event_data['event_enddate']; // enddate
@@ -5335,12 +5335,12 @@  discard block
 block discarded – undo
5335 5335
 				$csv_row[] = $event_data['recurring_end_date']; // repeat_end
5336 5336
 			}
5337 5337
 			$csv_row[] = $post_info['post_status']; // post_status
5338
-			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5338
+			$csv_row[] = (int) $post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5339 5339
             if ($is_claim_active) {
5340
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5340
+                $csv_row[] = !empty($post_info['claimed']) && (int) $post_info['claimed'] == 1 ? 1 : ''; // claimed
5341 5341
             }
5342 5342
 			if ($is_payment_plugin) {
5343
-				$csv_row[] = (int)$post_info['package_id']; // package_id
5343
+				$csv_row[] = (int) $post_info['package_id']; // package_id
5344 5344
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5345 5345
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5346 5346
 			}
@@ -5376,18 +5376,18 @@  discard block
 block discarded – undo
5376 5376
 			$csv_row[] = stripslashes($post_info['geodir_video']); // geodir_video
5377 5377
 			$csv_row[] = stripslashes($post_info['geodir_special_offers']); // geodir_special_offers
5378 5378
 			if ($is_events_active || $is_custom_posts_active) {
5379
-				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int)$post_info['geodir_link_business'] : ''; // linked business
5379
+				$csv_row[] = !empty($post_info['geodir_link_business']) ? (int) $post_info['geodir_link_business'] : ''; // linked business
5380 5380
 			}
5381 5381
 			// WPML
5382 5382
 			if ($is_wpml) {
5383
-				$csv_row[] = geodir_get_language_for_element( $post_id, 'post_' . $post_type );
5384
-				$csv_row[] = geodir_imex_original_post_id( $post_id, 'post_' . $post_type );
5383
+				$csv_row[] = geodir_get_language_for_element($post_id, 'post_'.$post_type);
5384
+				$csv_row[] = geodir_imex_original_post_id($post_id, 'post_'.$post_type);
5385 5385
 			}
5386 5386
 			// WPML
5387 5387
 			
5388
-			if ( !empty( $custom_fields ) ) {
5389
-				foreach ( $custom_fields as $custom_field ) {
5390
-					$csv_row[] = isset( $post_info[$custom_field->htmlvar_name] ) ? $post_info[$custom_field->htmlvar_name] : '';
5388
+			if (!empty($custom_fields)) {
5389
+				foreach ($custom_fields as $custom_field) {
5390
+					$csv_row[] = isset($post_info[$custom_field->htmlvar_name]) ? $post_info[$custom_field->htmlvar_name] : '';
5391 5391
 				}
5392 5392
 			}
5393 5393
 			
@@ -5398,15 +5398,15 @@  discard block
 block discarded – undo
5398 5398
 				$franchise = '';
5399 5399
 					
5400 5400
 				if (geodir_franchise_pkg_is_active($gd_post_info)) {
5401
-					$gd_is_franchise = (int)get_post_meta( $post_id, 'gd_is_franchise', true );
5402
-					$locaked_fields = $gd_is_franchise ? get_post_meta( $post_id, 'gd_franchise_lock', true ) : '';
5401
+					$gd_is_franchise = (int) get_post_meta($post_id, 'gd_is_franchise', true);
5402
+					$locaked_fields = $gd_is_franchise ? get_post_meta($post_id, 'gd_franchise_lock', true) : '';
5403 5403
 					$locaked_fields = (is_array($locaked_fields) && !empty($locaked_fields) ? implode(",", $locaked_fields) : '');
5404
-					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int)$post_info['franchise'] > 0 ? (int)$post_info['franchise'] : 0; // franchise id
5404
+					$franchise = !$gd_is_franchise && isset($post_info['franchise']) && (int) $post_info['franchise'] > 0 ? (int) $post_info['franchise'] : 0; // franchise id
5405 5405
 				}
5406 5406
 				
5407
-				$csv_row[] = (int)$gd_is_franchise; // gd_is_franchise
5407
+				$csv_row[] = (int) $gd_is_franchise; // gd_is_franchise
5408 5408
 				$csv_row[] = $locaked_fields; // gd_franchise_lock fields
5409
-				$csv_row[] = (int)$franchise; // franchise id
5409
+				$csv_row[] = (int) $franchise; // franchise id
5410 5410
 			}
5411 5411
             
5412 5412
             /**
@@ -5420,15 +5420,15 @@  discard block
 block discarded – undo
5420 5420
              */
5421 5421
             $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5422 5422
 			
5423
-			for ( $c = 0; $c < $images_count; $c++ ) {
5424
-				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
5423
+			for ($c = 0; $c < $images_count; $c++) {
5424
+				$csv_row[] = isset($current_images[$c]) ? $current_images[$c] : ''; // IMAGE
5425 5425
 			}
5426 5426
 			
5427 5427
 			$csv_rows[] = $csv_row;
5428 5428
 
5429 5429
 		}
5430 5430
 
5431
-		for ( $c = 0; $c < $images_count; $c++ ) {
5431
+		for ($c = 0; $c < $images_count; $c++) {
5432 5432
 			$csv_rows[0][] = 'IMAGE';
5433 5433
 		}
5434 5434
 	}
@@ -5450,30 +5450,30 @@  discard block
 block discarded – undo
5450 5450
  * @param int $page_no Page number. Default 0.
5451 5451
  * @return array Array of posts data.
5452 5452
  */
5453
-function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5453
+function geodir_get_export_posts($post_type, $per_page = 0, $page_no = 0) {
5454 5454
     global $wpdb, $plugin_prefix;
5455 5455
 
5456
-    if ( ! post_type_exists( $post_type ) )
5456
+    if (!post_type_exists($post_type))
5457 5457
         return new stdClass;
5458 5458
         
5459
-    $table = $plugin_prefix . $post_type . '_detail';
5459
+    $table = $plugin_prefix.$post_type.'_detail';
5460 5460
 
5461 5461
     $limit = '';
5462
-    if ( $per_page > 0 && $page_no > 0 ) {
5463
-        $offset = ( $page_no - 1 ) * $per_page;
5462
+    if ($per_page > 0 && $page_no > 0) {
5463
+        $offset = ($page_no - 1) * $per_page;
5464 5464
         
5465
-        if ( $offset > 0 ) {
5466
-            $limit = " LIMIT " . $offset . "," . $per_page;
5465
+        if ($offset > 0) {
5466
+            $limit = " LIMIT ".$offset.",".$per_page;
5467 5467
         } else {
5468
-            $limit = " LIMIT " . $per_page;
5468
+            $limit = " LIMIT ".$per_page;
5469 5469
         }
5470 5470
     }
5471 5471
 
5472 5472
     // Skip listing with statuses trash, auto-draft etc...
5473 5473
     $skip_statuses = geodir_imex_export_skip_statuses();
5474 5474
     $where_statuses = '';
5475
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5476
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5475
+    if (!empty($skip_statuses) && is_array($skip_statuses)) {
5476
+        $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5477 5477
     }
5478 5478
     
5479 5479
     /**
@@ -5484,9 +5484,9 @@  discard block
 block discarded – undo
5484 5484
      *
5485 5485
      * @param string $where SQL where clause part.
5486 5486
      */
5487
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5487
+    $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5488 5488
 
5489
-    $query = $wpdb->prepare( "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, $post_type );
5489
+    $query = $wpdb->prepare("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, $post_type);
5490 5490
     /**
5491 5491
      * Modify returned posts SQL query for the current post type.
5492 5492
      *
@@ -5496,8 +5496,8 @@  discard block
 block discarded – undo
5496 5496
      * @param int $query The SQL query.
5497 5497
      * @param string $post_type Post type.
5498 5498
      */
5499
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5500
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5499
+    $query = apply_filters('geodir_imex_export_posts_query', $query, $post_type);
5500
+    $results = (array) $wpdb->get_results($query, ARRAY_A);
5501 5501
 
5502 5502
     /**
5503 5503
      * Modify returned post results for the current post type.
@@ -5508,7 +5508,7 @@  discard block
 block discarded – undo
5508 5508
      * @param object $results An object containing all post ids.
5509 5509
      * @param string $post_type Post type.
5510 5510
      */
5511
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5511
+    return apply_filters('geodir_export_posts', $results, $post_type);
5512 5512
 }
5513 5513
 
5514 5514
 /**
@@ -5526,24 +5526,24 @@  discard block
 block discarded – undo
5526 5526
  * @param string $post_type Post type.
5527 5527
  * @return string The SQL query.
5528 5528
  */
5529
-function geodir_imex_get_events_query( $query, $post_type ) {
5530
-    if ( $post_type == 'gd_event' ) {
5529
+function geodir_imex_get_events_query($query, $post_type) {
5530
+    if ($post_type == 'gd_event') {
5531 5531
         global $wpdb, $plugin_prefix;
5532 5532
         
5533
-        $table = $plugin_prefix . $post_type . '_detail';
5533
+        $table = $plugin_prefix.$post_type.'_detail';
5534 5534
         $schedule_table = EVENT_SCHEDULE;
5535 5535
         
5536 5536
         // Skip listing with statuses trash, auto-draft etc...
5537 5537
         $skip_statuses = geodir_imex_export_skip_statuses();
5538 5538
         $where_statuses = '';
5539
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5540
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5539
+        if (!empty($skip_statuses) && is_array($skip_statuses)) {
5540
+            $where_statuses = "AND `".$wpdb->posts."`.`post_status` NOT IN('".implode("','", $skip_statuses)."')";
5541 5541
         }
5542 5542
         
5543 5543
         /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5544
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5544
+        $where_statuses = apply_filters('geodir_get_export_posts', $where_statuses, $post_type);
5545 5545
 
5546
-        $query = $wpdb->prepare( "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", $post_type );
5546
+        $query = $wpdb->prepare("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", $post_type);
5547 5547
     }
5548 5548
 
5549 5549
     return $query;
@@ -5567,35 +5567,35 @@  discard block
 block discarded – undo
5567 5567
  * @param  string $post_type Post type.
5568 5568
  * @return int Total terms count.
5569 5569
  */
5570
-function geodir_get_terms_count( $post_type ) {
5571
-    $args = array( 'hide_empty' => 0 );
5570
+function geodir_get_terms_count($post_type) {
5571
+    $args = array('hide_empty' => 0);
5572 5572
 
5573
-    remove_all_filters( 'get_terms' );
5573
+    remove_all_filters('get_terms');
5574 5574
 
5575
-    $taxonomy = $post_type . 'category';
5575
+    $taxonomy = $post_type.'category';
5576 5576
 
5577 5577
     // WPML
5578 5578
     $is_wpml = geodir_is_wpml();
5579 5579
     $active_lang = 'all';
5580
-    if ( $is_wpml ) {
5580
+    if ($is_wpml) {
5581 5581
         global $sitepress;
5582 5582
         $active_lang = $sitepress->get_current_language();
5583 5583
         
5584
-        if ( $active_lang != 'all' ) {
5585
-            $sitepress->switch_lang( 'all', true );
5584
+        if ($active_lang != 'all') {
5585
+            $sitepress->switch_lang('all', true);
5586 5586
         }
5587 5587
     }
5588 5588
     // WPML
5589 5589
             
5590
-    $count_terms = wp_count_terms( $taxonomy, $args );
5590
+    $count_terms = wp_count_terms($taxonomy, $args);
5591 5591
 
5592 5592
     // WPML
5593
-    if ( $is_wpml && $active_lang !== 'all' ) {
5593
+    if ($is_wpml && $active_lang !== 'all') {
5594 5594
         global $sitepress;
5595
-        $sitepress->switch_lang( $active_lang, true );
5595
+        $sitepress->switch_lang($active_lang, true);
5596 5596
     }
5597 5597
     // WPML
5598
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5598
+    $count_terms = !is_wp_error($count_terms) ? $count_terms : 0;
5599 5599
      
5600 5600
     return $count_terms;
5601 5601
 }
@@ -5612,23 +5612,23 @@  discard block
 block discarded – undo
5612 5612
  * @param int $page_no Page number. Default 0.
5613 5613
  * @return array Array of terms data.
5614 5614
  */
5615
-function geodir_imex_get_terms( $post_type, $per_page = 0, $page_no = 0 ) {
5616
-	$args = array( 'hide_empty' => 0, 'orderby' => 'id' );
5615
+function geodir_imex_get_terms($post_type, $per_page = 0, $page_no = 0) {
5616
+	$args = array('hide_empty' => 0, 'orderby' => 'id');
5617 5617
 	
5618
-	remove_all_filters( 'get_terms' );
5618
+	remove_all_filters('get_terms');
5619 5619
 	
5620
-	$taxonomy = $post_type . 'category';
5620
+	$taxonomy = $post_type.'category';
5621 5621
 	
5622
-	if ( $per_page > 0 && $page_no > 0 ) {
5623
-		$args['offset'] = ( $page_no - 1 ) * $per_page;
5622
+	if ($per_page > 0 && $page_no > 0) {
5623
+		$args['offset'] = ($page_no - 1) * $per_page;
5624 5624
 		$args['number'] = $per_page;
5625 5625
 	}
5626 5626
 	
5627
-	$terms = get_terms( $taxonomy, $args );
5627
+	$terms = get_terms($taxonomy, $args);
5628 5628
 
5629 5629
 	$csv_rows = array();
5630 5630
 	
5631
-	if ( !empty( $terms ) ) {
5631
+	if (!empty($terms)) {
5632 5632
 		$csv_row = array();
5633 5633
 		$csv_row[] = 'cat_id';
5634 5634
 		$csv_row[] = 'cat_name';
@@ -5637,7 +5637,7 @@  discard block
 block discarded – undo
5637 5637
 		$csv_row[] = 'cat_parent';
5638 5638
 		$csv_row[] = 'cat_schema';
5639 5639
         // WPML
5640
-		$is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy );
5640
+		$is_wpml = geodir_wpml_is_taxonomy_translated($taxonomy);
5641 5641
 		if ($is_wpml) {
5642 5642
 			$csv_row[] = 'cat_language';
5643 5643
             $csv_row[] = 'cat_id_original';
@@ -5650,16 +5650,16 @@  discard block
 block discarded – undo
5650 5650
 		
5651 5651
 		$csv_rows[] = $csv_row;
5652 5652
 		
5653
-		foreach ( $terms as $term ) {
5654
-			$cat_icon = geodir_get_tax_meta( $term->term_id, 'ct_cat_icon', false, $post_type );
5655
-			$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
5653
+		foreach ($terms as $term) {
5654
+			$cat_icon = geodir_get_tax_meta($term->term_id, 'ct_cat_icon', false, $post_type);
5655
+			$cat_icon = !empty($cat_icon) && isset($cat_icon['src']) ? $cat_icon['src'] : '';
5656 5656
 			
5657
-			$cat_image = geodir_get_default_catimage( $term->term_id, $post_type );
5658
-			$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : ''; 
5657
+			$cat_image = geodir_get_default_catimage($term->term_id, $post_type);
5658
+			$cat_image = !empty($cat_image) && isset($cat_image['src']) ? $cat_image['src'] : ''; 
5659 5659
 			
5660 5660
 			$cat_parent = '';
5661
-			if (isset($term->parent) && (int)$term->parent > 0 && term_exists((int)$term->parent, $taxonomy)) {
5662
-				$parent_term = (array)get_term_by( 'id', (int)$term->parent, $taxonomy );
5661
+			if (isset($term->parent) && (int) $term->parent > 0 && term_exists((int) $term->parent, $taxonomy)) {
5662
+				$parent_term = (array) get_term_by('id', (int) $term->parent, $taxonomy);
5663 5663
 				$cat_parent = !empty($parent_term) && isset($parent_term['name']) ? $parent_term['name'] : '';
5664 5664
 			}
5665 5665
 			
@@ -5669,15 +5669,15 @@  discard block
 block discarded – undo
5669 5669
 			$csv_row[] = $term->slug;
5670 5670
 			$csv_row[] = $post_type;
5671 5671
 			$csv_row[] = $cat_parent;
5672
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5672
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_schema', false, $post_type);
5673 5673
             // WPML
5674 5674
 			if ($is_wpml) {
5675
-				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5676
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5675
+				$csv_row[] = geodir_get_language_for_element($term->term_id, 'tax_'.$taxonomy);
5676
+                $csv_row[] = geodir_imex_original_post_id($term->term_id, 'tax_'.$taxonomy);
5677 5677
 			}
5678 5678
 			// WPML
5679 5679
 			$csv_row[] = $term->description;
5680
-			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_top_desc', false, $post_type );
5680
+			$csv_row[] = geodir_get_tax_meta($term->term_id, 'ct_cat_top_desc', false, $post_type);
5681 5681
 			$csv_row[] = $cat_image;
5682 5682
 			$csv_row[] = $cat_icon;
5683 5683
 			
@@ -5696,10 +5696,10 @@  discard block
 block discarded – undo
5696 5696
  * @param  bool $relative True for relative path & False for absolute path.
5697 5697
  * @return string Path to the cache directory.
5698 5698
  */
5699
-function geodir_path_import_export( $relative = true ) {
5699
+function geodir_path_import_export($relative = true) {
5700 5700
 	$upload_dir = wp_upload_dir();
5701 5701
 	
5702
-	return $relative ? $upload_dir['baseurl'] . '/cache' : $upload_dir['basedir'] . '/cache';
5702
+	return $relative ? $upload_dir['baseurl'].'/cache' : $upload_dir['basedir'].'/cache';
5703 5703
 }
5704 5704
 
5705 5705
 /**
@@ -5715,8 +5715,8 @@  discard block
 block discarded – undo
5715 5715
  * @param  bool $clear If true then it overwrite data otherwise add rows at the end of file.
5716 5716
  * @return bool true if success otherwise false.
5717 5717
  */
5718
-function geodir_save_csv_data( $file_path, $csv_data = array(), $clear = true ) {
5719
-	if ( empty( $csv_data ) ) {
5718
+function geodir_save_csv_data($file_path, $csv_data = array(), $clear = true) {
5719
+	if (empty($csv_data)) {
5720 5720
 		return false;
5721 5721
 	}
5722 5722
 	
@@ -5724,17 +5724,17 @@  discard block
 block discarded – undo
5724 5724
 	
5725 5725
 	$mode = $clear ? 'w+' : 'a+';
5726 5726
 	
5727
-	if ( function_exists( 'fputcsv' ) ) {
5728
-		$file = fopen( $file_path, $mode );
5729
-		foreach( $csv_data as $csv_row ) {
5727
+	if (function_exists('fputcsv')) {
5728
+		$file = fopen($file_path, $mode);
5729
+		foreach ($csv_data as $csv_row) {
5730 5730
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5731
-			$write_successful = fputcsv( $file, $csv_row, ",", $enclosure = '"' );
5731
+			$write_successful = fputcsv($file, $csv_row, ",", $enclosure = '"');
5732 5732
 		}
5733
-		fclose( $file );
5733
+		fclose($file);
5734 5734
 	} else {
5735
-		foreach( $csv_data as $csv_row ) {
5735
+		foreach ($csv_data as $csv_row) {
5736 5736
 			//$csv_row = array_map( 'utf8_decode', $csv_row );
5737
-			$wp_filesystem->put_contents( $file_path, $csv_row );
5737
+			$wp_filesystem->put_contents($file_path, $csv_row);
5738 5738
 		}
5739 5739
 	}
5740 5740
 		
@@ -5752,14 +5752,14 @@  discard block
 block discarded – undo
5752 5752
  * @param  string $file Full path to file.
5753 5753
  * @return int No of file rows.
5754 5754
  */
5755
-function geodir_import_export_line_count( $file ) {
5755
+function geodir_import_export_line_count($file) {
5756 5756
 	global $wp_filesystem;
5757 5757
 	
5758
-	if ( $wp_filesystem->is_file( $file ) && $wp_filesystem->exists( $file ) ) {
5759
-		$contents = $wp_filesystem->get_contents_array( $file );
5758
+	if ($wp_filesystem->is_file($file) && $wp_filesystem->exists($file)) {
5759
+		$contents = $wp_filesystem->get_contents_array($file);
5760 5760
 		
5761
-		if ( !empty( $contents ) && is_array( $contents ) ) {
5762
-			return count( $contents ) - 1;
5761
+		if (!empty($contents) && is_array($contents)) {
5762
+			return count($contents) - 1;
5763 5763
 		}
5764 5764
 	}
5765 5765
 	
@@ -5776,11 +5776,11 @@  discard block
 block discarded – undo
5776 5776
  * @param string $post_type The post type.
5777 5777
  * @return object Queried object.
5778 5778
  */
5779
-function geodir_imex_get_custom_fields( $post_type ) {
5779
+function geodir_imex_get_custom_fields($post_type) {
5780 5780
 	global $wpdb;
5781 5781
 	 
5782
-	$sql = $wpdb->prepare("SELECT htmlvar_name FROM " . GEODIR_CUSTOM_FIELDS_TABLE . " WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array( $post_type ) );
5783
-	$rows = $wpdb->get_results( $sql );
5782
+	$sql = $wpdb->prepare("SELECT htmlvar_name FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE post_type=%s AND is_active='1' AND is_admin!='1' AND field_type != 'fieldset' AND htmlvar_name != '' ORDER BY id ASC", array($post_type));
5783
+	$rows = $wpdb->get_results($sql);
5784 5784
 	 
5785 5785
 	return $rows;
5786 5786
 }
@@ -5796,10 +5796,10 @@  discard block
 block discarded – undo
5796 5796
  * @return array Event data array.
5797 5797
  */
5798 5798
 function geodir_imex_get_event_data($post, $gd_post_info) {
5799
-	$event_date = isset( $post['event_date'] ) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $post['event_date'] ) ) : '';
5799
+	$event_date = isset($post['event_date']) && $post['event_date'] != '' && $post['event_date'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($post['event_date'])) : '';
5800 5800
 	$event_enddate = $event_date;
5801
-	$starttime = isset( $post['starttime'] ) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['starttime'] ) ) : '';
5802
-	$endtime = isset( $post['endtime'] ) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $post['endtime'] ) ) : '';
5801
+	$starttime = isset($post['starttime']) && $post['starttime'] != '' && $post['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['starttime'])) : '';
5802
+	$endtime = isset($post['endtime']) && $post['endtime'] != '' && $post['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($post['endtime'])) : '';
5803 5803
 	
5804 5804
 	$is_recurring_event = '';
5805 5805
 	$event_duration_days = '';
@@ -5816,15 +5816,15 @@  discard block
 block discarded – undo
5816 5816
 		
5817 5817
 	$recurring_data = isset($gd_post_info->recurring_dates) ? maybe_unserialize($gd_post_info->recurring_dates) : array();
5818 5818
 	if (!empty($recurring_data)) {
5819
-		$event_date = isset( $recurring_data['event_start'] ) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_start'] ) ) : $event_date;
5820
-		$event_enddate = isset( $recurring_data['event_end'] ) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['event_end'] ) ) : $event_date;
5821
-		$starttime = isset( $recurring_data['starttime'] ) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['starttime'] ) ) : $starttime;
5822
-		$endtime = isset( $recurring_data['endtime'] ) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n( 'H:i', strtotime( $recurring_data['endtime'] ) ) : $endtime;
5819
+		$event_date = isset($recurring_data['event_start']) && $recurring_data['event_start'] != '' && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_start'])) : $event_date;
5820
+		$event_enddate = isset($recurring_data['event_end']) && $recurring_data['event_end'] != '' && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['event_end'])) : $event_date;
5821
+		$starttime = isset($recurring_data['starttime']) && $recurring_data['starttime'] != '' && $recurring_data['starttime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['starttime'])) : $starttime;
5822
+		$endtime = isset($recurring_data['endtime']) && $recurring_data['endtime'] != '' && $recurring_data['endtime'] != '00:00:00' ? date_i18n('H:i', strtotime($recurring_data['endtime'])) : $endtime;
5823 5823
 		$is_whole_day_event = !empty($recurring_data['all_day']) ? 1 : '';
5824 5824
 		$different_times = !empty($recurring_data['different_times']) ? true : false;
5825 5825
 	
5826
-		$recurring_pkg = geodir_event_recurring_pkg( $gd_post_info );
5827
-		$is_recurring = isset( $gd_post_info->is_recurring ) && (int)$gd_post_info->is_recurring == 0 ? false : true;
5826
+		$recurring_pkg = geodir_event_recurring_pkg($gd_post_info);
5827
+		$is_recurring = isset($gd_post_info->is_recurring) && (int) $gd_post_info->is_recurring == 0 ? false : true;
5828 5828
 			
5829 5829
 		if ($recurring_pkg && $is_recurring) {
5830 5830
 			$recurring_dates = $event_date;
@@ -5834,13 +5834,13 @@  discard block
 block discarded – undo
5834 5834
 			$recurring_type = !empty($recurring_data['repeat_type']) && in_array($recurring_data['repeat_type'], array('day', 'week', 'month', 'year', 'custom')) ? $recurring_data['repeat_type'] : 'custom';
5835 5835
 			
5836 5836
 			if (!empty($recurring_data['event_recurring_dates'])) {
5837
-				$event_recurring_dates = explode( ',', $recurring_data['event_recurring_dates'] );
5837
+				$event_recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
5838 5838
 				
5839 5839
 				if (!empty($event_recurring_dates)) {
5840 5840
 					$recurring_dates = array();
5841 5841
 					
5842 5842
 					foreach ($event_recurring_dates as $date) {
5843
-						$recurring_dates[] = date_i18n( 'd/m/Y', strtotime( $date ) );
5843
+						$recurring_dates[] = date_i18n('d/m/Y', strtotime($date));
5844 5844
 					}
5845 5845
 					
5846 5846
 					$recurring_dates = implode(",", $recurring_dates);
@@ -5856,7 +5856,7 @@  discard block
 block discarded – undo
5856 5856
 						$times = array();
5857 5857
 						
5858 5858
 						foreach ($recurring_data['starttimes'] as $time) {
5859
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5859
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5860 5860
 						}
5861 5861
 						
5862 5862
 						$event_starttimes = implode(",", $times);
@@ -5866,7 +5866,7 @@  discard block
 block discarded – undo
5866 5866
 						$times = array();
5867 5867
 						
5868 5868
 						foreach ($recurring_data['endtimes'] as $time) {
5869
-							$times[] = $time != '00:00:00' ? date_i18n( 'H:i', strtotime( $time ) ) : '00:00';
5869
+							$times[] = $time != '00:00:00' ? date_i18n('H:i', strtotime($time)) : '00:00';
5870 5870
 						}
5871 5871
 						
5872 5872
 						$event_endtimes = implode(",", $times);
@@ -5878,8 +5878,8 @@  discard block
 block discarded – undo
5878 5878
 					}
5879 5879
 				}
5880 5880
 			} else {
5881
-				$event_duration_days = isset($recurring_data['duration_x']) ? (int)$recurring_data['duration_x'] : 1;
5882
-				$recurring_interval = !empty($recurring_data['repeat_x']) && (int)$recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5881
+				$event_duration_days = isset($recurring_data['duration_x']) ? (int) $recurring_data['duration_x'] : 1;
5882
+				$recurring_interval = !empty($recurring_data['repeat_x']) && (int) $recurring_data['repeat_x'] > 0 ? $recurring_data['repeat_x'] : 1;
5883 5883
 				
5884 5884
 				if (($recurring_type == 'week' || $recurring_type == 'month') && !empty($recurring_data['repeat_days'])) {
5885 5885
 					$week_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@@ -5895,11 +5895,11 @@  discard block
 block discarded – undo
5895 5895
 				}
5896 5896
 				
5897 5897
 				$recurring_week_nos = $recurring_type == 'month' && !empty($recurring_data['repeat_weeks']) ? implode(",", $recurring_data['repeat_weeks']) : $recurring_week_nos;
5898
-				if (!empty($recurring_data['repeat_end_type']) && (int)$recurring_data['repeat_end_type'] == 1) {
5899
-					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n( 'd/m/Y', strtotime( $recurring_data['repeat_end'] ) ) : '';
5898
+				if (!empty($recurring_data['repeat_end_type']) && (int) $recurring_data['repeat_end_type'] == 1) {
5899
+					$recurring_end_date = isset($recurring_data['repeat_end']) && $recurring_data['repeat_end'] != '' && $recurring_data['repeat_end'] != '0000-00-00 00:00:00' ? date_i18n('d/m/Y', strtotime($recurring_data['repeat_end'])) : '';
5900 5900
 					$max_recurring_count = empty($recurring_end_date) ? 1 : '';
5901 5901
 				} else {
5902
-					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int)$recurring_data['max_repeat'] > 0 ? (int)$recurring_data['max_repeat'] : 1);
5902
+					$max_recurring_count = (!empty($recurring_data['max_repeat']) && (int) $recurring_data['max_repeat'] > 0 ? (int) $recurring_data['max_repeat'] : 1);
5903 5903
 				}
5904 5904
 			}
5905 5905
 		}
@@ -5963,9 +5963,9 @@  discard block
 block discarded – undo
5963 5963
  * @return array Event data array.
5964 5964
  */
5965 5965
 function geodir_imex_process_event_data($gd_post) {
5966
-	$recurring_pkg = geodir_event_recurring_pkg( (object)$gd_post );
5966
+	$recurring_pkg = geodir_event_recurring_pkg((object) $gd_post);
5967 5967
 
5968
-	$is_recurring = isset( $gd_post['is_recurring_event'] ) && (int)$gd_post['is_recurring_event'] == 0 ? false : true;
5968
+	$is_recurring = isset($gd_post['is_recurring_event']) && (int) $gd_post['is_recurring_event'] == 0 ? false : true;
5969 5969
 	$event_date = isset($gd_post['event_date']) && $gd_post['event_date'] != '' ? geodir_date($gd_post['event_date'], 'Y-m-d') : '';
5970 5970
 	$event_enddate = isset($gd_post['event_enddate']) && $gd_post['event_enddate'] != '' ? geodir_date($gd_post['event_enddate'], 'Y-m-d') : $event_date;
5971 5971
 	$all_day = isset($gd_post['is_whole_day_event']) && !empty($gd_post['is_whole_day_event']) ? true : false;
@@ -6012,17 +6012,17 @@  discard block
 block discarded – undo
6012 6012
 				$event_recurring_dates = implode(",", $event_recurring_dates);
6013 6013
 			}
6014 6014
 		} else {
6015
-			$duration_x = !empty( $gd_post['event_duration_days'] ) ? (int)$gd_post['event_duration_days'] : 1;
6016
-			$repeat_x = !empty( $gd_post['recurring_interval'] ) ? (int)$gd_post['recurring_interval'] : 1;
6017
-			$max_repeat = !empty( $gd_post['max_recurring_count'] ) ? (int)$gd_post['max_recurring_count'] : 1;
6018
-			$repeat_end = !empty( $gd_post['recurring_end_date'] ) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6015
+			$duration_x = !empty($gd_post['event_duration_days']) ? (int) $gd_post['event_duration_days'] : 1;
6016
+			$repeat_x = !empty($gd_post['recurring_interval']) ? (int) $gd_post['recurring_interval'] : 1;
6017
+			$max_repeat = !empty($gd_post['max_recurring_count']) ? (int) $gd_post['max_recurring_count'] : 1;
6018
+			$repeat_end = !empty($gd_post['recurring_end_date']) ? geodir_date($gd_post['recurring_end_date'], 'Y-m-d') : '';
6019 6019
 			
6020 6020
 			$repeat_end_type = $repeat_end != '' ? 1 : 0;
6021 6021
 			$max_repeat = $repeat_end != '' ? '' : $max_repeat;
6022 6022
 			
6023 6023
 			$week_days = array_flip(array('sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'));
6024 6024
 			
6025
-			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days'])!='' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6025
+			$a_repeat_days = isset($gd_post['recurring_week_days']) && trim($gd_post['recurring_week_days']) != '' ? explode(',', trim($gd_post['recurring_week_days'])) : array();
6026 6026
 			$repeat_days = array();
6027 6027
 			if (!empty($a_repeat_days)) {
6028 6028
 				foreach ($a_repeat_days as $repeat_day) {
@@ -6040,7 +6040,7 @@  discard block
 block discarded – undo
6040 6040
 			$repeat_weeks = array();
6041 6041
 			if (!empty($a_repeat_weeks)) {
6042 6042
 				foreach ($a_repeat_weeks as $repeat_week) {
6043
-					$repeat_weeks[] = (int)$repeat_week;
6043
+					$repeat_weeks[] = (int) $repeat_week;
6044 6044
 				}
6045 6045
 				
6046 6046
 				$repeat_weeks = array_unique($repeat_weeks);
@@ -6104,7 +6104,7 @@  discard block
 block discarded – undo
6104 6104
 
6105 6105
     $page_found = $wpdb->get_var(
6106 6106
         $wpdb->prepare(
6107
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6107
+            "SELECT ID FROM ".$wpdb->posts." WHERE post_name = %s LIMIT 1;",
6108 6108
             array($slug)
6109 6109
         )
6110 6110
     );
@@ -6159,7 +6159,7 @@  discard block
 block discarded – undo
6159 6159
  */
6160 6160
 function geodir_admin_upgrade_notice() {
6161 6161
     $class = "error";
6162
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6162
+    $message = __("Please update core GeoDirectory or some addons may not function correctly.", "geodirectory");
6163 6163
     echo"<div class=\"$class\"> <p>$message</p></div>";
6164 6164
 }
6165 6165
 
@@ -6171,7 +6171,7 @@  discard block
 block discarded – undo
6171 6171
  * @param (object) $r
6172 6172
  * @return (string) $output
6173 6173
  */
6174
-function geodire_admin_upgrade_notice( $plugin_data, $r )
6174
+function geodire_admin_upgrade_notice($plugin_data, $r)
6175 6175
 {
6176 6176
     // readme contents
6177 6177
     $args = array(
@@ -6179,7 +6179,7 @@  discard block
 block discarded – undo
6179 6179
         'redirection' => 5
6180 6180
     );
6181 6181
     $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6182
-    $data       = wp_remote_get( $url, $args );
6182
+    $data = wp_remote_get($url, $args);
6183 6183
 
6184 6184
     if (!is_wp_error($data) && $data['response']['code'] == 200) {
6185 6185
 
@@ -6194,20 +6194,20 @@  discard block
 block discarded – undo
6194 6194
 function geodir_in_plugin_update_message($content) {
6195 6195
     // Output Upgrade Notice
6196 6196
     $matches        = null;
6197
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6197
+    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*'.preg_quote(GEODIRECTORY_VERSION).'\s*=|$)~Uis';
6198 6198
     $upgrade_notice = '';
6199
-    if ( preg_match( $regexp, $content, $matches ) ) {
6200
-        if(empty($matches)){return;}
6199
+    if (preg_match($regexp, $content, $matches)) {
6200
+        if (empty($matches)) {return; }
6201 6201
 
6202
-        $version = trim( $matches[1] );
6203
-        if($version && $version>GEODIRECTORY_VERSION){
6202
+        $version = trim($matches[1]);
6203
+        if ($version && $version > GEODIRECTORY_VERSION) {
6204 6204
 
6205 6205
 
6206
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6207
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6206
+        $notices = (array) preg_split('~[\r\n]+~', trim($matches[2]));
6207
+        if (version_compare(GEODIRECTORY_VERSION, $version, '<')) {
6208 6208
             $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6209
-            foreach ( $notices as $index => $line ) {
6210
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6209
+            foreach ($notices as $index => $line) {
6210
+                $upgrade_notice .= wp_kses_post(preg_replace('~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line));
6211 6211
             }
6212 6212
             $upgrade_notice .= '</div> ';
6213 6213
         }
@@ -6231,7 +6231,7 @@  discard block
 block discarded – undo
6231 6231
 		$default_language = $sitepress->get_default_language();
6232 6232
 		if ($current_language != 'all' && $current_language != $default_language) {
6233 6233
 	?>
6234
-	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory');?></strong></p></div>
6234
+	<div class="updated error notice-success" id="message"><p style="color:red"><strong><?php _e('Saving GeoDirectory pages settings on a different language breaks pages settings. Try to save after switching to default language.', 'geodirectory'); ?></strong></p></div>
6235 6235
 	<?php
6236 6236
 		}
6237 6237
 	}
@@ -6246,7 +6246,7 @@  discard block
 block discarded – undo
6246 6246
  * @param array Listing statuses to be skipped.
6247 6247
  */
6248 6248
 function geodir_imex_export_skip_statuses() {
6249
-    $statuses = array( 'trash', 'auto-draft' );
6249
+    $statuses = array('trash', 'auto-draft');
6250 6250
     
6251 6251
     /**
6252 6252
      * Filter the statuses to skip during GD export listings.
@@ -6256,7 +6256,7 @@  discard block
 block discarded – undo
6256 6256
      *
6257 6257
      * @param array $statuses Listing statuses to be skipped.
6258 6258
      */
6259
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6259
+    $statuses = apply_filters('geodir_imex_export_skip_statuses', $statuses);
6260 6260
      
6261 6261
     return $statuses;
6262 6262
 }
@@ -6327,16 +6327,16 @@  discard block
 block discarded – undo
6327 6327
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6328 6328
     global $wpdb;
6329 6329
     
6330
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6330
+    $filters = !empty($_REQUEST['gd_imex']) && is_array($_REQUEST['gd_imex']) ? $_REQUEST['gd_imex'] : NULL;
6331 6331
     
6332
-    if ( !empty( $filters ) ) {
6333
-        foreach ( $filters as $field => $value ) {
6332
+    if (!empty($filters)) {
6333
+        foreach ($filters as $field => $value) {
6334 6334
             switch ($field) {
6335 6335
                 case 'start_date':
6336
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6336
+                    $where .= " AND `".$wpdb->posts."`.`post_date` >= '".sanitize_text_field($value)." 00:00:00'";
6337 6337
                 break;
6338 6338
                 case 'end_date':
6339
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6339
+                    $where .= " AND `".$wpdb->posts."`.`post_date` <= '".sanitize_text_field($value)." 23:59:59'";
6340 6340
                 break;
6341 6341
             }
6342 6342
         }
@@ -6348,25 +6348,25 @@  discard block
 block discarded – undo
6348 6348
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6349 6349
 
6350 6350
 
6351
-function geodir_fix_for_primer_theme(){
6352
-    if(!defined( 'PRIMER_VERSION' )){return;}
6351
+function geodir_fix_for_primer_theme() {
6352
+    if (!defined('PRIMER_VERSION')) {return; }
6353 6353
     global $pagenow;
6354 6354
 
6355
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6355
+    if (('post.php' === $pagenow || 'post-new.php' === $pagenow) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']))) {
6356 6356
 
6357
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6357
+        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type($_GET['post']);
6358 6358
 
6359 6359
         $post_types = geodir_get_posttypes();
6360
-        if ($post_type && in_array($post_type, $post_types) ) {
6360
+        if ($post_type && in_array($post_type, $post_types)) {
6361 6361
             global $primer_customizer_layouts;
6362
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6362
+            remove_action('add_meta_boxes', array($primer_customizer_layouts, 'add_meta_box'), 10);
6363 6363
         }
6364 6364
     }
6365 6365
 
6366 6366
 }
6367 6367
 
6368
-if(is_admin()){
6369
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6368
+if (is_admin()) {
6369
+    add_action('add_meta_boxes', 'geodir_fix_for_primer_theme', 0);  
6370 6370
 }
6371 6371
 
6372 6372
 
@@ -6499,32 +6499,32 @@  discard block
 block discarded – undo
6499 6499
 
6500 6500
 function geodir_ga_activation_url() {
6501 6501
 
6502
-    return add_query_arg( array(
6502
+    return add_query_arg(array(
6503 6503
         'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6504 6504
         'scope'         => GEODIR_GA_SCOPE,
6505 6505
         'response_type' => 'code',
6506 6506
         'redirect_uri'  => GEODIR_GA_REDIRECT,
6507 6507
         'client_id'     => GEODIR_GA_CLIENTID,
6508
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6508
+    ), 'https://accounts.google.com/o/oauth2/auth');
6509 6509
 
6510 6510
     return $url;
6511 6511
 }
6512 6512
 
6513
-function geodir_gd_accounts(){
6513
+function geodir_gd_accounts() {
6514 6514
     $accounts = array();
6515
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6516
-    if($useAuth){
6515
+    $useAuth = (get_option('geodir_ga_auth_code') == '' ? false : true);
6516
+    if ($useAuth) {
6517 6517
         try {
6518 6518
             $accounts = geodir_ga_get_analytics_accounts();
6519 6519
         } catch (Exception $e) {
6520
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6520
+            geodir_error_log(wp_sprintf(__('GD Google Analytics API Error(%s) : %s', 'geodirectory'), $e->getCode(), $e->getMessage()));
6521 6521
         }
6522 6522
         
6523
-        if(is_array($accounts)){
6524
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6525
-        }elseif(get_option('geodir_ga_account_id')){
6523
+        if (is_array($accounts)) {
6524
+            $accounts = array_merge(array(__('Select Account', 'geodirectory')), $accounts);
6525
+        }elseif (get_option('geodir_ga_account_id')) {
6526 6526
             $accounts = array();
6527
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6527
+            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required', 'geodirectory').' ('.get_option('geodir_ga_account_id').')';
6528 6528
         }
6529 6529
     }
6530 6530
     return $accounts;
@@ -6535,21 +6535,21 @@  discard block
 block discarded – undo
6535 6535
     global $gd_ga_errors;
6536 6536
     $accounts = array();
6537 6537
 
6538
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6538
+    if (get_option('geodir_ga_auth_token') === false) {update_option('geodir_ga_auth_token', ''); }
6539 6539
 
6540 6540
 
6541
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6541
+    if (get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])) {
6542 6542
       return get_option('geodir_gd_uids');
6543 6543
     }
6544 6544
 
6545 6545
     # Create a new Gdata call
6546
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6546
+    if (trim(get_option('geodir_ga_auth_code')) != '')
6547 6547
         $stats = new GDGoogleAnalyticsStats();
6548 6548
     else
6549 6549
         return false;
6550 6550
 
6551 6551
     # Check if Google sucessfully logged in
6552
-    if ( ! $stats->checkLogin() )
6552
+    if (!$stats->checkLogin())
6553 6553
         return false;
6554 6554
 
6555 6555
     # Get a list of accounts
@@ -6561,28 +6561,28 @@  discard block
 block discarded – undo
6561 6561
     }
6562 6562
 
6563 6563
 
6564
-    natcasesort ($accounts);
6564
+    natcasesort($accounts);
6565 6565
 
6566 6566
     # Return the account array if there are accounts
6567
-    if ( count($accounts) > 0 ){
6568
-        update_option('geodir_gd_uids',$accounts);
6567
+    if (count($accounts) > 0) {
6568
+        update_option('geodir_gd_uids', $accounts);
6569 6569
         return $accounts;
6570 6570
     }
6571 6571
     else
6572 6572
         return false;
6573 6573
 }
6574 6574
 
6575
-add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6576
-function geodir_ga_deauthorize(){
6575
+add_action('wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize');
6576
+function geodir_ga_deauthorize() {
6577 6577
 
6578
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6578
+    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'gd_ga_deauthorize')) {
6579 6579
 
6580
-        die( 'Security check' );
6580
+        die('Security check');
6581 6581
 
6582 6582
     } else {
6583
-        update_option('geodir_ga_auth_token','');
6584
-        update_option('geodir_ga_auth_code','');
6585
-        update_option('geodir_gd_uids','');
6583
+        update_option('geodir_ga_auth_token', '');
6584
+        update_option('geodir_ga_auth_code', '');
6585
+        update_option('geodir_gd_uids', '');
6586 6586
 
6587 6587
 
6588 6588
         echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
@@ -6615,22 +6615,22 @@  discard block
 block discarded – undo
6615 6615
  * @since 1.6.21
6616 6616
  * @return array
6617 6617
  */
6618
-function geodir_listing_image_size_arr(){
6618
+function geodir_listing_image_size_arr() {
6619 6619
 
6620 6620
     global $_wp_additional_image_sizes;
6621 6621
 
6622 6622
     $sizes = array();
6623 6623
 
6624
-    foreach ( get_intermediate_image_sizes() as $_size ) {
6625
-        if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6626
-            $sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6627
-            $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6628
-            $sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6629
-        } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6630
-            $sizes[ $_size ] = array(
6631
-                'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6632
-                'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6633
-                'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6624
+    foreach (get_intermediate_image_sizes() as $_size) {
6625
+        if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
6626
+            $sizes[$_size]['width']  = get_option("{$_size}_size_w");
6627
+            $sizes[$_size]['height'] = get_option("{$_size}_size_h");
6628
+            $sizes[$_size]['crop']   = (bool) get_option("{$_size}_crop");
6629
+        } elseif (isset($_wp_additional_image_sizes[$_size])) {
6630
+            $sizes[$_size] = array(
6631
+                'width'  => $_wp_additional_image_sizes[$_size]['width'],
6632
+                'height' => $_wp_additional_image_sizes[$_size]['height'],
6633
+                'crop'   => $_wp_additional_image_sizes[$_size]['crop'],
6634 6634
             );
6635 6635
         }
6636 6636
     }
@@ -6641,9 +6641,9 @@  discard block
 block discarded – undo
6641 6641
 
6642 6642
     $options['default'] = __('GD Default', 'geodirectory');
6643 6643
 
6644
-    if(!empty($sizes)){
6645
-        foreach($sizes as $key=>$val){
6646
-            $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6644
+    if (!empty($sizes)) {
6645
+        foreach ($sizes as $key=>$val) {
6646
+            $options[$key] = $key.' ( '.$val['width'].' x '.$val['height'].' )';
6647 6647
         }
6648 6648
     }
6649 6649
 
Please login to merge, or discard this patch.
Indentation   +2945 added lines, -2945 removed lines patch added patch discarded remove patch
@@ -13,133 +13,133 @@  discard block
 block discarded – undo
13 13
  * @package GeoDirectory
14 14
  */
15 15
 function geodir_deactivation() {
16
-    // Update installed variable
17
-    update_option("geodir_installed", 0);
16
+	// Update installed variable
17
+	update_option("geodir_installed", 0);
18 18
 
19
-    // Remove rewrite rules and then recreate rewrite rules.
20
-    flush_rewrite_rules();
19
+	// Remove rewrite rules and then recreate rewrite rules.
20
+	flush_rewrite_rules();
21 21
 }
22 22
 
23 23
 if (!function_exists('geodir_admin_styles')) {
24
-    /**
25
-     * Enqueue Admin Styles.
26
-     *
27
-     * @since 1.0.0
28
-     * @package GeoDirectory
29
-     */
30
-    function geodir_admin_styles() {
31
-        wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32
-        wp_enqueue_style('geodirectory-admin-css');
24
+	/**
25
+	 * Enqueue Admin Styles.
26
+	 *
27
+	 * @since 1.0.0
28
+	 * @package GeoDirectory
29
+	 */
30
+	function geodir_admin_styles() {
31
+		wp_register_style('geodirectory-admin-css', geodir_plugin_url() . '/geodirectory-assets/css/admin.css', array(), GEODIRECTORY_VERSION);
32
+		wp_enqueue_style('geodirectory-admin-css');
33 33
 
34
-        wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35
-        wp_enqueue_style('geodirectory-frontend-style');
34
+		wp_register_style('geodirectory-frontend-style', geodir_plugin_url() . '/geodirectory-assets/css/style.css', array(), GEODIRECTORY_VERSION);
35
+		wp_enqueue_style('geodirectory-frontend-style');
36 36
 
37
-        wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38
-        wp_enqueue_style('geodir-chosen-style');
37
+		wp_register_style('geodir-chosen-style', geodir_plugin_url() . '/geodirectory-assets/css/chosen.css', array(), GEODIRECTORY_VERSION);
38
+		wp_enqueue_style('geodir-chosen-style');
39 39
 
40
-        wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41
-        wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
40
+		wp_register_style('geodirectory-jquery-ui-timepicker-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery.ui.timepicker.css', array(), GEODIRECTORY_VERSION);
41
+		wp_enqueue_style('geodirectory-jquery-ui-timepicker-css');
42 42
 
43
-        wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44
-        wp_enqueue_style('geodirectory-jquery-ui-css');
43
+		wp_register_style('geodirectory-jquery-ui-css', geodir_plugin_url() . '/geodirectory-assets/css/jquery-ui.css', array(), GEODIRECTORY_VERSION);
44
+		wp_enqueue_style('geodirectory-jquery-ui-css');
45 45
 
46
-        wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47
-        wp_enqueue_style('geodirectory-custom-fields-css');
46
+		wp_register_style('geodirectory-custom-fields-css', geodir_plugin_url() . '/geodirectory-assets/css/custom_field.css', array(), GEODIRECTORY_VERSION);
47
+		wp_enqueue_style('geodirectory-custom-fields-css');
48 48
 
49
-        wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50
-        wp_enqueue_style('geodirectory-pluplodar-css');
49
+		wp_register_style('geodirectory-pluplodar-css', geodir_plugin_url() . '/geodirectory-assets/css/pluploader.css', array(), GEODIRECTORY_VERSION);
50
+		wp_enqueue_style('geodirectory-pluplodar-css');
51 51
 
52
-        wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53
-        wp_enqueue_style('geodir-rating-style');
52
+		wp_register_style('geodir-rating-style', geodir_plugin_url() . '/geodirectory-assets/css/jRating.jquery.css', array(), GEODIRECTORY_VERSION);
53
+		wp_enqueue_style('geodir-rating-style');
54 54
 
55
-        wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56
-        wp_enqueue_style('geodir-rtl-style');
57
-    }
55
+		wp_register_style('geodir-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl.css', array(), GEODIRECTORY_VERSION);
56
+		wp_enqueue_style('geodir-rtl-style');
57
+	}
58 58
 }
59 59
 
60 60
 if (!function_exists('geodir_admin_styles_req')) {
61
-    /**
62
-     * Loads stylesheets from CDN.
63
-     *
64
-     * @since 1.0.0
65
-     * @package GeoDirectory
66
-     */
67
-    function geodir_admin_styles_req()
68
-    {
61
+	/**
62
+	 * Loads stylesheets from CDN.
63
+	 *
64
+	 * @since 1.0.0
65
+	 * @package GeoDirectory
66
+	 */
67
+	function geodir_admin_styles_req()
68
+	{
69 69
 
70
-        wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
71
-        wp_enqueue_style('font-awesome');
70
+		wp_register_style('font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION);
71
+		wp_enqueue_style('font-awesome');
72 72
 
73
-        wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74
-        wp_enqueue_script('geodirectory-admin');
73
+		wp_register_script('geodirectory-admin', geodir_plugin_url() . '/geodirectory-assets/js/admin-req.min.js', array('jquery'), GEODIRECTORY_VERSION);
74
+		wp_enqueue_script('geodirectory-admin');
75 75
 
76
-    }
76
+	}
77 77
 }
78 78
 
79 79
 if (!function_exists('geodir_admin_scripts')) {
80
-    /**
81
-     * Enqueue Admin Scripts.
82
-     *
83
-     * @since 1.0.0
84
-     * @package GeoDirectory
85
-     */
86
-    function geodir_admin_scripts()
87
-    {
88
-        $geodir_map_name = geodir_map_name();
80
+	/**
81
+	 * Enqueue Admin Scripts.
82
+	 *
83
+	 * @since 1.0.0
84
+	 * @package GeoDirectory
85
+	 */
86
+	function geodir_admin_scripts()
87
+	{
88
+		$geodir_map_name = geodir_map_name();
89 89
         
90
-        wp_enqueue_script('jquery');
90
+		wp_enqueue_script('jquery');
91 91
 
92
-        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);
92
+		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);
93 93
 
94
-        wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95
-        wp_enqueue_script('chosen');
94
+		wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.js', array('jquery'), GEODIRECTORY_VERSION);
95
+		wp_enqueue_script('chosen');
96 96
 
97
-        wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98
-        wp_enqueue_script('geodirectory-choose-ajax');
97
+		wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.js', array(), GEODIRECTORY_VERSION);
98
+		wp_enqueue_script('geodirectory-choose-ajax');
99 99
 
100
-        if (isset($_REQUEST['listing_type'])) {
101
-            wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102
-        }
100
+		if (isset($_REQUEST['listing_type'])) {
101
+			wp_register_script('geodirectory-custom-fields-script', geodir_plugin_url() . '/geodirectory-assets/js/custom_fields.js', array(), GEODIRECTORY_VERSION);
102
+		}
103 103
 
104
-        wp_enqueue_script('geodirectory-custom-fields-script');
105
-        $plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
104
+		wp_enqueue_script('geodirectory-custom-fields-script');
105
+		$plugin_path = geodir_plugin_url() . '/geodirectory-functions/cat-meta-functions';
106 106
 
107
-        wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
107
+		wp_enqueue_script('tax-meta-clss', $plugin_path . '/js/tax-meta-clss.js', array('jquery'), null, true);
108 108
 
109
-        if (in_array($geodir_map_name, array('auto', 'google'))) {
110
-            $map_lang = "&language=" . geodir_get_map_default_language();
111
-            $map_key = "&key=" . geodir_get_map_api_key();
112
-            /** This filter is documented in geodirectory_template_tags.php */
113
-            $map_extra = apply_filters('geodir_googlemap_script_extra', '');
114
-            wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
109
+		if (in_array($geodir_map_name, array('auto', 'google'))) {
110
+			$map_lang = "&language=" . geodir_get_map_default_language();
111
+			$map_key = "&key=" . geodir_get_map_api_key();
112
+			/** This filter is documented in geodirectory_template_tags.php */
113
+			$map_extra = apply_filters('geodir_googlemap_script_extra', '');
114
+			wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra, '', NULL);
115 115
             
116
-            // Overlapping Marker Spiderfier
117
-            wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
118
-            wp_enqueue_script('geodirectory-g-overlappingmarker-script');
119
-        }
116
+			// Overlapping Marker Spiderfier
117
+			wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION);
118
+			wp_enqueue_script('geodirectory-g-overlappingmarker-script');
119
+		}
120 120
         
121
-        if ($geodir_map_name == 'osm') {
122
-            // Leaflet OpenStreetMap
123
-            wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
124
-            wp_enqueue_style('geodirectory-leaflet-style');
121
+		if ($geodir_map_name == 'osm') {
122
+			// Leaflet OpenStreetMap
123
+			wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION);
124
+			wp_enqueue_style('geodirectory-leaflet-style');
125 125
                 
126
-            wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
127
-            wp_enqueue_script('geodirectory-leaflet-script');
126
+			wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION);
127
+			wp_enqueue_script('geodirectory-leaflet-script');
128 128
             
129
-            wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
130
-            wp_enqueue_script('geodirectory-leaflet-geo-script');
129
+			wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array('geodirectory-leaflet-script'), GEODIRECTORY_VERSION);
130
+			wp_enqueue_script('geodirectory-leaflet-geo-script');
131 131
             
132
-            // Overlapping Marker Spiderfier Leaflet
133
-            wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134
-            wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135
-        }
136
-        wp_enqueue_script( 'jquery-ui-autocomplete' );
132
+			// Overlapping Marker Spiderfier Leaflet
133
+			wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION);
134
+			wp_enqueue_script('geodirectory-o-overlappingmarker-script');
135
+		}
136
+		wp_enqueue_script( 'jquery-ui-autocomplete' );
137 137
         
138
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
139
-        wp_enqueue_script('geodirectory-goMap-script');
138
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION,true);
139
+		wp_enqueue_script('geodirectory-goMap-script');
140 140
 
141
-        wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
142
-        wp_enqueue_script('geodirectory-goMap-script');
141
+		wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.js', array(), GEODIRECTORY_VERSION);
142
+		wp_enqueue_script('geodirectory-goMap-script');
143 143
 
144 144
 		// font awesome rating script
145 145
 		if (get_option('geodir_reviewrating_enable_font_awesome')) {
@@ -150,166 +150,166 @@  discard block
 block discarded – undo
150 150
 			wp_enqueue_script('geodir-jRating-js');
151 151
 		}
152 152
 
153
-        wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
154
-        wp_enqueue_script('geodir-on-document-load');
155
-
156
-
157
-        // SCRIPT FOR UPLOAD
158
-        wp_enqueue_script('plupload-all');
159
-        wp_enqueue_script('jquery-ui-sortable');
160
-
161
-        wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
162
-        wp_enqueue_script('geodirectory-plupload-script');
163
-
164
-        // SCRIPT FOR UPLOAD END
165
-
166
-
167
-        // place js config array for plupload
168
-        $plupload_init = array(
169
-            'runtimes' => 'html5,silverlight,html4',
170
-            'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
171
-            'container' => 'plupload-upload-ui', // will be adjusted per uploader
172
-            'file_data_name' => 'async-upload', // will be adjusted per uploader
173
-            'multiple_queues' => true,
174
-            'max_file_size' => geodir_max_upload_size(),
175
-            'url' => admin_url('admin-ajax.php'),
176
-            'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
177
-            'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
178
-            'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
179
-            'multipart' => true,
180
-            'urlstream_upload' => true,
181
-            'multi_selection' => false, // will be added per uploader
182
-            // additional post data to send to our ajax hook
183
-            'multipart_params' => array(
184
-                '_ajax_nonce' => "", // will be added per uploader
185
-                'action' => 'plupload_action', // the ajax action name
186
-                'imgid' => 0 // will be added per uploader
187
-            )
188
-        );
189
-        $base_plupload_config = json_encode($plupload_init);
190
-
191
-
192
-        $thumb_img_arr = array();
193
-
194
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
195
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
196
-
197
-        $totImg = '';
198
-        $image_limit = '';
199
-        if (!empty($thumb_img_arr)) {
200
-            $totImg = count($thumb_img_arr);
201
-        }
153
+		wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js', array(), GEODIRECTORY_VERSION);
154
+		wp_enqueue_script('geodir-on-document-load');
155
+
156
+
157
+		// SCRIPT FOR UPLOAD
158
+		wp_enqueue_script('plupload-all');
159
+		wp_enqueue_script('jquery-ui-sortable');
160
+
161
+		wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.js', array(), GEODIRECTORY_VERSION);
162
+		wp_enqueue_script('geodirectory-plupload-script');
163
+
164
+		// SCRIPT FOR UPLOAD END
165
+
166
+
167
+		// place js config array for plupload
168
+		$plupload_init = array(
169
+			'runtimes' => 'html5,silverlight,html4',
170
+			'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
171
+			'container' => 'plupload-upload-ui', // will be adjusted per uploader
172
+			'file_data_name' => 'async-upload', // will be adjusted per uploader
173
+			'multiple_queues' => true,
174
+			'max_file_size' => geodir_max_upload_size(),
175
+			'url' => admin_url('admin-ajax.php'),
176
+			'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'),
177
+			'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
178
+			'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')),
179
+			'multipart' => true,
180
+			'urlstream_upload' => true,
181
+			'multi_selection' => false, // will be added per uploader
182
+			// additional post data to send to our ajax hook
183
+			'multipart_params' => array(
184
+				'_ajax_nonce' => "", // will be added per uploader
185
+				'action' => 'plupload_action', // the ajax action name
186
+				'imgid' => 0 // will be added per uploader
187
+			)
188
+		);
189
+		$base_plupload_config = json_encode($plupload_init);
190
+
191
+
192
+		$thumb_img_arr = array();
193
+
194
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
195
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
196
+
197
+		$totImg = '';
198
+		$image_limit = '';
199
+		if (!empty($thumb_img_arr)) {
200
+			$totImg = count($thumb_img_arr);
201
+		}
202 202
 
203
-        $gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
204
-            'totalImg' => $totImg,
205
-            'image_limit' => $image_limit,
206
-            'upload_img_size' => geodir_max_upload_size());
203
+		$gd_plupload_init = array('base_plupload_config' => $base_plupload_config,
204
+			'totalImg' => $totImg,
205
+			'image_limit' => $image_limit,
206
+			'upload_img_size' => geodir_max_upload_size());
207 207
 
208
-        wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
208
+		wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init);
209 209
 
210
-        $ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
211
-        wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
210
+		$ajax_cons_data = array('url' => __(admin_url('admin-ajax.php')));
211
+		wp_localize_script('geodirectory-custom-fields-script', 'geodir_admin_ajax', $ajax_cons_data);
212 212
 
213 213
 
214
-        wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
215
-        wp_enqueue_script('geodirectory-admin-script');
214
+		wp_register_script('geodirectory-admin-script', geodir_plugin_url() . '/geodirectory-assets/js/admin.js', array(), GEODIRECTORY_VERSION);
215
+		wp_enqueue_script('geodirectory-admin-script');
216 216
 
217
-        wp_enqueue_style('farbtastic');
218
-        wp_enqueue_script('farbtastic');
217
+		wp_enqueue_style('farbtastic');
218
+		wp_enqueue_script('farbtastic');
219 219
 
220
-        $screen = get_current_screen();
221
-        if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
222
-            wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
223
-        }
220
+		$screen = get_current_screen();
221
+		if ($screen->base == 'post' && in_array($screen->post_type, geodir_get_posttypes())) {
222
+			wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation_admin.js');
223
+		}
224 224
 
225
-        $ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
226
-        wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
225
+		$ajax_cons_data = array('url' => esc_url(__(get_option('siteurl') . '?geodir_ajax=true')));
226
+		wp_localize_script('geodirectory-admin-script', 'geodir_ajax', $ajax_cons_data);
227 227
 
228
-    }
228
+	}
229 229
 }
230 230
 
231 231
 if (!function_exists('geodir_admin_menu')) {
232
-    /**
233
-     * Admin Menus
234
-     *
235
-     * Sets up the admin menus in wordpress.
236
-     *
237
-     * @since 1.0.0
238
-     * @package GeoDirectory
239
-     * @global array $menu Menu array.
240
-     * @global object $geodirectory GeoDirectory plugin object.
241
-     */
242
-    function geodir_admin_menu()
243
-    {
244
-        global $menu, $geodirectory;
232
+	/**
233
+	 * Admin Menus
234
+	 *
235
+	 * Sets up the admin menus in wordpress.
236
+	 *
237
+	 * @since 1.0.0
238
+	 * @package GeoDirectory
239
+	 * @global array $menu Menu array.
240
+	 * @global object $geodirectory GeoDirectory plugin object.
241
+	 */
242
+	function geodir_admin_menu()
243
+	{
244
+		global $menu, $geodirectory;
245 245
 
246
-        if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
246
+		if (current_user_can('manage_options')) $menu[] = array('', 'read', 'separator-geodirectory', '', 'wp-menu-separator geodirectory');
247 247
 
248
-        add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
248
+		add_menu_page(__('Geodirectory', 'geodirectory'), __('Geodirectory', 'geodirectory'), 'manage_options', 'geodirectory', 'geodir_admin_panel', geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico', '55.1984');
249 249
 
250 250
 
251
-    }
251
+	}
252 252
 }
253 253
 
254 254
 if (!function_exists('geodir_admin_menu_order')) {
255
-    /**
256
-     * Order admin menus.
257
-     *
258
-     * @since 1.0.0
259
-     * @package GeoDirectory
260
-     * @param array $menu_order Menu order array.
261
-     * @return array Modified menu order array.
262
-     */
263
-    function geodir_admin_menu_order($menu_order)
264
-    {
265
-
266
-        // Initialize our custom order array
267
-        $geodir_menu_order = array();
268
-
269
-        // Get the index of our custom separator
270
-        $geodir_separator = array_search('separator-geodirectory', $menu_order);
271
-
272
-        // Get index of posttype menu
273
-        $post_types = geodir_get_posttypes();
274
-
275
-        // Loop through menu order and do some rearranging
276
-        foreach ($menu_order as $index => $item) :
277
-
278
-            if ((('geodirectory') == $item)) :
279
-                $geodir_menu_order[] = 'separator-geodirectory';
280
-                if (!empty($post_types)) {
281
-                    foreach ($post_types as $post_type) {
282
-                        $geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
283
-                    }
284
-                }
285
-                $geodir_menu_order[] = $item;
255
+	/**
256
+	 * Order admin menus.
257
+	 *
258
+	 * @since 1.0.0
259
+	 * @package GeoDirectory
260
+	 * @param array $menu_order Menu order array.
261
+	 * @return array Modified menu order array.
262
+	 */
263
+	function geodir_admin_menu_order($menu_order)
264
+	{
286 265
 
287
-                unset($menu_order[$geodir_separator]);
288
-            //unset( $menu_order[$geodir_places] );
289
-            elseif (!in_array($item, array('separator-geodirectory'))) :
290
-                $geodir_menu_order[] = $item;
291
-            endif;
266
+		// Initialize our custom order array
267
+		$geodir_menu_order = array();
292 268
 
293
-        endforeach;
269
+		// Get the index of our custom separator
270
+		$geodir_separator = array_search('separator-geodirectory', $menu_order);
294 271
 
295
-        // Return order
296
-        return $geodir_menu_order;
297
-    }
272
+		// Get index of posttype menu
273
+		$post_types = geodir_get_posttypes();
274
+
275
+		// Loop through menu order and do some rearranging
276
+		foreach ($menu_order as $index => $item) :
277
+
278
+			if ((('geodirectory') == $item)) :
279
+				$geodir_menu_order[] = 'separator-geodirectory';
280
+				if (!empty($post_types)) {
281
+					foreach ($post_types as $post_type) {
282
+						$geodir_menu_order[] = 'edit.php?post_type=' . $post_type;
283
+					}
284
+				}
285
+				$geodir_menu_order[] = $item;
286
+
287
+				unset($menu_order[$geodir_separator]);
288
+			//unset( $menu_order[$geodir_places] );
289
+			elseif (!in_array($item, array('separator-geodirectory'))) :
290
+				$geodir_menu_order[] = $item;
291
+			endif;
292
+
293
+		endforeach;
294
+
295
+		// Return order
296
+		return $geodir_menu_order;
297
+	}
298 298
 }
299 299
 
300 300
 if (!function_exists('geodir_admin_custom_menu_order')) {
301
-    /**
302
-     * Enables custom menu order.
303
-     *
304
-     * @since 1.0.0
305
-     * @package GeoDirectory
306
-     * @return bool
307
-     */
308
-    function geodir_admin_custom_menu_order()
309
-    {
310
-        if (!current_user_can('manage_options')) return false;
311
-        return true;
312
-    }
301
+	/**
302
+	 * Enables custom menu order.
303
+	 *
304
+	 * @since 1.0.0
305
+	 * @package GeoDirectory
306
+	 * @return bool
307
+	 */
308
+	function geodir_admin_custom_menu_order()
309
+	{
310
+		if (!current_user_can('manage_options')) return false;
311
+		return true;
312
+	}
313 313
 }
314 314
 
315 315
 /**
@@ -320,51 +320,51 @@  discard block
 block discarded – undo
320 320
  */
321 321
 function geodir_before_admin_panel()
322 322
 {
323
-    if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
324
-        echo '<div id="message" class="updated fade">
323
+	if (isset($_REQUEST['installed']) && $_REQUEST['installed'] != '') {
324
+		echo '<div id="message" class="updated fade">
325 325
                         <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>
326 326
                         <p><strong>' . __('Geodirectory has been installed and setup. Enjoy :)', 'geodirectory') . '</strong></p>
327 327
                 </div>';
328 328
 
329
-    }
329
+	}
330 330
 
331
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
332
-        switch ($_REQUEST['msg']) {
333
-            case 'success':
334
-                echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
335
-                flush_rewrite_rules(false);
331
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] != '') {
332
+		switch ($_REQUEST['msg']) {
333
+			case 'success':
334
+				echo '<div id="message" class="updated fade"><p><strong>' . __('Your settings have been saved.', 'geodirectory') . '</strong></p></div>';
335
+				flush_rewrite_rules(false);
336 336
 
337
-                break;
337
+				break;
338 338
 			case 'fail':
339 339
 				$gderr = isset($_REQUEST['gderr']) ? $_REQUEST['gderr'] : '';
340 340
 				
341 341
 				if ($gderr == 21)
342
-			    	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>';
342
+					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>';
343 343
 				else
344 344
 					echo '<div id="message" class="error fade"><p><strong>' . __('Error: Your settings have not been saved, please try again.', 'geodirectory') . '</strong></p></div>';
345
-                break;
346
-        }
347
-    }
345
+				break;
346
+		}
347
+	}
348 348
 
349
-    $geodir_load_map = get_option('geodir_load_map');
350
-    $need_map_key = false;
351
-    if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
352
-        $need_map_key = true;
353
-    }
349
+	$geodir_load_map = get_option('geodir_load_map');
350
+	$need_map_key = false;
351
+	if($geodir_load_map=='' || $geodir_load_map=='google' || $geodir_load_map=='auto' ){
352
+		$need_map_key = true;
353
+	}
354 354
 
355
-    if (!geodir_get_map_api_key() && $need_map_key) {
356
-        echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
357
-    }
355
+	if (!geodir_get_map_api_key() && $need_map_key) {
356
+		echo '<div class="error"><p><strong>' . sprintf(__('Google Maps API KEY not set, %sclick here%s to set one OR use Open Street Maps instead.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=design_settings&active_tab=geodir_map_settings') . '\'>', '</a>') . '</strong></p></div>';
357
+	}
358 358
 
359
-    if (!geodir_is_default_location_set()) {
360
-        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>';
359
+	if (!geodir_is_default_location_set()) {
360
+		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>';
361 361
 
362
-    }
362
+	}
363 363
 
364
-    if (!function_exists('curl_init')) {
365
-        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>';
364
+	if (!function_exists('curl_init')) {
365
+		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>';
366 366
 
367
-    }
367
+	}
368 368
 
369 369
 
370 370
 
@@ -381,19 +381,19 @@  discard block
 block discarded – undo
381 381
  */
382 382
 function geodir_handle_option_form_submit($current_tab)
383 383
 {
384
-    global $geodir_settings;
385
-    if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
386
-        /**
387
-         * Contains settings array for current tab.
388
-         *
389
-         * @since 1.0.0
390
-         * @package GeoDirectory
391
-         */
392
-        include_once('option-pages/' . $current_tab . '_array.php');
393
-    }
394
-    if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
395
-        if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
396
-        if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
384
+	global $geodir_settings;
385
+	if (file_exists(dirname(__FILE__) . '/option-pages/' . $current_tab . '_array.php')) {
386
+		/**
387
+		 * Contains settings array for current tab.
388
+		 *
389
+		 * @since 1.0.0
390
+		 * @package GeoDirectory
391
+		 */
392
+		include_once('option-pages/' . $current_tab . '_array.php');
393
+	}
394
+	if (isset($_POST) && $_POST && isset($_REQUEST['page']) && $_REQUEST['page'] == 'geodirectory') :
395
+		if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'geodir-settings')) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
396
+		if (!wp_verify_nonce($_REQUEST['_wpnonce-' . $current_tab], 'geodir-settings-' . $current_tab)) die(__('Action failed. Please refresh the page and retry.', 'geodirectory'));
397 397
 		
398 398
 		/**
399 399
 		 * Fires before updating geodirectory admin settings.
@@ -405,38 +405,38 @@  discard block
 block discarded – undo
405 405
 		 */
406 406
 		do_action('geodir_before_update_options', $current_tab, $geodir_settings);		
407 407
 		
408
-        if (!empty($geodir_settings[$current_tab]))
409
-            geodir_update_options($geodir_settings[$current_tab]);
408
+		if (!empty($geodir_settings[$current_tab]))
409
+			geodir_update_options($geodir_settings[$current_tab]);
410 410
 
411
-        /**
412
-         * Called after GeoDirectory options settings are updated.
413
-         *
414
-         * @since 1.0.0
415
-         * @param array $geodir_settings The array of GeoDirectory settings.
416
-         * @see 'geodir_before_update_options'
417
-         */
418
-        do_action('geodir_update_options', $geodir_settings);
411
+		/**
412
+		 * Called after GeoDirectory options settings are updated.
413
+		 *
414
+		 * @since 1.0.0
415
+		 * @param array $geodir_settings The array of GeoDirectory settings.
416
+		 * @see 'geodir_before_update_options'
417
+		 */
418
+		do_action('geodir_update_options', $geodir_settings);
419 419
 
420
-        /**
421
-         * Called after GeoDirectory options settings are updated.
422
-         *
423
-         * Provides tab specific settings.
424
-         *
425
-         * @since 1.0.0
426
-         * @param string $current_tab The current settings tab name.
427
-         * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
428
-         */
429
-        do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
420
+		/**
421
+		 * Called after GeoDirectory options settings are updated.
422
+		 *
423
+		 * Provides tab specific settings.
424
+		 *
425
+		 * @since 1.0.0
426
+		 * @param string $current_tab The current settings tab name.
427
+		 * @param array $geodir_settings[$current_tab] The array of settings for the current settings tab.
428
+		 */
429
+		do_action('geodir_update_options_' . $current_tab, $geodir_settings[$current_tab]);
430 430
 
431
-        flush_rewrite_rules(false);
431
+		flush_rewrite_rules(false);
432 432
 
433
-        $current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
433
+		$current_tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : '';
434 434
 
435
-        $redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
435
+		$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $_REQUEST['active_tab'] . '&msg=success');
436 436
 
437
-        wp_redirect($redirect_url);
438
-        exit();
439
-    endif;
437
+		wp_redirect($redirect_url);
438
+		exit();
439
+	endif;
440 440
 
441 441
 
442 442
 }
@@ -454,144 +454,144 @@  discard block
 block discarded – undo
454 454
  * @return bool Returns true if saved.
455 455
  */
456 456
 function geodir_update_options($options, $dummy = false) {
457
-    if ((!isset($_POST) || !$_POST) && !$dummy) return false;
457
+	if ((!isset($_POST) || !$_POST) && !$dummy) return false;
458 458
 
459
-    foreach ($options as $value) {
460
-        if ($dummy && isset($value['std']))
461
-            $_POST[$value['id']] = $value['std'];
459
+	foreach ($options as $value) {
460
+		if ($dummy && isset($value['std']))
461
+			$_POST[$value['id']] = $value['std'];
462 462
 
463 463
 
464
-        if (isset($value['type']) && $value['type'] == 'checkbox') :
464
+		if (isset($value['type']) && $value['type'] == 'checkbox') :
465 465
 
466
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
467
-                update_option($value['id'], $_POST[$value['id']]);
468
-            } else {
469
-                update_option($value['id'], 0);
470
-            }
466
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
467
+				update_option($value['id'], $_POST[$value['id']]);
468
+			} else {
469
+				update_option($value['id'], 0);
470
+			}
471 471
 
472
-        elseif (isset($value['type']) && $value['type'] == 'image_width') :
472
+		elseif (isset($value['type']) && $value['type'] == 'image_width') :
473 473
 
474
-            if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
475
-                update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
476
-                update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
477
-                if (isset($_POST[$value['id'] . '_crop'])) :
478
-                    update_option($value['id'] . '_crop', 1);
479
-                else :
480
-                    update_option($value['id'] . '_crop', 0);
481
-                endif;
482
-            } else {
483
-                update_option($value['id'] . '_width', $value['std']);
484
-                update_option($value['id'] . '_height', $value['std']);
485
-                update_option($value['id'] . '_crop', 1);
486
-            }
474
+			if (isset($value['id']) && isset($_POST[$value['id'] . '_width'])) {
475
+				update_option($value['id'] . '_width', $_POST[$value['id'] . '_width']);
476
+				update_option($value['id'] . '_height', $_POST[$value['id'] . '_height']);
477
+				if (isset($_POST[$value['id'] . '_crop'])) :
478
+					update_option($value['id'] . '_crop', 1);
479
+				else :
480
+					update_option($value['id'] . '_crop', 0);
481
+				endif;
482
+			} else {
483
+				update_option($value['id'] . '_width', $value['std']);
484
+				update_option($value['id'] . '_height', $value['std']);
485
+				update_option($value['id'] . '_crop', 1);
486
+			}
487 487
 
488
-        elseif (isset($value['type']) && $value['type'] == 'map') :
489
-            $post_types = array();
490
-            $categories = array();
488
+		elseif (isset($value['type']) && $value['type'] == 'map') :
489
+			$post_types = array();
490
+			$categories = array();
491 491
 
492
-            if (!empty($_POST['home_map_post_types'])) :
493
-                foreach ($_POST['home_map_post_types'] as $post_type) :
494
-                    $post_types[] = $post_type;
495
-                endforeach;
496
-            endif;
492
+			if (!empty($_POST['home_map_post_types'])) :
493
+				foreach ($_POST['home_map_post_types'] as $post_type) :
494
+					$post_types[] = $post_type;
495
+				endforeach;
496
+			endif;
497 497
 
498
-            update_option('geodir_exclude_post_type_on_map', $post_types);
498
+			update_option('geodir_exclude_post_type_on_map', $post_types);
499 499
 
500
-            if (!empty($_POST['post_category'])) :
501
-                foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
502
-                    $categories[$texonomy] = array();
503
-                    foreach ($cat_arr as $category) :
504
-                        $categories[$texonomy][] = $category;
505
-                    endforeach;
506
-                    $categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
507
-                endforeach;
508
-            endif;
509
-            update_option('geodir_exclude_cat_on_map', $categories);
510
-            update_option('geodir_exclude_cat_on_map_upgrade', 1);
511
-        elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
500
+			if (!empty($_POST['post_category'])) :
501
+				foreach ($_POST['post_category'] as $texonomy => $cat_arr) :
502
+					$categories[$texonomy] = array();
503
+					foreach ($cat_arr as $category) :
504
+						$categories[$texonomy][] = $category;
505
+					endforeach;
506
+					$categories[$texonomy] = !empty($categories[$texonomy]) ? array_unique($categories[$texonomy]) : array();
507
+				endforeach;
508
+			endif;
509
+			update_option('geodir_exclude_cat_on_map', $categories);
510
+			update_option('geodir_exclude_cat_on_map_upgrade', 1);
511
+		elseif (isset($value['type']) && $value['type'] == 'map_default_settings') :
512 512
 
513 513
 
514
-            if (!empty($_POST['geodir_default_map_language'])):
515
-                update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
516
-            endif;
514
+			if (!empty($_POST['geodir_default_map_language'])):
515
+				update_option('geodir_default_map_language', $_POST['geodir_default_map_language']);
516
+			endif;
517 517
 
518 518
 
519
-            if (!empty($_POST['geodir_default_map_search_pt'])):
520
-                update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
521
-            endif;
519
+			if (!empty($_POST['geodir_default_map_search_pt'])):
520
+				update_option('geodir_default_map_search_pt', $_POST['geodir_default_map_search_pt']);
521
+			endif;
522 522
 
523 523
 
524
-        elseif (isset($value['type']) && $value['type'] == 'file') :
524
+		elseif (isset($value['type']) && $value['type'] == 'file') :
525 525
 
526 526
 
527
-            if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
527
+			if (isset($_POST[$value['id'] . '_remove']) && $_POST[$value['id'] . '_remove']) {// if remove is set then remove the file
528 528
 
529
-                if (get_option($value['id'])) {
530
-                    $image_name_arr = explode('/', get_option($value['id']));
531
-                    $noimg_name = end($image_name_arr);
532
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
533
-                    if (file_exists($img_path))
534
-                        unlink($img_path);
535
-                }
529
+				if (get_option($value['id'])) {
530
+					$image_name_arr = explode('/', get_option($value['id']));
531
+					$noimg_name = end($image_name_arr);
532
+					$img_path = $uploads['path'] . '/' . $noimg_name;
533
+					if (file_exists($img_path))
534
+						unlink($img_path);
535
+				}
536 536
 
537
-                update_option($value['id'], '');
538
-            }
537
+				update_option($value['id'], '');
538
+			}
539 539
 
540
-            $uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
541
-            $filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
542
-
543
-            if (!empty($filename)):
544
-                $ext = pathinfo($filename, PATHINFO_EXTENSION);
545
-                $uplaods = array();
546
-
547
-                foreach ($uploadedfile as $key => $uplaod):
548
-                    if ($key == 'name'):
549
-                        $uplaods[$key] = $filename;
550
-                    else :
551
-                        $uplaods[$key] = $uplaod;
552
-                    endif;
553
-                endforeach;
554
-
555
-                $uploads = wp_upload_dir();
556
-
557
-                if (get_option($value['id'])) {
558
-                    $image_name_arr = explode('/', get_option($value['id']));
559
-                    $noimg_name = end($image_name_arr);
560
-                    $img_path = $uploads['path'] . '/' . $noimg_name;
561
-                    if (file_exists($img_path))
562
-                        unlink($img_path);
563
-                }
540
+			$uploadedfile = isset($_FILES[$value['id']]) ? $_FILES[$value['id']] : '';
541
+			$filename = isset($_FILES[$value['id']]['name']) ? $_FILES[$value['id']]['name'] : '';
542
+
543
+			if (!empty($filename)):
544
+				$ext = pathinfo($filename, PATHINFO_EXTENSION);
545
+				$uplaods = array();
546
+
547
+				foreach ($uploadedfile as $key => $uplaod):
548
+					if ($key == 'name'):
549
+						$uplaods[$key] = $filename;
550
+					else :
551
+						$uplaods[$key] = $uplaod;
552
+					endif;
553
+				endforeach;
554
+
555
+				$uploads = wp_upload_dir();
556
+
557
+				if (get_option($value['id'])) {
558
+					$image_name_arr = explode('/', get_option($value['id']));
559
+					$noimg_name = end($image_name_arr);
560
+					$img_path = $uploads['path'] . '/' . $noimg_name;
561
+					if (file_exists($img_path))
562
+						unlink($img_path);
563
+				}
564 564
 
565
-                $upload_overrides = array('test_form' => false);
566
-                $movefile = wp_handle_upload($uplaods, $upload_overrides);
565
+				$upload_overrides = array('test_form' => false);
566
+				$movefile = wp_handle_upload($uplaods, $upload_overrides);
567 567
 
568
-                update_option($value['id'], $movefile['url']);
568
+				update_option($value['id'], $movefile['url']);
569 569
 
570
-            endif;
570
+			endif;
571 571
 
572
-            if (!get_option($value['id']) && isset($value['value'])):
573
-                update_option($value['id'], $value['value']);
574
-            endif;
572
+			if (!get_option($value['id']) && isset($value['value'])):
573
+				update_option($value['id'], $value['value']);
574
+			endif;
575 575
 
576 576
 
577
-        else :
578
-            // same menu setting per theme.
579
-            if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
580
-                $theme = wp_get_theme();
581
-                update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
582
-            }
577
+		else :
578
+			// same menu setting per theme.
579
+			if (isset($value['id']) && $value['id'] == 'geodir_theme_location_nav' && isset($_POST[$value['id']])) {
580
+				$theme = wp_get_theme();
581
+				update_option('geodir_theme_location_nav_' . $theme->name, $_POST[$value['id']]);
582
+			}
583 583
 
584
-            if (isset($value['id']) && isset($_POST[$value['id']])) {
585
-                update_option($value['id'], $_POST[$value['id']]);
586
-            } else {
587
-                delete_option($value['id']);
588
-            }
584
+			if (isset($value['id']) && isset($_POST[$value['id']])) {
585
+				update_option($value['id'], $_POST[$value['id']]);
586
+			} else {
587
+				delete_option($value['id']);
588
+			}
589 589
 
590
-        endif;
591
-    }
592
-    if ($dummy)
593
-        $_POST = array();
594
-    return true;
590
+		endif;
591
+	}
592
+	if ($dummy)
593
+		$_POST = array();
594
+	return true;
595 595
 
596 596
 }
597 597
 
@@ -640,33 +640,33 @@  discard block
 block discarded – undo
640 640
 function places_custom_fields_tab($tabs)
641 641
 {
642 642
 
643
-    $geodir_post_types = get_option('geodir_post_types');
643
+	$geodir_post_types = get_option('geodir_post_types');
644 644
 
645
-    if (!empty($geodir_post_types)) {
645
+	if (!empty($geodir_post_types)) {
646 646
 
647
-        foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
647
+		foreach ($geodir_post_types as $geodir_post_type => $geodir_posttype_info):
648 648
 
649
-            $listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
649
+			$listing_slug = __($geodir_posttype_info['labels']['singular_name'], 'geodirectory');
650 650
 
651
-            $tabs[$geodir_post_type . '_fields_settings'] = array(
652
-                'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
653
-                'subtabs' => array(
654
-                    array('subtab' => 'custom_fields',
655
-                        'label' => __('Custom Fields', 'geodirectory'),
656
-                        'request' => array('listing_type' => $geodir_post_type)),
657
-                    array('subtab' => 'sorting_options',
658
-                        'label' => __('Sorting Options', 'geodirectory'),
659
-                        'request' => array('listing_type' => $geodir_post_type)),
660
-                ),
661
-                'tab_index' => 9,
662
-                'request' => array('listing_type' => $geodir_post_type)
663
-            );
651
+			$tabs[$geodir_post_type . '_fields_settings'] = array(
652
+				'label' => wp_sprintf(__('%s Settings', 'geodirectory'), $listing_slug),
653
+				'subtabs' => array(
654
+					array('subtab' => 'custom_fields',
655
+						'label' => __('Custom Fields', 'geodirectory'),
656
+						'request' => array('listing_type' => $geodir_post_type)),
657
+					array('subtab' => 'sorting_options',
658
+						'label' => __('Sorting Options', 'geodirectory'),
659
+						'request' => array('listing_type' => $geodir_post_type)),
660
+				),
661
+				'tab_index' => 9,
662
+				'request' => array('listing_type' => $geodir_post_type)
663
+			);
664 664
 
665
-        endforeach;
665
+		endforeach;
666 666
 
667
-    }
667
+	}
668 668
 
669
-    return $tabs;
669
+	return $tabs;
670 670
 }
671 671
 
672 672
 
@@ -682,9 +682,9 @@  discard block
 block discarded – undo
682 682
  */
683 683
 function geodir_tools_setting_tab($tabs)
684 684
 {
685
-    wp_enqueue_script( 'jquery-ui-progressbar' );
686
-    $tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
687
-    return $tabs;
685
+	wp_enqueue_script( 'jquery-ui-progressbar' );
686
+	$tabs['tools_settings'] = array('label' => __('GD Tools', 'geodirectory'));
687
+	return $tabs;
688 688
 }
689 689
 
690 690
 /**
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
  */
700 700
 function geodir_compatibility_setting_tab($tabs)
701 701
 {
702
-    $tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
703
-    return $tabs;
702
+	$tabs['compatibility_settings'] = array('label' => __('Theme Compatibility', 'geodirectory'));
703
+	return $tabs;
704 704
 }
705 705
 
706 706
 
@@ -716,144 +716,144 @@  discard block
 block discarded – undo
716 716
  */
717 717
 function geodir_extend_geodirectory_setting_tab($tabs)
718 718
 {
719
-    $tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
720
-    return $tabs;
719
+	$tabs['extend_geodirectory_settings'] = array('label' => __('Extend Geodirectory', 'geodirectory'). ' <i class="fa fa-plug"></i>', 'url' => 'https://wpgeodirectory.com', 'target' => '_blank');
720
+	return $tabs;
721 721
 }
722 722
 
723 723
 
724 724
 if (!function_exists('geodir_edit_post_columns')) {
725
-    /**
726
-     * Modify admin post listing page columns.
727
-     *
728
-     * @since 1.0.0
729
-     * @package GeoDirectory
730
-     * @param array $columns The column array.
731
-     * @return array Altered column array.
732
-     */
733
-    function geodir_edit_post_columns($columns)
734
-    {
735
-
736
-        $new_columns = array('location' => __('Location (ID)', 'geodirectory'),
737
-            'categorys' => __('Categories', 'geodirectory'));
738
-
739
-        if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
740
-        {
741
-            $offset = 0; // should we prepend $array with $data?
742
-            $offset = count($columns); // or should we append $array with $data? lets pick this one...
743
-        }
725
+	/**
726
+	 * Modify admin post listing page columns.
727
+	 *
728
+	 * @since 1.0.0
729
+	 * @package GeoDirectory
730
+	 * @param array $columns The column array.
731
+	 * @return array Altered column array.
732
+	 */
733
+	function geodir_edit_post_columns($columns)
734
+	{
744 735
 
745
-        $columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
736
+		$new_columns = array('location' => __('Location (ID)', 'geodirectory'),
737
+			'categorys' => __('Categories', 'geodirectory'));
746 738
 
747
-        $columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
739
+		if (($offset = array_search('author', array_keys($columns))) === false) // if the key doesn't exist
740
+		{
741
+			$offset = 0; // should we prepend $array with $data?
742
+			$offset = count($columns); // or should we append $array with $data? lets pick this one...
743
+		}
748 744
 
749
-        return $columns;
750
-    }
745
+		$columns = array_merge(array_slice($columns, 0, $offset), $new_columns, array_slice($columns, $offset));
746
+
747
+		$columns = array_merge($columns, array('expire' => __('Expires', 'geodirectory')));
748
+
749
+		return $columns;
750
+	}
751 751
 }
752 752
 
753 753
 
754 754
 if (!function_exists('geodir_manage_post_columns')) {
755
-    /**
756
-     * Adds content to our custom post listing page columns.
757
-     *
758
-     * @since 1.0.0
759
-     * @package GeoDirectory
760
-     * @global object $wpdb WordPress Database object.
761
-     * @global object $post WordPress Post object.
762
-     * @param string $column The column name.
763
-     * @param int $post_id The post ID.
764
-     */
765
-    function geodir_manage_post_columns($column, $post_id)
766
-    {
767
-        global $post, $wpdb;
768
-
769
-        switch ($column):
770
-            /* If displaying the 'city' column. */
771
-            case 'location' :
772
-                $location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
773
-                $location = geodir_get_location($location_id);
774
-                /* If no city is found, output a default message. */
775
-                if (empty($location)) {
776
-                    _e('Unknown', 'geodirectory');
777
-                } else {
778
-                    /* If there is a city id, append 'city name' to the text string. */
779
-                    $add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
780
-                    echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
781
-                }
782
-                break;
783
-
784
-            /* If displaying the 'expire' column. */
785
-            case 'expire' :
786
-                $expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
787
-                $d1 = $expire_date; // get expire_date
788
-                $d2 = date('Y-m-d'); // get current date
789
-                $state = __('days left', 'geodirectory');
790
-                $date_diff_text = '';
791
-                $expire_class = 'expire_left';
792
-                if ($expire_date != 'Never') {
793
-                    if (strtotime($d1) < strtotime($d2)) {
794
-                        $state = __('days overdue', 'geodirectory');
795
-                        $expire_class = 'expire_over';
796
-                    }
797
-                    $date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
798
-                    $date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
799
-                }
800
-                /* If no expire_date is found, output a default message. */
801
-                if (empty($expire_date))
802
-                    echo __('Unknown', 'geodirectory');
803
-                /* If there is a expire_date, append 'days left' to the text string. */
804
-                else
805
-                    echo $expire_date . $date_diff_text;
806
-                break;
807
-
808
-            /* If displaying the 'categorys' column. */
809
-            case 'categorys' :
810
-
811
-                /* Get the categorys for the post. */
812
-
813
-
814
-                $terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
815
-
816
-                /* If terms were found. */
817
-                if (!empty($terms)) {
818
-                    $out = array();
819
-                    /* Loop through each term, linking to the 'edit posts' page for the specific term. */
820
-                    foreach ($terms as $term) {
821
-                        if (!strstr($term->taxonomy, 'tag')) {
822
-                            $out[] = sprintf('<a href="%s">%s</a>',
823
-                                esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
824
-                                esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
825
-                            );
826
-                        }
827
-                    }
828
-                    /* Join the terms, separating them with a comma. */
829
-                    echo(join(', ', $out));
830
-                } /* If no terms were found, output a default message. */
831
-                else {
832
-                    _e('No Categories', 'geodirectory');
833
-                }
834
-                break;
755
+	/**
756
+	 * Adds content to our custom post listing page columns.
757
+	 *
758
+	 * @since 1.0.0
759
+	 * @package GeoDirectory
760
+	 * @global object $wpdb WordPress Database object.
761
+	 * @global object $post WordPress Post object.
762
+	 * @param string $column The column name.
763
+	 * @param int $post_id The post ID.
764
+	 */
765
+	function geodir_manage_post_columns($column, $post_id)
766
+	{
767
+		global $post, $wpdb;
768
+
769
+		switch ($column):
770
+			/* If displaying the 'city' column. */
771
+			case 'location' :
772
+				$location_id = geodir_get_post_meta($post->ID, 'post_location_id', true);
773
+				$location = geodir_get_location($location_id);
774
+				/* If no city is found, output a default message. */
775
+				if (empty($location)) {
776
+					_e('Unknown', 'geodirectory');
777
+				} else {
778
+					/* If there is a city id, append 'city name' to the text string. */
779
+					$add_location_id = $location_id > 0 ? ' (' . $location_id . ')' : '';
780
+					echo(__($location->country, 'geodirectory') . '-' . $location->region . '-' . $location->city . $add_location_id);
781
+				}
782
+				break;
783
+
784
+			/* If displaying the 'expire' column. */
785
+			case 'expire' :
786
+				$expire_date = geodir_get_post_meta($post->ID, 'expire_date', true);
787
+				$d1 = $expire_date; // get expire_date
788
+				$d2 = date('Y-m-d'); // get current date
789
+				$state = __('days left', 'geodirectory');
790
+				$date_diff_text = '';
791
+				$expire_class = 'expire_left';
792
+				if ($expire_date != 'Never') {
793
+					if (strtotime($d1) < strtotime($d2)) {
794
+						$state = __('days overdue', 'geodirectory');
795
+						$expire_class = 'expire_over';
796
+					}
797
+					$date_diff = round(abs(strtotime($d1) - strtotime($d2)) / 86400); // get the difference in days
798
+					$date_diff_text = '<br /><span class="' . $expire_class . '">(' . $date_diff . ' ' . $state . ')</span>';
799
+				}
800
+				/* If no expire_date is found, output a default message. */
801
+				if (empty($expire_date))
802
+					echo __('Unknown', 'geodirectory');
803
+				/* If there is a expire_date, append 'days left' to the text string. */
804
+				else
805
+					echo $expire_date . $date_diff_text;
806
+				break;
835 807
 
836
-        endswitch;
837
-    }
808
+			/* If displaying the 'categorys' column. */
809
+			case 'categorys' :
810
+
811
+				/* Get the categorys for the post. */
812
+
813
+
814
+				$terms = wp_get_object_terms($post_id, get_object_taxonomies($post));
815
+
816
+				/* If terms were found. */
817
+				if (!empty($terms)) {
818
+					$out = array();
819
+					/* Loop through each term, linking to the 'edit posts' page for the specific term. */
820
+					foreach ($terms as $term) {
821
+						if (!strstr($term->taxonomy, 'tag')) {
822
+							$out[] = sprintf('<a href="%s">%s</a>',
823
+								esc_url(add_query_arg(array('post_type' => $post->post_type, $term->taxonomy => $term->slug), 'edit.php')),
824
+								esc_html(sanitize_term_field('name', $term->name, $term->term_id, $term->taxonomy, 'display'))
825
+							);
826
+						}
827
+					}
828
+					/* Join the terms, separating them with a comma. */
829
+					echo(join(', ', $out));
830
+				} /* If no terms were found, output a default message. */
831
+				else {
832
+					_e('No Categories', 'geodirectory');
833
+				}
834
+				break;
835
+
836
+		endswitch;
837
+	}
838 838
 }
839 839
 
840 840
 
841 841
 if (!function_exists('geodir_post_sortable_columns')) {
842
-    /**
843
-     * Makes admin post listing page columns sortable.
844
-     *
845
-     * @since 1.0.0
846
-     * @package GeoDirectory
847
-     * @param array $columns The column array.
848
-     * @return array Altered column array.
849
-     */
850
-    function geodir_post_sortable_columns($columns)
851
-    {
852
-
853
-        $columns['expire'] = 'expire';
854
-
855
-        return $columns;
856
-    }
842
+	/**
843
+	 * Makes admin post listing page columns sortable.
844
+	 *
845
+	 * @since 1.0.0
846
+	 * @package GeoDirectory
847
+	 * @param array $columns The column array.
848
+	 * @return array Altered column array.
849
+	 */
850
+	function geodir_post_sortable_columns($columns)
851
+	{
852
+
853
+		$columns['expire'] = 'expire';
854
+
855
+		return $columns;
856
+	}
857 857
 }
858 858
 
859 859
 /**
@@ -867,32 +867,32 @@  discard block
 block discarded – undo
867 867
  * @param int $post_id The post ID.
868 868
  */
869 869
 function geodir_post_information_save($post_id, $post) {
870
-    global $wpdb, $current_user;
870
+	global $wpdb, $current_user;
871 871
 
872
-    if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
873
-        return;
874
-    }
872
+	if (isset($post->post_type) && ($post->post_type=='nav_menu_item' || $post->post_type=='page' || $post->post_type=='post')) {
873
+		return;
874
+	}
875 875
 
876
-    $geodir_posttypes = geodir_get_posttypes();
876
+	$geodir_posttypes = geodir_get_posttypes();
877 877
 
878
-    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
879
-        return;
878
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
879
+		return;
880 880
 
881
-    if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
882
-        if (isset($_REQUEST['_status']))
883
-            geodir_change_post_status($post_id, $_REQUEST['_status']);
881
+	if (!wp_is_post_revision($post_id) && isset($post->post_type) && in_array($post->post_type, $geodir_posttypes)) {
882
+		if (isset($_REQUEST['_status']))
883
+			geodir_change_post_status($post_id, $_REQUEST['_status']);
884 884
 
885
-        if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
886
-            return;
885
+		if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'trash' || $_REQUEST['action'] == 'untrash'))
886
+			return;
887 887
 
888
-        if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
889
-            return;
888
+		if (!isset($_POST['geodir_post_info_noncename']) || !wp_verify_nonce($_POST['geodir_post_info_noncename'], plugin_basename(__FILE__)))
889
+			return;
890 890
 
891
-        if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
892
-            return;
891
+		if (!isset($_POST['geodir_post_attachments_noncename']) || !wp_verify_nonce($_POST['geodir_post_attachments_noncename'], plugin_basename(__FILE__)))
892
+			return;
893 893
 
894
-        geodir_save_listing($_REQUEST);
895
-    }
894
+		geodir_save_listing($_REQUEST);
895
+	}
896 896
 }
897 897
 
898 898
 /**
@@ -908,102 +908,102 @@  discard block
 block discarded – undo
908 908
  */
909 909
 function geodir_admin_fields($options)
910 910
 {
911
-    global $geodirectory;
912
-
913
-    $first_title = true;
914
-    $tab_id = '';
915
-    $i = 0;
916
-    foreach ($options as $value) :
917
-        if (!isset($value['name'])) $value['name'] = '';
918
-        if (!isset($value['class'])) $value['class'] = '';
919
-        if (!isset($value['css'])) $value['css'] = '';
920
-        if (!isset($value['std'])) $value['std'] = '';
921
-        $desc = '';
922
-        switch ($value['type']) :
923
-            case 'dummy_installer':
924
-                $post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
925
-                geodir_autoinstall_admin_header($post_type);
926
-                break;
927
-            case 'title':
928
-
929
-                if ($i == 0) {
930
-                    echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
931
-                    echo '<div class="inner_content_tab_main">';
932
-                }
911
+	global $geodirectory;
912
+
913
+	$first_title = true;
914
+	$tab_id = '';
915
+	$i = 0;
916
+	foreach ($options as $value) :
917
+		if (!isset($value['name'])) $value['name'] = '';
918
+		if (!isset($value['class'])) $value['class'] = '';
919
+		if (!isset($value['css'])) $value['css'] = '';
920
+		if (!isset($value['std'])) $value['std'] = '';
921
+		$desc = '';
922
+		switch ($value['type']) :
923
+			case 'dummy_installer':
924
+				$post_type = isset($value['post_type']) ? $value['post_type'] : 'gd_place';
925
+				geodir_autoinstall_admin_header($post_type);
926
+				break;
927
+			case 'title':
928
+
929
+				if ($i == 0) {
930
+					echo '<dl id="geodir_oiption_tabs" class="gd-tab-head"></dl>';
931
+					echo '<div class="inner_content_tab_main">';
932
+				}
933 933
 
934
-                $i++;
934
+				$i++;
935 935
 
936
-                if (isset($value['id']) && $value['id'])
937
-                    $tab_id = $value['id'];
936
+				if (isset($value['id']) && $value['id'])
937
+					$tab_id = $value['id'];
938 938
 
939
-                if (isset($value['desc']) && $value['desc'])
940
-                    $desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
939
+				if (isset($value['desc']) && $value['desc'])
940
+					$desc = '<span style=" text-transform:none;">:- ' . $value['desc'] . '</span>';
941 941
 
942
-                if (isset($value['name']) && $value['name']) {
943
-                    if ($first_title === true) {
944
-                        $first_title = false;
945
-                    } else {
946
-                        echo '</div>';
947
-                    }
948
-                    echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
942
+				if (isset($value['name']) && $value['name']) {
943
+					if ($first_title === true) {
944
+						$first_title = false;
945
+					} else {
946
+						echo '</div>';
947
+					}
948
+					echo '<dd id="' . trim($tab_id) . '" class="geodir_option_tabs" ><a href="javascript:void(0);">' . $value['name'] . '</a></dd>';
949 949
 
950
-                    echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
951
-                }
950
+					echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
951
+				}
952 952
 
953
-                /**
954
-                 * Called after a GeoDirectory settings title is output in the GD settings page.
955
-                 *
956
-                 * The action is called dynamically geodir_settings_$value['id'].
957
-                 *
958
-                 * @since 1.0.0
959
-                 */
960
-                do_action('geodir_settings_' . sanitize_title($value['id']));
961
-                break;
962
-
963
-            case 'no_tabs':
964
-
965
-                echo '<div class="inner_content_tab_main">';
966
-                echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
967
-
968
-                break;
969
-
970
-            case 'sectionstart':
971
-                if (isset($value['desc']) && $value['desc'])
972
-                    $desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
973
-                if (isset($value['name']) && $value['name'])
974
-                    echo '<h3>' . $value['name'] . $desc . '</h3>';
975
-                /**
976
-                 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
977
-                 *
978
-                 * The action is called dynamically geodir_settings_$value['id']_start.
979
-                 *
980
-                 * @since 1.0.0
981
-                 */
982
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
983
-                echo '<table class="form-table">' . "\n\n";
984
-
985
-                break;
986
-            case 'sectionend':
987
-                /**
988
-                 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
989
-                 *
990
-                 * The action is called dynamically geodir_settings_$value['id']_end.
991
-                 *
992
-                 * @since 1.0.0
993
-                 */
994
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
995
-                echo '</table>';
996
-                /**
997
-                 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
998
-                 *
999
-                 * The action is called dynamically geodir_settings_$value['id']_end.
1000
-                 *
1001
-                 * @since 1.0.0
1002
-                 */
1003
-                if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1004
-                break;
1005
-            case 'text':
1006
-                ?>
953
+				/**
954
+				 * Called after a GeoDirectory settings title is output in the GD settings page.
955
+				 *
956
+				 * The action is called dynamically geodir_settings_$value['id'].
957
+				 *
958
+				 * @since 1.0.0
959
+				 */
960
+				do_action('geodir_settings_' . sanitize_title($value['id']));
961
+				break;
962
+
963
+			case 'no_tabs':
964
+
965
+				echo '<div class="inner_content_tab_main">';
966
+				echo '<div id="sub_' . trim($tab_id) . '" class="gd-content-heading" style=" margin-bottom:10px;" >';
967
+
968
+				break;
969
+
970
+			case 'sectionstart':
971
+				if (isset($value['desc']) && $value['desc'])
972
+					$desc = '<span style=" text-transform:none;"> - ' . $value['desc'] . '</span>';
973
+				if (isset($value['name']) && $value['name'])
974
+					echo '<h3>' . $value['name'] . $desc . '</h3>';
975
+				/**
976
+				 * Called after a GeoDirectory settings sectionstart is output in the GD settings page.
977
+				 *
978
+				 * The action is called dynamically geodir_settings_$value['id']_start.
979
+				 *
980
+				 * @since 1.0.0
981
+				 */
982
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_start');
983
+				echo '<table class="form-table">' . "\n\n";
984
+
985
+				break;
986
+			case 'sectionend':
987
+				/**
988
+				 * Called before a GeoDirectory settings sectionend is output in the GD settings page.
989
+				 *
990
+				 * The action is called dynamically geodir_settings_$value['id']_end.
991
+				 *
992
+				 * @since 1.0.0
993
+				 */
994
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_end');
995
+				echo '</table>';
996
+				/**
997
+				 * Called after a GeoDirectory settings sectionend is output in the GD settings page.
998
+				 *
999
+				 * The action is called dynamically geodir_settings_$value['id']_end.
1000
+				 *
1001
+				 * @since 1.0.0
1002
+				 */
1003
+				if (isset($value['id']) && $value['id']) do_action('geodir_settings_' . sanitize_title($value['id']) . '_after');
1004
+				break;
1005
+			case 'text':
1006
+				?>
1007 1007
                 <tr valign="top">
1008 1008
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1009 1009
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1012,15 +1012,15 @@  discard block
 block discarded – undo
1012 1012
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1013 1013
                                            style=" <?php echo esc_attr($value['css']); ?>"
1014 1014
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1015
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1016
-                                           } else {
1017
-                                               echo esc_attr($value['std']);
1018
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1015
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1016
+										   } else {
1017
+											   echo esc_attr($value['std']);
1018
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1019 1019
                 </tr><?php
1020
-                break;
1020
+				break;
1021 1021
 
1022
-            case 'map-key':
1023
-                ?>
1022
+			case 'map-key':
1023
+				?>
1024 1024
                 <tr valign="top">
1025 1025
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1026 1026
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1029,17 +1029,17 @@  discard block
 block discarded – undo
1029 1029
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1030 1030
                                            style=" <?php echo esc_attr($value['css']); ?>"
1031 1031
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1032
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1033
-                                           } else {
1034
-                                               echo esc_attr($value['std']);
1035
-                                           } ?>"/>
1032
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1033
+										   } else {
1034
+											   echo esc_attr($value['std']);
1035
+										   } ?>"/>
1036 1036
                     <a href='https://console.developers.google.com/henhouse/?pb=["hh-1","maps_backend",null,[],"https://developers.google.com",null,["static_maps_backend","street_view_image_backend","maps_embed_backend","places_backend","geocoding_backend","directions_backend","distance_matrix_backend","geolocation","elevation_backend","timezone_backend","maps_backend"],null]&TB_iframe=true&width=600&height=400' class="thickbox button-primary" name="<?php _e('Generate API Key - ( MUST be logged in to your Google account )','geodirectory');?>" ><?php _e('Generate API Key','geodirectory');?></a>
1037 1037
                     <span class="description"><?php echo $value['desc']; ?></span></td>
1038 1038
                 </tr><?php
1039
-                break;
1039
+				break;
1040 1040
 
1041
-            case 'password':
1042
-                ?>
1041
+			case 'password':
1042
+				?>
1043 1043
                 <tr valign="top">
1044 1044
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1045 1045
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
@@ -1048,42 +1048,42 @@  discard block
 block discarded – undo
1048 1048
                                            <?php if(isset($value['placeholder'])){?>placeholder="<?php echo esc_attr($value['placeholder']); ?>"<?php }?>
1049 1049
                                            style="<?php echo esc_attr($value['css']); ?>"
1050 1050
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1051
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1052
-                                           } else {
1053
-                                               echo esc_attr($value['std']);
1054
-                                           } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1051
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1052
+										   } else {
1053
+											   echo esc_attr($value['std']);
1054
+										   } ?>"/> <span class="description"><?php echo $value['desc']; ?></span></td>
1055 1055
                 </tr><?php
1056
-                break;
1056
+				break;
1057 1057
 
1058
-            case 'html_content':
1059
-                ?>
1058
+			case 'html_content':
1059
+				?>
1060 1060
                 <tr valign="top">
1061 1061
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1062 1062
                 <td class="forminp"><span class="description"><?php echo $value['desc']; ?></span></td>
1063 1063
                 </tr><?php
1064
-                break;
1064
+				break;
1065 1065
 
1066
-            case 'color' :
1067
-                ?>
1066
+			case 'color' :
1067
+				?>
1068 1068
                 <tr valign="top">
1069 1069
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1070 1070
                 <td class="forminp"><input name="<?php echo esc_attr($value['id']); ?>"
1071 1071
                                            id="<?php echo esc_attr($value['id']); ?>" type="text"
1072 1072
                                            style="<?php echo esc_attr($value['css']); ?>"
1073 1073
                                            value="<?php if (get_option($value['id']) !== false && get_option($value['id']) !== null) {
1074
-                                               echo esc_attr(stripslashes(get_option($value['id'])));
1075
-                                           } else {
1076
-                                               echo esc_attr($value['std']);
1077
-                                           } ?>" class="colorpick"/> <span
1074
+											   echo esc_attr(stripslashes(get_option($value['id'])));
1075
+										   } else {
1076
+											   echo esc_attr($value['std']);
1077
+										   } ?>" class="colorpick"/> <span
1078 1078
                         class="description"><?php echo $value['desc']; ?></span>
1079 1079
 
1080 1080
                     <div id="colorPickerDiv_<?php echo esc_attr($value['id']); ?>" class="colorpickdiv"
1081 1081
                          style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"></div>
1082 1082
                 </td>
1083 1083
                 </tr><?php
1084
-                break;
1085
-            case 'image_width' :
1086
-                ?>
1084
+				break;
1085
+			case 'image_width' :
1086
+				?>
1087 1087
                 <tr valign="top">
1088 1088
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1089 1089
                 <td class="forminp">
@@ -1105,11 +1105,11 @@  discard block
 block discarded – undo
1105 1105
 
1106 1106
                     <span class="description"><?php echo $value['desc'] ?></span></td>
1107 1107
                 </tr><?php
1108
-                break;
1109
-            case 'select':
1110
-                $option_value = get_option($value['id']);
1111
-                $option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1112
-                ?>
1108
+				break;
1109
+			case 'select':
1110
+				$option_value = get_option($value['id']);
1111
+				$option_value = !empty($option_value) ? stripslashes_deep($option_value) : $option_value;
1112
+				?>
1113 1113
                 <tr valign="top">
1114 1114
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1115 1115
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1118,33 +1118,33 @@  discard block
 block discarded – undo
1118 1118
                                             class="<?php if (isset($value['class'])) echo $value['class']; ?>"
1119 1119
                                             option-ajaxchosen="false">
1120 1120
                         <?php
1121
-                        foreach ($value['options'] as $key => $val) {
1122
-                            $geodir_select_value = '';
1123
-                            if ($option_value != '') {
1124
-                                if ($option_value != '' && $option_value == $key)
1125
-                                    $geodir_select_value = ' selected="selected" ';
1126
-                            } else {
1127
-                                if ($value['std'] == $key)
1128
-                                    $geodir_select_value = ' selected="selected" ';
1129
-                            }
1130
-                            ?>
1121
+						foreach ($value['options'] as $key => $val) {
1122
+							$geodir_select_value = '';
1123
+							if ($option_value != '') {
1124
+								if ($option_value != '' && $option_value == $key)
1125
+									$geodir_select_value = ' selected="selected" ';
1126
+							} else {
1127
+								if ($value['std'] == $key)
1128
+									$geodir_select_value = ' selected="selected" ';
1129
+							}
1130
+							?>
1131 1131
                             <option
1132 1132
                                 value="<?php echo esc_attr($key); ?>" <?php echo $geodir_select_value; ?> ><?php echo geodir_utf8_ucfirst($val) ?></option>
1133 1133
                         <?php
1134
-                        }
1135
-                        ?>
1134
+						}
1135
+						?>
1136 1136
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1137 1137
                 </td>
1138 1138
                 </tr><?php
1139
-                break;
1139
+				break;
1140 1140
 
1141
-            case 'multiselect':
1142
-                $option_values = get_option($value['id']);
1143
-                if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1144
-                   $option_values = $value['std'];
1145
-                }
1146
-                $option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1147
-                ?>
1141
+			case 'multiselect':
1142
+				$option_values = get_option($value['id']);
1143
+				if ($option_values === '' && !empty($value['std']) && is_array($value['std'])) {
1144
+				   $option_values = $value['std'];
1145
+				}
1146
+				$option_values = !empty($option_values) ? stripslashes_deep($option_values) : $option_values;
1147
+				?>
1148 1148
                 <tr valign="top">
1149 1149
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1150 1150
                 <td class="forminp"><select multiple="multiple" name="<?php echo esc_attr($value['id']); ?>[]"
@@ -1154,26 +1154,26 @@  discard block
 block discarded – undo
1154 1154
                                             data-placeholder="<?php if (isset($value['placeholder_text'])) echo $value['placeholder_text'];?>"
1155 1155
                                             option-ajaxchosen="false">
1156 1156
                         <?php
1157
-                        foreach ($value['options'] as $key => $val) {
1158
-                            if (strpos($key, 'optgroup_start-') === 0) {
1159
-                                ?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php
1160
-                            } else if (strpos($key, 'optgroup_end-') === 0) {
1161
-                                ?></optgroup><?php
1162
-                            } else {
1163
-                                ?>
1157
+						foreach ($value['options'] as $key => $val) {
1158
+							if (strpos($key, 'optgroup_start-') === 0) {
1159
+								?><optgroup label="<?php echo geodir_utf8_ucfirst($val); ?>"><?php
1160
+							} else if (strpos($key, 'optgroup_end-') === 0) {
1161
+								?></optgroup><?php
1162
+							} else {
1163
+								?>
1164 1164
                                 <option value="<?php echo esc_attr($key); ?>" <?php selected(true, (is_array($option_values) && in_array($key, $option_values)));?>>
1165 1165
                                     <?php echo geodir_utf8_ucfirst($val) ?>
1166 1166
                                 </option>
1167 1167
                             <?php
1168
-                            }
1169
-                        }
1170
-                        ?>
1168
+							}
1169
+						}
1170
+						?>
1171 1171
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1172 1172
                 </td>
1173 1173
                 </tr><?php
1174
-                break;
1175
-            case 'file':
1176
-                ?>
1174
+				break;
1175
+			case 'file':
1176
+				?>
1177 1177
                 <tr valign="top">
1178 1178
                 <th scope="row" class="titledesc"><?php echo $value['name']; ?></th>
1179 1179
                 <td class="forminp">
@@ -1193,87 +1193,87 @@  discard block
 block discarded – undo
1193 1193
                     <?php } ?>
1194 1194
                 </td>
1195 1195
                 </tr><?php
1196
-                break;
1197
-            case 'map_default_settings' :
1198
-                ?>
1196
+				break;
1197
+			case 'map_default_settings' :
1198
+				?>
1199 1199
 
1200 1200
                 <tr valign="top">
1201 1201
                     <th class="titledesc" width="40%"><?php _e('Default map language', 'geodirectory');?></th>
1202 1202
                     <td width="60%">
1203 1203
                         <select name="geodir_default_map_language" style="width:60%">
1204 1204
                             <?php
1205
-                            $arr_map_langages = array(
1206
-                                'ar' => __('ARABIC', 'geodirectory'),
1207
-                                'eu' => __('BASQUE', 'geodirectory'),
1208
-                                'bg' => __('BULGARIAN', 'geodirectory'),
1209
-                                'bn' => __('BENGALI', 'geodirectory'),
1210
-                                'ca' => __('CATALAN', 'geodirectory'),
1211
-                                'cs' => __('CZECH', 'geodirectory'),
1212
-                                'da' => __('DANISH', 'geodirectory'),
1213
-                                'de' => __('GERMAN', 'geodirectory'),
1214
-                                'el' => __('GREEK', 'geodirectory'),
1215
-                                'en' => __('ENGLISH', 'geodirectory'),
1216
-                                'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1217
-                                'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1218
-                                'es' => __('SPANISH', 'geodirectory'),
1219
-                                'eu' => __('BASQUE', 'geodirectory'),
1220
-                                'fa' => __('FARSI', 'geodirectory'),
1221
-                                'fi' => __('FINNISH', 'geodirectory'),
1222
-                                'fil' => __('FILIPINO', 'geodirectory'),
1223
-                                'fr' => __('FRENCH', 'geodirectory'),
1224
-                                'gl' => __('GALICIAN', 'geodirectory'),
1225
-                                'gu' => __('GUJARATI', 'geodirectory'),
1226
-                                'hi' => __('HINDI', 'geodirectory'),
1227
-                                'hr' => __('CROATIAN', 'geodirectory'),
1228
-                                'hu' => __('HUNGARIAN', 'geodirectory'),
1229
-                                'id' => __('INDONESIAN', 'geodirectory'),
1230
-                                'it' => __('ITALIAN', 'geodirectory'),
1231
-                                'iw' => __('HEBREW', 'geodirectory'),
1232
-                                'ja' => __('JAPANESE', 'geodirectory'),
1233
-                                'kn' => __('KANNADA', 'geodirectory'),
1234
-                                'ko' => __('KOREAN', 'geodirectory'),
1235
-                                'lt' => __('LITHUANIAN', 'geodirectory'),
1236
-                                'lv' => __('LATVIAN', 'geodirectory'),
1237
-                                'ml' => __('MALAYALAM', 'geodirectory'),
1238
-                                'mr' => __('MARATHI', 'geodirectory'),
1239
-                                'nl' => __('DUTCH', 'geodirectory'),
1240
-                                'no' => __('NORWEGIAN', 'geodirectory'),
1241
-                                'pl' => __('POLISH', 'geodirectory'),
1242
-                                'pt' => __('PORTUGUESE', 'geodirectory'),
1243
-                                'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1244
-                                'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1245
-                                'ro' => __('ROMANIAN', 'geodirectory'),
1246
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1247
-                                'ru' => __('RUSSIAN', 'geodirectory'),
1248
-                                'sk' => __('SLOVAK', 'geodirectory'),
1249
-                                'sl' => __('SLOVENIAN', 'geodirectory'),
1250
-                                'sr' => __('SERBIAN', 'geodirectory'),
1251
-                                'sv' => __('	SWEDISH', 'geodirectory'),
1252
-                                'tl' => __('TAGALOG', 'geodirectory'),
1253
-                                'ta' => __('TAMIL', 'geodirectory'),
1254
-                                'te' => __('TELUGU', 'geodirectory'),
1255
-                                'th' => __('THAI', 'geodirectory'),
1256
-                                'tr' => __('TURKISH', 'geodirectory'),
1257
-                                'uk' => __('UKRAINIAN', 'geodirectory'),
1258
-                                'vi' => __('VIETNAMESE', 'geodirectory'),
1259
-                                'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1260
-                                'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1261
-                            );
1262
-                            $geodir_default_map_language = get_option('geodir_default_map_language');
1263
-                            if (empty($geodir_default_map_language))
1264
-                                $geodir_default_map_language = 'en';
1265
-                            foreach ($arr_map_langages as $language_key => $language_txt) {
1266
-                                if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1267
-                                    $geodir_default_language_selected = "selected='selected'";
1268
-                                else
1269
-                                    $geodir_default_language_selected = '';
1270
-
1271
-                                ?>
1205
+							$arr_map_langages = array(
1206
+								'ar' => __('ARABIC', 'geodirectory'),
1207
+								'eu' => __('BASQUE', 'geodirectory'),
1208
+								'bg' => __('BULGARIAN', 'geodirectory'),
1209
+								'bn' => __('BENGALI', 'geodirectory'),
1210
+								'ca' => __('CATALAN', 'geodirectory'),
1211
+								'cs' => __('CZECH', 'geodirectory'),
1212
+								'da' => __('DANISH', 'geodirectory'),
1213
+								'de' => __('GERMAN', 'geodirectory'),
1214
+								'el' => __('GREEK', 'geodirectory'),
1215
+								'en' => __('ENGLISH', 'geodirectory'),
1216
+								'en-AU' => __('ENGLISH (AUSTRALIAN)', 'geodirectory'),
1217
+								'en-GB' => __('ENGLISH (GREAT BRITAIN)', 'geodirectory'),
1218
+								'es' => __('SPANISH', 'geodirectory'),
1219
+								'eu' => __('BASQUE', 'geodirectory'),
1220
+								'fa' => __('FARSI', 'geodirectory'),
1221
+								'fi' => __('FINNISH', 'geodirectory'),
1222
+								'fil' => __('FILIPINO', 'geodirectory'),
1223
+								'fr' => __('FRENCH', 'geodirectory'),
1224
+								'gl' => __('GALICIAN', 'geodirectory'),
1225
+								'gu' => __('GUJARATI', 'geodirectory'),
1226
+								'hi' => __('HINDI', 'geodirectory'),
1227
+								'hr' => __('CROATIAN', 'geodirectory'),
1228
+								'hu' => __('HUNGARIAN', 'geodirectory'),
1229
+								'id' => __('INDONESIAN', 'geodirectory'),
1230
+								'it' => __('ITALIAN', 'geodirectory'),
1231
+								'iw' => __('HEBREW', 'geodirectory'),
1232
+								'ja' => __('JAPANESE', 'geodirectory'),
1233
+								'kn' => __('KANNADA', 'geodirectory'),
1234
+								'ko' => __('KOREAN', 'geodirectory'),
1235
+								'lt' => __('LITHUANIAN', 'geodirectory'),
1236
+								'lv' => __('LATVIAN', 'geodirectory'),
1237
+								'ml' => __('MALAYALAM', 'geodirectory'),
1238
+								'mr' => __('MARATHI', 'geodirectory'),
1239
+								'nl' => __('DUTCH', 'geodirectory'),
1240
+								'no' => __('NORWEGIAN', 'geodirectory'),
1241
+								'pl' => __('POLISH', 'geodirectory'),
1242
+								'pt' => __('PORTUGUESE', 'geodirectory'),
1243
+								'pt-BR' => __('PORTUGUESE (BRAZIL)', 'geodirectory'),
1244
+								'pt-PT' => __('PORTUGUESE (PORTUGAL)', 'geodirectory'),
1245
+								'ro' => __('ROMANIAN', 'geodirectory'),
1246
+								'ru' => __('RUSSIAN', 'geodirectory'),
1247
+								'ru' => __('RUSSIAN', 'geodirectory'),
1248
+								'sk' => __('SLOVAK', 'geodirectory'),
1249
+								'sl' => __('SLOVENIAN', 'geodirectory'),
1250
+								'sr' => __('SERBIAN', 'geodirectory'),
1251
+								'sv' => __('	SWEDISH', 'geodirectory'),
1252
+								'tl' => __('TAGALOG', 'geodirectory'),
1253
+								'ta' => __('TAMIL', 'geodirectory'),
1254
+								'te' => __('TELUGU', 'geodirectory'),
1255
+								'th' => __('THAI', 'geodirectory'),
1256
+								'tr' => __('TURKISH', 'geodirectory'),
1257
+								'uk' => __('UKRAINIAN', 'geodirectory'),
1258
+								'vi' => __('VIETNAMESE', 'geodirectory'),
1259
+								'zh-CN' => __('CHINESE (SIMPLIFIED)', 'geodirectory'),
1260
+								'zh-TW' => __('CHINESE (TRADITIONAL)', 'geodirectory'),
1261
+							);
1262
+							$geodir_default_map_language = get_option('geodir_default_map_language');
1263
+							if (empty($geodir_default_map_language))
1264
+								$geodir_default_map_language = 'en';
1265
+							foreach ($arr_map_langages as $language_key => $language_txt) {
1266
+								if (!empty($geodir_default_map_language) && $language_key == $geodir_default_map_language)
1267
+									$geodir_default_language_selected = "selected='selected'";
1268
+								else
1269
+									$geodir_default_language_selected = '';
1270
+
1271
+								?>
1272 1272
                                 <option
1273 1273
                                     value="<?php echo $language_key?>" <?php echo $geodir_default_language_selected; ?>><?php echo $language_txt; ?></option>
1274 1274
 
1275 1275
                             <?php }
1276
-                            ?>
1276
+							?>
1277 1277
                         </select>
1278 1278
                     </td>
1279 1279
                 </tr>
@@ -1284,46 +1284,46 @@  discard block
 block discarded – undo
1284 1284
                     <td width="60%">
1285 1285
                         <select name="geodir_default_map_search_pt" style="width:60%">
1286 1286
                             <?php
1287
-                            $post_types = geodir_get_posttypes('array');
1288
-                            $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1289
-                            if (empty($geodir_default_map_search_pt))
1290
-                                $geodir_default_map_search_pt = 'gd_place';
1291
-                            if (is_array($post_types)) {
1292
-                                foreach ($post_types as $key => $post_types_obj) {
1293
-                                    if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1294
-                                        $geodir_search_pt_selected = "selected='selected'";
1295
-                                    else
1296
-                                        $geodir_search_pt_selected = '';
1297
-
1298
-                                    ?>
1287
+							$post_types = geodir_get_posttypes('array');
1288
+							$geodir_default_map_search_pt = get_option('geodir_default_map_search_pt');
1289
+							if (empty($geodir_default_map_search_pt))
1290
+								$geodir_default_map_search_pt = 'gd_place';
1291
+							if (is_array($post_types)) {
1292
+								foreach ($post_types as $key => $post_types_obj) {
1293
+									if (!empty($geodir_default_map_search_pt) && $key == $geodir_default_map_search_pt)
1294
+										$geodir_search_pt_selected = "selected='selected'";
1295
+									else
1296
+										$geodir_search_pt_selected = '';
1297
+
1298
+									?>
1299 1299
                                     <option
1300 1300
                                         value="<?php echo $key?>" <?php echo $geodir_search_pt_selected; ?>><?php echo __($post_types_obj['labels']['singular_name'], 'geodirectory'); ?></option>
1301 1301
 
1302 1302
                                 <?php }
1303 1303
 
1304
-                            }
1304
+							}
1305 1305
 
1306
-                            ?>
1306
+							?>
1307 1307
                         </select>
1308 1308
                     </td>
1309 1309
                 </tr>
1310 1310
 
1311 1311
                 <?php
1312
-                break;
1312
+				break;
1313 1313
 
1314
-            case 'map':
1315
-                ?>
1314
+			case 'map':
1315
+				?>
1316 1316
                 <tr valign="top">
1317 1317
                     <td class="forminp">
1318 1318
                         <?php
1319
-                        global $post_cat, $cat_display;
1320
-                        $post_types = geodir_get_posttypes('object');
1321
-                        $cat_display = 'checkbox';
1322
-                        $gd_post_types = get_option('geodir_exclude_post_type_on_map');
1323
-                        $gd_cats = get_option('geodir_exclude_cat_on_map');
1324
-                        $gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1325
-                        $count = 1;
1326
-                        ?>
1319
+						global $post_cat, $cat_display;
1320
+						$post_types = geodir_get_posttypes('object');
1321
+						$cat_display = 'checkbox';
1322
+						$gd_post_types = get_option('geodir_exclude_post_type_on_map');
1323
+						$gd_cats = get_option('geodir_exclude_cat_on_map');
1324
+						$gd_cats_upgrade = (int)get_option('geodir_exclude_cat_on_map_upgrade');
1325
+						$count = 1;
1326
+						?>
1327 1327
                         <table width="70%" class="widefat">
1328 1328
                             <thead>
1329 1329
                             <tr>
@@ -1332,18 +1332,18 @@  discard block
 block discarded – undo
1332 1332
                                 <th><b><?php echo DESIGN_POST_TYPE_CAT; ?></b></th>
1333 1333
                             </tr>
1334 1334
                             <?php
1335
-                            $gd_categs = $gd_cats;
1336
-                            foreach ($post_types as $key => $post_types_obj) :
1337
-                                $checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1338
-                                $gd_taxonomy = geodir_get_taxonomies($key);
1339
-                                if ($gd_cats_upgrade) {
1340
-                                    $gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1341
-                                    $gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1342
-                                    $gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1343
-                                }
1344
-                                $post_cat = implode(',', $gd_cats);
1345
-                                $gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1346
-                                ?>
1335
+							$gd_categs = $gd_cats;
1336
+							foreach ($post_types as $key => $post_types_obj) :
1337
+								$checked = is_array($gd_post_types) && in_array($key, $gd_post_types) ? 'checked="checked"' : '';
1338
+								$gd_taxonomy = geodir_get_taxonomies($key);
1339
+								if ($gd_cats_upgrade) {
1340
+									$gd_cat_taxonomy = isset($gd_taxonomy[0]) ? $gd_taxonomy[0] : '';
1341
+									$gd_cats = isset($gd_categs[$gd_cat_taxonomy]) ? $gd_categs[$gd_cat_taxonomy] : array();
1342
+									$gd_cats = !empty($gd_cats) && is_array($gd_cats) ? array_unique($gd_cats) : array();
1343
+								}
1344
+								$post_cat = implode(',', $gd_cats);
1345
+								$gd_taxonomy_list = geodir_custom_taxonomy_walker($gd_taxonomy);
1346
+								?>
1347 1347
                                 <tr>
1348 1348
                                     <td valign="top" width="5%"><?php echo $count; ?></td>
1349 1349
                                     <td valign="top" width="25%" id="td_post_types"><input type="checkbox"
@@ -1364,19 +1364,19 @@  discard block
 block discarded – undo
1364 1364
                     </td>
1365 1365
                 </tr>
1366 1366
                 <?php
1367
-                break;
1367
+				break;
1368 1368
 
1369
-            case 'checkbox' :
1369
+			case 'checkbox' :
1370 1370
 
1371
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1372
-                    ?>
1371
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'start')) :
1372
+					?>
1373 1373
                     <tr valign="top">
1374 1374
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1375 1375
                     <td class="forminp">
1376 1376
                 <?php
1377
-                endif;
1377
+				endif;
1378 1378
 
1379
-                ?>
1379
+				?>
1380 1380
                 <fieldset>
1381 1381
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1382 1382
                     <label for="<?php echo $value['id'] ?>">
@@ -1386,49 +1386,49 @@  discard block
 block discarded – undo
1386 1386
                 </fieldset>
1387 1387
                 <?php
1388 1388
 
1389
-                if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1390
-                    ?>
1389
+				if (!isset($value['checkboxgroup']) || (isset($value['checkboxgroup']) && $value['checkboxgroup'] == 'end')) :
1390
+					?>
1391 1391
                     </td>
1392 1392
                     </tr>
1393 1393
                 <?php
1394
-                endif;
1394
+				endif;
1395 1395
 
1396
-                break;
1396
+				break;
1397 1397
 
1398
-            case 'radio' :
1398
+			case 'radio' :
1399 1399
 
1400
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1401
-                    ?>
1400
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'start')) :
1401
+					?>
1402 1402
                     <tr valign="top">
1403 1403
                     <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1404 1404
                     <td class="forminp">
1405 1405
                 <?php
1406
-                endif;
1406
+				endif;
1407 1407
 
1408
-                ?>
1408
+				?>
1409 1409
                 <fieldset>
1410 1410
                     <legend class="screen-reader-text"><span><?php echo $value['name'] ?></span></legend>
1411 1411
                     <label for="<?php echo $value['id'];?>">
1412 1412
                         <input name="<?php echo esc_attr($value['id']); ?>"
1413 1413
                                id="<?php echo esc_attr($value['id'] . $value['value']); ?>" type="radio"
1414 1414
                                value="<?php echo $value['value'] ?>" <?php if (get_option($value['id']) == $value['value']) {
1415
-                            echo 'checked="checked"';
1416
-                        }elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1415
+							echo 'checked="checked"';
1416
+						}elseif(get_option($value['id'])=='' && $value['std']==$value['value']){echo 'checked="checked"';} ?> />
1417 1417
                         <?php echo $value['desc']; ?></label><br>
1418 1418
                 </fieldset>
1419 1419
                 <?php
1420 1420
 
1421
-                if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1422
-                    ?>
1421
+				if (!isset($value['radiogroup']) || (isset($value['radiogroup']) && $value['radiogroup'] == 'end')) :
1422
+					?>
1423 1423
                     </td>
1424 1424
                     </tr>
1425 1425
                 <?php
1426
-                endif;
1426
+				endif;
1427 1427
 
1428
-                break;
1428
+				break;
1429 1429
 
1430
-            case 'textarea':
1431
-                ?>
1430
+			case 'textarea':
1431
+				?>
1432 1432
                 <tr valign="top">
1433 1433
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1434 1434
                 <td class="forminp">
@@ -1441,30 +1441,30 @@  discard block
 block discarded – undo
1441 1441
 
1442 1442
                 </td>
1443 1443
                 </tr><?php
1444
-                break;
1444
+				break;
1445 1445
 
1446
-            case 'editor':
1447
-                ?>
1446
+			case 'editor':
1447
+				?>
1448 1448
                 <tr valign="top">
1449 1449
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1450 1450
                 <td class="forminp"><?php
1451
-                    if (get_option($value['id']))
1452
-                        $content = stripslashes(get_option($value['id']));
1453
-                    else
1454
-                        $content = $value['std'];
1451
+					if (get_option($value['id']))
1452
+						$content = stripslashes(get_option($value['id']));
1453
+					else
1454
+						$content = $value['std'];
1455 1455
 
1456
-                    $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1456
+					$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
1457 1457
 
1458
-                    wp_editor($content, esc_attr($value['id']), $editor_settings);
1458
+					wp_editor($content, esc_attr($value['id']), $editor_settings);
1459 1459
 
1460
-                    ?> <span class="description"><?php echo $value['desc'] ?></span>
1460
+					?> <span class="description"><?php echo $value['desc'] ?></span>
1461 1461
 
1462 1462
                 </td>
1463 1463
                 </tr><?php
1464
-                break;
1464
+				break;
1465 1465
 
1466
-            case 'single_select_page' :
1467
-                // WPML
1466
+			case 'single_select_page' :
1467
+				// WPML
1468 1468
 				$switch_lang = false;
1469 1469
 				$disabled = '';
1470 1470
 				if (geodir_is_wpml() && isset($_REQUEST['tab']) && $_REQUEST['tab'] == 'permalink_settings') {
@@ -1482,18 +1482,18 @@  discard block
 block discarded – undo
1482 1482
 				//
1483 1483
 				$page_setting = (int)get_option($value['id']);
1484 1484
 
1485
-                $args = array('name' => $value['id'],
1486
-                    'id' => $value['id'],
1487
-                    'sort_column' => 'menu_order',
1488
-                    'sort_order' => 'ASC',
1489
-                    'show_option_none' => ' ',
1490
-                    'class' => $value['class'],
1491
-                    'echo' => false,
1492
-                    'selected' => $page_setting);
1485
+				$args = array('name' => $value['id'],
1486
+					'id' => $value['id'],
1487
+					'sort_column' => 'menu_order',
1488
+					'sort_order' => 'ASC',
1489
+					'show_option_none' => ' ',
1490
+					'class' => $value['class'],
1491
+					'echo' => false,
1492
+					'selected' => $page_setting);
1493 1493
 
1494
-                if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1494
+				if (isset($value['args'])) $args = wp_parse_args($value['args'], $args);
1495 1495
 
1496
-                ?>
1496
+				?>
1497 1497
                 <tr valign="top" class="single_select_page">
1498 1498
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1499 1499
                 <td class="forminp">
@@ -1504,17 +1504,17 @@  discard block
 block discarded – undo
1504 1504
 				if ($switch_lang) {
1505 1505
 					$sitepress->switch_lang($switch_lang, true);
1506 1506
 				}
1507
-                break;
1508
-            case 'single_select_country' :
1509
-                $country_setting = (string)get_option($value['id']);
1510
-                if (strstr($country_setting, ':')) :
1511
-                    $country = current(explode(':', $country_setting));
1512
-                    $state = end(explode(':', $country_setting));
1513
-                else :
1514
-                    $country = $country_setting;
1515
-                    $state = '*';
1516
-                endif;
1517
-                ?>
1507
+				break;
1508
+			case 'single_select_country' :
1509
+				$country_setting = (string)get_option($value['id']);
1510
+				if (strstr($country_setting, ':')) :
1511
+					$country = current(explode(':', $country_setting));
1512
+					$state = end(explode(':', $country_setting));
1513
+				else :
1514
+					$country = $country_setting;
1515
+					$state = '*';
1516
+				endif;
1517
+				?>
1518 1518
                 <tr valign="top">
1519 1519
                 <th scope="rpw" class="titledesc"><?php echo $value['name'] ?></th>
1520 1520
                 <td class="forminp"><select name="<?php echo esc_attr($value['id']); ?>"
@@ -1525,12 +1525,12 @@  discard block
 block discarded – undo
1525 1525
                     </select> <span class="description"><?php echo $value['desc'] ?></span>
1526 1526
                 </td>
1527 1527
                 </tr><?php
1528
-                break;
1529
-            case 'multi_select_countries' :
1530
-                $countries = $geodirectory->countries->countries;
1531
-                asort($countries);
1532
-                $selections = (array)get_option($value['id']);
1533
-                ?>
1528
+				break;
1529
+			case 'multi_select_countries' :
1530
+				$countries = $geodirectory->countries->countries;
1531
+				asort($countries);
1532
+				$selections = (array)get_option($value['id']);
1533
+				?>
1534 1534
                 <tr valign="top">
1535 1535
                 <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1536 1536
                 <td class="forminp">
@@ -1538,21 +1538,21 @@  discard block
 block discarded – undo
1538 1538
                             data-placeholder="<?php _e('Choose countries&hellip;', 'geodirectory'); ?>"
1539 1539
                             title="Country" class="chosen_select">
1540 1540
                         <?php
1541
-                        if ($countries) foreach ($countries as $key => $val) :
1542
-                            echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1543
-                        endforeach;
1544
-                        ?>
1541
+						if ($countries) foreach ($countries as $key => $val) :
1542
+							echo '<option value="' . $key . '" ' . selected(in_array($key, $selections), true, false) . '>' . $val . '</option>';
1543
+						endforeach;
1544
+						?>
1545 1545
                     </select>
1546 1546
                 </td>
1547 1547
                 </tr>
1548 1548
 
1549 1549
                 <?php
1550 1550
 
1551
-                break;
1551
+				break;
1552 1552
 
1553
-            case 'google_analytics' :
1554
-                $selections = (array)get_option($value['id']);
1555
-                    ?>
1553
+			case 'google_analytics' :
1554
+				$selections = (array)get_option($value['id']);
1555
+					?>
1556 1556
                     <tr valign="top">
1557 1557
                         <th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
1558 1558
                         <td class="forminp">
@@ -1560,62 +1560,62 @@  discard block
 block discarded – undo
1560 1560
 
1561 1561
                             <?php
1562 1562
 
1563
-                            $oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1564
-                            $scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1565
-                            $state = "&state=123";//any string
1566
-                            $redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1567
-                            $response_type = "&response_type=code";
1568
-                            $client_id = "&client_id=".get_option('geodir_ga_client_id');
1569
-                            $access_type = "&access_type=offline";
1570
-                            $approval_prompt = "&approval_prompt=force";
1563
+							$oAuthURL = "https://accounts.google.com/o/oauth2/auth?";
1564
+							$scope = "scope=https://www.googleapis.com/auth/analytics.readonly";
1565
+							$state = "&state=123";//any string
1566
+							$redirect_uri = "&redirect_uri=" . admin_url('admin-ajax.php') . "?action=geodir_ga_callback";
1567
+							$response_type = "&response_type=code";
1568
+							$client_id = "&client_id=".get_option('geodir_ga_client_id');
1569
+							$access_type = "&access_type=offline";
1570
+							$approval_prompt = "&approval_prompt=force";
1571 1571
 
1572
-                            $auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1572
+							$auth_url = $oAuthURL . $scope . $state . $redirect_uri . $response_type . $client_id . $access_type . $approval_prompt;
1573 1573
 
1574 1574
 
1575
-                            if (get_option('geodir_ga_auth_token')) {
1576
-                                ?>
1575
+							if (get_option('geodir_ga_auth_token')) {
1576
+								?>
1577 1577
                                 <span class="button-primary"
1578 1578
                                       onclick="gd_GA_Deauthorize('<?php echo wp_create_nonce('gd_ga_deauthorize');?>');"><?php _e('Deauthorize', 'geodirectory'); ?></span>
1579 1579
                                 <span style="color: green; font-weight: bold;"><?php _e('Authorized', 'geodirectory'); ?></span>
1580 1580
                             <?php
1581
-                                global $gd_ga_errors;
1582
-                                if(!empty($gd_ga_errors)){
1583
-                                    print_r($gd_ga_errors);
1584
-                                }
1585
-                            } else {
1586
-                                ?>
1581
+								global $gd_ga_errors;
1582
+								if(!empty($gd_ga_errors)){
1583
+									print_r($gd_ga_errors);
1584
+								}
1585
+							} else {
1586
+								?>
1587 1587
                                 <span class="button-primary"
1588 1588
                                       onclick="window.open('<?php echo  geodir_ga_activation_url();?>', 'activate','width=700, height=600, menubar=0, status=0, location=0, toolbar=0')"><?php _e('Authorize', 'geodirectory');?></span>
1589 1589
                             <?php
1590
-                            }
1591
-                            ?>
1590
+							}
1591
+							?>
1592 1592
                         </td>
1593 1593
                     </tr>
1594 1594
 
1595 1595
                 <?php
1596 1596
 
1597 1597
 
1598
-                break;
1598
+				break;
1599 1599
 
1600
-            case 'field_seperator' :
1600
+			case 'field_seperator' :
1601 1601
 
1602
-                ?>
1602
+				?>
1603 1603
                 <tr valign="top">
1604 1604
                     <td colspan="2" class="forminp geodir_line_seperator"></td>
1605 1605
                 </tr>
1606 1606
                 <?php
1607 1607
 
1608
-                break;
1608
+				break;
1609 1609
 
1610
-        endswitch;
1610
+		endswitch;
1611 1611
 
1612
-    endforeach;
1612
+	endforeach;
1613 1613
 
1614
-    if ($first_title === false) {
1615
-        echo "</div>";
1616
-    }
1614
+	if ($first_title === false) {
1615
+		echo "</div>";
1616
+	}
1617 1617
 
1618
-    ?>
1618
+	?>
1619 1619
 
1620 1620
     <script type="text/javascript">
1621 1621
 
@@ -1675,33 +1675,33 @@  discard block
 block discarded – undo
1675 1675
  */
1676 1676
 function geodir_post_info_setting()
1677 1677
 {
1678
-    global $post, $post_id;
1679
-
1680
-    $post_type = get_post_type();
1681
-
1682
-    $package_info = array();
1683
-
1684
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1685
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1686
-    echo '<div id="geodir_wrapper">';
1687
-    /**
1688
-     * Called before the GD custom fields are output in the wp-admin area.
1689
-     *
1690
-     * @since 1.0.0
1691
-     * @see 'geodir_after_default_field_in_meta_box'
1692
-     */
1693
-    do_action('geodir_before_default_field_in_meta_box');
1694
-    //geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1695
-    // to display all fields in one information box
1696
-    geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1697
-    /**
1698
-     * Called after the GD custom fields are output in the wp-admin area.
1699
-     *
1700
-     * @since 1.0.0
1701
-     * @see 'geodir_before_default_field_in_meta_box'
1702
-     */
1703
-    do_action('geodir_after_default_field_in_meta_box');
1704
-    echo '</div>';
1678
+	global $post, $post_id;
1679
+
1680
+	$post_type = get_post_type();
1681
+
1682
+	$package_info = array();
1683
+
1684
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1685
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_info_noncename');
1686
+	echo '<div id="geodir_wrapper">';
1687
+	/**
1688
+	 * Called before the GD custom fields are output in the wp-admin area.
1689
+	 *
1690
+	 * @since 1.0.0
1691
+	 * @see 'geodir_after_default_field_in_meta_box'
1692
+	 */
1693
+	do_action('geodir_before_default_field_in_meta_box');
1694
+	//geodir_get_custom_fields_html($package_info->pid,'default',$post_type);
1695
+	// to display all fields in one information box
1696
+	geodir_get_custom_fields_html($package_info->pid, 'all', $post_type);
1697
+	/**
1698
+	 * Called after the GD custom fields are output in the wp-admin area.
1699
+	 *
1700
+	 * @since 1.0.0
1701
+	 * @see 'geodir_before_default_field_in_meta_box'
1702
+	 */
1703
+	do_action('geodir_after_default_field_in_meta_box');
1704
+	echo '</div>';
1705 1705
 }
1706 1706
 
1707 1707
 /**
@@ -1714,18 +1714,18 @@  discard block
 block discarded – undo
1714 1714
  */
1715 1715
 function geodir_post_addinfo_setting()
1716 1716
 {
1717
-    global $post, $post_id;
1717
+	global $post, $post_id;
1718 1718
 
1719
-    $post_type = get_post_type();
1719
+	$post_type = get_post_type();
1720 1720
 
1721
-    $package_info = array();
1721
+	$package_info = array();
1722 1722
 
1723
-    $package_info = geodir_post_package_info($package_info, $post, $post_type);
1723
+	$package_info = geodir_post_package_info($package_info, $post, $post_type);
1724 1724
 
1725
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
1726
-    echo '<div id="geodir_wrapper">';
1727
-    geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
1728
-    echo '</div>';
1725
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_addinfo_noncename');
1726
+	echo '<div id="geodir_wrapper">';
1727
+	geodir_get_custom_fields_html($package_info->pid, 'custom', $post_type);
1728
+	echo '</div>';
1729 1729
 
1730 1730
 }
1731 1731
 
@@ -1739,60 +1739,60 @@  discard block
 block discarded – undo
1739 1739
  */
1740 1740
 function geodir_post_attachments()
1741 1741
 {
1742
-    global $post, $post_id;
1742
+	global $post, $post_id;
1743 1743
 
1744
-    wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1744
+	wp_nonce_field(plugin_basename(__FILE__), 'geodir_post_attachments_noncename');
1745 1745
 
1746
-    if (geodir_get_featured_image($post_id, 'thumbnail')) {
1747
-        echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1748
-        geodir_show_featured_image($post_id, 'thumbnail');
1749
-    }
1746
+	if (geodir_get_featured_image($post_id, 'thumbnail')) {
1747
+		echo '<h4>' . __('Featured Image', 'geodirectory') . '</h4>';
1748
+		geodir_show_featured_image($post_id, 'thumbnail');
1749
+	}
1750 1750
 
1751
-    $image_limit = 0;
1751
+	$image_limit = 0;
1752 1752
 
1753
-    ?>
1753
+	?>
1754 1754
 
1755 1755
 
1756 1756
     <h5 class="form_title">
1757 1757
         <?php if ($image_limit != 0 && $image_limit == 1) {
1758
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1759
-        } ?>
1758
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
1759
+		} ?>
1760 1760
         <?php if ($image_limit != 0 && $image_limit > 1) {
1761
-            echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1762
-        } ?>
1761
+			echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
1762
+		} ?>
1763 1763
         <?php if ($image_limit == 0) {
1764
-            echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1765
-        } ?>
1764
+			echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
1765
+		} ?>
1766 1766
     </h5>
1767 1767
 
1768 1768
 
1769 1769
     <?php
1770 1770
 
1771
-    $curImages = geodir_get_images($post_id);
1772
-    $place_img_array = array();
1771
+	$curImages = geodir_get_images($post_id);
1772
+	$place_img_array = array();
1773 1773
 
1774
-    if (!empty($curImages)):
1775
-        foreach ($curImages as $p_img):
1776
-            $place_img_array[] = $p_img->src;
1777
-        endforeach;
1778
-    endif;
1774
+	if (!empty($curImages)):
1775
+		foreach ($curImages as $p_img):
1776
+			$place_img_array[] = $p_img->src;
1777
+		endforeach;
1778
+	endif;
1779 1779
 
1780
-    if (!empty($place_img_array))
1781
-        $curImages = implode(',', $place_img_array);
1780
+	if (!empty($place_img_array))
1781
+		$curImages = implode(',', $place_img_array);
1782 1782
 
1783 1783
 
1784
-    // adjust values here
1785
-    $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
1784
+	// adjust values here
1785
+	$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
1786 1786
 
1787
-    $svalue = $curImages; // this will be initial value of the above form field. Image urls.
1787
+	$svalue = $curImages; // this will be initial value of the above form field. Image urls.
1788 1788
 
1789
-    $multiple = true; // allow multiple files upload
1789
+	$multiple = true; // allow multiple files upload
1790 1790
 
1791
-    $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1791
+	$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1792 1792
 
1793
-    $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1793
+	$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1794 1794
 
1795
-    ?>
1795
+	?>
1796 1796
 
1797 1797
     <div class="gtd-form_row clearfix" id="<?php echo $id; ?>dropbox" style="border:1px solid #999999;padding:5px;text-align:center;">
1798 1798
         <input type="hidden" name="<?php echo $id; ?>" id="<?php echo $id; ?>" value="<?php echo $svalue; ?>"/>
@@ -1834,13 +1834,13 @@  discard block
 block discarded – undo
1834 1834
  */
1835 1835
 function geodir_action_post_updated($post_ID, $post_after, $post_before)
1836 1836
 {
1837
-    $post_type = get_post_type($post_ID);
1837
+	$post_type = get_post_type($post_ID);
1838 1838
 
1839
-    if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1840
-        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) {
1841
-            geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
1842
-        }
1843
-    }
1839
+	if (isset($_POST['action']) && $_POST['action'] == 'inline-save') {
1840
+		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) {
1841
+			geodir_save_post_meta($post_ID, 'post_title', $post_after->post_title);
1842
+		}
1843
+	}
1844 1844
 }
1845 1845
 
1846 1846
 /**
@@ -1855,39 +1855,39 @@  discard block
 block discarded – undo
1855 1855
  */
1856 1856
 function geodir_notification_add_bcc_option($settings)
1857 1857
 {
1858
-    if (!empty($settings)) {
1859
-        $new_settings = array();
1860
-        foreach ($settings as $setting) {
1861
-            if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
1862
-                $geodir_bcc_listing_published_yes = array(
1863
-                    'name' => __('Listing published', 'geodirectory'),
1864
-                    'desc' => __('Yes', 'geodirectory'),
1865
-                    'id' => 'geodir_bcc_listing_published',
1866
-                    'std' => 'yes',
1867
-                    'type' => 'radio',
1868
-                    'value' => '1',
1869
-                    'radiogroup' => 'start'
1870
-                );
1871
-
1872
-                $geodir_bcc_listing_published_no = array(
1873
-                    'name' => __('Listing published', 'geodirectory'),
1874
-                    'desc' => __('No', 'geodirectory'),
1875
-                    'id' => 'geodir_bcc_listing_published',
1876
-                    'std' => 'yes',
1877
-                    'type' => 'radio',
1878
-                    'value' => '0',
1879
-                    'radiogroup' => 'end'
1880
-                );
1881
-
1882
-                $new_settings[] = $geodir_bcc_listing_published_yes;
1883
-                $new_settings[] = $geodir_bcc_listing_published_no;
1884
-            }
1885
-            $new_settings[] = $setting;
1886
-        }
1887
-        $settings = $new_settings;
1888
-    }
1858
+	if (!empty($settings)) {
1859
+		$new_settings = array();
1860
+		foreach ($settings as $setting) {
1861
+			if (isset($setting['id']) && $setting['id'] == 'site_bcc_options' && isset($setting['type']) && $setting['type'] == 'sectionend') {
1862
+				$geodir_bcc_listing_published_yes = array(
1863
+					'name' => __('Listing published', 'geodirectory'),
1864
+					'desc' => __('Yes', 'geodirectory'),
1865
+					'id' => 'geodir_bcc_listing_published',
1866
+					'std' => 'yes',
1867
+					'type' => 'radio',
1868
+					'value' => '1',
1869
+					'radiogroup' => 'start'
1870
+				);
1871
+
1872
+				$geodir_bcc_listing_published_no = array(
1873
+					'name' => __('Listing published', 'geodirectory'),
1874
+					'desc' => __('No', 'geodirectory'),
1875
+					'id' => 'geodir_bcc_listing_published',
1876
+					'std' => 'yes',
1877
+					'type' => 'radio',
1878
+					'value' => '0',
1879
+					'radiogroup' => 'end'
1880
+				);
1881
+
1882
+				$new_settings[] = $geodir_bcc_listing_published_yes;
1883
+				$new_settings[] = $geodir_bcc_listing_published_no;
1884
+			}
1885
+			$new_settings[] = $setting;
1886
+		}
1887
+		$settings = $new_settings;
1888
+	}
1889 1889
 
1890
-    return $settings;
1890
+	return $settings;
1891 1891
 }
1892 1892
 
1893 1893
 
@@ -1902,19 +1902,19 @@  discard block
 block discarded – undo
1902 1902
  */
1903 1903
 function get_gd_theme_compat_callback()
1904 1904
 {
1905
-    global $wpdb;
1906
-    $themes = get_option('gd_theme_compats');
1907
-
1908
-    if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
1909
-        if (isset($_POST['export'])) {
1910
-            echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
1911
-        } else {
1912
-            echo json_encode($themes[$_POST['theme']]);
1913
-        }
1905
+	global $wpdb;
1906
+	$themes = get_option('gd_theme_compats');
1914 1907
 
1915
-    }
1908
+	if (isset($_POST['theme']) && isset($themes[$_POST['theme']]) && !empty($themes[$_POST['theme']])) {
1909
+		if (isset($_POST['export'])) {
1910
+			echo json_encode(array($_POST['theme'] => $themes[$_POST['theme']]));
1911
+		} else {
1912
+			echo json_encode($themes[$_POST['theme']]);
1913
+		}
1914
+
1915
+	}
1916 1916
 
1917
-    die();
1917
+	die();
1918 1918
 }
1919 1919
 
1920 1920
 add_action('wp_ajax_get_gd_theme_compat_import_callback', 'get_gd_theme_compat_import_callback');
@@ -1928,20 +1928,20 @@  discard block
 block discarded – undo
1928 1928
  */
1929 1929
 function get_gd_theme_compat_import_callback()
1930 1930
 {
1931
-    global $wpdb;
1932
-    $themes = get_option('gd_theme_compats');
1933
-    if (isset($_POST['theme']) && !empty($_POST['theme'])) {
1934
-        $json = json_decode(stripslashes($_POST['theme']), true);
1935
-        if (!empty($json) && is_array($json)) {
1936
-            $key = sanitize_text_field(key($json));
1937
-            $themes[$key] = $json[$key];
1938
-            update_option('gd_theme_compats', $themes);
1939
-            echo $key;
1940
-            die();
1941
-        }
1942
-    }
1943
-    echo '0';
1944
-    die();
1931
+	global $wpdb;
1932
+	$themes = get_option('gd_theme_compats');
1933
+	if (isset($_POST['theme']) && !empty($_POST['theme'])) {
1934
+		$json = json_decode(stripslashes($_POST['theme']), true);
1935
+		if (!empty($json) && is_array($json)) {
1936
+			$key = sanitize_text_field(key($json));
1937
+			$themes[$key] = $json[$key];
1938
+			update_option('gd_theme_compats', $themes);
1939
+			echo $key;
1940
+			die();
1941
+		}
1942
+	}
1943
+	echo '0';
1944
+	die();
1945 1945
 }
1946 1946
 
1947 1947
 
@@ -1954,39 +1954,39 @@  discard block
 block discarded – undo
1954 1954
  */
1955 1955
 function gd_set_theme_compat()
1956 1956
 {
1957
-    global $wpdb;
1958
-    $theme = wp_get_theme();
1957
+	global $wpdb;
1958
+	$theme = wp_get_theme();
1959 1959
 
1960
-    if ($theme->parent()) {
1961
-        $theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
1962
-    } else {
1963
-        $theme_name = str_replace(" ", "_", $theme->get('Name'));
1964
-    }
1960
+	if ($theme->parent()) {
1961
+		$theme_name = str_replace(" ", "_", $theme->parent()->get('Name'));
1962
+	} else {
1963
+		$theme_name = str_replace(" ", "_", $theme->get('Name'));
1964
+	}
1965 1965
 
1966
-    $theme_compats = get_option('gd_theme_compats');
1967
-    $current_compat = get_option('gd_theme_compat');
1968
-    $current_compat = str_replace("_custom", "", $current_compat);
1966
+	$theme_compats = get_option('gd_theme_compats');
1967
+	$current_compat = get_option('gd_theme_compat');
1968
+	$current_compat = str_replace("_custom", "", $current_compat);
1969 1969
  
1970
-    if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
1971
-        return;
1972
-    }// if already running correct compat then bail
1970
+	if ($current_compat == $theme_name && strpos(get_option('gd_theme_compat'), "_custom") !== false) {
1971
+		return;
1972
+	}// if already running correct compat then bail
1973 1973
 
1974
-    if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
1975
-        update_option('gd_theme_compat', $theme_name);
1976
-        update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
1974
+	if (isset($theme_compats[$theme_name])) {// if there is a compat avail then set it
1975
+		update_option('gd_theme_compat', $theme_name);
1976
+		update_option('theme_compatibility_setting', $theme_compats[$theme_name]);
1977 1977
 
1978
-        // if there are default options to set then set them
1979
-        if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
1978
+		// if there are default options to set then set them
1979
+		if (isset($theme_compats[$theme_name]['geodir_theme_compat_default_options']) && !empty($theme_compats[$theme_name]['geodir_theme_compat_default_options'])) {
1980 1980
 
1981
-            foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
1982
-                update_option($key, $val);
1983
-            }
1984
-        }
1981
+			foreach ($theme_compats[$theme_name]['geodir_theme_compat_default_options'] as $key => $val) {
1982
+				update_option($key, $val);
1983
+			}
1984
+		}
1985 1985
 
1986
-    } else {
1987
-        update_option('gd_theme_compat', '');
1988
-        update_option('theme_compatibility_setting', '');
1989
-    }
1986
+	} else {
1987
+		update_option('gd_theme_compat', '');
1988
+		update_option('theme_compatibility_setting', '');
1989
+	}
1990 1990
 
1991 1991
 
1992 1992
 }
@@ -2001,9 +2001,9 @@  discard block
 block discarded – undo
2001 2001
  */
2002 2002
 function gd_check_avada_compat()
2003 2003
 {
2004
-    if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2005
-        add_action('admin_notices', 'gd_avada_compat_warning');
2006
-    }
2004
+	if (function_exists('avada_load_textdomain') && !get_option('avada_nag')) {
2005
+		add_action('admin_notices', 'gd_avada_compat_warning');
2006
+	}
2007 2007
 }
2008 2008
 
2009 2009
 
@@ -2016,22 +2016,22 @@  discard block
 block discarded – undo
2016 2016
 function gd_avada_compat_warning()
2017 2017
 {
2018 2018
 
2019
-    /*
2019
+	/*
2020 2020
     $msg_type = error
2021 2021
     $msg_type = updated fade
2022 2022
     $msg_type = update-nag
2023 2023
     */
2024 2024
 
2025
-    $plugin = 'avada-nag';
2026
-    $timestamp = 'avada-nag1234';
2027
-    $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');
2028
-    echo '<div id="' . $timestamp . '"  class="error">';
2029
-    echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2030
-    echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2031
-    echo "<p>$message</p>";
2032
-    echo "</div>";
2025
+	$plugin = 'avada-nag';
2026
+	$timestamp = 'avada-nag1234';
2027
+	$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');
2028
+	echo '<div id="' . $timestamp . '"  class="error">';
2029
+	echo '<span class="gd-remove-noti" onclick="gdRemoveANotification(\'' . $plugin . '\',\'' . $timestamp . '\');" ><i class="fa fa-times"></i></span>';
2030
+	echo "<img class='gd-icon-noti' src='" . plugin_dir_url('') . "geodirectory/geodirectory-assets/images/favicon.ico' > ";
2031
+	echo "<p>$message</p>";
2032
+	echo "</div>";
2033 2033
 
2034
-    ?>
2034
+	?>
2035 2035
     <script>
2036 2036
         function gdRemoveANotification($plugin, $timestamp) {
2037 2037
 
@@ -2099,10 +2099,10 @@  discard block
 block discarded – undo
2099 2099
  */
2100 2100
 function geodir_avada_remove_notification()
2101 2101
 {
2102
-    update_option('avada_nag', TRUE);
2102
+	update_option('avada_nag', TRUE);
2103 2103
 
2104
-    // Always die in functions echoing ajax content
2105
-    die();
2104
+	// Always die in functions echoing ajax content
2105
+	die();
2106 2106
 }
2107 2107
 
2108 2108
 
@@ -2124,11 +2124,11 @@  discard block
 block discarded – undo
2124 2124
 	global $post, $typenow, $current_screen;
2125 2125
 	
2126 2126
 	$post_type = NULL;
2127
-    if (isset($_REQUEST['post_type']))
2127
+	if (isset($_REQUEST['post_type']))
2128 2128
 		$post_type = sanitize_key($_REQUEST['post_type']);
2129
-    elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2129
+	elseif (isset($_REQUEST['post']) && get_post_type($_REQUEST['post']))
2130 2130
 		$post_type = get_post_type($_REQUEST['post']);
2131
-    elseif ($post && isset($post->post_type))
2131
+	elseif ($post && isset($post->post_type))
2132 2132
 		$post_type = $post->post_type;
2133 2133
 	elseif ($typenow)
2134 2134
 		$post_type = $typenow;
@@ -2162,7 +2162,7 @@  discard block
 block discarded – undo
2162 2162
 		// Don't allow same slug url for listing and location
2163 2163
 		if (geodir_strtolower($listing_prefix) == geodir_strtolower($location_prefix)) {
2164 2164
 			$redirect_url = admin_url('admin.php?page=geodirectory&tab=' . $current_tab . '&active_tab=' . $active_tab . '&msg=fail&gderr=21');
2165
-        	wp_redirect($redirect_url);
2165
+			wp_redirect($redirect_url);
2166 2166
 			exit;
2167 2167
 		}
2168 2168
 		
@@ -2192,10 +2192,10 @@  discard block
 block discarded – undo
2192 2192
  * @package GeoDirectory
2193 2193
  */
2194 2194
 function geodir_hide_admin_preview_button() {
2195
-    global $post_type;
2196
-    $post_types = geodir_get_posttypes();
2197
-    if(in_array($post_type, $post_types))
2198
-        echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2195
+	global $post_type;
2196
+	$post_types = geodir_get_posttypes();
2197
+	if(in_array($post_type, $post_types))
2198
+		echo '<style type="text/css">#post-preview, #view-post-btn{display: none;}</style>';
2199 2199
 }
2200 2200
 add_action( 'admin_head-post-new.php', 'geodir_hide_admin_preview_button' );
2201 2201
 add_action( 'admin_head-post.php', 'geodir_hide_admin_preview_button' );
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
  */
2211 2211
 function geodir_import_export_tab( $tabs ) {
2212 2212
 	$tabs['import_export'] = array( 'label' => __( 'Import & Export', 'geodirectory' ) );
2213
-    return $tabs;
2213
+	return $tabs;
2214 2214
 }
2215 2215
 
2216 2216
 /**
@@ -2225,26 +2225,26 @@  discard block
 block discarded – undo
2225 2225
 function geodir_import_export_page() {
2226 2226
 	$nonce = wp_create_nonce( 'geodir_import_export_nonce' );
2227 2227
 	$gd_cats_sample_csv = geodir_plugin_url() . '/geodirectory-assets/gd_sample_categories.csv';
2228
-    /**
2229
-     * Filter sample category data csv file url.
2230
-     *
2231
-     * @since 1.0.0
2232
-     * @package GeoDirectory
2233
-     *
2234
-     * @param string $gd_cats_sample_csv Sample category data csv file url.
2235
-     */
2228
+	/**
2229
+	 * Filter sample category data csv file url.
2230
+	 *
2231
+	 * @since 1.0.0
2232
+	 * @package GeoDirectory
2233
+	 *
2234
+	 * @param string $gd_cats_sample_csv Sample category data csv file url.
2235
+	 */
2236 2236
 	$gd_cats_sample_csv = apply_filters( 'geodir_export_cats_sample_csv', $gd_cats_sample_csv );
2237 2237
 	
2238 2238
 	$gd_posts_sample_csv = geodir_plugin_url() . '/geodirectory-assets/place_listing.csv';
2239
-    /**
2240
-     * Filter sample post data csv file url.
2241
-     *
2242
-     * @since 1.0.0
2243
-     * @package GeoDirectory
2244
-     *
2245
-     * @param string $gd_posts_sample_csv Sample post data csv file url.
2246
-     */
2247
-    $gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2239
+	/**
2240
+	 * Filter sample post data csv file url.
2241
+	 *
2242
+	 * @since 1.0.0
2243
+	 * @package GeoDirectory
2244
+	 *
2245
+	 * @param string $gd_posts_sample_csv Sample post data csv file url.
2246
+	 */
2247
+	$gd_posts_sample_csv = apply_filters( 'geodir_export_posts_sample_csv', $gd_posts_sample_csv );
2248 2248
 	
2249 2249
 	$gd_posttypes = geodir_get_posttypes( 'array' );
2250 2250
 	
@@ -2267,14 +2267,14 @@  discard block
 block discarded – undo
2267 2267
 	$gd_chunksize_options[100000] = 100000;
2268 2268
 	 
2269 2269
 	 /**
2270
-     * Filter max entries per export csv file.
2271
-     *
2272
-     * @since 1.5.6
2273
-     * @package GeoDirectory
2274
-     *
2275
-     * @param string $gd_chunksize_options Entries options.
2276
-     */
2277
-    $gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2270
+	  * Filter max entries per export csv file.
2271
+	  *
2272
+	  * @since 1.5.6
2273
+	  * @package GeoDirectory
2274
+	  *
2275
+	  * @param string $gd_chunksize_options Entries options.
2276
+	  */
2277
+	$gd_chunksize_options = apply_filters( 'geodir_export_csv_chunksize_options', $gd_chunksize_options );
2278 2278
 	
2279 2279
 	$gd_chunksize_option = '';
2280 2280
 	foreach ($gd_chunksize_options as $value => $title) {
@@ -2291,12 +2291,12 @@  discard block
 block discarded – undo
2291 2291
   <div class="gd-content-heading">
2292 2292
 
2293 2293
   <?php
2294
-    ini_set('max_execution_time', 999999);
2295
-    $ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2296
-    ini_restore('max_execution_time');
2294
+	ini_set('max_execution_time', 999999);
2295
+	$ini_max_execution_time_check = @ini_get( 'max_execution_time' );
2296
+	ini_restore('max_execution_time');
2297 2297
 
2298
-    if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2299
-        ?>
2298
+	if($ini_max_execution_time_check != 999999){ // only show these setting to the user if we can't change the ini setting
2299
+		?>
2300 2300
 	<div id="gd_ie_reqs" class="metabox-holder">
2301 2301
       <div class="meta-box-sortables ui-sortable">
2302 2302
         <div class="postbox">
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
 						 * Called just after the sample CSV download link.
2472 2472
 						 *
2473 2473
 						 * @since 1.0.0
2474
-                         * @package GeoDirectory
2474
+						 * @package GeoDirectory
2475 2475
 						 */
2476 2476
 						do_action('geodir_sample_cats_csv_download_link');
2477 2477
 						?>
@@ -2556,11 +2556,11 @@  discard block
 block discarded – undo
2556 2556
 	 *
2557 2557
 	 * Called after the last setting on the GD > Import & Export page.
2558 2558
 	 * @since 1.4.6
2559
-     * @package GeoDirectory
2559
+	 * @package GeoDirectory
2560 2560
 	 *
2561 2561
 	 * @param array $gd_posttypes GD post types.
2562
-     * @param array $gd_chunksize_options File chunk size options.
2563
-     * @param string $nonce Wordpress security token for GD import & export.
2562
+	 * @param array $gd_chunksize_options File chunk size options.
2563
+	 * @param string $nonce Wordpress security token for GD import & export.
2564 2564
 	 */
2565 2565
 	do_action( 'geodir_import_export', $gd_posttypes, $gd_chunksize_options, $nonce );
2566 2566
 	?>
@@ -3247,44 +3247,44 @@  discard block
 block discarded – undo
3247 3247
 function geodir_init_filesystem()
3248 3248
 {
3249 3249
 
3250
-    if(!function_exists('get_filesystem_method')){
3251
-        require_once(ABSPATH."/wp-admin/includes/file.php");
3252
-    }
3253
-    $access_type = get_filesystem_method();
3254
-    if ($access_type === 'direct') {
3255
-        /* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3256
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3257
-
3258
-        /* initialize the API */
3259
-        if (!WP_Filesystem($creds)) {
3260
-            /* any problems and we exit */
3261
-            //return '@@@3';
3262
-            return false;
3263
-        }
3250
+	if(!function_exists('get_filesystem_method')){
3251
+		require_once(ABSPATH."/wp-admin/includes/file.php");
3252
+	}
3253
+	$access_type = get_filesystem_method();
3254
+	if ($access_type === 'direct') {
3255
+		/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
3256
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3257
+
3258
+		/* initialize the API */
3259
+		if (!WP_Filesystem($creds)) {
3260
+			/* any problems and we exit */
3261
+			//return '@@@3';
3262
+			return false;
3263
+		}
3264 3264
 
3265
-        global $wp_filesystem;
3266
-        return $wp_filesystem;
3267
-        /* do our file manipulations below */
3268
-    } elseif (defined('FTP_USER')) {
3269
-        $creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3265
+		global $wp_filesystem;
3266
+		return $wp_filesystem;
3267
+		/* do our file manipulations below */
3268
+	} elseif (defined('FTP_USER')) {
3269
+		$creds = request_filesystem_credentials(trailingslashit(site_url()) . 'wp-admin/', '', false, false, array());
3270
+
3271
+		/* initialize the API */
3272
+		if (!WP_Filesystem($creds)) {
3273
+			/* any problems and we exit */
3274
+			//return '@@@33';
3275
+			return false;
3276
+		}
3270 3277
 
3271
-        /* initialize the API */
3272
-        if (!WP_Filesystem($creds)) {
3273
-            /* any problems and we exit */
3274
-            //return '@@@33';
3275
-            return false;
3276
-        }
3278
+		global $wp_filesystem;
3279
+		//return '@@@1';
3280
+		return $wp_filesystem;
3277 3281
 
3278
-        global $wp_filesystem;
3279
-        //return '@@@1';
3280
-        return $wp_filesystem;
3281
-
3282
-    } else {
3283
-        //return '@@@2';
3284
-        /* don't have direct write access. Prompt user with our notice */
3285
-        add_action('admin_notice', 'geodir_filesystem_notice');
3286
-        return false;
3287
-    }
3282
+	} else {
3283
+		//return '@@@2';
3284
+		/* don't have direct write access. Prompt user with our notice */
3285
+		add_action('admin_notice', 'geodir_filesystem_notice');
3286
+		return false;
3287
+	}
3288 3288
 
3289 3289
 }
3290 3290
 
@@ -3302,10 +3302,10 @@  discard block
 block discarded – undo
3302 3302
  */
3303 3303
 function geodir_filesystem_notice()
3304 3304
 {   if ( defined( 'DOING_AJAX' ) ){return;}
3305
-    $access_type = get_filesystem_method();
3306
-    if ($access_type === 'direct') {
3307
-    } elseif (!defined('FTP_USER')) {
3308
-        ?>
3305
+	$access_type = get_filesystem_method();
3306
+	if ($access_type === 'direct') {
3307
+	} elseif (!defined('FTP_USER')) {
3308
+		?>
3309 3309
         <div class="error">
3310 3310
             <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'); ?>
3311 3311
                 <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>
@@ -3333,1280 +3333,1280 @@  discard block
 block discarded – undo
3333 3333
  * @return string Json data.
3334 3334
  */
3335 3335
 function geodir_ajax_import_export() {
3336
-    global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3336
+	global $wpdb, $plugin_prefix, $current_user, $wp_filesystem;
3337 3337
     
3338
-    error_reporting(0);
3338
+	error_reporting(0);
3339 3339
 
3340
-    $xstart = microtime(true);
3340
+	$xstart = microtime(true);
3341 3341
 
3342
-    // try to set higher limits for import
3343
-    $max_input_time = ini_get('max_input_time');
3344
-    $max_execution_time = ini_get('max_execution_time');
3345
-    $memory_limit= ini_get('memory_limit');
3342
+	// try to set higher limits for import
3343
+	$max_input_time = ini_get('max_input_time');
3344
+	$max_execution_time = ini_get('max_execution_time');
3345
+	$memory_limit= ini_get('memory_limit');
3346 3346
 
3347
-    if(!$max_input_time || $max_input_time<3000){
3348
-        ini_set('max_input_time', 3000);
3349
-    }
3347
+	if(!$max_input_time || $max_input_time<3000){
3348
+		ini_set('max_input_time', 3000);
3349
+	}
3350 3350
 
3351
-    if(!$max_execution_time || $max_execution_time<3000){
3352
-        ini_set('max_execution_time', 3000);
3353
-    }
3351
+	if(!$max_execution_time || $max_execution_time<3000){
3352
+		ini_set('max_execution_time', 3000);
3353
+	}
3354 3354
 
3355
-    if($memory_limit && str_replace('M','',$memory_limit)){
3356
-        if(str_replace('M','',$memory_limit)<256){
3357
-            ini_set('memory_limit', '256M');
3358
-        }
3359
-    }
3355
+	if($memory_limit && str_replace('M','',$memory_limit)){
3356
+		if(str_replace('M','',$memory_limit)<256){
3357
+			ini_set('memory_limit', '256M');
3358
+		}
3359
+	}
3360 3360
 
3361
-    $json = array();
3361
+	$json = array();
3362 3362
 
3363
-    if ( !current_user_can( 'manage_options' ) ) {
3364
-        wp_send_json( $json );
3365
-    }
3363
+	if ( !current_user_can( 'manage_options' ) ) {
3364
+		wp_send_json( $json );
3365
+	}
3366 3366
 
3367
-    $task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3368
-    $nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3369
-    $stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3367
+	$task = isset( $_REQUEST['task'] ) ? $_REQUEST['task'] : NULL;
3368
+	$nonce = isset( $_REQUEST['_nonce'] ) ? $_REQUEST['_nonce'] : NULL;
3369
+	$stat = isset( $_REQUEST['_st'] ) ? $_REQUEST['_st'] : false;
3370 3370
 
3371
-    if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3372
-        wp_send_json( $json );
3373
-    }
3371
+	if ( !wp_verify_nonce( $nonce, 'geodir_import_export_nonce' ) ) {
3372
+		wp_send_json( $json );
3373
+	}
3374 3374
 
3375
-    $post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3376
-    $chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3377
-    $chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3378
-    $chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3375
+	$post_type = isset( $_REQUEST['_pt'] ) ? $_REQUEST['_pt'] : NULL;
3376
+	$chunk_per_page = isset( $_REQUEST['_n'] ) ? absint($_REQUEST['_n']) : NULL;
3377
+	$chunk_per_page = $chunk_per_page < 50 || $chunk_per_page > 100000 ? 5000 : $chunk_per_page;
3378
+	$chunk_page_no = isset( $_REQUEST['_p'] ) ? absint($_REQUEST['_p']) : 1;
3379 3379
 
3380
-    $wp_filesystem = geodir_init_filesystem();
3381
-    if (!$wp_filesystem) {
3382
-        $json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3383
-        wp_send_json( $json );
3384
-    }
3380
+	$wp_filesystem = geodir_init_filesystem();
3381
+	if (!$wp_filesystem) {
3382
+		$json['error'] = __( 'Filesystem ERROR: Could not access filesystem.', 'geodirectory' );
3383
+		wp_send_json( $json );
3384
+	}
3385 3385
 
3386
-    if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3387
-        $json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3388
-        wp_send_json( $json );
3389
-    }
3386
+	if (!empty($wp_filesystem) && isset($wp_filesystem->errors) && is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
3387
+		$json['error'] = __( 'Filesystem ERROR: ' . $wp_filesystem->errors->get_error_message(), 'geodirectory' );
3388
+		wp_send_json( $json );
3389
+	}
3390 3390
 
3391
-    $csv_file_dir = geodir_path_import_export( false );
3392
-    if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3393
-        if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3394
-            $json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3395
-            wp_send_json( $json );
3396
-        }
3397
-    }
3391
+	$csv_file_dir = geodir_path_import_export( false );
3392
+	if ( !$wp_filesystem->is_dir( $csv_file_dir ) ) {
3393
+		if ( !$wp_filesystem->mkdir( $csv_file_dir, FS_CHMOD_DIR ) ) {
3394
+			$json['error'] = __( 'ERROR: Could not create cache directory. This is usually due to inconsistent file permissions.', 'geodirectory' );
3395
+			wp_send_json( $json );
3396
+		}
3397
+	}
3398 3398
     
3399
-    $location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3400
-    $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3401
-
3402
-    switch ( $task ) {
3403
-        case 'export_posts': {
3404
-            // WPML
3405
-            $is_wpml = geodir_is_wpml();
3406
-            if ($is_wpml) {
3407
-                global $sitepress;
3408
-                $active_lang = ICL_LANGUAGE_CODE;
3399
+	$location_manager = function_exists('geodir_location_plugin_activated') ? true : false; // Check location manager installed & active.
3400
+	$neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false;
3401
+
3402
+	switch ( $task ) {
3403
+		case 'export_posts': {
3404
+			// WPML
3405
+			$is_wpml = geodir_is_wpml();
3406
+			if ($is_wpml) {
3407
+				global $sitepress;
3408
+				$active_lang = ICL_LANGUAGE_CODE;
3409 3409
                 
3410
-                $sitepress->switch_lang('all', true);
3411
-            }
3412
-            // WPML
3413
-            if ( $post_type == 'gd_event' ) {
3414
-                add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3415
-            }
3416
-            $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3410
+				$sitepress->switch_lang('all', true);
3411
+			}
3412
+			// WPML
3413
+			if ( $post_type == 'gd_event' ) {
3414
+				add_filter( 'geodir_imex_export_posts_query', 'geodir_imex_get_events_query', 10, 2 );
3415
+			}
3416
+			$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
3417 3417
             
3418
-            $file_name = $post_type . '_' . date( 'dmyHi' );
3419
-            if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3420
-                $file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3421
-            }
3422
-            $posts_count = geodir_get_posts_count( $post_type );
3423
-            $file_url_base = geodir_path_import_export() . '/';
3424
-            $file_url = $file_url_base . $file_name . '.csv';
3425
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3426
-            $file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3418
+			$file_name = $post_type . '_' . date( 'dmyHi' );
3419
+			if ( $filters && isset( $filters['start_date'] ) && isset( $filters['end_date'] ) ) {
3420
+				$file_name = $post_type . '_' . date_i18n( 'dmy', strtotime( $filters['start_date'] ) ) . '_' . date_i18n( 'dmy', strtotime( $filters['end_date'] ) );
3421
+			}
3422
+			$posts_count = geodir_get_posts_count( $post_type );
3423
+			$file_url_base = geodir_path_import_export() . '/';
3424
+			$file_url = $file_url_base . $file_name . '.csv';
3425
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3426
+			$file_path_temp = $csv_file_dir . '/' . $post_type . '_' . $nonce . '.csv';
3427 3427
             
3428
-            $chunk_file_paths = array();
3428
+			$chunk_file_paths = array();
3429 3429
 
3430
-            if ( isset( $_REQUEST['_c'] ) ) {
3431
-                $json['total'] = $posts_count;
3432
-                // WPML
3433
-                if ($is_wpml) {
3434
-                    $sitepress->switch_lang($active_lang, true);
3435
-                }
3436
-                // WPML
3437
-                wp_send_json( $json );
3438
-                gd_die();
3439
-            } else if ( isset( $_REQUEST['_st'] ) ) {
3440
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3441
-                $percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3442
-                $percentage = min( $percentage, 100 );
3430
+			if ( isset( $_REQUEST['_c'] ) ) {
3431
+				$json['total'] = $posts_count;
3432
+				// WPML
3433
+				if ($is_wpml) {
3434
+					$sitepress->switch_lang($active_lang, true);
3435
+				}
3436
+				// WPML
3437
+				wp_send_json( $json );
3438
+				gd_die();
3439
+			} else if ( isset( $_REQUEST['_st'] ) ) {
3440
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3441
+				$percentage = count( $posts_count ) > 0 && $line_count > 0 ? ceil( $line_count / $posts_count ) * 100 : 0;
3442
+				$percentage = min( $percentage, 100 );
3443 3443
                 
3444
-                $json['percentage'] = $percentage;
3445
-                // WPML
3446
-                if ($is_wpml) {
3447
-                    $sitepress->switch_lang($active_lang, true);
3448
-                }
3449
-                // WPML
3450
-                wp_send_json( $json );
3451
-                gd_die();
3452
-            } else {
3453
-                if ( !$posts_count > 0 ) {
3454
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3455
-                } else {
3456
-                    $total_posts = $posts_count;
3457
-                    if ($chunk_per_page > $total_posts) {
3458
-                        $chunk_per_page = $total_posts;
3459
-                    }
3460
-                    $chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3444
+				$json['percentage'] = $percentage;
3445
+				// WPML
3446
+				if ($is_wpml) {
3447
+					$sitepress->switch_lang($active_lang, true);
3448
+				}
3449
+				// WPML
3450
+				wp_send_json( $json );
3451
+				gd_die();
3452
+			} else {
3453
+				if ( !$posts_count > 0 ) {
3454
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3455
+				} else {
3456
+					$total_posts = $posts_count;
3457
+					if ($chunk_per_page > $total_posts) {
3458
+						$chunk_per_page = $total_posts;
3459
+					}
3460
+					$chunk_total_pages = ceil( $total_posts / $chunk_per_page );
3461 3461
                     
3462
-                    $j = $chunk_page_no;
3463
-                    $chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3462
+					$j = $chunk_page_no;
3463
+					$chunk_save_posts = geodir_imex_get_posts( $post_type, $chunk_per_page, $j );
3464 3464
                     
3465
-                    $per_page = 500;
3466
-                    if ($per_page > $chunk_per_page) {
3467
-                        $per_page = $chunk_per_page;
3468
-                    }
3469
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3465
+					$per_page = 500;
3466
+					if ($per_page > $chunk_per_page) {
3467
+						$per_page = $chunk_per_page;
3468
+					}
3469
+					$total_pages = ceil( $chunk_per_page / $per_page );
3470 3470
                     
3471
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3472
-                        $save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3471
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3472
+						$save_posts = array_slice( $chunk_save_posts , ( $i * $per_page ), $per_page );
3473 3473
                         
3474
-                        $clear = $i == 0 ? true : false;
3475
-                        geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3476
-                    }
3474
+						$clear = $i == 0 ? true : false;
3475
+						geodir_save_csv_data( $file_path_temp, $save_posts, $clear );
3476
+					}
3477 3477
                         
3478
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3479
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3480
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3481
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3482
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3478
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3479
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3480
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3481
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3482
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3483 3483
                         
3484
-                        $file_url = $file_url_base . $chunk_file_name;
3485
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3486
-                    }
3484
+						$file_url = $file_url_base . $chunk_file_name;
3485
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3486
+					}
3487 3487
                     
3488
-                    if ( !empty($chunk_file_paths) ) {
3489
-                        $json['total'] = $posts_count;
3490
-                        $json['files'] = $chunk_file_paths;
3491
-                    } else {
3492
-                        if ($j > 1) {
3493
-                            $json['total'] = $posts_count;
3494
-                            $json['files'] = array();
3495
-                        } else {
3496
-                            $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3497
-                        }
3498
-                    }
3499
-                }
3500
-                // WPML
3501
-                if ($is_wpml) {
3502
-                    $sitepress->switch_lang($active_lang, true);
3503
-                }
3504
-                // WPML
3505
-                wp_send_json( $json );
3506
-            }
3507
-        }
3508
-        break;
3509
-        case 'export_cats': {
3510
-            // WPML
3511
-            $is_wpml = geodir_is_wpml();
3512
-            if ($is_wpml) {
3513
-                global $sitepress;
3514
-                $active_lang = ICL_LANGUAGE_CODE;
3488
+					if ( !empty($chunk_file_paths) ) {
3489
+						$json['total'] = $posts_count;
3490
+						$json['files'] = $chunk_file_paths;
3491
+					} else {
3492
+						if ($j > 1) {
3493
+							$json['total'] = $posts_count;
3494
+							$json['files'] = array();
3495
+						} else {
3496
+							$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3497
+						}
3498
+					}
3499
+				}
3500
+				// WPML
3501
+				if ($is_wpml) {
3502
+					$sitepress->switch_lang($active_lang, true);
3503
+				}
3504
+				// WPML
3505
+				wp_send_json( $json );
3506
+			}
3507
+		}
3508
+		break;
3509
+		case 'export_cats': {
3510
+			// WPML
3511
+			$is_wpml = geodir_is_wpml();
3512
+			if ($is_wpml) {
3513
+				global $sitepress;
3514
+				$active_lang = ICL_LANGUAGE_CODE;
3515 3515
                 
3516
-                $sitepress->switch_lang('all', true);
3517
-            }
3518
-            // WPML
3519
-            $file_name = $post_type . 'category_' . date( 'dmyHi' );
3516
+				$sitepress->switch_lang('all', true);
3517
+			}
3518
+			// WPML
3519
+			$file_name = $post_type . 'category_' . date( 'dmyHi' );
3520 3520
             
3521
-            $terms_count = geodir_get_terms_count( $post_type );
3522
-            $file_url_base = geodir_path_import_export() . '/';
3523
-            $file_url = $file_url_base . $file_name . '.csv';
3524
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3525
-            $file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3521
+			$terms_count = geodir_get_terms_count( $post_type );
3522
+			$file_url_base = geodir_path_import_export() . '/';
3523
+			$file_url = $file_url_base . $file_name . '.csv';
3524
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3525
+			$file_path_temp = $csv_file_dir . '/' . $post_type . 'category_' . $nonce . '.csv';
3526 3526
             
3527
-            $chunk_file_paths = array();
3527
+			$chunk_file_paths = array();
3528 3528
             
3529
-            if ( isset( $_REQUEST['_st'] ) ) {
3530
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3531
-                $percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3532
-                $percentage = min( $percentage, 100 );
3529
+			if ( isset( $_REQUEST['_st'] ) ) {
3530
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3531
+				$percentage = count( $terms_count ) > 0 && $line_count > 0 ? ceil( $line_count / $terms_count ) * 100 : 0;
3532
+				$percentage = min( $percentage, 100 );
3533 3533
                 
3534
-                $json['percentage'] = $percentage;
3535
-                // WPML
3536
-                if ($is_wpml) {
3537
-                    $sitepress->switch_lang($active_lang, true);
3538
-                }
3539
-                // WPML
3540
-                wp_send_json( $json );
3541
-            } else {
3542
-                if ( !$terms_count > 0 ) {
3543
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3544
-                } else {
3545
-                    $total_terms = $terms_count;
3546
-                    if ($chunk_per_page > $terms_count) {
3547
-                        $chunk_per_page = $terms_count;
3548
-                    }
3549
-                    $chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3534
+				$json['percentage'] = $percentage;
3535
+				// WPML
3536
+				if ($is_wpml) {
3537
+					$sitepress->switch_lang($active_lang, true);
3538
+				}
3539
+				// WPML
3540
+				wp_send_json( $json );
3541
+			} else {
3542
+				if ( !$terms_count > 0 ) {
3543
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3544
+				} else {
3545
+					$total_terms = $terms_count;
3546
+					if ($chunk_per_page > $terms_count) {
3547
+						$chunk_per_page = $terms_count;
3548
+					}
3549
+					$chunk_total_pages = ceil( $total_terms / $chunk_per_page );
3550 3550
                     
3551
-                    $j = $chunk_page_no;
3552
-                    $chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3551
+					$j = $chunk_page_no;
3552
+					$chunk_save_terms = geodir_imex_get_terms( $post_type, $chunk_per_page, $j );
3553 3553
                     
3554
-                    $per_page = 500;
3555
-                    if ($per_page > $chunk_per_page) {
3556
-                        $per_page = $chunk_per_page;
3557
-                    }
3558
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3554
+					$per_page = 500;
3555
+					if ($per_page > $chunk_per_page) {
3556
+						$per_page = $chunk_per_page;
3557
+					}
3558
+					$total_pages = ceil( $chunk_per_page / $per_page );
3559 3559
                     
3560
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3561
-                        $save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3560
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3561
+						$save_terms = array_slice( $chunk_save_terms , ( $i * $per_page ), $per_page );
3562 3562
                         
3563
-                        $clear = $i == 0 ? true : false;
3564
-                        geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3565
-                    }
3563
+						$clear = $i == 0 ? true : false;
3564
+						geodir_save_csv_data( $file_path_temp, $save_terms, $clear );
3565
+					}
3566 3566
                     
3567
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3568
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3569
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3570
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3571
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3567
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3568
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3569
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3570
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3571
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3572 3572
                         
3573
-                        $file_url = $file_url_base . $chunk_file_name;
3574
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3575
-                    }
3573
+						$file_url = $file_url_base . $chunk_file_name;
3574
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3575
+					}
3576 3576
                     
3577
-                    if ( !empty($chunk_file_paths) ) {
3578
-                        $json['total'] = $terms_count;
3579
-                        $json['files'] = $chunk_file_paths;
3580
-                    } else {
3581
-                        $json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3582
-                    }
3583
-                }
3584
-                // WPML
3585
-                if ($is_wpml) {
3586
-                    $sitepress->switch_lang($active_lang, true);
3587
-                }
3588
-                // WPML
3589
-                wp_send_json( $json );
3590
-            }
3591
-        }
3592
-        break;
3593
-        case 'export_locations': {
3594
-            $file_url_base = geodir_path_import_export() . '/';
3595
-            $file_name = 'gd_locations_' . date( 'dmyHi' );
3596
-            $file_url = $file_url_base . $file_name . '.csv';
3597
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3598
-            $file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3577
+					if ( !empty($chunk_file_paths) ) {
3578
+						$json['total'] = $terms_count;
3579
+						$json['files'] = $chunk_file_paths;
3580
+					} else {
3581
+						$json['error'] = __( 'ERROR: Could not create csv file. This is usually due to inconsistent file permissions.', 'geodirectory' );
3582
+					}
3583
+				}
3584
+				// WPML
3585
+				if ($is_wpml) {
3586
+					$sitepress->switch_lang($active_lang, true);
3587
+				}
3588
+				// WPML
3589
+				wp_send_json( $json );
3590
+			}
3591
+		}
3592
+		break;
3593
+		case 'export_locations': {
3594
+			$file_url_base = geodir_path_import_export() . '/';
3595
+			$file_name = 'gd_locations_' . date( 'dmyHi' );
3596
+			$file_url = $file_url_base . $file_name . '.csv';
3597
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3598
+			$file_path_temp = $csv_file_dir . '/gd_locations_' . $nonce . '.csv';
3599 3599
             
3600
-            $items_count = (int)geodir_location_imex_count_locations();
3600
+			$items_count = (int)geodir_location_imex_count_locations();
3601 3601
             
3602
-            if ( isset( $_REQUEST['_st'] ) ) {
3603
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3604
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3605
-                $percentage = min( $percentage, 100 );
3602
+			if ( isset( $_REQUEST['_st'] ) ) {
3603
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3604
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3605
+				$percentage = min( $percentage, 100 );
3606 3606
                 
3607
-                $json['percentage'] = $percentage;
3608
-                wp_send_json( $json );
3609
-            } else {
3610
-                $chunk_file_paths = array();
3607
+				$json['percentage'] = $percentage;
3608
+				wp_send_json( $json );
3609
+			} else {
3610
+				$chunk_file_paths = array();
3611 3611
                 
3612
-                if ( !$items_count > 0 ) {
3613
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3614
-                } else {
3615
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3616
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3612
+				if ( !$items_count > 0 ) {
3613
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3614
+				} else {
3615
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3616
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3617 3617
                     
3618
-                    $j = $chunk_page_no;
3619
-                    $chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3618
+					$j = $chunk_page_no;
3619
+					$chunk_save_items = geodir_location_imex_locations_data( $chunk_per_page, $j );
3620 3620
                     
3621
-                    $per_page = 500;
3622
-                    $per_page = min( $per_page, $chunk_per_page );
3623
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3621
+					$per_page = 500;
3622
+					$per_page = min( $per_page, $chunk_per_page );
3623
+					$total_pages = ceil( $chunk_per_page / $per_page );
3624 3624
                     
3625
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3626
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3625
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3626
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3627 3627
                         
3628
-                        $clear = $i == 0 ? true : false;
3629
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3630
-                    }
3628
+						$clear = $i == 0 ? true : false;
3629
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3630
+					}
3631 3631
                     
3632
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3633
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3634
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3635
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3636
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3632
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3633
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3634
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3635
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3636
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3637 3637
                         
3638
-                        $file_url = $file_url_base . $chunk_file_name;
3639
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3640
-                    }
3638
+						$file_url = $file_url_base . $chunk_file_name;
3639
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3640
+					}
3641 3641
                     
3642
-                    if ( !empty($chunk_file_paths) ) {
3643
-                        $json['total'] = $items_count;
3644
-                        $json['files'] = $chunk_file_paths;
3645
-                    } else {
3646
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3647
-                    }
3648
-                }
3649
-                wp_send_json( $json );
3650
-            }
3651
-        }
3652
-        break;
3653
-        case 'export_hoods': {
3654
-            $file_url_base = geodir_path_import_export() . '/';
3655
-            $file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3656
-            $file_url = $file_url_base . $file_name . '.csv';
3657
-            $file_path = $csv_file_dir . '/' . $file_name . '.csv';
3658
-            $file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3642
+					if ( !empty($chunk_file_paths) ) {
3643
+						$json['total'] = $items_count;
3644
+						$json['files'] = $chunk_file_paths;
3645
+					} else {
3646
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3647
+					}
3648
+				}
3649
+				wp_send_json( $json );
3650
+			}
3651
+		}
3652
+		break;
3653
+		case 'export_hoods': {
3654
+			$file_url_base = geodir_path_import_export() . '/';
3655
+			$file_name = 'gd_neighbourhoods_' . date( 'dmyHi' );
3656
+			$file_url = $file_url_base . $file_name . '.csv';
3657
+			$file_path = $csv_file_dir . '/' . $file_name . '.csv';
3658
+			$file_path_temp = $csv_file_dir . '/gd_neighbourhoods_' . $nonce . '.csv';
3659 3659
             
3660
-            $items_count = (int)geodir_location_imex_count_neighbourhoods();
3660
+			$items_count = (int)geodir_location_imex_count_neighbourhoods();
3661 3661
             
3662
-            if ( isset( $_REQUEST['_st'] ) ) {
3663
-                $line_count = (int)geodir_import_export_line_count( $file_path_temp );
3664
-                $percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3665
-                $percentage = min( $percentage, 100 );
3662
+			if ( isset( $_REQUEST['_st'] ) ) {
3663
+				$line_count = (int)geodir_import_export_line_count( $file_path_temp );
3664
+				$percentage = count( $items_count ) > 0 && $line_count > 0 ? ceil( $line_count / $items_count ) * 100 : 0;
3665
+				$percentage = min( $percentage, 100 );
3666 3666
                 
3667
-                $json['percentage'] = $percentage;
3668
-                wp_send_json( $json );
3669
-            } else {
3670
-                $chunk_file_paths = array();
3667
+				$json['percentage'] = $percentage;
3668
+				wp_send_json( $json );
3669
+			} else {
3670
+				$chunk_file_paths = array();
3671 3671
                 
3672
-                if ( !$items_count > 0 ) {
3673
-                    $json['error'] = __( 'No records to export.', 'geodirectory' );
3674
-                } else {
3675
-                    $chunk_per_page = min( $chunk_per_page, $items_count );
3676
-                    $chunk_total_pages = ceil( $items_count / $chunk_per_page );
3672
+				if ( !$items_count > 0 ) {
3673
+					$json['error'] = __( 'No records to export.', 'geodirectory' );
3674
+				} else {
3675
+					$chunk_per_page = min( $chunk_per_page, $items_count );
3676
+					$chunk_total_pages = ceil( $items_count / $chunk_per_page );
3677 3677
                     
3678
-                    $j = $chunk_page_no;
3679
-                    $chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3678
+					$j = $chunk_page_no;
3679
+					$chunk_save_items = geodir_location_imex_neighbourhoods_data( $chunk_per_page, $j );
3680 3680
                     
3681
-                    $per_page = 500;
3682
-                    $per_page = min( $per_page, $chunk_per_page );
3683
-                    $total_pages = ceil( $chunk_per_page / $per_page );
3681
+					$per_page = 500;
3682
+					$per_page = min( $per_page, $chunk_per_page );
3683
+					$total_pages = ceil( $chunk_per_page / $per_page );
3684 3684
                     
3685
-                    for ( $i = 0; $i <= $total_pages; $i++ ) {
3686
-                        $save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3685
+					for ( $i = 0; $i <= $total_pages; $i++ ) {
3686
+						$save_items = array_slice( $chunk_save_items , ( $i * $per_page ), $per_page );
3687 3687
                         
3688
-                        $clear = $i == 0 ? true : false;
3689
-                        geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3690
-                    }
3688
+						$clear = $i == 0 ? true : false;
3689
+						geodir_save_csv_data( $file_path_temp, $save_items, $clear );
3690
+					}
3691 3691
                     
3692
-                    if ( $wp_filesystem->exists( $file_path_temp ) ) {
3693
-                        $chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3694
-                        $chunk_file_name = $file_name . $chunk_page_no . '.csv';
3695
-                        $file_path = $csv_file_dir . '/' . $chunk_file_name;
3696
-                        $wp_filesystem->move( $file_path_temp, $file_path, true );
3692
+					if ( $wp_filesystem->exists( $file_path_temp ) ) {
3693
+						$chunk_page_no = $chunk_total_pages > 1 ? '-' . $j : '';
3694
+						$chunk_file_name = $file_name . $chunk_page_no . '.csv';
3695
+						$file_path = $csv_file_dir . '/' . $chunk_file_name;
3696
+						$wp_filesystem->move( $file_path_temp, $file_path, true );
3697 3697
                         
3698
-                        $file_url = $file_url_base . $chunk_file_name;
3699
-                        $chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3700
-                    }
3698
+						$file_url = $file_url_base . $chunk_file_name;
3699
+						$chunk_file_paths[] = array('i' => $j . '.', 'u' => $file_url, 's' => size_format(filesize($file_path), 2));
3700
+					}
3701 3701
                     
3702
-                    if ( !empty($chunk_file_paths) ) {
3703
-                        $json['total'] = $items_count;
3704
-                        $json['files'] = $chunk_file_paths;
3705
-                    } else {
3706
-                        $json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3707
-                    }
3708
-                }
3709
-                wp_send_json( $json );
3710
-            }
3711
-        }
3712
-        break;
3713
-        case 'prepare_import':
3714
-        case 'import_cat':
3715
-        case 'import_post':
3716
-        case 'import_loc':
3717
-        case 'import_hood': {
3718
-            // WPML
3719
-            $is_wpml = geodir_is_wpml();
3720
-            if ($is_wpml) {
3721
-                global $sitepress;
3722
-                $active_lang = ICL_LANGUAGE_CODE;
3723
-            }
3724
-            // WPML
3702
+					if ( !empty($chunk_file_paths) ) {
3703
+						$json['total'] = $items_count;
3704
+						$json['files'] = $chunk_file_paths;
3705
+					} else {
3706
+						$json['error'] = __( 'Fail, something wrong to create csv file.', 'geodirectory' );
3707
+					}
3708
+				}
3709
+				wp_send_json( $json );
3710
+			}
3711
+		}
3712
+		break;
3713
+		case 'prepare_import':
3714
+		case 'import_cat':
3715
+		case 'import_post':
3716
+		case 'import_loc':
3717
+		case 'import_hood': {
3718
+			// WPML
3719
+			$is_wpml = geodir_is_wpml();
3720
+			if ($is_wpml) {
3721
+				global $sitepress;
3722
+				$active_lang = ICL_LANGUAGE_CODE;
3723
+			}
3724
+			// WPML
3725 3725
             
3726
-            ini_set( 'auto_detect_line_endings', true );
3726
+			ini_set( 'auto_detect_line_endings', true );
3727 3727
             
3728
-            $uploads = wp_upload_dir();
3729
-            $uploads_dir = $uploads['path'];
3730
-            $uploads_subdir = $uploads['subdir'];
3728
+			$uploads = wp_upload_dir();
3729
+			$uploads_dir = $uploads['path'];
3730
+			$uploads_subdir = $uploads['subdir'];
3731 3731
             
3732
-            $csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3733
-            $import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3732
+			$csv_file = isset( $_POST['_file'] ) ? $_POST['_file'] : NULL;
3733
+			$import_choice = isset( $_REQUEST['_ch'] ) ? $_REQUEST['_ch'] : 'skip';
3734 3734
             
3735
-            $csv_file_arr = explode( '/', $csv_file );
3736
-            $csv_filename = end( $csv_file_arr );
3737
-            $target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3735
+			$csv_file_arr = explode( '/', $csv_file );
3736
+			$csv_filename = end( $csv_file_arr );
3737
+			$target_path = $uploads_dir . '/temp_' . $current_user->data->ID . '/' . $csv_filename;
3738 3738
             
3739
-            $json['file'] = $csv_file;
3740
-            $json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3741
-            $file = array();
3739
+			$json['file'] = $csv_file;
3740
+			$json['error'] = __( 'The uploaded file is not a valid csv file. Please try again.', 'geodirectory' );
3741
+			$file = array();
3742 3742
 
3743
-            if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3744
-                $wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3743
+			if ( $csv_file && $wp_filesystem->is_file( $target_path ) && $wp_filesystem->exists( $target_path ) ) {
3744
+				$wp_filetype = wp_check_filetype_and_ext( $target_path, $csv_filename );
3745 3745
                 
3746
-                if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3747
-                    $json['error'] = NULL;
3748
-
3749
-                    $lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3750
-                    setlocale(LC_ALL, 'en_US.UTF-8');
3751
-                    if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3752
-                        while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3753
-                            if ( !empty( $data ) ) {
3754
-                                $file[] = $data;
3755
-                            }
3756
-                        }
3757
-                        fclose($handle);
3758
-                    }
3759
-                    setlocale(LC_ALL, $lc_all);
3746
+				if (!empty($wp_filetype) && isset($wp_filetype['ext']) && geodir_strtolower($wp_filetype['ext']) == 'csv') {
3747
+					$json['error'] = NULL;
3748
+
3749
+					$lc_all = setlocale(LC_ALL, 0); // Fix issue of fgetcsv ignores special characters when they are at the beginning of line
3750
+					setlocale(LC_ALL, 'en_US.UTF-8');
3751
+					if ( ( $handle = fopen($target_path, "r" ) ) !== FALSE ) {
3752
+						while ( ( $data = fgetcsv( $handle, 100000, "," ) ) !== FALSE ) {
3753
+							if ( !empty( $data ) ) {
3754
+								$file[] = $data;
3755
+							}
3756
+						}
3757
+						fclose($handle);
3758
+					}
3759
+					setlocale(LC_ALL, $lc_all);
3760 3760
 
3761
-                    $json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3761
+					$json['rows'] = (!empty($file) && count($file) > 1) ? count($file) - 1 : 0;
3762 3762
                     
3763
-                    if (!$json['rows'] > 0) {
3764
-                        $json['error'] = __('No data found in csv file.', 'geodirectory');
3765
-                    }
3766
-                } else {
3767
-                    wp_send_json( $json );
3768
-                }
3769
-            } else {
3770
-                wp_send_json( $json );
3771
-            }
3763
+					if (!$json['rows'] > 0) {
3764
+						$json['error'] = __('No data found in csv file.', 'geodirectory');
3765
+					}
3766
+				} else {
3767
+					wp_send_json( $json );
3768
+				}
3769
+			} else {
3770
+				wp_send_json( $json );
3771
+			}
3772 3772
             
3773
-            if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3774
-                wp_send_json( $json );
3775
-            }
3773
+			if ( $task == 'prepare_import' || !empty( $json['error'] ) ) {
3774
+				wp_send_json( $json );
3775
+			}
3776 3776
             
3777
-            $total = $json['rows'];
3778
-            $limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3779
-            $processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3777
+			$total = $json['rows'];
3778
+			$limit = isset($_POST['limit']) ? (int)$_POST['limit'] : 1;
3779
+			$processed = isset($_POST['processed']) ? (int)$_POST['processed'] : 0;
3780 3780
             
3781
-            $count = $limit;
3781
+			$count = $limit;
3782 3782
             
3783
-            if ($count < $total) {
3784
-                $count = $processed + $count;
3785
-                if ($count > $total) {
3786
-                    $count = $total;
3787
-                }
3788
-            } else {
3789
-                $count = $total;
3790
-            }
3783
+			if ($count < $total) {
3784
+				$count = $processed + $count;
3785
+				if ($count > $total) {
3786
+					$count = $total;
3787
+				}
3788
+			} else {
3789
+				$count = $total;
3790
+			}
3791 3791
             
3792
-            $created = 0;
3793
-            $updated = 0;
3794
-            $skipped = 0;
3795
-            $invalid = 0;
3796
-            $invalid_addr = 0;
3797
-            $images = 0;
3792
+			$created = 0;
3793
+			$updated = 0;
3794
+			$skipped = 0;
3795
+			$invalid = 0;
3796
+			$invalid_addr = 0;
3797
+			$images = 0;
3798 3798
             
3799
-            $gd_post_info = array();
3800
-            $countpost = 0;
3799
+			$gd_post_info = array();
3800
+			$countpost = 0;
3801 3801
             
3802
-            $post_types = geodir_get_posttypes();
3802
+			$post_types = geodir_get_posttypes();
3803 3803
 
3804
-            if ( $task == 'import_cat' ) {
3805
-                if (!empty($file)) {
3806
-                    $columns = isset($file[0]) ? $file[0] : NULL;
3804
+			if ( $task == 'import_cat' ) {
3805
+				if (!empty($file)) {
3806
+					$columns = isset($file[0]) ? $file[0] : NULL;
3807 3807
                     
3808
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3809
-                        $json['error'] = CSV_INVAILD_FILE;
3810
-                        wp_send_json( $json );
3811
-                        exit;
3812
-                    }
3808
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
3809
+						$json['error'] = CSV_INVAILD_FILE;
3810
+						wp_send_json( $json );
3811
+						exit;
3812
+					}
3813 3813
                     
3814
-                    $gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3814
+					$gd_error_log = __('GD IMPORT CATEGORIES [ROW %d]:', 'geodirectory');
3815 3815
                     
3816
-                    for ($i = 1; $i <= $limit; $i++) {
3817
-                        $index = $processed + $i;
3816
+					for ($i = 1; $i <= $limit; $i++) {
3817
+						$index = $processed + $i;
3818 3818
                         
3819
-                        if (isset($file[$index])) {
3820
-                            $row = $file[$index];
3821
-                            $row = array_map( 'trim', $row );
3822
-                            //$row = array_map( 'utf8_encode', $row );
3819
+						if (isset($file[$index])) {
3820
+							$row = $file[$index];
3821
+							$row = array_map( 'trim', $row );
3822
+							//$row = array_map( 'utf8_encode', $row );
3823 3823
                             
3824
-                            $cat_id = '';
3825
-                            $cat_name = '';
3826
-                            $cat_slug = '';
3827
-                            $cat_posttype = '';
3828
-                            $cat_parent = '';
3829
-                            $cat_description = '';
3830
-                            $cat_schema = '';
3831
-                            $cat_top_description = '';
3832
-                            $cat_image = '';
3833
-                            $cat_icon = '';
3834
-                            $cat_language = '';
3835
-                            $cat_id_original = '';
3824
+							$cat_id = '';
3825
+							$cat_name = '';
3826
+							$cat_slug = '';
3827
+							$cat_posttype = '';
3828
+							$cat_parent = '';
3829
+							$cat_description = '';
3830
+							$cat_schema = '';
3831
+							$cat_top_description = '';
3832
+							$cat_image = '';
3833
+							$cat_icon = '';
3834
+							$cat_language = '';
3835
+							$cat_id_original = '';
3836 3836
                             
3837
-                            $c = 0;
3838
-                            foreach ($columns as $column ) {
3839
-                                if ( $column == 'cat_id' ) {
3840
-                                    $cat_id = (int)$row[$c];
3841
-                                } else if ( $column == 'cat_name' ) {
3842
-                                    $cat_name = $row[$c];
3843
-                                } else if ( $column == 'cat_slug' ) {
3844
-                                    $cat_slug = $row[$c];
3845
-                                } else if ( $column == 'cat_posttype' ) {
3846
-                                    $cat_posttype = $row[$c];
3847
-                                } else if ( $column == 'cat_parent' ) {
3848
-                                    $cat_parent = trim($row[$c]);
3849
-                                } else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3850
-                                    $cat_schema = $row[$c];
3851
-                                } else if ( $column == 'cat_description' ) {
3852
-                                    $cat_description = $row[$c];
3853
-                                } else if ( $column == 'cat_top_description' ) {
3854
-                                    $cat_top_description = $row[$c];
3855
-                                } else if ( $column == 'cat_image' ) {
3856
-                                    $cat_image = $row[$c];
3857
-                                } else if ( $column == 'cat_icon' ) {
3858
-                                    $cat_icon = $row[$c];
3859
-                                }
3860
-                                // WPML
3861
-                                if ( $is_wpml ) {
3862
-                                    if ( $column == 'cat_language' ) {
3863
-                                        $cat_language = geodir_strtolower( trim( $row[$c] ) );
3864
-                                    } else if ( $column == 'cat_id_original' ) {
3865
-                                        $cat_id_original = (int)$row[$c];
3866
-                                    }
3867
-                                }
3868
-                                // WPML
3869
-                                $c++;
3870
-                            }
3837
+							$c = 0;
3838
+							foreach ($columns as $column ) {
3839
+								if ( $column == 'cat_id' ) {
3840
+									$cat_id = (int)$row[$c];
3841
+								} else if ( $column == 'cat_name' ) {
3842
+									$cat_name = $row[$c];
3843
+								} else if ( $column == 'cat_slug' ) {
3844
+									$cat_slug = $row[$c];
3845
+								} else if ( $column == 'cat_posttype' ) {
3846
+									$cat_posttype = $row[$c];
3847
+								} else if ( $column == 'cat_parent' ) {
3848
+									$cat_parent = trim($row[$c]);
3849
+								} else if ( $column == 'cat_schema' && $row[$c] != '' ) {
3850
+									$cat_schema = $row[$c];
3851
+								} else if ( $column == 'cat_description' ) {
3852
+									$cat_description = $row[$c];
3853
+								} else if ( $column == 'cat_top_description' ) {
3854
+									$cat_top_description = $row[$c];
3855
+								} else if ( $column == 'cat_image' ) {
3856
+									$cat_image = $row[$c];
3857
+								} else if ( $column == 'cat_icon' ) {
3858
+									$cat_icon = $row[$c];
3859
+								}
3860
+								// WPML
3861
+								if ( $is_wpml ) {
3862
+									if ( $column == 'cat_language' ) {
3863
+										$cat_language = geodir_strtolower( trim( $row[$c] ) );
3864
+									} else if ( $column == 'cat_id_original' ) {
3865
+										$cat_id_original = (int)$row[$c];
3866
+									}
3867
+								}
3868
+								// WPML
3869
+								$c++;
3870
+							}
3871 3871
                             
3872
-                            if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3873
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3872
+							if ( $cat_name == '' || !in_array( $cat_posttype, $post_types ) ) {
3873
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
3874 3874
                                 
3875
-                                $invalid++;
3876
-                                continue;
3877
-                            }
3875
+								$invalid++;
3876
+								continue;
3877
+							}
3878 3878
                             
3879
-                            // WPML
3880
-                            if ($is_wpml && $cat_language != '') {
3881
-                                $sitepress->switch_lang($cat_language, true);
3882
-                            }
3883
-                            // WPML
3879
+							// WPML
3880
+							if ($is_wpml && $cat_language != '') {
3881
+								$sitepress->switch_lang($cat_language, true);
3882
+							}
3883
+							// WPML
3884 3884
                                                         
3885
-                            $term_data = array();
3886
-                            $term_data['name'] = $cat_name;
3887
-                            $term_data['slug'] = $cat_slug;
3888
-                            $term_data['description'] = $cat_description;
3889
-                            $term_data['cat_schema'] = $cat_schema;
3890
-                            $term_data['top_description'] = $cat_top_description;
3891
-                            $term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3892
-                            $term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3885
+							$term_data = array();
3886
+							$term_data['name'] = $cat_name;
3887
+							$term_data['slug'] = $cat_slug;
3888
+							$term_data['description'] = $cat_description;
3889
+							$term_data['cat_schema'] = $cat_schema;
3890
+							$term_data['top_description'] = $cat_top_description;
3891
+							$term_data['image'] = $cat_image != '' ? basename( $cat_image ) : '';
3892
+							$term_data['icon'] = $cat_icon != '' ? basename( $cat_icon ) : '';
3893 3893
                             
3894
-                            //$term_data = array_map( 'utf8_encode', $term_data );
3894
+							//$term_data = array_map( 'utf8_encode', $term_data );
3895 3895
                             
3896
-                            $taxonomy = $cat_posttype . 'category';
3896
+							$taxonomy = $cat_posttype . 'category';
3897 3897
                             
3898
-                            $term_data['taxonomy'] = $taxonomy;
3898
+							$term_data['taxonomy'] = $taxonomy;
3899 3899
 
3900
-                            $term_parent_id = 0;
3901
-                            if ($cat_parent != "" || (int)$cat_parent > 0) {
3902
-                                $term_parent = '';
3900
+							$term_parent_id = 0;
3901
+							if ($cat_parent != "" || (int)$cat_parent > 0) {
3902
+								$term_parent = '';
3903 3903
                                 
3904
-                                if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3905
-                                    //
3906
-                                } else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3907
-                                    //
3908
-                                } else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3909
-                                    //
3910
-                                } else {
3911
-                                    $term_parent_data = array();
3912
-                                    $term_parent_data['name'] = $cat_parent;
3913
-                                    //$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3914
-                                    $term_parent_data['taxonomy'] = $taxonomy;
3904
+								if ( $term_parent = get_term_by( 'name', $cat_parent, $taxonomy ) ) {
3905
+									//
3906
+								} else if ( $term_parent = get_term_by( 'slug', $cat_parent, $taxonomy ) ) {
3907
+									//
3908
+								} else if ( $term_parent = get_term_by( 'id', $cat_parent, $taxonomy ) ) {
3909
+									//
3910
+								} else {
3911
+									$term_parent_data = array();
3912
+									$term_parent_data['name'] = $cat_parent;
3913
+									//$term_parent_data = array_map( 'utf8_encode', $term_parent_data );
3914
+									$term_parent_data['taxonomy'] = $taxonomy;
3915 3915
                                     
3916
-                                    $term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3917
-                                }
3916
+									$term_parent_id = (int)geodir_imex_insert_term( $taxonomy, $term_parent_data );
3917
+								}
3918 3918
                                 
3919
-                                if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3920
-                                    $term_parent_id = (int)$term_parent->term_id;
3921
-                                }
3922
-                            }
3923
-                            $term_data['parent'] = (int)$term_parent_id;
3919
+								if ( !empty( $term_parent ) && !is_wp_error( $term_parent ) ) {
3920
+									$term_parent_id = (int)$term_parent->term_id;
3921
+								}
3922
+							}
3923
+							$term_data['parent'] = (int)$term_parent_id;
3924 3924
 
3925
-                            $term_id = NULL;
3926
-                            if ( $import_choice == 'update' ) {
3927
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3928
-                                    $term_data['term_id'] = $term['term_id'];
3925
+							$term_id = NULL;
3926
+							if ( $import_choice == 'update' ) {
3927
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3928
+									$term_data['term_id'] = $term['term_id'];
3929 3929
                                     
3930
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3931
-                                        $updated++;
3932
-                                    } else {
3933
-                                        $invalid++;
3934
-                                        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' ) );
3935
-                                    }
3936
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3937
-                                    $term_data['term_id'] = $term['term_id'];
3930
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3931
+										$updated++;
3932
+									} else {
3933
+										$invalid++;
3934
+										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' ) );
3935
+									}
3936
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3937
+									$term_data['term_id'] = $term['term_id'];
3938 3938
                                     
3939
-                                    if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3940
-                                        $updated++;
3941
-                                    } else {
3942
-                                        $invalid++;
3943
-                                        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' ) );
3944
-                                    }
3945
-                                } else {
3946
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3947
-                                        $created++;
3948
-                                    } else {
3949
-                                        $invalid++;
3950
-                                        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' ) );
3951
-                                    }
3952
-                                }
3953
-                            } else if ( $import_choice == 'skip' ) {
3954
-                                if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3955
-                                    $skipped++;
3956
-                                } else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3957
-                                    $skipped++;
3958
-                                } else {
3959
-                                    if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3960
-                                        $created++;
3961
-                                    } else {
3962
-                                        $invalid++;
3963
-                                        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' ) );
3964
-                                    }
3965
-                                }
3966
-                            } else {
3967
-                                $invalid++;
3968
-                                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' ) );
3969
-                            }
3939
+									if ( $term_id = geodir_imex_update_term( $taxonomy, $term_data ) ) {
3940
+										$updated++;
3941
+									} else {
3942
+										$invalid++;
3943
+										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' ) );
3944
+									}
3945
+								} else {
3946
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3947
+										$created++;
3948
+									} else {
3949
+										$invalid++;
3950
+										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' ) );
3951
+									}
3952
+								}
3953
+							} else if ( $import_choice == 'skip' ) {
3954
+								if ( $cat_id > 0 && $term = (array)term_exists( $cat_id, $taxonomy ) ) {
3955
+									$skipped++;
3956
+								} else if ( $term_data['slug'] != '' && $term = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
3957
+									$skipped++;
3958
+								} else {
3959
+									if ( $term_id = geodir_imex_insert_term( $taxonomy, $term_data ) ) {
3960
+										$created++;
3961
+									} else {
3962
+										$invalid++;
3963
+										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' ) );
3964
+									}
3965
+								}
3966
+							} else {
3967
+								$invalid++;
3968
+								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' ) );
3969
+							}
3970 3970
                             
3971
-                            if ( $term_id ) {
3972
-                                // WPML
3973
-                                if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3974
-                                    $wpml_element_type = 'tax_' . $taxonomy;
3975
-                                    $source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3976
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3977
-
3978
-                                    $trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3971
+							if ( $term_id ) {
3972
+								// WPML
3973
+								if ($is_wpml && geodir_wpml_is_taxonomy_translated($taxonomy) && $cat_id_original > 0 && $cat_language != '') {
3974
+									$wpml_element_type = 'tax_' . $taxonomy;
3975
+									$source_language = geodir_get_language_for_element( $cat_id_original, $wpml_element_type );
3976
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
3977
+
3978
+									$trid = $sitepress->get_element_trid( $cat_id_original, $wpml_element_type );
3979 3979
                                     
3980
-                                    $sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3981
-                                }
3982
-                                // WPML
3980
+									$sitepress->set_element_language_details( $term_id, $wpml_element_type, $trid, $cat_language, $source_language );
3981
+								}
3982
+								// WPML
3983 3983
                                 
3984
-                                if ( isset( $term_data['top_description'] ) ) {
3985
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3986
-                                }
3984
+								if ( isset( $term_data['top_description'] ) ) {
3985
+									geodir_update_tax_meta( $term_id, 'ct_cat_top_desc', $term_data['top_description'], $cat_posttype );
3986
+								}
3987 3987
                                 
3988
-                                if ( isset( $term_data['cat_schema'] ) ) {
3989
-                                    geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3990
-                                }
3988
+								if ( isset( $term_data['cat_schema'] ) ) {
3989
+									geodir_update_tax_meta( $term_id, 'ct_cat_schema', $term_data['cat_schema'], $cat_posttype );
3990
+								}
3991 3991
             
3992
-                                $attachment = false;
3993
-                                if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3994
-                                    $cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3995
-                                    $cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3992
+								$attachment = false;
3993
+								if ( isset( $term_data['image'] ) && $term_data['image'] != '' ) {
3994
+									$cat_image = geodir_get_default_catimage( $term_id, $cat_posttype );
3995
+									$cat_image = !empty( $cat_image ) && isset( $cat_image['src'] ) ? $cat_image['src'] : '';
3996 3996
                                     
3997
-                                    if ( basename($cat_image) != $term_data['image'] ) {
3998
-                                        $attachment = true;
3999
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4000
-                                    }
4001
-                                }
3997
+									if ( basename($cat_image) != $term_data['image'] ) {
3998
+										$attachment = true;
3999
+										geodir_update_tax_meta( $term_id, 'ct_cat_default_img', array( 'id' => 'image', 'src' => $uploads['url'] . '/' . $term_data['image'] ), $cat_posttype );
4000
+									}
4001
+								}
4002 4002
                                 
4003
-                                if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4004
-                                    $cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4005
-                                    $cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4006
-
4007
-                                    if ( basename($cat_icon) != $term_data['icon'] ) {
4008
-                                        $attachment = true;
4009
-                                        geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4010
-                                    }
4011
-                                }
4003
+								if ( isset( $term_data['icon'] ) && $term_data['icon'] != '' ) {
4004
+									$cat_icon = geodir_get_tax_meta( $term_id, 'ct_cat_icon', false, $cat_posttype );
4005
+									$cat_icon = !empty( $cat_icon ) && isset( $cat_icon['src'] ) ? $cat_icon['src'] : '';
4006
+
4007
+									if ( basename($cat_icon) != $term_data['icon'] ) {
4008
+										$attachment = true;
4009
+										geodir_update_tax_meta( $term_id, 'ct_cat_icon', array( 'id' => 'icon', 'src' => $uploads['url'] . '/' . $term_data['icon'] ), $cat_posttype );
4010
+									}
4011
+								}
4012 4012
                                 
4013
-                                if ( $attachment ) {
4014
-                                    $images++;
4015
-                                }
4016
-                            }
4013
+								if ( $attachment ) {
4014
+									$images++;
4015
+								}
4016
+							}
4017 4017
                             
4018
-                            // WPML
4019
-                            if ($is_wpml && $cat_language != '') {
4020
-                                $sitepress->switch_lang($active_lang, true);
4021
-                            }
4022
-                            // WPML
4023
-                        }
4024
-                    }
4025
-                }
4018
+							// WPML
4019
+							if ($is_wpml && $cat_language != '') {
4020
+								$sitepress->switch_lang($active_lang, true);
4021
+							}
4022
+							// WPML
4023
+						}
4024
+					}
4025
+				}
4026 4026
                 
4027
-                $json = array();
4028
-                $json['processed'] = $limit;
4029
-                $json['created'] = $created;
4030
-                $json['updated'] = $updated;
4031
-                $json['skipped'] = $skipped;
4032
-                $json['invalid'] = $invalid;
4033
-                $json['images'] = $images;
4027
+				$json = array();
4028
+				$json['processed'] = $limit;
4029
+				$json['created'] = $created;
4030
+				$json['updated'] = $updated;
4031
+				$json['skipped'] = $skipped;
4032
+				$json['invalid'] = $invalid;
4033
+				$json['images'] = $images;
4034 4034
                 
4035
-                wp_send_json( $json );
4036
-                exit;
4037
-            } else if ( $task == 'import_post' ) {
4038
-                $xtimings['###1'] = microtime(true)-$xstart;
4039
-                //run some stuff to make the import quicker
4040
-                wp_defer_term_counting( true );
4041
-                wp_defer_comment_counting( true );
4042
-                $wpdb->query( 'SET autocommit = 0;' );
4035
+				wp_send_json( $json );
4036
+				exit;
4037
+			} else if ( $task == 'import_post' ) {
4038
+				$xtimings['###1'] = microtime(true)-$xstart;
4039
+				//run some stuff to make the import quicker
4040
+				wp_defer_term_counting( true );
4041
+				wp_defer_comment_counting( true );
4042
+				$wpdb->query( 'SET autocommit = 0;' );
4043 4043
 //
4044 4044
 //                remove_all_actions('publish_post');
4045 4045
 //                remove_all_actions('transition_post_status');
4046 4046
 //                remove_all_actions('publish_future_post');
4047 4047
 
4048
-                if (!empty($file)) {
4049
-                    $is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4050
-                    $wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4051
-                    $default_status = 'publish';
4052
-                    $current_date = date_i18n( 'Y-m-d', time() );
4048
+				if (!empty($file)) {
4049
+					$is_claim_active = is_plugin_active( 'geodir_claim_listing/geodir_claim_listing.php' ) && get_option('geodir_claim_enable') === 'yes' ? true : false;
4050
+					$wp_post_statuses = get_post_statuses(); // All of the WordPress supported post statuses.
4051
+					$default_status = 'publish';
4052
+					$current_date = date_i18n( 'Y-m-d', time() );
4053 4053
                     
4054
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4054
+					$columns = isset($file[0]) ? $file[0] : NULL;
4055 4055
                     
4056
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4057
-                        $json['error'] = CSV_INVAILD_FILE;
4058
-                        wp_send_json( $json );
4059
-                        exit;
4060
-                    }
4061
-                    $xtimings['###2'] = microtime(true)-$xstart;
4062
-                    $gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4063
-                    $wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4064
-                    $processed_actual = 0;
4065
-                    for ($i = 1; $i <= $limit; $i++) {
4066
-                        $index = $processed + $i;
4067
-                        $gd_post = array();
4056
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4057
+						$json['error'] = CSV_INVAILD_FILE;
4058
+						wp_send_json( $json );
4059
+						exit;
4060
+					}
4061
+					$xtimings['###2'] = microtime(true)-$xstart;
4062
+					$gd_error_log = __('GD IMPORT LISTINGS [ROW %d]:', 'geodirectory');
4063
+					$wp_chars_error = __( '(check & remove if any invalid characters used in data)', 'geodirectory' );
4064
+					$processed_actual = 0;
4065
+					for ($i = 1; $i <= $limit; $i++) {
4066
+						$index = $processed + $i;
4067
+						$gd_post = array();
4068 4068
                         
4069
-                        if (isset($file[$index])) {
4070
-                            $processed_actual++;
4071
-                            $row = $file[$index];
4072
-                            $row = array_map( 'trim', $row );
4073
-                            //$row = array_map( 'utf8_encode', $row );
4074
-                            $row = array_map( 'addslashes_gpc', $row );
4069
+						if (isset($file[$index])) {
4070
+							$processed_actual++;
4071
+							$row = $file[$index];
4072
+							$row = array_map( 'trim', $row );
4073
+							//$row = array_map( 'utf8_encode', $row );
4074
+							$row = array_map( 'addslashes_gpc', $row );
4075 4075
                             
4076
-                            $post_id = '';
4077
-                            $post_title = '';
4078
-                            $post_date = '';
4079
-                            $post_author = '';
4080
-                            $post_content = '';
4081
-                            $post_category_arr = array();
4082
-                            $default_category = '';
4083
-                            $post_tags = array();
4084
-                            $post_type = '';
4085
-                            $post_status = '';
4086
-                            $is_featured = 0;
4087
-                            $geodir_video = '';
4088
-                            $post_address = '';
4089
-                            $post_city = '';
4090
-                            $post_region = '';
4091
-                            $post_country = '';
4092
-                            $post_zip = '';
4093
-                            $post_latitude = '';
4094
-                            $post_longitude = '';
4095
-                            $post_neighbourhood = '';
4096
-                            $neighbourhood_latitude = '';
4097
-                            $neighbourhood_longitude = '';
4098
-                            $geodir_timing = '';
4099
-                            $geodir_contact = '';
4100
-                            $geodir_email = '';
4101
-                            $geodir_website = '';
4102
-                            $geodir_twitter = '';
4103
-                            $geodir_facebook = '';
4104
-                            $geodir_twitter = '';
4105
-                            $geodir_link_business = null;
4106
-                            $post_images = array();
4076
+							$post_id = '';
4077
+							$post_title = '';
4078
+							$post_date = '';
4079
+							$post_author = '';
4080
+							$post_content = '';
4081
+							$post_category_arr = array();
4082
+							$default_category = '';
4083
+							$post_tags = array();
4084
+							$post_type = '';
4085
+							$post_status = '';
4086
+							$is_featured = 0;
4087
+							$geodir_video = '';
4088
+							$post_address = '';
4089
+							$post_city = '';
4090
+							$post_region = '';
4091
+							$post_country = '';
4092
+							$post_zip = '';
4093
+							$post_latitude = '';
4094
+							$post_longitude = '';
4095
+							$post_neighbourhood = '';
4096
+							$neighbourhood_latitude = '';
4097
+							$neighbourhood_longitude = '';
4098
+							$geodir_timing = '';
4099
+							$geodir_contact = '';
4100
+							$geodir_email = '';
4101
+							$geodir_website = '';
4102
+							$geodir_twitter = '';
4103
+							$geodir_facebook = '';
4104
+							$geodir_twitter = '';
4105
+							$geodir_link_business = null;
4106
+							$post_images = array();
4107 4107
                             
4108
-                            $expire_date = 'Never';
4108
+							$expire_date = 'Never';
4109 4109
                             
4110
-                            $language = '';
4111
-                            $original_post_id = '';
4110
+							$language = '';
4111
+							$original_post_id = '';
4112 4112
                             
4113
-                            $c = 0;
4114
-                            foreach ($columns as $column ) {
4115
-                                $gd_post[$column] = $row[$c];
4113
+							$c = 0;
4114
+							foreach ($columns as $column ) {
4115
+								$gd_post[$column] = $row[$c];
4116 4116
                                 
4117
-                                if ( $column == 'post_id' ) {
4118
-                                    $post_id = $row[$c];
4119
-                                } else if ( $column == 'post_title' ) {
4120
-                                    $post_title = sanitize_text_field($row[$c]);
4121
-                                } else if ( $column == 'post_author' ) {
4122
-                                    $post_author = $row[$c];
4123
-                                } else if ( $column == 'post_date' ) {
4124
-                                    $post_date = $row[$c];
4125
-                                } else if ( $column == 'post_content' ) {
4126
-                                    $post_content = $row[$c];
4127
-                                } else if ( $column == 'post_category' && $row[$c] != '' ) {
4128
-                                    $post_category_arr = explode( ',', $row[$c] );
4129
-                                } else if ( $column == 'default_category' ) {
4130
-                                    $default_category = wp_kses_normalize_entities($row[$c]);
4131
-                                } else if ( $column == 'post_tags' && $row[$c] != '' ) {
4132
-                                    $post_tags = explode( ',', sanitize_text_field($row[$c]) );
4133
-                                } else if ( $column == 'post_type' ) {
4134
-                                    $post_type = $row[$c];
4135
-                                } else if ( $column == 'post_status' ) {
4136
-                                    $post_status = sanitize_key( $row[$c] );
4137
-                                } else if ( $column == 'is_featured' ) {
4138
-                                    $is_featured = (int)$row[$c];
4139
-                                } else if ( $column == 'geodir_video' ) {
4140
-                                    $geodir_video = $row[$c];
4141
-                                } else if ( $column == 'post_address' ) {
4142
-                                    $post_address = sanitize_text_field($row[$c]);
4143
-                                } else if ( $column == 'post_city' ) {
4144
-                                    $post_city = sanitize_text_field($row[$c]);
4145
-                                } else if ( $column == 'post_region' ) {
4146
-                                    $post_region = sanitize_text_field($row[$c]);
4147
-                                } else if ( $column == 'post_country' ) {
4148
-                                    $post_country = sanitize_text_field($row[$c]);
4149
-                                } else if ( $column == 'post_zip' ) {
4150
-                                    $post_zip = sanitize_text_field($row[$c]);
4151
-                                } else if ( $column == 'post_latitude' ) {
4152
-                                    $post_latitude = sanitize_text_field($row[$c]);
4153
-                                } else if ( $column == 'post_longitude' ) {
4154
-                                    $post_longitude = sanitize_text_field($row[$c]);
4155
-                                } else if ( $column == 'post_neighbourhood' ) {
4156
-                                    $post_neighbourhood = sanitize_text_field($row[$c]);
4157
-                                    unset($gd_post[$column]);
4158
-                                } else if ( $column == 'neighbourhood_latitude' ) {
4159
-                                    $neighbourhood_latitude = sanitize_text_field($row[$c]);
4160
-                                } else if ( $column == 'neighbourhood_longitude' ) {
4161
-                                    $neighbourhood_longitude = sanitize_text_field($row[$c]);
4162
-                                } else if ( $column == 'geodir_timing' ) {
4163
-                                    $geodir_timing = sanitize_text_field($row[$c]);
4164
-                                } else if ( $column == 'geodir_contact' ) {
4165
-                                    $geodir_contact = sanitize_text_field($row[$c]);
4166
-                                } else if ( $column == 'geodir_email' ) {
4167
-                                    $geodir_email = sanitize_email($row[$c]);
4168
-                                } else if ( $column == 'geodir_website' ) {
4169
-                                    $geodir_website = sanitize_text_field($row[$c]);
4170
-                                } else if ( $column == 'geodir_twitter' ) {
4171
-                                    $geodir_twitter = sanitize_text_field($row[$c]);
4172
-                                } else if ( $column == 'geodir_facebook' ) {
4173
-                                    $geodir_facebook = sanitize_text_field($row[$c]);
4174
-                                } else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4175
-                                    $post_images[] = $row[$c];
4176
-                                } else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4177
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4178
-                                } else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4179
-                                    $row[$c] = str_replace('/', '-', $row[$c]);
4180
-                                    $expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4181
-                                } else if ( strpos( $column, 'linked_' ) === 0 ) {
4182
-                                    $geodir_link_business = (int)$row[$c];
4183
-                                }
4184
-                                // WPML
4185
-                                if ($is_wpml) {
4186
-                                    if ($column == 'language') {
4187
-                                        $language = geodir_strtolower(trim($row[$c]));
4188
-                                    } else if ($column == 'original_post_id') {
4189
-                                        $original_post_id = (int)$row[$c];
4190
-                                    }
4191
-                                }
4192
-                                // WPML
4193
-                                $c++;
4194
-                            }
4195
-                            // listing claimed or not
4196
-                            if ($is_claim_active && isset($gd_post['claimed'])) {
4197
-                                $gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4198
-                            }
4117
+								if ( $column == 'post_id' ) {
4118
+									$post_id = $row[$c];
4119
+								} else if ( $column == 'post_title' ) {
4120
+									$post_title = sanitize_text_field($row[$c]);
4121
+								} else if ( $column == 'post_author' ) {
4122
+									$post_author = $row[$c];
4123
+								} else if ( $column == 'post_date' ) {
4124
+									$post_date = $row[$c];
4125
+								} else if ( $column == 'post_content' ) {
4126
+									$post_content = $row[$c];
4127
+								} else if ( $column == 'post_category' && $row[$c] != '' ) {
4128
+									$post_category_arr = explode( ',', $row[$c] );
4129
+								} else if ( $column == 'default_category' ) {
4130
+									$default_category = wp_kses_normalize_entities($row[$c]);
4131
+								} else if ( $column == 'post_tags' && $row[$c] != '' ) {
4132
+									$post_tags = explode( ',', sanitize_text_field($row[$c]) );
4133
+								} else if ( $column == 'post_type' ) {
4134
+									$post_type = $row[$c];
4135
+								} else if ( $column == 'post_status' ) {
4136
+									$post_status = sanitize_key( $row[$c] );
4137
+								} else if ( $column == 'is_featured' ) {
4138
+									$is_featured = (int)$row[$c];
4139
+								} else if ( $column == 'geodir_video' ) {
4140
+									$geodir_video = $row[$c];
4141
+								} else if ( $column == 'post_address' ) {
4142
+									$post_address = sanitize_text_field($row[$c]);
4143
+								} else if ( $column == 'post_city' ) {
4144
+									$post_city = sanitize_text_field($row[$c]);
4145
+								} else if ( $column == 'post_region' ) {
4146
+									$post_region = sanitize_text_field($row[$c]);
4147
+								} else if ( $column == 'post_country' ) {
4148
+									$post_country = sanitize_text_field($row[$c]);
4149
+								} else if ( $column == 'post_zip' ) {
4150
+									$post_zip = sanitize_text_field($row[$c]);
4151
+								} else if ( $column == 'post_latitude' ) {
4152
+									$post_latitude = sanitize_text_field($row[$c]);
4153
+								} else if ( $column == 'post_longitude' ) {
4154
+									$post_longitude = sanitize_text_field($row[$c]);
4155
+								} else if ( $column == 'post_neighbourhood' ) {
4156
+									$post_neighbourhood = sanitize_text_field($row[$c]);
4157
+									unset($gd_post[$column]);
4158
+								} else if ( $column == 'neighbourhood_latitude' ) {
4159
+									$neighbourhood_latitude = sanitize_text_field($row[$c]);
4160
+								} else if ( $column == 'neighbourhood_longitude' ) {
4161
+									$neighbourhood_longitude = sanitize_text_field($row[$c]);
4162
+								} else if ( $column == 'geodir_timing' ) {
4163
+									$geodir_timing = sanitize_text_field($row[$c]);
4164
+								} else if ( $column == 'geodir_contact' ) {
4165
+									$geodir_contact = sanitize_text_field($row[$c]);
4166
+								} else if ( $column == 'geodir_email' ) {
4167
+									$geodir_email = sanitize_email($row[$c]);
4168
+								} else if ( $column == 'geodir_website' ) {
4169
+									$geodir_website = sanitize_text_field($row[$c]);
4170
+								} else if ( $column == 'geodir_twitter' ) {
4171
+									$geodir_twitter = sanitize_text_field($row[$c]);
4172
+								} else if ( $column == 'geodir_facebook' ) {
4173
+									$geodir_facebook = sanitize_text_field($row[$c]);
4174
+								} else if ( $column == 'IMAGE' && !empty( $row[$c] ) && $row[$c] != '' ) {
4175
+									$post_images[] = $row[$c];
4176
+								} else if ( $column == 'alive_days' && (int)$row[$c] > 0 ) {
4177
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$row[$c] . ' days' ) );
4178
+								} else if ( $column == 'expire_date' && $row[$c] != '' && geodir_strtolower($row[$c]) != 'never' ) {
4179
+									$row[$c] = str_replace('/', '-', $row[$c]);
4180
+									$expire_date = date_i18n( 'Y-m-d', strtotime( $row[$c] ) );
4181
+								} else if ( strpos( $column, 'linked_' ) === 0 ) {
4182
+									$geodir_link_business = (int)$row[$c];
4183
+								}
4184
+								// WPML
4185
+								if ($is_wpml) {
4186
+									if ($column == 'language') {
4187
+										$language = geodir_strtolower(trim($row[$c]));
4188
+									} else if ($column == 'original_post_id') {
4189
+										$original_post_id = (int)$row[$c];
4190
+									}
4191
+								}
4192
+								// WPML
4193
+								$c++;
4194
+							}
4195
+							// listing claimed or not
4196
+							if ($is_claim_active && isset($gd_post['claimed'])) {
4197
+								$gd_post['claimed'] = (int)$gd_post['claimed'] == 1 ? 1 : 0;
4198
+							}
4199 4199
                             
4200
-                            // WPML
4201
-                            if ($is_wpml && $language != '') {
4202
-                                $sitepress->switch_lang($language, true);
4203
-                            }
4204
-                            // WPML
4200
+							// WPML
4201
+							if ($is_wpml && $language != '') {
4202
+								$sitepress->switch_lang($language, true);
4203
+							}
4204
+							// WPML
4205 4205
 
4206
-                            $gd_post['IMAGE'] = $post_images;
4206
+							$gd_post['IMAGE'] = $post_images;
4207 4207
                             
4208
-                            $post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4209
-                            $post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4208
+							$post_status = !empty( $post_status ) ? sanitize_key( $post_status ) : $default_status;
4209
+							$post_status = !empty( $wp_post_statuses ) && !isset( $wp_post_statuses[$post_status] ) ? $default_status : $post_status;
4210 4210
                                                                                                                 
4211
-                            $valid = true;
4211
+							$valid = true;
4212 4212
                             
4213
-                            if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4214
-                                $invalid++;
4215
-                                $valid = false;
4216
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4217
-                            }
4218
-                            $xtimings['###3'] = microtime(true)-$xstart;
4219
-                            $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4220
-                            if ( $location_allowed ) {
4221
-                                $location_result = geodir_get_default_location();
4222
-                                if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4223
-                                    $invalid_addr++;
4224
-                                    $valid = false;
4225
-                                    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' ) );
4226
-                                } else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4227
-                                    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 ) ) ) {
4228
-                                        $invalid_addr++;
4229
-                                        $valid = false;
4230
-                                        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' ) );
4231
-                                    } else {
4232
-                                        if (!$location_manager) {
4233
-                                            $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.
4234
-                                        }
4235
-                                    }
4236
-                                }
4237
-                            }
4238
-                            $xtimings['###4']   = microtime(true)-$xstart;
4239
-                            if ( !$valid ) {
4240
-                                continue;
4241
-                            }
4213
+							if ( $post_title == '' || !in_array( $post_type, $post_types ) ) {
4214
+								$invalid++;
4215
+								$valid = false;
4216
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . __( 'Could not be added due to blank title/invalid post type', 'geodirectory' ) );
4217
+							}
4218
+							$xtimings['###3'] = microtime(true)-$xstart;
4219
+							$location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true;
4220
+							if ( $location_allowed ) {
4221
+								$location_result = geodir_get_default_location();
4222
+								if ( $post_address == '' || $post_city == '' || $post_region == '' || $post_country == '' || $post_latitude == '' || $post_longitude == '' ) {
4223
+									$invalid_addr++;
4224
+									$valid = false;
4225
+									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' ) );
4226
+								} else if ( !empty( $location_result ) && $location_result->location_id == 0 ) {
4227
+									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 ) ) ) {
4228
+										$invalid_addr++;
4229
+										$valid = false;
4230
+										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' ) );
4231
+									} else {
4232
+										if (!$location_manager) {
4233
+											$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.
4234
+										}
4235
+									}
4236
+								}
4237
+							}
4238
+							$xtimings['###4']   = microtime(true)-$xstart;
4239
+							if ( !$valid ) {
4240
+								continue;
4241
+							}
4242 4242
 
4243
-                            $cat_taxonomy = $post_type . 'category';
4244
-                            $tags_taxonomy = $post_type . '_tags';
4243
+							$cat_taxonomy = $post_type . 'category';
4244
+							$tags_taxonomy = $post_type . '_tags';
4245 4245
                             
4246
-                            if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4247
-                                $post_category_arr = array_merge(array($default_category), $post_category_arr);
4248
-                            }
4246
+							if ($default_category != '' && !in_array($default_category, $post_category_arr)) {
4247
+								$post_category_arr = array_merge(array($default_category), $post_category_arr);
4248
+							}
4249 4249
 
4250
-                            $post_category = array();
4251
-                            $default_category_id = NULL;
4252
-                            if ( !empty( $post_category_arr ) ) {
4253
-                                foreach ( $post_category_arr as $value ) {
4254
-                                    $category_name = wp_kses_normalize_entities( trim( $value ) );
4250
+							$post_category = array();
4251
+							$default_category_id = NULL;
4252
+							if ( !empty( $post_category_arr ) ) {
4253
+								foreach ( $post_category_arr as $value ) {
4254
+									$category_name = wp_kses_normalize_entities( trim( $value ) );
4255 4255
                                     
4256
-                                    if ( $category_name != '' ) {
4257
-                                        $term_category = array();
4256
+									if ( $category_name != '' ) {
4257
+										$term_category = array();
4258 4258
                                         
4259
-                                        if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4260
-                                            $term_category = $term;
4261
-                                        } else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4262
-                                            $term_category = $term;
4263
-                                        } else {
4264
-                                            $term_data = array();
4265
-                                            $term_data['name'] = $category_name;
4266
-                                            $term_data['taxonomy'] = $cat_taxonomy;
4259
+										if ( $term = get_term_by( 'name', $category_name, $cat_taxonomy ) ) {
4260
+											$term_category = $term;
4261
+										} else if ( $term = get_term_by( 'slug', $category_name, $cat_taxonomy ) ) {
4262
+											$term_category = $term;
4263
+										} else {
4264
+											$term_data = array();
4265
+											$term_data['name'] = $category_name;
4266
+											$term_data['taxonomy'] = $cat_taxonomy;
4267 4267
                                             
4268
-                                            $term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4269
-                                            if ( $term_id ) {
4270
-                                                $term_category = get_term( $term_id, $cat_taxonomy );
4271
-                                            }
4272
-                                        }
4268
+											$term_id = geodir_imex_insert_term( $cat_taxonomy, $term_data );
4269
+											if ( $term_id ) {
4270
+												$term_category = get_term( $term_id, $cat_taxonomy );
4271
+											}
4272
+										}
4273 4273
                                         
4274
-                                        if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4275
-                                            $post_category[] = intval($term_category->term_id);
4274
+										if ( !empty( $term_category ) && !is_wp_error( $term_category ) ) {
4275
+											$post_category[] = intval($term_category->term_id);
4276 4276
                                             
4277
-                                            if ($category_name == $default_category) {
4278
-                                                $default_category_id = intval($term_category->term_id);
4279
-                                            }
4280
-                                        }
4281
-                                    }
4282
-                                }
4283
-                            }
4284
-                            $xtimings['###5'] = microtime(true)-$xstart;
4285
-                            $save_post = array();
4286
-                            $save_post['post_title'] = $post_title;
4287
-                            if (!empty($post_date)) {
4288
-                                $post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4277
+											if ($category_name == $default_category) {
4278
+												$default_category_id = intval($term_category->term_id);
4279
+											}
4280
+										}
4281
+									}
4282
+								}
4283
+							}
4284
+							$xtimings['###5'] = microtime(true)-$xstart;
4285
+							$save_post = array();
4286
+							$save_post['post_title'] = $post_title;
4287
+							if (!empty($post_date)) {
4288
+								$post_date = geodir_date( $post_date, 'Y-m-d H:i:s' ); // convert to mysql date format.
4289 4289
                                 
4290
-                                $save_post['post_date'] = $post_date;
4291
-                                $save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4292
-                            }
4293
-                            $save_post['post_content'] = $post_content;
4294
-                            $save_post['post_type'] = $post_type;
4295
-                            $save_post['post_author'] = $post_author;
4296
-                            $save_post['post_status'] = $post_status;
4297
-                            $save_post['post_category'] = $post_category;
4298
-                            $save_post['post_tags'] = $post_tags;
4299
-
4300
-                            $saved_post_id = NULL;
4301
-                            if ( $import_choice == 'update' ) {
4302
-                                $gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4290
+								$save_post['post_date'] = $post_date;
4291
+								$save_post['post_date_gmt'] = get_gmt_from_date( $post_date );
4292
+							}
4293
+							$save_post['post_content'] = $post_content;
4294
+							$save_post['post_type'] = $post_type;
4295
+							$save_post['post_author'] = $post_author;
4296
+							$save_post['post_status'] = $post_status;
4297
+							$save_post['post_category'] = $post_category;
4298
+							$save_post['post_tags'] = $post_tags;
4299
+
4300
+							$saved_post_id = NULL;
4301
+							if ( $import_choice == 'update' ) {
4302
+								$gd_wp_error = __( 'Unable to add listing, please check the listing data.', 'geodirectory' );
4303 4303
                                 
4304
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4305
-                                    $save_post['ID'] = $post_id;
4304
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4305
+									$save_post['ID'] = $post_id;
4306 4306
                                     
4307
-                                    if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4308
-                                        if ( is_wp_error( $saved_post_id ) ) {
4309
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4310
-                                            $saved_post_id = 0;
4311
-                                        } else {
4312
-                                            $saved_post_id = $post_id;
4313
-                                            $updated++;
4314
-                                        }
4315
-                                    }
4316
-                                } else {
4317
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4318
-                                        if ( is_wp_error( $saved_post_id ) ) {
4319
-                                            $gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4320
-                                            $saved_post_id = 0;
4321
-                                        } else {
4322
-                                            $created++;
4323
-                                        }
4324
-                                    }
4325
-                                }
4307
+									if ( $saved_post_id = wp_update_post( $save_post, true ) ) {
4308
+										if ( is_wp_error( $saved_post_id ) ) {
4309
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4310
+											$saved_post_id = 0;
4311
+										} else {
4312
+											$saved_post_id = $post_id;
4313
+											$updated++;
4314
+										}
4315
+									}
4316
+								} else {
4317
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4318
+										if ( is_wp_error( $saved_post_id ) ) {
4319
+											$gd_wp_error = $saved_post_id->get_error_message() . ' ' . $wp_chars_error;
4320
+											$saved_post_id = 0;
4321
+										} else {
4322
+											$created++;
4323
+										}
4324
+									}
4325
+								}
4326 4326
                                 
4327
-                                if ( !$saved_post_id > 0 ) {
4328
-                                    $invalid++;
4329
-                                    geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4330
-                                }
4331
-                            } else if ( $import_choice == 'skip' ) {
4332
-                                if ( $post_id > 0 && get_post( $post_id ) ) {
4333
-                                    $skipped++;	
4334
-                                } else {
4335
-                                    if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4336
-                                        if ( is_wp_error( $saved_post_id ) ) {
4337
-                                            $invalid++;
4327
+								if ( !$saved_post_id > 0 ) {
4328
+									$invalid++;
4329
+									geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_wp_error );
4330
+								}
4331
+							} else if ( $import_choice == 'skip' ) {
4332
+								if ( $post_id > 0 && get_post( $post_id ) ) {
4333
+									$skipped++;	
4334
+								} else {
4335
+									if ( $saved_post_id = wp_insert_post( $save_post, true ) ) {
4336
+										if ( is_wp_error( $saved_post_id ) ) {
4337
+											$invalid++;
4338 4338
                                             
4339
-                                            geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4340
-                                            $saved_post_id = 0;
4341
-                                        } else {
4342
-                                            $created++;
4343
-                                        }
4344
-                                    } else {
4345
-                                        $invalid++;
4339
+											geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $saved_post_id->get_error_message() . ' ' . $wp_chars_error );
4340
+											$saved_post_id = 0;
4341
+										} else {
4342
+											$created++;
4343
+										}
4344
+									} else {
4345
+										$invalid++;
4346 4346
                                         
4347
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4348
-                                    }
4349
-                                }
4350
-                            } else {
4351
-                                $invalid++;
4347
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4348
+									}
4349
+								}
4350
+							} else {
4351
+								$invalid++;
4352 4352
                                 
4353
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4354
-                            }
4355
-                            $xtimings['###6'] = microtime(true)-$xstart;
4356
-                            if ( (int)$saved_post_id > 0 ) {
4357
-                                // WPML
4358
-                                if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4359
-                                    $wpml_post_type = 'post_' . $post_type;
4360
-                                    $source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4361
-                                    $source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4362
-
4363
-                                    $trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4353
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $wp_chars_error );
4354
+							}
4355
+							$xtimings['###6'] = microtime(true)-$xstart;
4356
+							if ( (int)$saved_post_id > 0 ) {
4357
+								// WPML
4358
+								if ($is_wpml && geodir_wpml_is_post_type_translated($post_type) && $original_post_id > 0 && $language != '') {
4359
+									$wpml_post_type = 'post_' . $post_type;
4360
+									$source_language = geodir_get_language_for_element( $original_post_id, $wpml_post_type );
4361
+									$source_language = $source_language != '' ? $source_language : $sitepress->get_default_language();
4362
+
4363
+									$trid = $sitepress->get_element_trid( $original_post_id, $wpml_post_type );
4364 4364
                                     
4365
-                                    $sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4366
-                                }
4367
-                                // WPML
4368
-                                $gd_post_info = geodir_get_post_info( $saved_post_id );
4365
+									$sitepress->set_element_language_details( $saved_post_id, $wpml_post_type, $trid, $language, $source_language );
4366
+								}
4367
+								// WPML
4368
+								$gd_post_info = geodir_get_post_info( $saved_post_id );
4369 4369
                                 
4370
-                                $gd_post['post_id'] = $saved_post_id;
4371
-                                $gd_post['ID'] = $saved_post_id;
4372
-                                $gd_post['post_tags'] = $post_tags;
4373
-                                $gd_post['post_title'] = $post_title;
4374
-                                $gd_post['post_status'] = $post_status;
4375
-                                $gd_post['submit_time'] = time();
4376
-                                $gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4370
+								$gd_post['post_id'] = $saved_post_id;
4371
+								$gd_post['ID'] = $saved_post_id;
4372
+								$gd_post['post_tags'] = $post_tags;
4373
+								$gd_post['post_title'] = $post_title;
4374
+								$gd_post['post_status'] = $post_status;
4375
+								$gd_post['submit_time'] = time();
4376
+								$gd_post['submit_ip'] = $_SERVER['REMOTE_ADDR'];
4377 4377
                                                     
4378
-                                // post location
4379
-                                $post_location_id = 0;
4380
-                                if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4381
-                                    $gd_post['post_neighbourhood'] = '';
4378
+								// post location
4379
+								$post_location_id = 0;
4380
+								if ( $location_allowed && !empty( $location_result ) && $location_result->location_id > 0 ) {
4381
+									$gd_post['post_neighbourhood'] = '';
4382 4382
                                     
4383
-                                    $post_location_info = array(
4384
-                                                                'city' => $post_city,
4385
-                                                                'region' => $post_region,
4386
-                                                                'country' => $post_country,
4387
-                                                                'geo_lat' => $post_latitude,
4388
-                                                                'geo_lng' => $post_longitude
4389
-                                                            );
4390
-                                    if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4391
-                                        $post_location_id = $location_id;
4392
-                                    }
4383
+									$post_location_info = array(
4384
+																'city' => $post_city,
4385
+																'region' => $post_region,
4386
+																'country' => $post_country,
4387
+																'geo_lat' => $post_latitude,
4388
+																'geo_lng' => $post_longitude
4389
+															);
4390
+									if ( $location_id = (int)geodir_add_new_location( $post_location_info ) ) {
4391
+										$post_location_id = $location_id;
4392
+									}
4393 4393
                                     
4394
-                                    if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4395
-                                        $neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4394
+									if ($post_location_id > 0 && $neighbourhood_active && !empty($post_neighbourhood)) {
4395
+										$neighbourhood_info = geodir_location_neighbourhood_by_name_loc_id($post_neighbourhood, $post_location_id);
4396 4396
 
4397
-                                        $hood_data = array();
4398
-                                        $hood_data['hood_location_id'] = $post_location_id;
4399
-                                        $hood_data['hood_name'] = $post_neighbourhood;
4397
+										$hood_data = array();
4398
+										$hood_data['hood_location_id'] = $post_location_id;
4399
+										$hood_data['hood_name'] = $post_neighbourhood;
4400 4400
                                         
4401
-                                        if (!empty($neighbourhood_info)) {
4402
-                                            $hood_data['hood_id'] = $neighbourhood_info->hood_id;
4403
-                                            $hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4401
+										if (!empty($neighbourhood_info)) {
4402
+											$hood_data['hood_id'] = $neighbourhood_info->hood_id;
4403
+											$hood_data['hood_slug'] = $neighbourhood_info->hood_slug;
4404 4404
                                             
4405
-                                            if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4406
-                                                $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4407
-                                                $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4408
-                                            }
4409
-                                        }
4405
+											if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4406
+												$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4407
+												$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4408
+											}
4409
+										}
4410 4410
                                         
4411
-                                        if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4412
-                                            $neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4413
-                                            $neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4414
-                                        }
4411
+										if (empty($neighbourhood_latitude) || empty($neighbourhood_longitude)) {
4412
+											$neighbourhood_latitude = $neighbourhood_info->hood_latitude;
4413
+											$neighbourhood_longitude = $neighbourhood_info->hood_longitude;
4414
+										}
4415 4415
                                         
4416
-                                        $hood_data['hood_latitude'] = $post_latitude;
4417
-                                        $hood_data['hood_longitude'] = $post_longitude;
4418
-
4419
-                                        $neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4420
-                                        if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4421
-                                            $gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4422
-                                        }
4423
-                                    }
4424
-                                }
4425
-                                $gd_post['post_location_id'] = $post_location_id;
4416
+										$hood_data['hood_latitude'] = $post_latitude;
4417
+										$hood_data['hood_longitude'] = $post_longitude;
4418
+
4419
+										$neighbourhood_info = geodir_location_insert_update_neighbourhood($hood_data);
4420
+										if (!empty($neighbourhood_info) && isset($neighbourhood_info->hood_slug)) {
4421
+											$gd_post['post_neighbourhood'] = $neighbourhood_info->hood_slug;
4422
+										}
4423
+									}
4424
+								}
4425
+								$gd_post['post_location_id'] = $post_location_id;
4426 4426
                                 
4427
-                                if ($geodir_link_business !== null) {
4428
-                                    $gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : '';
4429
-                                }
4427
+								if ($geodir_link_business !== null) {
4428
+									$gd_post['geodir_link_business'] = $geodir_link_business > 0 ? $geodir_link_business : '';
4429
+								}
4430 4430
                                 
4431
-                                // post package info
4432
-                                $package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4433
-                                if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4434
-                                    $package_id = $gd_post_info->package_id;
4435
-                                }
4431
+								// post package info
4432
+								$package_id = isset( $gd_post['package_id'] ) && !empty( $gd_post['package_id'] ) ? (int)$gd_post['package_id'] : 0;
4433
+								if (!$package_id && !empty($gd_post_info) && isset($gd_post_info->package_id) && $gd_post_info->package_id) {
4434
+									$package_id = $gd_post_info->package_id;
4435
+								}
4436 4436
                                 
4437
-                                $package_info = array();
4438
-                                if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4439
-                                    $package_info = (array)geodir_get_package_info_by_id($package_id);
4437
+								$package_info = array();
4438
+								if ($package_id && function_exists('geodir_get_package_info_by_id')) {
4439
+									$package_info = (array)geodir_get_package_info_by_id($package_id);
4440 4440
                                     
4441
-                                    if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4442
-                                        $package_info = array();
4443
-                                    }
4444
-                                }
4441
+									if (!(!empty($package_info) && isset($package_info['post_type']) && $package_info['post_type'] == $post_type)) {
4442
+										$package_info = array();
4443
+									}
4444
+								}
4445 4445
                                 
4446
-                                if (empty($package_info)) {
4447
-                                    $package_info = (array)geodir_post_package_info( array(), '', $post_type );
4448
-                                }
4446
+								if (empty($package_info)) {
4447
+									$package_info = (array)geodir_post_package_info( array(), '', $post_type );
4448
+								}
4449 4449
                                  
4450
-                                if (!empty($package_info))	 {
4451
-                                    $package_id = $package_info['pid'];
4450
+								if (!empty($package_info))	 {
4451
+									$package_id = $package_info['pid'];
4452 4452
                                     
4453
-                                    if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4454
-                                        $gd_post['expire_date'] = $expire_date;
4455
-                                    } else {
4456
-                                        if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4457
-                                            $gd_post['alive_days'] = (int)$package_info['days'];
4458
-                                            $gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4459
-                                        } else {
4460
-                                            $gd_post['expire_date'] = 'Never';
4461
-                                        }
4462
-                                    }
4453
+									if (isset($gd_post['alive_days']) || isset($gd_post['expire_date'])) {
4454
+										$gd_post['expire_date'] = $expire_date;
4455
+									} else {
4456
+										if ( isset( $package_info['days'] ) && (int)$package_info['days'] > 0 ) {
4457
+											$gd_post['alive_days'] = (int)$package_info['days'];
4458
+											$gd_post['expire_date'] = date_i18n( 'Y-m-d', strtotime( $current_date . '+' . (int)$package_info['days'] . ' days' ) );
4459
+										} else {
4460
+											$gd_post['expire_date'] = 'Never';
4461
+										}
4462
+									}
4463 4463
                                     
4464
-                                    $gd_post['package_id'] = $package_id;
4465
-                                }
4464
+									$gd_post['package_id'] = $package_id;
4465
+								}
4466 4466
 
4467
-                                $table = $plugin_prefix . $post_type . '_detail';
4467
+								$table = $plugin_prefix . $post_type . '_detail';
4468 4468
                                 
4469
-                                if ($post_type == 'gd_event') {
4470
-                                    $gd_post = geodir_imex_process_event_data($gd_post);
4471
-                                }
4469
+								if ($post_type == 'gd_event') {
4470
+									$gd_post = geodir_imex_process_event_data($gd_post);
4471
+								}
4472 4472
                                 
4473
-                                if (isset($gd_post['post_id'])) {
4474
-                                    unset($gd_post['post_id']);
4475
-                                }
4473
+								if (isset($gd_post['post_id'])) {
4474
+									unset($gd_post['post_id']);
4475
+								}
4476 4476
 
4477
-                                // Export franchise fields
4478
-                                $is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4479
-                                if ($is_franchise_active) {
4480
-                                    if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4481
-                                        if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4482
-                                            $gd_franchise_lock = array();
4477
+								// Export franchise fields
4478
+								$is_franchise_active = is_plugin_active( 'geodir_franchise/geodir_franchise.php' ) && geodir_franchise_enabled( $post_type ) ? true : false;
4479
+								if ($is_franchise_active) {
4480
+									if ( isset( $gd_post['gd_is_franchise'] ) && empty( $gd_post['franchise'] ) ) {
4481
+										if ( absint( $gd_post['gd_is_franchise'] ) != 0 ) {
4482
+											$gd_franchise_lock = array();
4483 4483
                                             
4484
-                                            if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4485
-                                                $gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4486
-                                                $gd_franchise_lock = trim( $gd_franchise_lock );
4487
-                                                $gd_franchise_lock = explode( ",", $gd_franchise_lock );
4488
-                                            }
4484
+											if ( isset( $gd_post['gd_franchise_lock'] ) ) {
4485
+												$gd_franchise_lock = str_replace(" ", "", $gd_post['gd_franchise_lock'] );
4486
+												$gd_franchise_lock = trim( $gd_franchise_lock );
4487
+												$gd_franchise_lock = explode( ",", $gd_franchise_lock );
4488
+											}
4489 4489
                                             
4490
-                                            update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4491
-                                            update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4492
-                                        } else {
4493
-                                            if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4494
-                                                geodir_franchise_remove_franchise( $saved_post_id );
4495
-                                            }
4496
-                                        }
4497
-                                    } else {
4498
-                                        if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4499
-                                            geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4500
-                                        }
4501
-                                    }
4502
-                                }
4490
+											update_post_meta( $saved_post_id, 'gd_is_franchise', 1 );
4491
+											update_post_meta( $saved_post_id, 'gd_franchise_lock', $gd_franchise_lock );
4492
+										} else {
4493
+											if ( function_exists( 'geodir_franchise_remove_franchise' ) ) {
4494
+												geodir_franchise_remove_franchise( $saved_post_id );
4495
+											}
4496
+										}
4497
+									} else {
4498
+										if ( isset( $gd_post['franchise'] ) && (int)$gd_post['franchise'] > 0 && geodir_franchise_check( (int)$gd_post['franchise'] ) ) {
4499
+											geodir_save_post_meta( $saved_post_id, 'franchise', (int)$gd_post['franchise'] );
4500
+										}
4501
+									}
4502
+								}
4503 4503
                                 
4504
-                                if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4505
-                                    $save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4506
-                                    if ($default_category_id) {
4507
-                                        $save_post['post_default_category'] = $default_category_id;
4508
-                                        $gd_post['default_category'] = $default_category_id;
4509
-                                    }
4510
-                                    $gd_post[$cat_taxonomy] = $save_post['post_category'];
4511
-                                }
4512
-                                $xtimings['###7'] = microtime(true)-$xstart;
4513
-                                // Save post info
4514
-                                geodir_save_post_info( $saved_post_id, $gd_post );
4515
-                                $xtimings['###8'] = microtime(true)-$xstart;
4516
-                                // post taxonomies
4517
-                                if ( !empty( $save_post['post_category'] ) ) {
4518
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4504
+								if (!empty($save_post['post_category']) && is_array($save_post['post_category'])) {
4505
+									$save_post['post_category'] = array_unique( array_map( 'intval', $save_post['post_category'] ) );
4506
+									if ($default_category_id) {
4507
+										$save_post['post_default_category'] = $default_category_id;
4508
+										$gd_post['default_category'] = $default_category_id;
4509
+									}
4510
+									$gd_post[$cat_taxonomy] = $save_post['post_category'];
4511
+								}
4512
+								$xtimings['###7'] = microtime(true)-$xstart;
4513
+								// Save post info
4514
+								geodir_save_post_info( $saved_post_id, $gd_post );
4515
+								$xtimings['###8'] = microtime(true)-$xstart;
4516
+								// post taxonomies
4517
+								if ( !empty( $save_post['post_category'] ) ) {
4518
+									wp_set_object_terms( $saved_post_id, $save_post['post_category'], $cat_taxonomy );
4519 4519
                                     
4520
-                                    $post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4521
-                                    if ($default_category_id) {
4522
-                                        $post_default_category = $default_category_id;
4523
-                                    }
4524
-                                    $post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4525
-                                    $save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4526
-                                    $post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4520
+									$post_default_category = isset( $save_post['post_default_category'] ) ? $save_post['post_default_category'] : '';
4521
+									if ($default_category_id) {
4522
+										$post_default_category = $default_category_id;
4523
+									}
4524
+									$post_cat_ids = geodir_get_post_meta($saved_post_id, $cat_taxonomy);
4525
+									$save_post['post_category'] = !empty($post_cat_ids) ? explode(",", trim($post_cat_ids, ",")) : $save_post['post_category'];
4526
+									$post_category_str = !empty($save_post['post_category']) ? implode(",y:#", $save_post['post_category']) . ',y:' : '';
4527 4527
                                     
4528
-                                    if ($post_category_str != '' && $post_default_category) {
4529
-                                        $post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4530
-                                    }
4528
+									if ($post_category_str != '' && $post_default_category) {
4529
+										$post_category_str = str_replace($post_default_category . ',y:', $post_default_category . ',y,d:', $post_category_str);
4530
+									}
4531 4531
                                     
4532
-                                    $post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4532
+									$post_category_str = $post_category_str != '' ? array($cat_taxonomy => $post_category_str) : '';
4533 4533
                                     
4534
-                                    geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4535
-                                }
4536
-                                $xtimings['###8.1'] = microtime(true)-$xstart;
4537
-                                if ( !empty( $save_post['post_tags'] ) ) {
4538
-                                    wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4539
-                                }
4540
-                                $xtimings['###9'] = microtime(true)-$xstart;
4541
-                                // Post images
4542
-                                if ( !empty( $post_images ) ) {
4543
-                                    $post_images = array_unique($post_images);
4534
+									geodir_set_postcat_structure( $saved_post_id, $cat_taxonomy, $post_default_category, $post_category_str );
4535
+								}
4536
+								$xtimings['###8.1'] = microtime(true)-$xstart;
4537
+								if ( !empty( $save_post['post_tags'] ) ) {
4538
+									wp_set_object_terms( $saved_post_id, $save_post['post_tags'], $tags_taxonomy );
4539
+								}
4540
+								$xtimings['###9'] = microtime(true)-$xstart;
4541
+								// Post images
4542
+								if ( !empty( $post_images ) ) {
4543
+									$post_images = array_unique($post_images);
4544 4544
                                     
4545
-                                    $old_post_images_arr = array();
4546
-                                    $saved_post_images_arr = array();
4545
+									$old_post_images_arr = array();
4546
+									$saved_post_images_arr = array();
4547 4547
                                     
4548
-                                    $order = 1;
4548
+									$order = 1;
4549 4549
                                     
4550
-                                    $old_post_images = geodir_get_images( $saved_post_id );
4551
-                                    $xtimings['###9.1'] = microtime(true)-$xstart;
4552
-                                    if (!empty($old_post_images)) {
4553
-                                        foreach( $old_post_images as $old_post_image ) {
4554
-                                            if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4555
-                                                $old_post_images_arr[] = $old_post_image->file;
4556
-                                            }
4557
-                                        }
4558
-                                    }
4550
+									$old_post_images = geodir_get_images( $saved_post_id );
4551
+									$xtimings['###9.1'] = microtime(true)-$xstart;
4552
+									if (!empty($old_post_images)) {
4553
+										foreach( $old_post_images as $old_post_image ) {
4554
+											if (!empty($old_post_image) && isset($old_post_image->file) && $old_post_image->file != '') {
4555
+												$old_post_images_arr[] = $old_post_image->file;
4556
+											}
4557
+										}
4558
+									}
4559 4559
 
4560
-                                    foreach ( $post_images as $post_image ) {
4561
-                                        $image_name = basename( $post_image );
4562
-                                        $saved_post_images_arr[] = $image_name;
4560
+									foreach ( $post_images as $post_image ) {
4561
+										$image_name = basename( $post_image );
4562
+										$saved_post_images_arr[] = $image_name;
4563 4563
                                         
4564
-                                        if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4565
-                                            continue; // Skip if image already exists.
4566
-                                        }
4564
+										if (!empty($old_post_images_arr) && in_array( $image_name, $old_post_images_arr) ) {
4565
+											continue; // Skip if image already exists.
4566
+										}
4567 4567
                                         
4568
-                                        $image_name_parts = explode( '.', $image_name );
4569
-                                        array_pop( $image_name_parts );
4570
-                                        $proper_image_name = implode( '.', $image_name_parts );
4571
-                                        $xtimings['###9.2'] = microtime(true)-$xstart;
4572
-                                        $arr_file_type = wp_check_filetype( $image_name );
4573
-                                        $xtimings['###9.3'] = microtime(true)-$xstart;
4574
-                                        if ( !empty( $arr_file_type ) ) {
4575
-                                            $uploaded_file_type = $arr_file_type['type'];
4568
+										$image_name_parts = explode( '.', $image_name );
4569
+										array_pop( $image_name_parts );
4570
+										$proper_image_name = implode( '.', $image_name_parts );
4571
+										$xtimings['###9.2'] = microtime(true)-$xstart;
4572
+										$arr_file_type = wp_check_filetype( $image_name );
4573
+										$xtimings['###9.3'] = microtime(true)-$xstart;
4574
+										if ( !empty( $arr_file_type ) ) {
4575
+											$uploaded_file_type = $arr_file_type['type'];
4576 4576
                                             
4577
-                                            $attachment = array();
4578
-                                            $attachment['post_id'] = $saved_post_id;
4579
-                                            $attachment['title'] = $proper_image_name;
4580
-                                            $attachment['content'] = '';
4581
-                                            $attachment['file'] = $uploads_subdir . '/' . $image_name;
4582
-                                            $attachment['mime_type'] = $uploaded_file_type;
4583
-                                            $attachment['menu_order'] = $order;
4584
-                                            $attachment['is_featured'] = 0;
4585
-
4586
-                                            $attachment_set = '';
4587
-                                            foreach ( $attachment as $key => $val ) {
4588
-                                                if ( $val != '' ) {
4589
-                                                    $attachment_set .= $key . " = '" . $val . "', ";
4590
-                                                }
4591
-                                            }
4592
-                                            $attachment_set = trim( $attachment_set, ", " );
4577
+											$attachment = array();
4578
+											$attachment['post_id'] = $saved_post_id;
4579
+											$attachment['title'] = $proper_image_name;
4580
+											$attachment['content'] = '';
4581
+											$attachment['file'] = $uploads_subdir . '/' . $image_name;
4582
+											$attachment['mime_type'] = $uploaded_file_type;
4583
+											$attachment['menu_order'] = $order;
4584
+											$attachment['is_featured'] = 0;
4585
+
4586
+											$attachment_set = '';
4587
+											foreach ( $attachment as $key => $val ) {
4588
+												if ( $val != '' ) {
4589
+													$attachment_set .= $key . " = '" . $val . "', ";
4590
+												}
4591
+											}
4592
+											$attachment_set = trim( $attachment_set, ", " );
4593 4593
                                                                                         
4594
-                                            // Add new attachment
4595
-                                            $xtimings['###9.4'] = microtime(true)-$xstart;
4596
-                                            $wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4597
-                                            $xtimings['###9.5'] = microtime(true)-$xstart;
4598
-                                            $order++;
4599
-                                        }
4600
-                                    }
4601
-
4602
-                                    $saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4603
-                                    // Remove previous attachment
4604
-                                    $wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4605
-                                    $xtimings['###9.6'] = microtime(true)-$xstart;
4606
-                                    if ( !empty( $saved_post_images_arr ) ) {
4607
-                                        geodir_set_wp_featured_image($saved_post_id);
4608
-                                        $xtimings['###9.7'] = microtime(true)-$xstart;
4609
-                                        /*
4594
+											// Add new attachment
4595
+											$xtimings['###9.4'] = microtime(true)-$xstart;
4596
+											$wpdb->query( "INSERT INTO " . GEODIR_ATTACHMENT_TABLE . " SET " . $attachment_set );
4597
+											$xtimings['###9.5'] = microtime(true)-$xstart;
4598
+											$order++;
4599
+										}
4600
+									}
4601
+
4602
+									$saved_post_images_sql = !empty($saved_post_images_arr) ? " AND ( file NOT LIKE '%/" . implode("' AND file NOT LIKE '%/",  $saved_post_images_arr) . "' )" : '';
4603
+									// Remove previous attachment
4604
+									$wpdb->query( "DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = " . (int)$saved_post_id . " " . $saved_post_images_sql );
4605
+									$xtimings['###9.6'] = microtime(true)-$xstart;
4606
+									if ( !empty( $saved_post_images_arr ) ) {
4607
+										geodir_set_wp_featured_image($saved_post_id);
4608
+										$xtimings['###9.7'] = microtime(true)-$xstart;
4609
+										/*
4610 4610
                                         $menu_order = 1;
4611 4611
                                         
4612 4612
                                         foreach ( $saved_post_images_arr as $img_name ) {
@@ -4619,288 +4619,288 @@  discard block
 block discarded – undo
4619 4619
                                             }
4620 4620
                                             $menu_order++;
4621 4621
                                         }*/
4622
-                                    }
4622
+									}
4623 4623
                                     
4624
-                                    if ( $order > 1 ) {
4625
-                                        $images++;
4626
-                                    }
4627
-                                }
4628
-                                $xtimings['###10'] = microtime(true)-$xstart;
4629
-                                /** This action is documented in geodirectory-functions/post-functions.php */
4630
-                                do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4631
-                                $xtimings['###11'] = microtime(true)-$xstart;
4632
-                                if (isset($is_featured)) {
4633
-                                    geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4634
-                                }
4635
-                                if (isset($gd_post['alive_days'])) {
4636
-                                    geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']);
4637
-                                }
4638
-                                if (isset($gd_post['expire_date'])) {
4639
-                                    geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4640
-                                }
4641
-                                $xtimings['###12'] = microtime(true)-$xstart;
4642
-                            }
4624
+									if ( $order > 1 ) {
4625
+										$images++;
4626
+									}
4627
+								}
4628
+								$xtimings['###10'] = microtime(true)-$xstart;
4629
+								/** This action is documented in geodirectory-functions/post-functions.php */
4630
+								do_action( 'geodir_after_save_listing', $saved_post_id, $gd_post );
4631
+								$xtimings['###11'] = microtime(true)-$xstart;
4632
+								if (isset($is_featured)) {
4633
+									geodir_save_post_meta($saved_post_id, 'is_featured', $is_featured);
4634
+								}
4635
+								if (isset($gd_post['alive_days'])) {
4636
+									geodir_save_post_meta($saved_post_id, 'alive_days', $gd_post['alive_days']);
4637
+								}
4638
+								if (isset($gd_post['expire_date'])) {
4639
+									geodir_save_post_meta($saved_post_id, 'expire_date', $gd_post['expire_date']);
4640
+								}
4641
+								$xtimings['###12'] = microtime(true)-$xstart;
4642
+							}
4643 4643
                             
4644
-                            // WPML
4645
-                            if ($is_wpml && $language != '') {
4646
-                                $sitepress->switch_lang($active_lang, true);
4647
-                            }
4648
-                            // WPML
4649
-                        }
4650
-                    }
4651
-                }
4644
+							// WPML
4645
+							if ($is_wpml && $language != '') {
4646
+								$sitepress->switch_lang($active_lang, true);
4647
+							}
4648
+							// WPML
4649
+						}
4650
+					}
4651
+				}
4652 4652
 
4653
-                //undo some stuff to make the import quicker
4654
-                wp_defer_term_counting( false );
4655
-                wp_defer_comment_counting( false );
4656
-                $wpdb->query( 'COMMIT;' );
4657
-                $wpdb->query( 'SET autocommit = 1;' );
4658
-                $xtimings['###13'] = microtime(true)-$xstart;
4659
-                $json = array();
4660
-                $json['processed'] = $processed_actual;
4661
-                $json['created'] = $created;
4662
-                $json['updated'] = $updated;
4663
-                $json['skipped'] = $skipped;
4664
-                $json['invalid'] = $invalid;
4665
-                $json['invalid_addr'] = $invalid_addr;
4666
-                $json['images'] = $images;
4667
-                $json['timing'] = microtime(true)-$xstart;
4668
-                $json['timings'] = $xtimings;
4653
+				//undo some stuff to make the import quicker
4654
+				wp_defer_term_counting( false );
4655
+				wp_defer_comment_counting( false );
4656
+				$wpdb->query( 'COMMIT;' );
4657
+				$wpdb->query( 'SET autocommit = 1;' );
4658
+				$xtimings['###13'] = microtime(true)-$xstart;
4659
+				$json = array();
4660
+				$json['processed'] = $processed_actual;
4661
+				$json['created'] = $created;
4662
+				$json['updated'] = $updated;
4663
+				$json['skipped'] = $skipped;
4664
+				$json['invalid'] = $invalid;
4665
+				$json['invalid_addr'] = $invalid_addr;
4666
+				$json['images'] = $images;
4667
+				$json['timing'] = microtime(true)-$xstart;
4668
+				$json['timings'] = $xtimings;
4669 4669
                 
4670 4670
 
4671
-                wp_send_json( $json );
4672
-                exit;
4673
-            } else if ( $task == 'import_loc' ) {
4674
-                global $gd_post_types;
4675
-                $gd_post_types = $post_types;
4671
+				wp_send_json( $json );
4672
+				exit;
4673
+			} else if ( $task == 'import_loc' ) {
4674
+				global $gd_post_types;
4675
+				$gd_post_types = $post_types;
4676 4676
                 
4677
-                if (!empty($file)) {
4678
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4677
+				if (!empty($file)) {
4678
+					$columns = isset($file[0]) ? $file[0] : NULL;
4679 4679
                     
4680
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4681
-                        $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4682
-                        wp_send_json( $json );
4683
-                    }
4680
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4681
+						$json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4682
+						wp_send_json( $json );
4683
+					}
4684 4684
                     
4685
-                    $gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4686
-                    $gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4687
-                    for ($i = 1; $i <= $limit; $i++) {
4688
-                        $index = $processed + $i;
4685
+					$gd_error_log = __('GD IMPORT LOCATIONS [ROW %d]:', 'geodirectory');
4686
+					$gd_error_location = __( 'Could not be saved due to blank/invalid address(city, region, country, latitude, longitude)', 'geodirectory' );
4687
+					for ($i = 1; $i <= $limit; $i++) {
4688
+						$index = $processed + $i;
4689 4689
                         
4690
-                        if (isset($file[$index])) {
4691
-                            $row = $file[$index];
4692
-                            $row = array_map( 'trim', $row );
4693
-                            $data = array();
4690
+						if (isset($file[$index])) {
4691
+							$row = $file[$index];
4692
+							$row = array_map( 'trim', $row );
4693
+							$data = array();
4694 4694
                             
4695
-                            foreach ($columns as $c => $column ) {
4696
-                                if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4697
-                                    $data[$column] = $row[$c];
4698
-                                }
4699
-                            }
4695
+							foreach ($columns as $c => $column ) {
4696
+								if (in_array($column, array('location_id', 'latitude', 'longitude', 'city', 'city_slug', 'region', 'country', 'city_meta_title', 'city_meta_desc', 'city_desc', 'region_meta_title', 'region_meta_desc', 'region_desc', 'country_meta_title', 'country_meta_desc', 'country_desc'))) {
4697
+									$data[$column] = $row[$c];
4698
+								}
4699
+							}
4700 4700
 
4701
-                            if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4702
-                                $invalid++;
4703
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4704
-                                continue;
4705
-                            }
4701
+							if ( empty($data['city']) || empty($data['region']) || empty($data['country']) || empty($data['latitude']) || empty($data['longitude']) ) {
4702
+								$invalid++;
4703
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4704
+								continue;
4705
+							}
4706 4706
                             
4707
-                            $data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4707
+							$data['location_id'] = isset($data['location_id']) ? absint($data['location_id']) : 0;
4708 4708
                             
4709
-                            if ( $import_choice == 'update' ) {
4710
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4711
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4712
-                                        $updated++;
4713
-                                    } else {
4714
-                                        $invalid++;
4715
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4716
-                                    }
4717
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4718
-                                    $data['location_id'] = (int)$location->location_id;
4709
+							if ( $import_choice == 'update' ) {
4710
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4711
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4712
+										$updated++;
4713
+									} else {
4714
+										$invalid++;
4715
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4716
+									}
4717
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4718
+									$data['location_id'] = (int)$location->location_id;
4719 4719
                                     
4720
-                                    if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4721
-                                        $data['location_id'] = (int)$location->location_id;
4722
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4723
-                                        $data['location_id'] = (int)$location->location_id;
4724
-                                    } else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4725
-                                        $data['location_id'] = (int)$location->location_id;
4726
-                                    }
4720
+									if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'], 'region' => $data['region'] ) ) ) {
4721
+										$data['location_id'] = (int)$location->location_id;
4722
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'region' => $data['region'] ) ) ) {
4723
+										$data['location_id'] = (int)$location->location_id;
4724
+									} else if ( $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'], 'country' => $data['country'] ) ) ) {
4725
+										$data['location_id'] = (int)$location->location_id;
4726
+									}
4727 4727
                                     
4728
-                                    if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4729
-                                        $updated++;
4730
-                                    } else {
4731
-                                        $invalid++;
4732
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4733
-                                    }
4734
-                                } else {
4735
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4736
-                                        $created++;
4737
-                                    } else {
4738
-                                        $invalid++;
4739
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4740
-                                    }
4741
-                                }
4742
-                            } elseif ( $import_choice == 'skip' ) {
4743
-                                if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4744
-                                    $skipped++;
4745
-                                } else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4746
-                                    $skipped++;
4747
-                                } else {
4748
-                                    if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4749
-                                        $created++;
4750
-                                    } else {
4751
-                                        $invalid++;
4752
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4753
-                                    }
4754
-                                }
4755
-                            } else {
4756
-                                $invalid++;
4757
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4758
-                            }
4759
-                        }
4760
-                    }
4761
-                }
4728
+									if ( $location_id = geodir_location_update_city( $data, true, $location ) ) {
4729
+										$updated++;
4730
+									} else {
4731
+										$invalid++;
4732
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4733
+									}
4734
+								} else {
4735
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4736
+										$created++;
4737
+									} else {
4738
+										$invalid++;
4739
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4740
+									}
4741
+								}
4742
+							} elseif ( $import_choice == 'skip' ) {
4743
+								if ( (int)$data['location_id'] > 0 && $location = geodir_get_location_by_id( '', (int)$data['location_id'] ) ) {
4744
+									$skipped++;
4745
+								} else if ( !empty( $data['city_slug'] ) && $location = geodir_get_location_by_slug( 'city', array( 'city_slug' => $data['city_slug'] ) ) ) {
4746
+									$skipped++;
4747
+								} else {
4748
+									if ( $location_id = geodir_location_insert_city( $data, true ) ) {
4749
+										$created++;
4750
+									} else {
4751
+										$invalid++;
4752
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4753
+									}
4754
+								}
4755
+							} else {
4756
+								$invalid++;
4757
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_location );
4758
+							}
4759
+						}
4760
+					}
4761
+				}
4762 4762
                 
4763
-                $json = array();
4764
-                $json['processed'] = $limit;
4765
-                $json['created'] = $created;
4766
-                $json['updated'] = $updated;
4767
-                $json['skipped'] = $skipped;
4768
-                $json['invalid'] = $invalid;
4769
-                $json['images'] = $images;
4763
+				$json = array();
4764
+				$json['processed'] = $limit;
4765
+				$json['created'] = $created;
4766
+				$json['updated'] = $updated;
4767
+				$json['skipped'] = $skipped;
4768
+				$json['invalid'] = $invalid;
4769
+				$json['images'] = $images;
4770 4770
                 
4771
-                wp_send_json( $json );
4772
-            } else if ( $task == 'import_hood' ) {               
4773
-                if (!empty($file)) {
4774
-                    $columns = isset($file[0]) ? $file[0] : NULL;
4771
+				wp_send_json( $json );
4772
+			} else if ( $task == 'import_hood' ) {               
4773
+				if (!empty($file)) {
4774
+					$columns = isset($file[0]) ? $file[0] : NULL;
4775 4775
                     
4776
-                    if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4777
-                        $json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4778
-                        wp_send_json( $json );
4779
-                    }
4776
+					if (empty($columns) || (!empty($columns) && $columns[0] == '')) {
4777
+						$json['error'] = __('The file you are uploading is not valid. There are problems with the file columns.', 'geodirectory');
4778
+						wp_send_json( $json );
4779
+					}
4780 4780
                     
4781
-                    $gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4782
-                    $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' );
4783
-                    for ($i = 1; $i <= $limit; $i++) {
4784
-                        $index = $processed + $i;
4781
+					$gd_error_log = __('GD IMPORT NEIGHBOURHOODS [ROW %d]:', 'geodirectory');
4782
+					$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' );
4783
+					for ($i = 1; $i <= $limit; $i++) {
4784
+						$index = $processed + $i;
4785 4785
                         
4786
-                        if (isset($file[$index])) {
4787
-                            $row = $file[$index];
4788
-                            $row = array_map( 'trim', $row );
4789
-                            $data = array();
4786
+						if (isset($file[$index])) {
4787
+							$row = $file[$index];
4788
+							$row = array_map( 'trim', $row );
4789
+							$data = array();
4790 4790
                             
4791
-                            foreach ($columns as $c => $column) {
4792
-                                if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4793
-                                    $data[$column] = sanitize_text_field($row[$c]);
4794
-                                }
4795
-                            }
4791
+							foreach ($columns as $c => $column) {
4792
+								if (in_array($column, array('neighbourhood_id', 'neighbourhood_name', 'neighbourhood_slug', 'latitude', 'longitude', 'location_id', 'city', 'region', 'country'))) {
4793
+									$data[$column] = sanitize_text_field($row[$c]);
4794
+								}
4795
+							}
4796 4796
 
4797
-                            if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4798
-                                $invalid++;
4799
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4800
-                                continue;
4801
-                            }
4797
+							if (empty($data['neighbourhood_name']) || empty($data['latitude']) || empty($data['longitude'])) {
4798
+								$invalid++;
4799
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4800
+								continue;
4801
+							}
4802 4802
                             
4803
-                            $location_info = array();
4804
-                            if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4805
-                                $location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4806
-                            } else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4807
-                                $location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4808
-                            }
4803
+							$location_info = array();
4804
+							if (!empty($data['location_id']) && (int)$data['location_id'] > 0) {
4805
+								$location_info = geodir_get_location_by_id('', (int)$data['location_id']);
4806
+							} else if (!empty($data['city']) && !empty($data['region']) && !empty($data['country'])) {
4807
+								$location_info = geodir_get_location_by_slug('city', array('fields' => 'location_id', 'city' => $data['city'], 'country' => $data['country'], 'region' => $data['region']));
4808
+							}
4809 4809
 
4810
-                            if (empty($location_info)) {
4811
-                                $invalid++;
4812
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4813
-                                continue;
4814
-                            }
4810
+							if (empty($location_info)) {
4811
+								$invalid++;
4812
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4813
+								continue;
4814
+							}
4815 4815
                             
4816
-                            $location_id = $location_info->location_id;
4816
+							$location_id = $location_info->location_id;
4817 4817
 
4818
-                            $data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4818
+							$data['neighbourhood_id'] = isset($data['neighbourhood_id']) ? absint($data['neighbourhood_id']) : 0;
4819 4819
                             
4820
-                            $hood_data = array();
4821
-                            $hood_data['hood_name'] = $data['neighbourhood_name'];
4822
-                            $hood_data['hood_slug'] = $data['neighbourhood_slug'];
4823
-                            $hood_data['hood_latitude'] = $data['latitude'];
4824
-                            $hood_data['hood_longitude'] = $data['longitude'];
4825
-                            $hood_data['hood_location_id'] = $location_id;
4820
+							$hood_data = array();
4821
+							$hood_data['hood_name'] = $data['neighbourhood_name'];
4822
+							$hood_data['hood_slug'] = $data['neighbourhood_slug'];
4823
+							$hood_data['hood_latitude'] = $data['latitude'];
4824
+							$hood_data['hood_longitude'] = $data['longitude'];
4825
+							$hood_data['hood_location_id'] = $location_id;
4826 4826
                                     
4827
-                            if ( $import_choice == 'update' ) {
4828
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4829
-                                    $hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4827
+							if ( $import_choice == 'update' ) {
4828
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4829
+									$hood_data['hood_id'] = (int)$data['neighbourhood_id'];
4830 4830
                                     
4831
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4832
-                                        $updated++;
4833
-                                    } else {
4834
-                                        $invalid++;
4835
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4836
-                                    }
4837
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4838
-                                    $hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4831
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4832
+										$updated++;
4833
+									} else {
4834
+										$invalid++;
4835
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4836
+									}
4837
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4838
+									$hood_data['hood_id'] = (int)$neighbourhood->hood_id;
4839 4839
                                     
4840
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4841
-                                        $updated++;
4842
-                                    } else {
4843
-                                        $invalid++;
4844
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4845
-                                    }
4846
-                                } else {
4847
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4848
-                                        $created++;
4849
-                                    } else {
4850
-                                        $invalid++;
4851
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4852
-                                    }
4853
-                                }
4854
-                            } elseif ( $import_choice == 'skip' ) {
4855
-                                if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4856
-                                    $skipped++;
4857
-                                } else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4858
-                                    $skipped++;
4859
-                                } else {
4840
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4841
+										$updated++;
4842
+									} else {
4843
+										$invalid++;
4844
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4845
+									}
4846
+								} else {
4847
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4848
+										$created++;
4849
+									} else {
4850
+										$invalid++;
4851
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4852
+									}
4853
+								}
4854
+							} elseif ( $import_choice == 'skip' ) {
4855
+								if ((int)$data['neighbourhood_id'] > 0 && ($neighbourhood = geodir_location_get_neighbourhood_by_id((int)$data['neighbourhood_id']))) {
4856
+									$skipped++;
4857
+								} else if (!empty($data['neighbourhood_slug']) && ($neighbourhood = geodir_location_get_neighbourhood_by_id($data['neighbourhood_slug'], true))) {
4858
+									$skipped++;
4859
+								} else {
4860 4860
                                     
4861
-                                    if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4862
-                                        $created++;
4863
-                                    } else {
4864
-                                        $invalid++;
4865
-                                        geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4866
-                                    }
4867
-                                }
4868
-                            } else {
4869
-                                $invalid++;
4870
-                                geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4871
-                            }
4872
-                        }
4873
-                    }
4874
-                }
4861
+									if ($neighbourhood = geodir_location_insert_update_neighbourhood($hood_data)) {
4862
+										$created++;
4863
+									} else {
4864
+										$invalid++;
4865
+										geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4866
+									}
4867
+								}
4868
+							} else {
4869
+								$invalid++;
4870
+								geodir_error_log( wp_sprintf( $gd_error_log, ($index + 1) ) . ' ' . $gd_error_hood );
4871
+							}
4872
+						}
4873
+					}
4874
+				}
4875 4875
                 
4876
-                $json = array();
4877
-                $json['processed'] = $limit;
4878
-                $json['created'] = $created;
4879
-                $json['updated'] = $updated;
4880
-                $json['skipped'] = $skipped;
4881
-                $json['invalid'] = $invalid;
4882
-                $json['images'] = $images;
4876
+				$json = array();
4877
+				$json['processed'] = $limit;
4878
+				$json['created'] = $created;
4879
+				$json['updated'] = $updated;
4880
+				$json['skipped'] = $skipped;
4881
+				$json['invalid'] = $invalid;
4882
+				$json['images'] = $images;
4883 4883
                 
4884
-                wp_send_json( $json );
4885
-            }
4886
-        }
4887
-        break;
4888
-        case 'import_finish':{
4889
-            /**
4890
-             * Run an action when an import finishes.
4891
-             *
4892
-             * This action can be used to fire functions after an import ends.
4893
-             *
4894
-             * @since 1.5.3
4895
-             * @package GeoDirectory
4896
-             */
4897
-            do_action('geodir_import_finished');
4898
-        }
4899
-        break;
4884
+				wp_send_json( $json );
4885
+			}
4886
+		}
4887
+		break;
4888
+		case 'import_finish':{
4889
+			/**
4890
+			 * Run an action when an import finishes.
4891
+			 *
4892
+			 * This action can be used to fire functions after an import ends.
4893
+			 *
4894
+			 * @since 1.5.3
4895
+			 * @package GeoDirectory
4896
+			 */
4897
+			do_action('geodir_import_finished');
4898
+		}
4899
+		break;
4900 4900
 
4901
-    }
4902
-    echo '0';
4903
-    gd_die();
4901
+	}
4902
+	echo '0';
4903
+	gd_die();
4904 4904
 }
4905 4905
 
4906 4906
 /**
@@ -4944,12 +4944,12 @@  discard block
 block discarded – undo
4944 4944
 		$args['slug'] = wp_unique_term_slug( $args['slug'], (object)$term_args );
4945 4945
 	}
4946 4946
 	
4947
-    if( !empty( $term ) ) {
4947
+	if( !empty( $term ) ) {
4948 4948
 		$result = wp_insert_term( $term, $taxonomy, $args );
4949
-        if( !is_wp_error( $result ) ) {
4950
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4951
-        }
4952
-    }
4949
+		if( !is_wp_error( $result ) ) {
4950
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4951
+		}
4952
+	}
4953 4953
 	
4954 4954
 	return false;
4955 4955
 }
@@ -4995,16 +4995,16 @@  discard block
 block discarded – undo
4995 4995
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
4996 4996
 		
4997 4997
 		if( !is_wp_error( $result ) ) {
4998
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4999
-        }
4998
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
4999
+		}
5000 5000
 	} else if ( $term_data['slug'] != '' && $term_info = (array)term_exists( $term_data['slug'], $taxonomy ) ) {
5001 5001
 		$term_data['term_id'] = $term_info['term_id'];
5002 5002
 		
5003 5003
 		$result = wp_update_term( $term_data['term_id'], $taxonomy, $term_data );
5004 5004
 		
5005 5005
 		if( !is_wp_error( $result ) ) {
5006
-            return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5007
-        }
5006
+			return isset( $result['term_id'] ) ? $result['term_id'] : 0;
5007
+		}
5008 5008
 	} else {
5009 5009
 		return geodir_imex_insert_term( $taxonomy, $term_data );
5010 5010
 	}
@@ -5026,47 +5026,47 @@  discard block
 block discarded – undo
5026 5026
  * @return int Posts count.
5027 5027
  */
5028 5028
 function geodir_get_posts_count( $post_type ) {
5029
-    global $wpdb, $plugin_prefix;
5029
+	global $wpdb, $plugin_prefix;
5030 5030
 
5031
-    if ( !post_type_exists( $post_type ) ) {
5032
-        return 0;
5033
-    }
5031
+	if ( !post_type_exists( $post_type ) ) {
5032
+		return 0;
5033
+	}
5034 5034
         
5035
-    $table = $plugin_prefix . $post_type . '_detail';
5035
+	$table = $plugin_prefix . $post_type . '_detail';
5036 5036
 
5037
-    // Skip listing with statuses trash, auto-draft etc...
5038
-    $skip_statuses = geodir_imex_export_skip_statuses();
5039
-    $where_statuses = '';
5040
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5041
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5042
-    }
5037
+	// Skip listing with statuses trash, auto-draft etc...
5038
+	$skip_statuses = geodir_imex_export_skip_statuses();
5039
+	$where_statuses = '';
5040
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5041
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5042
+	}
5043 5043
     
5044
-    /**
5045
-     * Filter the SQL where clause part to filter posts count in import/export.
5046
-     *
5047
-     * @since 1.6.4
5048
-     * @package GeoDirectory
5049
-     *
5050
-     * @param string $where SQL where clause part.
5051
-     */
5052
-    $where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5053
-
5054
-    $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 );
5055
-
5056
-    $posts_count = (int)$wpdb->get_var( $query );
5044
+	/**
5045
+	 * Filter the SQL where clause part to filter posts count in import/export.
5046
+	 *
5047
+	 * @since 1.6.4
5048
+	 * @package GeoDirectory
5049
+	 *
5050
+	 * @param string $where SQL where clause part.
5051
+	 */
5052
+	$where_statuses = apply_filters( 'geodir_get_posts_count', $where_statuses, $post_type );
5053
+
5054
+	$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 );
5055
+
5056
+	$posts_count = (int)$wpdb->get_var( $query );
5057 5057
     
5058
-    /**
5059
-     * Modify returned post counts for the current post type.
5060
-     *
5061
-     * @since 1.4.6
5062
-     * @package GeoDirectory
5063
-     *
5064
-     * @param int $posts_count Post counts.
5065
-     * @param string $post_type Post type.
5066
-     */
5067
-    $posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5068
-
5069
-    return $posts_count;
5058
+	/**
5059
+	 * Modify returned post counts for the current post type.
5060
+	 *
5061
+	 * @since 1.4.6
5062
+	 * @package GeoDirectory
5063
+	 *
5064
+	 * @param int $posts_count Post counts.
5065
+	 * @param string $post_type Post type.
5066
+	 */
5067
+	$posts_count = apply_filters( 'geodir_imex_count_posts', $posts_count, $post_type );
5068
+
5069
+	return $posts_count;
5070 5070
 }
5071 5071
 
5072 5072
 /**
@@ -5134,7 +5134,7 @@  discard block
 block discarded – undo
5134 5134
 		}
5135 5135
 		$csv_row[] = 'post_status';
5136 5136
 		$csv_row[] = 'is_featured';
5137
-        // Export claim listing field
5137
+		// Export claim listing field
5138 5138
 		if ($is_claim_active) {
5139 5139
 			$csv_row[] = 'claimed';
5140 5140
 		}
@@ -5143,7 +5143,7 @@  discard block
 block discarded – undo
5143 5143
 			$csv_row[] = 'alive_days';
5144 5144
 			$csv_row[] = 'expire_date';
5145 5145
 		}
5146
-        $csv_row[] = 'post_date';
5146
+		$csv_row[] = 'post_date';
5147 5147
 		$csv_row[] = 'post_address';
5148 5148
 		$csv_row[] = 'post_city';
5149 5149
 		$csv_row[] = 'post_region';
@@ -5151,11 +5151,11 @@  discard block
 block discarded – undo
5151 5151
 		$csv_row[] = 'post_zip';
5152 5152
 		$csv_row[] = 'post_latitude';
5153 5153
 		$csv_row[] = 'post_longitude';
5154
-        if ($neighbourhood_active) {
5155
-            $csv_row[] = 'post_neighbourhood';
5156
-            $csv_row[] = 'neighbourhood_latitude';
5157
-            $csv_row[] = 'neighbourhood_longitude';
5158
-        }
5154
+		if ($neighbourhood_active) {
5155
+			$csv_row[] = 'post_neighbourhood';
5156
+			$csv_row[] = 'neighbourhood_latitude';
5157
+			$csv_row[] = 'neighbourhood_longitude';
5158
+		}
5159 5159
 		$csv_row[] = 'geodir_timing';
5160 5160
 		$csv_row[] = 'geodir_contact';
5161 5161
 		$csv_row[] = 'geodir_email';
@@ -5190,21 +5190,21 @@  discard block
 block discarded – undo
5190 5190
 			$csv_row[] = 'franchise';
5191 5191
 		}
5192 5192
         
5193
-        /**
5194
-         * Filter columns field names of gd export listings csv.
5195
-         *
5196
-         * @since 1.6.5
5197
-         * @package GeoDirectory
5198
-         *
5199
-         * @param array $csv_row Column names being exported in csv.
5200
-         * @param string $post_type The post type.
5201
-         */
5202
-        $csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
5193
+		/**
5194
+		 * Filter columns field names of gd export listings csv.
5195
+		 *
5196
+		 * @since 1.6.5
5197
+		 * @package GeoDirectory
5198
+		 *
5199
+		 * @param array $csv_row Column names being exported in csv.
5200
+		 * @param string $post_type The post type.
5201
+		 */
5202
+		$csv_row = apply_filters('geodir_export_listing_csv_column_names', $csv_row, $post_type);
5203 5203
 		
5204 5204
 		$csv_rows[] = $csv_row;
5205 5205
 
5206 5206
 		$images_count = 5;
5207
-        $xx=0;
5207
+		$xx=0;
5208 5208
 		foreach ( $posts as $post ) {$xx++;
5209 5209
 			$post_id = $post['ID'];
5210 5210
 			
@@ -5335,15 +5335,15 @@  discard block
 block discarded – undo
5335 5335
 			}
5336 5336
 			$csv_row[] = $post_info['post_status']; // post_status
5337 5337
 			$csv_row[] = (int)$post_info['is_featured'] == 1 ? 1 : ''; // is_featured
5338
-            if ($is_claim_active) {
5339
-                $csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5340
-            }
5338
+			if ($is_claim_active) {
5339
+				$csv_row[] = !empty($post_info['claimed']) && (int)$post_info['claimed'] == 1 ? 1 : ''; // claimed
5340
+			}
5341 5341
 			if ($is_payment_plugin) {
5342 5342
 				$csv_row[] = (int)$post_info['package_id']; // package_id
5343 5343
 				$csv_row[] = $post_info['alive_days'] !== '' ? absint($post_info['alive_days']) : ''; // alive_days
5344 5344
 				$csv_row[] = $post_info['expire_date'] != '' && geodir_strtolower($post_info['expire_date']) != 'never' ? date_i18n('Y-m-d', strtotime($post_info['expire_date'])) : 'Never'; // expire_date
5345 5345
 			}
5346
-            $csv_row[] = $post_info['post_date']; // post_date
5346
+			$csv_row[] = $post_info['post_date']; // post_date
5347 5347
 			$csv_row[] = stripslashes($post_info['post_address']); // post_address
5348 5348
 			$csv_row[] = stripslashes($post_info['post_city']); // post_city
5349 5349
 			$csv_row[] = stripslashes($post_info['post_region']); // post_region
@@ -5351,21 +5351,21 @@  discard block
 block discarded – undo
5351 5351
 			$csv_row[] = stripslashes($post_info['post_zip']); // post_zip
5352 5352
 			$csv_row[] = $post_info['post_latitude']; // post_latitude
5353 5353
 			$csv_row[] = $post_info['post_longitude']; // post_longitude
5354
-            if ($neighbourhood_active) {
5355
-                $post_neighbourhood = '';
5356
-                $neighbourhood_latitude = '';
5357
-                $neighbourhood_longitude = '';
5358
-                if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5359
-                    if (!empty($hood_info)) {
5360
-                        $post_neighbourhood = $hood_info->hood_name;
5361
-                        $neighbourhood_latitude = $hood_info->hood_latitude;
5362
-                        $neighbourhood_longitude = $hood_info->hood_longitude;
5363
-                    }
5364
-                }
5365
-                $csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood
5366
-                $csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5367
-                $csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5368
-            }
5354
+			if ($neighbourhood_active) {
5355
+				$post_neighbourhood = '';
5356
+				$neighbourhood_latitude = '';
5357
+				$neighbourhood_longitude = '';
5358
+				if (!empty($post_info['post_neighbourhood']) && ($hood_info = geodir_location_get_neighbourhood_by_id($post_info['post_neighbourhood'], true, $post_info['post_location_id']))) {
5359
+					if (!empty($hood_info)) {
5360
+						$post_neighbourhood = $hood_info->hood_name;
5361
+						$neighbourhood_latitude = $hood_info->hood_latitude;
5362
+						$neighbourhood_longitude = $hood_info->hood_longitude;
5363
+					}
5364
+				}
5365
+				$csv_row[] = stripslashes($post_neighbourhood); // post_neighbourhood
5366
+				$csv_row[] = $neighbourhood_latitude; // neighbourhood_latitude
5367
+				$csv_row[] = $neighbourhood_longitude; // neighbourhood_longitude
5368
+			}
5369 5369
 			$csv_row[] = stripslashes($post_info['geodir_timing']); // geodir_timing
5370 5370
 			$csv_row[] = stripslashes($post_info['geodir_contact']); // geodir_contact
5371 5371
 			$csv_row[] = stripslashes($post_info['geodir_email']); // geodir_email
@@ -5408,16 +5408,16 @@  discard block
 block discarded – undo
5408 5408
 				$csv_row[] = (int)$franchise; // franchise id
5409 5409
 			}
5410 5410
             
5411
-            /**
5412
-             * Filter columns values of gd export listings csv file
5413
-             *
5414
-             * @since 1.6.5
5415
-             * @package GeoDirectory
5416
-             *
5417
-             * @param array $csv_row Field values being exported in csv.
5418
-             * @param array $post_info The post info.
5419
-             */
5420
-            $csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5411
+			/**
5412
+			 * Filter columns values of gd export listings csv file
5413
+			 *
5414
+			 * @since 1.6.5
5415
+			 * @package GeoDirectory
5416
+			 *
5417
+			 * @param array $csv_row Field values being exported in csv.
5418
+			 * @param array $post_info The post info.
5419
+			 */
5420
+			$csv_row = apply_filters('geodir_export_listing_csv_column_values', $csv_row, $post_info);
5421 5421
 			
5422 5422
 			for ( $c = 0; $c < $images_count; $c++ ) {
5423 5423
 				$csv_row[] = isset( $current_images[$c] ) ? $current_images[$c] : ''; // IMAGE
@@ -5450,64 +5450,64 @@  discard block
 block discarded – undo
5450 5450
  * @return array Array of posts data.
5451 5451
  */
5452 5452
 function geodir_get_export_posts( $post_type, $per_page = 0, $page_no = 0 ) {
5453
-    global $wpdb, $plugin_prefix;
5453
+	global $wpdb, $plugin_prefix;
5454 5454
 
5455
-    if ( ! post_type_exists( $post_type ) )
5456
-        return new stdClass;
5455
+	if ( ! post_type_exists( $post_type ) )
5456
+		return new stdClass;
5457 5457
         
5458
-    $table = $plugin_prefix . $post_type . '_detail';
5458
+	$table = $plugin_prefix . $post_type . '_detail';
5459 5459
 
5460
-    $limit = '';
5461
-    if ( $per_page > 0 && $page_no > 0 ) {
5462
-        $offset = ( $page_no - 1 ) * $per_page;
5460
+	$limit = '';
5461
+	if ( $per_page > 0 && $page_no > 0 ) {
5462
+		$offset = ( $page_no - 1 ) * $per_page;
5463 5463
         
5464
-        if ( $offset > 0 ) {
5465
-            $limit = " LIMIT " . $offset . "," . $per_page;
5466
-        } else {
5467
-            $limit = " LIMIT " . $per_page;
5468
-        }
5469
-    }
5464
+		if ( $offset > 0 ) {
5465
+			$limit = " LIMIT " . $offset . "," . $per_page;
5466
+		} else {
5467
+			$limit = " LIMIT " . $per_page;
5468
+		}
5469
+	}
5470 5470
 
5471
-    // Skip listing with statuses trash, auto-draft etc...
5472
-    $skip_statuses = geodir_imex_export_skip_statuses();
5473
-    $where_statuses = '';
5474
-    if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5475
-        $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5476
-    }
5471
+	// Skip listing with statuses trash, auto-draft etc...
5472
+	$skip_statuses = geodir_imex_export_skip_statuses();
5473
+	$where_statuses = '';
5474
+	if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5475
+		$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5476
+	}
5477 5477
     
5478
-    /**
5479
-     * Filter the SQL where clause part to filter posts in import/export.
5480
-     *
5481
-     * @since 1.6.4
5482
-     * @package GeoDirectory
5483
-     *
5484
-     * @param string $where SQL where clause part.
5485
-     */
5486
-    $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5487
-
5488
-    $query = $wpdb->prepare( "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, $post_type );
5489
-    /**
5490
-     * Modify returned posts SQL query for the current post type.
5491
-     *
5492
-     * @since 1.4.6
5493
-     * @package GeoDirectory
5494
-     *
5495
-     * @param int $query The SQL query.
5496
-     * @param string $post_type Post type.
5497
-     */
5498
-    $query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5499
-    $results = (array)$wpdb->get_results( $query, ARRAY_A );
5500
-
5501
-    /**
5502
-     * Modify returned post results for the current post type.
5503
-     *
5504
-     * @since 1.4.6
5505
-     * @package GeoDirectory
5506
-     *
5507
-     * @param object $results An object containing all post ids.
5508
-     * @param string $post_type Post type.
5509
-     */
5510
-    return apply_filters( 'geodir_export_posts', $results, $post_type );
5478
+	/**
5479
+	 * Filter the SQL where clause part to filter posts in import/export.
5480
+	 *
5481
+	 * @since 1.6.4
5482
+	 * @package GeoDirectory
5483
+	 *
5484
+	 * @param string $where SQL where clause part.
5485
+	 */
5486
+	$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5487
+
5488
+	$query = $wpdb->prepare( "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, $post_type );
5489
+	/**
5490
+	 * Modify returned posts SQL query for the current post type.
5491
+	 *
5492
+	 * @since 1.4.6
5493
+	 * @package GeoDirectory
5494
+	 *
5495
+	 * @param int $query The SQL query.
5496
+	 * @param string $post_type Post type.
5497
+	 */
5498
+	$query = apply_filters( 'geodir_imex_export_posts_query', $query, $post_type );
5499
+	$results = (array)$wpdb->get_results( $query, ARRAY_A );
5500
+
5501
+	/**
5502
+	 * Modify returned post results for the current post type.
5503
+	 *
5504
+	 * @since 1.4.6
5505
+	 * @package GeoDirectory
5506
+	 *
5507
+	 * @param object $results An object containing all post ids.
5508
+	 * @param string $post_type Post type.
5509
+	 */
5510
+	return apply_filters( 'geodir_export_posts', $results, $post_type );
5511 5511
 }
5512 5512
 
5513 5513
 /**
@@ -5526,26 +5526,26 @@  discard block
 block discarded – undo
5526 5526
  * @return string The SQL query.
5527 5527
  */
5528 5528
 function geodir_imex_get_events_query( $query, $post_type ) {
5529
-    if ( $post_type == 'gd_event' ) {
5530
-        global $wpdb, $plugin_prefix;
5529
+	if ( $post_type == 'gd_event' ) {
5530
+		global $wpdb, $plugin_prefix;
5531 5531
         
5532
-        $table = $plugin_prefix . $post_type . '_detail';
5533
-        $schedule_table = EVENT_SCHEDULE;
5532
+		$table = $plugin_prefix . $post_type . '_detail';
5533
+		$schedule_table = EVENT_SCHEDULE;
5534 5534
         
5535
-        // Skip listing with statuses trash, auto-draft etc...
5536
-        $skip_statuses = geodir_imex_export_skip_statuses();
5537
-        $where_statuses = '';
5538
-        if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5539
-            $where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5540
-        }
5535
+		// Skip listing with statuses trash, auto-draft etc...
5536
+		$skip_statuses = geodir_imex_export_skip_statuses();
5537
+		$where_statuses = '';
5538
+		if ( !empty( $skip_statuses ) && is_array( $skip_statuses ) ) {
5539
+			$where_statuses = "AND `" . $wpdb->posts . "`.`post_status` NOT IN('" . implode( "','", $skip_statuses ) . "')";
5540
+		}
5541 5541
         
5542
-        /** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5543
-        $where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5542
+		/** This action is documented in geodirectory-functions/geodirectory-admin/admin_functions.php */
5543
+		$where_statuses = apply_filters( 'geodir_get_export_posts', $where_statuses, $post_type );
5544 5544
 
5545
-        $query = $wpdb->prepare( "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", $post_type );
5546
-    }
5545
+		$query = $wpdb->prepare( "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", $post_type );
5546
+	}
5547 5547
 
5548
-    return $query;
5548
+	return $query;
5549 5549
 }
5550 5550
 
5551 5551
 /**
@@ -5567,36 +5567,36 @@  discard block
 block discarded – undo
5567 5567
  * @return int Total terms count.
5568 5568
  */
5569 5569
 function geodir_get_terms_count( $post_type ) {
5570
-    $args = array( 'hide_empty' => 0 );
5570
+	$args = array( 'hide_empty' => 0 );
5571 5571
 
5572
-    remove_all_filters( 'get_terms' );
5572
+	remove_all_filters( 'get_terms' );
5573 5573
 
5574
-    $taxonomy = $post_type . 'category';
5574
+	$taxonomy = $post_type . 'category';
5575 5575
 
5576
-    // WPML
5577
-    $is_wpml = geodir_is_wpml();
5578
-    $active_lang = 'all';
5579
-    if ( $is_wpml ) {
5580
-        global $sitepress;
5581
-        $active_lang = $sitepress->get_current_language();
5576
+	// WPML
5577
+	$is_wpml = geodir_is_wpml();
5578
+	$active_lang = 'all';
5579
+	if ( $is_wpml ) {
5580
+		global $sitepress;
5581
+		$active_lang = $sitepress->get_current_language();
5582 5582
         
5583
-        if ( $active_lang != 'all' ) {
5584
-            $sitepress->switch_lang( 'all', true );
5585
-        }
5586
-    }
5587
-    // WPML
5583
+		if ( $active_lang != 'all' ) {
5584
+			$sitepress->switch_lang( 'all', true );
5585
+		}
5586
+	}
5587
+	// WPML
5588 5588
             
5589
-    $count_terms = wp_count_terms( $taxonomy, $args );
5589
+	$count_terms = wp_count_terms( $taxonomy, $args );
5590 5590
 
5591
-    // WPML
5592
-    if ( $is_wpml && $active_lang !== 'all' ) {
5593
-        global $sitepress;
5594
-        $sitepress->switch_lang( $active_lang, true );
5595
-    }
5596
-    // WPML
5597
-    $count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5591
+	// WPML
5592
+	if ( $is_wpml && $active_lang !== 'all' ) {
5593
+		global $sitepress;
5594
+		$sitepress->switch_lang( $active_lang, true );
5595
+	}
5596
+	// WPML
5597
+	$count_terms = !is_wp_error( $count_terms ) ? $count_terms : 0;
5598 5598
      
5599
-    return $count_terms;
5599
+	return $count_terms;
5600 5600
 }
5601 5601
 
5602 5602
 /**
@@ -5635,11 +5635,11 @@  discard block
 block discarded – undo
5635 5635
 		$csv_row[] = 'cat_posttype';
5636 5636
 		$csv_row[] = 'cat_parent';
5637 5637
 		$csv_row[] = 'cat_schema';
5638
-        // WPML
5638
+		// WPML
5639 5639
 		$is_wpml = geodir_wpml_is_taxonomy_translated( $taxonomy );
5640 5640
 		if ($is_wpml) {
5641 5641
 			$csv_row[] = 'cat_language';
5642
-            $csv_row[] = 'cat_id_original';
5642
+			$csv_row[] = 'cat_id_original';
5643 5643
 		}
5644 5644
 		// WPML
5645 5645
 		$csv_row[] = 'cat_description';
@@ -5669,10 +5669,10 @@  discard block
 block discarded – undo
5669 5669
 			$csv_row[] = $post_type;
5670 5670
 			$csv_row[] = $cat_parent;
5671 5671
 			$csv_row[] = geodir_get_tax_meta( $term->term_id, 'ct_cat_schema', false, $post_type );
5672
-            // WPML
5672
+			// WPML
5673 5673
 			if ($is_wpml) {
5674 5674
 				$csv_row[] = geodir_get_language_for_element( $term->term_id, 'tax_' . $taxonomy );
5675
-                $csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5675
+				$csv_row[] = geodir_imex_original_post_id( $term->term_id, 'tax_' . $taxonomy );
5676 5676
 			}
5677 5677
 			// WPML
5678 5678
 			$csv_row[] = $term->description;
@@ -6090,43 +6090,43 @@  discard block
 block discarded – undo
6090 6090
  * @param string $status Post status.
6091 6091
  */
6092 6092
 function geodir_create_page($slug, $option, $page_title = '', $page_content = '', $post_parent = 0, $status = 'publish') {
6093
-    global $wpdb, $current_user;
6094
-
6095
-    $option_value = get_option($option);
6096
-
6097
-    if ($option_value > 0) :
6098
-        if (get_post($option_value)) :
6099
-            // Page exists
6100
-            return;
6101
-        endif;
6102
-    endif;
6103
-
6104
-    $page_found = $wpdb->get_var(
6105
-        $wpdb->prepare(
6106
-            "SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6107
-            array($slug)
6108
-        )
6109
-    );
6110
-
6111
-    if ($page_found) :
6112
-        // Page exists
6113
-        if (!$option_value) update_option($option, $page_found);
6114
-        return;
6115
-    endif;
6116
-
6117
-    $page_data = array(
6118
-        'post_status' => $status,
6119
-        'post_type' => 'page',
6120
-        'post_author' => $current_user->ID,
6121
-        'post_name' => $slug,
6122
-        'post_title' => $page_title,
6123
-        'post_content' => $page_content,
6124
-        'post_parent' => $post_parent,
6125
-        'comment_status' => 'closed'
6126
-    );
6127
-    $page_id = wp_insert_post($page_data);
6128
-
6129
-    add_option($option, $page_id);
6093
+	global $wpdb, $current_user;
6094
+
6095
+	$option_value = get_option($option);
6096
+
6097
+	if ($option_value > 0) :
6098
+		if (get_post($option_value)) :
6099
+			// Page exists
6100
+			return;
6101
+		endif;
6102
+	endif;
6103
+
6104
+	$page_found = $wpdb->get_var(
6105
+		$wpdb->prepare(
6106
+			"SELECT ID FROM " . $wpdb->posts . " WHERE post_name = %s LIMIT 1;",
6107
+			array($slug)
6108
+		)
6109
+	);
6110
+
6111
+	if ($page_found) :
6112
+		// Page exists
6113
+		if (!$option_value) update_option($option, $page_found);
6114
+		return;
6115
+	endif;
6116
+
6117
+	$page_data = array(
6118
+		'post_status' => $status,
6119
+		'post_type' => 'page',
6120
+		'post_author' => $current_user->ID,
6121
+		'post_name' => $slug,
6122
+		'post_title' => $page_title,
6123
+		'post_content' => $page_content,
6124
+		'post_parent' => $post_parent,
6125
+		'comment_status' => 'closed'
6126
+	);
6127
+	$page_id = wp_insert_post($page_data);
6128
+
6129
+	add_option($option, $page_id);
6130 6130
 
6131 6131
 }
6132 6132
 
@@ -6157,9 +6157,9 @@  discard block
 block discarded – undo
6157 6157
  * @package GeoDirectory
6158 6158
  */
6159 6159
 function geodir_admin_upgrade_notice() {
6160
-    $class = "error";
6161
-    $message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6162
-    echo"<div class=\"$class\"> <p>$message</p></div>";
6160
+	$class = "error";
6161
+	$message = __("Please update core GeoDirectory or some addons may not function correctly.","geodirectory");
6162
+	echo"<div class=\"$class\"> <p>$message</p></div>";
6163 6163
 }
6164 6164
 
6165 6165
 /**
@@ -6172,18 +6172,18 @@  discard block
 block discarded – undo
6172 6172
  */
6173 6173
 function geodire_admin_upgrade_notice( $plugin_data, $r )
6174 6174
 {
6175
-    // readme contents
6176
-    $args = array(
6177
-        'timeout'     => 15,
6178
-        'redirection' => 5
6179
-    );
6180
-    $url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6181
-    $data       = wp_remote_get( $url, $args );
6175
+	// readme contents
6176
+	$args = array(
6177
+		'timeout'     => 15,
6178
+		'redirection' => 5
6179
+	);
6180
+	$url = "http://plugins.svn.wordpress.org/geodirectory/trunk/readme.txt";
6181
+	$data       = wp_remote_get( $url, $args );
6182 6182
 
6183
-    if (!is_wp_error($data) && $data['response']['code'] == 200) {
6183
+	if (!is_wp_error($data) && $data['response']['code'] == 200) {
6184 6184
 
6185
-        geodir_in_plugin_update_message($data['body']);
6186
-    }
6185
+		geodir_in_plugin_update_message($data['body']);
6186
+	}
6187 6187
 }
6188 6188
 
6189 6189
 
@@ -6191,28 +6191,28 @@  discard block
 block discarded – undo
6191 6191
 * @param string $content http response body
6192 6192
 */
6193 6193
 function geodir_in_plugin_update_message($content) {
6194
-    // Output Upgrade Notice
6195
-    $matches        = null;
6196
-    $regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6197
-    $upgrade_notice = '';
6198
-    if ( preg_match( $regexp, $content, $matches ) ) {
6199
-        if(empty($matches)){return;}
6200
-
6201
-        $version = trim( $matches[1] );
6202
-        if($version && $version>GEODIRECTORY_VERSION){
6203
-
6204
-
6205
-        $notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6206
-        if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6207
-            $upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6208
-            foreach ( $notices as $index => $line ) {
6209
-                $upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6210
-            }
6211
-            $upgrade_notice .= '</div> ';
6212
-        }
6213
-        }
6214
-    }
6215
-    echo $upgrade_notice;
6194
+	// Output Upgrade Notice
6195
+	$matches        = null;
6196
+	$regexp         = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( GEODIRECTORY_VERSION ) . '\s*=|$)~Uis';
6197
+	$upgrade_notice = '';
6198
+	if ( preg_match( $regexp, $content, $matches ) ) {
6199
+		if(empty($matches)){return;}
6200
+
6201
+		$version = trim( $matches[1] );
6202
+		if($version && $version>GEODIRECTORY_VERSION){
6203
+
6204
+
6205
+		$notices = (array) preg_split('~[\r\n]+~', trim( $matches[2] ) );
6206
+		if ( version_compare( GEODIRECTORY_VERSION, $version, '<' ) ) {
6207
+			$upgrade_notice .= '<div class="geodir_plugin_upgrade_notice">';
6208
+			foreach ( $notices as $index => $line ) {
6209
+				$upgrade_notice .= wp_kses_post( preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line ) );
6210
+			}
6211
+			$upgrade_notice .= '</div> ';
6212
+		}
6213
+		}
6214
+	}
6215
+	echo $upgrade_notice;
6216 6216
 }
6217 6217
 
6218 6218
 /**
@@ -6245,19 +6245,19 @@  discard block
 block discarded – undo
6245 6245
  * @param array Listing statuses to be skipped.
6246 6246
  */
6247 6247
 function geodir_imex_export_skip_statuses() {
6248
-    $statuses = array( 'trash', 'auto-draft' );
6248
+	$statuses = array( 'trash', 'auto-draft' );
6249 6249
     
6250
-    /**
6251
-     * Filter the statuses to skip during GD export listings.
6252
-     *
6253
-     * @since 1.6.0
6254
-     * @package GeoDirectory
6255
-     *
6256
-     * @param array $statuses Listing statuses to be skipped.
6257
-     */
6258
-    $statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6250
+	/**
6251
+	 * Filter the statuses to skip during GD export listings.
6252
+	 *
6253
+	 * @since 1.6.0
6254
+	 * @package GeoDirectory
6255
+	 *
6256
+	 * @param array $statuses Listing statuses to be skipped.
6257
+	 */
6258
+	$statuses = apply_filters( 'geodir_imex_export_skip_statuses', $statuses );
6259 6259
      
6260
-    return $statuses;
6260
+	return $statuses;
6261 6261
 }
6262 6262
 
6263 6263
 /**
@@ -6273,42 +6273,42 @@  discard block
 block discarded – undo
6273 6273
  * @global string $typenow Current post type.
6274 6274
  */
6275 6275
 function geodir_admin_dequeue_scripts() {
6276
-    global $typenow;
6276
+	global $typenow;
6277 6277
     
6278
-    // EDD
6279
-    if (wp_script_is('jquery-chosen', 'enqueued')) {
6280
-        wp_dequeue_script('jquery-chosen');
6281
-    }
6278
+	// EDD
6279
+	if (wp_script_is('jquery-chosen', 'enqueued')) {
6280
+		wp_dequeue_script('jquery-chosen');
6281
+	}
6282 6282
     
6283
-    // Ultimate Addons for Visual Composer
6284
-    if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6285
-        wp_dequeue_script('ultimate-vc-backend-script');
6286
-    }
6283
+	// Ultimate Addons for Visual Composer
6284
+	if (wp_script_is('ultimate-vc-backend-script', 'enqueued')) {
6285
+		wp_dequeue_script('ultimate-vc-backend-script');
6286
+	}
6287 6287
     
6288
-    // VC editor conflicts
6289
-    if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
6290
-        wp_dequeue_script('dfd_vc_damin_scripts');
6291
-    }
6288
+	// VC editor conflicts
6289
+	if (class_exists('Vc_Role_Access_Controller') && wp_script_is('dfd_vc_damin_scripts', 'enqueued')) {
6290
+		wp_dequeue_script('dfd_vc_damin_scripts');
6291
+	}
6292 6292
     
6293
-    // Ultimate chosen
6294
-    if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
6295
-        wp_dequeue_script('ultimate-chosen-script');
6296
-    }
6293
+	// Ultimate chosen
6294
+	if (wp_script_is('ultimate-chosen-script', 'enqueued')) {
6295
+		wp_dequeue_script('ultimate-chosen-script');
6296
+	}
6297 6297
     
6298
-    // Crum composer choosen
6299
-    if (wp_script_is('crum-composer-choosen', 'enqueued')) {
6300
-        wp_dequeue_script('crum-composer-choosen');
6301
-    }
6298
+	// Crum composer choosen
6299
+	if (wp_script_is('crum-composer-choosen', 'enqueued')) {
6300
+		wp_dequeue_script('crum-composer-choosen');
6301
+	}
6302 6302
     
6303
-    // Fix conflict Fusion Builder jquery chosen with GD jquery chosen.
6304
-    if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
6305
-        wp_dequeue_script('fusion_builder_chosen_js');
6306
-    }
6303
+	// Fix conflict Fusion Builder jquery chosen with GD jquery chosen.
6304
+	if (class_exists('FusionBuilder') && wp_script_is('fusion_builder_chosen_js', 'enqueued')) {
6305
+		wp_dequeue_script('fusion_builder_chosen_js');
6306
+	}
6307 6307
     
6308
-    // Fix conflicts timepicker & setting date value.
6309
-    if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
6310
-        wp_dequeue_script('acf-timepicker');
6311
-    }
6308
+	// Fix conflicts timepicker & setting date value.
6309
+	if (class_exists('acf') && wp_script_is('acf-timepicker', 'enqueued')) {
6310
+		wp_dequeue_script('acf-timepicker');
6311
+	}
6312 6312
 }
6313 6313
 
6314 6314
 /**
@@ -6324,48 +6324,48 @@  discard block
 block discarded – undo
6324 6324
  * @return string SQL where clause part.
6325 6325
  */
6326 6326
 function geodir_imex_get_filter_where($where = '', $post_type = '') {
6327
-    global $wpdb;
6327
+	global $wpdb;
6328 6328
     
6329
-    $filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6329
+	$filters = !empty( $_REQUEST['gd_imex'] ) && is_array( $_REQUEST['gd_imex'] ) ? $_REQUEST['gd_imex'] : NULL;
6330 6330
     
6331
-    if ( !empty( $filters ) ) {
6332
-        foreach ( $filters as $field => $value ) {
6333
-            switch ($field) {
6334
-                case 'start_date':
6335
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6336
-                break;
6337
-                case 'end_date':
6338
-                    $where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6339
-                break;
6340
-            }
6341
-        }
6342
-    }
6331
+	if ( !empty( $filters ) ) {
6332
+		foreach ( $filters as $field => $value ) {
6333
+			switch ($field) {
6334
+				case 'start_date':
6335
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` >= '" . sanitize_text_field( $value ) . " 00:00:00'";
6336
+				break;
6337
+				case 'end_date':
6338
+					$where .= " AND `" . $wpdb->posts . "`.`post_date` <= '" . sanitize_text_field( $value ) . " 23:59:59'";
6339
+				break;
6340
+			}
6341
+		}
6342
+	}
6343 6343
     
6344
-    return $where;
6344
+	return $where;
6345 6345
 }
6346 6346
 add_filter('geodir_get_posts_count', 'geodir_imex_get_filter_where', 10, 2);
6347 6347
 add_filter('geodir_get_export_posts', 'geodir_imex_get_filter_where', 10, 2);
6348 6348
 
6349 6349
 
6350 6350
 function geodir_fix_for_primer_theme(){
6351
-    if(!defined( 'PRIMER_VERSION' )){return;}
6352
-    global $pagenow;
6351
+	if(!defined( 'PRIMER_VERSION' )){return;}
6352
+	global $pagenow;
6353 6353
 
6354
-    if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6354
+	if ( ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) && (isset($_REQUEST['post_type']) || isset($_REQUEST['post']) )  ){
6355 6355
 
6356
-        $post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6356
+		$post_type = isset($_REQUEST['post_type']) ? esc_attr($_REQUEST['post_type']) : get_post_type( $_GET['post'] );
6357 6357
 
6358
-        $post_types = geodir_get_posttypes();
6359
-        if ($post_type && in_array($post_type, $post_types) ) {
6360
-            global $primer_customizer_layouts;
6361
-            remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6362
-        }
6363
-    }
6358
+		$post_types = geodir_get_posttypes();
6359
+		if ($post_type && in_array($post_type, $post_types) ) {
6360
+			global $primer_customizer_layouts;
6361
+			remove_action( 'add_meta_boxes', array( $primer_customizer_layouts, 'add_meta_box' ), 10);
6362
+		}
6363
+	}
6364 6364
 
6365 6365
 }
6366 6366
 
6367 6367
 if(is_admin()){
6368
-    add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6368
+	add_action('add_meta_boxes','geodir_fix_for_primer_theme',0);  
6369 6369
 }
6370 6370
 
6371 6371
 
@@ -6498,96 +6498,96 @@  discard block
 block discarded – undo
6498 6498
 
6499 6499
 function geodir_ga_activation_url() {
6500 6500
 
6501
-    return add_query_arg( array(
6502
-        'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6503
-        'scope'         => GEODIR_GA_SCOPE,
6504
-        'response_type' => 'code',
6505
-        'redirect_uri'  => GEODIR_GA_REDIRECT,
6506
-        'client_id'     => GEODIR_GA_CLIENTID,
6507
-    ), 'https://accounts.google.com/o/oauth2/auth' );
6501
+	return add_query_arg( array(
6502
+		'next'          => admin_url("admin.php?page=geodirectory&active_tab=google_analytic_settings"),
6503
+		'scope'         => GEODIR_GA_SCOPE,
6504
+		'response_type' => 'code',
6505
+		'redirect_uri'  => GEODIR_GA_REDIRECT,
6506
+		'client_id'     => GEODIR_GA_CLIENTID,
6507
+	), 'https://accounts.google.com/o/oauth2/auth' );
6508 6508
 
6509
-    return $url;
6509
+	return $url;
6510 6510
 }
6511 6511
 
6512 6512
 function geodir_gd_accounts(){
6513
-    $accounts = array();
6514
-    $useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6515
-    if($useAuth){
6516
-        try {
6517
-            $accounts = geodir_ga_get_analytics_accounts();
6518
-        } catch (Exception $e) {
6519
-            geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6520
-        }
6513
+	$accounts = array();
6514
+	$useAuth = ( get_option( 'geodir_ga_auth_code' ) == '' ? false : true );
6515
+	if($useAuth){
6516
+		try {
6517
+			$accounts = geodir_ga_get_analytics_accounts();
6518
+		} catch (Exception $e) {
6519
+			geodir_error_log( wp_sprintf( __( 'GD Google Analytics API Error(%s) : %s', 'geodirectory' ), $e->getCode(), $e->getMessage() ) );
6520
+		}
6521 6521
         
6522
-        if(is_array($accounts)){
6523
-            $accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6524
-        }elseif(get_option('geodir_ga_account_id')){
6525
-            $accounts = array();
6526
-            $accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6527
-        }
6528
-    }
6529
-    return $accounts;
6522
+		if(is_array($accounts)){
6523
+			$accounts = array_merge(array(__('Select Account','geodirectory')),$accounts);
6524
+		}elseif(get_option('geodir_ga_account_id')){
6525
+			$accounts = array();
6526
+			$accounts[get_option('geodir_ga_account_id')] = __('Account re-authorization may be required','geodirectory').' ('.get_option('geodir_ga_account_id').')';
6527
+		}
6528
+	}
6529
+	return $accounts;
6530 6530
 }
6531 6531
 
6532 6532
 function geodir_ga_get_analytics_accounts()
6533 6533
 {
6534
-    global $gd_ga_errors;
6535
-    $accounts = array();
6534
+	global $gd_ga_errors;
6535
+	$accounts = array();
6536 6536
 
6537
-    if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6537
+	if(get_option('geodir_ga_auth_token')===false){update_option('geodir_ga_auth_token','');}
6538 6538
 
6539 6539
 
6540
-    if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6541
-      return get_option('geodir_gd_uids');
6542
-    }
6540
+	if(get_option('geodir_gd_uids') && !isset($_POST['geodir_ga_auth_code'])){
6541
+	  return get_option('geodir_gd_uids');
6542
+	}
6543 6543
 
6544
-    # Create a new Gdata call
6545
-    if ( trim(get_option('geodir_ga_auth_code')) != '' )
6546
-        $stats = new GDGoogleAnalyticsStats();
6547
-    else
6548
-        return false;
6544
+	# Create a new Gdata call
6545
+	if ( trim(get_option('geodir_ga_auth_code')) != '' )
6546
+		$stats = new GDGoogleAnalyticsStats();
6547
+	else
6548
+		return false;
6549 6549
 
6550
-    # Check if Google sucessfully logged in
6551
-    if ( ! $stats->checkLogin() )
6552
-        return false;
6550
+	# Check if Google sucessfully logged in
6551
+	if ( ! $stats->checkLogin() )
6552
+		return false;
6553 6553
 
6554
-    # Get a list of accounts
6555
-    try {
6556
-        $accounts = $stats->getAllProfiles();
6557
-    } catch (Exception $e) {
6558
-        $gd_ga_errors[] = $e->getMessage();
6559
-        return false;
6560
-    }
6554
+	# Get a list of accounts
6555
+	try {
6556
+		$accounts = $stats->getAllProfiles();
6557
+	} catch (Exception $e) {
6558
+		$gd_ga_errors[] = $e->getMessage();
6559
+		return false;
6560
+	}
6561 6561
 
6562 6562
 
6563
-    natcasesort ($accounts);
6563
+	natcasesort ($accounts);
6564 6564
 
6565
-    # Return the account array if there are accounts
6566
-    if ( count($accounts) > 0 ){
6567
-        update_option('geodir_gd_uids',$accounts);
6568
-        return $accounts;
6569
-    }
6570
-    else
6571
-        return false;
6565
+	# Return the account array if there are accounts
6566
+	if ( count($accounts) > 0 ){
6567
+		update_option('geodir_gd_uids',$accounts);
6568
+		return $accounts;
6569
+	}
6570
+	else
6571
+		return false;
6572 6572
 }
6573 6573
 
6574 6574
 add_action( 'wp_ajax_geodir_ga_deauthorize', 'geodir_ga_deauthorize' );
6575 6575
 function geodir_ga_deauthorize(){
6576 6576
 
6577
-    if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6577
+	if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gd_ga_deauthorize' ) ) {
6578 6578
 
6579
-        die( 'Security check' );
6579
+		die( 'Security check' );
6580 6580
 
6581
-    } else {
6582
-        update_option('geodir_ga_auth_token','');
6583
-        update_option('geodir_ga_auth_code','');
6584
-        update_option('geodir_gd_uids','');
6581
+	} else {
6582
+		update_option('geodir_ga_auth_token','');
6583
+		update_option('geodir_ga_auth_code','');
6584
+		update_option('geodir_gd_uids','');
6585 6585
 
6586 6586
 
6587
-        echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
6588
-    }
6587
+		echo admin_url('?page=geodirectory&active_tab=google_analytic_settings');
6588
+	}
6589 6589
 
6590
-    die();
6590
+	die();
6591 6591
 }
6592 6592
 
6593 6593
 
@@ -6598,14 +6598,14 @@  discard block
 block discarded – undo
6598 6598
  * @package GeoDirectory
6599 6599
  */
6600 6600
 function geodir_post_type_setting_fun() {
6601
-    $post_type_arr = array();
6601
+	$post_type_arr = array();
6602 6602
 
6603
-    $post_types = geodir_get_posttypes('object');
6603
+	$post_types = geodir_get_posttypes('object');
6604 6604
 
6605
-    foreach ($post_types as $key => $post_types_obj) {
6606
-        $post_type_arr[$key] = $post_types_obj->labels->singular_name;
6607
-    }
6608
-    return $post_type_arr;
6605
+	foreach ($post_types as $key => $post_types_obj) {
6606
+		$post_type_arr[$key] = $post_types_obj->labels->singular_name;
6607
+	}
6608
+	return $post_type_arr;
6609 6609
 }
6610 6610
 
6611 6611
 /**
@@ -6616,35 +6616,35 @@  discard block
 block discarded – undo
6616 6616
  */
6617 6617
 function geodir_listing_image_size_arr(){
6618 6618
 
6619
-    global $_wp_additional_image_sizes;
6620
-
6621
-    $sizes = array();
6622
-
6623
-    foreach ( get_intermediate_image_sizes() as $_size ) {
6624
-        if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6625
-            $sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6626
-            $sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6627
-            $sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6628
-        } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6629
-            $sizes[ $_size ] = array(
6630
-                'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6631
-                'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6632
-                'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6633
-            );
6634
-        }
6635
-    }
6619
+	global $_wp_additional_image_sizes;
6620
+
6621
+	$sizes = array();
6622
+
6623
+	foreach ( get_intermediate_image_sizes() as $_size ) {
6624
+		if ( in_array( $_size, array('thumbnail', 'medium', 'medium_large', 'large') ) ) {
6625
+			$sizes[ $_size ]['width']  = get_option( "{$_size}_size_w" );
6626
+			$sizes[ $_size ]['height'] = get_option( "{$_size}_size_h" );
6627
+			$sizes[ $_size ]['crop']   = (bool) get_option( "{$_size}_crop" );
6628
+		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
6629
+			$sizes[ $_size ] = array(
6630
+				'width'  => $_wp_additional_image_sizes[ $_size ]['width'],
6631
+				'height' => $_wp_additional_image_sizes[ $_size ]['height'],
6632
+				'crop'   => $_wp_additional_image_sizes[ $_size ]['crop'],
6633
+			);
6634
+		}
6635
+	}
6636 6636
 
6637 6637
 
6638 6638
 
6639
-    $options = array();
6639
+	$options = array();
6640 6640
 
6641
-    $options['default'] = __('GD Default', 'geodirectory');
6641
+	$options['default'] = __('GD Default', 'geodirectory');
6642 6642
 
6643
-    if(!empty($sizes)){
6644
-        foreach($sizes as $key=>$val){
6645
-            $options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6646
-        }
6647
-    }
6643
+	if(!empty($sizes)){
6644
+		foreach($sizes as $key=>$val){
6645
+			$options[$key] = $key. ' ( '.$val['width'].' x '.$val['height']. ' )';
6646
+		}
6647
+	}
6648 6648
 
6649
-    return $options;
6649
+	return $options;
6650 6650
 }
6651 6651
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/custom_fields_input_functions.php 3 patches
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * @return string The html to output for the custom field.
19 19
  */
20
-function geodir_cfi_fieldset($html,$cf){
20
+function geodir_cfi_fieldset($html, $cf) {
21 21
 
22 22
     $html_var = $cf['htmlvar_name'];
23 23
 
24 24
     // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
25
+    if (has_filter("geodir_custom_field_input_fieldset_{$html_var}")) {
26 26
         /**
27 27
          * Filter the fieldset html by individual custom field.
28 28
          *
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
          * @param array $cf The custom field array.
31 31
          * @since 1.6.6
32 32
          */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
33
+        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}", $html, $cf);
34 34
     }
35 35
 
36 36
     // If no html then we run the standard output.
37
-    if(empty($html)) {
37
+    if (empty($html)) {
38 38
 
39 39
         ob_start(); // Start  buffering;
40 40
         ?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42
-            gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?>
43
-            <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
42
+            gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __($cf['site_title'], 'geodirectory'); ?>
43
+            <?php if ($cf['desc'] != '') {
44
+                echo '<small>( '.__($cf['desc'], 'geodirectory').' )</small>';
45 45
             } ?></h5>
46 46
         <?php
47 47
         $html = ob_get_clean();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     return $html;
51 51
 }
52
-add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
52
+add_filter('geodir_custom_field_input_fieldset', 'geodir_cfi_fieldset', 10, 2);
53 53
 
54 54
 
55 55
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string The html to output for the custom field.
64 64
  */
65
-function geodir_cfi_text($html,$cf){
65
+function geodir_cfi_text($html, $cf) {
66 66
 
67 67
     $html_var = $cf['htmlvar_name'];
68 68
 
69 69
     // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
70
+    if (has_filter("geodir_custom_field_input_text_{$html_var}")) {
71 71
         /**
72 72
          * Filter the text html by individual custom field.
73 73
          *
@@ -75,41 +75,41 @@  discard block
 block discarded – undo
75 75
          * @param array $cf The custom field array.
76 76
          * @since 1.6.6
77 77
          */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
78
+        $html = apply_filters("geodir_custom_field_input_text_{$html_var}", $html, $cf);
79 79
     }
80 80
 
81 81
     // If no html then we run the standard output.
82
-    if(empty($html)) {
82
+    if (empty($html)) {
83 83
 
84 84
         ob_start(); // Start  buffering;
85 85
 
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if (isset($cf['data_type']) && $cf['data_type'] == 'INT') {$type = 'number'; }
90
+        elseif (isset($cf['data_type']) && $cf['data_type'] == 'FLOAT') {$type = 'float'; }
91 91
 
92 92
         //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
93
+        if (isset($cf['validation_pattern']) && $cf['validation_pattern']) {
94 94
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
95
+        } else {$validation = ''; }
96 96
 
97 97
         // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
98
+        if (isset($cf['validation_msg']) && $cf['validation_msg']) {
99 99
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
100
+        } else {$validation_msg = ''; }
101 101
         ?>
102 102
 
103
-        <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+        <div id="<?php echo $cf['name']; ?>_row"
104
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 107
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
108
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
109 109
             </label>
110
-            <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
112
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
110
+            <input field_type="<?php echo $type; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
111
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="<?php echo $type; ?>" class="geodir_textfield" <?php echo $validation; echo $validation_msg; ?> />
112
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
113 113
             <?php if ($cf['is_required']) { ?>
114 114
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
115 115
             <?php } ?>
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     return $html;
123 123
 }
124
-add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
124
+add_filter('geodir_custom_field_input_text', 'geodir_cfi_text', 10, 2);
125 125
 
126 126
 
127 127
 /**
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return string The html to output for the custom field.
135 135
  */
136
-function geodir_cfi_email($html,$cf){
136
+function geodir_cfi_email($html, $cf) {
137 137
 
138 138
     $html_var = $cf['htmlvar_name'];
139 139
 
140 140
     // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
141
+    if (has_filter("geodir_custom_field_input_email_{$html_var}")) {
142 142
         /**
143 143
          * Filter the email html by individual custom field.
144 144
          *
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
          * @param array $cf The custom field array.
147 147
          * @since 1.6.6
148 148
          */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
149
+        $html = apply_filters("geodir_custom_field_input_email_{$html_var}", $html, $cf);
150 150
     }
151 151
 
152 152
     // If no html then we run the standard output.
153
-    if(empty($html)) {
153
+    if (empty($html)) {
154 154
 
155 155
         ob_start(); // Start  buffering;
156 156
         $value = geodir_get_cf_value($cf);
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
             $value = '';
160 160
         }?>
161 161
 
162
-        <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
162
+        <div id="<?php echo $cf['name']; ?>_row"
163
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 166
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
167
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
168 168
             </label>
169
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
171
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
169
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
170
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="email" class="geodir_textfield"/>
171
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
172 172
             <?php if ($cf['is_required']) { ?>
173 173
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
174 174
             <?php } ?>
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
     return $html;
182 182
 }
183
-add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
183
+add_filter('geodir_custom_field_input_email', 'geodir_cfi_email', 10, 2);
184 184
 
185 185
 
186 186
 
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @return string The html to output for the custom field.
195 195
  */
196
-function geodir_cfi_phone($html,$cf){
196
+function geodir_cfi_phone($html, $cf) {
197 197
 
198 198
     $html_var = $cf['htmlvar_name'];
199 199
 
200 200
     // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
201
+    if (has_filter("geodir_custom_field_input_phone_{$html_var}")) {
202 202
         /**
203 203
          * Filter the phone html by individual custom field.
204 204
          *
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
          * @param array $cf The custom field array.
207 207
          * @since 1.6.6
208 208
          */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
209
+        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}", $html, $cf);
210 210
     }
211 211
 
212 212
     // If no html then we run the standard output.
213
-    if(empty($html)) {
213
+    if (empty($html)) {
214 214
 
215 215
         ob_start(); // Start  buffering;
216 216
         $value = geodir_get_cf_value($cf);
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
             $value = '';
220 220
         }?>
221 221
 
222
-        <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
222
+        <div id="<?php echo $cf['name']; ?>_row"
223
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 226
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
227
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
228 228
             </label>
229
-            <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
231
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
229
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php  echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
230
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="tel" class="geodir_textfield"/>
231
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
232 232
             <?php if ($cf['is_required']) { ?>
233 233
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
234 234
             <?php } ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
     return $html;
242 242
 }
243
-add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
243
+add_filter('geodir_custom_field_input_phone', 'geodir_cfi_phone', 10, 2);
244 244
 
245 245
 
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
  *
254 254
  * @return string The html to output for the custom field.
255 255
  */
256
-function geodir_cfi_url($html,$cf){
256
+function geodir_cfi_url($html, $cf) {
257 257
 
258 258
     $html_var = $cf['htmlvar_name'];
259 259
 
260 260
     // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
261
+    if (has_filter("geodir_custom_field_input_url_{$html_var}")) {
262 262
         /**
263 263
          * Filter the url html by individual custom field.
264 264
          *
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
          * @param array $cf The custom field array.
267 267
          * @since 1.6.6
268 268
          */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
269
+        $html = apply_filters("geodir_custom_field_input_url_{$html_var}", $html, $cf);
270 270
     }
271 271
 
272 272
     // If no html then we run the standard output.
273
-    if(empty($html)) {
273
+    if (empty($html)) {
274 274
 
275 275
         ob_start(); // Start  buffering;
276 276
         $value = geodir_get_cf_value($cf);
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
             $value = '';
280 280
         }?>
281 281
 
282
-        <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
282
+        <div id="<?php echo $cf['name']; ?>_row"
283
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 286
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
287
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
288 288
             </label>
289
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290
-                   value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
289
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
290
+                   value="<?php echo esc_attr(stripslashes($value)); ?>" type="url" class="geodir_textfield"
291 291
                    oninvalid="setCustomValidity('<?php _e('Please enter a valid URL including http://', 'geodirectory'); ?>')"
292 292
                    onchange="try{setCustomValidity('')}catch(e){}"
293 293
             />
294
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
294
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
295 295
             <?php if ($cf['is_required']) { ?>
296 296
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
297 297
             <?php } ?>
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     return $html;
305 305
 }
306
-add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
306
+add_filter('geodir_custom_field_input_url', 'geodir_cfi_url', 10, 2);
307 307
 
308 308
 
309 309
 /**
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The html to output for the custom field.
317 317
  */
318
-function geodir_cfi_radio($html,$cf){
318
+function geodir_cfi_radio($html, $cf) {
319 319
 
320 320
     $html_var = $cf['htmlvar_name'];
321 321
 
322 322
     // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
323
+    if (has_filter("geodir_custom_field_input_radio_{$html_var}")) {
324 324
         /**
325 325
          * Filter the radio html by individual custom field.
326 326
          *
@@ -328,22 +328,22 @@  discard block
 block discarded – undo
328 328
          * @param array $cf The custom field array.
329 329
          * @since 1.6.6
330 330
          */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
331
+        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}", $html, $cf);
332 332
     }
333 333
 
334 334
     // If no html then we run the standard output.
335
-    if(empty($html)) {
335
+    if (empty($html)) {
336 336
 
337 337
         ob_start(); // Start  buffering;
338 338
         $value = geodir_get_cf_value($cf);
339 339
 
340 340
         ?>
341
-        <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
341
+        <div id="<?php echo $cf['name']; ?>_row"
342
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 345
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
346
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349 349
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
                     foreach ($option_values as $option_value) {
353 353
                         if (empty($option_value['optgroup'])) {
354 354
                             ?>
355
-                            <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
355
+                            <span class="gd-radios"><input name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" <?php checked(stripslashes($value), $option_value['value']); ?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357 357
                         }
358 358
                     }
359 359
                 }
360 360
             }
361 361
             ?>
362
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
362
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
365 365
             <?php } ?>
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     return $html;
373 373
 }
374
-add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
374
+add_filter('geodir_custom_field_input_radio', 'geodir_cfi_radio', 10, 2);
375 375
 
376 376
 
377 377
 /**
@@ -383,12 +383,12 @@  discard block
 block discarded – undo
383 383
  *
384 384
  * @return string The html to output for the custom field.
385 385
  */
386
-function geodir_cfi_checkbox($html,$cf){
386
+function geodir_cfi_checkbox($html, $cf) {
387 387
 
388 388
     $html_var = $cf['htmlvar_name'];
389 389
 
390 390
     // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
391
+    if (has_filter("geodir_custom_field_input_checkbox_{$html_var}")) {
392 392
         /**
393 393
          * Filter the checkbox html by individual custom field.
394 394
          *
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
          * @param array $cf The custom field array.
397 397
          * @since 1.6.6
398 398
          */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
399
+        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}", $html, $cf);
400 400
     }
401 401
 
402 402
     // If no html then we run the standard output.
403
-    if(empty($html)) {
403
+    if (empty($html)) {
404 404
 
405 405
         ob_start(); // Start  buffering;
406 406
         $value = geodir_get_cf_value($cf);
@@ -411,22 +411,22 @@  discard block
 block discarded – undo
411 411
         }
412 412
         ?>
413 413
 
414
-        <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
414
+        <div id="<?php echo $cf['name']; ?>_row"
415
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 418
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
419
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422 422
                 $value = '0';
423 423
             }?>
424
-            <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
424
+            <input type="hidden" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>" value="<?php echo esc_attr($value); ?>"/>
425 425
             <input  <?php if ($value == '1') {
426 426
                 echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428
-                 onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
427
+            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type']; ?>" type="checkbox"
428
+                 onchange="if(this.checked){jQuery('#<?php echo $cf['name']; ?>').val('1');} else{ jQuery('#<?php echo $cf['name']; ?>').val('0');}"/>
429
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
430 430
             <?php if ($cf['is_required']) { ?>
431 431
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
432 432
             <?php } ?>
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
     return $html;
440 440
 }
441
-add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
441
+add_filter('geodir_custom_field_input_checkbox', 'geodir_cfi_checkbox', 10, 2);
442 442
 
443 443
 
444 444
 /**
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
  *
451 451
  * @return string The html to output for the custom field.
452 452
  */
453
-function geodir_cfi_textarea($html,$cf){
453
+function geodir_cfi_textarea($html, $cf) {
454 454
 
455 455
     $html_var = $cf['htmlvar_name'];
456 456
 
457 457
     // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
458
+    if (has_filter("geodir_custom_field_input_textarea_{$html_var}")) {
459 459
         /**
460 460
          * Filter the textarea html by individual custom field.
461 461
          *
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
          * @param array $cf The custom field array.
464 464
          * @since 1.6.6
465 465
          */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
466
+        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}", $html, $cf);
467 467
     }
468 468
 
469 469
     // If no html then we run the standard output.
470
-    if(empty($html)) {
470
+    if (empty($html)) {
471 471
 
472 472
         ob_start(); // Start  buffering;
473 473
         $value = geodir_get_cf_value($cf);
@@ -475,32 +475,32 @@  discard block
 block discarded – undo
475 475
         $extra_fields = unserialize($cf['extra_fields']);
476 476
         ?>
477 477
 
478
-        <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
478
+        <div id="<?php echo $cf['name']; ?>_row"
479
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 482
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
483
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
484 484
             </label><?php
485 485
 
486 486
 
487 487
             if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
490 490
 
491
-            <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
491
+            <div class="editor" field_id="<?php echo $cf['name']; ?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495 495
             } else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498
-                            id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
497
+                ?><textarea field_type="<?php echo $cf['type']; ?>" class="geodir_textarea" name="<?php echo $cf['name']; ?>"
498
+                            id="<?php echo $cf['name']; ?>"><?php echo stripslashes($value); ?></textarea><?php
499 499
 
500 500
             }?>
501 501
 
502 502
 
503
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
503
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
504 504
             <?php if ($cf['is_required']) { ?>
505 505
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
506 506
             <?php } ?>
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
     return $html;
514 514
 }
515
-add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
515
+add_filter('geodir_custom_field_input_textarea', 'geodir_cfi_textarea', 10, 2);
516 516
 
517 517
 
518 518
 /**
@@ -524,12 +524,12 @@  discard block
 block discarded – undo
524 524
  *
525 525
  * @return string The html to output for the custom field.
526 526
  */
527
-function geodir_cfi_select($html,$cf){
527
+function geodir_cfi_select($html, $cf) {
528 528
 
529 529
     $html_var = $cf['htmlvar_name'];
530 530
 
531 531
     // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
532
+    if (has_filter("geodir_custom_field_input_select_{$html_var}")) {
533 533
         /**
534 534
          * Filter the select html by individual custom field.
535 535
          *
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
          * @param array $cf The custom field array.
538 538
          * @since 1.6.6
539 539
          */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
540
+        $html = apply_filters("geodir_custom_field_input_select_{$html_var}", $html, $cf);
541 541
     }
542 542
 
543 543
     // If no html then we run the standard output.
544
-    if(empty($html)) {
544
+    if (empty($html)) {
545 545
 
546 546
         ob_start(); // Start  buffering;
547 547
         $value = geodir_get_cf_value($cf);
548 548
 
549 549
         ?>
550
-        <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
550
+        <div id="<?php echo $cf['name']; ?>_row"
551
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 554
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
555
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
556 556
             </label>
557 557
             <?php
558 558
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -562,22 +562,22 @@  discard block
 block discarded – undo
562 562
                     if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563 563
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564 564
 
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
565
+                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
566 566
                     } else {
567 567
                         $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568 568
                         $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569 569
                         $selected = $option_value == stripslashes($value) ? 'selected="selected"' : '';
570 570
 
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
571
+                        $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
572 572
                     }
573 573
                 }
574 574
             }
575 575
             ?>
576
-            <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
576
+            <select field_type="<?php echo $cf['type']; ?>" name="<?php echo $cf['name']; ?>" id="<?php echo $cf['name']; ?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578
-                    data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
579
-                    option-ajaxchosen="false"><?php echo $select_options;?></select>
580
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
578
+                    data-placeholder="<?php echo __('Choose', 'geodirectory').' '.$site_title.'&hellip;'; ?>"
579
+                    option-ajaxchosen="false"><?php echo $select_options; ?></select>
580
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
581 581
             <?php if ($cf['is_required']) { ?>
582 582
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
583 583
             <?php } ?>
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
     return $html;
591 591
 }
592
-add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
592
+add_filter('geodir_custom_field_input_select', 'geodir_cfi_select', 10, 2);
593 593
 
594 594
 
595 595
 /**
@@ -601,12 +601,12 @@  discard block
 block discarded – undo
601 601
  *
602 602
  * @return string The html to output for the custom field.
603 603
  */
604
-function geodir_cfi_multiselect($html,$cf){
604
+function geodir_cfi_multiselect($html, $cf) {
605 605
 
606 606
     $html_var = $cf['htmlvar_name'];
607 607
 
608 608
     // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
609
+    if (has_filter("geodir_custom_field_input_multiselect_{$html_var}")) {
610 610
         /**
611 611
          * Filter the multiselect html by individual custom field.
612 612
          *
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
          * @param array $cf The custom field array.
615 615
          * @since 1.6.6
616 616
          */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
617
+        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}", $html, $cf);
618 618
     }
619 619
 
620 620
     // If no html then we run the standard output.
621
-    if(empty($html)) {
621
+    if (empty($html)) {
622 622
 
623 623
         ob_start(); // Start  buffering;
624 624
         $value = geodir_get_cf_value($cf);
@@ -655,9 +655,9 @@  discard block
 block discarded – undo
655 655
                                 $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656 656
 
657 657
                                 if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
658
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="'.esc_attr($option_label).'">' : '</optgroup>';
659 659
                                 } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
660
+                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>'.$option_label.'</li>' : '';
661 661
                                 }
662 662
                             } else {
663 663
                                 if (!is_array($value) && $value != '') {
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
                                 }
691 691
 
692 692
                                 if ($multi_display == 'select') {
693
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
693
+                                    $select_options .= '<option value="'.esc_attr($option_value).'" '.$selected.'>'.$option_label.'</option>';
694 694
                                 } else {
695
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
695
+                                    $select_options .= '<li><input name="'.$cf['name'].'[]" '.$checked.' value="'.esc_attr($option_value).'" class="gd-'.$multi_display.'" field_type="'.$multi_display.'" type="'.$multi_display.'" />&nbsp;'.$option_label.' </li>';
696 696
                                 }
697 697
                             }
698 698
                         }
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
     return $html;
714 714
 }
715
-add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
715
+add_filter('geodir_custom_field_input_multiselect', 'geodir_cfi_multiselect', 10, 2);
716 716
 
717 717
 
718 718
 /**
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
  *
725 725
  * @return string The html to output for the custom field.
726 726
  */
727
-function geodir_cfi_html($html,$cf){
727
+function geodir_cfi_html($html, $cf) {
728 728
 
729 729
     $html_var = $cf['htmlvar_name'];
730 730
 
731 731
     // Check if there is a custom field specific filter.
732
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
732
+    if (has_filter("geodir_custom_field_input_html_{$html_var}")) {
733 733
         /**
734 734
          * Filter the html html by individual custom field.
735 735
          *
@@ -737,11 +737,11 @@  discard block
 block discarded – undo
737 737
          * @param array $cf The custom field array.
738 738
          * @since 1.6.6
739 739
          */
740
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
740
+        $html = apply_filters("geodir_custom_field_input_html_{$html_var}", $html, $cf);
741 741
     }
742 742
 
743 743
     // If no html then we run the standard output.
744
-    if(empty($html)) {
744
+    if (empty($html)) {
745 745
 
746 746
         ob_start(); // Start  buffering;
747 747
         $value = geodir_get_cf_value($cf);
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
     return $html;
776 776
 }
777
-add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
777
+add_filter('geodir_custom_field_input_html', 'geodir_cfi_html', 10, 2);
778 778
 
779 779
 
780 780
 
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
  *
788 788
  * @return string The html to output for the custom field.
789 789
  */
790
-function geodir_cfi_datepicker($html,$cf){
790
+function geodir_cfi_datepicker($html, $cf) {
791 791
 
792 792
     $html_var = $cf['htmlvar_name'];
793 793
 
794 794
     // Check if there is a custom field specific filter.
795
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
795
+    if (has_filter("geodir_custom_field_input_datepicker_{$html_var}")) {
796 796
         /**
797 797
          * Filter the datepicker html by individual custom field.
798 798
          *
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
          * @param array $cf The custom field array.
801 801
          * @since 1.6.6
802 802
          */
803
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
803
+        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}", $html, $cf);
804 804
     }
805 805
 
806 806
     // If no html then we run the standard output.
807
-    if(empty($html)) {
807
+    if (empty($html)) {
808 808
 
809 809
         ob_start(); // Start  buffering;
810 810
         $value = geodir_get_cf_value($cf);
@@ -816,23 +816,23 @@  discard block
 block discarded – undo
816 816
             $extra_fields['date_format'] = 'yy-mm-dd';
817 817
 
818 818
         $date_format = $extra_fields['date_format'];
819
-        $jquery_date_format  = $date_format;
819
+        $jquery_date_format = $date_format;
820 820
 
821 821
 
822 822
         // check if we need to change the format or not
823 823
         $date_format_len = strlen(str_replace(' ', '', $date_format));
824
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
824
+        if ($date_format_len > 5) {// if greater then 5 then it's the old style format.
825 825
 
826
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
827
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
826
+            $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format
827
+            $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format
828 828
 
829 829
             $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
831
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
830
+        } else {
831
+            $jquery_date_format = geodir_date_format_php_to_jqueryui($jquery_date_format);
832 832
         }
833 833
 
834
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
835
-        if($value && !isset($_REQUEST['backandedit'])) {
834
+        if ($value == '0000-00-00') {$value = ''; }//if date not set, then mark it empty
835
+        if ($value && !isset($_REQUEST['backandedit'])) {
836 836
             //$time = strtotime($value);
837 837
             //$value = date_i18n($date_format, $time);
838 838
         }
@@ -843,37 +843,37 @@  discard block
 block discarded – undo
843 843
 
844 844
             jQuery(function () {
845 845
 
846
-                jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
846
+                jQuery("#<?php echo $cf['name']; ?>").datepicker({changeMonth: true, changeYear: true <?php
847 847
                     /**
848 848
                      * Used to add extra option to datepicker per custom field.
849 849
                      *
850 850
                      * @since 1.5.7
851 851
                      * @param string $name The custom field name.
852 852
                      */
853
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
853
+                    echo apply_filters("gd_datepicker_extra_{$name}", ''); ?>});
854 854
 
855
-                jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
855
+                jQuery("#<?php echo $name; ?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format; ?>');
856 856
 
857
-                <?php if(!empty($value)){?>
858
-                jQuery("#<?php echo $name;?>").datepicker("setDate", '<?php echo $value;?>');
857
+                <?php if (!empty($value)) {?>
858
+                jQuery("#<?php echo $name; ?>").datepicker("setDate", '<?php echo $value; ?>');
859 859
                 <?php } ?>
860 860
 
861 861
             });
862 862
 
863 863
         </script>
864
-        <div id="<?php echo $name;?>_row"
865
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
864
+        <div id="<?php echo $name; ?>_row"
865
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
866 866
             <label>
867 867
 
868 868
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869 869
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
870
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
871 871
             </label>
872 872
 
873
-            <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
874
-                   value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
873
+            <input field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>"
874
+                   value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
875 875
 
876
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
876
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
877 877
             <?php if ($cf['is_required']) { ?>
878 878
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
879 879
             <?php } ?>
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
     return $html;
887 887
 }
888
-add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
888
+add_filter('geodir_custom_field_input_datepicker', 'geodir_cfi_datepicker', 10, 2);
889 889
 
890 890
 
891 891
 /**
@@ -897,12 +897,12 @@  discard block
 block discarded – undo
897 897
  *
898 898
  * @return string The html to output for the custom field.
899 899
  */
900
-function geodir_cfi_time($html,$cf){
900
+function geodir_cfi_time($html, $cf) {
901 901
 
902 902
     $html_var = $cf['htmlvar_name'];
903 903
 
904 904
     // Check if there is a custom field specific filter.
905
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
905
+    if (has_filter("geodir_custom_field_input_time_{$html_var}")) {
906 906
         /**
907 907
          * Filter the time html by individual custom field.
908 908
          *
@@ -910,11 +910,11 @@  discard block
 block discarded – undo
910 910
          * @param array $cf The custom field array.
911 911
          * @since 1.6.6
912 912
          */
913
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
913
+        $html = apply_filters("geodir_custom_field_input_time_{$html_var}", $html, $cf);
914 914
     }
915 915
 
916 916
     // If no html then we run the standard output.
917
-    if(empty($html)) {
917
+    if (empty($html)) {
918 918
 
919 919
         ob_start(); // Start  buffering;
920 920
         $value = geodir_get_cf_value($cf);
@@ -927,25 +927,25 @@  discard block
 block discarded – undo
927 927
         <script type="text/javascript">
928 928
             jQuery(document).ready(function () {
929 929
 
930
-                jQuery('#<?php echo $name;?>').timepicker({
930
+                jQuery('#<?php echo $name; ?>').timepicker({
931 931
                     showPeriod: true,
932 932
                     showLeadingZero: true,
933 933
                     showPeriod: true,
934 934
                 });
935 935
             });
936 936
         </script>
937
-        <div id="<?php echo $name;?>_row"
938
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
937
+        <div id="<?php echo $name; ?>_row"
938
+             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
939 939
             <label>
940 940
 
941 941
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942 942
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
943
+                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
944 944
             </label>
945
-            <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
946
-                   id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
945
+            <input readonly="readonly" field_type="<?php echo $cf['type']; ?>" name="<?php echo $name; ?>"
946
+                   id="<?php echo $name; ?>" value="<?php echo esc_attr($value); ?>" type="text" class="geodir_textfield"/>
947 947
 
948
-            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
948
+            <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
949 949
             <?php if ($cf['is_required']) { ?>
950 950
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
951 951
             <?php } ?>
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 
957 957
     return $html;
958 958
 }
959
-add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
959
+add_filter('geodir_custom_field_input_time', 'geodir_cfi_time', 10, 2);
960 960
 
961 961
 
962 962
 /**
@@ -968,12 +968,12 @@  discard block
 block discarded – undo
968 968
  *
969 969
  * @return string The html to output for the custom field.
970 970
  */
971
-function geodir_cfi_address($html,$cf){
971
+function geodir_cfi_address($html, $cf) {
972 972
 
973 973
     $html_var = $cf['htmlvar_name'];
974 974
 
975 975
     // Check if there is a custom field specific filter.
976
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
976
+    if (has_filter("geodir_custom_field_input_address_{$html_var}")) {
977 977
         /**
978 978
          * Filter the address html by individual custom field.
979 979
          *
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
          * @param array $cf The custom field array.
982 982
          * @since 1.6.6
983 983
          */
984
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
984
+        $html = apply_filters("geodir_custom_field_input_address_{$html_var}", $html, $cf);
985 985
     }
986 986
 
987 987
     // If no html then we run the standard output.
988
-    if(empty($html)) {
988
+    if (empty($html)) {
989 989
 
990 990
         global $gd_session;
991 991
         ob_start(); // Start  buffering;
@@ -998,12 +998,12 @@  discard block
 block discarded – undo
998 998
         $site_title = $cf['site_title'];
999 999
         $is_admin = $cf['is_admin'];
1000 1000
         $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1001
-        $prefix = $name . '_';
1001
+        $prefix = $name.'_';
1002 1002
 
1003
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1004
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1003
+        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix.' address');
1004
+        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix.' zip/post code ');
1005 1005
         ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1006
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1006
+        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix.' mapview');
1007 1007
 
1008 1008
         $address = '';
1009 1009
         $zip = '';
@@ -1014,21 +1014,21 @@  discard block
 block discarded – undo
1014 1014
 
1015 1015
         if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1016 1016
             $post = $gd_ses_listing;
1017
-            $address = $post[$prefix . 'address'];
1018
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1019
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1020
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1021
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1022
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1017
+            $address = $post[$prefix.'address'];
1018
+            $zip = isset($post[$prefix.'zip']) ? $post[$prefix.'zip'] : '';
1019
+            $lat = isset($post[$prefix.'latitude']) ? $post[$prefix.'latitude'] : '';
1020
+            $lng = isset($post[$prefix.'longitude']) ? $post[$prefix.'longitude'] : '';
1021
+            $mapview = isset($post[$prefix.'mapview']) ? $post[$prefix.'mapview'] : '';
1022
+            $mapzoom = isset($post[$prefix.'mapzoom']) ? $post[$prefix.'mapzoom'] : '';
1023 1023
         } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1024
-            $post_info = (array)$post_info;
1025
-
1026
-            $address = $post_info[$prefix . 'address'];
1027
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1028
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1029
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1030
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1031
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1024
+            $post_info = (array) $post_info;
1025
+
1026
+            $address = $post_info[$prefix.'address'];
1027
+            $zip = isset($post_info[$prefix.'zip']) ? $post_info[$prefix.'zip'] : '';
1028
+            $lat = isset($post_info[$prefix.'latitude']) ? $post_info[$prefix.'latitude'] : '';
1029
+            $lng = isset($post_info[$prefix.'longitude']) ? $post_info[$prefix.'longitude'] : '';
1030
+            $mapview = isset($post_info[$prefix.'mapview']) ? $post_info[$prefix.'mapview'] : '';
1031
+            $mapzoom = isset($post_info[$prefix.'mapzoom']) ? $post_info[$prefix.'mapzoom'] : '';
1032 1032
         }
1033 1033
 
1034 1034
         $location = geodir_get_default_location();
@@ -1066,18 +1066,18 @@  discard block
 block discarded – undo
1066 1066
         $locate_me = !empty($extra_fields['show_map']) && geodir_map_name() != 'none' ? true : false;
1067 1067
         $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068 1068
         ?>
1069
-        <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071
-            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
1069
+        <div id="geodir_<?php echo $prefix.'address'; ?>_row"
1070
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1071
+            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>'; ?></label>
1072 1072
             <?php if ($locate_me) { ?>
1073 1073
             <div class="gd-input-group gd-locate-me">
1074 1074
             <?php } ?>
1075
-                <input type="text" field_type="<?php echo $type;?>" name="<?php echo $prefix . 'address';?>" id="<?php echo $prefix . 'address';?>" class="geodir_textfield<?php echo $locate_me_class;?>" value="<?php echo esc_attr(stripslashes($address)); ?>" />
1075
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'address'; ?>" id="<?php echo $prefix.'address'; ?>" class="geodir_textfield<?php echo $locate_me_class; ?>" value="<?php echo esc_attr(stripslashes($address)); ?>" />
1076 1076
                 <?php if ($locate_me) { ?>
1077 1077
                 <span onclick="gdGeoLocateMe(this, 'add-listing');" class="gd-locate-me-btn gd-input-group-addon" title="<?php esc_attr_e('My location', 'geodirlocation'); ?>"><i class="fa fa-crosshairs fa-fw" aria-hidden="true"></i></span>
1078 1078
             </div>
1079 1079
             <?php } ?>
1080
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1080
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1081 1081
             <?php if ($is_required) { ?>
1082 1082
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1083 1083
             <?php } ?>
@@ -1096,14 +1096,14 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
         if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1098 1098
 
1099
-            <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1099
+            <div id="geodir_<?php echo $prefix.'zip'; ?>_row"
1100 1100
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
1101 1101
                 <label>
1102 1102
                     <?php _e($zip_title, 'geodirectory'); ?>
1103 1103
                     <?php /*if($is_required) echo '<span>*</span>';*/ ?>
1104 1104
                 </label>
1105
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'zip'; ?>"
1106
-                       id="<?php echo $prefix . 'zip'; ?>" class="geodir_textfield autofill"
1105
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'zip'; ?>"
1106
+                       id="<?php echo $prefix.'zip'; ?>" class="geodir_textfield autofill"
1107 1107
                        value="<?php echo esc_attr(stripslashes($zip)); ?>"/>
1108 1108
                 <?php /*if($is_required) {?>
1109 1109
 					<span class="geodir_message_error"><?php echo _e($required_msg,'geodirectory');?></span>
@@ -1113,14 +1113,14 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
         <?php if (isset($extra_fields['show_map']) && $extra_fields['show_map']) { ?>
1115 1115
 
1116
-            <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1116
+            <div id="geodir_<?php echo $prefix.'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1117 1117
                 <?php
1118 1118
                 /**
1119 1119
                  * Contains add listing page map functions.
1120 1120
                  *
1121 1121
                  * @since 1.0.0
1122 1122
                  */
1123
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1123
+                include(geodir_plugin_path()."/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1124 1124
                 if ($lat_lng_blank) {
1125 1125
                     $lat = '';
1126 1126
                     $lng = '';
@@ -1131,14 +1131,14 @@  discard block
 block discarded – undo
1131 1131
             <?php
1132 1132
             /* show lat lng */
1133 1133
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134
-            <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1134
+            <div id="geodir_<?php echo $prefix.'latitude'; ?>_row"
1135 1135
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1136
                 <label>
1137 1137
                     <?php echo PLACE_ADDRESS_LAT; ?>
1138 1138
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1139 1139
                 </label>
1140
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1141
-                       id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
1140
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'latitude'; ?>"
1141
+                       id="<?php echo $prefix.'latitude'; ?>" class="geodir_textfield"
1142 1142
                        value="<?php echo esc_attr(stripslashes($lat)); ?>" size="25"/>
1143 1143
                 <span class="geodir_message_note"><?php echo GET_LATITUDE_MSG; ?></span>
1144 1144
                 <?php if ($is_required) { ?>
@@ -1146,14 +1146,14 @@  discard block
 block discarded – undo
1146 1146
                 <?php } ?>
1147 1147
             </div>
1148 1148
 
1149
-            <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1149
+            <div id="geodir_<?php echo $prefix.'longitude'; ?>_row"
1150 1150
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1151 1151
                 <label>
1152 1152
                     <?php echo PLACE_ADDRESS_LNG; ?>
1153 1153
                     <?php if ($is_required) echo '<span>*</span>'; ?>
1154 1154
                 </label>
1155
-                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1156
-                       id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
1155
+                <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix.'longitude'; ?>"
1156
+                       id="<?php echo $prefix.'longitude'; ?>" class="geodir_textfield"
1157 1157
                        value="<?php echo esc_attr(stripslashes($lng)); ?>" size="25"/>
1158 1158
                 <span class="geodir_message_note"><?php echo GET_LOGNGITUDE_MSG; ?></span>
1159 1159
                 <?php if ($is_required) { ?>
@@ -1163,32 +1163,32 @@  discard block
 block discarded – undo
1163 1163
         <?php } ?>
1164 1164
 
1165 1165
         <?php if (isset($extra_fields['show_mapview']) && $extra_fields['show_mapview']) { ?>
1166
-            <div id="geodir_<?php echo $prefix . 'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1166
+            <div id="geodir_<?php echo $prefix.'mapview'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1167 1167
                 <label><?php _e($mapview_title, 'geodirectory'); ?></label>
1168 1168
 
1169 1169
 
1170 1170
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1171 1171
                                                             class="gd-checkbox"
1172
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1173
-                                                            id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1172
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1173
+                                                            id="<?php echo $prefix.'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1174 1174
                             echo 'checked="checked"';
1175 1175
                         } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1176 1176
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1177 1177
                                                              class="gd-checkbox"
1178
-                                                             name="<?php echo $prefix . 'mapview'; ?>"
1178
+                                                             name="<?php echo $prefix.'mapview'; ?>"
1179 1179
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1180 1180
                             echo 'checked="checked"';
1181 1181
                         } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1182 1182
 
1183 1183
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1184 1184
                                                             class="gd-checkbox"
1185
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1185
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1186 1186
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1187 1187
                             echo 'checked="checked"';
1188 1188
                         } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1189 1189
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1190 1190
                                                             class="gd-checkbox"
1191
-                                                            name="<?php echo $prefix . 'mapview'; ?>"
1191
+                                                            name="<?php echo $prefix.'mapview'; ?>"
1192 1192
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1193 1193
                             echo 'checked="checked"';
1194 1194
                         } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1201 1201
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1202 1202
                 echo esc_attr($mapzoom);
1203
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1203
+            } ?>" name="<?php echo $prefix.'mapzoom'; ?>" id="<?php echo $prefix.'mapzoom'; ?>"/>
1204 1204
         <?php }
1205 1205
 
1206 1206
         $html = ob_get_clean();
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
     return $html;
1210 1210
 }
1211
-add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1211
+add_filter('geodir_custom_field_input_address', 'geodir_cfi_address', 10, 2);
1212 1212
 
1213 1213
 
1214 1214
 
@@ -1221,12 +1221,12 @@  discard block
 block discarded – undo
1221 1221
  *
1222 1222
  * @return string The html to output for the custom field.
1223 1223
  */
1224
-function geodir_cfi_taxonomy($html,$cf){
1224
+function geodir_cfi_taxonomy($html, $cf) {
1225 1225
 
1226 1226
     $html_var = $cf['htmlvar_name'];
1227 1227
 
1228 1228
     // Check if there is a custom field specific filter.
1229
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1229
+    if (has_filter("geodir_custom_field_input_taxonomy_{$html_var}")) {
1230 1230
         /**
1231 1231
          * Filter the taxonomy html by individual custom field.
1232 1232
          *
@@ -1234,11 +1234,11 @@  discard block
 block discarded – undo
1234 1234
          * @param array $cf The custom field array.
1235 1235
          * @since 1.6.6
1236 1236
          */
1237
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1237
+        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}", $html, $cf);
1238 1238
     }
1239 1239
 
1240 1240
     // If no html then we run the standard output.
1241
-    if(empty($html)) {
1241
+    if (empty($html)) {
1242 1242
 
1243 1243
         ob_start(); // Start  buffering;
1244 1244
         $value = geodir_get_cf_value($cf);
@@ -1253,15 +1253,15 @@  discard block
 block discarded – undo
1253 1253
         if ($value == $cf['default']) {
1254 1254
             $value = '';
1255 1255
         } ?>
1256
-        <div id="<?php echo $name;?>_row"
1257
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1256
+        <div id="<?php echo $name; ?>_row"
1257
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1258 1258
             <label>
1259 1259
                 <?php $site_title = __($site_title, 'geodirectory');
1260 1260
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261
-                <?php if ($is_required) echo '<span>*</span>';?>
1261
+                <?php if ($is_required) echo '<span>*</span>'; ?>
1262 1262
             </label>
1263 1263
 
1264
-            <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1264
+            <div id="<?php echo $name; ?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1265 1265
                 <?php
1266 1266
                 global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1267 1267
 
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 
1274 1274
                     $package_info = array();
1275 1275
 
1276
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1276
+                    $package_info = (array) geodir_post_package_info($package_info, $post, $post_type);
1277 1277
 
1278 1278
                     if (!empty($package_info)) {
1279 1279
 
@@ -1302,7 +1302,7 @@  discard block
 block discarded – undo
1302 1302
 
1303 1303
                     $catadd_limit = $wpdb->get_var(
1304 1304
                         $wpdb->prepare(
1305
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1305
+                            "SELECT cat_limit FROM ".GEODIR_PRICE_TABLE." WHERE pid = %d",
1306 1306
                             array($package_id)
1307 1307
                         )
1308 1308
                     );
@@ -1318,13 +1318,13 @@  discard block
 block discarded – undo
1318 1318
                     $required_limit_msg = '';
1319 1319
                     if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1320 1320
 
1321
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1321
+                        $required_limit_msg = __('Only select', 'geodirectory').' '.$catadd_limit.__(' categories for this package.', 'geodirectory');
1322 1322
 
1323 1323
                     } else {
1324 1324
                         $required_limit_msg = $required_msg;
1325 1325
                     }
1326 1326
 
1327
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1327
+                    echo '<input type="hidden" cat_limit="'.$catadd_limit.'" id="cat_limit" value="'.esc_attr($required_limit_msg).'" name="cat_limit['.$name.']"  />';
1328 1328
 
1329 1329
 
1330 1330
                     if ($cat_display == 'select' || $cat_display == 'multiselect') {
@@ -1334,11 +1334,11 @@  discard block
 block discarded – undo
1334 1334
                         if ($cat_display == 'multiselect')
1335 1335
                             $multiple = 'multiple="multiple"';
1336 1336
 
1337
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1337
+                        echo '<select id="'.$name.'" '.$multiple.' type="'.$name.'" name="post_category['.$name.'][]" alt="'.$name.'" field_type="'.$cat_display.'" class="geodir_textfield textfield_x chosen_select" data-placeholder="'.__('Select Category', 'geodirectory').'">';
1338 1338
 
1339 1339
 
1340 1340
                         if ($cat_display == 'select')
1341
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1341
+                            echo '<option value="">'.__('Select Category', 'geodirectory').'</option>';
1342 1342
 
1343 1343
                     }
1344 1344
 
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
                 ?>
1357 1357
             </div>
1358 1358
 
1359
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
1359
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?></span>
1360 1360
             <?php if ($is_required) { ?>
1361 1361
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1362 1362
             <?php } ?>
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 
1369 1369
     return $html;
1370 1370
 }
1371
-add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1371
+add_filter('geodir_custom_field_input_taxonomy', 'geodir_cfi_taxonomy', 10, 2);
1372 1372
 
1373 1373
 
1374 1374
 /**
@@ -1380,12 +1380,12 @@  discard block
 block discarded – undo
1380 1380
  *
1381 1381
  * @return string The html to output for the custom field.
1382 1382
  */
1383
-function geodir_cfi_file($html,$cf){
1383
+function geodir_cfi_file($html, $cf) {
1384 1384
 
1385 1385
     $html_var = $cf['htmlvar_name'];
1386 1386
 
1387 1387
     // Check if there is a custom field specific filter.
1388
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1388
+    if (has_filter("geodir_custom_field_input_file_{$html_var}")) {
1389 1389
         /**
1390 1390
          * Filter the file html by individual custom field.
1391 1391
          *
@@ -1393,11 +1393,11 @@  discard block
 block discarded – undo
1393 1393
          * @param array $cf The custom field array.
1394 1394
          * @since 1.6.6
1395 1395
          */
1396
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1396
+        $html = apply_filters("geodir_custom_field_input_file_{$html_var}", $html, $cf);
1397 1397
     }
1398 1398
 
1399 1399
     // If no html then we run the standard output.
1400
-    if(empty($html)) {
1400
+    if (empty($html)) {
1401 1401
 
1402 1402
         ob_start(); // Start  buffering;
1403 1403
         $value = geodir_get_cf_value($cf);
@@ -1440,8 +1440,8 @@  discard block
 block discarded – undo
1440 1440
                 $file_totImg = count($curImages);
1441 1441
         }
1442 1442
 
1443
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1444
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1443
+        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? implode(",", $extra_fields['gd_file_types']) : '';
1444
+        $display_file_types = $allowed_file_types != '' ? '.'.implode(", .", $extra_fields['gd_file_types']) : '';
1445 1445
 
1446 1446
         ?>
1447 1447
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
@@ -1451,13 +1451,13 @@  discard block
 block discarded – undo
1451 1451
 			</h5>   <?php */
1452 1452
         ?>
1453 1453
 
1454
-        <div id="<?php echo $name;?>_row"
1455
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1454
+        <div id="<?php echo $name; ?>_row"
1455
+             class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
1456 1456
 
1457 1457
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1458 1458
                 <label
1459 1459
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1460
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1460
+                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>'; ?></label>
1461 1461
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1462 1462
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1463 1463
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
                        id="<?php echo $file_id; ?>image_limit" value="<?php echo $file_image_limit; ?>"/>
1466 1466
                 <?php if ($allowed_file_types != '') { ?>
1467 1467
                     <input type="hidden" name="<?php echo $file_id; ?>_allowed_types"
1468
-                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types);?>"/>
1468
+                           id="<?php echo $file_id; ?>_allowed_types" value="<?php echo esc_attr($allowed_file_types); ?>" data-exts="<?php echo esc_attr($display_file_types); ?>"/>
1469 1469
                 <?php } ?>
1470 1470
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1471 1471
                        value="<?php if (isset($file_totImg)) {
@@ -1481,10 +1481,10 @@  discard block
 block discarded – undo
1481 1481
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1482 1482
                         ?>
1483 1483
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1484
-                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1484
+                               value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory')); ?>"
1485 1485
                                class="geodir_button" style="margin-top:10px;"/>
1486 1486
                             <span class="ajaxnonceplu"
1487
-                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id . 'pluploadan'); ?>"></span>
1487
+                                  id="ajaxnonceplu<?php echo wp_create_nonce($file_id.'pluploadan'); ?>"></span>
1488 1488
                         <?php if ($file_width && $file_height): ?>
1489 1489
                             <span class="plupload-resize"></span>
1490 1490
                             <span class="plupload-width" id="plupload-width<?php echo $file_width; ?>"></span>
@@ -1504,7 +1504,7 @@  discard block
 block discarded – undo
1504 1504
 
1505 1505
                 </div>
1506 1506
             </div>
1507
-            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?> <?php echo ( $display_file_types != '' ? __('Allowed file types:', 'geodirectory') . ' ' . $display_file_types : '' );?></span>
1507
+            <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory'); ?> <?php echo ($display_file_types != '' ? __('Allowed file types:', 'geodirectory').' '.$display_file_types : ''); ?></span>
1508 1508
             <?php if ($is_required) { ?>
1509 1509
                 <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
1510 1510
             <?php } ?>
@@ -1517,4 +1517,4 @@  discard block
 block discarded – undo
1517 1517
 
1518 1518
     return $html;
1519 1519
 }
1520
-add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1521 1520
\ No newline at end of file
1521
+add_filter('geodir_custom_field_input_file', 'geodir_cfi_file', 10, 2);
1522 1522
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +711 added lines, -711 removed lines patch added patch discarded remove patch
@@ -19,35 +19,35 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_cfi_fieldset($html,$cf){
21 21
 
22
-    $html_var = $cf['htmlvar_name'];
23
-
24
-    // Check if there is a custom field specific filter.
25
-    if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
-        /**
27
-         * Filter the fieldset html by individual custom field.
28
-         *
29
-         * @param string $html The html to filter.
30
-         * @param array $cf The custom field array.
31
-         * @since 1.6.6
32
-         */
33
-        $html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
-    }
35
-
36
-    // If no html then we run the standard output.
37
-    if(empty($html)) {
38
-
39
-        ob_start(); // Start  buffering;
40
-        ?>
22
+	$html_var = $cf['htmlvar_name'];
23
+
24
+	// Check if there is a custom field specific filter.
25
+	if(has_filter("geodir_custom_field_input_fieldset_{$html_var}")){
26
+		/**
27
+		 * Filter the fieldset html by individual custom field.
28
+		 *
29
+		 * @param string $html The html to filter.
30
+		 * @param array $cf The custom field array.
31
+		 * @since 1.6.6
32
+		 */
33
+		$html = apply_filters("geodir_custom_field_input_fieldset_{$html_var}",$html,$cf);
34
+	}
35
+
36
+	// If no html then we run the standard output.
37
+	if(empty($html)) {
38
+
39
+		ob_start(); // Start  buffering;
40
+		?>
41 41
         <h5 id="geodir_fieldset_<?php echo (int) $cf['id']; ?>" class="geodir-fieldset-row"
42 42
             gd-fieldset="<?php echo (int) $cf['id']; ?>"><?php echo __( $cf['site_title'], 'geodirectory' ); ?>
43 43
             <?php if ( $cf['desc'] != '' ) {
44
-                echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
45
-            } ?></h5>
44
+				echo '<small>( ' . __( $cf['desc'], 'geodirectory' ) . ' )</small>';
45
+			} ?></h5>
46 46
         <?php
47
-        $html = ob_get_clean();
48
-    }
47
+		$html = ob_get_clean();
48
+	}
49 49
 
50
-    return $html;
50
+	return $html;
51 51
 }
52 52
 add_filter('geodir_custom_field_input_fieldset','geodir_cfi_fieldset',10,2);
53 53
 
@@ -64,47 +64,47 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function geodir_cfi_text($html,$cf){
66 66
 
67
-    $html_var = $cf['htmlvar_name'];
68
-
69
-    // Check if there is a custom field specific filter.
70
-    if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
-        /**
72
-         * Filter the text html by individual custom field.
73
-         *
74
-         * @param string $html The html to filter.
75
-         * @param array $cf The custom field array.
76
-         * @since 1.6.6
77
-         */
78
-        $html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
-    }
80
-
81
-    // If no html then we run the standard output.
82
-    if(empty($html)) {
83
-
84
-        ob_start(); // Start  buffering;
85
-
86
-        $value = geodir_get_cf_value($cf);
87
-        $type = $cf['type'];
88
-        //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
-
92
-        //validation
93
-        if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
-            $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
96
-
97
-        // validation message
98
-        if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
-            $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
101
-        ?>
67
+	$html_var = $cf['htmlvar_name'];
68
+
69
+	// Check if there is a custom field specific filter.
70
+	if(has_filter("geodir_custom_field_input_text_{$html_var}")){
71
+		/**
72
+		 * Filter the text html by individual custom field.
73
+		 *
74
+		 * @param string $html The html to filter.
75
+		 * @param array $cf The custom field array.
76
+		 * @since 1.6.6
77
+		 */
78
+		$html = apply_filters("geodir_custom_field_input_text_{$html_var}",$html,$cf);
79
+	}
80
+
81
+	// If no html then we run the standard output.
82
+	if(empty($html)) {
83
+
84
+		ob_start(); // Start  buffering;
85
+
86
+		$value = geodir_get_cf_value($cf);
87
+		$type = $cf['type'];
88
+		//number and float validation $validation_pattern
89
+		if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
+		elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91
+
92
+		//validation
93
+		if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94
+			$validation = 'pattern="'.$cf['validation_pattern'].'"';
95
+		}else{$validation='';}
96
+
97
+		// validation message
98
+		if(isset($cf['validation_msg']) && $cf['validation_msg']){
99
+			$validation_msg = 'title="'.$cf['validation_msg'].'"';
100
+		}else{$validation_msg='';}
101
+		?>
102 102
 
103 103
         <div id="<?php echo $cf['name'];?>_row"
104 104
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
105 105
             <label>
106 106
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
107
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108 108
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
109 109
             </label>
110 110
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
         </div>
117 117
 
118 118
         <?php
119
-        $html = ob_get_clean();
120
-    }
119
+		$html = ob_get_clean();
120
+	}
121 121
 
122
-    return $html;
122
+	return $html;
123 123
 }
124 124
 add_filter('geodir_custom_field_input_text','geodir_cfi_text',10,2);
125 125
 
@@ -135,35 +135,35 @@  discard block
 block discarded – undo
135 135
  */
136 136
 function geodir_cfi_email($html,$cf){
137 137
 
138
-    $html_var = $cf['htmlvar_name'];
138
+	$html_var = $cf['htmlvar_name'];
139 139
 
140
-    // Check if there is a custom field specific filter.
141
-    if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
-        /**
143
-         * Filter the email html by individual custom field.
144
-         *
145
-         * @param string $html The html to filter.
146
-         * @param array $cf The custom field array.
147
-         * @since 1.6.6
148
-         */
149
-        $html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
-    }
140
+	// Check if there is a custom field specific filter.
141
+	if(has_filter("geodir_custom_field_input_email_{$html_var}")){
142
+		/**
143
+		 * Filter the email html by individual custom field.
144
+		 *
145
+		 * @param string $html The html to filter.
146
+		 * @param array $cf The custom field array.
147
+		 * @since 1.6.6
148
+		 */
149
+		$html = apply_filters("geodir_custom_field_input_email_{$html_var}",$html,$cf);
150
+	}
151 151
 
152
-    // If no html then we run the standard output.
153
-    if(empty($html)) {
152
+	// If no html then we run the standard output.
153
+	if(empty($html)) {
154 154
 
155
-        ob_start(); // Start  buffering;
156
-        $value = geodir_get_cf_value($cf);
155
+		ob_start(); // Start  buffering;
156
+		$value = geodir_get_cf_value($cf);
157 157
 
158
-        if ($value == $cf['default']) {
159
-            $value = '';
160
-        }?>
158
+		if ($value == $cf['default']) {
159
+			$value = '';
160
+		}?>
161 161
 
162 162
         <div id="<?php echo $cf['name'];?>_row"
163 163
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
164 164
             <label>
165 165
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
166
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167 167
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
168 168
             </label>
169 169
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         </div>
176 176
 
177 177
         <?php
178
-        $html = ob_get_clean();
179
-    }
178
+		$html = ob_get_clean();
179
+	}
180 180
 
181
-    return $html;
181
+	return $html;
182 182
 }
183 183
 add_filter('geodir_custom_field_input_email','geodir_cfi_email',10,2);
184 184
 
@@ -195,35 +195,35 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function geodir_cfi_phone($html,$cf){
197 197
 
198
-    $html_var = $cf['htmlvar_name'];
198
+	$html_var = $cf['htmlvar_name'];
199 199
 
200
-    // Check if there is a custom field specific filter.
201
-    if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
-        /**
203
-         * Filter the phone html by individual custom field.
204
-         *
205
-         * @param string $html The html to filter.
206
-         * @param array $cf The custom field array.
207
-         * @since 1.6.6
208
-         */
209
-        $html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
-    }
200
+	// Check if there is a custom field specific filter.
201
+	if(has_filter("geodir_custom_field_input_phone_{$html_var}")){
202
+		/**
203
+		 * Filter the phone html by individual custom field.
204
+		 *
205
+		 * @param string $html The html to filter.
206
+		 * @param array $cf The custom field array.
207
+		 * @since 1.6.6
208
+		 */
209
+		$html = apply_filters("geodir_custom_field_input_phone_{$html_var}",$html,$cf);
210
+	}
211 211
 
212
-    // If no html then we run the standard output.
213
-    if(empty($html)) {
212
+	// If no html then we run the standard output.
213
+	if(empty($html)) {
214 214
 
215
-        ob_start(); // Start  buffering;
216
-        $value = geodir_get_cf_value($cf);
215
+		ob_start(); // Start  buffering;
216
+		$value = geodir_get_cf_value($cf);
217 217
 
218
-        if ($value == $cf['default']) {
219
-            $value = '';
220
-        }?>
218
+		if ($value == $cf['default']) {
219
+			$value = '';
220
+		}?>
221 221
 
222 222
         <div id="<?php echo $cf['name'];?>_row"
223 223
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
224 224
             <label>
225 225
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
226
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227 227
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
228 228
             </label>
229 229
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
         </div>
236 236
 
237 237
         <?php
238
-        $html = ob_get_clean();
239
-    }
238
+		$html = ob_get_clean();
239
+	}
240 240
 
241
-    return $html;
241
+	return $html;
242 242
 }
243 243
 add_filter('geodir_custom_field_input_phone','geodir_cfi_phone',10,2);
244 244
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
  */
256 256
 function geodir_cfi_url($html,$cf){
257 257
 
258
-    $html_var = $cf['htmlvar_name'];
258
+	$html_var = $cf['htmlvar_name'];
259 259
 
260
-    // Check if there is a custom field specific filter.
261
-    if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
-        /**
263
-         * Filter the url html by individual custom field.
264
-         *
265
-         * @param string $html The html to filter.
266
-         * @param array $cf The custom field array.
267
-         * @since 1.6.6
268
-         */
269
-        $html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
-    }
260
+	// Check if there is a custom field specific filter.
261
+	if(has_filter("geodir_custom_field_input_url_{$html_var}")){
262
+		/**
263
+		 * Filter the url html by individual custom field.
264
+		 *
265
+		 * @param string $html The html to filter.
266
+		 * @param array $cf The custom field array.
267
+		 * @since 1.6.6
268
+		 */
269
+		$html = apply_filters("geodir_custom_field_input_url_{$html_var}",$html,$cf);
270
+	}
271 271
 
272
-    // If no html then we run the standard output.
273
-    if(empty($html)) {
272
+	// If no html then we run the standard output.
273
+	if(empty($html)) {
274 274
 
275
-        ob_start(); // Start  buffering;
276
-        $value = geodir_get_cf_value($cf);
275
+		ob_start(); // Start  buffering;
276
+		$value = geodir_get_cf_value($cf);
277 277
 
278
-        if ($value == $cf['default']) {
279
-            $value = '';
280
-        }?>
278
+		if ($value == $cf['default']) {
279
+			$value = '';
280
+		}?>
281 281
 
282 282
         <div id="<?php echo $cf['name'];?>_row"
283 283
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
284 284
             <label>
285 285
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
286
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287 287
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
288 288
             </label>
289 289
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
         </div>
299 299
 
300 300
         <?php
301
-        $html = ob_get_clean();
302
-    }
301
+		$html = ob_get_clean();
302
+	}
303 303
 
304
-    return $html;
304
+	return $html;
305 305
 }
306 306
 add_filter('geodir_custom_field_input_url','geodir_cfi_url',10,2);
307 307
 
@@ -317,48 +317,48 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function geodir_cfi_radio($html,$cf){
319 319
 
320
-    $html_var = $cf['htmlvar_name'];
320
+	$html_var = $cf['htmlvar_name'];
321 321
 
322
-    // Check if there is a custom field specific filter.
323
-    if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
-        /**
325
-         * Filter the radio html by individual custom field.
326
-         *
327
-         * @param string $html The html to filter.
328
-         * @param array $cf The custom field array.
329
-         * @since 1.6.6
330
-         */
331
-        $html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
-    }
322
+	// Check if there is a custom field specific filter.
323
+	if(has_filter("geodir_custom_field_input_radio_{$html_var}")){
324
+		/**
325
+		 * Filter the radio html by individual custom field.
326
+		 *
327
+		 * @param string $html The html to filter.
328
+		 * @param array $cf The custom field array.
329
+		 * @since 1.6.6
330
+		 */
331
+		$html = apply_filters("geodir_custom_field_input_radio_{$html_var}",$html,$cf);
332
+	}
333 333
 
334
-    // If no html then we run the standard output.
335
-    if(empty($html)) {
334
+	// If no html then we run the standard output.
335
+	if(empty($html)) {
336 336
 
337
-        ob_start(); // Start  buffering;
338
-        $value = geodir_get_cf_value($cf);
337
+		ob_start(); // Start  buffering;
338
+		$value = geodir_get_cf_value($cf);
339 339
 
340
-        ?>
340
+		?>
341 341
         <div id="<?php echo $cf['name'];?>_row"
342 342
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
343 343
             <label>
344 344
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
345
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346 346
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
347 347
             </label>
348 348
             <?php if ($cf['option_values']) {
349
-                $option_values = geodir_string_values_to_options($cf['option_values'], true);
349
+				$option_values = geodir_string_values_to_options($cf['option_values'], true);
350 350
 
351
-                if (!empty($option_values)) {
352
-                    foreach ($option_values as $option_value) {
353
-                        if (empty($option_value['optgroup'])) {
354
-                            ?>
351
+				if (!empty($option_values)) {
352
+					foreach ($option_values as $option_value) {
353
+						if (empty($option_value['optgroup'])) {
354
+							?>
355 355
                             <span class="gd-radios"><input name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" <?php checked(stripslashes($value), $option_value['value']);?> value="<?php echo esc_attr($option_value['value']); ?>" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="radio" /><?php echo $option_value['label']; ?></span>
356 356
                             <?php
357
-                        }
358
-                    }
359
-                }
360
-            }
361
-            ?>
357
+						}
358
+					}
359
+				}
360
+			}
361
+			?>
362 362
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
363 363
             <?php if ($cf['is_required']) { ?>
364 364
                 <span class="geodir_message_error"><?php _e($cf['required_msg'], 'geodirectory'); ?></span>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
         </div>
367 367
 
368 368
         <?php
369
-        $html = ob_get_clean();
370
-    }
369
+		$html = ob_get_clean();
370
+	}
371 371
 
372
-    return $html;
372
+	return $html;
373 373
 }
374 374
 add_filter('geodir_custom_field_input_radio','geodir_cfi_radio',10,2);
375 375
 
@@ -385,46 +385,46 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function geodir_cfi_checkbox($html,$cf){
387 387
 
388
-    $html_var = $cf['htmlvar_name'];
388
+	$html_var = $cf['htmlvar_name'];
389 389
 
390
-    // Check if there is a custom field specific filter.
391
-    if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
-        /**
393
-         * Filter the checkbox html by individual custom field.
394
-         *
395
-         * @param string $html The html to filter.
396
-         * @param array $cf The custom field array.
397
-         * @since 1.6.6
398
-         */
399
-        $html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
-    }
390
+	// Check if there is a custom field specific filter.
391
+	if(has_filter("geodir_custom_field_input_checkbox_{$html_var}")){
392
+		/**
393
+		 * Filter the checkbox html by individual custom field.
394
+		 *
395
+		 * @param string $html The html to filter.
396
+		 * @param array $cf The custom field array.
397
+		 * @since 1.6.6
398
+		 */
399
+		$html = apply_filters("geodir_custom_field_input_checkbox_{$html_var}",$html,$cf);
400
+	}
401 401
 
402
-    // If no html then we run the standard output.
403
-    if(empty($html)) {
402
+	// If no html then we run the standard output.
403
+	if(empty($html)) {
404 404
 
405
-        ob_start(); // Start  buffering;
406
-        $value = geodir_get_cf_value($cf);
405
+		ob_start(); // Start  buffering;
406
+		$value = geodir_get_cf_value($cf);
407 407
 
408 408
 
409
-        if ($value == '' && $cf['default']) {
410
-            $value = '1';
411
-        }
412
-        ?>
409
+		if ($value == '' && $cf['default']) {
410
+			$value = '1';
411
+		}
412
+		?>
413 413
 
414 414
         <div id="<?php echo $cf['name'];?>_row"
415 415
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
416 416
             <label>
417 417
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
418
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419 419
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
420 420
             </label>
421 421
             <?php if ($value != '1') {
422
-                $value = '0';
423
-            }?>
422
+				$value = '0';
423
+			}?>
424 424
             <input type="hidden" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>" value="<?php echo esc_attr($value);?>"/>
425 425
             <input  <?php if ($value == '1') {
426
-                echo 'checked="checked"';
427
-            }?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
426
+				echo 'checked="checked"';
427
+			}?>  value="1" class="gd-checkbox" field_type="<?php echo $cf['type'];?>" type="checkbox"
428 428
                  onchange="if(this.checked){jQuery('#<?php echo $cf['name'];?>').val('1');} else{ jQuery('#<?php echo $cf['name'];?>').val('0');}"/>
429 429
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
430 430
             <?php if ($cf['is_required']) { ?>
@@ -433,10 +433,10 @@  discard block
 block discarded – undo
433 433
         </div>
434 434
 
435 435
         <?php
436
-        $html = ob_get_clean();
437
-    }
436
+		$html = ob_get_clean();
437
+	}
438 438
 
439
-    return $html;
439
+	return $html;
440 440
 }
441 441
 add_filter('geodir_custom_field_input_checkbox','geodir_cfi_checkbox',10,2);
442 442
 
@@ -452,52 +452,52 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_cfi_textarea($html,$cf){
454 454
 
455
-    $html_var = $cf['htmlvar_name'];
455
+	$html_var = $cf['htmlvar_name'];
456 456
 
457
-    // Check if there is a custom field specific filter.
458
-    if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
-        /**
460
-         * Filter the textarea html by individual custom field.
461
-         *
462
-         * @param string $html The html to filter.
463
-         * @param array $cf The custom field array.
464
-         * @since 1.6.6
465
-         */
466
-        $html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
-    }
457
+	// Check if there is a custom field specific filter.
458
+	if(has_filter("geodir_custom_field_input_textarea_{$html_var}")){
459
+		/**
460
+		 * Filter the textarea html by individual custom field.
461
+		 *
462
+		 * @param string $html The html to filter.
463
+		 * @param array $cf The custom field array.
464
+		 * @since 1.6.6
465
+		 */
466
+		$html = apply_filters("geodir_custom_field_input_textarea_{$html_var}",$html,$cf);
467
+	}
468 468
 
469
-    // If no html then we run the standard output.
470
-    if(empty($html)) {
469
+	// If no html then we run the standard output.
470
+	if(empty($html)) {
471 471
 
472
-        ob_start(); // Start  buffering;
473
-        $value = geodir_get_cf_value($cf);
472
+		ob_start(); // Start  buffering;
473
+		$value = geodir_get_cf_value($cf);
474 474
 
475
-        $extra_fields = unserialize($cf['extra_fields']);
476
-        ?>
475
+		$extra_fields = unserialize($cf['extra_fields']);
476
+		?>
477 477
 
478 478
         <div id="<?php echo $cf['name'];?>_row"
479 479
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
480 480
             <label>
481 481
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
482
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483 483
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
484 484
             </label><?php
485 485
 
486 486
 
487
-            if (is_array($extra_fields) && in_array('1', $extra_fields)) {
487
+			if (is_array($extra_fields) && in_array('1', $extra_fields)) {
488 488
 
489
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
489
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?>
490 490
 
491 491
             <div class="editor" field_id="<?php echo $cf['name'];?>" field_type="editor">
492 492
                 <?php wp_editor(stripslashes($value), $cf['name'], $editor_settings); ?>
493 493
                 </div><?php
494 494
 
495
-            } else {
495
+			} else {
496 496
 
497
-                ?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
497
+				?><textarea field_type="<?php echo $cf['type'];?>" class="geodir_textarea" name="<?php echo $cf['name'];?>"
498 498
                             id="<?php echo $cf['name'];?>"><?php echo stripslashes($value);?></textarea><?php
499 499
 
500
-            }?>
500
+			}?>
501 501
 
502 502
 
503 503
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory');?></span>
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
         </div>
508 508
 
509 509
         <?php
510
-        $html = ob_get_clean();
511
-    }
510
+		$html = ob_get_clean();
511
+	}
512 512
 
513
-    return $html;
513
+	return $html;
514 514
 }
515 515
 add_filter('geodir_custom_field_input_textarea','geodir_cfi_textarea',10,2);
516 516
 
@@ -526,53 +526,53 @@  discard block
 block discarded – undo
526 526
  */
527 527
 function geodir_cfi_select($html,$cf){
528 528
 
529
-    $html_var = $cf['htmlvar_name'];
529
+	$html_var = $cf['htmlvar_name'];
530 530
 
531
-    // Check if there is a custom field specific filter.
532
-    if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
-        /**
534
-         * Filter the select html by individual custom field.
535
-         *
536
-         * @param string $html The html to filter.
537
-         * @param array $cf The custom field array.
538
-         * @since 1.6.6
539
-         */
540
-        $html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
-    }
531
+	// Check if there is a custom field specific filter.
532
+	if(has_filter("geodir_custom_field_input_select_{$html_var}")){
533
+		/**
534
+		 * Filter the select html by individual custom field.
535
+		 *
536
+		 * @param string $html The html to filter.
537
+		 * @param array $cf The custom field array.
538
+		 * @since 1.6.6
539
+		 */
540
+		$html = apply_filters("geodir_custom_field_input_select_{$html_var}",$html,$cf);
541
+	}
542 542
 
543
-    // If no html then we run the standard output.
544
-    if(empty($html)) {
543
+	// If no html then we run the standard output.
544
+	if(empty($html)) {
545 545
 
546
-        ob_start(); // Start  buffering;
547
-        $value = geodir_get_cf_value($cf);
546
+		ob_start(); // Start  buffering;
547
+		$value = geodir_get_cf_value($cf);
548 548
 
549
-        ?>
549
+		?>
550 550
         <div id="<?php echo $cf['name'];?>_row"
551 551
              class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 552
             <label>
553 553
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
554
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555 555
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
556 556
             </label>
557 557
             <?php
558
-            $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
-            $select_options = '';
560
-            if (!empty($option_values_arr)) {
561
-                foreach ($option_values_arr as $option_row) {
562
-                    if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
-
565
-                        $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
-                    } else {
567
-                        $option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
-                        $option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
-                        $selected = $option_value == stripslashes($value) ? 'selected="selected"' : '';
570
-
571
-                        $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
-                    }
573
-                }
574
-            }
575
-            ?>
558
+			$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
559
+			$select_options = '';
560
+			if (!empty($option_values_arr)) {
561
+				foreach ($option_values_arr as $option_row) {
562
+					if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
563
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
564
+
565
+						$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
566
+					} else {
567
+						$option_label = isset($option_row['label']) ? $option_row['label'] : '';
568
+						$option_value = isset($option_row['value']) ? $option_row['value'] : '';
569
+						$selected = $option_value == stripslashes($value) ? 'selected="selected"' : '';
570
+
571
+						$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
572
+					}
573
+				}
574
+			}
575
+			?>
576 576
             <select field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
577 577
                     class="geodir_textfield textfield_x chosen_select"
578 578
                     data-placeholder="<?php echo __('Choose', 'geodirectory') . ' ' . $site_title . '&hellip;';?>"
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
         </div>
585 585
 
586 586
         <?php
587
-        $html = ob_get_clean();
588
-    }
587
+		$html = ob_get_clean();
588
+	}
589 589
 
590
-    return $html;
590
+	return $html;
591 591
 }
592 592
 add_filter('geodir_custom_field_input_select','geodir_cfi_select',10,2);
593 593
 
@@ -603,36 +603,36 @@  discard block
 block discarded – undo
603 603
  */
604 604
 function geodir_cfi_multiselect($html,$cf){
605 605
 
606
-    $html_var = $cf['htmlvar_name'];
607
-
608
-    // Check if there is a custom field specific filter.
609
-    if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
-        /**
611
-         * Filter the multiselect html by individual custom field.
612
-         *
613
-         * @param string $html The html to filter.
614
-         * @param array $cf The custom field array.
615
-         * @since 1.6.6
616
-         */
617
-        $html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
-    }
619
-
620
-    // If no html then we run the standard output.
621
-    if(empty($html)) {
622
-
623
-        ob_start(); // Start  buffering;
624
-        $value = geodir_get_cf_value($cf);
625
-
626
-        $multi_display = 'select';
627
-        if (!empty($cf['extra_fields'])) {
628
-            $multi_display = unserialize($cf['extra_fields']);
629
-        }
630
-        ?>
606
+	$html_var = $cf['htmlvar_name'];
607
+
608
+	// Check if there is a custom field specific filter.
609
+	if(has_filter("geodir_custom_field_input_multiselect_{$html_var}")){
610
+		/**
611
+		 * Filter the multiselect html by individual custom field.
612
+		 *
613
+		 * @param string $html The html to filter.
614
+		 * @param array $cf The custom field array.
615
+		 * @since 1.6.6
616
+		 */
617
+		$html = apply_filters("geodir_custom_field_input_multiselect_{$html_var}",$html,$cf);
618
+	}
619
+
620
+	// If no html then we run the standard output.
621
+	if(empty($html)) {
622
+
623
+		ob_start(); // Start  buffering;
624
+		$value = geodir_get_cf_value($cf);
625
+
626
+		$multi_display = 'select';
627
+		if (!empty($cf['extra_fields'])) {
628
+			$multi_display = unserialize($cf['extra_fields']);
629
+		}
630
+		?>
631 631
         <div id="<?php echo $cf['name']; ?>_row"
632 632
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
633 633
             <label>
634 634
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
635
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636 636
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
637 637
             </label>
638 638
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
@@ -643,63 +643,63 @@  discard block
 block discarded – undo
643 643
                         data-placeholder="<?php _e('Select', 'geodirectory'); ?>"
644 644
                         option-ajaxchosen="false">
645 645
                     <?php
646
-                    } else {
647
-                        echo '<ul class="gd_multi_choice">';
648
-                    }
649
-
650
-                    $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
-                    $select_options = '';
652
-                    if (!empty($option_values_arr)) {
653
-                        foreach ($option_values_arr as $option_row) {
654
-                            if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
-
657
-                                if ($multi_display == 'select') {
658
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
-                                } else {
660
-                                    $select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
-                                }
662
-                            } else {
663
-                                if (!is_array($value) && $value != '') {
664
-                                    $value = trim($value);
665
-                                }
646
+					} else {
647
+						echo '<ul class="gd_multi_choice">';
648
+					}
649
+
650
+					$option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
651
+					$select_options = '';
652
+					if (!empty($option_values_arr)) {
653
+						foreach ($option_values_arr as $option_row) {
654
+							if (isset($option_row['optgroup']) && ($option_row['optgroup'] == 'start' || $option_row['optgroup'] == 'end')) {
655
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
656
+
657
+								if ($multi_display == 'select') {
658
+									$select_options .= $option_row['optgroup'] == 'start' ? '<optgroup label="' . esc_attr($option_label) . '">' : '</optgroup>';
659
+								} else {
660
+									$select_options .= $option_row['optgroup'] == 'start' ? '<li>' . $option_label . '</li>' : '';
661
+								}
662
+							} else {
663
+								if (!is_array($value) && $value != '') {
664
+									$value = trim($value);
665
+								}
666 666
                                 
667
-                                $option_label = isset($option_row['label']) ? $option_row['label'] : '';
668
-                                $option_value = isset($option_row['value']) ? $option_row['value'] : '';
669
-                                $selected = $option_value == $value ? 'selected="selected"' : '';
670
-                                $selected = '';
671
-                                $checked = '';
672
-
673
-                                if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
674
-                                    if (!is_array($value)) {
675
-                                        $value_array = explode(',', $value);
676
-                                    } else {
677
-                                        $value_array = $value;
678
-                                    }
667
+								$option_label = isset($option_row['label']) ? $option_row['label'] : '';
668
+								$option_value = isset($option_row['value']) ? $option_row['value'] : '';
669
+								$selected = $option_value == $value ? 'selected="selected"' : '';
670
+								$selected = '';
671
+								$checked = '';
672
+
673
+								if ((!is_array($value) && trim($value) != '') || (is_array($value) && !empty($value))) {
674
+									if (!is_array($value)) {
675
+										$value_array = explode(',', $value);
676
+									} else {
677
+										$value_array = $value;
678
+									}
679 679
                                     
680
-                                    $value_array = stripslashes_deep($value_array);
680
+									$value_array = stripslashes_deep($value_array);
681 681
 
682
-                                    if (is_array($value_array)) {
683
-                                        $value_array = array_map('trim', $value_array);
682
+									if (is_array($value_array)) {
683
+										$value_array = array_map('trim', $value_array);
684 684
                                         
685
-                                        if (in_array($option_value, $value_array)) {
686
-                                            $selected = 'selected="selected"';
687
-                                            $checked = 'checked="checked"';
688
-                                        }
689
-                                    }
690
-                                }
691
-
692
-                                if ($multi_display == 'select') {
693
-                                    $select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
694
-                                } else {
695
-                                    $select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
696
-                                }
697
-                            }
698
-                        }
699
-                    }
700
-                    echo $select_options;
701
-
702
-                    if ($multi_display == 'select') { ?></select></div>
685
+										if (in_array($option_value, $value_array)) {
686
+											$selected = 'selected="selected"';
687
+											$checked = 'checked="checked"';
688
+										}
689
+									}
690
+								}
691
+
692
+								if ($multi_display == 'select') {
693
+									$select_options .= '<option value="' . esc_attr($option_value) . '" ' . $selected . '>' . $option_label . '</option>';
694
+								} else {
695
+									$select_options .= '<li><input name="' . $cf['name'] . '[]" ' . $checked . ' value="' . esc_attr($option_value) . '" class="gd-' . $multi_display . '" field_type="' . $multi_display . '" type="' . $multi_display . '" />&nbsp;' . $option_label . ' </li>';
696
+								}
697
+							}
698
+						}
699
+					}
700
+					echo $select_options;
701
+
702
+					if ($multi_display == 'select') { ?></select></div>
703 703
         <?php } else { ?></ul><?php } ?>
704 704
             <span class="geodir_message_note"><?php _e($cf['desc'], 'geodirectory'); ?></span>
705 705
             <?php if ($cf['is_required']) { ?>
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
             <?php } ?>
708 708
         </div>
709 709
         <?php
710
-        $html = ob_get_clean();
711
-    }
710
+		$html = ob_get_clean();
711
+	}
712 712
 
713
-    return $html;
713
+	return $html;
714 714
 }
715 715
 add_filter('geodir_custom_field_input_multiselect','geodir_cfi_multiselect',10,2);
716 716
 
@@ -726,32 +726,32 @@  discard block
 block discarded – undo
726 726
  */
727 727
 function geodir_cfi_html($html,$cf){
728 728
 
729
-    $html_var = $cf['htmlvar_name'];
729
+	$html_var = $cf['htmlvar_name'];
730 730
 
731
-    // Check if there is a custom field specific filter.
732
-    if(has_filter("geodir_custom_field_input_html_{$html_var}")){
733
-        /**
734
-         * Filter the html html by individual custom field.
735
-         *
736
-         * @param string $html The html to filter.
737
-         * @param array $cf The custom field array.
738
-         * @since 1.6.6
739
-         */
740
-        $html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
741
-    }
731
+	// Check if there is a custom field specific filter.
732
+	if(has_filter("geodir_custom_field_input_html_{$html_var}")){
733
+		/**
734
+		 * Filter the html html by individual custom field.
735
+		 *
736
+		 * @param string $html The html to filter.
737
+		 * @param array $cf The custom field array.
738
+		 * @since 1.6.6
739
+		 */
740
+		$html = apply_filters("geodir_custom_field_input_html_{$html_var}",$html,$cf);
741
+	}
742 742
 
743
-    // If no html then we run the standard output.
744
-    if(empty($html)) {
743
+	// If no html then we run the standard output.
744
+	if(empty($html)) {
745 745
 
746
-        ob_start(); // Start  buffering;
747
-        $value = geodir_get_cf_value($cf);
748
-        ?>
746
+		ob_start(); // Start  buffering;
747
+		$value = geodir_get_cf_value($cf);
748
+		?>
749 749
 
750 750
         <div id="<?php echo $cf['name']; ?>_row"
751 751
              class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
752 752
             <label>
753 753
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
754
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
754
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
755 755
                 <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
756 756
             </label>
757 757
 
@@ -769,10 +769,10 @@  discard block
 block discarded – undo
769 769
         </div>
770 770
 
771 771
         <?php
772
-        $html = ob_get_clean();
773
-    }
772
+		$html = ob_get_clean();
773
+	}
774 774
 
775
-    return $html;
775
+	return $html;
776 776
 }
777 777
 add_filter('geodir_custom_field_input_html','geodir_cfi_html',10,2);
778 778
 
@@ -789,68 +789,68 @@  discard block
 block discarded – undo
789 789
  */
790 790
 function geodir_cfi_datepicker($html,$cf){
791 791
 
792
-    $html_var = $cf['htmlvar_name'];
792
+	$html_var = $cf['htmlvar_name'];
793 793
 
794
-    // Check if there is a custom field specific filter.
795
-    if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
796
-        /**
797
-         * Filter the datepicker html by individual custom field.
798
-         *
799
-         * @param string $html The html to filter.
800
-         * @param array $cf The custom field array.
801
-         * @since 1.6.6
802
-         */
803
-        $html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
804
-    }
794
+	// Check if there is a custom field specific filter.
795
+	if(has_filter("geodir_custom_field_input_datepicker_{$html_var}")){
796
+		/**
797
+		 * Filter the datepicker html by individual custom field.
798
+		 *
799
+		 * @param string $html The html to filter.
800
+		 * @param array $cf The custom field array.
801
+		 * @since 1.6.6
802
+		 */
803
+		$html = apply_filters("geodir_custom_field_input_datepicker_{$html_var}",$html,$cf);
804
+	}
805 805
 
806
-    // If no html then we run the standard output.
807
-    if(empty($html)) {
806
+	// If no html then we run the standard output.
807
+	if(empty($html)) {
808 808
 
809
-        ob_start(); // Start  buffering;
810
-        $value = geodir_get_cf_value($cf);
809
+		ob_start(); // Start  buffering;
810
+		$value = geodir_get_cf_value($cf);
811 811
 
812
-        $extra_fields = unserialize($cf['extra_fields']);
813
-        $name = $cf['name'];
812
+		$extra_fields = unserialize($cf['extra_fields']);
813
+		$name = $cf['name'];
814 814
 
815
-        if ($extra_fields['date_format'] == '')
816
-            $extra_fields['date_format'] = 'yy-mm-dd';
815
+		if ($extra_fields['date_format'] == '')
816
+			$extra_fields['date_format'] = 'yy-mm-dd';
817 817
 
818
-        $date_format = $extra_fields['date_format'];
819
-        $jquery_date_format  = $date_format;
818
+		$date_format = $extra_fields['date_format'];
819
+		$jquery_date_format  = $date_format;
820 820
 
821 821
 
822
-        // check if we need to change the format or not
823
-        $date_format_len = strlen(str_replace(' ', '', $date_format));
824
-        if($date_format_len>5){// if greater then 5 then it's the old style format.
822
+		// check if we need to change the format or not
823
+		$date_format_len = strlen(str_replace(' ', '', $date_format));
824
+		if($date_format_len>5){// if greater then 5 then it's the old style format.
825 825
 
826
-            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
827
-            $replace = array('d','j','l','m','n','F','Y');//PHP date format
826
+			$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
827
+			$replace = array('d','j','l','m','n','F','Y');//PHP date format
828 828
 
829
-            $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
831
-            $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832
-        }
829
+			$date_format = str_replace($search, $replace, $date_format);
830
+		}else{
831
+			$jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832
+		}
833 833
 
834
-        if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
835
-        if($value && !isset($_REQUEST['backandedit'])) {
836
-            //$time = strtotime($value);
837
-            //$value = date_i18n($date_format, $time);
838
-        }
839
-        $value = geodir_date($value, 'Y-m-d', $date_format);
834
+		if($value=='0000-00-00'){$value='';}//if date not set, then mark it empty
835
+		if($value && !isset($_REQUEST['backandedit'])) {
836
+			//$time = strtotime($value);
837
+			//$value = date_i18n($date_format, $time);
838
+		}
839
+		$value = geodir_date($value, 'Y-m-d', $date_format);
840 840
 
841
-        ?>
841
+		?>
842 842
         <script type="text/javascript">
843 843
 
844 844
             jQuery(function () {
845 845
 
846 846
                 jQuery("#<?php echo $cf['name'];?>").datepicker({changeMonth: true, changeYear: true <?php
847
-                    /**
848
-                     * Used to add extra option to datepicker per custom field.
849
-                     *
850
-                     * @since 1.5.7
851
-                     * @param string $name The custom field name.
852
-                     */
853
-                    echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
847
+					/**
848
+					 * Used to add extra option to datepicker per custom field.
849
+					 *
850
+					 * @since 1.5.7
851
+					 * @param string $name The custom field name.
852
+					 */
853
+					echo apply_filters("gd_datepicker_extra_{$name}",'');?>});
854 854
 
855 855
                 jQuery("#<?php echo $name;?>").datepicker("option", "dateFormat", '<?php echo $jquery_date_format;?>');
856 856
 
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
             <label>
867 867
 
868 868
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
869
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870 870
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
871 871
             </label>
872 872
 
@@ -880,10 +880,10 @@  discard block
 block discarded – undo
880 880
         </div>
881 881
 
882 882
         <?php
883
-        $html = ob_get_clean();
884
-    }
883
+		$html = ob_get_clean();
884
+	}
885 885
 
886
-    return $html;
886
+	return $html;
887 887
 }
888 888
 add_filter('geodir_custom_field_input_datepicker','geodir_cfi_datepicker',10,2);
889 889
 
@@ -899,31 +899,31 @@  discard block
 block discarded – undo
899 899
  */
900 900
 function geodir_cfi_time($html,$cf){
901 901
 
902
-    $html_var = $cf['htmlvar_name'];
902
+	$html_var = $cf['htmlvar_name'];
903 903
 
904
-    // Check if there is a custom field specific filter.
905
-    if(has_filter("geodir_custom_field_input_time_{$html_var}")){
906
-        /**
907
-         * Filter the time html by individual custom field.
908
-         *
909
-         * @param string $html The html to filter.
910
-         * @param array $cf The custom field array.
911
-         * @since 1.6.6
912
-         */
913
-        $html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
914
-    }
904
+	// Check if there is a custom field specific filter.
905
+	if(has_filter("geodir_custom_field_input_time_{$html_var}")){
906
+		/**
907
+		 * Filter the time html by individual custom field.
908
+		 *
909
+		 * @param string $html The html to filter.
910
+		 * @param array $cf The custom field array.
911
+		 * @since 1.6.6
912
+		 */
913
+		$html = apply_filters("geodir_custom_field_input_time_{$html_var}",$html,$cf);
914
+	}
915 915
 
916
-    // If no html then we run the standard output.
917
-    if(empty($html)) {
916
+	// If no html then we run the standard output.
917
+	if(empty($html)) {
918 918
 
919
-        ob_start(); // Start  buffering;
920
-        $value = geodir_get_cf_value($cf);
919
+		ob_start(); // Start  buffering;
920
+		$value = geodir_get_cf_value($cf);
921 921
 
922
-        $name = $cf['name'];
922
+		$name = $cf['name'];
923 923
 
924
-        if ($value != '')
925
-            $value = date('H:i', strtotime($value));
926
-        ?>
924
+		if ($value != '')
925
+			$value = date('H:i', strtotime($value));
926
+		?>
927 927
         <script type="text/javascript">
928 928
             jQuery(document).ready(function () {
929 929
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             <label>
940 940
 
941 941
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
942
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943 943
                 <?php if ($cf['is_required']) echo '<span>*</span>';?>
944 944
             </label>
945 945
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
@@ -951,10 +951,10 @@  discard block
 block discarded – undo
951 951
             <?php } ?>
952 952
         </div>
953 953
         <?php
954
-        $html = ob_get_clean();
955
-    }
954
+		$html = ob_get_clean();
955
+	}
956 956
 
957
-    return $html;
957
+	return $html;
958 958
 }
959 959
 add_filter('geodir_custom_field_input_time','geodir_cfi_time',10,2);
960 960
 
@@ -970,102 +970,102 @@  discard block
 block discarded – undo
970 970
  */
971 971
 function geodir_cfi_address($html,$cf){
972 972
 
973
-    $html_var = $cf['htmlvar_name'];
974
-
975
-    // Check if there is a custom field specific filter.
976
-    if(has_filter("geodir_custom_field_input_address_{$html_var}")){
977
-        /**
978
-         * Filter the address html by individual custom field.
979
-         *
980
-         * @param string $html The html to filter.
981
-         * @param array $cf The custom field array.
982
-         * @since 1.6.6
983
-         */
984
-        $html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
985
-    }
986
-
987
-    // If no html then we run the standard output.
988
-    if(empty($html)) {
989
-
990
-        global $gd_session;
991
-        ob_start(); // Start  buffering;
992
-        $value = geodir_get_cf_value($cf);
993
-        $name = $cf['name'];
994
-        $type = $cf['type'];
995
-        $admin_desc = $cf['desc'];
996
-        $is_required = $cf['is_required'];
997
-        $required_msg = $cf['required_msg'];
998
-        $site_title = $cf['site_title'];
999
-        $is_admin = $cf['is_admin'];
1000
-        $extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1001
-        $prefix = $name . '_';
1002
-
1003
-        ($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1004
-        ($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1005
-        ($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1006
-        ($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1007
-
1008
-        $address = '';
1009
-        $zip = '';
1010
-        $mapview = '';
1011
-        $mapzoom = '';
1012
-        $lat = '';
1013
-        $lng = '';
1014
-
1015
-        if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1016
-            $post = $gd_ses_listing;
1017
-            $address = $post[$prefix . 'address'];
1018
-            $zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1019
-            $lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1020
-            $lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1021
-            $mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1022
-            $mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1023
-        } else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1024
-            $post_info = (array)$post_info;
1025
-
1026
-            $address = $post_info[$prefix . 'address'];
1027
-            $zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1028
-            $lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1029
-            $lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1030
-            $mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1031
-            $mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1032
-        }
1033
-
1034
-        $location = geodir_get_default_location();
1035
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1038
-
1039
-        $lat_lng_blank = false;
1040
-        if (empty($lat) && empty($lng)) {
1041
-            $lat_lng_blank = true;
1042
-        }
1043
-
1044
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1046
-
1047
-        /**
1048
-         * Filter the default latitude.
1049
-         *
1050
-         * @since 1.0.0
1051
-         *
1052
-         * @param float $lat Default latitude.
1053
-         * @param bool $is_admin For admin use only?.
1054
-         */
1055
-        $lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1056
-        /**
1057
-         * Filter the default longitude.
1058
-         *
1059
-         * @since 1.0.0
1060
-         *
1061
-         * @param float $lat Default longitude.
1062
-         * @param bool $is_admin For admin use only?.
1063
-         */
1064
-        $lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1065
-
1066
-        $locate_me = !empty($extra_fields['show_map']) && geodir_map_name() != 'none' ? true : false;
1067
-        $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068
-        ?>
973
+	$html_var = $cf['htmlvar_name'];
974
+
975
+	// Check if there is a custom field specific filter.
976
+	if(has_filter("geodir_custom_field_input_address_{$html_var}")){
977
+		/**
978
+		 * Filter the address html by individual custom field.
979
+		 *
980
+		 * @param string $html The html to filter.
981
+		 * @param array $cf The custom field array.
982
+		 * @since 1.6.6
983
+		 */
984
+		$html = apply_filters("geodir_custom_field_input_address_{$html_var}",$html,$cf);
985
+	}
986
+
987
+	// If no html then we run the standard output.
988
+	if(empty($html)) {
989
+
990
+		global $gd_session;
991
+		ob_start(); // Start  buffering;
992
+		$value = geodir_get_cf_value($cf);
993
+		$name = $cf['name'];
994
+		$type = $cf['type'];
995
+		$admin_desc = $cf['desc'];
996
+		$is_required = $cf['is_required'];
997
+		$required_msg = $cf['required_msg'];
998
+		$site_title = $cf['site_title'];
999
+		$is_admin = $cf['is_admin'];
1000
+		$extra_fields = stripslashes_deep(unserialize($cf['extra_fields']));
1001
+		$prefix = $name . '_';
1002
+
1003
+		($site_title != '') ? $address_title = $site_title : $address_title = geodir_ucwords($prefix . ' address');
1004
+		($extra_fields['zip_lable'] != '') ? $zip_title = $extra_fields['zip_lable'] : $zip_title = geodir_ucwords($prefix . ' zip/post code ');
1005
+		($extra_fields['map_lable'] != '') ? $map_title = $extra_fields['map_lable'] : $map_title = geodir_ucwords('set address on map');
1006
+		($extra_fields['mapview_lable'] != '') ? $mapview_title = $extra_fields['mapview_lable'] : $mapview_title = geodir_ucwords($prefix . ' mapview');
1007
+
1008
+		$address = '';
1009
+		$zip = '';
1010
+		$mapview = '';
1011
+		$mapzoom = '';
1012
+		$lat = '';
1013
+		$lng = '';
1014
+
1015
+		if (isset($_REQUEST['backandedit']) && $_REQUEST['backandedit'] && $gd_ses_listing = $gd_session->get('listing')) {
1016
+			$post = $gd_ses_listing;
1017
+			$address = $post[$prefix . 'address'];
1018
+			$zip = isset($post[$prefix . 'zip']) ? $post[$prefix . 'zip'] : '';
1019
+			$lat = isset($post[$prefix . 'latitude']) ? $post[$prefix . 'latitude'] : '';
1020
+			$lng = isset($post[$prefix . 'longitude']) ? $post[$prefix . 'longitude'] : '';
1021
+			$mapview = isset($post[$prefix . 'mapview']) ? $post[$prefix . 'mapview'] : '';
1022
+			$mapzoom = isset($post[$prefix . 'mapzoom']) ? $post[$prefix . 'mapzoom'] : '';
1023
+		} else if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '' && $post_info = geodir_get_post_info($_REQUEST['pid'])) {
1024
+			$post_info = (array)$post_info;
1025
+
1026
+			$address = $post_info[$prefix . 'address'];
1027
+			$zip = isset($post_info[$prefix . 'zip']) ? $post_info[$prefix . 'zip'] : '';
1028
+			$lat = isset($post_info[$prefix . 'latitude']) ? $post_info[$prefix . 'latitude'] : '';
1029
+			$lng = isset($post_info[$prefix . 'longitude']) ? $post_info[$prefix . 'longitude'] : '';
1030
+			$mapview = isset($post_info[$prefix . 'mapview']) ? $post_info[$prefix . 'mapview'] : '';
1031
+			$mapzoom = isset($post_info[$prefix . 'mapzoom']) ? $post_info[$prefix . 'mapzoom'] : '';
1032
+		}
1033
+
1034
+		$location = geodir_get_default_location();
1035
+		if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
+		if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
+		if (empty($country)) $country = isset($location->country) ? $location->country : '';
1038
+
1039
+		$lat_lng_blank = false;
1040
+		if (empty($lat) && empty($lng)) {
1041
+			$lat_lng_blank = true;
1042
+		}
1043
+
1044
+		if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
+		if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1046
+
1047
+		/**
1048
+		 * Filter the default latitude.
1049
+		 *
1050
+		 * @since 1.0.0
1051
+		 *
1052
+		 * @param float $lat Default latitude.
1053
+		 * @param bool $is_admin For admin use only?.
1054
+		 */
1055
+		$lat = apply_filters('geodir_default_latitude', $lat, $is_admin);
1056
+		/**
1057
+		 * Filter the default longitude.
1058
+		 *
1059
+		 * @since 1.0.0
1060
+		 *
1061
+		 * @param float $lat Default longitude.
1062
+		 * @param bool $is_admin For admin use only?.
1063
+		 */
1064
+		$lng = apply_filters('geodir_default_longitude', $lng, $is_admin);
1065
+
1066
+		$locate_me = !empty($extra_fields['show_map']) && geodir_map_name() != 'none' ? true : false;
1067
+		$locate_me_class = $locate_me ? ' gd-form-control' : '';
1068
+		?>
1069 1069
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070 1070
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071 1071
             <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
@@ -1084,17 +1084,17 @@  discard block
 block discarded – undo
1084 1084
         </div>
1085 1085
         
1086 1086
         <?php
1087
-        /**
1088
-         * Called after the address input on the add listings.
1089
-         *
1090
-         * This is used by the location manage to add further locations info etc.
1091
-         *
1092
-         * @since 1.0.0
1093
-         * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1094
-         */
1095
-        do_action('geodir_address_extra_listing_fields', $cf);
1096
-
1097
-        if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1087
+		/**
1088
+		 * Called after the address input on the add listings.
1089
+		 *
1090
+		 * This is used by the location manage to add further locations info etc.
1091
+		 *
1092
+		 * @since 1.0.0
1093
+		 * @param array $cf The array of setting for the custom field. {@see geodir_custom_field_save()}.
1094
+		 */
1095
+		do_action('geodir_address_extra_listing_fields', $cf);
1096
+
1097
+		if (isset($extra_fields['show_zip']) && $extra_fields['show_zip']) { ?>
1098 1098
 
1099 1099
             <div id="geodir_<?php echo $prefix . 'zip'; ?>_row"
1100 1100
                  class="<?php /*if($is_required) echo 'required_field';*/ ?> geodir_form_row clearfix gd-fieldset-details">
@@ -1115,22 +1115,22 @@  discard block
 block discarded – undo
1115 1115
 
1116 1116
             <div id="geodir_<?php echo $prefix . 'map'; ?>_row" class="geodir_form_row clearfix gd-fieldset-details">
1117 1117
                 <?php
1118
-                /**
1119
-                 * Contains add listing page map functions.
1120
-                 *
1121
-                 * @since 1.0.0
1122
-                 */
1123
-                include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1124
-                if ($lat_lng_blank) {
1125
-                    $lat = '';
1126
-                    $lng = '';
1127
-                }
1128
-                ?>
1118
+				/**
1119
+				 * Contains add listing page map functions.
1120
+				 *
1121
+				 * @since 1.0.0
1122
+				 */
1123
+				include(geodir_plugin_path() . "/geodirectory-functions/map-functions/map_on_add_listing_page.php");
1124
+				if ($lat_lng_blank) {
1125
+					$lat = '';
1126
+					$lng = '';
1127
+				}
1128
+				?>
1129 1129
                 <span class="geodir_message_note"><?php echo stripslashes(GET_MAP_MSG); ?></span>
1130 1130
             </div>
1131 1131
             <?php
1132
-            /* show lat lng */
1133
-            $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1132
+			/* show lat lng */
1133
+			$style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134 1134
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1135 1135
                  class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1136
                 <label>
@@ -1171,27 +1171,27 @@  discard block
 block discarded – undo
1171 1171
                                                             class="gd-checkbox"
1172 1172
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1173 1173
                                                             id="<?php echo $prefix . 'mapview'; ?>" <?php if ($mapview == 'ROADMAP' || $mapview == '') {
1174
-                            echo 'checked="checked"';
1175
-                        } ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1174
+							echo 'checked="checked"';
1175
+						} ?>  value="ROADMAP" size="25"/> <?php _e('Default Map', 'geodirectory'); ?></span>
1176 1176
                     <span class="geodir_user_define"> <input field_type="<?php echo $type; ?>" type="radio"
1177 1177
                                                              class="gd-checkbox"
1178 1178
                                                              name="<?php echo $prefix . 'mapview'; ?>"
1179 1179
                                                              id="map_view1" <?php if ($mapview == 'SATELLITE') {
1180
-                            echo 'checked="checked"';
1181
-                        } ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1180
+							echo 'checked="checked"';
1181
+						} ?> value="SATELLITE" size="25"/> <?php _e('Satellite Map', 'geodirectory'); ?></span>
1182 1182
 
1183 1183
                     <span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1184 1184
                                                             class="gd-checkbox"
1185 1185
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1186 1186
                                                             id="map_view2" <?php if ($mapview == 'HYBRID') {
1187
-                            echo 'checked="checked"';
1188
-                        } ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1187
+							echo 'checked="checked"';
1188
+						} ?>  value="HYBRID" size="25"/> <?php _e('Hybrid Map', 'geodirectory'); ?></span>
1189 1189
 					<span class="geodir_user_define"><input field_type="<?php echo $type; ?>" type="radio"
1190 1190
                                                             class="gd-checkbox"
1191 1191
                                                             name="<?php echo $prefix . 'mapview'; ?>"
1192 1192
                                                             id="map_view3" <?php if ($mapview == 'TERRAIN') {
1193
-                            echo 'checked="checked"';
1194
-                        } ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1193
+							echo 'checked="checked"';
1194
+						} ?>  value="TERRAIN" size="25"/> <?php _e('Terrain Map', 'geodirectory'); ?></span>
1195 1195
 
1196 1196
 
1197 1197
             </div>
@@ -1199,14 +1199,14 @@  discard block
 block discarded – undo
1199 1199
 
1200 1200
         <?php if (isset($extra_fields['show_mapzoom']) && $extra_fields['show_mapzoom']) { ?>
1201 1201
             <input type="hidden" value="<?php if (isset($mapzoom)) {
1202
-                echo esc_attr($mapzoom);
1203
-            } ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1202
+				echo esc_attr($mapzoom);
1203
+			} ?>" name="<?php echo $prefix . 'mapzoom'; ?>" id="<?php echo $prefix . 'mapzoom'; ?>"/>
1204 1204
         <?php }
1205 1205
 
1206
-        $html = ob_get_clean();
1207
-    }
1206
+		$html = ob_get_clean();
1207
+	}
1208 1208
 
1209
-    return $html;
1209
+	return $html;
1210 1210
 }
1211 1211
 add_filter('geodir_custom_field_input_address','geodir_cfi_address',10,2);
1212 1212
 
@@ -1223,135 +1223,135 @@  discard block
 block discarded – undo
1223 1223
  */
1224 1224
 function geodir_cfi_taxonomy($html,$cf){
1225 1225
 
1226
-    $html_var = $cf['htmlvar_name'];
1227
-
1228
-    // Check if there is a custom field specific filter.
1229
-    if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1230
-        /**
1231
-         * Filter the taxonomy html by individual custom field.
1232
-         *
1233
-         * @param string $html The html to filter.
1234
-         * @param array $cf The custom field array.
1235
-         * @since 1.6.6
1236
-         */
1237
-        $html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1238
-    }
1239
-
1240
-    // If no html then we run the standard output.
1241
-    if(empty($html)) {
1242
-
1243
-        ob_start(); // Start  buffering;
1244
-        $value = geodir_get_cf_value($cf);
1245
-
1246
-        $name = $cf['name'];
1247
-        $site_title = $cf['site_title'];
1248
-        $admin_desc = $cf['desc'];
1249
-        $is_required = $cf['is_required'];
1250
-        $is_admin = $cf['is_admin'];
1251
-        $required_msg = $cf['required_msg'];
1252
-
1253
-        if ($value == $cf['default']) {
1254
-            $value = '';
1255
-        } ?>
1226
+	$html_var = $cf['htmlvar_name'];
1227
+
1228
+	// Check if there is a custom field specific filter.
1229
+	if(has_filter("geodir_custom_field_input_taxonomy_{$html_var}")){
1230
+		/**
1231
+		 * Filter the taxonomy html by individual custom field.
1232
+		 *
1233
+		 * @param string $html The html to filter.
1234
+		 * @param array $cf The custom field array.
1235
+		 * @since 1.6.6
1236
+		 */
1237
+		$html = apply_filters("geodir_custom_field_input_taxonomy_{$html_var}",$html,$cf);
1238
+	}
1239
+
1240
+	// If no html then we run the standard output.
1241
+	if(empty($html)) {
1242
+
1243
+		ob_start(); // Start  buffering;
1244
+		$value = geodir_get_cf_value($cf);
1245
+
1246
+		$name = $cf['name'];
1247
+		$site_title = $cf['site_title'];
1248
+		$admin_desc = $cf['desc'];
1249
+		$is_required = $cf['is_required'];
1250
+		$is_admin = $cf['is_admin'];
1251
+		$required_msg = $cf['required_msg'];
1252
+
1253
+		if ($value == $cf['default']) {
1254
+			$value = '';
1255
+		} ?>
1256 1256
         <div id="<?php echo $name;?>_row"
1257 1257
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1258 1258
             <label>
1259 1259
                 <?php $site_title = __($site_title, 'geodirectory');
1260
-                echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1260
+				echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261 1261
                 <?php if ($is_required) echo '<span>*</span>';?>
1262 1262
             </label>
1263 1263
 
1264 1264
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
1265 1265
                 <?php
1266
-                global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1266
+				global $wpdb, $post, $cat_display, $post_cat, $package_id, $exclude_cats;
1267 1267
 
1268
-                $exclude_cats = array();
1268
+				$exclude_cats = array();
1269 1269
 
1270
-                if ($is_admin == '1') {
1270
+				if ($is_admin == '1') {
1271 1271
 
1272
-                    $post_type = get_post_type();
1272
+					$post_type = get_post_type();
1273 1273
 
1274
-                    $package_info = array();
1274
+					$package_info = array();
1275 1275
 
1276
-                    $package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1276
+					$package_info = (array)geodir_post_package_info($package_info, $post, $post_type);
1277 1277
 
1278
-                    if (!empty($package_info)) {
1278
+					if (!empty($package_info)) {
1279 1279
 
1280
-                        if (isset($package_info['cat']) && $package_info['cat'] != '') {
1280
+						if (isset($package_info['cat']) && $package_info['cat'] != '') {
1281 1281
 
1282
-                            $exclude_cats = explode(',', $package_info['cat']);
1282
+							$exclude_cats = explode(',', $package_info['cat']);
1283 1283
 
1284
-                        }
1285
-                    }
1286
-                }
1284
+						}
1285
+					}
1286
+				}
1287 1287
 
1288
-                $cat_display = unserialize($cf['extra_fields']);
1288
+				$cat_display = unserialize($cf['extra_fields']);
1289 1289
 
1290
-                if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291
-                    $post_cat = implode(",", $post_cat[$name]);
1292
-                } else {
1293
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1295
-                }
1290
+				if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291
+					$post_cat = implode(",", $post_cat[$name]);
1292
+				} else {
1293
+					if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
+						$post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1295
+				}
1296 1296
 
1297 1297
 
1298
-                global $geodir_addon_list;
1299
-                if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1298
+				global $geodir_addon_list;
1299
+				if (!empty($geodir_addon_list) && array_key_exists('geodir_payment_manager', $geodir_addon_list) && $geodir_addon_list['geodir_payment_manager'] == 'yes') {
1300 1300
 
1301
-                    $catadd_limit = $wpdb->get_var(
1302
-                        $wpdb->prepare(
1303
-                            "SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1304
-                            array($package_id)
1305
-                        )
1306
-                    );
1301
+					$catadd_limit = $wpdb->get_var(
1302
+						$wpdb->prepare(
1303
+							"SELECT cat_limit FROM " . GEODIR_PRICE_TABLE . " WHERE pid = %d",
1304
+							array($package_id)
1305
+						)
1306
+					);
1307 1307
 
1308 1308
 
1309
-                } else {
1310
-                    $catadd_limit = 0;
1311
-                }
1309
+				} else {
1310
+					$catadd_limit = 0;
1311
+				}
1312 1312
 
1313 1313
 
1314
-                if ($cat_display != '' && $cat_display != 'ajax_chained') {
1314
+				if ($cat_display != '' && $cat_display != 'ajax_chained') {
1315 1315
 
1316
-                    $required_limit_msg = '';
1317
-                    if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1316
+					$required_limit_msg = '';
1317
+					if ($catadd_limit > 0 && $cat_display != 'select' && $cat_display != 'radio') {
1318 1318
 
1319
-                        $required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1319
+						$required_limit_msg = __('Only select', 'geodirectory') . ' ' . $catadd_limit . __(' categories for this package.', 'geodirectory');
1320 1320
 
1321
-                    } else {
1322
-                        $required_limit_msg = $required_msg;
1323
-                    }
1321
+					} else {
1322
+						$required_limit_msg = $required_msg;
1323
+					}
1324 1324
 
1325
-                    echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1325
+					echo '<input type="hidden" cat_limit="' . $catadd_limit . '" id="cat_limit" value="' . esc_attr($required_limit_msg) . '" name="cat_limit[' . $name . ']"  />';
1326 1326
 
1327 1327
 
1328
-                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1328
+					if ($cat_display == 'select' || $cat_display == 'multiselect') {
1329 1329
 
1330
-                        $cat_display == '';
1331
-                        $multiple = '';
1332
-                        if ($cat_display == 'multiselect')
1333
-                            $multiple = 'multiple="multiple"';
1330
+						$cat_display == '';
1331
+						$multiple = '';
1332
+						if ($cat_display == 'multiselect')
1333
+							$multiple = 'multiple="multiple"';
1334 1334
 
1335
-                        echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1335
+						echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1336 1336
 
1337 1337
 
1338
-                        if ($cat_display == 'select')
1339
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1338
+						if ($cat_display == 'select')
1339
+							echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1340 1340
 
1341
-                    }
1341
+					}
1342 1342
 
1343
-                    echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1343
+					echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1344 1344
 
1345
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
-                        echo '</select>';
1345
+					if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
+						echo '</select>';
1347 1347
 
1348
-                } else {
1348
+				} else {
1349 1349
 
1350
-                    echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1350
+					echo geodir_custom_taxonomy_walker2($name, $catadd_limit);
1351 1351
 
1352
-                }
1352
+				}
1353 1353
 
1354
-                ?>
1354
+				?>
1355 1355
             </div>
1356 1356
 
1357 1357
             <span class="geodir_message_note"><?php _e($admin_desc, 'geodirectory');?></span>
@@ -1361,10 +1361,10 @@  discard block
 block discarded – undo
1361 1361
         </div>
1362 1362
 
1363 1363
         <?php
1364
-        $html = ob_get_clean();
1365
-    }
1364
+		$html = ob_get_clean();
1365
+	}
1366 1366
 
1367
-    return $html;
1367
+	return $html;
1368 1368
 }
1369 1369
 add_filter('geodir_custom_field_input_taxonomy','geodir_cfi_taxonomy',10,2);
1370 1370
 
@@ -1380,74 +1380,74 @@  discard block
 block discarded – undo
1380 1380
  */
1381 1381
 function geodir_cfi_file($html,$cf){
1382 1382
 
1383
-    $html_var = $cf['htmlvar_name'];
1383
+	$html_var = $cf['htmlvar_name'];
1384 1384
 
1385
-    // Check if there is a custom field specific filter.
1386
-    if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1387
-        /**
1388
-         * Filter the file html by individual custom field.
1389
-         *
1390
-         * @param string $html The html to filter.
1391
-         * @param array $cf The custom field array.
1392
-         * @since 1.6.6
1393
-         */
1394
-        $html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1395
-    }
1385
+	// Check if there is a custom field specific filter.
1386
+	if(has_filter("geodir_custom_field_input_file_{$html_var}")){
1387
+		/**
1388
+		 * Filter the file html by individual custom field.
1389
+		 *
1390
+		 * @param string $html The html to filter.
1391
+		 * @param array $cf The custom field array.
1392
+		 * @since 1.6.6
1393
+		 */
1394
+		$html = apply_filters("geodir_custom_field_input_file_{$html_var}",$html,$cf);
1395
+	}
1396 1396
 
1397
-    // If no html then we run the standard output.
1398
-    if(empty($html)) {
1397
+	// If no html then we run the standard output.
1398
+	if(empty($html)) {
1399 1399
 
1400
-        ob_start(); // Start  buffering;
1401
-        $value = geodir_get_cf_value($cf);
1400
+		ob_start(); // Start  buffering;
1401
+		$value = geodir_get_cf_value($cf);
1402 1402
 
1403
-        $name = $cf['name'];
1404
-        $site_title = $cf['site_title'];
1405
-        $admin_desc = $cf['desc'];
1406
-        $is_required = $cf['is_required'];
1407
-        $required_msg = $cf['required_msg'];
1408
-        $extra_fields = unserialize($cf['extra_fields']);
1403
+		$name = $cf['name'];
1404
+		$site_title = $cf['site_title'];
1405
+		$admin_desc = $cf['desc'];
1406
+		$is_required = $cf['is_required'];
1407
+		$required_msg = $cf['required_msg'];
1408
+		$extra_fields = unserialize($cf['extra_fields']);
1409 1409
 
1410 1410
 
1411
-        // adjust values here
1412
-        $file_id = $name; // 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
1411
+		// adjust values here
1412
+		$file_id = $name; // 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
1413 1413
 
1414
-        if ($value != '') {
1414
+		if ($value != '') {
1415 1415
 
1416
-            $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1416
+			$file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1417 1417
 
1418
-        } else
1419
-            $file_value = '';
1418
+		} else
1419
+			$file_value = '';
1420 1420
 
1421
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
-            $file_multiple = true; // allow multiple files upload
1423
-        else
1424
-            $file_multiple = false;
1421
+		if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
+			$file_multiple = true; // allow multiple files upload
1423
+		else
1424
+			$file_multiple = false;
1425 1425
 
1426
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
-            $file_image_limit = $extra_fields['image_limit'];
1428
-        else
1429
-            $file_image_limit = 1;
1426
+		if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
+			$file_image_limit = $extra_fields['image_limit'];
1428
+		else
1429
+			$file_image_limit = 1;
1430 1430
 
1431
-        $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1431
+		$file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1432 1432
 
1433
-        $file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1433
+		$file_height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
1434 1434
 
1435
-        if (!empty($file_value)) {
1436
-            $curImages = explode(',', $file_value);
1437
-            if (!empty($curImages))
1438
-                $file_totImg = count($curImages);
1439
-        }
1435
+		if (!empty($file_value)) {
1436
+			$curImages = explode(',', $file_value);
1437
+			if (!empty($curImages))
1438
+				$file_totImg = count($curImages);
1439
+		}
1440 1440
 
1441
-        $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1442
-        $display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1441
+		$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
1442
+		$display_file_types = $allowed_file_types != '' ? '.' . implode(", .", $extra_fields['gd_file_types']) : '';
1443 1443
 
1444
-        ?>
1444
+		?>
1445 1445
         <?php /*?> <h5 class="geodir-form_title"> <?php echo $site_title; ?>
1446 1446
 				 <?php if($file_image_limit!=0 && $file_image_limit==1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('image with this package').')</small>';} ?>
1447 1447
 				 <?php if($file_image_limit!=0 && $file_image_limit>1 ){echo '<br /><small>('.__('You can upload').' '.$file_image_limit.' '.__('images with this package').')</small>';} ?>
1448 1448
 				 <?php if($file_image_limit==0){echo '<br /><small>('.__('You can upload unlimited images with this package').')</small>';} ?>
1449 1449
 			</h5>   <?php */
1450
-        ?>
1450
+		?>
1451 1451
 
1452 1452
         <div id="<?php echo $name;?>_row"
1453 1453
              class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1456 1456
                 <label
1457 1457
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1458
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1458
+					echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1459 1459
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1460 1460
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1461 1461
                        value="<?php echo esc_attr($file_value); ?>"/>
@@ -1467,17 +1467,17 @@  discard block
 block discarded – undo
1467 1467
                 <?php } ?>
1468 1468
                 <input type="hidden" name="<?php echo $file_id; ?>totImg" id="<?php echo $file_id; ?>totImg"
1469 1469
                        value="<?php if (isset($file_totImg)) {
1470
-                           echo esc_attr($file_totImg);
1471
-                       } else {
1472
-                           echo '0';
1473
-                       } ?>"/>
1470
+						   echo esc_attr($file_totImg);
1471
+					   } else {
1472
+						   echo '0';
1473
+					   } ?>"/>
1474 1474
 
1475 1475
                 <div style="float:left; width:55%;">
1476 1476
                     <div
1477 1477
                         class="plupload-upload-uic hide-if-no-js <?php if ($file_multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
1478 1478
                         id="<?php echo $file_id; ?>plupload-upload-ui" style="float:left; width:30%;">
1479 1479
                         <?php /*?><h4><?php _e('Drop files to upload');?></h4><br/><?php */
1480
-                        ?>
1480
+						?>
1481 1481
                         <input id="<?php echo $file_id; ?>plupload-browse-button" type="button"
1482 1482
                                value="<?php ($file_image_limit > 1 ? esc_attr_e('Select Files', 'geodirectory') : esc_attr_e('Select File', 'geodirectory') ); ?>"
1483 1483
                                class="geodir_button" style="margin-top:10px;"/>
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
                         style=" clear:inherit; margin-top:0; margin-left:15px; padding-top:10px; float:left; width:50%;">
1497 1497
                     </div>
1498 1498
                     <?php /*?><span id="upload-msg" ><?php _e('Please drag &amp; drop the images to rearrange the order');?></span><?php */
1499
-                    ?>
1499
+					?>
1500 1500
 
1501 1501
                     <span id="<?php echo $file_id; ?>upload-error" style="display:none"></span>
1502 1502
 
@@ -1510,9 +1510,9 @@  discard block
 block discarded – undo
1510 1510
 
1511 1511
 
1512 1512
         <?php
1513
-        $html = ob_get_clean();
1514
-    }
1513
+		$html = ob_get_clean();
1514
+	}
1515 1515
 
1516
-    return $html;
1516
+	return $html;
1517 1517
 }
1518 1518
 add_filter('geodir_custom_field_input_file','geodir_cfi_file',10,2);
1519 1519
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +191 added lines, -68 removed lines patch added patch discarded remove patch
@@ -86,26 +86,31 @@  discard block
 block discarded – undo
86 86
         $value = geodir_get_cf_value($cf);
87 87
         $type = $cf['type'];
88 88
         //number and float validation $validation_pattern
89
-        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';}
90
-        elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
89
+        if(isset($cf['data_type']) && $cf['data_type']=='INT'){$type = 'number';} elseif(isset($cf['data_type']) && $cf['data_type']=='FLOAT'){$type = 'float';}
91 90
 
92 91
         //validation
93 92
         if(isset($cf['validation_pattern']) && $cf['validation_pattern']){
94 93
             $validation = 'pattern="'.$cf['validation_pattern'].'"';
95
-        }else{$validation='';}
94
+        } else{$validation='';}
96 95
 
97 96
         // validation message
98 97
         if(isset($cf['validation_msg']) && $cf['validation_msg']){
99 98
             $validation_msg = 'title="'.$cf['validation_msg'].'"';
100
-        }else{$validation_msg='';}
99
+        } else{$validation_msg='';}
101 100
         ?>
102 101
 
103 102
         <div id="<?php echo $cf['name'];?>_row"
104
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
103
+             class="<?php if ($cf['is_required']) {
104
+	echo 'required_field';
105
+}
106
+?> geodir_form_row clearfix gd-fieldset-details">
105 107
             <label>
106 108
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
107 109
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
108
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
110
+                <?php if ($cf['is_required']) {
111
+	echo '<span>*</span>';
112
+}
113
+?>
109 114
             </label>
110 115
             <input field_type="<?php echo $type;?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
111 116
                    value="<?php echo esc_attr(stripslashes($value));?>" type="<?php echo $type;?>" class="geodir_textfield" <?php echo $validation;echo $validation_msg;?> />
@@ -160,11 +165,17 @@  discard block
 block discarded – undo
160 165
         }?>
161 166
 
162 167
         <div id="<?php echo $cf['name'];?>_row"
163
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
168
+             class="<?php if ($cf['is_required']) {
169
+	echo 'required_field';
170
+}
171
+?> geodir_form_row clearfix gd-fieldset-details">
164 172
             <label>
165 173
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
166 174
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
167
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
175
+                <?php if ($cf['is_required']) {
176
+	echo '<span>*</span>';
177
+}
178
+?>
168 179
             </label>
169 180
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
170 181
                    value="<?php echo esc_attr(stripslashes($value));?>" type="email" class="geodir_textfield"/>
@@ -220,11 +231,17 @@  discard block
 block discarded – undo
220 231
         }?>
221 232
 
222 233
         <div id="<?php echo $cf['name'];?>_row"
223
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
234
+             class="<?php if ($cf['is_required']) {
235
+	echo 'required_field';
236
+}
237
+?> geodir_form_row clearfix gd-fieldset-details">
224 238
             <label>
225 239
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
226 240
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
227
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
241
+                <?php if ($cf['is_required']) {
242
+	echo '<span>*</span>';
243
+}
244
+?>
228 245
             </label>
229 246
             <input field_type="<?php echo $cf['type'];?>" name="<?php  echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
230 247
                    value="<?php echo esc_attr(stripslashes($value));?>" type="tel" class="geodir_textfield"/>
@@ -280,11 +297,17 @@  discard block
 block discarded – undo
280 297
         }?>
281 298
 
282 299
         <div id="<?php echo $cf['name'];?>_row"
283
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
300
+             class="<?php if ($cf['is_required']) {
301
+	echo 'required_field';
302
+}
303
+?> geodir_form_row clearfix gd-fieldset-details">
284 304
             <label>
285 305
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
286 306
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
287
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
307
+                <?php if ($cf['is_required']) {
308
+	echo '<span>*</span>';
309
+}
310
+?>
288 311
             </label>
289 312
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $cf['name'];?>" id="<?php echo $cf['name'];?>"
290 313
                    value="<?php echo esc_attr(stripslashes($value));?>" type="url" class="geodir_textfield"
@@ -339,11 +362,17 @@  discard block
 block discarded – undo
339 362
 
340 363
         ?>
341 364
         <div id="<?php echo $cf['name'];?>_row"
342
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
365
+             class="<?php if ($cf['is_required']) {
366
+	echo 'required_field';
367
+}
368
+?> geodir_form_row clearfix gd-fieldset-details">
343 369
             <label>
344 370
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
345 371
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
346
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
372
+                <?php if ($cf['is_required']) {
373
+	echo '<span>*</span>';
374
+}
375
+?>
347 376
             </label>
348 377
             <?php if ($cf['option_values']) {
349 378
                 $option_values = geodir_string_values_to_options($cf['option_values'], true);
@@ -412,11 +441,17 @@  discard block
 block discarded – undo
412 441
         ?>
413 442
 
414 443
         <div id="<?php echo $cf['name'];?>_row"
415
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
444
+             class="<?php if ($cf['is_required']) {
445
+	echo 'required_field';
446
+}
447
+?> geodir_form_row clearfix gd-fieldset-details">
416 448
             <label>
417 449
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
418 450
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
419
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
451
+                <?php if ($cf['is_required']) {
452
+	echo '<span>*</span>';
453
+}
454
+?>
420 455
             </label>
421 456
             <?php if ($value != '1') {
422 457
                 $value = '0';
@@ -476,11 +511,17 @@  discard block
 block discarded – undo
476 511
         ?>
477 512
 
478 513
         <div id="<?php echo $cf['name'];?>_row"
479
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
514
+             class="<?php if ($cf['is_required']) {
515
+	echo 'required_field';
516
+}
517
+?> geodir_form_row clearfix gd-fieldset-details">
480 518
             <label>
481 519
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
482 520
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
483
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
521
+                <?php if ($cf['is_required']) {
522
+	echo '<span>*</span>';
523
+}
524
+?>
484 525
             </label><?php
485 526
 
486 527
 
@@ -548,11 +589,17 @@  discard block
 block discarded – undo
548 589
 
549 590
         ?>
550 591
         <div id="<?php echo $cf['name'];?>_row"
551
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
592
+             class="<?php if ($cf['is_required']) {
593
+	echo 'required_field';
594
+}
595
+?> geodir_form_row geodir_custom_fields clearfix gd-fieldset-details">
552 596
             <label>
553 597
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
554 598
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
555
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
599
+                <?php if ($cf['is_required']) {
600
+	echo '<span>*</span>';
601
+}
602
+?>
556 603
             </label>
557 604
             <?php
558 605
             $option_values_arr = geodir_string_values_to_options($cf['option_values'], true);
@@ -629,11 +676,17 @@  discard block
 block discarded – undo
629 676
         }
630 677
         ?>
631 678
         <div id="<?php echo $cf['name']; ?>_row"
632
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
679
+             class="<?php if ($cf['is_required']) {
680
+	echo 'required_field';
681
+}
682
+?> geodir_form_row clearfix gd-fieldset-details">
633 683
             <label>
634 684
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
635 685
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
636
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
686
+                <?php if ($cf['is_required']) {
687
+	echo '<span>*</span>';
688
+}
689
+?>
637 690
             </label>
638 691
             <input type="hidden" name="gd_field_<?php echo $cf['name']; ?>" value="1"/>
639 692
             <?php if ($multi_display == 'select') { ?>
@@ -748,11 +801,17 @@  discard block
 block discarded – undo
748 801
         ?>
749 802
 
750 803
         <div id="<?php echo $cf['name']; ?>_row"
751
-             class="<?php if ($cf['is_required']) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details">
804
+             class="<?php if ($cf['is_required']) {
805
+	echo 'required_field';
806
+}
807
+?> geodir_form_row clearfix gd-fieldset-details">
752 808
             <label>
753 809
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
754 810
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
755
-                <?php if ($cf['is_required']) echo '<span>*</span>'; ?>
811
+                <?php if ($cf['is_required']) {
812
+	echo '<span>*</span>';
813
+}
814
+?>
756 815
             </label>
757 816
 
758 817
             <?php $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?>
@@ -812,8 +871,9 @@  discard block
 block discarded – undo
812 871
         $extra_fields = unserialize($cf['extra_fields']);
813 872
         $name = $cf['name'];
814 873
 
815
-        if ($extra_fields['date_format'] == '')
816
-            $extra_fields['date_format'] = 'yy-mm-dd';
874
+        if ($extra_fields['date_format'] == '') {
875
+                    $extra_fields['date_format'] = 'yy-mm-dd';
876
+        }
817 877
 
818 878
         $date_format = $extra_fields['date_format'];
819 879
         $jquery_date_format  = $date_format;
@@ -827,7 +887,7 @@  discard block
 block discarded – undo
827 887
             $replace = array('d','j','l','m','n','F','Y');//PHP date format
828 888
 
829 889
             $date_format = str_replace($search, $replace, $date_format);
830
-        }else{
890
+        } else{
831 891
             $jquery_date_format = geodir_date_format_php_to_jqueryui( $jquery_date_format );
832 892
         }
833 893
 
@@ -862,12 +922,18 @@  discard block
 block discarded – undo
862 922
 
863 923
         </script>
864 924
         <div id="<?php echo $name;?>_row"
865
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
925
+             class="<?php if ($cf['is_required']) {
926
+	echo 'required_field';
927
+}
928
+?> geodir_form_row clearfix gd-fieldset-details">
866 929
             <label>
867 930
 
868 931
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
869 932
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
870
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
933
+                <?php if ($cf['is_required']) {
934
+	echo '<span>*</span>';
935
+}
936
+?>
871 937
             </label>
872 938
 
873 939
             <input field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>" id="<?php echo $name;?>"
@@ -921,8 +987,9 @@  discard block
 block discarded – undo
921 987
 
922 988
         $name = $cf['name'];
923 989
 
924
-        if ($value != '')
925
-            $value = date('H:i', strtotime($value));
990
+        if ($value != '') {
991
+                    $value = date('H:i', strtotime($value));
992
+        }
926 993
         ?>
927 994
         <script type="text/javascript">
928 995
             jQuery(document).ready(function () {
@@ -935,12 +1002,18 @@  discard block
 block discarded – undo
935 1002
             });
936 1003
         </script>
937 1004
         <div id="<?php echo $name;?>_row"
938
-             class="<?php if ($cf['is_required']) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1005
+             class="<?php if ($cf['is_required']) {
1006
+	echo 'required_field';
1007
+}
1008
+?> geodir_form_row clearfix gd-fieldset-details">
939 1009
             <label>
940 1010
 
941 1011
                 <?php $site_title = __($cf['site_title'], 'geodirectory');
942 1012
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
943
-                <?php if ($cf['is_required']) echo '<span>*</span>';?>
1013
+                <?php if ($cf['is_required']) {
1014
+	echo '<span>*</span>';
1015
+}
1016
+?>
944 1017
             </label>
945 1018
             <input readonly="readonly" field_type="<?php echo $cf['type'];?>" name="<?php echo $name;?>"
946 1019
                    id="<?php echo $name;?>" value="<?php echo esc_attr($value);?>" type="text" class="geodir_textfield"/>
@@ -1032,17 +1105,27 @@  discard block
 block discarded – undo
1032 1105
         }
1033 1106
 
1034 1107
         $location = geodir_get_default_location();
1035
-        if (empty($city)) $city = isset($location->city) ? $location->city : '';
1036
-        if (empty($region)) $region = isset($location->region) ? $location->region : '';
1037
-        if (empty($country)) $country = isset($location->country) ? $location->country : '';
1108
+        if (empty($city)) {
1109
+        	$city = isset($location->city) ? $location->city : '';
1110
+        }
1111
+        if (empty($region)) {
1112
+        	$region = isset($location->region) ? $location->region : '';
1113
+        }
1114
+        if (empty($country)) {
1115
+        	$country = isset($location->country) ? $location->country : '';
1116
+        }
1038 1117
 
1039 1118
         $lat_lng_blank = false;
1040 1119
         if (empty($lat) && empty($lng)) {
1041 1120
             $lat_lng_blank = true;
1042 1121
         }
1043 1122
 
1044
-        if (empty($lat)) $lat = isset($location->city_latitude) ? $location->city_latitude : '';
1045
-        if (empty($lng)) $lng = isset($location->city_longitude) ? $location->city_longitude : '';
1123
+        if (empty($lat)) {
1124
+        	$lat = isset($location->city_latitude) ? $location->city_latitude : '';
1125
+        }
1126
+        if (empty($lng)) {
1127
+        	$lng = isset($location->city_longitude) ? $location->city_longitude : '';
1128
+        }
1046 1129
 
1047 1130
         /**
1048 1131
          * Filter the default latitude.
@@ -1067,8 +1150,14 @@  discard block
 block discarded – undo
1067 1150
         $locate_me_class = $locate_me ? ' gd-form-control' : '';
1068 1151
         ?>
1069 1152
         <div id="geodir_<?php echo $prefix . 'address';?>_row"
1070
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1071
-            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) echo '<span>*</span>';?></label>
1153
+             class="<?php if ($is_required) {
1154
+	echo 'required_field';
1155
+}
1156
+?> geodir_form_row clearfix gd-fieldset-details">
1157
+            <label><?php _e($address_title, 'geodirectory'); ?> <?php if ($is_required) {
1158
+	echo '<span>*</span>';
1159
+}
1160
+?></label>
1072 1161
             <?php if ($locate_me) { ?>
1073 1162
             <div class="gd-input-group gd-locate-me">
1074 1163
             <?php } ?>
@@ -1132,10 +1221,16 @@  discard block
 block discarded – undo
1132 1221
             /* show lat lng */
1133 1222
             $style_latlng = ((isset($extra_fields['show_latlng']) && $extra_fields['show_latlng']) || is_admin()) ? '' : 'style="display:none"'; ?>
1134 1223
             <div id="geodir_<?php echo $prefix . 'latitude'; ?>_row"
1135
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1224
+                 class="<?php if ($is_required) {
1225
+	echo 'required_field';
1226
+}
1227
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1136 1228
                 <label>
1137 1229
                     <?php echo PLACE_ADDRESS_LAT; ?>
1138
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1230
+                    <?php if ($is_required) {
1231
+	echo '<span>*</span>';
1232
+}
1233
+?>
1139 1234
                 </label>
1140 1235
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'latitude'; ?>"
1141 1236
                        id="<?php echo $prefix . 'latitude'; ?>" class="geodir_textfield"
@@ -1147,10 +1242,16 @@  discard block
 block discarded – undo
1147 1242
             </div>
1148 1243
 
1149 1244
             <div id="geodir_<?php echo $prefix . 'longitude'; ?>_row"
1150
-                 class="<?php if ($is_required) echo 'required_field'; ?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1245
+                 class="<?php if ($is_required) {
1246
+	echo 'required_field';
1247
+}
1248
+?> geodir_form_row clearfix gd-fieldset-details" <?php echo $style_latlng; ?>>
1151 1249
                 <label>
1152 1250
                     <?php echo PLACE_ADDRESS_LNG; ?>
1153
-                    <?php if ($is_required) echo '<span>*</span>'; ?>
1251
+                    <?php if ($is_required) {
1252
+	echo '<span>*</span>';
1253
+}
1254
+?>
1154 1255
                 </label>
1155 1256
                 <input type="text" field_type="<?php echo $type; ?>" name="<?php echo $prefix . 'longitude'; ?>"
1156 1257
                        id="<?php echo $prefix . 'longitude'; ?>" class="geodir_textfield"
@@ -1254,11 +1355,17 @@  discard block
 block discarded – undo
1254 1355
             $value = '';
1255 1356
         } ?>
1256 1357
         <div id="<?php echo $name;?>_row"
1257
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1358
+             class="<?php if ($is_required) {
1359
+	echo 'required_field';
1360
+}
1361
+?> geodir_form_row clearfix gd-fieldset-details">
1258 1362
             <label>
1259 1363
                 <?php $site_title = __($site_title, 'geodirectory');
1260 1364
                 echo (trim($site_title)) ? $site_title : '&nbsp;'; ?>
1261
-                <?php if ($is_required) echo '<span>*</span>';?>
1365
+                <?php if ($is_required) {
1366
+	echo '<span>*</span>';
1367
+}
1368
+?>
1262 1369
             </label>
1263 1370
 
1264 1371
             <div id="<?php echo $name;?>" class="geodir_taxonomy_field" style="float:left; width:70%;">
@@ -1290,8 +1397,9 @@  discard block
 block discarded – undo
1290 1397
                 if (isset($_REQUEST['backandedit']) && !empty($post_cat[$name]) && is_array($post_cat[$name])) {
1291 1398
                     $post_cat = implode(",", $post_cat[$name]);
1292 1399
                 } else {
1293
-                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
1294
-                        $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1400
+                    if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
1401
+                                            $post_cat = geodir_get_post_meta($_REQUEST['pid'], $name, true);
1402
+                    }
1295 1403
                 }
1296 1404
 
1297 1405
 
@@ -1329,21 +1437,24 @@  discard block
 block discarded – undo
1329 1437
 
1330 1438
                         $cat_display == '';
1331 1439
                         $multiple = '';
1332
-                        if ($cat_display == 'multiselect')
1333
-                            $multiple = 'multiple="multiple"';
1440
+                        if ($cat_display == 'multiselect') {
1441
+                                                    $multiple = 'multiple="multiple"';
1442
+                        }
1334 1443
 
1335 1444
                         echo '<select id="' . $name . '" ' . $multiple . ' type="' . $name . '" name="post_category[' . $name . '][]" alt="' . $name . '" field_type="' . $cat_display . '" class="geodir_textfield textfield_x chosen_select" data-placeholder="' . __('Select Category', 'geodirectory') . '">';
1336 1445
 
1337 1446
 
1338
-                        if ($cat_display == 'select')
1339
-                            echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1447
+                        if ($cat_display == 'select') {
1448
+                                                    echo '<option value="">' . __('Select Category', 'geodirectory') . '</option>';
1449
+                        }
1340 1450
 
1341 1451
                     }
1342 1452
 
1343 1453
                     echo geodir_custom_taxonomy_walker($name, $catadd_limit = 0);
1344 1454
 
1345
-                    if ($cat_display == 'select' || $cat_display == 'multiselect')
1346
-                        echo '</select>';
1455
+                    if ($cat_display == 'select' || $cat_display == 'multiselect') {
1456
+                                            echo '</select>';
1457
+                    }
1347 1458
 
1348 1459
                 } else {
1349 1460
 
@@ -1415,18 +1526,23 @@  discard block
 block discarded – undo
1415 1526
 
1416 1527
             $file_value = trim($value, ","); // this will be initial value of the above form field. Image urls.
1417 1528
 
1418
-        } else
1419
-            $file_value = '';
1529
+        } else {
1530
+                    $file_value = '';
1531
+        }
1420 1532
 
1421
-        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple'])
1422
-            $file_multiple = true; // allow multiple files upload
1423
-        else
1424
-            $file_multiple = false;
1533
+        if (isset($extra_fields['file_multiple']) && $extra_fields['file_multiple']) {
1534
+                    $file_multiple = true;
1535
+        }
1536
+        // allow multiple files upload
1537
+        else {
1538
+                    $file_multiple = false;
1539
+        }
1425 1540
 
1426
-        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit'])
1427
-            $file_image_limit = $extra_fields['image_limit'];
1428
-        else
1429
-            $file_image_limit = 1;
1541
+        if (isset($extra_fields['image_limit']) && $extra_fields['image_limit']) {
1542
+                    $file_image_limit = $extra_fields['image_limit'];
1543
+        } else {
1544
+                    $file_image_limit = 1;
1545
+        }
1430 1546
 
1431 1547
         $file_width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
1432 1548
 
@@ -1434,8 +1550,9 @@  discard block
 block discarded – undo
1434 1550
 
1435 1551
         if (!empty($file_value)) {
1436 1552
             $curImages = explode(',', $file_value);
1437
-            if (!empty($curImages))
1438
-                $file_totImg = count($curImages);
1553
+            if (!empty($curImages)) {
1554
+                            $file_totImg = count($curImages);
1555
+            }
1439 1556
         }
1440 1557
 
1441 1558
         $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? implode(",", $extra_fields['gd_file_types']) : '';
@@ -1450,12 +1567,18 @@  discard block
 block discarded – undo
1450 1567
         ?>
1451 1568
 
1452 1569
         <div id="<?php echo $name;?>_row"
1453
-             class="<?php if ($is_required) echo 'required_field';?> geodir_form_row clearfix gd-fieldset-details">
1570
+             class="<?php if ($is_required) {
1571
+	echo 'required_field';
1572
+}
1573
+?> geodir_form_row clearfix gd-fieldset-details">
1454 1574
 
1455 1575
             <div id="<?php echo $file_id; ?>dropbox" style="text-align:center;">
1456 1576
                 <label
1457 1577
                     style="text-align:left; padding-top:10px;"><?php $site_title = __($site_title, 'geodirectory');
1458
-                    echo $site_title; ?><?php if ($is_required) echo '<span>*</span>';?></label>
1578
+                    echo $site_title; ?><?php if ($is_required) {
1579
+                    	echo '<span>*</span>';
1580
+                    }
1581
+                    ?></label>
1459 1582
                 <input class="geodir-custom-file-upload" field_type="file" type="hidden"
1460 1583
                        name="<?php echo $file_id; ?>" id="<?php echo $file_id; ?>"
1461 1584
                        value="<?php echo esc_attr($file_value); ?>"/>
Please login to merge, or discard this patch.
geodirectory-functions/cat-meta-functions/Tax-meta-class.php 4 patches
Braces   +106 added lines, -69 removed lines patch added patch discarded remove patch
@@ -102,8 +102,9 @@  discard block
 block discarded – undo
102 102
         {
103 103
 
104 104
             // If we are not in admin area exit.
105
-            if (!is_admin())
106
-                return;
105
+            if (!is_admin()) {
106
+                            return;
107
+            }
107 108
 
108 109
             // Assign meta box values to local variables and add it's missed values.
109 110
             $this->_meta_box = $meta_box;
@@ -111,15 +112,15 @@  discard block
 block discarded – undo
111 112
             $this->_fields = &$this->_meta_box['fields'];
112 113
             $this->_Local_images = (isset($meta_box['local_images'])) ? true : false;
113 114
             $this->add_missed_values();
114
-            if (isset($meta_box['use_with_theme']))
115
-                if ($meta_box['use_with_theme'] === true) {
115
+            if (isset($meta_box['use_with_theme'])) {
116
+                            if ($meta_box['use_with_theme'] === true) {
116 117
                     $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
118
+            }
117 119
                 } elseif ($meta_box['use_with_theme'] === false) {
118 120
                     $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119 121
                 } else {
120 122
                     $this->SelfPath = $meta_box['use_with_theme'];
121
-                }
122
-            else {
123
+                } else {
123 124
                 $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
124 125
             }
125 126
 
@@ -190,8 +191,9 @@  discard block
 block discarded – undo
190 191
         {
191 192
 
192 193
             // Check if the field is an image or file. If not, return.
193
-            if (!$this->has_field('image') && !$this->has_field('file'))
194
-                return;
194
+            if (!$this->has_field('image') && !$this->has_field('file')) {
195
+                            return;
196
+            }
195 197
 
196 198
 
197 199
             add_action('wp_enqueue_scripts', array(&$this, 'enqueue_tax_meta_scripts'), 100);
@@ -235,8 +237,9 @@  discard block
 block discarded – undo
235 237
         {
236 238
 
237 239
             // If post variables are empty, return.
238
-            if (!isset($_POST['at-insert']) || empty($_POST['attachments']))
239
-                return;
240
+            if (!isset($_POST['at-insert']) || empty($_POST['attachments'])) {
241
+                            return;
242
+            }
240 243
 
241 244
             // Security Check
242 245
             check_admin_referer('media-form');
@@ -256,8 +259,9 @@  discard block
 block discarded – undo
256 259
                 $attachment = stripslashes_deep($attachment);
257 260
 
258 261
                 // If not selected or url is empty, continue in loop.
259
-                if (empty($attachment['selected']) || empty($attachment['url']))
260
-                    continue;
262
+                if (empty($attachment['selected']) || empty($attachment['url'])) {
263
+                                    continue;
264
+                }
261 265
 
262 266
                 $li = "<li id='item_{$attachment_id}'>";
263 267
                 $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
@@ -308,13 +312,15 @@  discard block
 block discarded – undo
308 312
 
309 313
 
310 314
             // If data is not set, die.
311
-            if (!isset($_POST['data']))
312
-                die();
315
+            if (!isset($_POST['data'])) {
316
+                            die();
317
+            }
313 318
 
314 319
             list($nonce, $term_id, $key, $attach_id) = explode('|', $_POST['data']);
315 320
 
316
-            if (!wp_verify_nonce($nonce, 'at_ajax_delete'))
317
-                die('1');
321
+            if (!wp_verify_nonce($nonce, 'at_ajax_delete')) {
322
+                            die('1');
323
+            }
318 324
 
319 325
             $this->delete_tax_meta($term_id, $key, $attach_id);
320 326
 
@@ -336,8 +342,9 @@  discard block
 block discarded – undo
336 342
             $ok = false;
337 343
             if (strpos($field_id, '[') === false) {
338 344
                 check_admin_referer("at-delete-mupload_" . urldecode($field_id));
339
-                if ($term_id > 0)
340
-                    $this->delete_tax_meta($term_id, $field_id);
345
+                if ($term_id > 0) {
346
+                                    $this->delete_tax_meta($term_id, $field_id);
347
+                }
341 348
                 //$ok = wp_delete_attachment( $attachment_id );
342 349
                 $ok = 1;
343 350
             } else {
@@ -349,8 +356,9 @@  discard block
 block discarded – undo
349 356
                 $saved = $this->get_tax_meta($term_id, $f[0], true);
350 357
                 if (isset($saved[$f[1]][$f[2]])) {
351 358
                     unset($saved[$f[1]][$f[2]]);
352
-                    if ($term_id > 0)
353
-                        update_post_meta($term_id, $f[0], $saved);
359
+                    if ($term_id > 0) {
360
+                                            update_post_meta($term_id, $f[0], $saved);
361
+                    }
354 362
                     //$ok = wp_delete_attachment( $attachment_id );
355 363
                     $ok = 1;
356 364
                 }
@@ -375,13 +383,15 @@  discard block
 block discarded – undo
375 383
         public function reorder_images()
376 384
         {
377 385
 
378
-            if (!isset($_POST['data']))
379
-                die();
386
+            if (!isset($_POST['data'])) {
387
+                            die();
388
+            }
380 389
 
381 390
             list($order, $term_id, $key, $nonce) = explode('|', $_POST['data']);
382 391
 
383
-            if (!wp_verify_nonce($nonce, 'at_ajax_reorder'))
384
-                die('1');
392
+            if (!wp_verify_nonce($nonce, 'at_ajax_reorder')) {
393
+                            die('1');
394
+            }
385 395
 
386 396
             parse_str($order, $items);
387 397
             $items = $items['item'];
@@ -513,8 +523,9 @@  discard block
 block discarded – undo
513 523
             foreach ($this->_fields as $field) {
514 524
                 $meta = $this->get_tax_meta($term_id, $field['id'], !$field['multiple']);
515 525
                 $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);
526
+                if ('image' != $field['type'] && $field['type'] != 'repeater') {
527
+                                    $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
528
+                }
518 529
 
519 530
                 if ($field['validate_func']) {
520 531
                     echo '<tr class="form-field form-required ' . $field['style'] . '">';
@@ -560,8 +571,9 @@  discard block
 block discarded – undo
560 571
                         $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
561 572
                         $m = $me[$f['id']];
562 573
                         $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);
574
+                        if ('image' != $f['type'] && $f['type'] != 'repeater') {
575
+                                                    $m = is_array($m) ? array_map('esc_attr', $m) : esc_attr($m);
576
+                        }
565 577
                         //set new id for field in array format
566 578
                         $f['id'] = $id;
567 579
                         if (!$field['inline']) {
@@ -802,8 +814,9 @@  discard block
 block discarded – undo
802 814
         public function show_field_select($field, $meta)
803 815
         {
804 816
 
805
-            if (!is_array($meta))
806
-                $meta = (array)$meta;
817
+            if (!is_array($meta)) {
818
+                            $meta = (array)$meta;
819
+            }
807 820
 
808 821
             $this->show_field_begin($field, $meta);
809 822
             echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
@@ -826,8 +839,9 @@  discard block
 block discarded – undo
826 839
         public function show_field_radio($field, $meta)
827 840
         {
828 841
 
829
-            if (!is_array($meta))
830
-                $meta = (array)$meta;
842
+            if (!is_array($meta)) {
843
+                            $meta = (array)$meta;
844
+            }
831 845
 
832 846
             $this->show_field_begin($field, $meta);
833 847
             foreach ($field['options'] as $key => $value) {
@@ -889,8 +903,9 @@  discard block
 block discarded – undo
889 903
 
890 904
             global $post;
891 905
 
892
-            if (!is_array($meta))
893
-                $meta = (array)$meta;
906
+            if (!is_array($meta)) {
907
+                            $meta = (array)$meta;
908
+            }
894 909
 
895 910
             $this->show_field_begin($field, $meta);
896 911
             echo "{$field['desc']}<br />";
@@ -934,16 +949,18 @@  discard block
 block discarded – undo
934 949
             $this->show_field_begin($field, $meta);
935 950
             $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
936 951
             if (is_array($meta)) {
937
-                if (isset($meta[0]) && is_array($meta[0]))
938
-                    $meta = $meta[0];
952
+                if (isset($meta[0]) && is_array($meta[0])) {
953
+                                    $meta = $meta[0];
954
+                }
939 955
             }
940 956
 
941 957
             $uploads = wp_upload_dir();
942 958
             if (is_array($meta) && isset($meta['src']) && $meta['src'] != '') {
943 959
                 $file_info = pathinfo($meta['src']);
944 960
 
945
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
-                    $sub_dir = $file_info['dirname'];
961
+                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') {
962
+                                    $sub_dir = $file_info['dirname'];
963
+                }
947 964
 
948 965
                 $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949 966
                 $uploads_baseurl = $uploads['baseurl'];
@@ -987,8 +1004,9 @@  discard block
 block discarded – undo
987 1004
         public function show_field_color($field, $meta)
988 1005
         {
989 1006
 
990
-            if (empty($meta))
991
-                $meta = '#';
1007
+            if (empty($meta)) {
1008
+                            $meta = '#';
1009
+            }
992 1010
 
993 1011
             $this->show_field_begin($field, $meta);
994 1012
 
@@ -1011,8 +1029,9 @@  discard block
 block discarded – undo
1011 1029
         public function show_field_checkbox_list($field, $meta)
1012 1030
         {
1013 1031
 
1014
-            if (!is_array($meta))
1015
-                $meta = (array)$meta;
1032
+            if (!is_array($meta)) {
1033
+                            $meta = (array)$meta;
1034
+            }
1016 1035
 
1017 1036
             $this->show_field_begin($field, $meta);
1018 1037
 
@@ -1072,7 +1091,9 @@  discard block
 block discarded – undo
1072 1091
         {
1073 1092
             global $post;
1074 1093
 
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1094
+            if (!is_array($meta)) {
1095
+            	$meta = (array)$meta;
1096
+            }
1076 1097
             $this->show_field_begin($field, $meta);
1077 1098
             $options = $field['options'];
1078 1099
             $posts = get_posts($options['args']);
@@ -1110,7 +1131,9 @@  discard block
 block discarded – undo
1110 1131
         {
1111 1132
             global $post;
1112 1133
 
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1134
+            if (!is_array($meta)) {
1135
+            	$meta = (array)$meta;
1136
+            }
1114 1137
             $this->show_field_begin($field, $meta);
1115 1138
             $options = $field['options'];
1116 1139
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1144,17 +1167,20 @@  discard block
 block discarded – undo
1144 1167
         {
1145 1168
 
1146 1169
             $taxnow = '';
1147
-            if (isset($_POST['taxonomy']))
1148
-                $taxnow = $_POST['taxonomy'];
1170
+            if (isset($_POST['taxonomy'])) {
1171
+                            $taxnow = $_POST['taxonomy'];
1172
+            }
1149 1173
 
1150 1174
             if (!isset($term_id)                                                        // Check Revision
1151 1175
                 || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152 1176
                 || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153 1177
                 || (!current_user_can('manage_categories'))
1154
-            )                                // Check permission
1178
+            ) {
1179
+            	// Check permission
1155 1180
             {
1156 1181
                 return $term_id;
1157 1182
             }
1183
+            }
1158 1184
 
1159 1185
 
1160 1186
             foreach ($this->_fields as $field) {
@@ -1248,8 +1274,9 @@  discard block
 block discarded – undo
1248 1274
         {
1249 1275
             $name = $field['id'];
1250 1276
             $this->delete_tax_meta($term_id, $name);
1251
-            if ($new === '' || $new === array())
1252
-                return;
1277
+            if ($new === '' || $new === array()) {
1278
+                            return;
1279
+            }
1253 1280
 
1254 1281
             $this->update_tax_meta($term_id, $name, $new);
1255 1282
         }
@@ -1269,8 +1296,9 @@  discard block
 block discarded – undo
1269 1296
             $name = $field['id'];
1270 1297
 
1271 1298
             $this->delete_tax_meta($term_id, $name);
1272
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
-                return;
1299
+            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '') {
1300
+                            return;
1301
+            }
1274 1302
 
1275 1303
             $this->update_tax_meta($term_id, $name, $new);
1276 1304
         }
@@ -1317,8 +1345,9 @@  discard block
 block discarded – undo
1317 1345
                                 break;
1318 1346
                         }
1319 1347
                     }
1320
-                    if (!$this->is_array_empty($n))
1321
-                        $temp[] = $n;
1348
+                    if (!$this->is_array_empty($n)) {
1349
+                                            $temp[] = $n;
1350
+                    }
1322 1351
                 }
1323 1352
                 if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324 1353
                     $this->update_tax_meta($term_id, $field['id'], $temp);
@@ -1346,14 +1375,16 @@  discard block
 block discarded – undo
1346 1375
         {
1347 1376
 
1348 1377
             $name = $field['id'];
1349
-            if (empty($_FILES[$name]))
1350
-                return;
1378
+            if (empty($_FILES[$name])) {
1379
+                            return;
1380
+            }
1351 1381
             $this->fix_file_array($_FILES[$name]);
1352 1382
             foreach ($_FILES[$name] as $position => $fileitem) {
1353 1383
 
1354 1384
                 $file = wp_handle_upload($fileitem, array('test_form' => false));
1355
-                if (empty($file['file']))
1356
-                    continue;
1385
+                if (empty($file['file'])) {
1386
+                                    continue;
1387
+                }
1357 1388
                 $filename = $file['file'];
1358 1389
 
1359 1390
                 $attachment = array(
@@ -1391,14 +1422,16 @@  discard block
 block discarded – undo
1391 1422
         {
1392 1423
 
1393 1424
             $name = $field['id'];
1394
-            if (empty($_FILES[$name]))
1395
-                return;
1425
+            if (empty($_FILES[$name])) {
1426
+                            return;
1427
+            }
1396 1428
             $this->fix_file_array($_FILES[$name]);
1397 1429
             foreach ($_FILES[$name] as $position => $fileitem) {
1398 1430
 
1399 1431
                 $file = wp_handle_upload($fileitem, array('test_form' => false));
1400
-                if (empty($file['file']))
1401
-                    continue;
1432
+                if (empty($file['file'])) {
1433
+                                    continue;
1434
+                }
1402 1435
                 $filename = $file['file'];
1403 1436
 
1404 1437
                 $attachment = array(
@@ -1453,8 +1486,9 @@  discard block
 block discarded – undo
1453 1486
         {
1454 1487
             if(is_array($this->_fields)) {
1455 1488
                 foreach ($this->_fields as $field) {
1456
-                    if ($type == $field['type'])
1457
-                        return true;
1489
+                    if ($type == $field['type']) {
1490
+                                            return true;
1491
+                    }
1458 1492
                 }
1459 1493
             }
1460 1494
             return false;
@@ -1992,18 +2026,21 @@  discard block
 block discarded – undo
1992 2026
          */
1993 2027
         public function is_array_empty($array)
1994 2028
         {
1995
-            if (!is_array($array))
1996
-                return true;
2029
+            if (!is_array($array)) {
2030
+                            return true;
2031
+            }
1997 2032
 
1998 2033
             foreach ($array as $a) {
1999 2034
                 if (is_array($a)) {
2000 2035
                     foreach ($a as $sub_a) {
2001
-                        if (!empty($sub_a) && $sub_a != '')
2002
-                            return false;
2036
+                        if (!empty($sub_a) && $sub_a != '') {
2037
+                                                    return false;
2038
+                        }
2003 2039
                     }
2004 2040
                 } else {
2005
-                    if (!empty($a) && $a != '')
2006
-                        return false;
2041
+                    if (!empty($a) && $a != '') {
2042
+                                            return false;
2043
+                    }
2007 2044
                 }
2008 2045
             }
2009 2046
             return true;
Please login to merge, or discard this patch.
Indentation   +2046 added lines, -2046 removed lines patch added patch discarded remove patch
@@ -28,260 +28,260 @@  discard block
 block discarded – undo
28 28
 
29 29
 if (!class_exists('Geodir_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 Geodir_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 Geodir_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,531 +658,531 @@  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
-                $file_info = pathinfo($meta['src']);
944
-
945
-                if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
-                    $sub_dir = $file_info['dirname'];
947
-
948
-                $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949
-                $uploads_baseurl = $uploads['baseurl'];
950
-                $uploads_path = $uploads['path'];
951
-
952
-                $file_name = $file_info['basename'];
953
-
954
-                if (strpos($sub_dir, 'https://') !== false) {
955
-                    $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
956
-                } else {
957
-                    $uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
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
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
969
-            } else {
970
-                $html .= "<span class='mupload_img_holder'></span>";
971
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
974
-            }
975
-            echo $html;
976
-            $this->show_field_end($field, $meta);
977
-        }
978
-
979
-        /**
980
-         * Show Color Field.
981
-         *
982
-         * @param string $field
983
-         * @param string $meta
984
-         * @since 1.0
985
-         * @access public
986
-         */
987
-        public function show_field_color($field, $meta)
988
-        {
989
-
990
-            if (empty($meta))
991
-                $meta = '#';
992
-
993
-            $this->show_field_begin($field, $meta);
994
-
995
-            echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996
-            //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
998
-            echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999
-            $this->show_field_end($field, $meta);
1000
-
1001
-        }
1002
-
1003
-        /**
1004
-         * Show Checkbox List Field
1005
-         *
1006
-         * @param string $field
1007
-         * @param string $meta
1008
-         * @since 1.0
1009
-         * @access public
1010
-         */
1011
-        public function show_field_checkbox_list($field, $meta)
1012
-        {
1013
-
1014
-            if (!is_array($meta))
1015
-                $meta = (array)$meta;
1016
-
1017
-            $this->show_field_begin($field, $meta);
1018
-
1019
-            $html = array();
1020
-
1021
-            foreach ($field['options'] as $key => $value) {
1022
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1023
-            }
1024
-
1025
-            echo implode('<br />', $html);
1026
-
1027
-            $this->show_field_end($field, $meta);
1028
-
1029
-        }
1030
-
1031
-        /**
1032
-         * Show Date Field.
1033
-         *
1034
-         * @param string $field
1035
-         * @param string $meta
1036
-         * @since 1.0
1037
-         * @access public
1038
-         */
1039
-        public function show_field_date($field, $meta)
1040
-        {
1041
-            $this->show_field_begin($field, $meta);
1042
-            echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1043
-            $this->show_field_end($field, $meta);
1044
-        }
1045
-
1046
-        /**
1047
-         * Show time field.
1048
-         *
1049
-         * @param string $field
1050
-         * @param string $meta
1051
-         * @since 1.0
1052
-         * @access public
1053
-         */
1054
-        public function show_field_time($field, $meta)
1055
-        {
1056
-            $this->show_field_begin($field, $meta);
1057
-            echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1058
-            $this->show_field_end($field, $meta);
1059
-        }
1060
-
1061
-        /**
1062
-         * Show Posts field.
1063
-         * used creating a posts/pages/custom types checkboxlist or a select dropdown
1064
-         *
1065
-         * @global object $post The current post object.
1066
-         * @param string $field
1067
-         * @param string $meta
1068
-         * @since 1.0
1069
-         * @access public
1070
-         */
1071
-        public function show_field_posts($field, $meta)
1072
-        {
1073
-            global $post;
1074
-
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1076
-            $this->show_field_begin($field, $meta);
1077
-            $options = $field['options'];
1078
-            $posts = get_posts($options['args']);
1079
-
1080
-            // checkbox_list
1081
-            if ('checkbox_list' == $options['type']) {
1082
-                foreach ($posts as $p) {
1083
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
-                }
1085
-            } // select
1086
-            else {
1087
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
-                foreach ($posts as $p) {
1089
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
-                }
1091
-                echo "</select>";
1092
-            }
1093
-
1094
-            $this->show_field_end($field, $meta);
1095
-        }
1096
-
1097
-        /**
1098
-         * Show Taxonomy field.
1099
-         * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1100
-         *
1101
-         * @global object $post The current post object.
1102
-         * @param string $field
1103
-         * @param string $meta
1104
-         * @since 1.0
1105
-         * @access public
1106
-         *
1107
-         * @uses get_terms()
1108
-         */
1109
-        public function show_field_taxonomy($field, $meta)
1110
-        {
1111
-            global $post;
1112
-
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1114
-            $this->show_field_begin($field, $meta);
1115
-            $options = $field['options'];
1116
-            $terms = get_terms($options['taxonomy'], $options['args']);
1117
-
1118
-            // checkbox_list
1119
-            if ('checkbox_list' == $options['type']) {
1120
-                foreach ($terms as $term) {
1121
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
-                }
1123
-            } // select
1124
-            else {
1125
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
-                foreach ($terms as $term) {
1127
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
-                }
1129
-                echo "</select>";
1130
-            }
1131
-
1132
-            $this->show_field_end($field, $meta);
1133
-        }
1134
-
1135
-        /**
1136
-         * Save Data from Metabox
1137
-         *
1138
-         * @param string $term_id The term ID.
1139
-         * @since 1.0
1140
-         * @access public
1141
-         * @return string
1142
-         */
1143
-        public function save($term_id)
1144
-        {
1145
-
1146
-            $taxnow = '';
1147
-            if (isset($_POST['taxonomy']))
1148
-                $taxnow = $_POST['taxonomy'];
1149
-
1150
-            if (!isset($term_id)                                                        // Check Revision
1151
-                || (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152
-                || (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153
-                || (!current_user_can('manage_categories'))
1154
-            )                                // Check permission
1155
-            {
1156
-                return $term_id;
1157
-            }
1158
-
1159
-
1160
-            foreach ($this->_fields as $field) {
1161
-
1162
-                $name = $field['id'];
1163
-                $type = $field['type'];
1164
-                $old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1165
-                $new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1166
-
1167
-                // Validate meta value
1168
-                if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1169
-                    $new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1170
-                }
1171
-
1172
-
1173
-                if ($name == 'ct_cat_icon') {
1174
-
1175
-                    $upload_dir = wp_upload_dir();
1176
-
1177
-                    $image_name_arr = explode('/', $new['src']);
1178
-                    //$old_filename = end($image_name_arr);
1179
-                    //$img_name_arr = explode('.',$old_filename);
1180
-
1181
-                    //$old_filename = $upload_dir['path'].'/'.$old_filename;
1182
-
1183
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1184
-
1185
-                    /*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
+				$file_info = pathinfo($meta['src']);
944
+
945
+				if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
946
+					$sub_dir = $file_info['dirname'];
947
+
948
+				$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
949
+				$uploads_baseurl = $uploads['baseurl'];
950
+				$uploads_path = $uploads['path'];
951
+
952
+				$file_name = $file_info['basename'];
953
+
954
+				if (strpos($sub_dir, 'https://') !== false) {
955
+					$uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
956
+				} else {
957
+					$uploads['baseurl'] = str_replace('https://', 'http://', $uploads['baseurl']);
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
+				$html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
+				$html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
+				$html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
969
+			} else {
970
+				$html .= "<span class='mupload_img_holder'></span>";
971
+				$html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
+				$html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
+				$html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
974
+			}
975
+			echo $html;
976
+			$this->show_field_end($field, $meta);
977
+		}
978
+
979
+		/**
980
+		 * Show Color Field.
981
+		 *
982
+		 * @param string $field
983
+		 * @param string $meta
984
+		 * @since 1.0
985
+		 * @access public
986
+		 */
987
+		public function show_field_color($field, $meta)
988
+		{
989
+
990
+			if (empty($meta))
991
+				$meta = '#';
992
+
993
+			$this->show_field_begin($field, $meta);
994
+
995
+			echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996
+			//	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
+			echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
998
+			echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999
+			$this->show_field_end($field, $meta);
1000
+
1001
+		}
1002
+
1003
+		/**
1004
+		 * Show Checkbox List Field
1005
+		 *
1006
+		 * @param string $field
1007
+		 * @param string $meta
1008
+		 * @since 1.0
1009
+		 * @access public
1010
+		 */
1011
+		public function show_field_checkbox_list($field, $meta)
1012
+		{
1013
+
1014
+			if (!is_array($meta))
1015
+				$meta = (array)$meta;
1016
+
1017
+			$this->show_field_begin($field, $meta);
1018
+
1019
+			$html = array();
1020
+
1021
+			foreach ($field['options'] as $key => $value) {
1022
+				$html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1023
+			}
1024
+
1025
+			echo implode('<br />', $html);
1026
+
1027
+			$this->show_field_end($field, $meta);
1028
+
1029
+		}
1030
+
1031
+		/**
1032
+		 * Show Date Field.
1033
+		 *
1034
+		 * @param string $field
1035
+		 * @param string $meta
1036
+		 * @since 1.0
1037
+		 * @access public
1038
+		 */
1039
+		public function show_field_date($field, $meta)
1040
+		{
1041
+			$this->show_field_begin($field, $meta);
1042
+			echo "<input type='text' class='at-date' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1043
+			$this->show_field_end($field, $meta);
1044
+		}
1045
+
1046
+		/**
1047
+		 * Show time field.
1048
+		 *
1049
+		 * @param string $field
1050
+		 * @param string $meta
1051
+		 * @since 1.0
1052
+		 * @access public
1053
+		 */
1054
+		public function show_field_time($field, $meta)
1055
+		{
1056
+			$this->show_field_begin($field, $meta);
1057
+			echo "<input type='text' class='at-time' name='{$field['id']}' id='{$field['id']}' rel='{$field['format']}' value='{$meta}' size='30' />";
1058
+			$this->show_field_end($field, $meta);
1059
+		}
1060
+
1061
+		/**
1062
+		 * Show Posts field.
1063
+		 * used creating a posts/pages/custom types checkboxlist or a select dropdown
1064
+		 *
1065
+		 * @global object $post The current post object.
1066
+		 * @param string $field
1067
+		 * @param string $meta
1068
+		 * @since 1.0
1069
+		 * @access public
1070
+		 */
1071
+		public function show_field_posts($field, $meta)
1072
+		{
1073
+			global $post;
1074
+
1075
+			if (!is_array($meta)) $meta = (array)$meta;
1076
+			$this->show_field_begin($field, $meta);
1077
+			$options = $field['options'];
1078
+			$posts = get_posts($options['args']);
1079
+
1080
+			// checkbox_list
1081
+			if ('checkbox_list' == $options['type']) {
1082
+				foreach ($posts as $p) {
1083
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1084
+				}
1085
+			} // select
1086
+			else {
1087
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1088
+				foreach ($posts as $p) {
1089
+					echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1090
+				}
1091
+				echo "</select>";
1092
+			}
1093
+
1094
+			$this->show_field_end($field, $meta);
1095
+		}
1096
+
1097
+		/**
1098
+		 * Show Taxonomy field.
1099
+		 * used creating a category/tags/custom taxonomy checkboxlist or a select dropdown
1100
+		 *
1101
+		 * @global object $post The current post object.
1102
+		 * @param string $field
1103
+		 * @param string $meta
1104
+		 * @since 1.0
1105
+		 * @access public
1106
+		 *
1107
+		 * @uses get_terms()
1108
+		 */
1109
+		public function show_field_taxonomy($field, $meta)
1110
+		{
1111
+			global $post;
1112
+
1113
+			if (!is_array($meta)) $meta = (array)$meta;
1114
+			$this->show_field_begin($field, $meta);
1115
+			$options = $field['options'];
1116
+			$terms = get_terms($options['taxonomy'], $options['args']);
1117
+
1118
+			// checkbox_list
1119
+			if ('checkbox_list' == $options['type']) {
1120
+				foreach ($terms as $term) {
1121
+					echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1122
+				}
1123
+			} // select
1124
+			else {
1125
+				echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1126
+				foreach ($terms as $term) {
1127
+					echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1128
+				}
1129
+				echo "</select>";
1130
+			}
1131
+
1132
+			$this->show_field_end($field, $meta);
1133
+		}
1134
+
1135
+		/**
1136
+		 * Save Data from Metabox
1137
+		 *
1138
+		 * @param string $term_id The term ID.
1139
+		 * @since 1.0
1140
+		 * @access public
1141
+		 * @return string
1142
+		 */
1143
+		public function save($term_id)
1144
+		{
1145
+
1146
+			$taxnow = '';
1147
+			if (isset($_POST['taxonomy']))
1148
+				$taxnow = $_POST['taxonomy'];
1149
+
1150
+			if (!isset($term_id)                                                        // Check Revision
1151
+				|| (!in_array($taxnow, $this->_meta_box['pages']))                            // Check if current taxonomy type is supported.
1152
+				|| (!check_admin_referer(basename(__FILE__), 'tax_meta_class_nonce'))        // Check nonce - Security
1153
+				|| (!current_user_can('manage_categories'))
1154
+			)                                // Check permission
1155
+			{
1156
+				return $term_id;
1157
+			}
1158
+
1159
+
1160
+			foreach ($this->_fields as $field) {
1161
+
1162
+				$name = $field['id'];
1163
+				$type = $field['type'];
1164
+				$old = $this->get_tax_meta($term_id, $name, !$field['multiple']);
1165
+				$new = (isset($_POST[$name])) ? $_POST[$name] : (($field['multiple']) ? array() : '');
1166
+
1167
+				// Validate meta value
1168
+				if (class_exists('Tax_Meta_Validate') && method_exists('Tax_Meta_Validate', $field['validate_func'])) {
1169
+					$new = call_user_func(array('Tax_Meta_Validate', $field['validate_func']), $new);
1170
+				}
1171
+
1172
+
1173
+				if ($name == 'ct_cat_icon') {
1174
+
1175
+					$upload_dir = wp_upload_dir();
1176
+
1177
+					$image_name_arr = explode('/', $new['src']);
1178
+					//$old_filename = end($image_name_arr);
1179
+					//$img_name_arr = explode('.',$old_filename);
1180
+
1181
+					//$old_filename = $upload_dir['path'].'/'.$old_filename;
1182
+
1183
+					$new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1184
+
1185
+					/*rename($old_filename, $new_filename);
1186 1186
 				
1187 1187
 				//subdir
1188 1188
 				$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 				update_attached_file( $new['id'], $new['src'] );*/
1191 1191
 
1192 1192
 
1193
-                    /*	
1193
+					/*	
1194 1194
 		
1195 1195
 		$new['src'] = $upload_dir['url'].'/'.'cat_icon_'.$term_id.'.png';
1196 1196
 		
@@ -1215,67 +1215,67 @@  discard block
 block discarded – undo
1215 1215
 		$attach_id = wp_insert_attachment( $attachment, $filename);*/
1216 1216
 
1217 1217
 
1218
-                }
1219
-
1220
-
1221
-                //skip on Paragraph field
1222
-                if ($type != "paragraph") {
1223
-
1224
-                    // Call defined method to save meta value, if there's no methods, call common one.
1225
-                    $save_func = 'save_field_' . $type;
1226
-                    if (method_exists($this, $save_func)) {
1227
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1228
-                    } else {
1229
-                        $this->save_field($term_id, $field, $old, $new);
1230
-                    }
1231
-                }
1232
-
1233
-            } // End foreach
1234
-
1235
-        }
1236
-
1237
-        /**
1238
-         * Common function for saving fields.
1239
-         *
1240
-         * @param string $term_id The term ID.
1241
-         * @param string $field
1242
-         * @param string $old
1243
-         * @param string|mixed $new
1244
-         * @since 1.0
1245
-         * @access public
1246
-         */
1247
-        public function save_field($term_id, $field, $old, $new)
1248
-        {
1249
-            $name = $field['id'];
1250
-            $this->delete_tax_meta($term_id, $name);
1251
-            if ($new === '' || $new === array())
1252
-                return;
1253
-
1254
-            $this->update_tax_meta($term_id, $name, $new);
1255
-        }
1256
-
1257
-        /**
1258
-         * function for saving image field.
1259
-         *
1260
-         * @param string $term_id The term ID.
1261
-         * @param string $field
1262
-         * @param string $old
1263
-         * @param string|mixed $new
1264
-         * @since 1.0
1265
-         * @access public
1266
-         */
1267
-        public function save_field_image($term_id, $field, $old, $new)
1268
-        {
1269
-            $name = $field['id'];
1270
-
1271
-            $this->delete_tax_meta($term_id, $name);
1272
-            if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
-                return;
1274
-
1275
-            $this->update_tax_meta($term_id, $name, $new);
1276
-        }
1277
-
1278
-        /*
1218
+				}
1219
+
1220
+
1221
+				//skip on Paragraph field
1222
+				if ($type != "paragraph") {
1223
+
1224
+					// Call defined method to save meta value, if there's no methods, call common one.
1225
+					$save_func = 'save_field_' . $type;
1226
+					if (method_exists($this, $save_func)) {
1227
+						call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1228
+					} else {
1229
+						$this->save_field($term_id, $field, $old, $new);
1230
+					}
1231
+				}
1232
+
1233
+			} // End foreach
1234
+
1235
+		}
1236
+
1237
+		/**
1238
+		 * Common function for saving fields.
1239
+		 *
1240
+		 * @param string $term_id The term ID.
1241
+		 * @param string $field
1242
+		 * @param string $old
1243
+		 * @param string|mixed $new
1244
+		 * @since 1.0
1245
+		 * @access public
1246
+		 */
1247
+		public function save_field($term_id, $field, $old, $new)
1248
+		{
1249
+			$name = $field['id'];
1250
+			$this->delete_tax_meta($term_id, $name);
1251
+			if ($new === '' || $new === array())
1252
+				return;
1253
+
1254
+			$this->update_tax_meta($term_id, $name, $new);
1255
+		}
1256
+
1257
+		/**
1258
+		 * function for saving image field.
1259
+		 *
1260
+		 * @param string $term_id The term ID.
1261
+		 * @param string $field
1262
+		 * @param string $old
1263
+		 * @param string|mixed $new
1264
+		 * @since 1.0
1265
+		 * @access public
1266
+		 */
1267
+		public function save_field_image($term_id, $field, $old, $new)
1268
+		{
1269
+			$name = $field['id'];
1270
+
1271
+			$this->delete_tax_meta($term_id, $name);
1272
+			if ($new === '' || $new === array() || $new['id'] == '' || $new['src'] == '')
1273
+				return;
1274
+
1275
+			$this->update_tax_meta($term_id, $name, $new);
1276
+		}
1277
+
1278
+		/*
1279 1279
 	 * Save Wysiwyg Field.
1280 1280
 	 *
1281 1281
 	 * @param string $term_id The term ID. 
@@ -1285,806 +1285,806 @@  discard block
 block discarded – undo
1285 1285
 	 * @since 1.0
1286 1286
 	 * @access public 
1287 1287
 	 */
1288
-        public function save_field_wysiwyg($term_id, $field, $old, $new)
1289
-        {
1290
-            $this->save_field($term_id, $field, $old, $new);
1291
-        }
1292
-
1293
-        /**
1294
-         * Save repeater Fields.
1295
-         *
1296
-         * @param string $term_id The term ID.
1297
-         * @param string $field
1298
-         * @param string|mixed $old
1299
-         * @param string|mixed $new
1300
-         * @since 1.0
1301
-         * @access public
1302
-         */
1303
-        public function save_field_repeater($term_id, $field, $old, $new)
1304
-        {
1305
-            if (is_array($new) && count($new) > 0) {
1306
-                foreach ($new as $n) {
1307
-                    foreach ($field['fields'] as $f) {
1308
-                        $type = $f['type'];
1309
-                        switch ($type) {
1310
-                            case 'wysiwyg':
1311
-                                $n[$f['id']] = wpautop($n[$f['id']]);
1312
-                                break;
1313
-                            case 'file':
1314
-                                $n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1315
-                                break;
1316
-                            default:
1317
-                                break;
1318
-                        }
1319
-                    }
1320
-                    if (!$this->is_array_empty($n))
1321
-                        $temp[] = $n;
1322
-                }
1323
-                if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324
-                    $this->update_tax_meta($term_id, $field['id'], $temp);
1325
-                } else {
1326
-                    //	remove old meta if exists
1327
-                    delete_post_meta($term_id, $field['id']);
1328
-                }
1329
-            } else {
1330
-                //	remove old meta if exists
1331
-                delete_post_meta($term_id, $field['id']);
1332
-            }
1333
-        }
1334
-
1335
-        /**
1336
-         * Save File Field.
1337
-         *
1338
-         * @param string $term_id The term ID.
1339
-         * @param string $field
1340
-         * @param string $old
1341
-         * @param string $new
1342
-         * @since 1.0
1343
-         * @access public
1344
-         */
1345
-        public function save_field_file($term_id, $field, $old, $new)
1346
-        {
1347
-
1348
-            $name = $field['id'];
1349
-            if (empty($_FILES[$name]))
1350
-                return;
1351
-            $this->fix_file_array($_FILES[$name]);
1352
-            foreach ($_FILES[$name] as $position => $fileitem) {
1353
-
1354
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1355
-                if (empty($file['file']))
1356
-                    continue;
1357
-                $filename = $file['file'];
1358
-
1359
-                $attachment = array(
1360
-                    'post_mime_type' => $file['type'],
1361
-                    'guid' => $file['url'],
1362
-                    'post_parent' => $term_id,
1363
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1364
-                    'post_content' => ''
1365
-                );
1366
-
1367
-                $id = wp_insert_attachment($attachment, $filename, $term_id);
1368
-
1369
-                if (!is_wp_error($id)) {
1370
-
1371
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
-
1374
-                } // End if
1375
-
1376
-            } // End foreach
1377
-
1378
-        }
1379
-
1380
-        /**
1381
-         * Save repeater File Field.
1382
-         * @param string $term_id The term ID.
1383
-         * @param string $field
1384
-         * @param string $old
1385
-         * @param string $new
1386
-         * @since 1.0
1387
-         * @access public
1388
-         * @return int|void
1389
-         */
1390
-        public function save_field_file_repeater($term_id, $field, $old, $new)
1391
-        {
1392
-
1393
-            $name = $field['id'];
1394
-            if (empty($_FILES[$name]))
1395
-                return;
1396
-            $this->fix_file_array($_FILES[$name]);
1397
-            foreach ($_FILES[$name] as $position => $fileitem) {
1398
-
1399
-                $file = wp_handle_upload($fileitem, array('test_form' => false));
1400
-                if (empty($file['file']))
1401
-                    continue;
1402
-                $filename = $file['file'];
1403
-
1404
-                $attachment = array(
1405
-                    'post_mime_type' => $file['type'],
1406
-                    'guid' => $file['url'],
1407
-                    'post_parent' => $term_id,
1408
-                    'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1409
-                    'post_content' => ''
1410
-                );
1411
-
1412
-                $id = wp_insert_attachment($attachment, $filename);
1413
-
1414
-                if (!is_wp_error($id)) {
1415
-
1416
-                    wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
-                    return $id;    // return file's url in meta fields
1418
-                } // End if
1419
-            } // End foreach
1420
-        }
1421
-
1422
-        /**
1423
-         * Add missed values for meta box.
1424
-         *
1425
-         * @since 1.0
1426
-         * @access public
1427
-         */
1428
-        public function add_missed_values()
1429
-        {
1430
-
1431
-            // Default values for meta box
1432
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
-
1434
-            if(is_array($this->_fields)) {
1435
-                // Default values for fields
1436
-                foreach ($this->_fields as &$field) {
1437
-                    $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1438
-                    $std = $multiple ? array() : '';
1439
-                    $format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1440
-                    $field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1441
-                } // End foreach
1442
-            }
1443
-        }
1444
-
1445
-        /**
1446
-         * Check if field with $type exists.
1447
-         *
1448
-         * @param string $type
1449
-         * @since 1.0
1450
-         * @access public
1451
-         */
1452
-        public function has_field($type)
1453
-        {
1454
-            if(is_array($this->_fields)) {
1455
-                foreach ($this->_fields as $field) {
1456
-                    if ($type == $field['type'])
1457
-                        return true;
1458
-                }
1459
-            }
1460
-            return false;
1461
-        }
1462
-
1463
-        /**
1464
-         * Check if current page is edit page.
1465
-         *
1466
-         * @since 1.0
1467
-         * @access public
1468
-         */
1469
-        public function is_edit_page()
1470
-        {
1471
-            global $pagenow;
1472
-            return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1473
-        }
1474
-
1475
-        /**
1476
-         * Fixes the odd indexing of multiple file uploads.
1477
-         *
1478
-         * Goes from the format:
1479
-         * $_FILES['field']['key']['index']
1480
-         * to
1481
-         * The More standard and appropriate:
1482
-         * $_FILES['field']['index']['key']
1483
-         *
1484
-         * @param string $files
1485
-         * @since 1.0
1486
-         * @access public
1487
-         */
1488
-        public function fix_file_array(&$files)
1489
-        {
1490
-
1491
-            $output = array();
1492
-
1493
-            foreach ($files as $key => $list) {
1494
-                foreach ($list as $index => $value) {
1495
-                    $output[$index][$key] = $value;
1496
-                }
1497
-            }
1498
-
1499
-            return $files = $output;
1500
-
1501
-        }
1502
-
1503
-        /**
1504
-         * Get proper JQuery UI version.
1505
-         *
1506
-         * Used in order to not conflict with WP Admin Scripts.
1507
-         *
1508
-         * @since 1.0
1509
-         * @access public
1510
-         */
1511
-        public function get_jqueryui_ver()
1512
-        {
1513
-
1514
-            global $wp_version;
1515
-
1516
-            if (version_compare($wp_version, '3.1', '>=')) {
1517
-                return '1.8.10';
1518
-            }
1519
-
1520
-            return '1.7.3';
1521
-
1522
-        }
1523
-
1524
-        /**
1525
-         *  Add Field to meta box (generic function)
1526
-         * @author Ohad Raz
1527
-         * @since 1.0
1528
-         * @access public
1529
-         * @param $id string  field id, i.e. the meta key
1530
-         * @param $args mixed|array
1531
-         */
1532
-        public function addField($id, $args)
1533
-        {
1534
-            $new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1535
-            $new_field = array_merge($new_field, $args);
1536
-            $this->_fields[] = $new_field;
1537
-        }
1538
-
1539
-
1540
-        /**
1541
-         *  Add Text Field to meta box
1542
-         * @author Ohad Raz
1543
-         * @since 1.0
1544
-         * @access public
1545
-         * @param $id string  field id, i.e. the meta key
1546
-         * @param $args mixed|array
1547
-         *    'name' => // field name/label string optional
1548
-         *    'desc' => // field description, string optional
1549
-         *    'std' => // default value, string optional
1550
-         *    'style' =>    // custom style for field, string optional
1551
-         *    'validate_func' => // validate function, string optional
1552
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1553
-         */
1554
-        public function addText($id, $args, $repeater = false)
1555
-        {
1556
-            $new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1557
-            $new_field = array_merge($new_field, $args);
1558
-            if (false === $repeater) {
1559
-                $this->_fields[] = $new_field;
1560
-            } else {
1561
-                return $new_field;
1562
-            }
1563
-        }
1564
-
1565
-        /**
1566
-         *  Add Hidden Field to meta box
1567
-         * @author Ohad Raz
1568
-         * @since 0.1.3
1569
-         * @access public
1570
-         * @param $id string  field id, i.e. the meta key
1571
-         * @param $args mixed|array
1572
-         *    'name' => // field name/label string optional
1573
-         *    'desc' => // field description, string optional
1574
-         *    'std' => // default value, string optional
1575
-         *    'style' =>    // custom style for field, string optional
1576
-         *    'validate_func' => // validate function, string optional
1577
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1578
-         */
1579
-        public function addHidden($id, $args, $repeater = false)
1580
-        {
1581
-            $new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1582
-            $new_field = array_merge($new_field, $args);
1583
-            if (false === $repeater) {
1584
-                $this->_fields[] = $new_field;
1585
-            } else {
1586
-                return $new_field;
1587
-            }
1588
-        }
1589
-
1590
-        /**
1591
-         *  Add Paragraph to meta box
1592
-         * @author Ohad Raz
1593
-         * @since 0.1.3
1594
-         * @access public
1595
-         * @param $id string  field id, i.e. the meta key
1596
-         * @param $value  paragraph html
1597
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1598
-         */
1599
-        public function addParagraph($id, $args, $repeater = false)
1600
-        {
1601
-            $new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1602
-            $new_field = array_merge($new_field, $args);
1603
-            if (false === $repeater) {
1604
-                $this->_fields[] = $new_field;
1605
-            } else {
1606
-                return $new_field;
1607
-            }
1608
-        }
1609
-
1610
-        /**
1611
-         *  Add Checkbox Field to meta box
1612
-         * @author Ohad Raz
1613
-         * @since 1.0
1614
-         * @access public
1615
-         * @param $id string  field id, i.e. the meta key
1616
-         * @param $args mixed|array
1617
-         *    'name' => // field name/label string optional
1618
-         *    'desc' => // field description, string optional
1619
-         *    'std' => // default value, string optional
1620
-         *    'validate_func' => // validate function, string optional
1621
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1622
-         */
1623
-        public function addCheckbox($id, $args, $repeater = false)
1624
-        {
1625
-            $new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1626
-            $new_field = array_merge($new_field, $args);
1627
-            if (false === $repeater) {
1628
-                $this->_fields[] = $new_field;
1629
-            } else {
1630
-                return $new_field;
1631
-            }
1632
-        }
1633
-
1634
-        /**
1635
-         *  Add CheckboxList Field to meta box
1636
-         * @author Ohad Raz
1637
-         * @since 1.0
1638
-         * @access public
1639
-         * @param $id string  field id, i.e. the meta key
1640
-         * @param $options (array)  array of key => value pairs for select options
1641
-         * @param $args mixed|array
1642
-         *    'name' => // field name/label string optional
1643
-         *    'desc' => // field description, string optional
1644
-         *    'std' => // default value, string optional
1645
-         *    'validate_func' => // validate function, string optional
1646
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1647
-         *
1648
-         * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1649
-         *   which means the last param as false to get the values in an array
1650
-         */
1651
-        public function addCheckboxList($id, $options, $args, $repeater = false)
1652
-        {
1653
-            $new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1654
-            $new_field = array_merge($new_field, $args);
1655
-            if (false === $repeater) {
1656
-                $this->_fields[] = $new_field;
1657
-            } else {
1658
-                return $new_field;
1659
-            }
1660
-        }
1661
-
1662
-        /**
1663
-         *  Add Textarea Field to meta box
1664
-         * @author Ohad Raz
1665
-         * @since 1.0
1666
-         * @access public
1667
-         * @param $id string  field id, i.e. the meta key
1668
-         * @param $args mixed|array
1669
-         *    'name' => // field name/label string optional
1670
-         *    'desc' => // field description, string optional
1671
-         *    'std' => // default value, string optional
1672
-         *    'style' =>    // custom style for field, string optional
1673
-         *    'validate_func' => // validate function, string optional
1674
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1675
-         */
1676
-        public function addTextarea($id, $args, $repeater = false)
1677
-        {
1678
-            $new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1679
-            $new_field = array_merge($new_field, $args);
1680
-            if (false === $repeater) {
1681
-                $this->_fields[] = $new_field;
1682
-            } else {
1683
-                return $new_field;
1684
-            }
1685
-        }
1686
-
1687
-        /**
1688
-         *  Add Select Field to meta box
1689
-         * @author Ohad Raz
1690
-         * @since 1.0
1691
-         * @access public
1692
-         * @param $id string field id, i.e. the meta key
1693
-         * @param $options (array)  array of key => value pairs for select options
1694
-         * @param $args mixed|array
1695
-         *    'name' => // field name/label string optional
1696
-         *    'desc' => // field description, string optional
1697
-         *    'std' => // default value, (array) optional
1698
-         *    'multiple' => // select multiple values, optional. Default is false.
1699
-         *    'validate_func' => // validate function, string optional
1700
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1701
-         */
1702
-        public function addSelect($id, $options, $args, $repeater = false)
1703
-        {
1704
-            $new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1705
-            $new_field = array_merge($new_field, $args);
1706
-            if (false === $repeater) {
1707
-                $this->_fields[] = $new_field;
1708
-            } else {
1709
-                return $new_field;
1710
-            }
1711
-        }
1712
-
1713
-
1714
-        /**
1715
-         *  Add Radio Field to meta box
1716
-         * @author Ohad Raz
1717
-         * @since 1.0
1718
-         * @access public
1719
-         * @param $id string field id, i.e. the meta key
1720
-         * @param $options (array)  array of key => value pairs for radio options
1721
-         * @param $args mixed|array
1722
-         *    'name' => // field name/label string optional
1723
-         *    'desc' => // field description, string optional
1724
-         *    'std' => // default value, string optional
1725
-         *    'validate_func' => // validate function, string optional
1726
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1727
-         */
1728
-        public function addRadio($id, $options, $args, $repeater = false)
1729
-        {
1730
-            $new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1731
-            $new_field = array_merge($new_field, $args);
1732
-            if (false === $repeater) {
1733
-                $this->_fields[] = $new_field;
1734
-            } else {
1735
-                return $new_field;
1736
-            }
1737
-        }
1738
-
1739
-        /**
1740
-         *  Add Date Field to meta box
1741
-         * @author Ohad Raz
1742
-         * @since 1.0
1743
-         * @access public
1744
-         * @param $id string  field id, i.e. the meta key
1745
-         * @param $args mixed|array
1746
-         *    'name' => // field name/label string optional
1747
-         *    'desc' => // field description, string optional
1748
-         *    'std' => // default value, string optional
1749
-         *    'validate_func' => // validate function, string optional
1750
-         *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1751
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1752
-         */
1753
-        public function addDate($id, $args, $repeater = false)
1754
-        {
1755
-            $new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1756
-            $new_field = array_merge($new_field, $args);
1757
-            if (false === $repeater) {
1758
-                $this->_fields[] = $new_field;
1759
-            } else {
1760
-                return $new_field;
1761
-            }
1762
-        }
1763
-
1764
-        /**
1765
-         *  Add Time Field to meta box
1766
-         * @author Ohad Raz
1767
-         * @since 1.0
1768
-         * @access public
1769
-         * @param $id string- field id, i.e. the meta key
1770
-         * @param $args mixed|array
1771
-         *    'name' => // field name/label string optional
1772
-         *    'desc' => // field description, string optional
1773
-         *    'std' => // default value, string optional
1774
-         *    'validate_func' => // validate function, string optional
1775
-         *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1776
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1777
-         */
1778
-        public function addTime($id, $args, $repeater = false)
1779
-        {
1780
-            $new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1781
-            $new_field = array_merge($new_field, $args);
1782
-            if (false === $repeater) {
1783
-                $this->_fields[] = $new_field;
1784
-            } else {
1785
-                return $new_field;
1786
-            }
1787
-        }
1788
-
1789
-        /**
1790
-         *  Add Color Field to meta box
1791
-         * @author Ohad Raz
1792
-         * @since 1.0
1793
-         * @access public
1794
-         * @param $id string  field id, i.e. the meta key
1795
-         * @param $args mixed|array
1796
-         *    'name' => // field name/label string optional
1797
-         *    'desc' => // field description, string optional
1798
-         *    'std' => // default value, string optional
1799
-         *    'validate_func' => // validate function, string optional
1800
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1801
-         */
1802
-        public function addColor($id, $args, $repeater = false)
1803
-        {
1804
-            $new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1805
-            $new_field = array_merge($new_field, $args);
1806
-            if (false === $repeater) {
1807
-                $this->_fields[] = $new_field;
1808
-            } else {
1809
-                return $new_field;
1810
-            }
1811
-        }
1812
-
1813
-        /**
1814
-         *  Add Image Field to meta box
1815
-         * @author Ohad Raz
1816
-         * @since 1.0
1817
-         * @access public
1818
-         * @param $id string  field id, i.e. the meta key
1819
-         * @param $args mixed|array
1820
-         *    'name' => // field name/label string optional
1821
-         *    'desc' => // field description, string optional
1822
-         *    'validate_func' => // validate function, string optional
1823
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1824
-         */
1825
-        public function addImage($id, $args, $repeater = false)
1826
-        {
1827
-            $new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1828
-            $new_field = array_merge($new_field, $args);
1829
-
1830
-            if (false === $repeater) {
1831
-                $this->_fields[] = $new_field;
1832
-            } else {
1833
-                return $new_field;
1834
-            }
1835
-        }
1836
-
1837
-        /**
1838
-         *  Add File Field to meta box
1839
-         * @author Ohad Raz
1840
-         * @since 1.0
1841
-         * @access public
1842
-         * @param $id string  field id, i.e. the meta key
1843
-         * @param $args mixed|array
1844
-         *    'name' => // field name/label string optional
1845
-         *    'desc' => // field description, string optional
1846
-         *    'validate_func' => // validate function, string optional
1847
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1848
-         */
1849
-        public function addFile($id, $args, $repeater = false)
1850
-        {
1851
-            $new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1852
-            $new_field = array_merge($new_field, $args);
1853
-            if (false === $repeater) {
1854
-                $this->_fields[] = $new_field;
1855
-            } else {
1856
-                return $new_field;
1857
-            }
1858
-        }
1859
-
1860
-        /**
1861
-         *  Add WYSIWYG Field to meta box
1862
-         * @author Ohad Raz
1863
-         * @since 1.0
1864
-         * @access public
1865
-         * @param $id string  field id, i.e. the meta key
1866
-         * @param $args mixed|array
1867
-         *    'name' => // field name/label string optional
1868
-         *    'desc' => // field description, string optional
1869
-         *    'std' => // default value, string optional
1870
-         *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1871
-         *    'validate_func' => // validate function, string optional
1872
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1873
-         */
1874
-        public function addWysiwyg($id, $args, $repeater = false)
1875
-        {
1876
-            $new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1877
-            $new_field = array_merge($new_field, $args);
1878
-            if (false === $repeater) {
1879
-                $this->_fields[] = $new_field;
1880
-            } else {
1881
-                return $new_field;
1882
-            }
1883
-        }
1884
-
1885
-        /**
1886
-         *  Add Taxonomy Field to meta box
1887
-         * @author Ohad Raz
1888
-         * @since 1.0
1889
-         * @access public
1890
-         * @param $id string  field id, i.e. the meta key
1891
-         * @param $options mixed|array options of taxonomy field
1892
-         *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1893
-         * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1894
-         * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1895
-         * @param $args mixed|array
1896
-         *    'name' => // field name/label string optional
1897
-         *    'desc' => // field description, string optional
1898
-         *    'std' => // default value, string optional
1899
-         *    'validate_func' => // validate function, string optional
1900
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1901
-         */
1902
-        public function addTaxonomy($id, $options, $args, $repeater = false)
1903
-        {
1904
-            $q = array('hide_empty' => 0);
1905
-            $tax = 'category';
1906
-            $type = 'select';
1907
-            $temp = array($tax, $type, $q);
1908
-            $options = array_merge($temp, $options);
1909
-            $new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1910
-            $new_field = array_merge($new_field, $args);
1911
-            if (false === $repeater) {
1912
-                $this->_fields[] = $new_field;
1913
-            } else {
1914
-                return $new_field;
1915
-            }
1916
-        }
1917
-
1918
-        /**
1919
-         *  Add posts Field to meta box
1920
-         * @author Ohad Raz
1921
-         * @since 1.0
1922
-         * @access public
1923
-         * @param $id string  field id, i.e. the meta key
1924
-         * @param $options mixed|array options of taxonomy field
1925
-         *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1926
-         * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1927
-         * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1928
-         * @param $args mixed|array
1929
-         *    'name' => // field name/label string optional
1930
-         *    'desc' => // field description, string optional
1931
-         *    'std' => // default value, string optional
1932
-         *    'validate_func' => // validate function, string optional
1933
-         * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1934
-         */
1935
-        public function addPosts($id, $options, $args, $repeater = false)
1936
-        {
1937
-            $q = array('posts_per_page' => -1);
1938
-            $temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1939
-            $options = array_merge($temp, $options);
1940
-            $new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1941
-            $new_field = array_merge($new_field, $args);
1942
-            if (false === $repeater) {
1943
-                $this->_fields[] = $new_field;
1944
-            } else {
1945
-                return $new_field;
1946
-            }
1947
-        }
1948
-
1949
-        /**
1950
-         *  Add repeater Field Block to meta box
1951
-         * @author Ohad Raz
1952
-         * @since 1.0
1953
-         * @access public
1954
-         * @param $id string  field id, i.e. the meta key
1955
-         * @param $args mixed|array
1956
-         *    'name' => // field name/label string optional
1957
-         *    'desc' => // field description, string optional
1958
-         *    'std' => // default value, string optional
1959
-         *    'style' =>    // custom style for field, string optional
1960
-         *    'validate_func' => // validate function, string optional
1961
-         *    'fields' => //fields to repeater
1962
-         */
1963
-        public function addRepeaterBlock($id, $args)
1964
-        {
1965
-            $new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1966
-            $new_field = array_merge($new_field, $args);
1967
-            $this->_fields[] = $new_field;
1968
-        }
1969
-
1970
-
1971
-        /**
1972
-         * Finish Declaration of Meta Box
1973
-         * @author Ohad Raz
1974
-         * @since 1.0
1975
-         * @access public
1976
-         */
1977
-        public function Finish()
1978
-        {
1979
-            $this->add_missed_values();
1980
-            $this->check_field_upload();
1981
-            $this->check_field_color();
1982
-            $this->check_field_date();
1983
-            $this->check_field_time();
1984
-        }
1985
-
1986
-        /**
1987
-         * Helper function to check for empty arrays
1988
-         * @author Ohad Raz
1989
-         * @since 1.0
1990
-         * @access public
1991
-         * @param $args mixed|array
1992
-         */
1993
-        public function is_array_empty($array)
1994
-        {
1995
-            if (!is_array($array))
1996
-                return true;
1997
-
1998
-            foreach ($array as $a) {
1999
-                if (is_array($a)) {
2000
-                    foreach ($a as $sub_a) {
2001
-                        if (!empty($sub_a) && $sub_a != '')
2002
-                            return false;
2003
-                    }
2004
-                } else {
2005
-                    if (!empty($a) && $a != '')
2006
-                        return false;
2007
-                }
2008
-            }
2009
-            return true;
2010
-        }
2011
-
2012
-
2013
-        //get term meta field
2014
-        public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2015
-        {
2016
-
2017
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2018
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2019
-                $post_type = $taxObject->object_type[0];
2020
-            }
2021
-
2022
-            if($post_type=='post'){$post_type='';}
2023
-            if($post_type){$post_type = $post_type.'_';}
2024
-
2025
-            $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026
-
2027
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2028
-            if (isset($m[$key])) {
2029
-                return $m[$key];
2030
-            } else {
2031
-                return '';
2032
-            }
2033
-        }
2034
-
2035
-        //delete meta
2036
-        public function delete_tax_meta($term_id, $key, $post_type = '')
2037
-        {
2038
-
2039
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2040
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2041
-                $post_type = $taxObject->object_type[0];
2042
-            }
2043
-
2044
-            if($post_type=='post'){$post_type='';}
2045
-            if($post_type){$post_type = $post_type.'_';}
2046
-
2047
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2048
-
2049
-            if (isset($m[$key])) {
2050
-                unset($m[$key]);
2051
-            }
2052
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
-        }
2054
-
2055
-        //update meta
2056
-        public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
-        {
2058
-
2059
-            if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
-                $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
-                $post_type = $taxObject->object_type[0];
2062
-            }
2063
-
2064
-            if($post_type=='post'){$post_type='';}
2065
-            if($post_type){$post_type = $post_type.'_';}
2066
-
2067
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2068
-
2069
-            $m[$key] = $value;
2070
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
-
2072
-            /**
2073
-             * Called after the tax meta is updated.
2074
-             *
2075
-             * Used to update things after a GD category is saved.
2076
-             *
2077
-             * @since 1.0.0
2078
-             * @param bool $false False.
2079
-             * @param bool $true True.
2080
-             * @param int $term_id The term id being updated.
2081
-             * @param string $post_type The post type of the cat being updated.
2082
-             */
2083
-            do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
-        }
2085
-
2086
-
2087
-    } // End Class
1288
+		public function save_field_wysiwyg($term_id, $field, $old, $new)
1289
+		{
1290
+			$this->save_field($term_id, $field, $old, $new);
1291
+		}
1292
+
1293
+		/**
1294
+		 * Save repeater Fields.
1295
+		 *
1296
+		 * @param string $term_id The term ID.
1297
+		 * @param string $field
1298
+		 * @param string|mixed $old
1299
+		 * @param string|mixed $new
1300
+		 * @since 1.0
1301
+		 * @access public
1302
+		 */
1303
+		public function save_field_repeater($term_id, $field, $old, $new)
1304
+		{
1305
+			if (is_array($new) && count($new) > 0) {
1306
+				foreach ($new as $n) {
1307
+					foreach ($field['fields'] as $f) {
1308
+						$type = $f['type'];
1309
+						switch ($type) {
1310
+							case 'wysiwyg':
1311
+								$n[$f['id']] = wpautop($n[$f['id']]);
1312
+								break;
1313
+							case 'file':
1314
+								$n[$f['id']] = $this->save_field_file_repeater($term_id, $f, '', $n[$f['id']]);
1315
+								break;
1316
+							default:
1317
+								break;
1318
+						}
1319
+					}
1320
+					if (!$this->is_array_empty($n))
1321
+						$temp[] = $n;
1322
+				}
1323
+				if (isset($temp) && count($temp) > 0 && !$this->is_array_empty($temp)) {
1324
+					$this->update_tax_meta($term_id, $field['id'], $temp);
1325
+				} else {
1326
+					//	remove old meta if exists
1327
+					delete_post_meta($term_id, $field['id']);
1328
+				}
1329
+			} else {
1330
+				//	remove old meta if exists
1331
+				delete_post_meta($term_id, $field['id']);
1332
+			}
1333
+		}
1334
+
1335
+		/**
1336
+		 * Save File Field.
1337
+		 *
1338
+		 * @param string $term_id The term ID.
1339
+		 * @param string $field
1340
+		 * @param string $old
1341
+		 * @param string $new
1342
+		 * @since 1.0
1343
+		 * @access public
1344
+		 */
1345
+		public function save_field_file($term_id, $field, $old, $new)
1346
+		{
1347
+
1348
+			$name = $field['id'];
1349
+			if (empty($_FILES[$name]))
1350
+				return;
1351
+			$this->fix_file_array($_FILES[$name]);
1352
+			foreach ($_FILES[$name] as $position => $fileitem) {
1353
+
1354
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1355
+				if (empty($file['file']))
1356
+					continue;
1357
+				$filename = $file['file'];
1358
+
1359
+				$attachment = array(
1360
+					'post_mime_type' => $file['type'],
1361
+					'guid' => $file['url'],
1362
+					'post_parent' => $term_id,
1363
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1364
+					'post_content' => ''
1365
+				);
1366
+
1367
+				$id = wp_insert_attachment($attachment, $filename, $term_id);
1368
+
1369
+				if (!is_wp_error($id)) {
1370
+
1371
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
+					add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1373
+
1374
+				} // End if
1375
+
1376
+			} // End foreach
1377
+
1378
+		}
1379
+
1380
+		/**
1381
+		 * Save repeater File Field.
1382
+		 * @param string $term_id The term ID.
1383
+		 * @param string $field
1384
+		 * @param string $old
1385
+		 * @param string $new
1386
+		 * @since 1.0
1387
+		 * @access public
1388
+		 * @return int|void
1389
+		 */
1390
+		public function save_field_file_repeater($term_id, $field, $old, $new)
1391
+		{
1392
+
1393
+			$name = $field['id'];
1394
+			if (empty($_FILES[$name]))
1395
+				return;
1396
+			$this->fix_file_array($_FILES[$name]);
1397
+			foreach ($_FILES[$name] as $position => $fileitem) {
1398
+
1399
+				$file = wp_handle_upload($fileitem, array('test_form' => false));
1400
+				if (empty($file['file']))
1401
+					continue;
1402
+				$filename = $file['file'];
1403
+
1404
+				$attachment = array(
1405
+					'post_mime_type' => $file['type'],
1406
+					'guid' => $file['url'],
1407
+					'post_parent' => $term_id,
1408
+					'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
1409
+					'post_content' => ''
1410
+				);
1411
+
1412
+				$id = wp_insert_attachment($attachment, $filename);
1413
+
1414
+				if (!is_wp_error($id)) {
1415
+
1416
+					wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
+					return $id;    // return file's url in meta fields
1418
+				} // End if
1419
+			} // End foreach
1420
+		}
1421
+
1422
+		/**
1423
+		 * Add missed values for meta box.
1424
+		 *
1425
+		 * @since 1.0
1426
+		 * @access public
1427
+		 */
1428
+		public function add_missed_values()
1429
+		{
1430
+
1431
+			// Default values for meta box
1432
+			$this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1433
+
1434
+			if(is_array($this->_fields)) {
1435
+				// Default values for fields
1436
+				foreach ($this->_fields as &$field) {
1437
+					$multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
1438
+					$std = $multiple ? array() : '';
1439
+					$format = 'date' == $field['type'] ? 'yy-mm-dd' : ('time' == $field['type'] ? 'hh:mm' : '');
1440
+					$field = array_merge(array('multiple' => $multiple, 'std' => $std, 'desc' => '', 'format' => $format, 'validate_func' => ''), $field);
1441
+				} // End foreach
1442
+			}
1443
+		}
1444
+
1445
+		/**
1446
+		 * Check if field with $type exists.
1447
+		 *
1448
+		 * @param string $type
1449
+		 * @since 1.0
1450
+		 * @access public
1451
+		 */
1452
+		public function has_field($type)
1453
+		{
1454
+			if(is_array($this->_fields)) {
1455
+				foreach ($this->_fields as $field) {
1456
+					if ($type == $field['type'])
1457
+						return true;
1458
+				}
1459
+			}
1460
+			return false;
1461
+		}
1462
+
1463
+		/**
1464
+		 * Check if current page is edit page.
1465
+		 *
1466
+		 * @since 1.0
1467
+		 * @access public
1468
+		 */
1469
+		public function is_edit_page()
1470
+		{
1471
+			global $pagenow;
1472
+			return ($pagenow == 'edit-tags.php' || $pagenow == 'term.php');
1473
+		}
1474
+
1475
+		/**
1476
+		 * Fixes the odd indexing of multiple file uploads.
1477
+		 *
1478
+		 * Goes from the format:
1479
+		 * $_FILES['field']['key']['index']
1480
+		 * to
1481
+		 * The More standard and appropriate:
1482
+		 * $_FILES['field']['index']['key']
1483
+		 *
1484
+		 * @param string $files
1485
+		 * @since 1.0
1486
+		 * @access public
1487
+		 */
1488
+		public function fix_file_array(&$files)
1489
+		{
1490
+
1491
+			$output = array();
1492
+
1493
+			foreach ($files as $key => $list) {
1494
+				foreach ($list as $index => $value) {
1495
+					$output[$index][$key] = $value;
1496
+				}
1497
+			}
1498
+
1499
+			return $files = $output;
1500
+
1501
+		}
1502
+
1503
+		/**
1504
+		 * Get proper JQuery UI version.
1505
+		 *
1506
+		 * Used in order to not conflict with WP Admin Scripts.
1507
+		 *
1508
+		 * @since 1.0
1509
+		 * @access public
1510
+		 */
1511
+		public function get_jqueryui_ver()
1512
+		{
1513
+
1514
+			global $wp_version;
1515
+
1516
+			if (version_compare($wp_version, '3.1', '>=')) {
1517
+				return '1.8.10';
1518
+			}
1519
+
1520
+			return '1.7.3';
1521
+
1522
+		}
1523
+
1524
+		/**
1525
+		 *  Add Field to meta box (generic function)
1526
+		 * @author Ohad Raz
1527
+		 * @since 1.0
1528
+		 * @access public
1529
+		 * @param $id string  field id, i.e. the meta key
1530
+		 * @param $args mixed|array
1531
+		 */
1532
+		public function addField($id, $args)
1533
+		{
1534
+			$new_field = array('id' => $id, 'std' => '', 'desc' => '', 'style' => '');
1535
+			$new_field = array_merge($new_field, $args);
1536
+			$this->_fields[] = $new_field;
1537
+		}
1538
+
1539
+
1540
+		/**
1541
+		 *  Add Text Field to meta box
1542
+		 * @author Ohad Raz
1543
+		 * @since 1.0
1544
+		 * @access public
1545
+		 * @param $id string  field id, i.e. the meta key
1546
+		 * @param $args mixed|array
1547
+		 *    'name' => // field name/label string optional
1548
+		 *    'desc' => // field description, string optional
1549
+		 *    'std' => // default value, string optional
1550
+		 *    'style' =>    // custom style for field, string optional
1551
+		 *    'validate_func' => // validate function, string optional
1552
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1553
+		 */
1554
+		public function addText($id, $args, $repeater = false)
1555
+		{
1556
+			$new_field = array('type' => 'text', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1557
+			$new_field = array_merge($new_field, $args);
1558
+			if (false === $repeater) {
1559
+				$this->_fields[] = $new_field;
1560
+			} else {
1561
+				return $new_field;
1562
+			}
1563
+		}
1564
+
1565
+		/**
1566
+		 *  Add Hidden Field to meta box
1567
+		 * @author Ohad Raz
1568
+		 * @since 0.1.3
1569
+		 * @access public
1570
+		 * @param $id string  field id, i.e. the meta key
1571
+		 * @param $args mixed|array
1572
+		 *    'name' => // field name/label string optional
1573
+		 *    'desc' => // field description, string optional
1574
+		 *    'std' => // default value, string optional
1575
+		 *    'style' =>    // custom style for field, string optional
1576
+		 *    'validate_func' => // validate function, string optional
1577
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1578
+		 */
1579
+		public function addHidden($id, $args, $repeater = false)
1580
+		{
1581
+			$new_field = array('type' => 'hidden', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Text Field', 'geodirectory'));
1582
+			$new_field = array_merge($new_field, $args);
1583
+			if (false === $repeater) {
1584
+				$this->_fields[] = $new_field;
1585
+			} else {
1586
+				return $new_field;
1587
+			}
1588
+		}
1589
+
1590
+		/**
1591
+		 *  Add Paragraph to meta box
1592
+		 * @author Ohad Raz
1593
+		 * @since 0.1.3
1594
+		 * @access public
1595
+		 * @param $id string  field id, i.e. the meta key
1596
+		 * @param $value  paragraph html
1597
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1598
+		 */
1599
+		public function addParagraph($id, $args, $repeater = false)
1600
+		{
1601
+			$new_field = array('type' => 'paragraph', 'id' => $id, 'value' => '', 'style' => '');
1602
+			$new_field = array_merge($new_field, $args);
1603
+			if (false === $repeater) {
1604
+				$this->_fields[] = $new_field;
1605
+			} else {
1606
+				return $new_field;
1607
+			}
1608
+		}
1609
+
1610
+		/**
1611
+		 *  Add Checkbox Field to meta box
1612
+		 * @author Ohad Raz
1613
+		 * @since 1.0
1614
+		 * @access public
1615
+		 * @param $id string  field id, i.e. the meta key
1616
+		 * @param $args mixed|array
1617
+		 *    'name' => // field name/label string optional
1618
+		 *    'desc' => // field description, string optional
1619
+		 *    'std' => // default value, string optional
1620
+		 *    'validate_func' => // validate function, string optional
1621
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1622
+		 */
1623
+		public function addCheckbox($id, $args, $repeater = false)
1624
+		{
1625
+			$new_field = array('type' => 'checkbox', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox Field', 'geodirectory'));
1626
+			$new_field = array_merge($new_field, $args);
1627
+			if (false === $repeater) {
1628
+				$this->_fields[] = $new_field;
1629
+			} else {
1630
+				return $new_field;
1631
+			}
1632
+		}
1633
+
1634
+		/**
1635
+		 *  Add CheckboxList Field to meta box
1636
+		 * @author Ohad Raz
1637
+		 * @since 1.0
1638
+		 * @access public
1639
+		 * @param $id string  field id, i.e. the meta key
1640
+		 * @param $options (array)  array of key => value pairs for select options
1641
+		 * @param $args mixed|array
1642
+		 *    'name' => // field name/label string optional
1643
+		 *    'desc' => // field description, string optional
1644
+		 *    'std' => // default value, string optional
1645
+		 *    'validate_func' => // validate function, string optional
1646
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1647
+		 *
1648
+		 * @return : remember to call: $checkbox_list = $this->get_tax_meta(get_the_ID(), 'meta_name', false);
1649
+		 *   which means the last param as false to get the values in an array
1650
+		 */
1651
+		public function addCheckboxList($id, $options, $args, $repeater = false)
1652
+		{
1653
+			$new_field = array('type' => 'checkbox_list', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Checkbox List Field', 'geodirectory'));
1654
+			$new_field = array_merge($new_field, $args);
1655
+			if (false === $repeater) {
1656
+				$this->_fields[] = $new_field;
1657
+			} else {
1658
+				return $new_field;
1659
+			}
1660
+		}
1661
+
1662
+		/**
1663
+		 *  Add Textarea Field to meta box
1664
+		 * @author Ohad Raz
1665
+		 * @since 1.0
1666
+		 * @access public
1667
+		 * @param $id string  field id, i.e. the meta key
1668
+		 * @param $args mixed|array
1669
+		 *    'name' => // field name/label string optional
1670
+		 *    'desc' => // field description, string optional
1671
+		 *    'std' => // default value, string optional
1672
+		 *    'style' =>    // custom style for field, string optional
1673
+		 *    'validate_func' => // validate function, string optional
1674
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1675
+		 */
1676
+		public function addTextarea($id, $args, $repeater = false)
1677
+		{
1678
+			$new_field = array('type' => 'textarea', 'id' => $id, 'std' => '', 'desc' => '', 'style' => '', 'name' => __('Textarea Field', 'geodirectory'));
1679
+			$new_field = array_merge($new_field, $args);
1680
+			if (false === $repeater) {
1681
+				$this->_fields[] = $new_field;
1682
+			} else {
1683
+				return $new_field;
1684
+			}
1685
+		}
1686
+
1687
+		/**
1688
+		 *  Add Select Field to meta box
1689
+		 * @author Ohad Raz
1690
+		 * @since 1.0
1691
+		 * @access public
1692
+		 * @param $id string field id, i.e. the meta key
1693
+		 * @param $options (array)  array of key => value pairs for select options
1694
+		 * @param $args mixed|array
1695
+		 *    'name' => // field name/label string optional
1696
+		 *    'desc' => // field description, string optional
1697
+		 *    'std' => // default value, (array) optional
1698
+		 *    'multiple' => // select multiple values, optional. Default is false.
1699
+		 *    'validate_func' => // validate function, string optional
1700
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1701
+		 */
1702
+		public function addSelect($id, $options, $args, $repeater = false)
1703
+		{
1704
+			$new_field = array('type' => 'select', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Select Field', 'geodirectory'), 'multiple' => false, 'options' => $options);
1705
+			$new_field = array_merge($new_field, $args);
1706
+			if (false === $repeater) {
1707
+				$this->_fields[] = $new_field;
1708
+			} else {
1709
+				return $new_field;
1710
+			}
1711
+		}
1712
+
1713
+
1714
+		/**
1715
+		 *  Add Radio Field to meta box
1716
+		 * @author Ohad Raz
1717
+		 * @since 1.0
1718
+		 * @access public
1719
+		 * @param $id string field id, i.e. the meta key
1720
+		 * @param $options (array)  array of key => value pairs for radio options
1721
+		 * @param $args mixed|array
1722
+		 *    'name' => // field name/label string optional
1723
+		 *    'desc' => // field description, string optional
1724
+		 *    'std' => // default value, string optional
1725
+		 *    'validate_func' => // validate function, string optional
1726
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1727
+		 */
1728
+		public function addRadio($id, $options, $args, $repeater = false)
1729
+		{
1730
+			$new_field = array('type' => 'radio', 'id' => $id, 'std' => array(), 'desc' => '', 'style' => '', 'name' => __('Radio Field', 'geodirectory'), 'options' => $options);
1731
+			$new_field = array_merge($new_field, $args);
1732
+			if (false === $repeater) {
1733
+				$this->_fields[] = $new_field;
1734
+			} else {
1735
+				return $new_field;
1736
+			}
1737
+		}
1738
+
1739
+		/**
1740
+		 *  Add Date Field to meta box
1741
+		 * @author Ohad Raz
1742
+		 * @since 1.0
1743
+		 * @access public
1744
+		 * @param $id string  field id, i.e. the meta key
1745
+		 * @param $args mixed|array
1746
+		 *    'name' => // field name/label string optional
1747
+		 *    'desc' => // field description, string optional
1748
+		 *    'std' => // default value, string optional
1749
+		 *    'validate_func' => // validate function, string optional
1750
+		 *    'format' => // date format, default yy-mm-dd. Optional. Default "'d MM, yy'"  See more formats here: http://goo.gl/Wcwxn
1751
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1752
+		 */
1753
+		public function addDate($id, $args, $repeater = false)
1754
+		{
1755
+			$new_field = array('type' => 'date', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'yy-mm-dd', 'name' => __('Date Field', 'geodirectory'));
1756
+			$new_field = array_merge($new_field, $args);
1757
+			if (false === $repeater) {
1758
+				$this->_fields[] = $new_field;
1759
+			} else {
1760
+				return $new_field;
1761
+			}
1762
+		}
1763
+
1764
+		/**
1765
+		 *  Add Time Field to meta box
1766
+		 * @author Ohad Raz
1767
+		 * @since 1.0
1768
+		 * @access public
1769
+		 * @param $id string- field id, i.e. the meta key
1770
+		 * @param $args mixed|array
1771
+		 *    'name' => // field name/label string optional
1772
+		 *    'desc' => // field description, string optional
1773
+		 *    'std' => // default value, string optional
1774
+		 *    'validate_func' => // validate function, string optional
1775
+		 *    'format' => // time format, default hh:mm. Optional. See more formats here: http://goo.gl/83woX
1776
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1777
+		 */
1778
+		public function addTime($id, $args, $repeater = false)
1779
+		{
1780
+			$new_field = array('type' => 'time', 'id' => $id, 'std' => '', 'desc' => '', 'format' => 'hh:mm', 'name' => __('Time Field', 'geodirectory'));
1781
+			$new_field = array_merge($new_field, $args);
1782
+			if (false === $repeater) {
1783
+				$this->_fields[] = $new_field;
1784
+			} else {
1785
+				return $new_field;
1786
+			}
1787
+		}
1788
+
1789
+		/**
1790
+		 *  Add Color Field to meta box
1791
+		 * @author Ohad Raz
1792
+		 * @since 1.0
1793
+		 * @access public
1794
+		 * @param $id string  field id, i.e. the meta key
1795
+		 * @param $args mixed|array
1796
+		 *    'name' => // field name/label string optional
1797
+		 *    'desc' => // field description, string optional
1798
+		 *    'std' => // default value, string optional
1799
+		 *    'validate_func' => // validate function, string optional
1800
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1801
+		 */
1802
+		public function addColor($id, $args, $repeater = false)
1803
+		{
1804
+			$new_field = array('type' => 'color', 'id' => $id, 'std' => '', 'desc' => '', 'name' => __('ColorPicker Field', 'geodirectory'));
1805
+			$new_field = array_merge($new_field, $args);
1806
+			if (false === $repeater) {
1807
+				$this->_fields[] = $new_field;
1808
+			} else {
1809
+				return $new_field;
1810
+			}
1811
+		}
1812
+
1813
+		/**
1814
+		 *  Add Image Field to meta box
1815
+		 * @author Ohad Raz
1816
+		 * @since 1.0
1817
+		 * @access public
1818
+		 * @param $id string  field id, i.e. the meta key
1819
+		 * @param $args mixed|array
1820
+		 *    'name' => // field name/label string optional
1821
+		 *    'desc' => // field description, string optional
1822
+		 *    'validate_func' => // validate function, string optional
1823
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1824
+		 */
1825
+		public function addImage($id, $args, $repeater = false)
1826
+		{
1827
+			$new_field = array('type' => 'image', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('Image Field', 'geodirectory'));
1828
+			$new_field = array_merge($new_field, $args);
1829
+
1830
+			if (false === $repeater) {
1831
+				$this->_fields[] = $new_field;
1832
+			} else {
1833
+				return $new_field;
1834
+			}
1835
+		}
1836
+
1837
+		/**
1838
+		 *  Add File Field to meta box
1839
+		 * @author Ohad Raz
1840
+		 * @since 1.0
1841
+		 * @access public
1842
+		 * @param $id string  field id, i.e. the meta key
1843
+		 * @param $args mixed|array
1844
+		 *    'name' => // field name/label string optional
1845
+		 *    'desc' => // field description, string optional
1846
+		 *    'validate_func' => // validate function, string optional
1847
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1848
+		 */
1849
+		public function addFile($id, $args, $repeater = false)
1850
+		{
1851
+			$new_field = array('type' => 'file', 'id' => $id, 'desc' => '', 'style' => '', 'name' => __('File Field', 'geodirectory'));
1852
+			$new_field = array_merge($new_field, $args);
1853
+			if (false === $repeater) {
1854
+				$this->_fields[] = $new_field;
1855
+			} else {
1856
+				return $new_field;
1857
+			}
1858
+		}
1859
+
1860
+		/**
1861
+		 *  Add WYSIWYG Field to meta box
1862
+		 * @author Ohad Raz
1863
+		 * @since 1.0
1864
+		 * @access public
1865
+		 * @param $id string  field id, i.e. the meta key
1866
+		 * @param $args mixed|array
1867
+		 *    'name' => // field name/label string optional
1868
+		 *    'desc' => // field description, string optional
1869
+		 *    'std' => // default value, string optional
1870
+		 *    'style' =>    // custom style for field, string optional Default 'width: 300px; height: 400px'
1871
+		 *    'validate_func' => // validate function, string optional
1872
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1873
+		 */
1874
+		public function addWysiwyg($id, $args, $repeater = false)
1875
+		{
1876
+			$new_field = array('type' => 'wysiwyg', 'id' => $id, 'std' => '', 'desc' => '', 'style' => 'width: 300px; height: 400px', 'name' => __('WYSIWYG Editor Field', 'geodirectory'));
1877
+			$new_field = array_merge($new_field, $args);
1878
+			if (false === $repeater) {
1879
+				$this->_fields[] = $new_field;
1880
+			} else {
1881
+				return $new_field;
1882
+			}
1883
+		}
1884
+
1885
+		/**
1886
+		 *  Add Taxonomy Field to meta box
1887
+		 * @author Ohad Raz
1888
+		 * @since 1.0
1889
+		 * @access public
1890
+		 * @param $id string  field id, i.e. the meta key
1891
+		 * @param $options mixed|array options of taxonomy field
1892
+		 *    'taxonomy' =>    // taxonomy name can be category,post_tag or any custom taxonomy default is category
1893
+		 * 'type' =>  // how to show taxonomy? 'select' (default) or 'checkbox_list'
1894
+		 * 'args' =>  // arguments to query taxonomy, see http://goo.gl/uAANN default ('hide_empty' => false)
1895
+		 * @param $args mixed|array
1896
+		 *    'name' => // field name/label string optional
1897
+		 *    'desc' => // field description, string optional
1898
+		 *    'std' => // default value, string optional
1899
+		 *    'validate_func' => // validate function, string optional
1900
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1901
+		 */
1902
+		public function addTaxonomy($id, $options, $args, $repeater = false)
1903
+		{
1904
+			$q = array('hide_empty' => 0);
1905
+			$tax = 'category';
1906
+			$type = 'select';
1907
+			$temp = array($tax, $type, $q);
1908
+			$options = array_merge($temp, $options);
1909
+			$new_field = array('type' => 'taxonomy', 'id' => $id, 'desc' => '', 'name' => __('Taxonomy Field', 'geodirectory'), 'options' => $options);
1910
+			$new_field = array_merge($new_field, $args);
1911
+			if (false === $repeater) {
1912
+				$this->_fields[] = $new_field;
1913
+			} else {
1914
+				return $new_field;
1915
+			}
1916
+		}
1917
+
1918
+		/**
1919
+		 *  Add posts Field to meta box
1920
+		 * @author Ohad Raz
1921
+		 * @since 1.0
1922
+		 * @access public
1923
+		 * @param $id string  field id, i.e. the meta key
1924
+		 * @param $options mixed|array options of taxonomy field
1925
+		 *    'post_type' =>    // post type name, 'post' (default) 'page' or any custom post type
1926
+		 * 'type' =>  // how to show posts? 'select' (default) or 'checkbox_list'
1927
+		 * 'args' =>  // arguments to query posts, see http://goo.gl/is0yK default ('posts_per_page' => -1)
1928
+		 * @param $args mixed|array
1929
+		 *    'name' => // field name/label string optional
1930
+		 *    'desc' => // field description, string optional
1931
+		 *    'std' => // default value, string optional
1932
+		 *    'validate_func' => // validate function, string optional
1933
+		 * @param $repeater bool  is this a field inside a repeatr? true|false(default)
1934
+		 */
1935
+		public function addPosts($id, $options, $args, $repeater = false)
1936
+		{
1937
+			$q = array('posts_per_page' => -1);
1938
+			$temp = array('post_type' => 'post', 'type' => 'select', 'args' => $q);
1939
+			$options = array_merge($temp, $options);
1940
+			$new_field = array('type' => 'posts', 'id' => $id, 'desc' => '', 'name' => __('Posts Field', 'geodirectory'), 'options' => $options);
1941
+			$new_field = array_merge($new_field, $args);
1942
+			if (false === $repeater) {
1943
+				$this->_fields[] = $new_field;
1944
+			} else {
1945
+				return $new_field;
1946
+			}
1947
+		}
1948
+
1949
+		/**
1950
+		 *  Add repeater Field Block to meta box
1951
+		 * @author Ohad Raz
1952
+		 * @since 1.0
1953
+		 * @access public
1954
+		 * @param $id string  field id, i.e. the meta key
1955
+		 * @param $args mixed|array
1956
+		 *    'name' => // field name/label string optional
1957
+		 *    'desc' => // field description, string optional
1958
+		 *    'std' => // default value, string optional
1959
+		 *    'style' =>    // custom style for field, string optional
1960
+		 *    'validate_func' => // validate function, string optional
1961
+		 *    'fields' => //fields to repeater
1962
+		 */
1963
+		public function addRepeaterBlock($id, $args)
1964
+		{
1965
+			$new_field = array('type' => 'repeater', 'id' => $id, 'name' => __('Reapeater Field', 'geodirectory'), 'fields' => array(), 'inline' => false);
1966
+			$new_field = array_merge($new_field, $args);
1967
+			$this->_fields[] = $new_field;
1968
+		}
1969
+
1970
+
1971
+		/**
1972
+		 * Finish Declaration of Meta Box
1973
+		 * @author Ohad Raz
1974
+		 * @since 1.0
1975
+		 * @access public
1976
+		 */
1977
+		public function Finish()
1978
+		{
1979
+			$this->add_missed_values();
1980
+			$this->check_field_upload();
1981
+			$this->check_field_color();
1982
+			$this->check_field_date();
1983
+			$this->check_field_time();
1984
+		}
1985
+
1986
+		/**
1987
+		 * Helper function to check for empty arrays
1988
+		 * @author Ohad Raz
1989
+		 * @since 1.0
1990
+		 * @access public
1991
+		 * @param $args mixed|array
1992
+		 */
1993
+		public function is_array_empty($array)
1994
+		{
1995
+			if (!is_array($array))
1996
+				return true;
1997
+
1998
+			foreach ($array as $a) {
1999
+				if (is_array($a)) {
2000
+					foreach ($a as $sub_a) {
2001
+						if (!empty($sub_a) && $sub_a != '')
2002
+							return false;
2003
+					}
2004
+				} else {
2005
+					if (!empty($a) && $a != '')
2006
+						return false;
2007
+				}
2008
+			}
2009
+			return true;
2010
+		}
2011
+
2012
+
2013
+		//get term meta field
2014
+		public function get_tax_meta($term_id, $key, $multi = false, $post_type = '')
2015
+		{
2016
+
2017
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2018
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2019
+				$post_type = $taxObject->object_type[0];
2020
+			}
2021
+
2022
+			if($post_type=='post'){$post_type='';}
2023
+			if($post_type){$post_type = $post_type.'_';}
2024
+
2025
+			$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026
+
2027
+			$m = get_option('tax_meta_' . $post_type  . $t_id);
2028
+			if (isset($m[$key])) {
2029
+				return $m[$key];
2030
+			} else {
2031
+				return '';
2032
+			}
2033
+		}
2034
+
2035
+		//delete meta
2036
+		public function delete_tax_meta($term_id, $key, $post_type = '')
2037
+		{
2038
+
2039
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2040
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2041
+				$post_type = $taxObject->object_type[0];
2042
+			}
2043
+
2044
+			if($post_type=='post'){$post_type='';}
2045
+			if($post_type){$post_type = $post_type.'_';}
2046
+
2047
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2048
+
2049
+			if (isset($m[$key])) {
2050
+				unset($m[$key]);
2051
+			}
2052
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2053
+		}
2054
+
2055
+		//update meta
2056
+		public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057
+		{
2058
+
2059
+			if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2060
+				$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2061
+				$post_type = $taxObject->object_type[0];
2062
+			}
2063
+
2064
+			if($post_type=='post'){$post_type='';}
2065
+			if($post_type){$post_type = $post_type.'_';}
2066
+
2067
+			$m = get_option('tax_meta_' . $post_type  . $term_id);
2068
+
2069
+			$m[$key] = $value;
2070
+			update_option('tax_meta_' . $post_type  . $term_id, $m);
2071
+
2072
+			/**
2073
+			 * Called after the tax meta is updated.
2074
+			 *
2075
+			 * Used to update things after a GD category is saved.
2076
+			 *
2077
+			 * @since 1.0.0
2078
+			 * @param bool $false False.
2079
+			 * @param bool $true True.
2080
+			 * @param int $term_id The term id being updated.
2081
+			 * @param string $post_type The post type of the cat being updated.
2082
+			 */
2083
+			do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2084
+		}
2085
+
2086
+
2087
+	} // End Class
2088 2088
 
2089 2089
 endif; // End Check Class Exists
2090 2090
 
@@ -2094,79 +2094,79 @@  discard block
 block discarded – undo
2094 2094
 
2095 2095
 //get term meta field
2096 2096
 if (!function_exists('geodir_get_tax_meta')) {
2097
-    function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2097
+	function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2100 2100
             
2101
-            if (!empty($taxObject->object_type)) {
2102
-                $post_type = $taxObject->object_type[0];
2103
-            }
2104
-        }
2105
-
2106
-        if ($post_type == 'post') {
2107
-            $post_type = '';
2108
-        }
2109
-        if ($post_type) {
2110
-            $post_type = $post_type . '_';
2111
-        }
2112
-
2113
-        $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114
-
2115
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2116
-        if (isset($m[$key])) {
2117
-            return $m[$key];
2118
-        } else {
2119
-            return '';
2120
-        }
2121
-    }
2101
+			if (!empty($taxObject->object_type)) {
2102
+				$post_type = $taxObject->object_type[0];
2103
+			}
2104
+		}
2105
+
2106
+		if ($post_type == 'post') {
2107
+			$post_type = '';
2108
+		}
2109
+		if ($post_type) {
2110
+			$post_type = $post_type . '_';
2111
+		}
2112
+
2113
+		$t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114
+
2115
+		$m = get_option('tax_meta_' . $post_type  . $t_id);
2116
+		if (isset($m[$key])) {
2117
+			return $m[$key];
2118
+		} else {
2119
+			return '';
2120
+		}
2121
+	}
2122 2122
 }
2123 2123
 
2124 2124
 //delete meta
2125 2125
 if (!function_exists('geodir_delete_tax_meta')) {
2126
-    function geodir_delete_tax_meta($term_id, $key) {
2127
-        $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2128
-        $post_type = !empty($taxObject->object_type) ? $taxObject->object_type[0] : '';
2129
-
2130
-        if ($post_type == 'post') {
2131
-            $post_type = '';
2132
-        }
2133
-        if ($post_type) {
2134
-            $post_type = $post_type . '_';
2135
-        }
2136
-
2137
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2138
-
2139
-        if (isset($m[$key])) {
2140
-            unset($m[$key]);
2141
-        }
2142
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2143
-    }
2126
+	function geodir_delete_tax_meta($term_id, $key) {
2127
+		$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2128
+		$post_type = !empty($taxObject->object_type) ? $taxObject->object_type[0] : '';
2129
+
2130
+		if ($post_type == 'post') {
2131
+			$post_type = '';
2132
+		}
2133
+		if ($post_type) {
2134
+			$post_type = $post_type . '_';
2135
+		}
2136
+
2137
+		$m = get_option('tax_meta_' . $post_type . $term_id);
2138
+
2139
+		if (isset($m[$key])) {
2140
+			unset($m[$key]);
2141
+		}
2142
+		update_option('tax_meta_' . $post_type  . $term_id, $m);
2143
+	}
2144 2144
 }
2145 2145
 
2146 2146
 //update meta
2147 2147
 if (!function_exists('geodir_update_tax_meta')) {
2148
-    function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149
-        if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150
-            $taxObject = get_taxonomy($_REQUEST['taxonomy']);
2148
+	function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149
+		if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150
+			$taxObject = get_taxonomy($_REQUEST['taxonomy']);
2151 2151
             
2152
-            if (!empty($taxObject->object_type)) {
2153
-                $post_type = $taxObject->object_type[0];
2154
-            }
2155
-        }
2156
-
2157
-        if ($post_type == 'post') {
2158
-            $post_type = '';
2159
-        }
2160
-        if ($post_type) {
2161
-            $post_type = $post_type . '_';
2162
-        }
2163
-
2164
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2165
-
2166
-        $m[$key] = $value;
2167
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2168
-
2169
-        /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170
-        do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2171
-    }
2152
+			if (!empty($taxObject->object_type)) {
2153
+				$post_type = $taxObject->object_type[0];
2154
+			}
2155
+		}
2156
+
2157
+		if ($post_type == 'post') {
2158
+			$post_type = '';
2159
+		}
2160
+		if ($post_type) {
2161
+			$post_type = $post_type . '_';
2162
+		}
2163
+
2164
+		$m = get_option('tax_meta_' . $post_type  . $term_id);
2165
+
2166
+		$m[$key] = $value;
2167
+		update_option('tax_meta_' . $post_type . $term_id, $m);
2168
+
2169
+		/** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170
+		do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
2171
+	}
2172 2172
 }
2173 2173
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             $this->add_missed_values();
114 114
             if (isset($meta_box['use_with_theme']))
115 115
                 if ($meta_box['use_with_theme'] === true) {
116
-                    $this->SelfPath = get_stylesheet_directory_uri() . '/library/cat-meta';
116
+                    $this->SelfPath = get_stylesheet_directory_uri().'/library/cat-meta';
117 117
                 } elseif ($meta_box['use_with_theme'] === false) {
118 118
                     $this->SelfPath = plugins_url('cat-meta-functions', plugin_basename(dirname(__FILE__)));
119 119
                 } else {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 $li = "<li id='item_{$attachment_id}'>";
263 263
                 $li .= "<img src='{$attachment['url']}' alt='image_{$attachment_id}' />";
264 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>";
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 266
                 $li .= "<input type='hidden' name='{$id}[]' value='{$attachment_id}' />";
267 267
                 $li .= "</li>";
268 268
                 $html .= $li;
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
             $attachment_id = isset($_GET['attachment_id']) ? intval($_GET['attachment_id']) : 0;
336 336
             $ok = false;
337 337
             if (strpos($field_id, '[') === false) {
338
-                check_admin_referer("at-delete-mupload_" . urldecode($field_id));
338
+                check_admin_referer("at-delete-mupload_".urldecode($field_id));
339 339
                 if ($term_id > 0)
340 340
                     $this->delete_tax_meta($term_id, $field_id);
341 341
                 //$ok = wp_delete_attachment( $attachment_id );
@@ -423,8 +423,8 @@  discard block
 block discarded – undo
423 423
 
424 424
             if ($this->has_field('date') && $this->is_edit_page()) {
425 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'));
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 428
             }
429 429
 
430 430
         }
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
             if ($this->has_field('time') && $this->is_edit_page()) {
442 442
 
443 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);
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 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 447
 
448 448
             }
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
             if (!empty($this->_meta_box['pages'])) {
463 463
                 foreach ($this->_meta_box['pages'] as $page) {
464 464
                     //add fields to edit form
465
-                    add_action($page . '_edit_form_fields', array(&$this, 'show_edit_form'));
465
+                    add_action($page.'_edit_form_fields', array(&$this, 'show_edit_form'));
466 466
                     //add fields to add new form
467
-                    add_action($page . '_add_form_fields', array(&$this, 'show_new_form'));
467
+                    add_action($page.'_add_form_fields', array(&$this, 'show_new_form'));
468 468
                     // this saves the edit fields
469
-                    add_action('edited_' . $page, array(&$this, 'save'), 10, 2);
469
+                    add_action('edited_'.$page, array(&$this, 'save'), 10, 2);
470 470
                     // this saves the add fields
471
-                    add_action('created_' . $page, array(&$this, 'save'), 10, 2);
471
+                    add_action('created_'.$page, array(&$this, 'save'), 10, 2);
472 472
                 }
473 473
             }
474 474
 
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
                     $meta = is_array($meta) ? array_map('esc_attr', $meta) : esc_attr($meta);
518 518
 
519 519
                 if ($field['validate_func']) {
520
-                    echo '<tr class="form-field form-required ' . $field['style'] . '">';
520
+                    echo '<tr class="form-field form-required '.$field['style'].'">';
521 521
                 } else {
522
-                    echo '<tr class="form-field ' . $field['style'] . '">';
522
+                    echo '<tr class="form-field '.$field['style'].'">';
523 523
                 }
524 524
 
525 525
                 // Call Separated methods for displaying each type of field.
526
-                call_user_func(array(&$this, 'show_field_' . $field['type']), $field, $meta);
526
+                call_user_func(array(&$this, 'show_field_'.$field['type']), $field, $meta);
527 527
                 echo '</tr>';
528 528
             }
529 529
             echo '</table>';
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
                 foreach ($meta as $me) {
551 551
                     //for labling toggles
552 552
                     $mmm = $me[$field['fields'][0]['id']];
553
-                    echo '<div class="at-repater-block">' . $mmm . '<br/><table class="repeater-table" style="display: none;">';
553
+                    echo '<div class="at-repater-block">'.$mmm.'<br/><table class="repeater-table" style="display: none;">';
554 554
                     if ($field['inline']) {
555 555
                         echo '<tr class="at-inline" VALIGN="top">';
556 556
                     }
557 557
                     foreach ($field['fields'] as $f) {
558 558
                         //reset var $id for repeater
559 559
                         $id = '';
560
-                        $id = $field['id'] . '[' . $c . '][' . $f['id'] . ']';
560
+                        $id = $field['id'].'['.$c.']['.$f['id'].']';
561 561
                         $m = $me[$f['id']];
562 562
                         $m = ($m !== '') ? $m : $f['std'];
563 563
                         if ('image' != $f['type'] && $f['type'] != 'repeater')
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
                         if (!$field['inline']) {
568 568
                             echo '<tr>';
569 569
                         }
570
-                        call_user_func(array(&$this, 'show_field_' . $f['type']), $f, $m);
570
+                        call_user_func(array(&$this, 'show_field_'.$f['type']), $f, $m);
571 571
                         if (!$field['inline']) {
572 572
                             echo '</tr>';
573 573
                         }
@@ -578,18 +578,18 @@  discard block
 block discarded – undo
578 578
                     echo '</table>
579 579
 				<span class="at-re-toggle"><img src="';
580 580
                     if ($this->_Local_images) {
581
-                        echo $plugin_path . '/images/edit.png';
581
+                        echo $plugin_path.'/images/edit.png';
582 582
                     } else {
583 583
                         echo 'http://i.imgur.com/ka0E2.png';
584 584
                     }
585 585
                     echo '" alt="Edit" title="Edit"/></span> 
586 586
 				<img src="';
587 587
                     if ($this->_Local_images) {
588
-                        echo $plugin_path . '/images/remove.png';
588
+                        echo $plugin_path.'/images/remove.png';
589 589
                     } else {
590 590
                         echo 'http://i.imgur.com/g8Duj.png';
591 591
                     }
592
-                    echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
592
+                    echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>';
593 593
                     $c = $c + 1;
594 594
 
595 595
                 }
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 
599 599
             echo '<img src="';
600 600
             if ($this->_Local_images) {
601
-                echo $plugin_path . '/images/add.png';
601
+                echo $plugin_path.'/images/add.png';
602 602
             } else {
603 603
                 echo 'http://i.imgur.com/w5Tuc.png';
604 604
             }
605
-            echo '" alt="' . __('Add', 'geodirectory') . '" title="' . __('Add', 'geodirectory') . '" id="add-' . $field['id'] . '"><br/></div>';
605
+            echo '" alt="'.__('Add', 'geodirectory').'" title="'.__('Add', 'geodirectory').'" id="add-'.$field['id'].'"><br/></div>';
606 606
 
607 607
             //create all fields once more for js function and catch with object buffer
608 608
             ob_start();
@@ -613,12 +613,12 @@  discard block
 block discarded – undo
613 613
             foreach ($field['fields'] as $f) {
614 614
                 //reset var $id for repeater
615 615
                 $id = '';
616
-                $id = $field['id'] . '[CurrentCounter][' . $f['id'] . ']';
616
+                $id = $field['id'].'[CurrentCounter]['.$f['id'].']';
617 617
                 $f['id'] = $id;
618 618
                 if (!$field['inline']) {
619 619
                     echo '<tr>';
620 620
                 }
621
-                call_user_func(array(&$this, 'show_field_' . $f['type']), $f, '');
621
+                call_user_func(array(&$this, 'show_field_'.$f['type']), $f, '');
622 622
                 if (!$field['inline']) {
623 623
                     echo '</tr>';
624 624
                 }
@@ -628,24 +628,24 @@  discard block
 block discarded – undo
628 628
             }
629 629
             echo '</table><img src="';
630 630
             if ($this->_Local_images) {
631
-                echo $plugin_path . '/images/remove.png';
631
+                echo $plugin_path.'/images/remove.png';
632 632
             } else {
633 633
                 echo 'http://i.imgur.com/g8Duj.png';
634 634
             }
635
-            echo '" alt="' . __('Remove', 'geodirectory') . '" title="' . __('Remove', 'geodirectory') . '" id="remove-' . $field['id'] . '"></div>';
636
-            $counter = 'countadd_' . $field['id'];
635
+            echo '" alt="'.__('Remove', 'geodirectory').'" title="'.__('Remove', 'geodirectory').'" id="remove-'.$field['id'].'"></div>';
636
+            $counter = 'countadd_'.$field['id'];
637 637
             $js_code = ob_get_clean();
638 638
             $js_code = str_replace("'", "\"", $js_code);
639
-            $js_code = str_replace("CurrentCounter", "' + " . $counter . " + '", $js_code);
639
+            $js_code = str_replace("CurrentCounter", "' + ".$counter." + '", $js_code);
640 640
             echo '<script>
641 641
 				jQuery(document).ready(function() {
642
-					var ' . $counter . ' = ' . $c . ';
643
-					jQuery("#add-' . $field['id'] . '").live(\'click\', function() {
644
-						' . $counter . ' = ' . $counter . ' + 1;
645
-						jQuery(this).before(\'' . $js_code . '\');						
642
+					var ' . $counter.' = '.$c.';
643
+					jQuery("#add-' . $field['id'].'").live(\'click\', function() {
644
+						' . $counter.' = '.$counter.' + 1;
645
+						jQuery(this).before(\'' . $js_code.'\');						
646 646
 						update_repeater_fields();
647 647
 					});
648
-        			jQuery("#remove-' . $field['id'] . '").live(\'click\', function() {
648
+        			jQuery("#remove-' . $field['id'].'").live(\'click\', function() {
649 649
             			jQuery(this).parent().remove();
650 650
         			});
651 651
     			});
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
         public function show_field_paragraph($field)
773 773
         {
774 774
             //$this->show_field_begin( $field, $meta );
775
-            echo '<p>' . $field['value'] . '</p>';
775
+            echo '<p>'.$field['value'].'</p>';
776 776
             //$this->show_field_end( $field, $meta );
777 777
         }
778 778
 
@@ -803,12 +803,12 @@  discard block
 block discarded – undo
803 803
         {
804 804
 
805 805
             if (!is_array($meta))
806
-                $meta = (array)$meta;
806
+                $meta = (array) $meta;
807 807
 
808 808
             $this->show_field_begin($field, $meta);
809
-            echo "<select class='at-select' name='{$field['id']}" . ($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'") . ">";
809
+            echo "<select class='at-select' name='{$field['id']}".($field['multiple'] ? "[]' id='{$field['id']}' multiple='multiple'" : "'").">";
810 810
             foreach ($field['options'] as $key => $value) {
811
-                echo "<option value='{$key}'" . selected(in_array($key, $meta), true, false) . ">{$value}</option>";
811
+                echo "<option value='{$key}'".selected(in_array($key, $meta), true, false).">{$value}</option>";
812 812
             }
813 813
             echo "</select>";
814 814
             $this->show_field_end($field, $meta);
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
         {
828 828
 
829 829
             if (!is_array($meta))
830
-                $meta = (array)$meta;
830
+                $meta = (array) $meta;
831 831
 
832 832
             $this->show_field_begin($field, $meta);
833 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>";
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 835
             }
836 836
             $this->show_field_end($field, $meta);
837 837
         }
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
         {
849 849
 
850 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']}";
851
+            echo "<input type='checkbox' class='rw-checkbox' name='{$field['id']}' id='{$field['id']}'".checked(!empty($meta), true, false)." /> {$field['desc']}";
852 852
             $this->show_field_end($field, $meta);
853 853
         }
854 854
 
@@ -890,18 +890,18 @@  discard block
 block discarded – undo
890 890
             global $post;
891 891
 
892 892
             if (!is_array($meta))
893
-                $meta = (array)$meta;
893
+                $meta = (array) $meta;
894 894
 
895 895
             $this->show_field_begin($field, $meta);
896 896
             echo "{$field['desc']}<br />";
897 897
 
898 898
             if (!empty($meta)) {
899 899
                 $nonce = wp_create_nonce('at_ajax_delete');
900
-                echo '<div style="margin-bottom: 10px"><strong>' . __('Uploaded files', 'geodirectory') . '</strong></div>';
900
+                echo '<div style="margin-bottom: 10px"><strong>'.__('Uploaded files', 'geodirectory').'</strong></div>';
901 901
                 echo '<ol class="at-upload">';
902 902
                 foreach ($meta as $att) {
903 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>";
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 905
                 }
906 906
                 echo '</ol>';
907 907
             }
@@ -909,13 +909,13 @@  discard block
 block discarded – undo
909 909
             // show form upload
910 910
 
911 911
             echo "<div class='at-file-upload-label'>";
912
-            echo "<strong>" . __('Upload new files', 'geodirectory') . "</strong>";
912
+            echo "<strong>".__('Upload new files', 'geodirectory')."</strong>";
913 913
             echo "</div>";
914 914
             echo "<div class='new-files'>";
915 915
             echo "<div class='file-input'>";
916 916
             echo "<input type='file' name='{$field['id']}[]' />";
917 917
             echo "</div><!-- End .file-input -->";
918
-            echo "<a class='at-add-file button' href='#'>" . __('Add more files', 'geodirectory') . "</a>";
918
+            echo "<a class='at-add-file button' href='#'>".__('Add more files', 'geodirectory')."</a>";
919 919
             echo "</div><!-- End .new-files -->";
920 920
             echo "</td>";
921 921
             $this->show_field_end($field, $meta);
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         public function show_field_image($field, $meta)
933 933
         {
934 934
             $this->show_field_begin($field, $meta);
935
-            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_" . $field['id'], false, false);
935
+            $html = wp_nonce_field("at-delete-mupload_{$field['id']}", "nonce-delete-mupload_".$field['id'], false, false);
936 936
             if (is_array($meta)) {
937 937
                 if (isset($meta[0]) && is_array($meta[0]))
938 938
                     $meta = $meta[0];
@@ -958,19 +958,19 @@  discard block
 block discarded – undo
958 958
                 }
959 959
                 $sub_dir = str_replace($uploads['baseurl'], '', $sub_dir);
960 960
 
961
-                $uploads_url = $uploads_baseurl . $sub_dir;
961
+                $uploads_url = $uploads_baseurl.$sub_dir;
962 962
 
963
-                $meta['src'] = $uploads_url . '/' . $file_name;
963
+                $meta['src'] = $uploads_url.'/'.$file_name;
964 964
 
965
-                $html .= "<span class='mupload_img_holder'><img src='" . $meta['src'] . "' style='max-height: 150px;max-width: 150px;' /></span>";
966
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='" . $meta['id'] . "' />";
967
-                $html .= "<input type='hidden' class='" . $field['id'] . "[src]' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='" . $meta['src'] . "' />";
968
-                $html .= "<input class='at-delete_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Remove Image', 'geodirectory') . "' />";
965
+                $html .= "<span class='mupload_img_holder'><img src='".$meta['src']."' style='max-height: 150px;max-width: 150px;' /></span>";
966
+                $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='".$meta['id']."' />";
967
+                $html .= "<input type='hidden' class='".$field['id']."[src]' name='".$field['id']."[src]' id='".$field['id']."[src]' value='".$meta['src']."' />";
968
+                $html .= "<input class='at-delete_image_button' type='button' rel='".$field['id']."' value='".__('Remove Image', 'geodirectory')."' />";
969 969
             } else {
970 970
                 $html .= "<span class='mupload_img_holder'></span>";
971
-                $html .= "<input type='hidden' name='" . $field['id'] . "[id]' id='" . $field['id'] . "[id]' value='' />";
972
-                $html .= "<input class='" . $field['id'] . "[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='" . $field['id'] . "[src]' id='" . $field['id'] . "[src]' value='' />";
973
-                $html .= "<input class='at-upload_image_button' type='button' rel='" . $field['id'] . "' value='" . __('Upload Image', 'geodirectory') . "' />";
971
+                $html .= "<input type='hidden' name='".$field['id']."[id]' id='".$field['id']."[id]' value='' />";
972
+                $html .= "<input class='".$field['id']."[src]' style='position:absolute;left:-500px;width:50px;' type='text' name='".$field['id']."[src]' id='".$field['id']."[src]' value='' />";
973
+                $html .= "<input class='at-upload_image_button' type='button' rel='".$field['id']."' value='".__('Upload Image', 'geodirectory')."' />";
974 974
             }
975 975
             echo $html;
976 976
             $this->show_field_end($field, $meta);
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 
995 995
             echo "<input class='at-color' type='text' name='{$field['id']}' id='{$field['id']}' value='{$meta}' size='8' />";
996 996
             //	echo "<a href='#' class='at-color-select button' rel='{$field['id']}'>" . __( 'Select a color' ) . "</a>";
997
-            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='" . __('Select a color', 'geodirectory') . "'/>";
997
+            echo "<input type='button' class='at-color-select button' rel='{$field['id']}' value='".__('Select a color', 'geodirectory')."'/>";
998 998
             echo "<div style='display:none' class='at-color-picker' rel='{$field['id']}'></div>";
999 999
             $this->show_field_end($field, $meta);
1000 1000
 
@@ -1012,14 +1012,14 @@  discard block
 block discarded – undo
1012 1012
         {
1013 1013
 
1014 1014
             if (!is_array($meta))
1015
-                $meta = (array)$meta;
1015
+                $meta = (array) $meta;
1016 1016
 
1017 1017
             $this->show_field_begin($field, $meta);
1018 1018
 
1019 1019
             $html = array();
1020 1020
 
1021 1021
             foreach ($field['options'] as $key => $value) {
1022
-                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'" . checked(in_array($key, $meta), true, false) . " /> {$value}";
1022
+                $html[] = "<input type='checkbox' class='at-checkbox_list' name='{$field['id']}[]' value='{$key}'".checked(in_array($key, $meta), true, false)." /> {$value}";
1023 1023
             }
1024 1024
 
1025 1025
             echo implode('<br />', $html);
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
         {
1073 1073
             global $post;
1074 1074
 
1075
-            if (!is_array($meta)) $meta = (array)$meta;
1075
+            if (!is_array($meta)) $meta = (array) $meta;
1076 1076
             $this->show_field_begin($field, $meta);
1077 1077
             $options = $field['options'];
1078 1078
             $posts = get_posts($options['args']);
@@ -1080,13 +1080,13 @@  discard block
 block discarded – undo
1080 1080
             // checkbox_list
1081 1081
             if ('checkbox_list' == $options['type']) {
1082 1082
                 foreach ($posts as $p) {
1083
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'" . checked(in_array($p->ID, $meta), true, false) . " /> $p->post_title<br/>";
1083
+                    echo "<input type='checkbox' name='{$field['id']}[]' value='$p->ID'".checked(in_array($p->ID, $meta), true, false)." /> $p->post_title<br/>";
1084 1084
                 }
1085 1085
             } // select
1086 1086
             else {
1087
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1087
+                echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">";
1088 1088
                 foreach ($posts as $p) {
1089
-                    echo "<option value='$p->ID'" . selected(in_array($p->ID, $meta), true, false) . ">$p->post_title</option>";
1089
+                    echo "<option value='$p->ID'".selected(in_array($p->ID, $meta), true, false).">$p->post_title</option>";
1090 1090
                 }
1091 1091
                 echo "</select>";
1092 1092
             }
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
         {
1111 1111
             global $post;
1112 1112
 
1113
-            if (!is_array($meta)) $meta = (array)$meta;
1113
+            if (!is_array($meta)) $meta = (array) $meta;
1114 1114
             $this->show_field_begin($field, $meta);
1115 1115
             $options = $field['options'];
1116 1116
             $terms = get_terms($options['taxonomy'], $options['args']);
@@ -1118,13 +1118,13 @@  discard block
 block discarded – undo
1118 1118
             // checkbox_list
1119 1119
             if ('checkbox_list' == $options['type']) {
1120 1120
                 foreach ($terms as $term) {
1121
-                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'" . checked(in_array($term->slug, $meta), true, false) . " /> $term->name<br/>";
1121
+                    echo "<input type='checkbox' name='{$field['id']}[]' value='$term->slug'".checked(in_array($term->slug, $meta), true, false)." /> $term->name<br/>";
1122 1122
                 }
1123 1123
             } // select
1124 1124
             else {
1125
-                echo "<select name='{$field['id']}" . ($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'") . ">";
1125
+                echo "<select name='{$field['id']}".($field['multiple'] ? "[]' multiple='multiple' style='height:auto'" : "'").">";
1126 1126
                 foreach ($terms as $term) {
1127
-                    echo "<option value='$term->slug'" . selected(in_array($term->slug, $meta), true, false) . ">$term->name</option>";
1127
+                    echo "<option value='$term->slug'".selected(in_array($term->slug, $meta), true, false).">$term->name</option>";
1128 1128
                 }
1129 1129
                 echo "</select>";
1130 1130
             }
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 
1181 1181
                     //$old_filename = $upload_dir['path'].'/'.$old_filename;
1182 1182
 
1183
-                    $new_filename = $upload_dir['path'] . '/' . 'cat_icon_' . $term_id . '.png';
1183
+                    $new_filename = $upload_dir['path'].'/'.'cat_icon_'.$term_id.'.png';
1184 1184
 
1185 1185
                     /*rename($old_filename, $new_filename);
1186 1186
 				
@@ -1222,9 +1222,9 @@  discard block
 block discarded – undo
1222 1222
                 if ($type != "paragraph") {
1223 1223
 
1224 1224
                     // Call defined method to save meta value, if there's no methods, call common one.
1225
-                    $save_func = 'save_field_' . $type;
1225
+                    $save_func = 'save_field_'.$type;
1226 1226
                     if (method_exists($this, $save_func)) {
1227
-                        call_user_func(array(&$this, 'save_field_' . $type), $term_id, $field, $old, $new);
1227
+                        call_user_func(array(&$this, 'save_field_'.$type), $term_id, $field, $old, $new);
1228 1228
                     } else {
1229 1229
                         $this->save_field($term_id, $field, $old, $new);
1230 1230
                     }
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
                 if (!is_wp_error($id)) {
1370 1370
 
1371 1371
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1372
-                    add_post_meta($term_id, $name, $id, false);    // save file's url in meta fields
1372
+                    add_post_meta($term_id, $name, $id, false); // save file's url in meta fields
1373 1373
 
1374 1374
                 } // End if
1375 1375
 
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
                 if (!is_wp_error($id)) {
1415 1415
 
1416 1416
                     wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $filename));
1417
-                    return $id;    // return file's url in meta fields
1417
+                    return $id; // return file's url in meta fields
1418 1418
                 } // End if
1419 1419
             } // End foreach
1420 1420
         }
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
         {
1430 1430
 
1431 1431
             // Default values for meta box
1432
-            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array)$this->_meta_box);
1432
+            $this->_meta_box = array_merge(array('context' => 'normal', 'priority' => 'high', 'pages' => array('post')), (array) $this->_meta_box);
1433 1433
 
1434
-            if(is_array($this->_fields)) {
1434
+            if (is_array($this->_fields)) {
1435 1435
                 // Default values for fields
1436 1436
                 foreach ($this->_fields as &$field) {
1437 1437
                     $multiple = in_array($field['type'], array('checkbox_list', 'file', 'image'));
@@ -1451,7 +1451,7 @@  discard block
 block discarded – undo
1451 1451
          */
1452 1452
         public function has_field($type)
1453 1453
         {
1454
-            if(is_array($this->_fields)) {
1454
+            if (is_array($this->_fields)) {
1455 1455
                 foreach ($this->_fields as $field) {
1456 1456
                     if ($type == $field['type'])
1457 1457
                         return true;
@@ -2019,12 +2019,12 @@  discard block
 block discarded – undo
2019 2019
                 $post_type = $taxObject->object_type[0];
2020 2020
             }
2021 2021
 
2022
-            if($post_type=='post'){$post_type='';}
2023
-            if($post_type){$post_type = $post_type.'_';}
2022
+            if ($post_type == 'post') {$post_type = ''; }
2023
+            if ($post_type) {$post_type = $post_type.'_'; }
2024 2024
 
2025 2025
             $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2026 2026
 
2027
-            $m = get_option('tax_meta_' . $post_type  . $t_id);
2027
+            $m = get_option('tax_meta_'.$post_type.$t_id);
2028 2028
             if (isset($m[$key])) {
2029 2029
                 return $m[$key];
2030 2030
             } else {
@@ -2041,15 +2041,15 @@  discard block
 block discarded – undo
2041 2041
                 $post_type = $taxObject->object_type[0];
2042 2042
             }
2043 2043
 
2044
-            if($post_type=='post'){$post_type='';}
2045
-            if($post_type){$post_type = $post_type.'_';}
2044
+            if ($post_type == 'post') {$post_type = ''; }
2045
+            if ($post_type) {$post_type = $post_type.'_'; }
2046 2046
 
2047
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2047
+            $m = get_option('tax_meta_'.$post_type.$term_id);
2048 2048
 
2049 2049
             if (isset($m[$key])) {
2050 2050
                 unset($m[$key]);
2051 2051
             }
2052
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2052
+            update_option('tax_meta_'.$post_type.$term_id, $m);
2053 2053
         }
2054 2054
 
2055 2055
         //update meta
@@ -2061,13 +2061,13 @@  discard block
 block discarded – undo
2061 2061
                 $post_type = $taxObject->object_type[0];
2062 2062
             }
2063 2063
 
2064
-            if($post_type=='post'){$post_type='';}
2065
-            if($post_type){$post_type = $post_type.'_';}
2064
+            if ($post_type == 'post') {$post_type = ''; }
2065
+            if ($post_type) {$post_type = $post_type.'_'; }
2066 2066
 
2067
-            $m = get_option('tax_meta_' . $post_type  . $term_id);
2067
+            $m = get_option('tax_meta_'.$post_type.$term_id);
2068 2068
 
2069 2069
             $m[$key] = $value;
2070
-            update_option('tax_meta_' . $post_type  . $term_id, $m);
2070
+            update_option('tax_meta_'.$post_type.$term_id, $m);
2071 2071
 
2072 2072
             /**
2073 2073
              * Called after the tax meta is updated.
@@ -2107,12 +2107,12 @@  discard block
 block discarded – undo
2107 2107
             $post_type = '';
2108 2108
         }
2109 2109
         if ($post_type) {
2110
-            $post_type = $post_type . '_';
2110
+            $post_type = $post_type.'_';
2111 2111
         }
2112 2112
 
2113 2113
         $t_id = (is_object($term_id)) ? $term_id->term_id : $term_id;
2114 2114
 
2115
-        $m = get_option('tax_meta_' . $post_type  . $t_id);
2115
+        $m = get_option('tax_meta_'.$post_type.$t_id);
2116 2116
         if (isset($m[$key])) {
2117 2117
             return $m[$key];
2118 2118
         } else {
@@ -2131,15 +2131,15 @@  discard block
 block discarded – undo
2131 2131
             $post_type = '';
2132 2132
         }
2133 2133
         if ($post_type) {
2134
-            $post_type = $post_type . '_';
2134
+            $post_type = $post_type.'_';
2135 2135
         }
2136 2136
 
2137
-        $m = get_option('tax_meta_' . $post_type . $term_id);
2137
+        $m = get_option('tax_meta_'.$post_type.$term_id);
2138 2138
 
2139 2139
         if (isset($m[$key])) {
2140 2140
             unset($m[$key]);
2141 2141
         }
2142
-        update_option('tax_meta_' . $post_type  . $term_id, $m);
2142
+        update_option('tax_meta_'.$post_type.$term_id, $m);
2143 2143
     }
2144 2144
 }
2145 2145
 
@@ -2158,13 +2158,13 @@  discard block
 block discarded – undo
2158 2158
             $post_type = '';
2159 2159
         }
2160 2160
         if ($post_type) {
2161
-            $post_type = $post_type . '_';
2161
+            $post_type = $post_type.'_';
2162 2162
         }
2163 2163
 
2164
-        $m = get_option('tax_meta_' . $post_type  . $term_id);
2164
+        $m = get_option('tax_meta_'.$post_type.$term_id);
2165 2165
 
2166 2166
         $m[$key] = $value;
2167
-        update_option('tax_meta_' . $post_type . $term_id, $m);
2167
+        update_option('tax_meta_'.$post_type.$term_id, $m);
2168 2168
 
2169 2169
         /** This action is documented in geodirectory-functions/cat-meta-functions/Tax-meta-class.php */
2170 2170
         do_action('gd_tax_meta_updated', false, true, $term_id, $post_type);
Please login to merge, or discard this patch.
Doc Comments   +18 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
          * @author Ohad Raz
1690 1690
          * @since 1.0
1691 1691
          * @access public
1692
-         * @param $id string field id, i.e. the meta key
1692
+         * @param string $id string field id, i.e. the meta key
1693 1693
          * @param $options (array)  array of key => value pairs for select options
1694 1694
          * @param $args mixed|array
1695 1695
          *    'name' => // field name/label string optional
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
          * @author Ohad Raz
1816 1816
          * @since 1.0
1817 1817
          * @access public
1818
-         * @param $id string  field id, i.e. the meta key
1818
+         * @param string $id string  field id, i.e. the meta key
1819 1819
          * @param $args mixed|array
1820 1820
          *    'name' => // field name/label string optional
1821 1821
          *    'desc' => // field description, string optional
@@ -1862,7 +1862,7 @@  discard block
 block discarded – undo
1862 1862
          * @author Ohad Raz
1863 1863
          * @since 1.0
1864 1864
          * @access public
1865
-         * @param $id string  field id, i.e. the meta key
1865
+         * @param string $id string  field id, i.e. the meta key
1866 1866
          * @param $args mixed|array
1867 1867
          *    'name' => // field name/label string optional
1868 1868
          *    'desc' => // field description, string optional
@@ -2053,6 +2053,11 @@  discard block
 block discarded – undo
2053 2053
         }
2054 2054
 
2055 2055
         //update meta
2056
+
2057
+        /**
2058
+         * @param string $term_id
2059
+         * @param string $key
2060
+         */
2056 2061
         public function update_tax_meta($term_id, $key, $value, $post_type = '')
2057 2062
         {
2058 2063
 
@@ -2094,6 +2099,12 @@  discard block
 block discarded – undo
2094 2099
 
2095 2100
 //get term meta field
2096 2101
 if (!function_exists('geodir_get_tax_meta')) {
2102
+
2103
+    /**
2104
+     * @param string $key
2105
+     *
2106
+     * @return string
2107
+     */
2097 2108
     function geodir_get_tax_meta($term_id, $key, $multi = false, $post_type = '') {
2098 2109
         if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2099 2110
             $taxObject = get_taxonomy($_REQUEST['taxonomy']);
@@ -2145,6 +2156,10 @@  discard block
 block discarded – undo
2145 2156
 
2146 2157
 //update meta
2147 2158
 if (!function_exists('geodir_update_tax_meta')) {
2159
+
2160
+    /**
2161
+     * @param string $key
2162
+     */
2148 2163
     function geodir_update_tax_meta($term_id, $key, $value, $post_type = '') {
2149 2164
         if (empty($post_type) && isset($_REQUEST['taxonomy'])) {
2150 2165
             $taxObject = get_taxonomy($_REQUEST['taxonomy']);
Please login to merge, or discard this patch.
geodirectory_template_actions.php 3 patches
Braces   +31 added lines, -24 removed lines patch added patch discarded remove patch
@@ -715,8 +715,9 @@  discard block
 block discarded – undo
715 715
 
716 716
                         if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717 717
                             if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
718
+                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') {
719
+                                                                    $term_icon = $term_icon_url['src'];
720
+                                }
720 721
                                 break;
721 722
                             }
722 723
                         }
@@ -1265,8 +1266,9 @@  discard block
 block discarded – undo
1265 1266
         echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1266 1267
     }
1267 1268
 
1268
-    if (isset($taxonomies[$post_type . '_tags']))
1269
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1269
+    if (isset($taxonomies[$post_type . '_tags'])) {
1270
+            echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1271
+    }
1270 1272
 
1271 1273
     ?>
1272 1274
     </p><?php
@@ -1634,23 +1636,21 @@  discard block
 block discarded – undo
1634 1636
     if(geodir_is_page('pt')){
1635 1637
         $gd_page = 'pt';
1636 1638
         $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1637
-    }
1638
-    elseif(geodir_is_page('listing')){
1639
+    } elseif(geodir_is_page('listing')){
1639 1640
         $gd_page = 'listing';
1640 1641
         global $wp_query;
1641 1642
         $current_term = $wp_query->get_queried_object();
1642 1643
         if (strpos($current_term->taxonomy,'_tags') !== false) {
1643 1644
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1644
-        }else{
1645
+        } else{
1645 1646
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1646 1647
         }
1647 1648
 
1648
-    }
1649
-    elseif(geodir_is_page('author')){
1649
+    } elseif(geodir_is_page('author')){
1650 1650
         $gd_page = 'author';
1651 1651
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1652 1652
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1653
-        }else{
1653
+        } else{
1654 1654
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1655 1655
         }
1656 1656
 
@@ -2074,8 +2074,9 @@  discard block
 block discarded – undo
2074 2074
  */
2075 2075
 function geodir_action_add_listing_page_title()
2076 2076
 {
2077
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2078
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2077
+    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') {
2078
+            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2079
+    }
2079 2080
     /** This action is documented in geodirectory_template_actions.php */
2080 2081
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2081 2082
     /** This action is documented in geodirectory_template_actions.php */
@@ -2087,7 +2088,7 @@  discard block
 block discarded – undo
2087 2088
         $gd_page = 'add-listing';
2088 2089
         if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2089 2090
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2090
-        }elseif(isset($listing_type)){
2091
+        } elseif(isset($listing_type)){
2091 2092
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2092 2093
         }
2093 2094
 
@@ -2406,8 +2407,9 @@  discard block
 block discarded – undo
2406 2407
         $totImg = 0;
2407 2408
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2408 2409
             $post = (object)$gd_session->get('listing');
2409
-            if (isset($post->post_images))
2410
-                $curImages = trim($post->post_images, ",");
2410
+            if (isset($post->post_images)) {
2411
+                            $curImages = trim($post->post_images, ",");
2412
+            }
2411 2413
 
2412 2414
 
2413 2415
             if ($curImages != '') {
@@ -2435,10 +2437,13 @@  discard block
 block discarded – undo
2435 2437
             $totImg = count((array)$thumb_img_arr);
2436 2438
         }
2437 2439
 
2438
-        if ($curImages != '')
2439
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2440
-        else
2441
-            $svalue = '';
2440
+        if ($curImages != '') {
2441
+                    $svalue = $curImages;
2442
+        }
2443
+        // this will be initial value of the above form field. Image urls.
2444
+        else {
2445
+                    $svalue = '';
2446
+        }
2442 2447
 
2443 2448
         $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2444 2449
         $show_image_input_box = ($image_limit != '0');
@@ -2650,8 +2655,9 @@  discard block
 block discarded – undo
2650 2655
     </script><?php
2651 2656
 
2652 2657
     global $errors;
2653
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2654
-        $errors->add('claim_login', LOGIN_CLAIM);
2658
+    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') {
2659
+            $errors->add('claim_login', LOGIN_CLAIM);
2660
+    }
2655 2661
 
2656 2662
     if (!empty($errors)) {
2657 2663
         foreach ($errors as $errorsObj) {
@@ -2758,8 +2764,9 @@  discard block
 block discarded – undo
2758 2764
 
2759 2765
     if (!empty($term)) {
2760 2766
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2761
-        if (!empty($current_term))
2762
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2767
+        if (!empty($current_term)) {
2768
+                    $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2769
+        }
2763 2770
     }
2764 2771
 
2765 2772
 
@@ -2777,7 +2784,7 @@  discard block
 block discarded – undo
2777 2784
         $gd_page = 'author';
2778 2785
         if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2779 2786
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2780
-        }else{
2787
+        } else{
2781 2788
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2782 2789
         }
2783 2790
 
Please login to merge, or discard this patch.
Indentation   +1852 added lines, -1852 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,107 +275,107 @@  discard block
 block discarded – undo
275 275
 function geodir_content_actions_dynamic()
276 276
 {
277 277
 
278
-    $tc = get_option('theme_compatibility_setting');
278
+	$tc = get_option('theme_compatibility_setting');
279 279
 //print_r($tc);
280
-    if (empty($tc)) {
281
-        return;
282
-    }
283
-
284
-    //php
285
-    if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
-    }
288
-
289
-    //geodir_full_page_class
290
-    if (!empty($tc['geodir_full_page_class_filter'])) {
291
-        add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
-    }
293
-
294
-    //widget before filter
295
-    if (!empty($tc['geodir_before_widget_filter'])) {
296
-        add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
-    }
298
-
299
-    //widget after filter
300
-    if (!empty($tc['geodir_after_widget_filter'])) {
301
-        add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
-    }
303
-
304
-    //widget before title filter
305
-    if (!empty($tc['geodir_before_title_filter'])) {
306
-        add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
-    }
308
-
309
-    //widget before title filter
310
-    if (!empty($tc['geodir_after_title_filter'])) {
311
-        add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
-    }
313
-
314
-    //menu li class
315
-    if (!empty($tc['geodir_menu_li_class_filter'])) {
316
-        add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
-    }
318
-
319
-    //menu ul class
320
-    if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
-        add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
-    }
323
-
324
-    //menu sub li class
325
-    if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
-        add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
-    }
328
-
329
-    //menu a class
330
-    if (!empty($tc['geodir_menu_a_class_filter'])) {
331
-        add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
-    }
333
-
334
-    //menu sub a class
335
-    if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
-        add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
-    }
338
-
339
-    //location menu li class
340
-    if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
-        add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
-    }
343
-
344
-    //location menu sub ul class
345
-    if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
-        add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
-    }
348
-
349
-    //location menu sub li class
350
-    if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
-        add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
-    }
353
-
354
-    //location menu a class
355
-    if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
-        add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
-    }
358
-
359
-    // compat styles
360
-    if (!empty($tc['geodir_theme_compat_css'])) {
361
-        add_action('wp_head', 'gd_compat_styles');
362
-    }
363
-
364
-    // compat js
365
-    if (!empty($tc['geodir_theme_compat_js'])) {
366
-        add_action('wp_footer', 'gd_compat_script');
367
-    }
368
-
369
-
370
-    // geodir_top_content_add
371
-    if (!empty($tc['geodir_top_content_add'])) {
372
-        add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
-    }
374
-
375
-    // geodir_before_main_content_add
376
-    if (!empty($tc['geodir_before_main_content_add'])) {
377
-        add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
-    }
280
+	if (empty($tc)) {
281
+		return;
282
+	}
283
+
284
+	//php
285
+	if (!empty($tc['geodir_theme_compat_code'])) {
286
+		include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
287
+	}
288
+
289
+	//geodir_full_page_class
290
+	if (!empty($tc['geodir_full_page_class_filter'])) {
291
+		add_filter('geodir_full_page_class', 'geodir_full_page_class_dynamic', 10);
292
+	}
293
+
294
+	//widget before filter
295
+	if (!empty($tc['geodir_before_widget_filter'])) {
296
+		add_filter('geodir_before_widget', 'geodir_before_widget_dynamic', 10);
297
+	}
298
+
299
+	//widget after filter
300
+	if (!empty($tc['geodir_after_widget_filter'])) {
301
+		add_filter('geodir_after_widget', 'geodir_after_widget_dynamic', 10);
302
+	}
303
+
304
+	//widget before title filter
305
+	if (!empty($tc['geodir_before_title_filter'])) {
306
+		add_filter('geodir_before_title', 'geodir_before_title_dynamic', 10);
307
+	}
308
+
309
+	//widget before title filter
310
+	if (!empty($tc['geodir_after_title_filter'])) {
311
+		add_filter('geodir_after_title', 'geodir_after_title_dynamic', 10);
312
+	}
313
+
314
+	//menu li class
315
+	if (!empty($tc['geodir_menu_li_class_filter'])) {
316
+		add_filter('geodir_menu_li_class', 'geodir_menu_li_class_dynamic', 10);
317
+	}
318
+
319
+	//menu ul class
320
+	if (!empty($tc['geodir_sub_menu_ul_class_filter'])) {
321
+		add_filter('geodir_sub_menu_ul_class', 'geodir_sub_menu_ul_class_dynamic', 10);
322
+	}
323
+
324
+	//menu sub li class
325
+	if (!empty($tc['geodir_sub_menu_li_class_filter'])) {
326
+		add_filter('geodir_sub_menu_li_class', 'geodir_sub_menu_li_class_dynamic', 10);
327
+	}
328
+
329
+	//menu a class
330
+	if (!empty($tc['geodir_menu_a_class_filter'])) {
331
+		add_filter('geodir_menu_a_class', 'geodir_menu_a_class_dynamic', 10);
332
+	}
333
+
334
+	//menu sub a class
335
+	if (!empty($tc['geodir_sub_menu_a_class_filter'])) {
336
+		add_filter('geodir_sub_menu_a_class', 'geodir_sub_menu_a_class_dynamic', 10);
337
+	}
338
+
339
+	//location menu li class
340
+	if (!empty($tc['geodir_location_switcher_menu_li_class_filter'])) {
341
+		add_filter('geodir_location_switcher_menu_li_class', 'geodir_location_switcher_menu_li_class_dynamic', 10);
342
+	}
343
+
344
+	//location menu sub ul class
345
+	if (!empty($tc['geodir_location_switcher_menu_sub_ul_class_filter'])) {
346
+		add_filter('geodir_location_switcher_menu_sub_ul_class', 'geodir_location_switcher_menu_sub_ul_class_dynamic', 10);
347
+	}
348
+
349
+	//location menu sub li class
350
+	if (!empty($tc['geodir_location_switcher_menu_sub_li_class_filter'])) {
351
+		add_filter('geodir_location_switcher_menu_sub_li_class', 'geodir_location_switcher_menu_sub_li_class_dynamic', 10);
352
+	}
353
+
354
+	//location menu a class
355
+	if (!empty($tc['geodir_location_switcher_menu_a_class_filter'])) {
356
+		add_filter('geodir_location_switcher_menu_a_class', 'geodir_location_switcher_menu_a_class_dynamic', 10);
357
+	}
358
+
359
+	// compat styles
360
+	if (!empty($tc['geodir_theme_compat_css'])) {
361
+		add_action('wp_head', 'gd_compat_styles');
362
+	}
363
+
364
+	// compat js
365
+	if (!empty($tc['geodir_theme_compat_js'])) {
366
+		add_action('wp_footer', 'gd_compat_script');
367
+	}
368
+
369
+
370
+	// geodir_top_content_add
371
+	if (!empty($tc['geodir_top_content_add'])) {
372
+		add_action('geodir_top_content', 'geodir_top_content_add_dynamic', 10, 1);
373
+	}
374
+
375
+	// geodir_before_main_content_add
376
+	if (!empty($tc['geodir_before_main_content_add'])) {
377
+		add_action('geodir_before_main_content', 'geodir_before_main_content_add_dynamic', 10, 1);
378
+	}
379 379
 
380 380
 
381 381
 }
@@ -398,23 +398,23 @@  discard block
 block discarded – undo
398 398
  */
399 399
 function geodir_action_wrapper_open($type = '', $id = '', $class = '')
400 400
 {
401
-    $tc = get_option('theme_compatibility_setting');
402
-    if (!empty($tc['geodir_wrapper_open_replace'])) {
403
-        $text = $tc['geodir_wrapper_open_replace'];
404
-    } else {
405
-        $text = '<div id="[id]" class="[class]">';
406
-    }
401
+	$tc = get_option('theme_compatibility_setting');
402
+	if (!empty($tc['geodir_wrapper_open_replace'])) {
403
+		$text = $tc['geodir_wrapper_open_replace'];
404
+	} else {
405
+		$text = '<div id="[id]" class="[class]">';
406
+	}
407 407
 
408
-    if (!empty($tc['geodir_wrapper_open_id'])) {
409
-        $id = $tc['geodir_wrapper_open_id'];
410
-    }
411
-    if (!empty($tc['geodir_wrapper_open_class'])) {
412
-        $class = $tc['geodir_wrapper_open_class'];
413
-    }
408
+	if (!empty($tc['geodir_wrapper_open_id'])) {
409
+		$id = $tc['geodir_wrapper_open_id'];
410
+	}
411
+	if (!empty($tc['geodir_wrapper_open_class'])) {
412
+		$class = $tc['geodir_wrapper_open_class'];
413
+	}
414 414
 
415
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
415
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
416 416
 
417
-    echo $text;
417
+	echo $text;
418 418
 }
419 419
 
420 420
 // action for adding the wrapperdiv closing tag
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function geodir_action_wrapper_close($type = '')
431 431
 {
432
-    $tc = get_option('theme_compatibility_setting');
433
-    if (!empty($tc['geodir_wrapper_close_replace'])) {
434
-        $text = $tc['geodir_wrapper_close_replace'];
435
-    } else {
436
-        $text = '</div><!-- wrapper ends here-->';
437
-    }
432
+	$tc = get_option('theme_compatibility_setting');
433
+	if (!empty($tc['geodir_wrapper_close_replace'])) {
434
+		$text = $tc['geodir_wrapper_close_replace'];
435
+	} else {
436
+		$text = '</div><!-- wrapper ends here-->';
437
+	}
438 438
 
439
-    echo $text;
439
+	echo $text;
440 440
 }
441 441
 
442 442
 // action for adding the content div opening tag
@@ -452,35 +452,35 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
457
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
459
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
461
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
463
-    } else {
464
-        $width_css = '';
465
-    }
466
-
467
-    $tc = get_option('theme_compatibility_setting');
468
-    if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
-        $text = $tc['geodir_wrapper_content_open_replace'];
470
-    } else {
471
-        $text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
-    }
473
-
474
-    if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
-        $id = $tc['geodir_wrapper_content_open_id'];
476
-    }
477
-    if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
-        $class = $tc['geodir_wrapper_content_open_class'];
479
-    }
480
-
481
-    $text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
-
483
-    echo $text;
455
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
+		$width_css = 'style="width:' . $width . '%;"';
457
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
+		$width_css = 'style="width:' . $width . '%;"';
459
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
+		$width_css = 'style="width:' . $width . '%;"';
461
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
+		$width_css = 'style="width:' . $width . '%;"';
463
+	} else {
464
+		$width_css = '';
465
+	}
466
+
467
+	$tc = get_option('theme_compatibility_setting');
468
+	if (!empty($tc['geodir_wrapper_content_open_replace'])) {
469
+		$text = $tc['geodir_wrapper_content_open_replace'];
470
+	} else {
471
+		$text = '<div id="[id]" class="[class]" role="main" [width_css]>';
472
+	}
473
+
474
+	if (!empty($tc['geodir_wrapper_content_open_id'])) {
475
+		$id = $tc['geodir_wrapper_content_open_id'];
476
+	}
477
+	if (!empty($tc['geodir_wrapper_content_open_class'])) {
478
+		$class = $tc['geodir_wrapper_content_open_class'];
479
+	}
480
+
481
+	$text = str_replace(array("[id]", "[class]", "[width_css]"), array($id, $class, $width_css), $text);
482
+
483
+	echo $text;
484 484
 }
485 485
 
486 486
 // action for adding the primary div closing tag
@@ -494,13 +494,13 @@  discard block
 block discarded – undo
494 494
  */
495 495
 function geodir_action_wrapper_content_close($type = '')
496 496
 {
497
-    $tc = get_option('theme_compatibility_setting');
498
-    if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
-        $text = $tc['geodir_wrapper_content_close_replace'];
500
-    } else {
501
-        $text = '</div><!-- content ends here-->';
502
-    }
503
-    echo $text;
497
+	$tc = get_option('theme_compatibility_setting');
498
+	if (!empty($tc['geodir_wrapper_content_close_replace'])) {
499
+		$text = $tc['geodir_wrapper_content_close_replace'];
500
+	} else {
501
+		$text = '</div><!-- content ends here-->';
502
+	}
503
+	echo $text;
504 504
 }
505 505
 
506 506
 // action for adding the <article> opening tag
@@ -518,24 +518,24 @@  discard block
 block discarded – undo
518 518
  */
519 519
 function geodir_action_article_open($type = '', $id = '', $class = '', $itemtype = '')
520 520
 {
521
-    $class = implode(" ", $class);
522
-    $tc = get_option('theme_compatibility_setting');
523
-    if (!empty($tc['geodir_article_open_replace'])) {
524
-        $text = $tc['geodir_article_open_replace'];
525
-    } else {
526
-        $text = '<article  id="[id]" class="[class]" >';
527
-    }
521
+	$class = implode(" ", $class);
522
+	$tc = get_option('theme_compatibility_setting');
523
+	if (!empty($tc['geodir_article_open_replace'])) {
524
+		$text = $tc['geodir_article_open_replace'];
525
+	} else {
526
+		$text = '<article  id="[id]" class="[class]" >';
527
+	}
528 528
 
529
-    if (!empty($tc['geodir_article_open_id'])) {
530
-        $id = $tc['geodir_article_open_id'];
531
-    }
532
-    if (!empty($tc['geodir_article_open_class'])) {
533
-        $class = $tc['geodir_article_open_class'];
534
-    }
529
+	if (!empty($tc['geodir_article_open_id'])) {
530
+		$id = $tc['geodir_article_open_id'];
531
+	}
532
+	if (!empty($tc['geodir_article_open_class'])) {
533
+		$class = $tc['geodir_article_open_class'];
534
+	}
535 535
 
536
-    $text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
536
+	$text = str_replace(array("[id]", "[class]", "[itemtype]"), array($id, $class, $itemtype), $text);
537 537
 
538
-    echo $text;
538
+	echo $text;
539 539
 }
540 540
 
541 541
 // action for adding the primary div closing tag
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
  */
550 550
 function geodir_action_article_close($type = '')
551 551
 {
552
-    $tc = get_option('theme_compatibility_setting');
553
-    if (!empty($tc['geodir_article_close_replace'])) {
554
-        $text = $tc['geodir_article_close_replace'];
555
-    } else {
556
-        $text = '</article><!-- article ends here-->';
557
-    }
558
-    echo $text;
552
+	$tc = get_option('theme_compatibility_setting');
553
+	if (!empty($tc['geodir_article_close_replace'])) {
554
+		$text = $tc['geodir_article_close_replace'];
555
+	} else {
556
+		$text = '</article><!-- article ends here-->';
557
+	}
558
+	echo $text;
559 559
 }
560 560
 
561 561
 // action for adding the sidebar opening tag
@@ -572,35 +572,35 @@  discard block
 block discarded – undo
572 572
  */
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
577
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
579
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
581
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
583
-    } else {
584
-        $width_css = '';
585
-    }
586
-
587
-    $tc = get_option('theme_compatibility_setting');
588
-    if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
-        $text = $tc['geodir_sidebar_right_open_replace'];
590
-    } else {
591
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
-    }
593
-
594
-    if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
-        $id = $tc['geodir_sidebar_right_open_id'];
596
-    }
597
-    if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
-        $class = $tc['geodir_sidebar_right_open_class'];
599
-    }
600
-
601
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
-
603
-    echo $text;
575
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
+		$width_css = 'style="width:' . $width . '%;"';
577
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
+		$width_css = 'style="width:' . $width . '%;"';
579
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
+		$width_css = 'style="width:' . $width . '%;"';
581
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
+		$width_css = 'style="width:' . $width . '%;"';
583
+	} else {
584
+		$width_css = '';
585
+	}
586
+
587
+	$tc = get_option('theme_compatibility_setting');
588
+	if (!empty($tc['geodir_sidebar_right_open_replace'])) {
589
+		$text = $tc['geodir_sidebar_right_open_replace'];
590
+	} else {
591
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
592
+	}
593
+
594
+	if (!empty($tc['geodir_sidebar_right_open_id'])) {
595
+		$id = $tc['geodir_sidebar_right_open_id'];
596
+	}
597
+	if (!empty($tc['geodir_sidebar_right_open_class'])) {
598
+		$class = $tc['geodir_sidebar_right_open_class'];
599
+	}
600
+
601
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
602
+
603
+	echo $text;
604 604
 }
605 605
 
606 606
 // action for adding the primary div closing tag
@@ -614,13 +614,13 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_action_sidebar_right_close($type = '')
616 616
 {
617
-    $tc = get_option('theme_compatibility_setting');
618
-    if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
-        $text = $tc['geodir_sidebar_right_close_replace'];
620
-    } else {
621
-        $text = '</aside><!-- sidebar ends here-->';
622
-    }
623
-    echo $text;
617
+	$tc = get_option('theme_compatibility_setting');
618
+	if (!empty($tc['geodir_sidebar_right_close_replace'])) {
619
+		$text = $tc['geodir_sidebar_right_close_replace'];
620
+	} else {
621
+		$text = '</aside><!-- sidebar ends here-->';
622
+	}
623
+	echo $text;
624 624
 }
625 625
 
626 626
 
@@ -641,121 +641,121 @@  discard block
 block discarded – undo
641 641
  */
642 642
 function geodir_action_geodir_set_preview_post()
643 643
 {
644
-    global $post, $preview, $gd_session;
645
-    $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
646
-    if (!$preview || $is_backend_preview) {
647
-        return;
648
-    }// bail if not previewing
649
-
650
-    $listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
-
652
-    $fields_info = geodir_get_custom_fields_type($listing_type);
653
-
654
-    foreach ($_REQUEST as $pkey => $pval) {
655
-        if ($pkey == 'geodir_video') {
656
-            $tags = '<iframe>';
657
-        } else if ($pkey == 'post_desc') {
658
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
-        } else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
-            $tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
-        } else if (is_array($_REQUEST[$pkey])) {
662
-            $tags = 'skip_field';
663
-        } else {
664
-            $tags = '';
665
-        }
666
-        /**
667
-         * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
-         *
669
-         * @since 1.0.0
670
-         * @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>'.
671
-         * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
-         */
673
-        $tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
-
675
-        if ($tags != 'skip_field') {
676
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
-        }
678
-    }
679
-
680
-    $post = (object)$_REQUEST;
681
-
682
-
683
-    if (isset($post->video)) {
684
-        $post->video = stripslashes($post->video);
685
-    }
686
-
687
-    if (isset($post->Video2)) {
688
-        $post->Video2 = stripslashes($post->Video2);
689
-    }
690
-
691
-    $post_type = $post->listing_type;
692
-    $post_type_info = get_post_type_object($post_type);
693
-
694
-    $listing_label = $post_type_info->labels->singular_name;
695
-
696
-    $term_icon = '';
697
-
698
-    if (!empty($post->post_category)) {
699
-        foreach ($post->post_category as $post_taxonomy => $post_term) {
700
-
701
-            if ($post_term != '' && !is_array($post_term)) {
702
-                $post_term = explode(',', trim($post_term, ','));
703
-            }
644
+	global $post, $preview, $gd_session;
645
+	$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
646
+	if (!$preview || $is_backend_preview) {
647
+		return;
648
+	}// bail if not previewing
649
+
650
+	$listing_type = isset($_REQUEST['listing_type']) ? sanitize_text_field($_REQUEST['listing_type']) : '';
651
+
652
+	$fields_info = geodir_get_custom_fields_type($listing_type);
653
+
654
+	foreach ($_REQUEST as $pkey => $pval) {
655
+		if ($pkey == 'geodir_video') {
656
+			$tags = '<iframe>';
657
+		} else if ($pkey == 'post_desc') {
658
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
659
+		} else if (is_array($fields_info) && isset($fields_info[$pkey]) && ($fields_info[$pkey] == 'textarea' || $fields_info[$pkey] == 'html')) {
660
+			$tags = '<p><a><b><i><em><h1><h2><h3><h4><h5><ul><ol><li><img><div><del><ins><span><cite><code><strike><strong><blockquote>';
661
+		} else if (is_array($_REQUEST[$pkey])) {
662
+			$tags = 'skip_field';
663
+		} else {
664
+			$tags = '';
665
+		}
666
+		/**
667
+		 * Allows the filtering of the allowed HTML tags per field when submitting from frontend add listing page.
668
+		 *
669
+		 * @since 1.0.0
670
+		 * @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>'.
671
+		 * @param string|array $pkey The field id/name. If array then value is set as "skip_field".
672
+		 */
673
+		$tags = apply_filters('geodir_save_post_key', $tags, $pkey);
674
+
675
+		if ($tags != 'skip_field') {
676
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
677
+		}
678
+	}
679
+
680
+	$post = (object)$_REQUEST;
681
+
682
+
683
+	if (isset($post->video)) {
684
+		$post->video = stripslashes($post->video);
685
+	}
686
+
687
+	if (isset($post->Video2)) {
688
+		$post->Video2 = stripslashes($post->Video2);
689
+	}
690
+
691
+	$post_type = $post->listing_type;
692
+	$post_type_info = get_post_type_object($post_type);
693
+
694
+	$listing_label = $post_type_info->labels->singular_name;
695
+
696
+	$term_icon = '';
697
+
698
+	if (!empty($post->post_category)) {
699
+		foreach ($post->post_category as $post_taxonomy => $post_term) {
700
+
701
+			if ($post_term != '' && !is_array($post_term)) {
702
+				$post_term = explode(',', trim($post_term, ','));
703
+			}
704 704
 
705
-            if (is_array($post_term)) {
706
-                $post_term = array_unique($post_term);
707
-            }
705
+			if (is_array($post_term)) {
706
+				$post_term = array_unique($post_term);
707
+			}
708 708
 
709
-            if (!empty($post_term)) {
710
-                foreach ($post_term as $cat_id) {
711
-                    $cat_id = trim($cat_id);
712
-
713
-                    if ($cat_id != '') {
714
-                        $term_icon = get_option('geodir_default_marker_icon');
715
-
716
-                        if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
-                            if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
-                                if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
-                                    $term_icon = $term_icon_url['src'];
720
-                                break;
721
-                            }
722
-                        }
723
-                    }
724
-                }
725
-            }
726
-        }
727
-    }
709
+			if (!empty($post_term)) {
710
+				foreach ($post_term as $cat_id) {
711
+					$cat_id = trim($cat_id);
712
+
713
+					if ($cat_id != '') {
714
+						$term_icon = get_option('geodir_default_marker_icon');
715
+
716
+						if (isset($post->post_default_category) && $post->post_default_category == $cat_id) {
717
+							if ($term_icon_url = geodir_get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) {
718
+								if (isset($term_icon_url['src']) && $term_icon_url['src'] != '')
719
+									$term_icon = $term_icon_url['src'];
720
+								break;
721
+							}
722
+						}
723
+					}
724
+				}
725
+			}
726
+		}
727
+	}
728 728
 
729
-    $post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
-    $post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
729
+	$post_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
730
+	$post_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
731 731
 
732
-    $srcharr = array("'", "/", "-", '"', '\\');
733
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
732
+	$srcharr = array("'", "/", "-", '"', '\\');
733
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
734 734
 
735
-    $json_title = str_replace($srcharr, $replarr, $post->post_title);
735
+	$json_title = str_replace($srcharr, $replarr, $post->post_title);
736 736
 
737
-    $json = '{';
738
-    $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
743
-    $json .= '}';
737
+	$json = '{';
738
+	$json .= '"post_preview": "1",';
739
+	$json .= '"t": "' . $json_title . '",';
740
+	$json .= '"lt": "' . $post_latitude . '",';
741
+	$json .= '"ln": "' . $post_longitude . '",';
742
+	$json .= '"i":"' . $term_icon . '"';
743
+	$json .= '}';
744 744
 
745
-    $post->marker_json = $json;
745
+	$post->marker_json = $json;
746 746
 
747
-    $gd_session->set('listing', $_REQUEST);
747
+	$gd_session->set('listing', $_REQUEST);
748 748
 
749
-    // we need to define a few things to trick the setup_postdata
750
-    if (!isset($post->ID)) {
751
-        $post->ID = '';
752
-        $post->post_author = '';
753
-        $post->post_date = '';
754
-        $post->post_content = '';
755
-        $post->default_category = '';
756
-        $post->post_type = '';
757
-    }
758
-    setup_postdata($post);
749
+	// we need to define a few things to trick the setup_postdata
750
+	if (!isset($post->ID)) {
751
+		$post->ID = '';
752
+		$post->post_author = '';
753
+		$post->post_date = '';
754
+		$post->post_content = '';
755
+		$post->default_category = '';
756
+		$post->post_type = '';
757
+	}
758
+	setup_postdata($post);
759 759
 }
760 760
 
761 761
 /**
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
  */
768 768
 function geodir_action_geodir_preview_code()
769 769
 {
770
-    global $preview;
770
+	global $preview;
771 771
 
772
-    $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
+	$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
773 773
 
774
-    if (!$preview || $is_backend_preview) {
775
-        return;
776
-    }// bail if not previewing
774
+	if (!$preview || $is_backend_preview) {
775
+		return;
776
+	}// bail if not previewing
777 777
 
778
-    geodir_get_template_part('preview', 'buttons');
778
+	geodir_get_template_part('preview', 'buttons');
779 779
 }
780 780
 
781 781
 // action for adding the details page top widget area
@@ -791,20 +791,20 @@  discard block
 block discarded – undo
791 791
  */
792 792
 function geodir_action_geodir_sidebar_detail_top($class = '')
793 793
 {
794
-    if (get_option('geodir_show_detail_top_section')) { ?>
794
+	if (get_option('geodir_show_detail_top_section')) { ?>
795 795
         <div
796 796
             class="<?php
797
-            /**
798
-             * Filter the div class for the wrapper of the full width widget areas.
799
-             *
800
-             * 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.
801
-             *
802
-             * @since 1.0.0
803
-             * @param string $class The class of the div.
804
-             * @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',
805
-             *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
-             */
807
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
797
+			/**
798
+			 * Filter the div class for the wrapper of the full width widget areas.
799
+			 *
800
+			 * 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.
801
+			 *
802
+			 * @since 1.0.0
803
+			 * @param string $class The class of the div.
804
+			 * @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',
805
+			 *               'geodir_author_top','geodir_author_bottom', 'geodir_search_top', 'geodir_search_bottom', 'geodir_home_top' or 'geodir_home_bottom'.
806
+			 */
807
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_top'); ?> <?php echo $class; ?>">
808 808
             <?php dynamic_sidebar('geodir_detail_top'); ?>
809 809
         </div>
810 810
     <?php }
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
  */
829 829
 function geodir_action_geodir_sidebar_detail_bottom_section($class = '')
830 830
 {
831
-    if (get_option('geodir_show_detail_bottom_section')) { ?>
831
+	if (get_option('geodir_show_detail_bottom_section')) { ?>
832 832
         <div
833 833
             class="<?php
834
-            /** This action is documented in geodirectory_template_actions.php */
835
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
834
+			/** This action is documented in geodirectory_template_actions.php */
835
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_detail_bottom'); ?> <?php echo $class; ?>">
836 836
             <?php dynamic_sidebar('geodir_detail_bottom'); ?>
837 837
         </div><!-- clearfix ends here-->
838 838
     <?php }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
  */
847 847
 function geodir_details_sidebar_widget_area()
848 848
 {
849
-    dynamic_sidebar('geodir_detail_sidebar');
849
+	dynamic_sidebar('geodir_detail_sidebar');
850 850
 }
851 851
 
852 852
 /**
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
  */
858 858
 function geodir_details_sidebar_place_details()
859 859
 {
860
-    /**
861
-     * Used to add items to the details page sidebar.
862
-     *
863
-     * @since 1.0.0
864
-     */
865
-    do_action('geodir_detail_page_sidebar');
860
+	/**
861
+	 * Used to add items to the details page sidebar.
862
+	 *
863
+	 * @since 1.0.0
864
+	 */
865
+	do_action('geodir_detail_page_sidebar');
866 866
 }
867 867
 
868 868
 add_action('geodir_detail_sidebar_inside', 'geodir_details_sidebar_place_details', 10);
@@ -877,68 +877,68 @@  discard block
 block discarded – undo
877 877
  */
878 878
 function geodir_action_details_sidebar()
879 879
 {
880
-    // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
-    if (get_option('geodir_detail_sidebar_left_section')) {
882
-        /**
883
-         * Called before the details page left sidebar is opened.
884
-         *
885
-         * This is used to add opening wrapper HTML to the details page left sidebar.
886
-         *
887
-         * @since 1.0.0
888
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
-         */
893
-        do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
-        ?>
880
+	// this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
881
+	if (get_option('geodir_detail_sidebar_left_section')) {
882
+		/**
883
+		 * Called before the details page left sidebar is opened.
884
+		 *
885
+		 * This is used to add opening wrapper HTML to the details page left sidebar.
886
+		 *
887
+		 * @since 1.0.0
888
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
889
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-left'.
890
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-left geodir-details-sidebar-left'.
891
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
892
+		 */
893
+		do_action('geodir_sidebar_left_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-left geodir-details-sidebar-left', 'https://schema.org/WPSideBar');
894
+		?>
895 895
         <div class="geodir-content-left geodir-sidebar-wrap"><?php
896
-        /**
897
-         * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
-         *
899
-         * This is used to add all info to the details page sidebars.
900
-         *
901
-         * @since 1.0.0
902
-         */
903
-        do_action('geodir_detail_sidebar_inside');
904
-        ?></div><!-- end geodir-content-left --><?php
905
-        /**
906
-         * Called after the details page left sidebar.
907
-         *
908
-         * This is used to add closing wrapper HTML to the details page left sidebar.
909
-         *
910
-         * @since 1.0.0
911
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
-         */
913
-        do_action('geodir_sidebar_left_close', 'details-page');
914
-    } else {
915
-        /**
916
-         * Called before the details page right sidebar is opened.
917
-         *
918
-         * This is used to add opening wrapper HTML to the details page right sidebar.
919
-         *
920
-         * @since 1.0.0
921
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
-         * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
-         * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
-         * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
-         */
926
-        do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
-        ?>
896
+		/**
897
+		 * Called inside the HTML wrapper of the details sidebar for either the left and right sidebar.
898
+		 *
899
+		 * This is used to add all info to the details page sidebars.
900
+		 *
901
+		 * @since 1.0.0
902
+		 */
903
+		do_action('geodir_detail_sidebar_inside');
904
+		?></div><!-- end geodir-content-left --><?php
905
+		/**
906
+		 * Called after the details page left sidebar.
907
+		 *
908
+		 * This is used to add closing wrapper HTML to the details page left sidebar.
909
+		 *
910
+		 * @since 1.0.0
911
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
912
+		 */
913
+		do_action('geodir_sidebar_left_close', 'details-page');
914
+	} else {
915
+		/**
916
+		 * Called before the details page right sidebar is opened.
917
+		 *
918
+		 * This is used to add opening wrapper HTML to the details page right sidebar.
919
+		 *
920
+		 * @since 1.0.0
921
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'add-listing-page', 'author-page', 'search-page' or 'home-page'.
922
+		 * @param string $id Usually the ID of the sidebar wrapper. Values can be 'geodir-sidebar' or 'geodir-sidebar-right'.
923
+		 * @param string $class The class of the sidebar wrapper. 'geodir-sidebar-right geodir-details-sidebar-right'.
924
+		 * @param string $itemtype HTML itemtype 'http://schema.org/WPSideBar'.
925
+		 */
926
+		do_action('geodir_sidebar_right_open', 'details-page', 'geodir-sidebar', 'geodir-sidebar-right geodir-details-sidebar-right', 'http://schema.org/WPSideBar');
927
+		?>
928 928
         <div class="geodir-content-right geodir-sidebar-wrap"><?php
929
-        /** This action is documented in geodirectory_template_actions.php */
930
-        do_action('geodir_detail_sidebar_inside');
931
-        ?></div><!-- end geodir-content-right --><?php
932
-        /**
933
-         * Called after the details page right sidebar.
934
-         *
935
-         * This is used to add closing wrapper HTML to the details page right sidebar.
936
-         *
937
-         * @since 1.0.0
938
-         * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
-         */
940
-        do_action('geodir_sidebar_right_close', 'details-page');
941
-    }
929
+		/** This action is documented in geodirectory_template_actions.php */
930
+		do_action('geodir_detail_sidebar_inside');
931
+		?></div><!-- end geodir-content-right --><?php
932
+		/**
933
+		 * Called after the details page right sidebar.
934
+		 *
935
+		 * This is used to add closing wrapper HTML to the details page right sidebar.
936
+		 *
937
+		 * @since 1.0.0
938
+		 * @param string $type The current page type. Values can be 'details-page', 'listings-page', 'author-page', 'search-page' or 'home-page'.
939
+		 */
940
+		do_action('geodir_sidebar_right_close', 'details-page');
941
+	}
942 942
 }
943 943
 
944 944
 add_action('geodir_page_title', 'geodir_action_page_title', 10);
@@ -952,21 +952,21 @@  discard block
 block discarded – undo
952 952
  */
953 953
 function geodir_action_page_title()
954 954
 {
955
-    /**
956
-     * Filter the page title HTML h1 class.
957
-     *
958
-     * @since 1.0.0
959
-     * @param string $class The class to use. Default is 'entry-title fn'.
960
-     */
961
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
-    /**
963
-     * Filter the page title HTML header wrapper class.
964
-     *
965
-     * @since 1.0.0
966
-     * @param string $class The class to use. Default is 'entry-header'.
967
-     */
968
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
955
+	/**
956
+	 * Filter the page title HTML h1 class.
957
+	 *
958
+	 * @since 1.0.0
959
+	 * @param string $class The class to use. Default is 'entry-title fn'.
960
+	 */
961
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
962
+	/**
963
+	 * Filter the page title HTML header wrapper class.
964
+	 *
965
+	 * @since 1.0.0
966
+	 * @param string $class The class to use. Default is 'entry-header'.
967
+	 */
968
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -983,106 +983,106 @@  discard block
 block discarded – undo
983 983
  */
984 984
 function geodir_action_details_slider()
985 985
 {
986
-    global $preview, $post;
986
+	global $preview, $post;
987 987
 
988
-    $is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
988
+	$is_backend_preview = (is_single() && !empty($_REQUEST['post_type']) && !empty($_REQUEST['preview']) && !empty($_REQUEST['p'])) && is_super_admin() ? true : false; // preview from backend
989 989
 
990
-    if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
-        $preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
990
+	if ($is_backend_preview && !empty($post) && !empty($post->ID) && !isset($post->post_images)) {
991
+		$preview_get_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
992 992
 
993
-        $preview_post_images = array();
994
-        if ($preview_get_images) {
995
-            foreach ($preview_get_images as $row) {
996
-                $preview_post_images[] = $row->src;
997
-            }
998
-        }
999
-        if (!empty($preview_post_images)) {
1000
-            $post->post_images = implode(',', $preview_post_images);
1001
-        }
1002
-    }
993
+		$preview_post_images = array();
994
+		if ($preview_get_images) {
995
+			foreach ($preview_get_images as $row) {
996
+				$preview_post_images[] = $row->src;
997
+			}
998
+		}
999
+		if (!empty($preview_post_images)) {
1000
+			$post->post_images = implode(',', $preview_post_images);
1001
+		}
1002
+	}
1003 1003
     
1004
-    $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1005
-    $image_limit = '';
1006
-    if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1007
-        $image_limit = (int)$package_info->image_limit;
1008
-    }
1009
-
1010
-    if ($preview) {
1011
-        $post_images = array();
1012
-        if (isset($post->post_images) && !empty($post->post_images)) {
1013
-            $post->post_images = trim($post->post_images, ",");
1014
-            $post_images = explode(",", $post->post_images);
1015
-        }
1016
-
1017
-        $main_slides = '';
1018
-        $nav_slides = '';
1019
-        $slides = 0;
1020
-
1021
-        if (!empty($post_images)) {
1022
-            foreach ($post_images as $image) {
1023
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1024
-                     break;
1025
-                }
1026
-                if (!empty($image)) {
1027
-                    $sizes = getimagesize(trim($image));
1028
-                    $width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1029
-                    $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1030
-
1031
-                    if ($image && $width && $height) {
1032
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1033
-                    }
1034
-
1035
-                    if (isset($image->src)) {
1036
-                        if ($image->height >= 400) {
1037
-                            $spacer_height = 0;
1038
-                        } else {
1039
-                            $spacer_height = ((400 - $image->height) / 2);
1040
-                        }
1041
-
1042
-                        $image_title = isset($image->title) ? $image->title : '';
1043
-
1044
-                        $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;" />';
1045
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1046
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1047
-                        $slides++;
1048
-                    }
1049
-                }
1050
-            }// endfore
1051
-        } //end if
1052
-    } else {
1053
-        $main_slides = '';
1054
-        $nav_slides = '';
1055
-        /**
1056
-         * Filter if default images should show on the details page.
1057
-         *
1058
-         * @param bool $use_default_image Default false.
1059
-         * @since 1.6.16
1060
-         */
1061
-        $use_default_image = apply_filters('geodir_details_default_image_show', false);
1062
-        $post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1063
-        $slides = 0;
1064
-
1065
-        if (!empty($post_images)) {
1066
-            foreach ($post_images as $image) {
1067
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1068
-                     break;
1069
-                }
1070
-                if ($image->height >= 400) {
1071
-                    $spacer_height = 0;
1072
-                } else {
1073
-                    $spacer_height = ((400 - $image->height) / 2);
1074
-                }
1075
-
1076
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1077
-                $main_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1079
-                $slides++;
1080
-            }
1081
-        }// endfore
1082
-    }
1004
+	$package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1005
+	$image_limit = '';
1006
+	if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1007
+		$image_limit = (int)$package_info->image_limit;
1008
+	}
1009
+
1010
+	if ($preview) {
1011
+		$post_images = array();
1012
+		if (isset($post->post_images) && !empty($post->post_images)) {
1013
+			$post->post_images = trim($post->post_images, ",");
1014
+			$post_images = explode(",", $post->post_images);
1015
+		}
1016
+
1017
+		$main_slides = '';
1018
+		$nav_slides = '';
1019
+		$slides = 0;
1020
+
1021
+		if (!empty($post_images)) {
1022
+			foreach ($post_images as $image) {
1023
+				if ($image_limit !== '' && ($slides+1) > $image_limit) {
1024
+					 break;
1025
+				}
1026
+				if (!empty($image)) {
1027
+					$sizes = getimagesize(trim($image));
1028
+					$width = !empty($sizes) && isset($sizes[0]) ? $sizes[0] : 0;
1029
+					$height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1030
+
1031
+					if ($image && $width && $height) {
1032
+						$image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1033
+					}
1034
+
1035
+					if (isset($image->src)) {
1036
+						if ($image->height >= 400) {
1037
+							$spacer_height = 0;
1038
+						} else {
1039
+							$spacer_height = ((400 - $image->height) / 2);
1040
+						}
1041
+
1042
+						$image_title = isset($image->title) ? $image->title : '';
1043
+
1044
+						$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;" />';
1045
+						$main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1046
+						$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1047
+						$slides++;
1048
+					}
1049
+				}
1050
+			}// endfore
1051
+		} //end if
1052
+	} else {
1053
+		$main_slides = '';
1054
+		$nav_slides = '';
1055
+		/**
1056
+		 * Filter if default images should show on the details page.
1057
+		 *
1058
+		 * @param bool $use_default_image Default false.
1059
+		 * @since 1.6.16
1060
+		 */
1061
+		$use_default_image = apply_filters('geodir_details_default_image_show', false);
1062
+		$post_images = geodir_get_images($post->ID, 'thumbnail', $use_default_image); // Hide default image on listing preview/detail page.
1063
+		$slides = 0;
1064
+
1065
+		if (!empty($post_images)) {
1066
+			foreach ($post_images as $image) {
1067
+				if ($image_limit !== '' && ($slides+1) > $image_limit) {
1068
+					 break;
1069
+				}
1070
+				if ($image->height >= 400) {
1071
+					$spacer_height = 0;
1072
+				} else {
1073
+					$spacer_height = ((400 - $image->height) / 2);
1074
+				}
1075
+
1076
+				$caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1077
+				$main_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
+				$nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1079
+				$slides++;
1080
+			}
1081
+		}// endfore
1082
+	}
1083 1083
 
1084
-    if (!empty($post_images)) {
1085
-        ?>
1084
+	if (!empty($post_images)) {
1085
+		?>
1086 1086
         <div class="geodir_flex-container">
1087 1087
             <div class="geodir_flex-loader"><i class="fa fa-refresh fa-spin"></i></div>
1088 1088
             <div id="geodir_slider" class="geodir_flexslider ">
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
             <?php } ?>
1096 1096
         </div>
1097 1097
     <?php
1098
-    }
1098
+	}
1099 1099
 }
1100 1100
 
1101 1101
 add_action('geodir_details_taxonomies', 'geodir_action_details_taxonomies', 10);
@@ -1110,177 +1110,177 @@  discard block
 block discarded – undo
1110 1110
  */
1111 1111
 function geodir_action_details_taxonomies()
1112 1112
 {
1113
-    global $preview, $post;?>
1113
+	global $preview, $post;?>
1114 1114
     <p class="geodir_post_taxomomies clearfix">
1115 1115
     <?php
1116
-    $taxonomies = array();
1117
-
1118
-    $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
1119
-
1120
-    if ($preview && !$is_backend_preview) {
1121
-        $post_type = $post->listing_type;
1122
-        $post_taxonomy = $post_type . 'category';
1123
-        $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1124
-    } else {
1125
-        $post_type = $post->post_type;
1126
-        $post_taxonomy = $post_type . 'category';
1127
-    }
1116
+	$taxonomies = array();
1117
+
1118
+	$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
1119
+
1120
+	if ($preview && !$is_backend_preview) {
1121
+		$post_type = $post->listing_type;
1122
+		$post_taxonomy = $post_type . 'category';
1123
+		$post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1124
+	} else {
1125
+		$post_type = $post->post_type;
1126
+		$post_taxonomy = $post_type . 'category';
1127
+	}
1128 1128
 //{	
1129
-    $post_type_info = get_post_type_object($post_type);
1130
-    $listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1131
-
1132
-    if (!empty($post->post_tags)) {
1133
-
1134
-        if (taxonomy_exists($post_type . '_tags')):
1135
-            $links = array();
1136
-            $terms = array();
1137
-            // to limit post tags
1138
-            $post_tags = trim($post->post_tags, ",");
1139
-            $post_id = isset($post->ID) ? $post->ID : '';
1140
-            /**
1141
-             * Filter the post tags.
1142
-             *
1143
-             * Allows you to filter the post tags output on the details page of a post.
1144
-             *
1145
-             * @since 1.0.0
1146
-             * @param string $post_tags A comma seperated list of tags.
1147
-             * @param int $post_id The current post id.
1148
-             */
1149
-            $post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1150
-
1151
-            $post->post_tags = $post_tags;
1152
-            $post_tags = explode(",", trim($post->post_tags, ","));
1153
-
1154
-
1155
-            foreach ($post_tags as $post_term) {
1156
-
1157
-                // fix slug creation order for tags & location
1158
-                $post_term = trim($post_term);
1159
-
1160
-                $priority_location = false;
1161
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1162
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1163
-                } else {
1164
-                    $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1165
-                    $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1166
-                    $post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1167
-                    $match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1168
-                    $match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1169
-                    $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1170
-                    if ($match_country || $match_region || $match_city) {
1171
-                        $priority_location = true;
1172
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1173
-                    } else {
1174
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1175
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1176
-                    }
1177
-                }
1178
-
1179
-                if (!is_wp_error($term) && is_object($term)) {
1180
-
1181
-                    // fix tag link on detail page
1182
-                    if ($priority_location) {
1183
-
1184
-                        $tag_link = "<a href=''>$post_term</a>";
1185
-                        /**
1186
-                         * Filter the tag name on the details page.
1187
-                         *
1188
-                         * @since 1.5.6
1189
-                         * @param string $tag_link The tag link html.
1190
-                         * @param object $term The tag term object.
1191
-                         */
1192
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1193
-                        $links[] = $tag_link;
1194
-                    } else {
1195
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1196
-                        /** This action is documented in geodirectory-template_actions.php */
1197
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1198
-                        $links[] = $tag_link;
1199
-                    }
1200
-                    $terms[] = $term;
1201
-                }
1202
-                //
1203
-            }
1204
-            if (!isset($listing_label)) {
1205
-                $listing_label = '';
1206
-            }
1207
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1208
-        endif;
1209
-
1210
-    }
1211
-
1212
-    if (!empty($post->{$post_taxonomy})) {
1213
-        $links = array();
1214
-        $terms = array();
1215
-        $termsOrdered = array();
1216
-        if (!is_array($post->{$post_taxonomy})) {
1217
-            $post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1218
-        } else {
1219
-            $post_term = $post->{$post_taxonomy};
1129
+	$post_type_info = get_post_type_object($post_type);
1130
+	$listing_label = __($post_type_info->labels->singular_name, 'geodirectory');
1131
+
1132
+	if (!empty($post->post_tags)) {
1133
+
1134
+		if (taxonomy_exists($post_type . '_tags')):
1135
+			$links = array();
1136
+			$terms = array();
1137
+			// to limit post tags
1138
+			$post_tags = trim($post->post_tags, ",");
1139
+			$post_id = isset($post->ID) ? $post->ID : '';
1140
+			/**
1141
+			 * Filter the post tags.
1142
+			 *
1143
+			 * Allows you to filter the post tags output on the details page of a post.
1144
+			 *
1145
+			 * @since 1.0.0
1146
+			 * @param string $post_tags A comma seperated list of tags.
1147
+			 * @param int $post_id The current post id.
1148
+			 */
1149
+			$post_tags = apply_filters('geodir_action_details_post_tags', $post_tags, $post_id);
1150
+
1151
+			$post->post_tags = $post_tags;
1152
+			$post_tags = explode(",", trim($post->post_tags, ","));
1153
+
1154
+
1155
+			foreach ($post_tags as $post_term) {
1156
+
1157
+				// fix slug creation order for tags & location
1158
+				$post_term = trim($post_term);
1159
+
1160
+				$priority_location = false;
1161
+				if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1162
+					$term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1163
+				} else {
1164
+					$post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1165
+					$post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
1166
+					$post_city = isset($_REQUEST['post_city']) && $_REQUEST['post_city'] != '' ? sanitize_text_field($_REQUEST['post_city']) : NULL;
1167
+					$match_country = $post_country && sanitize_title($post_term) == sanitize_title($post_country) ? true : false;
1168
+					$match_region = $post_region && sanitize_title($post_term) == sanitize_title($post_region) ? true : false;
1169
+					$match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1170
+					if ($match_country || $match_region || $match_city) {
1171
+						$priority_location = true;
1172
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1173
+					} else {
1174
+						$insert_term = wp_insert_term($post_term, $post_type . '_tags');
1175
+						$term = get_term_by('name', $post_term, $post_type . '_tags');
1176
+					}
1177
+				}
1178
+
1179
+				if (!is_wp_error($term) && is_object($term)) {
1180
+
1181
+					// fix tag link on detail page
1182
+					if ($priority_location) {
1183
+
1184
+						$tag_link = "<a href=''>$post_term</a>";
1185
+						/**
1186
+						 * Filter the tag name on the details page.
1187
+						 *
1188
+						 * @since 1.5.6
1189
+						 * @param string $tag_link The tag link html.
1190
+						 * @param object $term The tag term object.
1191
+						 */
1192
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1193
+						$links[] = $tag_link;
1194
+					} else {
1195
+						$tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1196
+						/** This action is documented in geodirectory-template_actions.php */
1197
+						$tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1198
+						$links[] = $tag_link;
1199
+					}
1200
+					$terms[] = $term;
1201
+				}
1202
+				//
1203
+			}
1204
+			if (!isset($listing_label)) {
1205
+				$listing_label = '';
1206
+			}
1207
+			$taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1208
+		endif;
1209
+
1210
+	}
1211
+
1212
+	if (!empty($post->{$post_taxonomy})) {
1213
+		$links = array();
1214
+		$terms = array();
1215
+		$termsOrdered = array();
1216
+		if (!is_array($post->{$post_taxonomy})) {
1217
+			$post_term = explode(",", trim($post->{$post_taxonomy}, ","));
1218
+		} else {
1219
+			$post_term = $post->{$post_taxonomy};
1220 1220
 			
1221 1221
 			if ($preview && !$is_backend_preview) {
1222 1222
 				$post_term = geodir_add_parent_terms($post_term, $post_taxonomy);
1223 1223
 			}
1224
-        }
1225
-
1226
-        $post_term = array_unique($post_term);
1227
-        if (!empty($post_term)) {
1228
-            foreach ($post_term as $post_term) {
1229
-                $post_term = trim($post_term);
1230
-
1231
-                if ($post_term != ''):
1232
-                    $term = get_term_by('id', $post_term, $post_taxonomy);
1233
-
1234
-                    if (is_object($term)) {
1235
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1236
-                        /**
1237
-                         * Filter the category name on the details page.
1238
-                         *
1239
-                         * @since 1.5.6
1240
-                         * @param string $term_link The link html to the category.
1241
-                         * @param object $term The category term object.
1242
-                         */
1243
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1244
-                        $links[] = $term_link;
1245
-                        $terms[] = $term;
1246
-                    }
1247
-                endif;
1248
-            }
1249
-            // order alphabetically
1250
-            asort($links);
1251
-            foreach (array_keys($links) as $key) {
1252
-                $termsOrdered[$key] = $terms[$key];
1253
-            }
1254
-            $terms = $termsOrdered;
1224
+		}
1225
+
1226
+		$post_term = array_unique($post_term);
1227
+		if (!empty($post_term)) {
1228
+			foreach ($post_term as $post_term) {
1229
+				$post_term = trim($post_term);
1230
+
1231
+				if ($post_term != ''):
1232
+					$term = get_term_by('id', $post_term, $post_taxonomy);
1233
+
1234
+					if (is_object($term)) {
1235
+						$term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1236
+						/**
1237
+						 * Filter the category name on the details page.
1238
+						 *
1239
+						 * @since 1.5.6
1240
+						 * @param string $term_link The link html to the category.
1241
+						 * @param object $term The category term object.
1242
+						 */
1243
+						$term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1244
+						$links[] = $term_link;
1245
+						$terms[] = $term;
1246
+					}
1247
+				endif;
1248
+			}
1249
+			// order alphabetically
1250
+			asort($links);
1251
+			foreach (array_keys($links) as $key) {
1252
+				$termsOrdered[$key] = $terms[$key];
1253
+			}
1254
+			$terms = $termsOrdered;
1255 1255
 
1256
-        }
1256
+		}
1257 1257
 
1258
-        if (!isset($listing_label)) {
1259
-            $listing_label = '';
1260
-        }
1261
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1258
+		if (!isset($listing_label)) {
1259
+			$listing_label = '';
1260
+		}
1261
+		$taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1262 1262
 
1263
-    }
1263
+	}
1264 1264
 
1265
-    /**
1266
-     * Filter the taxonomies array before output.
1267
-     *
1268
-     * @since 1.5.9
1269
-     * @param array $taxonomies The array of cats and tags.
1270
-     * @param string $post_type The post type being output.
1271
-     * @param string $listing_label The post type label.
1272
-     * @param string $listing_label The post type label with ucwords function.
1273
-     */
1274
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1265
+	/**
1266
+	 * Filter the taxonomies array before output.
1267
+	 *
1268
+	 * @since 1.5.9
1269
+	 * @param array $taxonomies The array of cats and tags.
1270
+	 * @param string $post_type The post type being output.
1271
+	 * @param string $listing_label The post type label.
1272
+	 * @param string $listing_label The post type label with ucwords function.
1273
+	 */
1274
+	$taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1275 1275
 
1276
-    if (isset($taxonomies[$post_taxonomy])) {
1277
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1278
-    }
1276
+	if (isset($taxonomies[$post_taxonomy])) {
1277
+		echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1278
+	}
1279 1279
 
1280
-    if (isset($taxonomies[$post_type . '_tags']))
1281
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1280
+	if (isset($taxonomies[$post_type . '_tags']))
1281
+		echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1282 1282
 
1283
-    ?>
1283
+	?>
1284 1284
     </p><?php
1285 1285
 }
1286 1286
 
@@ -1302,144 +1302,144 @@  discard block
 block discarded – undo
1302 1302
 function geodir_action_details_micordata($post='')
1303 1303
 {
1304 1304
 
1305
-    global $preview;
1306
-    if(empty($post)){global $post;}
1307
-    if ($preview || !geodir_is_page('detail')) {
1308
-        return;
1309
-    }
1310
-
1311
-    // url
1312
-    $c_url = geodir_curPageURL();
1313
-
1314
-    // post reviews
1315
-    $post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1316
-    if (empty($post_reviews)) {
1317
-        $reviews = '';
1318
-    } else {
1319
-        foreach ($post_reviews as $review) {
1320
-
1321
-            if($rating_value = geodir_get_commentoverall($review->comment_ID)){
1322
-                $reviews[] = array(
1323
-                    "@type" => "Review",
1324
-                    "author" => $review->comment_author,
1325
-                    "datePublished" => $review->comment_date,
1326
-                    "description" => $review->comment_content,
1327
-                    "reviewRating" => array(
1328
-                        "@type" => "Rating",
1329
-                        "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1330
-                        "ratingValue" => $rating_value,
1331
-                        "worstRating" => "1"
1332
-                    )
1333
-                );
1334
-            }
1335
-
1336
-        }
1337
-
1338
-    }
1339
-
1340
-    // post images
1341
-    $post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1342
-    if (empty($post_images)) {
1343
-        $images = '';
1344
-    } else {
1345
-        $i_arr = array();
1346
-        foreach ($post_images as $img) {
1347
-            $i_arr[] = $img->src;
1348
-        }
1349
-
1350
-        if (count($i_arr) == 1) {
1351
-            $images = $i_arr[0];
1352
-        } else {
1353
-            $images = $i_arr;
1354
-        }
1305
+	global $preview;
1306
+	if(empty($post)){global $post;}
1307
+	if ($preview || !geodir_is_page('detail')) {
1308
+		return;
1309
+	}
1310
+
1311
+	// url
1312
+	$c_url = geodir_curPageURL();
1313
+
1314
+	// post reviews
1315
+	$post_reviews = get_comments(array('post_id' => $post->ID, 'status' => 'approve'));
1316
+	if (empty($post_reviews)) {
1317
+		$reviews = '';
1318
+	} else {
1319
+		foreach ($post_reviews as $review) {
1320
+
1321
+			if($rating_value = geodir_get_commentoverall($review->comment_ID)){
1322
+				$reviews[] = array(
1323
+					"@type" => "Review",
1324
+					"author" => $review->comment_author,
1325
+					"datePublished" => $review->comment_date,
1326
+					"description" => $review->comment_content,
1327
+					"reviewRating" => array(
1328
+						"@type" => "Rating",
1329
+						"bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1330
+						"ratingValue" => $rating_value,
1331
+						"worstRating" => "1"
1332
+					)
1333
+				);
1334
+			}
1355 1335
 
1356
-    }
1357
-    //print_r($post);
1358
-    // external links
1359
-    $external_links =  array();
1360
-    $external_links[] = $post->geodir_website;
1361
-    $external_links[] = $post->geodir_twitter;
1362
-    $external_links[] = $post->geodir_facebook;
1363
-    $external_links = array_filter($external_links);
1364
-
1365
-    if(!empty($external_links)){
1366
-        $external_links = array_values($external_links);
1367
-    }
1368
-
1369
-    // reviews
1370
-    $comment_count = geodir_get_review_count_total($post->ID);
1371
-    $post_avgratings = geodir_get_post_rating($post->ID);
1372
-
1373
-    // schema type
1374
-    $schema_type = 'LocalBusiness';
1375
-    if(isset($post->default_category) && $post->default_category){
1376
-        $cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1377
-        if($cat_schema){$schema_type = $cat_schema;}
1378
-        if(!$cat_schema && $schema_type=='LocalBusiness' && $post->post_type=='gd_event'){$schema_type = 'Event';}
1379
-    }
1380
-
1381
-    $schema = array();
1382
-    $schema['@context'] = "https://schema.org";
1383
-    $schema['@type'] = $schema_type;
1384
-    $schema['name'] = $post->post_title;
1385
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1386
-    $schema['telephone'] = $post->geodir_contact;
1387
-    $schema['url'] = $c_url;
1388
-    $schema['sameAs'] = $external_links;
1389
-    $schema['image'] = $images;
1390
-    $schema['address'] = array(
1391
-        "@type" => "PostalAddress",
1392
-        "streetAddress" => $post->post_address,
1393
-        "addressLocality" => $post->post_city,
1394
-        "addressRegion" => $post->post_region,
1395
-        "addressCountry" => $post->post_country,
1396
-        "postalCode" => $post->post_zip
1397
-    );
1398
-
1399
-    if($post->post_latitude && $post->post_longitude) {
1400
-        $schema['geo'] = array(
1401
-            "@type" => "GeoCoordinates",
1402
-            "latitude" => $post->post_latitude,
1403
-            "longitude" => $post->post_longitude
1404
-        );
1405
-    }
1406
-
1407
-    if($post_avgratings) {
1408
-        $schema['aggregateRating'] = array(
1409
-            "@type" => "AggregateRating",
1410
-            "ratingValue" => $post_avgratings,
1411
-            "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1412
-            "worstRating" => "1",
1413
-            "ratingCount" => $comment_count
1414
-        );
1415
-    }
1416
-    $schema['review'] = $reviews;
1417
-
1418
-    /**
1419
-     * Allow the schema JSON-LD info to be filtered.
1420
-     *
1421
-     * @since 1.5.4
1422
-     * @since 1.5.7 Added $post variable.
1423
-     * @param array $schema The array of schema data to be filtered.
1424
-     * @param object $post The post object.
1425
-     */
1426
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1427
-
1428
-
1429
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1430
-
1431
-
1432
-    $uploads = wp_upload_dir();
1433
-    $facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1434
-
1435
-    /**
1436
-     * Show facebook open graph meta info
1437
-     *
1438
-     * @since 1.6.6
1439
-     * @param string $facebook_og The open graph html to be filtered.
1440
-     * @param object $post The post object.
1441
-     */
1442
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1336
+		}
1337
+
1338
+	}
1339
+
1340
+	// post images
1341
+	$post_images = geodir_get_images($post->ID, 'thumbnail', get_option('geodir_listing_no_img'));
1342
+	if (empty($post_images)) {
1343
+		$images = '';
1344
+	} else {
1345
+		$i_arr = array();
1346
+		foreach ($post_images as $img) {
1347
+			$i_arr[] = $img->src;
1348
+		}
1349
+
1350
+		if (count($i_arr) == 1) {
1351
+			$images = $i_arr[0];
1352
+		} else {
1353
+			$images = $i_arr;
1354
+		}
1355
+
1356
+	}
1357
+	//print_r($post);
1358
+	// external links
1359
+	$external_links =  array();
1360
+	$external_links[] = $post->geodir_website;
1361
+	$external_links[] = $post->geodir_twitter;
1362
+	$external_links[] = $post->geodir_facebook;
1363
+	$external_links = array_filter($external_links);
1364
+
1365
+	if(!empty($external_links)){
1366
+		$external_links = array_values($external_links);
1367
+	}
1368
+
1369
+	// reviews
1370
+	$comment_count = geodir_get_review_count_total($post->ID);
1371
+	$post_avgratings = geodir_get_post_rating($post->ID);
1372
+
1373
+	// schema type
1374
+	$schema_type = 'LocalBusiness';
1375
+	if(isset($post->default_category) && $post->default_category){
1376
+		$cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1377
+		if($cat_schema){$schema_type = $cat_schema;}
1378
+		if(!$cat_schema && $schema_type=='LocalBusiness' && $post->post_type=='gd_event'){$schema_type = 'Event';}
1379
+	}
1380
+
1381
+	$schema = array();
1382
+	$schema['@context'] = "https://schema.org";
1383
+	$schema['@type'] = $schema_type;
1384
+	$schema['name'] = $post->post_title;
1385
+	$schema['description'] = wp_strip_all_tags( $post->post_content, true );
1386
+	$schema['telephone'] = $post->geodir_contact;
1387
+	$schema['url'] = $c_url;
1388
+	$schema['sameAs'] = $external_links;
1389
+	$schema['image'] = $images;
1390
+	$schema['address'] = array(
1391
+		"@type" => "PostalAddress",
1392
+		"streetAddress" => $post->post_address,
1393
+		"addressLocality" => $post->post_city,
1394
+		"addressRegion" => $post->post_region,
1395
+		"addressCountry" => $post->post_country,
1396
+		"postalCode" => $post->post_zip
1397
+	);
1398
+
1399
+	if($post->post_latitude && $post->post_longitude) {
1400
+		$schema['geo'] = array(
1401
+			"@type" => "GeoCoordinates",
1402
+			"latitude" => $post->post_latitude,
1403
+			"longitude" => $post->post_longitude
1404
+		);
1405
+	}
1406
+
1407
+	if($post_avgratings) {
1408
+		$schema['aggregateRating'] = array(
1409
+			"@type" => "AggregateRating",
1410
+			"ratingValue" => $post_avgratings,
1411
+			"bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1412
+			"worstRating" => "1",
1413
+			"ratingCount" => $comment_count
1414
+		);
1415
+	}
1416
+	$schema['review'] = $reviews;
1417
+
1418
+	/**
1419
+	 * Allow the schema JSON-LD info to be filtered.
1420
+	 *
1421
+	 * @since 1.5.4
1422
+	 * @since 1.5.7 Added $post variable.
1423
+	 * @param array $schema The array of schema data to be filtered.
1424
+	 * @param object $post The post object.
1425
+	 */
1426
+	$schema = apply_filters('geodir_details_schema', $schema,$post);
1427
+
1428
+
1429
+	echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1430
+
1431
+
1432
+	$uploads = wp_upload_dir();
1433
+	$facebook_og = (isset($post->featured_image) && $post->featured_image) ? '<meta property="og:image" content="'.$uploads['baseurl'].$post->featured_image.'"/>' : '';
1434
+
1435
+	/**
1436
+	 * Show facebook open graph meta info
1437
+	 *
1438
+	 * @since 1.6.6
1439
+	 * @param string $facebook_og The open graph html to be filtered.
1440
+	 * @param object $post The post object.
1441
+	 */
1442
+	echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1443 1443
 
1444 1444
 
1445 1445
 
@@ -1459,7 +1459,7 @@  discard block
 block discarded – undo
1459 1459
  */
1460 1460
 function geodir_action_details_next_prev()
1461 1461
 {
1462
-    ?>
1462
+	?>
1463 1463
     <div class="geodir-pos_navigation clearfix">
1464 1464
     <div
1465 1465
         class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
@@ -1477,15 +1477,15 @@  discard block
 block discarded – undo
1477 1477
  */
1478 1478
 function geodir_action_before_single_post()
1479 1479
 {
1480
-    global $post;
1481
-    /**
1482
-     * Called at the very start of the details page output, before the title section.
1483
-     *
1484
-     * @since 1.0.0
1485
-     * @param object $post The current post object.
1486
-     * @global WP_Post|null $post The current post, if available.
1487
-     */
1488
-    do_action('geodir_before_single_post', $post); // extra action	
1480
+	global $post;
1481
+	/**
1482
+	 * Called at the very start of the details page output, before the title section.
1483
+	 *
1484
+	 * @since 1.0.0
1485
+	 * @param object $post The current post object.
1486
+	 * @global WP_Post|null $post The current post, if available.
1487
+	 */
1488
+	do_action('geodir_before_single_post', $post); // extra action	
1489 1489
 }
1490 1490
 
1491 1491
 /**
@@ -1496,13 +1496,13 @@  discard block
 block discarded – undo
1496 1496
  */
1497 1497
 function geodir_action_after_single_post($post)
1498 1498
 {
1499
-    /**
1500
-     * Called on the details page after the details page tabs section and before the next/prev buttons.
1501
-     *
1502
-     * @since 1.0.0
1503
-     * @param object $post The current post object.
1504
-     */
1505
-    do_action('geodir_after_single_post', $post); // extra action	
1499
+	/**
1500
+	 * Called on the details page after the details page tabs section and before the next/prev buttons.
1501
+	 *
1502
+	 * @since 1.0.0
1503
+	 * @param object $post The current post object.
1504
+	 */
1505
+	do_action('geodir_after_single_post', $post); // extra action	
1506 1506
 }
1507 1507
 
1508 1508
 add_action('geodir_details_main_content', 'geodir_action_before_single_post', 10);
@@ -1528,168 +1528,168 @@  discard block
 block discarded – undo
1528 1528
  */
1529 1529
 function geodir_action_listings_title()
1530 1530
 {
1531
-    global $wp, $term;
1532
-
1533
-    $gd_post_type = geodir_get_current_posttype();
1534
-    $post_type_info = get_post_type_object($gd_post_type);
1531
+	global $wp, $term;
1535 1532
 
1536
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1537
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1538
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1539
-    }
1533
+	$gd_post_type = geodir_get_current_posttype();
1534
+	$post_type_info = get_post_type_object($gd_post_type);
1540 1535
 
1541
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1542
-    $single_name = $post_type_info->labels->singular_name;
1536
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
1537
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1538
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1539
+	}
1543 1540
 
1544
-    $taxonomy = geodir_get_taxonomies($gd_post_type, true);
1541
+	$list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1542
+	$single_name = $post_type_info->labels->singular_name;
1545 1543
 
1546
-    $gd_country = get_query_var('gd_country');
1547
-    $gd_region = get_query_var('gd_region');
1548
-    $gd_city = get_query_var('gd_city');
1544
+	$taxonomy = geodir_get_taxonomies($gd_post_type, true);
1549 1545
 
1550
-    if (!empty($term)) {
1551
-        $location_name = '';
1552
-        if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1553
-            if ($gd_country != '') {
1554
-                $location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1555
-            }
1546
+	$gd_country = get_query_var('gd_country');
1547
+	$gd_region = get_query_var('gd_region');
1548
+	$gd_city = get_query_var('gd_city');
1556 1549
 
1557
-            if ($gd_region != '') {
1558
-                $location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1559
-            }
1560
-
1561
-            if ($gd_city != '') {
1562
-                $location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1563
-            }
1564
-        }
1565
-
1566
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
1567
-        if (!empty($current_term)) {
1568
-            $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1569
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1570
-                $location_last_char = substr($location_name, -1);
1571
-                $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1572
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1573
-            } else {
1574
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1575
-            }
1576
-        } else {
1577
-            if (count($taxonomy) > 1) {
1578
-                $current_term = get_term_by('slug', $term, $taxonomy[1]);
1579
-
1580
-                if (!empty($current_term)) {
1581
-                    $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1582
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1583
-                        $location_last_char = substr($location_name, -1);
1584
-                        $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1585
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1586
-                    } else {
1587
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1588
-                    }
1589
-                }
1590
-            }
1591
-        }
1592
-
1593
-    } else {
1594
-        $gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1595
-        $gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1596
-        $gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1597
-
1598
-        $gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1599
-
1600
-        if (function_exists('get_actual_location_name')) {
1601
-            $gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1602
-            $gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1603
-            $gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1604
-        }
1605
-
1606
-        if ($gd_city != '') {
1607
-            if ($gd_city_actual != '') {
1608
-                $gd_city = $gd_city_actual;
1609
-            } else {
1610
-                $gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1611
-                $gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1612
-                $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1613
-            }
1614
-
1615
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1616
-        } else if ($gd_region != '') {
1617
-            if ($gd_region_actual != '') {
1618
-                $gd_region = $gd_region_actual;
1619
-            } else {
1620
-                $gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1621
-                $gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1622
-                $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1623
-            }
1624
-
1625
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1626
-        } else if ($gd_country != '') {
1627
-            if ($gd_country_actual != '') {
1628
-                $gd_country = $gd_country_actual;
1629
-            } else {
1630
-                $gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1631
-                $gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1632
-                $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1633
-            }
1634
-
1635
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1636
-        }
1637
-    }
1638
-
1639
-    if (is_search()) {
1640
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1641
-    }
1642
-    /** This action is documented in geodirectory_template_actions.php */
1643
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
1644
-    /** This action is documented in geodirectory_template_actions.php */
1645
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1646
-
1647
-
1648
-    $title = $list_title;
1649
-    $gd_page = '';
1650
-    if(geodir_is_page('pt')){
1651
-        $gd_page = 'pt';
1652
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1653
-    }
1654
-    elseif(geodir_is_page('listing')){
1655
-        $gd_page = 'listing';
1656
-        global $wp_query;
1657
-        $current_term = $wp_query->get_queried_object();
1658
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1659
-            $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1660
-        }else{
1661
-            $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1662
-        }
1550
+	if (!empty($term)) {
1551
+		$location_name = '';
1552
+		if ($gd_country != '' || $gd_region != '' || $gd_city != '') {
1553
+			if ($gd_country != '') {
1554
+				$location_name = geodir_sanitize_location_name('gd_country', $gd_country);
1555
+			}
1663 1556
 
1664
-    }
1665
-    elseif(geodir_is_page('author')){
1666
-        $gd_page = 'author';
1667
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1668
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1669
-        }else{
1670
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1671
-        }
1557
+			if ($gd_region != '') {
1558
+				$location_name = geodir_sanitize_location_name('gd_region', $gd_region);
1559
+			}
1672 1560
 
1673
-    }
1561
+			if ($gd_city != '') {
1562
+				$location_name = geodir_sanitize_location_name('gd_city', $gd_city);
1563
+			}
1564
+		}
1565
+
1566
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
1567
+		if (!empty($current_term)) {
1568
+			$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1569
+			if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1570
+				$location_last_char = substr($location_name, -1);
1571
+				$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1572
+				$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1573
+			} else {
1574
+				$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1575
+			}
1576
+		} else {
1577
+			if (count($taxonomy) > 1) {
1578
+				$current_term = get_term_by('slug', $term, $taxonomy[1]);
1579
+
1580
+				if (!empty($current_term)) {
1581
+					$current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1582
+					if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1583
+						$location_last_char = substr($location_name, -1);
1584
+						$location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1585
+						$list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1586
+					} else {
1587
+						$list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1588
+					}
1589
+				}
1590
+			}
1591
+		}
1592
+
1593
+	} else {
1594
+		$gd_country = (isset($wp->query_vars['gd_country']) && $wp->query_vars['gd_country'] != '') ? $wp->query_vars['gd_country'] : '';
1595
+		$gd_region = (isset($wp->query_vars['gd_region']) && $wp->query_vars['gd_region'] != '') ? $wp->query_vars['gd_region'] : '';
1596
+		$gd_city = (isset($wp->query_vars['gd_city']) && $wp->query_vars['gd_city'] != '') ? $wp->query_vars['gd_city'] : '';
1597
+
1598
+		$gd_country_actual = $gd_region_actual = $gd_city_actual = '';
1599
+
1600
+		if (function_exists('get_actual_location_name')) {
1601
+			$gd_country_actual = $gd_country != '' ? get_actual_location_name('country', $gd_country, true) : $gd_country;
1602
+			$gd_region_actual = $gd_region != '' ? get_actual_location_name('region', $gd_region) : $gd_region;
1603
+			$gd_city_actual = $gd_city != '' ? get_actual_location_name('city', $gd_city) : $gd_city;
1604
+		}
1605
+
1606
+		if ($gd_city != '') {
1607
+			if ($gd_city_actual != '') {
1608
+				$gd_city = $gd_city_actual;
1609
+			} else {
1610
+				$gd_city = preg_replace('/-(\d+)$/', '', $gd_city);
1611
+				$gd_city = preg_replace('/[_-]/', ' ', $gd_city);
1612
+				$gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1613
+			}
1674 1614
 
1615
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1616
+		} else if ($gd_region != '') {
1617
+			if ($gd_region_actual != '') {
1618
+				$gd_region = $gd_region_actual;
1619
+			} else {
1620
+				$gd_region = preg_replace('/-(\d+)$/', '', $gd_region);
1621
+				$gd_region = preg_replace('/[_-]/', ' ', $gd_region);
1622
+				$gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1623
+			}
1675 1624
 
1676
-    /**
1677
-     * Filter page title to replace variables.
1678
-     *
1679
-     * @since 1.5.4
1680
-     * @param string $title The page title including variables.
1681
-     * @param string $gd_page The GeoDirectory page type if any.
1682
-     */
1683
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1625
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1626
+		} else if ($gd_country != '') {
1627
+			if ($gd_country_actual != '') {
1628
+				$gd_country = $gd_country_actual;
1629
+			} else {
1630
+				$gd_country = preg_replace('/-(\d+)$/', '', $gd_country);
1631
+				$gd_country = preg_replace('/[_-]/', ' ', $gd_country);
1632
+				$gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1633
+			}
1684 1634
 
1685
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1686
-        /**
1687
-         * Filter the listing page title.
1688
-         *
1689
-         * @since 1.0.0
1690
-         * @param string $list_title The title for the category page.
1691
-         */
1692
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1635
+			$list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1636
+		}
1637
+	}
1638
+
1639
+	if (is_search()) {
1640
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1641
+	}
1642
+	/** This action is documented in geodirectory_template_actions.php */
1643
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
1644
+	/** This action is documented in geodirectory_template_actions.php */
1645
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
1646
+
1647
+
1648
+	$title = $list_title;
1649
+	$gd_page = '';
1650
+	if(geodir_is_page('pt')){
1651
+		$gd_page = 'pt';
1652
+		$title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1653
+	}
1654
+	elseif(geodir_is_page('listing')){
1655
+		$gd_page = 'listing';
1656
+		global $wp_query;
1657
+		$current_term = $wp_query->get_queried_object();
1658
+		if (strpos($current_term->taxonomy,'_tags') !== false) {
1659
+			$title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1660
+		}else{
1661
+			$title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1662
+		}
1663
+
1664
+	}
1665
+	elseif(geodir_is_page('author')){
1666
+		$gd_page = 'author';
1667
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1668
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1669
+		}else{
1670
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1671
+		}
1672
+
1673
+	}
1674
+
1675
+
1676
+	/**
1677
+	 * Filter page title to replace variables.
1678
+	 *
1679
+	 * @since 1.5.4
1680
+	 * @param string $title The page title including variables.
1681
+	 * @param string $gd_page The GeoDirectory page type if any.
1682
+	 */
1683
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1684
+
1685
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1686
+		/**
1687
+		 * Filter the listing page title.
1688
+		 *
1689
+		 * @since 1.0.0
1690
+		 * @param string $list_title The title for the category page.
1691
+		 */
1692
+		apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1693 1693
 }
1694 1694
 
1695 1695
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1702,46 +1702,46 @@  discard block
 block discarded – undo
1702 1702
  */
1703 1703
 function geodir_action_listings_description()
1704 1704
 {
1705
-    global $wp_query;
1706
-    $current_term = $wp_query->get_queried_object();
1705
+	global $wp_query;
1706
+	$current_term = $wp_query->get_queried_object();
1707 1707
 
1708
-    $gd_post_type = geodir_get_current_posttype();
1709
-    if (isset($current_term->term_id) && $current_term->term_id != '') {
1708
+	$gd_post_type = geodir_get_current_posttype();
1709
+	if (isset($current_term->term_id) && $current_term->term_id != '') {
1710 1710
 
1711
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1712
-        $saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1713
-        if ($term_desc && !$saved_data) {
1714
-            $saved_data = $term_desc;
1715
-        }
1711
+		$term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1712
+		$saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1713
+		if ($term_desc && !$saved_data) {
1714
+			$saved_data = $term_desc;
1715
+		}
1716 1716
 
1717
-        // stop payment manager filtering content length
1718
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1719
-        if ( false !== $filter_priority ) {
1720
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1721
-        }
1717
+		// stop payment manager filtering content length
1718
+		$filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1719
+		if ( false !== $filter_priority ) {
1720
+			remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1721
+		}
1722 1722
 
1723
-        /**
1724
-         * Apply the core filter `the_content` filter to the variable string.
1725
-         *
1726
-         * This is a WordPress core filter that does many things.
1727
-         *
1728
-         * @since 1.0.0
1729
-         * @param string $var The string to apply the filter to.
1730
-         */
1731
-        $cat_description = apply_filters('the_content', $saved_data);
1723
+		/**
1724
+		 * Apply the core filter `the_content` filter to the variable string.
1725
+		 *
1726
+		 * This is a WordPress core filter that does many things.
1727
+		 *
1728
+		 * @since 1.0.0
1729
+		 * @param string $var The string to apply the filter to.
1730
+		 */
1731
+		$cat_description = apply_filters('the_content', $saved_data);
1732 1732
 
1733 1733
 
1734
-        if ( false !== $filter_priority ) {
1735
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1736
-        }
1734
+		if ( false !== $filter_priority ) {
1735
+			add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1736
+		}
1737 1737
 
1738
-        if ($cat_description) {
1739
-            ?>
1738
+		if ($cat_description) {
1739
+			?>
1740 1740
 
1741 1741
             <div class="term_description"><?php echo $cat_description;?></div> <?php
1742
-        }
1742
+		}
1743 1743
 
1744
-    }
1744
+	}
1745 1745
 }
1746 1746
 
1747 1747
 // action for adding the listings page top widget area
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
  */
1761 1761
 function geodir_action_geodir_sidebar_listings_top()
1762 1762
 {
1763
-    if (get_option('geodir_show_listing_top_section')) { ?>
1763
+	if (get_option('geodir_show_listing_top_section')) { ?>
1764 1764
         <div
1765 1765
             class="<?php
1766
-            /** This action is documented in geodirectory_template_actions.php */
1767
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1766
+			/** This action is documented in geodirectory_template_actions.php */
1767
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_top'); ?>">
1768 1768
             <?php dynamic_sidebar('geodir_listing_top'); ?>
1769 1769
         </div><!-- clearfix ends here-->
1770 1770
     <?php }
@@ -1787,35 +1787,35 @@  discard block
 block discarded – undo
1787 1787
  */
1788 1788
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1789 1789
 {
1790
-    if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1791
-        $width_css = 'style="width:' . $width . '%;"';
1792
-    } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1793
-        $width_css = 'style="width:' . $width . '%;"';
1794
-    } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1795
-        $width_css = 'style="width:' . $width . '%;"';
1796
-    } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1797
-        $width_css = 'style="width:' . $width . '%;"';
1798
-    } else {
1799
-        $width_css = '';
1800
-    }
1801
-
1802
-    $tc = get_option('theme_compatibility_setting');
1803
-    if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1804
-        $text = $tc['geodir_sidebar_left_open_replace'];
1805
-    } else {
1806
-        $text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1807
-    }
1808
-
1809
-    if (!empty($tc['geodir_sidebar_left_open_id'])) {
1810
-        $id = $tc['geodir_sidebar_left_open_id'];
1811
-    }
1812
-    if (!empty($tc['geodir_sidebar_left_open_class'])) {
1813
-        $class = $tc['geodir_sidebar_left_open_class'];
1814
-    }
1815
-
1816
-    $text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1817
-
1818
-    echo $text;
1790
+	if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1791
+		$width_css = 'style="width:' . $width . '%;"';
1792
+	} elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1793
+		$width_css = 'style="width:' . $width . '%;"';
1794
+	} elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1795
+		$width_css = 'style="width:' . $width . '%;"';
1796
+	} elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1797
+		$width_css = 'style="width:' . $width . '%;"';
1798
+	} else {
1799
+		$width_css = '';
1800
+	}
1801
+
1802
+	$tc = get_option('theme_compatibility_setting');
1803
+	if (!empty($tc['geodir_sidebar_left_open_replace'])) {
1804
+		$text = $tc['geodir_sidebar_left_open_replace'];
1805
+	} else {
1806
+		$text = '<aside  id="[id]" class="[class]" role="complementary" itemscope itemtype="[itemtype]" [width_css]>';
1807
+	}
1808
+
1809
+	if (!empty($tc['geodir_sidebar_left_open_id'])) {
1810
+		$id = $tc['geodir_sidebar_left_open_id'];
1811
+	}
1812
+	if (!empty($tc['geodir_sidebar_left_open_class'])) {
1813
+		$class = $tc['geodir_sidebar_left_open_class'];
1814
+	}
1815
+
1816
+	$text = str_replace(array("[id]", "[class]", "[itemtype]", "[width_css]"), array($id, $class, $itemtype, $width_css), $text);
1817
+
1818
+	echo $text;
1819 1819
 }
1820 1820
 
1821 1821
 // action for adding the primary div closing tag
@@ -1831,13 +1831,13 @@  discard block
 block discarded – undo
1831 1831
  */
1832 1832
 function geodir_action_sidebar_left_close($type = '')
1833 1833
 {
1834
-    $tc = get_option('theme_compatibility_setting');
1835
-    if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1836
-        $text = $tc['geodir_sidebar_left_close_replace'];
1837
-    } else {
1838
-        $text = '</aside><!-- sidebar ends here-->';
1839
-    }
1840
-    echo $text;
1834
+	$tc = get_option('theme_compatibility_setting');
1835
+	if (!empty($tc['geodir_sidebar_left_close_replace'])) {
1836
+		$text = $tc['geodir_sidebar_left_close_replace'];
1837
+	} else {
1838
+		$text = '</aside><!-- sidebar ends here-->';
1839
+	}
1840
+	echo $text;
1841 1841
 }
1842 1842
 
1843 1843
 /**
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
  */
1851 1851
 function geodir_listing_left_section()
1852 1852
 {
1853
-    if (get_option('geodir_show_listing_left_section')) { ?>
1853
+	if (get_option('geodir_show_listing_left_section')) { ?>
1854 1854
         <div class="geodir-content-left geodir-sidebar-wrap">
1855 1855
             <?php dynamic_sidebar('geodir_listing_left_sidebar'); ?>
1856 1856
         </div><!-- end geodir-content-left -->
@@ -1868,20 +1868,20 @@  discard block
 block discarded – undo
1868 1868
  */
1869 1869
 function geodir_action_listings_sidebar_left()
1870 1870
 {
1871
-    if (get_option('geodir_show_listing_left_section')) {
1872
-        /** This action is documented in geodirectory_template_actions.php */
1873
-        do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1874
-        /**
1875
-         * Calls the listings page (category) left sidebar content.
1876
-         *
1877
-         * All the content for the listings page left sidebar is added via this hook.
1878
-         *
1879
-         * @since 1.0.0
1880
-         */
1881
-        do_action('geodir_listings_sidebar_left_inside');
1882
-        /** This action is documented in geodirectory_template_actions.php */
1883
-        do_action('geodir_sidebar_left_close', 'listings-page');
1884
-    }
1871
+	if (get_option('geodir_show_listing_left_section')) {
1872
+		/** This action is documented in geodirectory_template_actions.php */
1873
+		do_action('geodir_sidebar_left_open', 'listings-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'https://schema.org/WPSideBar');
1874
+		/**
1875
+		 * Calls the listings page (category) left sidebar content.
1876
+		 *
1877
+		 * All the content for the listings page left sidebar is added via this hook.
1878
+		 *
1879
+		 * @since 1.0.0
1880
+		 */
1881
+		do_action('geodir_listings_sidebar_left_inside');
1882
+		/** This action is documented in geodirectory_template_actions.php */
1883
+		do_action('geodir_sidebar_left_close', 'listings-page');
1884
+	}
1885 1885
 }
1886 1886
 
1887 1887
 /**
@@ -1894,7 +1894,7 @@  discard block
 block discarded – undo
1894 1894
  */
1895 1895
 function geodir_listing_right_section()
1896 1896
 {
1897
-    if (get_option('geodir_show_listing_right_section')) { ?>
1897
+	if (get_option('geodir_show_listing_right_section')) { ?>
1898 1898
         <div class="geodir-content-right geodir-sidebar-wrap">
1899 1899
             <?php dynamic_sidebar('geodir_listing_right_sidebar'); ?>
1900 1900
         </div><!-- end geodir-content-right -->
@@ -1912,20 +1912,20 @@  discard block
 block discarded – undo
1912 1912
  */
1913 1913
 function geodir_action_listings_sidebar_right()
1914 1914
 {
1915
-    if (get_option('geodir_show_listing_right_section')) {
1916
-        /** This action is documented in geodirectory_template_actions.php */
1917
-        do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1918
-        /**
1919
-         * Calls the listings page (category) right sidebar content.
1920
-         *
1921
-         * All the content for the listings page right sidebar is added via this hook.
1922
-         *
1923
-         * @since 1.0.0
1924
-         */
1925
-        do_action('geodir_listings_sidebar_right_inside');
1926
-        /** This action is documented in geodirectory_template_actions.php */
1927
-        do_action('geodir_sidebar_right_close', 'listings-page');
1928
-    }
1915
+	if (get_option('geodir_show_listing_right_section')) {
1916
+		/** This action is documented in geodirectory_template_actions.php */
1917
+		do_action('geodir_sidebar_right_open', 'listings-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
1918
+		/**
1919
+		 * Calls the listings page (category) right sidebar content.
1920
+		 *
1921
+		 * All the content for the listings page right sidebar is added via this hook.
1922
+		 *
1923
+		 * @since 1.0.0
1924
+		 */
1925
+		do_action('geodir_listings_sidebar_right_inside');
1926
+		/** This action is documented in geodirectory_template_actions.php */
1927
+		do_action('geodir_sidebar_right_close', 'listings-page');
1928
+	}
1929 1929
 }
1930 1930
 
1931 1931
 
@@ -1942,23 +1942,23 @@  discard block
 block discarded – undo
1942 1942
  */
1943 1943
 function geodir_action_main_content_open($type = '', $id = '', $class = '')
1944 1944
 {
1945
-    $tc = get_option('theme_compatibility_setting');
1946
-    if (!empty($tc['geodir_main_content_open_replace'])) {
1947
-        $text = $tc['geodir_main_content_open_replace'];
1948
-    } else {
1949
-        $text = '<main id="[id]" class="[class]" role="main">';
1950
-    }
1945
+	$tc = get_option('theme_compatibility_setting');
1946
+	if (!empty($tc['geodir_main_content_open_replace'])) {
1947
+		$text = $tc['geodir_main_content_open_replace'];
1948
+	} else {
1949
+		$text = '<main id="[id]" class="[class]" role="main">';
1950
+	}
1951 1951
 
1952
-    if (!empty($tc['geodir_main_content_open_id'])) {
1953
-        $id = $tc['geodir_main_content_open_id'];
1954
-    }
1955
-    if (!empty($tc['geodir_main_content_open_class'])) {
1956
-        $class = $tc['geodir_main_content_open_class'];
1957
-    }
1952
+	if (!empty($tc['geodir_main_content_open_id'])) {
1953
+		$id = $tc['geodir_main_content_open_id'];
1954
+	}
1955
+	if (!empty($tc['geodir_main_content_open_class'])) {
1956
+		$class = $tc['geodir_main_content_open_class'];
1957
+	}
1958 1958
 
1959
-    $text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1959
+	$text = str_replace(array("[id]", "[class]"), array($id, $class), $text);
1960 1960
 
1961
-    echo $text;
1961
+	echo $text;
1962 1962
 }
1963 1963
 
1964 1964
 // action for adding the primary div closing tag
@@ -1971,13 +1971,13 @@  discard block
 block discarded – undo
1971 1971
  */
1972 1972
 function geodir_action_main_content_close()
1973 1973
 {
1974
-    $tc = get_option('theme_compatibility_setting');
1975
-    if (!empty($tc['geodir_main_content_close_replace'])) {
1976
-        $text = $tc['geodir_main_content_close_replace'];
1977
-    } else {
1978
-        $text = '</main><!-- main ends here-->';
1979
-    }
1980
-    echo $text;
1974
+	$tc = get_option('theme_compatibility_setting');
1975
+	if (!empty($tc['geodir_main_content_close_replace'])) {
1976
+		$text = $tc['geodir_main_content_close_replace'];
1977
+	} else {
1978
+		$text = '</main><!-- main ends here-->';
1979
+	}
1980
+	echo $text;
1981 1981
 }
1982 1982
 
1983 1983
 /**
@@ -1989,14 +1989,14 @@  discard block
 block discarded – undo
1989 1989
  */
1990 1990
 function geodir_action_listings_content_inside()
1991 1991
 {
1992
-    global $gridview_columns;
1993
-    $listing_view = get_option('geodir_listing_view');
1994
-    if (strstr($listing_view, 'gridview')) {
1995
-        $gridview_columns = $listing_view;
1996
-        $listing_view_exp = explode('_', $listing_view);
1997
-        $listing_view = $listing_view_exp[0];
1998
-    }
1999
-    geodir_get_template_part('listing', 'listview');
1992
+	global $gridview_columns;
1993
+	$listing_view = get_option('geodir_listing_view');
1994
+	if (strstr($listing_view, 'gridview')) {
1995
+		$gridview_columns = $listing_view;
1996
+		$listing_view_exp = explode('_', $listing_view);
1997
+		$listing_view = $listing_view_exp[0];
1998
+	}
1999
+	geodir_get_template_part('listing', 'listview');
2000 2000
 }
2001 2001
 
2002 2002
 add_action('geodir_listings_content_inside', 'geodir_action_listings_content_inside', 10);
@@ -2012,47 +2012,47 @@  discard block
 block discarded – undo
2012 2012
  */
2013 2013
 function geodir_action_listings_content()
2014 2014
 {
2015
-    /**
2016
-     * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2017
-     *
2018
-     * @since 1.0.0
2019
-     * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2020
-     * @param string $id The id for the div. Usually 'geodir-main-content'.
2021
-     * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2022
-     * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2023
-     */
2024
-    do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2025
-    $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2026
-    echo '<div class="clearfix '.$extra_class.'">';
2027
-    /**
2028
-     * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2029
-     *
2030
-     * @since 1.0.0
2031
-     */
2032
-    do_action('geodir_before_listing');
2033
-    echo '</div>';
2034
-
2035
-    /**
2036
-     * This actions calls the listings list content. Used on listings pages and search and author pages.
2037
-     *
2038
-     * @since 1.0.0
2039
-     */
2040
-    do_action('geodir_listings_content_inside');
2041
-
2042
-    /**
2043
-     * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2044
-     *
2045
-     * @since 1.0.0
2046
-     */
2047
-    do_action('geodir_after_listing');
2048
-
2049
-    /**
2050
-     * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2051
-     *
2052
-     * @since 1.0.0
2053
-     * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2054
-     */
2055
-    do_action('geodir_main_content_close', 'listings-page');
2015
+	/**
2016
+	 * This is used to add HTML opening wrappers to the main content of most pages including listings, author, search, home etc.
2017
+	 *
2018
+	 * @since 1.0.0
2019
+	 * @param string $type The page type. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2020
+	 * @param string $id The id for the div. Usually 'geodir-main-content'.
2021
+	 * @param string $class The class for the div. Values can be 'listings-page', 'author-page', 'search-page' or 'home-page'.
2022
+	 * @see 'geodir_main_content_close' Where the oposing closing tag is added.
2023
+	 */
2024
+	do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page');
2025
+	$extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page');
2026
+	echo '<div class="clearfix '.$extra_class.'">';
2027
+	/**
2028
+	 * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages.
2029
+	 *
2030
+	 * @since 1.0.0
2031
+	 */
2032
+	do_action('geodir_before_listing');
2033
+	echo '</div>';
2034
+
2035
+	/**
2036
+	 * This actions calls the listings list content. Used on listings pages and search and author pages.
2037
+	 *
2038
+	 * @since 1.0.0
2039
+	 */
2040
+	do_action('geodir_listings_content_inside');
2041
+
2042
+	/**
2043
+	 * Called after the listings content, inside the outer wrapper HTML. Used on listings pages and search and author pages.
2044
+	 *
2045
+	 * @since 1.0.0
2046
+	 */
2047
+	do_action('geodir_after_listing');
2048
+
2049
+	/**
2050
+	 * This is used to add HTML closing wrappers to the main content of most pages including listings, author, search, home etc.
2051
+	 *
2052
+	 * @since 1.0.0
2053
+	 * @see 'geodir_main_content_open' Where the oposing opening tag is added.
2054
+	 */
2055
+	do_action('geodir_main_content_close', 'listings-page');
2056 2056
 }
2057 2057
 
2058 2058
 
@@ -2067,10 +2067,10 @@  discard block
 block discarded – undo
2067 2067
  */
2068 2068
 function geodir_action_sidebar_listings_bottom_section()
2069 2069
 {
2070
-    if (get_option('geodir_show_listing_bottom_section')) { ?>
2070
+	if (get_option('geodir_show_listing_bottom_section')) { ?>
2071 2071
         <div class="<?php
2072
-            /** This action is documented in geodirectory_template_actions.php */
2073
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2072
+			/** This action is documented in geodirectory_template_actions.php */
2073
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_listing_bottom'); ?>">
2074 2074
             <?php dynamic_sidebar('geodir_listing_bottom'); ?>
2075 2075
         </div><!-- clearfix ends here-->
2076 2076
     <?php }
@@ -2090,38 +2090,38 @@  discard block
 block discarded – undo
2090 2090
  */
2091 2091
 function geodir_action_add_listing_page_title()
2092 2092
 {
2093
-    if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2094
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2095
-    /** This action is documented in geodirectory_template_actions.php */
2096
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2097
-    /** This action is documented in geodirectory_template_actions.php */
2098
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2099
-
2100
-    $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2101
-
2102
-    if(geodir_is_page('add-listing')){
2103
-        $gd_page = 'add-listing';
2104
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2105
-            $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2106
-        }elseif(isset($listing_type)){
2107
-            $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2108
-        }
2093
+	if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '')
2094
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2095
+	/** This action is documented in geodirectory_template_actions.php */
2096
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2097
+	/** This action is documented in geodirectory_template_actions.php */
2098
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2099
+
2100
+	$title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2101
+
2102
+	if(geodir_is_page('add-listing')){
2103
+		$gd_page = 'add-listing';
2104
+		if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2105
+			$title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2106
+		}elseif(isset($listing_type)){
2107
+			$title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2108
+		}
2109 2109
 
2110
-    }
2110
+	}
2111 2111
 
2112 2112
 
2113
-    /**
2114
-     * Filter page title to replace variables.
2115
-     *
2116
-     * @since 1.5.4
2117
-     * @param string $title The page title including variables.
2118
-     * @param string $gd_page The GeoDirectory page type if any.
2119
-     */
2120
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2113
+	/**
2114
+	 * Filter page title to replace variables.
2115
+	 *
2116
+	 * @since 1.5.4
2117
+	 * @param string $title The page title including variables.
2118
+	 * @param string $gd_page The GeoDirectory page type if any.
2119
+	 */
2120
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2121 2121
 
2122
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2123
-    echo $title;
2124
-    echo '</h1></header>';
2122
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2123
+	echo $title;
2124
+	echo '</h1></header>';
2125 2125
 }
2126 2126
 
2127 2127
 add_action('geodir_add_listing_page_mandatory', 'geodir_action_add_listing_page_mandatory', 10);
@@ -2152,61 +2152,61 @@  discard block
 block discarded – undo
2152 2152
  */
2153 2153
 function geodir_action_add_listing_form()
2154 2154
 {
2155
-    global $cat_display, $post_cat, $current_user, $gd_session;
2156
-    $page_id = get_the_ID();
2157
-    $post = '';
2158
-    $title = '';
2159
-    $desc = '';
2160
-    $kw_tags = '';
2161
-    $required_msg = '';
2162
-    $submit_button = '';
2163
-
2164
-    $ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2165
-
2166
-    $thumb_img_arr = array();
2167
-    $curImages = '';
2168
-
2169
-    if (isset($_REQUEST['backandedit'])) {
2170
-        global $post;
2171
-        $post = (object)$gd_session->get('listing');
2172
-        $listing_type = $post->listing_type;
2173
-        $title = $post->post_title;
2174
-        $desc = $post->post_desc;
2175
-        $post_cat = isset($post->post_category) ? $post->post_category : '';
2176
-
2177
-        $kw_tags = $post->post_tags;
2178
-        $curImages = isset($post->post_images) ? $post->post_images : '';
2179
-    } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2180
-        global $post, $post_images;
2181
-
2182
-        $post = geodir_get_post_info($_REQUEST['pid']);
2183
-        $thumb_img_arr = geodir_get_images($post->ID);
2184
-        if ($thumb_img_arr) {
2185
-            foreach ($thumb_img_arr as $post_img) {
2186
-                $curImages .= $post_img->src . ',';
2187
-            }
2188
-        }
2155
+	global $cat_display, $post_cat, $current_user, $gd_session;
2156
+	$page_id = get_the_ID();
2157
+	$post = '';
2158
+	$title = '';
2159
+	$desc = '';
2160
+	$kw_tags = '';
2161
+	$required_msg = '';
2162
+	$submit_button = '';
2163
+
2164
+	$ajax_action = isset($_REQUEST['ajax_action']) ? $_REQUEST['ajax_action'] : 'add';
2165
+
2166
+	$thumb_img_arr = array();
2167
+	$curImages = '';
2168
+
2169
+	if (isset($_REQUEST['backandedit'])) {
2170
+		global $post;
2171
+		$post = (object)$gd_session->get('listing');
2172
+		$listing_type = $post->listing_type;
2173
+		$title = $post->post_title;
2174
+		$desc = $post->post_desc;
2175
+		$post_cat = isset($post->post_category) ? $post->post_category : '';
2176
+
2177
+		$kw_tags = $post->post_tags;
2178
+		$curImages = isset($post->post_images) ? $post->post_images : '';
2179
+	} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2180
+		global $post, $post_images;
2181
+
2182
+		$post = geodir_get_post_info($_REQUEST['pid']);
2183
+		$thumb_img_arr = geodir_get_images($post->ID);
2184
+		if ($thumb_img_arr) {
2185
+			foreach ($thumb_img_arr as $post_img) {
2186
+				$curImages .= $post_img->src . ',';
2187
+			}
2188
+		}
2189 2189
 
2190
-        $listing_type = $post->post_type;
2191
-        $title = $post->post_title;
2192
-        $desc = $post->post_content;
2193
-        $kw_tags = $post->post_tags;
2194
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2195
-    } else {
2196
-        $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2197
-    }
2190
+		$listing_type = $post->post_type;
2191
+		$title = $post->post_title;
2192
+		$desc = $post->post_content;
2193
+		$kw_tags = $post->post_tags;
2194
+		$kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2195
+	} else {
2196
+		$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2197
+	}
2198 2198
 
2199
-    if ($current_user->ID != '0') {
2200
-        $user_login = true;
2201
-    }
2199
+	if ($current_user->ID != '0') {
2200
+		$user_login = true;
2201
+	}
2202 2202
 
2203
-    $post_type_info = geodir_get_posttype_info($listing_type);
2203
+	$post_type_info = geodir_get_posttype_info($listing_type);
2204 2204
 
2205
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2205
+	$cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2206 2206
     
2207
-    $package_info = array();
2208
-    $package_info = geodir_post_package_info($package_info, $post);
2209
-    ?>
2207
+	$package_info = array();
2208
+	$package_info = geodir_post_package_info($package_info, $post);
2209
+	?>
2210 2210
     <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2211 2211
         <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2212 2212
         <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
@@ -2217,114 +2217,114 @@  discard block
 block discarded – undo
2217 2217
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2218 2218
             <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2219 2219
         <?php
2220
-        } 
2221
-        /**
2222
-         * Called at the very top of the add listing page form for frontend.
2223
-         *
2224
-         * This is called just before the "Enter Listing Details" text.
2225
-         *
2226
-         * @since 1.0.0
2227
-         */
2228
-        do_action('geodir_before_detail_fields');
2229
-        ?>
2220
+		} 
2221
+		/**
2222
+		 * Called at the very top of the add listing page form for frontend.
2223
+		 *
2224
+		 * This is called just before the "Enter Listing Details" text.
2225
+		 *
2226
+		 * @since 1.0.0
2227
+		 */
2228
+		do_action('geodir_before_detail_fields');
2229
+		?>
2230 2230
         <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2231 2231
         <?php
2232
-        /**
2233
-         * Called at the top of the add listing page form for frontend.
2234
-         *
2235
-         * This is called after the "Enter Listing Details" text.
2236
-         *
2237
-         * @since 1.0.0
2238
-         */
2239
-        do_action('geodir_before_main_form_fields');
2240
-        ?>
2232
+		/**
2233
+		 * Called at the top of the add listing page form for frontend.
2234
+		 *
2235
+		 * This is called after the "Enter Listing Details" text.
2236
+		 *
2237
+		 * @since 1.0.0
2238
+		 */
2239
+		do_action('geodir_before_main_form_fields');
2240
+		?>
2241 2241
         <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details">
2242 2242
             <label><?php
2243
-                /**
2244
-                 * Filter the add listing page title input label.
2245
-                 *
2246
-                 * @since 1.6.11
2247
-                 * @param string $title The title to be output.
2248
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2249
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2250
-                 */
2251
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2243
+				/**
2244
+				 * Filter the add listing page title input label.
2245
+				 *
2246
+				 * @since 1.6.11
2247
+				 * @param string $title The title to be output.
2248
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2249
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2250
+				 */
2251
+				echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2252 2252
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2253 2253
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2254 2254
             <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2255 2255
         </div>
2256 2256
         <?php
2257
-        $show_editor = get_option('geodir_tiny_editor_on_add_listing');
2258
-        $show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2259
-        /**
2260
-         * Filter whether to show or don't show the editor.
2261
-         *
2262
-         * @since 1.6.16
2263
-         * @param bool $show_editor If true the editor will be available for description field.
2264
-         * @param object $package_info The listing package.
2265
-         * @param string $listing_type The current post type.
2266
-         * @param object $post The current post object.
2267
-         */
2268
-        $show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2269
-
2270
-        $desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2271
-        $desc_limit = '';
2272
-        /**
2273
-         * Filter the add listing description field character limit number.
2274
-         *
2275
-         * @since 1.0.0
2276
-         * @param int $desc_limit The amount of characters to limit the description to.
2277
-         */
2278
-        $desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2279
-        /**
2280
-         * Filter the add listing description field text.
2281
-         *
2282
-         * @since 1.0.0
2283
-         * @param string $desc The text for the description field.
2284
-         * @param int $desc_limit The character limit number if any.
2285
-         */
2286
-        $desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2287
-        $desc_limit_msg = '';
2288
-        /**
2289
-         * Filter the add listing description limit message.
2290
-         *
2291
-         * This is the message shown if there is a limit applied to the amount of characters the description can use.
2292
-         *
2293
-         * @since 1.0.0
2294
-         * @param string $desc_limit_msg The limit message string if any.
2295
-         * @param int $desc_limit The character limit numer if any.
2296
-         */
2297
-        $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2257
+		$show_editor = get_option('geodir_tiny_editor_on_add_listing');
2258
+		$show_editor = !empty($show_editor) && in_array($listing_type, $show_editor) ? true : false;
2259
+		/**
2260
+		 * Filter whether to show or don't show the editor.
2261
+		 *
2262
+		 * @since 1.6.16
2263
+		 * @param bool $show_editor If true the editor will be available for description field.
2264
+		 * @param object $package_info The listing package.
2265
+		 * @param string $listing_type The current post type.
2266
+		 * @param object $post The current post object.
2267
+		 */
2268
+		$show_editor = apply_filters('geodir_description_field_show_editor', $show_editor, $package_info, $listing_type, $post);
2269
+
2270
+		$desc = $show_editor ? stripslashes($desc) : esc_attr(stripslashes($desc));
2271
+		$desc_limit = '';
2272
+		/**
2273
+		 * Filter the add listing description field character limit number.
2274
+		 *
2275
+		 * @since 1.0.0
2276
+		 * @param int $desc_limit The amount of characters to limit the description to.
2277
+		 */
2278
+		$desc_limit = apply_filters('geodir_description_field_desc_limit', $desc_limit);
2279
+		/**
2280
+		 * Filter the add listing description field text.
2281
+		 *
2282
+		 * @since 1.0.0
2283
+		 * @param string $desc The text for the description field.
2284
+		 * @param int $desc_limit The character limit number if any.
2285
+		 */
2286
+		$desc = apply_filters('geodir_description_field_desc', $desc, $desc_limit);
2287
+		$desc_limit_msg = '';
2288
+		/**
2289
+		 * Filter the add listing description limit message.
2290
+		 *
2291
+		 * This is the message shown if there is a limit applied to the amount of characters the description can use.
2292
+		 *
2293
+		 * @since 1.0.0
2294
+		 * @param string $desc_limit_msg The limit message string if any.
2295
+		 * @param int $desc_limit The character limit numer if any.
2296
+		 */
2297
+		$desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2298 2298
         
2299
-        $desc_class = '';
2300
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2301
-            /**
2302
-             * Called on the add listing page form for frontend just before the description field.
2303
-             *
2304
-             * @since 1.0.0
2305
-             */
2306
-            do_action('geodir_before_description_field');
2299
+		$desc_class = '';
2300
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2301
+			/**
2302
+			 * Called on the add listing page form for frontend just before the description field.
2303
+			 *
2304
+			 * @since 1.0.0
2305
+			 */
2306
+			do_action('geodir_before_description_field');
2307 2307
             
2308
-            $desc_class = ' required_field';
2309
-        } else {
2310
-            $desc_class = ' hidden';
2311
-        }
2312
-        ?>
2308
+			$desc_class = ' required_field';
2309
+		} else {
2310
+			$desc_class = ' hidden';
2311
+		}
2312
+		?>
2313 2313
         <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2314 2314
             <label><?php
2315
-                /**
2316
-                 * Filter the add listing page description input label.
2317
-                 *
2318
-                 * @since 1.6.11
2319
-                 * @param string $title The title to be output.
2320
-                 * @param string $cpt_singular_name The singular title of the curent CPT.
2321
-                 * @param string $listing_type The CPT being requested. ie: gd_place.
2322
-                 */
2323
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2315
+				/**
2316
+				 * Filter the add listing page description input label.
2317
+				 *
2318
+				 * @since 1.6.11
2319
+				 * @param string $title The title to be output.
2320
+				 * @param string $cpt_singular_name The singular title of the curent CPT.
2321
+				 * @param string $listing_type The CPT being requested. ie: gd_place.
2322
+				 */
2323
+				echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2324 2324
             <?php
2325
-            if ($show_editor) {
2326
-                $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2327
-            ?>
2325
+			if ($show_editor) {
2326
+				$editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
2327
+			?>
2328 2328
                 <div class="editor" field_id="post_desc" field_type="editor">
2329 2329
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2330 2330
                 </div>
@@ -2338,56 +2338,56 @@  discard block
 block discarded – undo
2338 2338
             <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2339 2339
         </div>
2340 2340
         <?php
2341
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2342
-            /**
2343
-             * Called on the add listing page form for frontend just after the description field.
2344
-             *
2345
-             * @since 1.0.0
2346
-             */
2347
-            do_action('geodir_after_description_field');
2348
-        }
2341
+		if ($desc_limit === '' || (int)$desc_limit > 0) {
2342
+			/**
2343
+			 * Called on the add listing page form for frontend just after the description field.
2344
+			 *
2345
+			 * @since 1.0.0
2346
+			 */
2347
+			do_action('geodir_after_description_field');
2348
+		}
2349 2349
         
2350
-        $kw_tags = esc_attr(stripslashes($kw_tags));
2351
-        $kw_tags_count = TAGKW_TEXT_COUNT;
2352
-        $kw_tags_msg = TAGKW_MSG;
2353
-        /**
2354
-         * Filter the add listing tags character limit.
2355
-         *
2356
-         * @since 1.0.0
2357
-         * @param int $kw_tags_count The character count limit if any.
2358
-         */
2359
-        $kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2360
-        /**
2361
-         * Filter the add listing tags field value.
2362
-         *
2363
-         * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2364
-         *
2365
-         * @since 1.0.0
2366
-         * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2367
-         * @param int $kw_tags_count The character count limit if any.
2368
-         */
2369
-        $kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2370
-        /**
2371
-         * Filter the add listing tags field message text.
2372
-         *
2373
-         * @since 1.0.0
2374
-         * @param string $kw_tags_msg The message shown under the field.
2375
-         * @param int $kw_tags_count The character count limit if any.
2376
-         */
2377
-        $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2350
+		$kw_tags = esc_attr(stripslashes($kw_tags));
2351
+		$kw_tags_count = TAGKW_TEXT_COUNT;
2352
+		$kw_tags_msg = TAGKW_MSG;
2353
+		/**
2354
+		 * Filter the add listing tags character limit.
2355
+		 *
2356
+		 * @since 1.0.0
2357
+		 * @param int $kw_tags_count The character count limit if any.
2358
+		 */
2359
+		$kw_tags_count = apply_filters('geodir_listing_tags_field_tags_count', $kw_tags_count);
2360
+		/**
2361
+		 * Filter the add listing tags field value.
2362
+		 *
2363
+		 * You can use the $_REQUEST values to check if this is a go back and edit value etc.
2364
+		 *
2365
+		 * @since 1.0.0
2366
+		 * @param string $kw_tags The tag field value, usually a comma separated list of tags.
2367
+		 * @param int $kw_tags_count The character count limit if any.
2368
+		 */
2369
+		$kw_tags = apply_filters('geodir_listing_tags_field_tags', $kw_tags, $kw_tags_count);
2370
+		/**
2371
+		 * Filter the add listing tags field message text.
2372
+		 *
2373
+		 * @since 1.0.0
2374
+		 * @param string $kw_tags_msg The message shown under the field.
2375
+		 * @param int $kw_tags_count The character count limit if any.
2376
+		 */
2377
+		$kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2378 2378
         
2379
-        $tags_class = '';
2380
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2381
-            /**
2382
-             * Called on the add listing page form for frontend just before the tags field.
2383
-             *
2384
-             * @since 1.0.0
2385
-             */
2386
-            do_action('geodir_before_listing_tags_field');
2387
-        } else {
2388
-            $tags_class = ' hidden';
2389
-        }
2390
-        ?>
2379
+		$tags_class = '';
2380
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2381
+			/**
2382
+			 * Called on the add listing page form for frontend just before the tags field.
2383
+			 *
2384
+			 * @since 1.0.0
2385
+			 */
2386
+			do_action('geodir_before_listing_tags_field');
2387
+		} else {
2388
+			$tags_class = ' hidden';
2389
+		}
2390
+		?>
2391 2391
         <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2392 2392
             <label><?php echo TAGKW_TEXT; ?></label>
2393 2393
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
@@ -2395,90 +2395,90 @@  discard block
 block discarded – undo
2395 2395
             <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2396 2396
         </div>
2397 2397
         <?php
2398
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2399
-            /**
2400
-             * Called on the add listing page form for frontend just after the tags field.
2401
-             *
2402
-             * @since 1.0.0
2403
-             */
2404
-            do_action('geodir_after_listing_tags_field');
2405
-        }
2398
+		if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2399
+			/**
2400
+			 * Called on the add listing page form for frontend just after the tags field.
2401
+			 *
2402
+			 * @since 1.0.0
2403
+			 */
2404
+			do_action('geodir_after_listing_tags_field');
2405
+		}
2406 2406
         
2407
-        $package_info = array();
2408
-        $package_info = geodir_post_package_info($package_info, $post);
2407
+		$package_info = array();
2408
+		$package_info = geodir_post_package_info($package_info, $post);
2409 2409
         
2410
-        geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2410
+		geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);
2411 2411
         
2412
-        // adjust values here
2413
-        $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
2412
+		// adjust values here
2413
+		$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
2414 2414
 
2415
-        $multiple = true; // allow multiple files upload
2415
+		$multiple = true; // allow multiple files upload
2416 2416
 
2417
-        $width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2417
+		$width = geodir_media_image_large_width(); // If you want to automatically resize all uploaded images then provide width here (in pixels)
2418 2418
 
2419
-        $height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2419
+		$height = geodir_media_image_large_height(); // If you want to automatically resize all uploaded images then provide height here (in pixels)
2420 2420
 
2421
-        $thumb_img_arr = array();
2422
-        $totImg = 0;
2423
-        if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2424
-            $post = (object)$gd_session->get('listing');
2425
-            if (isset($post->post_images))
2426
-                $curImages = trim($post->post_images, ",");
2421
+		$thumb_img_arr = array();
2422
+		$totImg = 0;
2423
+		if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2424
+			$post = (object)$gd_session->get('listing');
2425
+			if (isset($post->post_images))
2426
+				$curImages = trim($post->post_images, ",");
2427 2427
 
2428 2428
 
2429
-            if ($curImages != '') {
2430
-                $curImages_array = explode(',', $curImages);
2431
-                $totImg = count($curImages_array);
2432
-            }
2429
+			if ($curImages != '') {
2430
+				$curImages_array = explode(',', $curImages);
2431
+				$totImg = count($curImages_array);
2432
+			}
2433 2433
 
2434
-            $listing_type = $post->listing_type;
2434
+			$listing_type = $post->listing_type;
2435 2435
 
2436
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2437
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2438
-            $listing_type = $post->post_type;
2439
-            $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2436
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2437
+			$post = geodir_get_post_info((int)$_REQUEST['pid']);
2438
+			$listing_type = $post->post_type;
2439
+			$thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2440 2440
 
2441
-        } else {
2442
-            $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2443
-        }
2441
+		} else {
2442
+			$listing_type = sanitize_text_field($_REQUEST['listing_type']);
2443
+		}
2444 2444
 
2445 2445
 
2446
-        if (!empty($thumb_img_arr)) {
2447
-            foreach ($thumb_img_arr as $img) {
2448
-                //$curImages = $img->src.",";
2449
-            }
2450
-
2451
-            $totImg = count((array)$thumb_img_arr);
2452
-        }
2446
+		if (!empty($thumb_img_arr)) {
2447
+			foreach ($thumb_img_arr as $img) {
2448
+				//$curImages = $img->src.",";
2449
+			}
2453 2450
 
2454
-        if ($curImages != '')
2455
-            $svalue = $curImages; // this will be initial value of the above form field. Image urls.
2456
-        else
2457
-            $svalue = '';
2458
-
2459
-        $image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2460
-        $show_image_input_box = ($image_limit != '0');
2461
-        /**
2462
-         * Filter to be able to show/hide the image upload section of the add listing form.
2463
-         *
2464
-         * @since 1.0.0
2465
-         * @param bool $show_image_input_box Set true to show. Set false to not show.
2466
-         * @param string $listing_type The custom post type slug.
2467
-         */
2468
-        $show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2469
-        if ($show_image_input_box) {
2470
-            ?>
2451
+			$totImg = count((array)$thumb_img_arr);
2452
+		}
2453
+
2454
+		if ($curImages != '')
2455
+			$svalue = $curImages; // this will be initial value of the above form field. Image urls.
2456
+		else
2457
+			$svalue = '';
2458
+
2459
+		$image_limit = isset($package_info->image_limit) ? $package_info->image_limit : '0';
2460
+		$show_image_input_box = ($image_limit != '0');
2461
+		/**
2462
+		 * Filter to be able to show/hide the image upload section of the add listing form.
2463
+		 *
2464
+		 * @since 1.0.0
2465
+		 * @param bool $show_image_input_box Set true to show. Set false to not show.
2466
+		 * @param string $listing_type The custom post type slug.
2467
+		 */
2468
+		$show_image_input_box = apply_filters('geodir_image_uploader_on_add_listing', $show_image_input_box, $listing_type);
2469
+		if ($show_image_input_box) {
2470
+			?>
2471 2471
 
2472 2472
             <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2473 2473
                 <?php if ($image_limit == 1) {
2474
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2475
-                } ?>
2474
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2475
+				} ?>
2476 2476
                 <?php if ($image_limit > 1) {
2477
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2478
-                } ?>
2477
+					echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2478
+				} ?>
2479 2479
                 <?php if ($image_limit == '') {
2480
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2481
-                } ?>
2480
+					echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2481
+				} ?>
2482 2482
             </h5>
2483 2483
 
2484 2484
             <div class="geodir_form_row clearfix" id="<?php echo $id; ?>dropbox"
@@ -2516,12 +2516,12 @@  discard block
 block discarded – undo
2516 2516
         <?php } ?>
2517 2517
 
2518 2518
         <?php
2519
-        /**
2520
-         * Called on the add listing page form for frontend just after the image upload field.
2521
-         *
2522
-         * @since 1.0.0
2523
-         */
2524
-        do_action('geodir_after_main_form_fields');?>
2519
+		/**
2520
+		 * Called on the add listing page form for frontend just after the image upload field.
2521
+		 *
2522
+		 * @since 1.0.0
2523
+		 */
2524
+		do_action('geodir_after_main_form_fields');?>
2525 2525
 
2526 2526
 
2527 2527
         <!-- add captcha code -->
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
 
2551 2551
     </form>
2552 2552
     <?php
2553
-    wp_reset_query();
2553
+	wp_reset_query();
2554 2554
 }
2555 2555
 
2556 2556
 /**
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
  */
2562 2562
 function geodir_add_listing_sidebar_widget_area()
2563 2563
 {
2564
-    dynamic_sidebar('geodir_add_listing_sidebar');
2564
+	dynamic_sidebar('geodir_add_listing_sidebar');
2565 2565
 }
2566 2566
 
2567 2567
 add_action('geodir_add_listing_sidebar_inside', 'geodir_add_listing_sidebar_widget_area', 10);
@@ -2576,16 +2576,16 @@  discard block
 block discarded – undo
2576 2576
  */
2577 2577
 function geodir_action_add_listing_sidebar()
2578 2578
 {
2579
-    /** This action is documented in geodirectory_template_actions.php */
2580
-    do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2581
-    /**
2582
-     * This is used to add the content to the add listing page sidebar.
2583
-     *
2584
-     * @since 1.0.0
2585
-     */
2586
-    do_action('geodir_add_listing_sidebar_inside');
2587
-    /** This action is documented in geodirectory_template_actions.php */
2588
-    do_action('geodir_sidebar_right_close', 'details-page');
2579
+	/** This action is documented in geodirectory_template_actions.php */
2580
+	do_action('geodir_sidebar_right_open', 'add-listing-page', 'geodir-sidebar', 'geodir-sidebar-right', 'http://schema.org/WPSideBar');
2581
+	/**
2582
+	 * This is used to add the content to the add listing page sidebar.
2583
+	 *
2584
+	 * @since 1.0.0
2585
+	 */
2586
+	do_action('geodir_add_listing_sidebar_inside');
2587
+	/** This action is documented in geodirectory_template_actions.php */
2588
+	do_action('geodir_sidebar_right_close', 'details-page');
2589 2589
 }
2590 2590
 
2591 2591
 ###############################################
@@ -2602,11 +2602,11 @@  discard block
 block discarded – undo
2602 2602
  */
2603 2603
 function geodir_action_geodir_sidebar_signup_top()
2604 2604
 {
2605
-    ?>
2605
+	?>
2606 2606
     <div
2607 2607
         class="<?php
2608
-        /** This action is documented in geodirectory_template_actions.php */
2609
-        echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2608
+		/** This action is documented in geodirectory_template_actions.php */
2609
+		echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2610 2610
         <?php dynamic_sidebar('Reg/Login Top Section');?>
2611 2611
     </div><!-- clearfix ends here-->
2612 2612
 <?php
@@ -2625,11 +2625,11 @@  discard block
 block discarded – undo
2625 2625
 function geodir_action_signup_forms()
2626 2626
 {
2627 2627
 
2628
-    global $user_login;
2628
+	global $user_login;
2629 2629
     
2630
-    $is_enable_signup = get_option( 'users_can_register' );
2630
+	$is_enable_signup = get_option( 'users_can_register' );
2631 2631
     
2632
-    ?>
2632
+	?>
2633 2633
     <script type="text/javascript">
2634 2634
         <?php if ( $user_login ) { ?>
2635 2635
         setTimeout(function () {
@@ -2665,67 +2665,67 @@  discard block
 block discarded – undo
2665 2665
         <?php } ?>
2666 2666
     </script><?php
2667 2667
 
2668
-    global $errors;
2669
-    if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2670
-        $errors->add('claim_login', LOGIN_CLAIM);
2671
-
2672
-    if (!empty($errors)) {
2673
-        foreach ($errors as $errorsObj) {
2674
-            foreach ($errorsObj as $key => $val) {
2675
-                for ($i = 0; $i < count($val); $i++) {
2676
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2677
-                    $registration_error_msg = 1;
2678
-                }
2679
-            }
2680
-        }
2681
-    }
2668
+	global $errors;
2669
+	if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim')
2670
+		$errors->add('claim_login', LOGIN_CLAIM);
2671
+
2672
+	if (!empty($errors)) {
2673
+		foreach ($errors as $errorsObj) {
2674
+			foreach ($errorsObj as $key => $val) {
2675
+				for ($i = 0; $i < count($val); $i++) {
2676
+					echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2677
+					$registration_error_msg = 1;
2678
+				}
2679
+			}
2680
+		}
2681
+	}
2682 2682
 
2683
-    if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2684
-        ?>
2683
+	if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_in') {
2684
+		?>
2685 2685
 
2686 2686
         <div class="login_form">
2687 2687
             <?php
2688
-            /**
2689
-             * Contains login form template.
2690
-             *
2691
-             * @since 1.0.0
2692
-             */
2693
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2688
+			/**
2689
+			 * Contains login form template.
2690
+			 *
2691
+			 * @since 1.0.0
2692
+			 */
2693
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2694 2694
         </div>
2695 2695
 
2696 2696
     <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2697 2697
 
2698 2698
         <div class="registration_form">
2699 2699
             <?php
2700
-            /**
2701
-             * Contains registration form template.
2702
-             *
2703
-             * @since 1.0.0
2704
-             */
2705
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2700
+			/**
2701
+			 * Contains registration form template.
2702
+			 *
2703
+			 * @since 1.0.0
2704
+			 */
2705
+			include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2706 2706
         </div>
2707 2707
 
2708 2708
     <?php } else { ?>
2709 2709
 
2710 2710
         <div class="login_form_l">
2711 2711
             <?php
2712
-            /**
2713
-             * Contains login form template.
2714
-             *
2715
-             * @since 1.0.0
2716
-             */
2717
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2712
+			/**
2713
+			 * Contains login form template.
2714
+			 *
2715
+			 * @since 1.0.0
2716
+			 */
2717
+			include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2718 2718
         </div>
2719 2719
         
2720 2720
         <?php if ( $is_enable_signup ) { ?>
2721 2721
             <div class="registration_form_r">
2722 2722
                 <?php
2723
-                /**
2724
-                 * Contains registration form template.
2725
-                 *
2726
-                 * @since 1.0.0
2727
-                 */
2728
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2723
+				/**
2724
+				 * Contains registration form template.
2725
+				 *
2726
+				 * @since 1.0.0
2727
+				 */
2728
+				include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2729 2729
             </div>
2730 2730
         <?php } ?>
2731 2731
 
@@ -2757,66 +2757,66 @@  discard block
 block discarded – undo
2757 2757
  */
2758 2758
 function geodir_action_author_page_title()
2759 2759
 {
2760
-    global $term;
2760
+	global $term;
2761 2761
 
2762
-    $gd_post_type = geodir_get_current_posttype();
2763
-    $post_type_info = get_post_type_object($gd_post_type);
2762
+	$gd_post_type = geodir_get_current_posttype();
2763
+	$post_type_info = get_post_type_object($gd_post_type);
2764 2764
 
2765
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2766
-    if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2767
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2768
-    }
2765
+	$add_string_in_title = __('All', 'geodirectory') . ' ';
2766
+	if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2767
+		$add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2768
+	}
2769 2769
 
2770
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2771
-    $single_name = $post_type_info->labels->singular_name;
2770
+	$list_title = $add_string_in_title . $post_type_info->labels->name;
2771
+	$single_name = $post_type_info->labels->singular_name;
2772 2772
 
2773
-    $taxonomy = geodir_get_taxonomies($gd_post_type);
2773
+	$taxonomy = geodir_get_taxonomies($gd_post_type);
2774 2774
 
2775
-    if (!empty($term)) {
2776
-        $current_term = get_term_by('slug', $term, $taxonomy[0]);
2777
-        if (!empty($current_term))
2778
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2779
-    }
2775
+	if (!empty($term)) {
2776
+		$current_term = get_term_by('slug', $term, $taxonomy[0]);
2777
+		if (!empty($current_term))
2778
+			$list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2779
+	}
2780 2780
 
2781 2781
 
2782
-    if (is_search()) {
2783
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2782
+	if (is_search()) {
2783
+		$list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2784 2784
 
2785
-    }
2786
-    /** This action is documented in geodirectory_template_actions.php */
2787
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
2788
-    /** This action is documented in geodirectory_template_actions.php */
2789
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2785
+	}
2786
+	/** This action is documented in geodirectory_template_actions.php */
2787
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
2788
+	/** This action is documented in geodirectory_template_actions.php */
2789
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2790 2790
 
2791
-    $title = $list_title;
2792
-    if(geodir_is_page('author')){
2793
-        $gd_page = 'author';
2794
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2795
-            $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2796
-        }else{
2797
-            $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2798
-        }
2791
+	$title = $list_title;
2792
+	if(geodir_is_page('author')){
2793
+		$gd_page = 'author';
2794
+		if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2795
+			$title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2796
+		}else{
2797
+			$title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2798
+		}
2799 2799
 
2800
-    }
2800
+	}
2801 2801
 
2802 2802
 
2803
-    /**
2804
-     * Filter page title to replace variables.
2805
-     *
2806
-     * @since 1.5.4
2807
-     * @param string $title The page title including variables.
2808
-     * @param string $gd_page The GeoDirectory page type if any.
2809
-     */
2810
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2803
+	/**
2804
+	 * Filter page title to replace variables.
2805
+	 *
2806
+	 * @since 1.5.4
2807
+	 * @param string $title The page title including variables.
2808
+	 * @param string $gd_page The GeoDirectory page type if any.
2809
+	 */
2810
+	$title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2811 2811
 
2812
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2813
-        /**
2814
-         * Filter the author page title text.
2815
-         *
2816
-         * @since 1.0.0
2817
-         * @param string $list_title The title for the page.
2818
-         */
2819
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2812
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2813
+		/**
2814
+		 * Filter the author page title text.
2815
+		 *
2816
+		 * @since 1.0.0
2817
+		 * @param string $list_title The title for the page.
2818
+		 */
2819
+		apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2820 2820
 }
2821 2821
 
2822 2822
 
@@ -2834,11 +2834,11 @@  discard block
 block discarded – undo
2834 2834
  */
2835 2835
 function geodir_action_geodir_sidebar_author_top()
2836 2836
 {
2837
-    if (get_option('geodir_show_author_top_section')) { ?>
2837
+	if (get_option('geodir_show_author_top_section')) { ?>
2838 2838
         <div
2839 2839
             class="<?php
2840
-            /** This action is documented in geodirectory_template_actions.php */
2841
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2840
+			/** This action is documented in geodirectory_template_actions.php */
2841
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_top'); ?>">
2842 2842
             <?php dynamic_sidebar('geodir_author_top'); ?>
2843 2843
         </div><!-- clearfix ends here-->
2844 2844
     <?php }
@@ -2854,7 +2854,7 @@  discard block
 block discarded – undo
2854 2854
  */
2855 2855
 function geodir_author_left_section()
2856 2856
 {
2857
-    if (get_option('geodir_show_author_left_section')) { ?>
2857
+	if (get_option('geodir_show_author_left_section')) { ?>
2858 2858
         <div class="geodir-content-left geodir-sidebar-wrap">
2859 2859
             <?php dynamic_sidebar('geodir_author_left_sidebar'); ?>
2860 2860
         </div><!-- end geodir-content-left -->
@@ -2875,19 +2875,19 @@  discard block
 block discarded – undo
2875 2875
  */
2876 2876
 function geodir_action_author_sidebar_left()
2877 2877
 {
2878
-    if (get_option('geodir_show_author_left_section')) {
2878
+	if (get_option('geodir_show_author_left_section')) {
2879 2879
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
2880
-        /** This action is documented in geodirectory_template_actions.php */
2881
-        do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2882
-        /**
2883
-         * This is used to add the content to the author page left sidebar (if active).
2884
-         *
2885
-         * @since 1.0.0
2886
-         */
2887
-        do_action('geodir_author_sidebar_left_inside');
2888
-        /** This action is documented in geodirectory_template_actions.php */
2889
-        do_action('geodir_sidebar_left_close', 'author-page');
2890
-    }
2880
+		/** This action is documented in geodirectory_template_actions.php */
2881
+		do_action('geodir_sidebar_left_open', 'author-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
2882
+		/**
2883
+		 * This is used to add the content to the author page left sidebar (if active).
2884
+		 *
2885
+		 * @since 1.0.0
2886
+		 */
2887
+		do_action('geodir_author_sidebar_left_inside');
2888
+		/** This action is documented in geodirectory_template_actions.php */
2889
+		do_action('geodir_sidebar_left_close', 'author-page');
2890
+	}
2891 2891
 }
2892 2892
 
2893 2893
 /**
@@ -2900,7 +2900,7 @@  discard block
 block discarded – undo
2900 2900
  */
2901 2901
 function geodir_author_right_section()
2902 2902
 {
2903
-    if (get_option('geodir_show_author_right_section')) { ?>
2903
+	if (get_option('geodir_show_author_right_section')) { ?>
2904 2904
         <div class="geodir-content-right geodir-sidebar-wrap">
2905 2905
             <?php dynamic_sidebar('geodir_author_right_sidebar'); ?>
2906 2906
         </div><!-- end geodir-content-right -->
@@ -2920,18 +2920,18 @@  discard block
 block discarded – undo
2920 2920
  */
2921 2921
 function geodir_action_author_sidebar_right()
2922 2922
 {
2923
-    if (get_option('geodir_show_author_right_section')) {
2924
-        /** This action is documented in geodirectory_template_actions.php */
2925
-        do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2926
-        /**
2927
-         * This is used to add the content to the author page right sidebar (if active).
2928
-         *
2929
-         * @since 1.0.0
2930
-         */
2931
-        do_action('geodir_author_sidebar_right_inside');
2932
-        /** This action is documented in geodirectory_template_actions.php */
2933
-        do_action('geodir_sidebar_right_close', 'author-page');
2934
-    }
2923
+	if (get_option('geodir_show_author_right_section')) {
2924
+		/** This action is documented in geodirectory_template_actions.php */
2925
+		do_action('geodir_sidebar_right_open', 'author-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
2926
+		/**
2927
+		 * This is used to add the content to the author page right sidebar (if active).
2928
+		 *
2929
+		 * @since 1.0.0
2930
+		 */
2931
+		do_action('geodir_author_sidebar_right_inside');
2932
+		/** This action is documented in geodirectory_template_actions.php */
2933
+		do_action('geodir_sidebar_right_close', 'author-page');
2934
+	}
2935 2935
 }
2936 2936
 
2937 2937
 /**
@@ -2943,14 +2943,14 @@  discard block
 block discarded – undo
2943 2943
  */
2944 2944
 function geodir_action_author_content_inside()
2945 2945
 {
2946
-    global $gridview_columns;
2947
-    $listing_view = get_option('geodir_author_view');
2948
-    if (strstr($listing_view, 'gridview')) {
2949
-        $gridview_columns = $listing_view;
2950
-        $listing_view_exp = explode('_', $listing_view);
2951
-        $listing_view = $listing_view_exp[0];
2952
-    }
2953
-    geodir_get_template_part('listing', 'listview');
2946
+	global $gridview_columns;
2947
+	$listing_view = get_option('geodir_author_view');
2948
+	if (strstr($listing_view, 'gridview')) {
2949
+		$gridview_columns = $listing_view;
2950
+		$listing_view_exp = explode('_', $listing_view);
2951
+		$listing_view = $listing_view_exp[0];
2952
+	}
2953
+	geodir_get_template_part('listing', 'listview');
2954 2954
 }
2955 2955
 
2956 2956
 add_action('geodir_author_content_inside', 'geodir_action_author_content_inside', 10);
@@ -2965,22 +2965,22 @@  discard block
 block discarded – undo
2965 2965
  */
2966 2966
 function geodir_action_author_content()
2967 2967
 {
2968
-    /** This action is documented in geodirectory_template_actions.php */
2969
-    do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2970
-    echo '<div class="clearfix">';
2971
-    /** This action is documented in geodirectory_template_actions.php */
2972
-    do_action('geodir_before_listing');
2973
-    echo '</div>';
2974
-    /**
2975
-     * This is used to add the content to the author page main content.
2976
-     *
2977
-     * @since 1.0.0
2978
-     */
2979
-    do_action('geodir_author_content_inside');
2980
-    /** This action is documented in geodirectory_template_actions.php */
2981
-    do_action('geodir_after_listing');
2982
-    /** This action is documented in geodirectory_template_actions.php */
2983
-    do_action('geodir_main_content_close', 'author-page');
2968
+	/** This action is documented in geodirectory_template_actions.php */
2969
+	do_action('geodir_main_content_open', 'author-page', 'geodir-main-content', 'author-page');
2970
+	echo '<div class="clearfix">';
2971
+	/** This action is documented in geodirectory_template_actions.php */
2972
+	do_action('geodir_before_listing');
2973
+	echo '</div>';
2974
+	/**
2975
+	 * This is used to add the content to the author page main content.
2976
+	 *
2977
+	 * @since 1.0.0
2978
+	 */
2979
+	do_action('geodir_author_content_inside');
2980
+	/** This action is documented in geodirectory_template_actions.php */
2981
+	do_action('geodir_after_listing');
2982
+	/** This action is documented in geodirectory_template_actions.php */
2983
+	do_action('geodir_main_content_close', 'author-page');
2984 2984
 }
2985 2985
 
2986 2986
 add_action('geodir_sidebar_author_bottom_section', 'geodir_action_sidebar_author_bottom_section', 10);
@@ -2994,11 +2994,11 @@  discard block
 block discarded – undo
2994 2994
  */
2995 2995
 function geodir_action_sidebar_author_bottom_section()
2996 2996
 {
2997
-    if (get_option('geodir_show_author_bottom_section')) { ?>
2997
+	if (get_option('geodir_show_author_bottom_section')) { ?>
2998 2998
         <div
2999 2999
             class="<?php
3000
-            /** This action is documented in geodirectory_template_actions.php */
3001
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
3000
+			/** This action is documented in geodirectory_template_actions.php */
3001
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_author_bottom'); ?>">
3002 3002
             <?php dynamic_sidebar('geodir_author_bottom'); ?>
3003 3003
         </div><!-- clearfix ends here-->
3004 3004
     <?php }
@@ -3017,23 +3017,23 @@  discard block
 block discarded – undo
3017 3017
  */
3018 3018
 function geodir_action_search_page_title()
3019 3019
 {
3020
-    $gd_post_type = geodir_get_current_posttype();
3021
-    $post_type_info = get_post_type_object($gd_post_type);
3020
+	$gd_post_type = geodir_get_current_posttype();
3021
+	$post_type_info = get_post_type_object($gd_post_type);
3022 3022
 
3023
-    $pt_name = '';
3024
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3023
+	$pt_name = '';
3024
+	if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3025 3025
 
3026
-    if (is_search()) {
3027
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3026
+	if (is_search()) {
3027
+		$list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3028 3028
 
3029
-    }
3030
-    /** This action is documented in geodirectory_template_actions.php */
3031
-    $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3032
-    /** This action is documented in geodirectory_template_actions.php */
3033
-    $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3034
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3035
-        /** This action is documented in geodirectory_template_actions.php */
3036
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3029
+	}
3030
+	/** This action is documented in geodirectory_template_actions.php */
3031
+	$class = apply_filters('geodir_page_title_class', 'entry-title fn');
3032
+	/** This action is documented in geodirectory_template_actions.php */
3033
+	$class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3034
+	echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3035
+		/** This action is documented in geodirectory_template_actions.php */
3036
+		apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3037 3037
 }
3038 3038
 
3039 3039
 // action for adding the listings page top widget area
@@ -3049,11 +3049,11 @@  discard block
 block discarded – undo
3049 3049
  */
3050 3050
 function geodir_action_geodir_sidebar_search_top()
3051 3051
 {
3052
-    if (get_option('geodir_show_search_top_section')) { ?>
3052
+	if (get_option('geodir_show_search_top_section')) { ?>
3053 3053
         <div
3054 3054
             class="<?php
3055
-            /** This action is documented in geodirectory_template_actions.php */
3056
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3055
+			/** This action is documented in geodirectory_template_actions.php */
3056
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_top'); ?>">
3057 3057
             <?php dynamic_sidebar('geodir_search_top'); ?>
3058 3058
         </div><!-- clearfix ends here-->
3059 3059
     <?php }
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
  */
3070 3070
 function geodir_search_left_section()
3071 3071
 {
3072
-    if (get_option('geodir_show_search_left_section')) { ?>
3072
+	if (get_option('geodir_show_search_left_section')) { ?>
3073 3073
         <div class="geodir-content-left geodir-sidebar-wrap">
3074 3074
             <?php dynamic_sidebar('geodir_search_left_sidebar'); ?>
3075 3075
         </div><!-- end geodir-content-left -->
@@ -3089,19 +3089,19 @@  discard block
 block discarded – undo
3089 3089
  */
3090 3090
 function geodir_action_search_sidebar_left()
3091 3091
 {
3092
-    if (get_option('geodir_show_search_left_section')) {
3092
+	if (get_option('geodir_show_search_left_section')) {
3093 3093
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3094
-        /** This action is documented in geodirectory_template_actions.php */
3095
-        do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3096
-        /**
3097
-         * This is used to add the content to the search page left sidebar (if active).
3098
-         *
3099
-         * @since 1.0.0
3100
-         */
3101
-        do_action('geodir_search_sidebar_left_inside');
3102
-        /** This action is documented in geodirectory_template_actions.php */
3103
-        do_action('geodir_sidebar_left_close', 'search-page');
3104
-    }
3094
+		/** This action is documented in geodirectory_template_actions.php */
3095
+		do_action('geodir_sidebar_left_open', 'search-page', 'geodir-sidebar-left', 'geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3096
+		/**
3097
+		 * This is used to add the content to the search page left sidebar (if active).
3098
+		 *
3099
+		 * @since 1.0.0
3100
+		 */
3101
+		do_action('geodir_search_sidebar_left_inside');
3102
+		/** This action is documented in geodirectory_template_actions.php */
3103
+		do_action('geodir_sidebar_left_close', 'search-page');
3104
+	}
3105 3105
 }
3106 3106
 
3107 3107
 /**
@@ -3114,7 +3114,7 @@  discard block
 block discarded – undo
3114 3114
  */
3115 3115
 function geodir_search_right_section()
3116 3116
 {
3117
-    if (get_option('geodir_show_search_right_section')) { ?>
3117
+	if (get_option('geodir_show_search_right_section')) { ?>
3118 3118
         <div class="geodir-content-right geodir-sidebar-wrap">
3119 3119
             <?php dynamic_sidebar('geodir_search_right_sidebar'); ?>
3120 3120
         </div><!-- end geodir-content-right -->
@@ -3134,18 +3134,18 @@  discard block
 block discarded – undo
3134 3134
  */
3135 3135
 function geodir_action_search_sidebar_right()
3136 3136
 {
3137
-    if (get_option('geodir_show_search_right_section')) {
3138
-        /** This action is documented in geodirectory_template_actions.php */
3139
-        do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3140
-        /**
3141
-         * This is used to add the content to the search page right sidebar (if active).
3142
-         *
3143
-         * @since 1.0.0
3144
-         */
3145
-        do_action('geodir_search_sidebar_right_inside');
3146
-        /** This action is documented in geodirectory_template_actions.php */
3147
-        do_action('geodir_sidebar_right_close', 'search-page');
3148
-    }
3137
+	if (get_option('geodir_show_search_right_section')) {
3138
+		/** This action is documented in geodirectory_template_actions.php */
3139
+		do_action('geodir_sidebar_right_open', 'search-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3140
+		/**
3141
+		 * This is used to add the content to the search page right sidebar (if active).
3142
+		 *
3143
+		 * @since 1.0.0
3144
+		 */
3145
+		do_action('geodir_search_sidebar_right_inside');
3146
+		/** This action is documented in geodirectory_template_actions.php */
3147
+		do_action('geodir_sidebar_right_close', 'search-page');
3148
+	}
3149 3149
 }
3150 3150
 
3151 3151
 
@@ -3160,11 +3160,11 @@  discard block
 block discarded – undo
3160 3160
  */
3161 3161
 function geodir_action_sidebar_search_bottom_section()
3162 3162
 {
3163
-    if (get_option('geodir_show_search_bottom_section')) { ?>
3163
+	if (get_option('geodir_show_search_bottom_section')) { ?>
3164 3164
         <div
3165 3165
             class="<?php
3166
-            /** This action is documented in geodirectory_template_actions.php */
3167
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3166
+			/** This action is documented in geodirectory_template_actions.php */
3167
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_search_bottom'); ?>">
3168 3168
             <?php dynamic_sidebar('geodir_search_bottom'); ?>
3169 3169
         </div><!-- clearfix ends here-->
3170 3170
     <?php }
@@ -3179,14 +3179,14 @@  discard block
 block discarded – undo
3179 3179
  */
3180 3180
 function geodir_action_search_content_inside()
3181 3181
 {
3182
-    global $gridview_columns;
3183
-    $listing_view = get_option('geodir_search_view');
3184
-    if (strstr($listing_view, 'gridview')) {
3185
-        $gridview_columns = $listing_view;
3186
-        $listing_view_exp = explode('_', $listing_view);
3187
-        $listing_view = $listing_view_exp[0];
3188
-    }
3189
-    geodir_get_template_part('listing', 'listview');
3182
+	global $gridview_columns;
3183
+	$listing_view = get_option('geodir_search_view');
3184
+	if (strstr($listing_view, 'gridview')) {
3185
+		$gridview_columns = $listing_view;
3186
+		$listing_view_exp = explode('_', $listing_view);
3187
+		$listing_view = $listing_view_exp[0];
3188
+	}
3189
+	geodir_get_template_part('listing', 'listview');
3190 3190
 }
3191 3191
 
3192 3192
 add_action('geodir_search_content_inside', 'geodir_action_search_content_inside', 10);
@@ -3202,22 +3202,22 @@  discard block
 block discarded – undo
3202 3202
  */
3203 3203
 function geodir_action_search_content()
3204 3204
 {
3205
-    /** This action is documented in geodirectory_template_actions.php */
3206
-    do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3207
-    echo '<div class="clearfix">';
3208
-    /** This action is documented in geodirectory_template_actions.php */
3209
-    do_action('geodir_before_listing');
3210
-    echo '</div>';
3211
-    /**
3212
-     * This is used to add the content to the search page main content.
3213
-     *
3214
-     * @since 1.0.0
3215
-     */
3216
-    do_action('geodir_search_content_inside');
3217
-    /** This action is documented in geodirectory_template_actions.php */
3218
-    do_action('geodir_after_listing');
3219
-    /** This action is documented in geodirectory_template_actions.php */
3220
-    do_action('geodir_main_content_close', 'search-page');
3205
+	/** This action is documented in geodirectory_template_actions.php */
3206
+	do_action('geodir_main_content_open', 'search-page', 'geodir-main-content', 'search-page');
3207
+	echo '<div class="clearfix">';
3208
+	/** This action is documented in geodirectory_template_actions.php */
3209
+	do_action('geodir_before_listing');
3210
+	echo '</div>';
3211
+	/**
3212
+	 * This is used to add the content to the search page main content.
3213
+	 *
3214
+	 * @since 1.0.0
3215
+	 */
3216
+	do_action('geodir_search_content_inside');
3217
+	/** This action is documented in geodirectory_template_actions.php */
3218
+	do_action('geodir_after_listing');
3219
+	/** This action is documented in geodirectory_template_actions.php */
3220
+	do_action('geodir_main_content_close', 'search-page');
3221 3221
 }
3222 3222
 
3223 3223
 ###############################################
@@ -3240,11 +3240,11 @@  discard block
 block discarded – undo
3240 3240
  */
3241 3241
 function geodir_action_geodir_sidebar_home_top()
3242 3242
 {
3243
-    if (get_option('geodir_show_home_top_section')) { ?>
3243
+	if (get_option('geodir_show_home_top_section')) { ?>
3244 3244
         <div
3245 3245
             class="<?php
3246
-            /** This action is documented in geodirectory_template_actions.php */
3247
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3246
+			/** This action is documented in geodirectory_template_actions.php */
3247
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_top'); ?>">
3248 3248
             <?php dynamic_sidebar('geodir_home_top'); ?>
3249 3249
         </div><!-- clearfix ends here-->
3250 3250
     <?php }
@@ -3260,7 +3260,7 @@  discard block
 block discarded – undo
3260 3260
  */
3261 3261
 function geodir_home_left_section()
3262 3262
 {
3263
-    if (get_option('geodir_show_home_left_section')) { ?>
3263
+	if (get_option('geodir_show_home_left_section')) { ?>
3264 3264
         <div class="geodir-content-left geodir-sidebar-wrap">
3265 3265
             <?php dynamic_sidebar('geodir_home_left'); ?>
3266 3266
         </div><!-- end geodir-content-left -->
@@ -3282,19 +3282,19 @@  discard block
 block discarded – undo
3282 3282
  */
3283 3283
 function geodir_action_home_sidebar_left()
3284 3284
 {
3285
-    if (get_option('geodir_show_home_left_section')) {
3285
+	if (get_option('geodir_show_home_left_section')) {
3286 3286
 // this adds the opening html tags to the primary div, this required the closing tag below :: ($type='',$id='',$class='',$itemtype='')
3287
-        /** This action is documented in geodirectory_template_actions.php */
3288
-        do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3289
-        /**
3290
-         * This is used to add the content to the home page left sidebar (if active).
3291
-         *
3292
-         * @since 1.0.0
3293
-         */
3294
-        do_action('geodir_home_sidebar_left_inside');
3295
-        /** This action is documented in geodirectory_template_actions.php */
3296
-        do_action('geodir_sidebar_left_close', 'home-page');
3297
-    }
3287
+		/** This action is documented in geodirectory_template_actions.php */
3288
+		do_action('geodir_sidebar_left_open', 'home-page', 'geodir-sidebar-left', 'geodir-sidebar geodir-sidebar-left geodir-listings-sidebar-left', 'http://schema.org/WPSideBar');
3289
+		/**
3290
+		 * This is used to add the content to the home page left sidebar (if active).
3291
+		 *
3292
+		 * @since 1.0.0
3293
+		 */
3294
+		do_action('geodir_home_sidebar_left_inside');
3295
+		/** This action is documented in geodirectory_template_actions.php */
3296
+		do_action('geodir_sidebar_left_close', 'home-page');
3297
+	}
3298 3298
 }
3299 3299
 
3300 3300
 /**
@@ -3307,7 +3307,7 @@  discard block
 block discarded – undo
3307 3307
  */
3308 3308
 function geodir_home_right_section()
3309 3309
 {
3310
-    if (get_option('geodir_show_home_right_section')) { ?>
3310
+	if (get_option('geodir_show_home_right_section')) { ?>
3311 3311
         <div class="geodir-content-right geodir-sidebar-wrap">
3312 3312
             <?php dynamic_sidebar('geodir_home_right'); ?>
3313 3313
         </div><!-- end geodir-content-right -->
@@ -3328,18 +3328,18 @@  discard block
 block discarded – undo
3328 3328
  */
3329 3329
 function geodir_action_home_sidebar_right()
3330 3330
 {
3331
-    if (get_option('geodir_show_home_right_section')) {
3332
-        /** This action is documented in geodirectory_template_actions.php */
3333
-        do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3334
-        /**
3335
-         * This is used to add the content to the home page right sidebar (if active).
3336
-         *
3337
-         * @since 1.0.0
3338
-         */
3339
-        do_action('geodir_home_sidebar_right_inside');
3340
-        /** This action is documented in geodirectory_template_actions.php */
3341
-        do_action('geodir_sidebar_right_close', 'home-page');
3342
-    }
3331
+	if (get_option('geodir_show_home_right_section')) {
3332
+		/** This action is documented in geodirectory_template_actions.php */
3333
+		do_action('geodir_sidebar_right_open', 'home-page', 'geodir-sidebar-right', 'geodir-sidebar-right geodir-listings-sidebar-right', 'http://schema.org/WPSideBar');
3334
+		/**
3335
+		 * This is used to add the content to the home page right sidebar (if active).
3336
+		 *
3337
+		 * @since 1.0.0
3338
+		 */
3339
+		do_action('geodir_home_sidebar_right_inside');
3340
+		/** This action is documented in geodirectory_template_actions.php */
3341
+		do_action('geodir_sidebar_right_close', 'home-page');
3342
+	}
3343 3343
 }
3344 3344
 
3345 3345
 /**
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
  */
3351 3351
 function geodir_action_home_content_inside()
3352 3352
 {
3353
-    dynamic_sidebar('geodir_home_content');
3353
+	dynamic_sidebar('geodir_home_content');
3354 3354
 }
3355 3355
 
3356 3356
 add_action('geodir_home_content_inside', 'geodir_action_home_content_inside', 10);
@@ -3365,28 +3365,28 @@  discard block
 block discarded – undo
3365 3365
  */
3366 3366
 function geodir_action_home_content()
3367 3367
 {
3368
-    /** This action is documented in geodirectory_template_actions.php */
3369
-    do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3370
-    /**
3371
-     * This called before the home page main content.
3372
-     *
3373
-     * @since 1.0.0
3374
-     */
3375
-    do_action('geodir_before_home_content');
3376
-    /**
3377
-     * This is used to add the content to the home page main content.
3378
-     *
3379
-     * @since 1.0.0
3380
-     */
3381
-    do_action('geodir_home_content_inside');
3382
-    /**
3383
-     * This is called after the homepage main content.
3384
-     *
3385
-     * @since 1.0.0
3386
-     */
3387
-    do_action('geodir_after_home_content');
3388
-    /** This action is documented in geodirectory_template_actions.php */
3389
-    do_action('geodir_main_content_close', 'home-page');
3368
+	/** This action is documented in geodirectory_template_actions.php */
3369
+	do_action('geodir_main_content_open', 'home-page', 'geodir-main-content', 'home-page');
3370
+	/**
3371
+	 * This called before the home page main content.
3372
+	 *
3373
+	 * @since 1.0.0
3374
+	 */
3375
+	do_action('geodir_before_home_content');
3376
+	/**
3377
+	 * This is used to add the content to the home page main content.
3378
+	 *
3379
+	 * @since 1.0.0
3380
+	 */
3381
+	do_action('geodir_home_content_inside');
3382
+	/**
3383
+	 * This is called after the homepage main content.
3384
+	 *
3385
+	 * @since 1.0.0
3386
+	 */
3387
+	do_action('geodir_after_home_content');
3388
+	/** This action is documented in geodirectory_template_actions.php */
3389
+	do_action('geodir_main_content_close', 'home-page');
3390 3390
 }
3391 3391
 
3392 3392
 add_action('geodir_sidebar_location_bottom_section', 'geodir_action_sidebar_home_bottom_section', 10);
@@ -3401,11 +3401,11 @@  discard block
 block discarded – undo
3401 3401
  */
3402 3402
 function geodir_action_sidebar_home_bottom_section()
3403 3403
 {
3404
-    if (get_option('geodir_show_home_bottom_section')) { ?>
3404
+	if (get_option('geodir_show_home_bottom_section')) { ?>
3405 3405
         <div
3406 3406
             class="<?php
3407
-            /** This action is documented in geodirectory_template_actions.php */
3408
-            echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3407
+			/** This action is documented in geodirectory_template_actions.php */
3408
+			echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'geodir_home_bottom'); ?>">
3409 3409
             <?php dynamic_sidebar('geodir_home_bottom'); ?>
3410 3410
         </div><!-- clearfix ends here-->
3411 3411
     <?php }
@@ -3433,13 +3433,13 @@  discard block
 block discarded – undo
3433 3433
  */
3434 3434
 function geodir_filter_listing_page_title($list_title)
3435 3435
 {
3436
-    if (is_search() && trim(get_search_query()) == '') {
3437
-        $gd_post_type = geodir_get_current_posttype();
3438
-        $post_type_info = get_post_type_object($gd_post_type);
3436
+	if (is_search() && trim(get_search_query()) == '') {
3437
+		$gd_post_type = geodir_get_current_posttype();
3438
+		$post_type_info = get_post_type_object($gd_post_type);
3439 3439
 
3440
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3441
-    }
3442
-    return $list_title;
3440
+		$list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3441
+	}
3442
+	return $list_title;
3443 3443
 }
3444 3444
 
3445 3445
 add_action('geodir_message_not_found_on_listing', 'geodir_display_message_not_found_on_listing');
@@ -3454,62 +3454,62 @@  discard block
 block discarded – undo
3454 3454
  * @param string $gd_page The geodirectory page type. Default null.
3455 3455
  */
3456 3456
 function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3457
-    global $post;
3458
-
3459
-    $gd_page_id = NULL;
3460
-    if ($gd_page == 'home-page' && geodir_is_page('home')) {
3461
-        $gd_page_id = geodir_home_page_id();
3462
-    } else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3463
-        $gd_page_id = geodir_preview_page_id();
3464
-    } else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3465
-        $gd_page_id = geodir_add_listing_page_id();
3466
-    } else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3467
-        $gd_page_id = geodir_success_page_id();
3468
-    } else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3469
-        $gd_page_id = geodir_location_page_id();
3470
-    } else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3471
-        $gd_page_id = geodir_info_page_id();
3472
-    } else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3473
-        $gd_page_id = geodir_login_page_id();
3474
-    } else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3475
-        $gd_page_id = geodir_payment_checkout_page_id();
3476
-    } else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3477
-        $gd_page_id = geodir_payment_invoices_page_id();
3478
-    }
3479
-
3480
-    if (!$gd_page_id > 0) {
3481
-        return;
3482
-    }
3457
+	global $post;
3458
+
3459
+	$gd_page_id = NULL;
3460
+	if ($gd_page == 'home-page' && geodir_is_page('home')) {
3461
+		$gd_page_id = geodir_home_page_id();
3462
+	} else if ($gd_page == 'details-page' && geodir_is_page('preview')) {
3463
+		$gd_page_id = geodir_preview_page_id();
3464
+	} else if ($gd_page == 'add-listing-page' && geodir_is_page('add-listing')) {
3465
+		$gd_page_id = geodir_add_listing_page_id();
3466
+	} else if ($gd_page == 'success-page' && geodir_is_page('listing-success')) {
3467
+		$gd_page_id = geodir_success_page_id();
3468
+	} else if ($gd_page == 'location-page' && geodir_is_page('location')) {
3469
+		$gd_page_id = geodir_location_page_id();
3470
+	} else if ($gd_page == 'info-page' && geodir_is_page('info')) {
3471
+		$gd_page_id = geodir_info_page_id();
3472
+	} else if ($gd_page == 'signup-page' && geodir_is_page('login')) {
3473
+		$gd_page_id = geodir_login_page_id();
3474
+	} else if ($gd_page == 'checkout-page' && geodir_is_page('checkout')) {
3475
+		$gd_page_id = geodir_payment_checkout_page_id();
3476
+	} else if ($gd_page == 'invoices-page' && geodir_is_page('invoices')) {
3477
+		$gd_page_id = geodir_payment_invoices_page_id();
3478
+	}
3479
+
3480
+	if (!$gd_page_id > 0) {
3481
+		return;
3482
+	}
3483 3483
     
3484
-    $display = 'before';
3485
-    /**
3486
-     * Filter the position to display the page content.
3487
-     *
3488
-     * @since 1.6.3
3489
-     *
3490
-     * @param string $display Position to add the post content.
3491
-     * @param string $gd_page The geodirectory page type.
3492
-     */
3493
-    $display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3494
-
3495
-    if ($position !== $display) {
3496
-        return;
3497
-    }
3498
-
3499
-    $gd_post = $post;
3484
+	$display = 'before';
3485
+	/**
3486
+	 * Filter the position to display the page content.
3487
+	 *
3488
+	 * @since 1.6.3
3489
+	 *
3490
+	 * @param string $display Position to add the post content.
3491
+	 * @param string $gd_page The geodirectory page type.
3492
+	 */
3493
+	$display = apply_filters('geodir_add_page_content_position', $display, $gd_page);
3494
+
3495
+	if ($position !== $display) {
3496
+		return;
3497
+	}
3498
+
3499
+	$gd_post = $post;
3500 3500
     
3501
-    setup_postdata(get_post($gd_page_id));
3501
+	setup_postdata(get_post($gd_page_id));
3502 3502
 
3503
-    if (get_the_content()) {
3504
-        ?>
3503
+	if (get_the_content()) {
3504
+		?>
3505 3505
         <section class="entry-content clearfix" itemprop="articleBody"><?php the_content(); ?></section>
3506 3506
         <?php
3507
-    }
3507
+	}
3508 3508
 
3509
-    $post = $gd_post;
3510
-    if (!empty($gd_post) && is_object($gd_post)) {
3511
-        setup_postdata($gd_post);
3512
-    }
3509
+	$post = $gd_post;
3510
+	if (!empty($gd_post) && is_object($gd_post)) {
3511
+		setup_postdata($gd_post);
3512
+	}
3513 3513
 
3514 3514
 }
3515 3515
 add_action('geodir_add_page_content', 'geodir_add_page_content', 10, 2);
@@ -3530,13 +3530,13 @@  discard block
 block discarded – undo
3530 3530
  * @return string Filtered SQL JOIN clause.
3531 3531
  */
3532 3532
 function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3533
-    global $plugin_prefix;
3533
+	global $plugin_prefix;
3534 3534
 
3535
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3536
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3537
-    }
3535
+	if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3536
+		$join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3537
+	}
3538 3538
     
3539
-    return $join;
3539
+	return $join;
3540 3540
 }
3541 3541
 add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3542 3542
 add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
@@ -3558,31 +3558,31 @@  discard block
 block discarded – undo
3558 3558
  * @return string Filtered SQL WHERE clause.
3559 3559
  */
3560 3560
 function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3561
-    global $wpdb, $plugin_prefix;
3561
+	global $wpdb, $plugin_prefix;
3562 3562
 
3563
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3564
-        $post_locations = '';
3565
-        $post_locations_var = array();
3563
+	if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3564
+		$post_locations = '';
3565
+		$post_locations_var = array();
3566 3566
         
3567
-        if ( !empty( $post->country_slug ) ) {
3568
-            $post_locations .= " AND post_locations LIKE %s";
3569
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3570
-        }
3571
-
3572
-        if ( !empty( $post->region_slug ) ) {
3573
-            $post_locations .= " AND post_locations LIKE %s";
3574
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3575
-        }
3576
-
3577
-        if ( !empty( $post->city_slug ) ) {
3578
-            $post_locations .= " AND post_locations LIKE %s";
3579
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3580
-        }
3567
+		if ( !empty( $post->country_slug ) ) {
3568
+			$post_locations .= " AND post_locations LIKE %s";
3569
+			$post_locations_var[] = "%,[" . $post->country_slug . "]";
3570
+		}
3571
+
3572
+		if ( !empty( $post->region_slug ) ) {
3573
+			$post_locations .= " AND post_locations LIKE %s";
3574
+			$post_locations_var[] = "%,[" . $post->region_slug . "],%";
3575
+		}
3576
+
3577
+		if ( !empty( $post->city_slug ) ) {
3578
+			$post_locations .= " AND post_locations LIKE %s";
3579
+			$post_locations_var[] = "[" . $post->city_slug . "],%";
3580
+		}
3581 3581
         
3582
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3583
-    }
3582
+		$where .= $wpdb->prepare( $post_locations, $post_locations_var );
3583
+	}
3584 3584
     
3585
-    return $where;
3585
+	return $where;
3586 3586
 }
3587 3587
 add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3588 3588
 add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3589 3589
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     //php
285 285
     if (!empty($tc['geodir_theme_compat_code'])) {
286
-        include_once('geodirectory-functions/compatibility/' . $tc['geodir_theme_compat_code'] . '.php');
286
+        include_once('geodirectory-functions/compatibility/'.$tc['geodir_theme_compat_code'].'.php');
287 287
     }
288 288
 
289 289
     //geodir_full_page_class
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 function geodir_action_wrapper_content_open($type = '', $id = '', $class = '')
454 454
 {
455 455
     if ($type == 'home-page' && $width = get_option('geodir_width_home_contant_section')) {
456
-        $width_css = 'style="width:' . $width . '%;"';
456
+        $width_css = 'style="width:'.$width.'%;"';
457 457
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_contant_section')) {
458
-        $width_css = 'style="width:' . $width . '%;"';
458
+        $width_css = 'style="width:'.$width.'%;"';
459 459
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_contant_section')) {
460
-        $width_css = 'style="width:' . $width . '%;"';
460
+        $width_css = 'style="width:'.$width.'%;"';
461 461
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_contant_section')) {
462
-        $width_css = 'style="width:' . $width . '%;"';
462
+        $width_css = 'style="width:'.$width.'%;"';
463 463
     } else {
464 464
         $width_css = '';
465 465
     }
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 function geodir_action_sidebar_right_open($type = '', $id = '', $class = '', $itemtype = '')
574 574
 {
575 575
     if ($type == 'home-page' && $width = get_option('geodir_width_home_right_section')) {
576
-        $width_css = 'style="width:' . $width . '%;"';
576
+        $width_css = 'style="width:'.$width.'%;"';
577 577
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_right_section')) {
578
-        $width_css = 'style="width:' . $width . '%;"';
578
+        $width_css = 'style="width:'.$width.'%;"';
579 579
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_right_section')) {
580
-        $width_css = 'style="width:' . $width . '%;"';
580
+        $width_css = 'style="width:'.$width.'%;"';
581 581
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_right_section')) {
582
-        $width_css = 'style="width:' . $width . '%;"';
582
+        $width_css = 'style="width:'.$width.'%;"';
583 583
     } else {
584 584
         $width_css = '';
585 585
     }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         }
678 678
     }
679 679
 
680
-    $post = (object)$_REQUEST;
680
+    $post = (object) $_REQUEST;
681 681
 
682 682
 
683 683
     if (isset($post->video)) {
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
 
737 737
     $json = '{';
738 738
     $json .= '"post_preview": "1",';
739
-    $json .= '"t": "' . $json_title . '",';
740
-    $json .= '"lt": "' . $post_latitude . '",';
741
-    $json .= '"ln": "' . $post_longitude . '",';
742
-    $json .= '"i":"' . $term_icon . '"';
739
+    $json .= '"t": "'.$json_title.'",';
740
+    $json .= '"lt": "'.$post_latitude.'",';
741
+    $json .= '"ln": "'.$post_longitude.'",';
742
+    $json .= '"i":"'.$term_icon.'"';
743 743
     $json .= '}';
744 744
 
745 745
     $post->marker_json = $json;
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
      * @param string $class The class to use. Default is 'entry-header'.
967 967
      */
968 968
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
969
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . stripslashes(get_the_title()) . '</h1></header>';
969
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.stripslashes(get_the_title()).'</h1></header>';
970 970
 }
971 971
 
972 972
 
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
     $package_info = geodir_post_package_info(array(), $post, (!empty($post->post_type) ? $post->post_type : ''));
1005 1005
     $image_limit = '';
1006 1006
     if (defined('GEODIRPAYMENT_VERSION') && !empty($package_info) && isset($package_info->image_limit) && $package_info->image_limit !== '') {
1007
-        $image_limit = (int)$package_info->image_limit;
1007
+        $image_limit = (int) $package_info->image_limit;
1008 1008
     }
1009 1009
 
1010 1010
     if ($preview) {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 
1021 1021
         if (!empty($post_images)) {
1022 1022
             foreach ($post_images as $image) {
1023
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1023
+                if ($image_limit !== '' && ($slides + 1) > $image_limit) {
1024 1024
                      break;
1025 1025
                 }
1026 1026
                 if (!empty($image)) {
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
                     $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0;
1030 1030
 
1031 1031
                     if ($image && $width && $height) {
1032
-                        $image = (object)array('src' => $image, 'width' => $width, 'height' => $height);
1032
+                        $image = (object) array('src' => $image, 'width' => $width, 'height' => $height);
1033 1033
                     }
1034 1034
 
1035 1035
                     if (isset($image->src)) {
@@ -1041,9 +1041,9 @@  discard block
 block discarded – undo
1041 1041
 
1042 1042
                         $image_title = isset($image->title) ? $image->title : '';
1043 1043
 
1044
-                        $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;" />';
1045
-                        $main_slides .= '<img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:400px;margin:0 auto;" /></li>';
1046
-                        $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image_title . '" title="' . $image_title . '" style="max-height:48px;margin:0 auto;" /></li>';
1044
+                        $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;" />';
1045
+                        $main_slides .= '<img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:400px;margin:0 auto;" /></li>';
1046
+                        $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image_title.'" title="'.$image_title.'" style="max-height:48px;margin:0 auto;" /></li>';
1047 1047
                         $slides++;
1048 1048
                     }
1049 1049
                 }
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
         if (!empty($post_images)) {
1066 1066
             foreach ($post_images as $image) {
1067
-                if ($image_limit !== '' && ($slides+1) > $image_limit) {
1067
+                if ($image_limit !== '' && ($slides + 1) > $image_limit) {
1068 1068
                      break;
1069 1069
                 }
1070 1070
                 if ($image->height >= 400) {
@@ -1073,9 +1073,9 @@  discard block
 block discarded – undo
1073 1073
                     $spacer_height = ((400 - $image->height) / 2);
1074 1074
                 }
1075 1075
 
1076
-                $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1077
-                $main_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
-                $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>';
1076
+                $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : '';
1077
+                $main_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>';
1078
+                $nav_slides .= '<li><img src="'.$image->src.'" alt="'.$image->title.'" title="'.$image->title.'" style="max-height:48px;margin:0 auto;" /></li>';
1079 1079
                 $slides++;
1080 1080
             }
1081 1081
         }// endfore
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
  */
1111 1111
 function geodir_action_details_taxonomies()
1112 1112
 {
1113
-    global $preview, $post;?>
1113
+    global $preview, $post; ?>
1114 1114
     <p class="geodir_post_taxomomies clearfix">
1115 1115
     <?php
1116 1116
     $taxonomies = array();
@@ -1119,11 +1119,11 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
     if ($preview && !$is_backend_preview) {
1121 1121
         $post_type = $post->listing_type;
1122
-        $post_taxonomy = $post_type . 'category';
1122
+        $post_taxonomy = $post_type.'category';
1123 1123
         $post->{$post_taxonomy} = $post->post_category[$post_taxonomy];
1124 1124
     } else {
1125 1125
         $post_type = $post->post_type;
1126
-        $post_taxonomy = $post_type . 'category';
1126
+        $post_taxonomy = $post_type.'category';
1127 1127
     }
1128 1128
 //{	
1129 1129
     $post_type_info = get_post_type_object($post_type);
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 
1132 1132
     if (!empty($post->post_tags)) {
1133 1133
 
1134
-        if (taxonomy_exists($post_type . '_tags')):
1134
+        if (taxonomy_exists($post_type.'_tags')):
1135 1135
             $links = array();
1136 1136
             $terms = array();
1137 1137
             // to limit post tags
@@ -1158,8 +1158,8 @@  discard block
 block discarded – undo
1158 1158
                 $post_term = trim($post_term);
1159 1159
 
1160 1160
                 $priority_location = false;
1161
-                if ($insert_term = term_exists($post_term, $post_type . '_tags')) {
1162
-                    $term = get_term_by('id', $insert_term['term_id'], $post_type . '_tags');
1161
+                if ($insert_term = term_exists($post_term, $post_type.'_tags')) {
1162
+                    $term = get_term_by('id', $insert_term['term_id'], $post_type.'_tags');
1163 1163
                 } else {
1164 1164
                     $post_country = isset($_REQUEST['post_country']) && $_REQUEST['post_country'] != '' ? sanitize_text_field($_REQUEST['post_country']) : NULL;
1165 1165
                     $post_region = isset($_REQUEST['post_region']) && $_REQUEST['post_region'] != '' ? sanitize_text_field($_REQUEST['post_region']) : NULL;
@@ -1169,10 +1169,10 @@  discard block
 block discarded – undo
1169 1169
                     $match_city = $post_city && sanitize_title($post_term) == sanitize_title($post_city) ? true : false;
1170 1170
                     if ($match_country || $match_region || $match_city) {
1171 1171
                         $priority_location = true;
1172
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1172
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1173 1173
                     } else {
1174
-                        $insert_term = wp_insert_term($post_term, $post_type . '_tags');
1175
-                        $term = get_term_by('name', $post_term, $post_type . '_tags');
1174
+                        $insert_term = wp_insert_term($post_term, $post_type.'_tags');
1175
+                        $term = get_term_by('name', $post_term, $post_type.'_tags');
1176 1176
                     }
1177 1177
                 }
1178 1178
 
@@ -1189,12 +1189,12 @@  discard block
 block discarded – undo
1189 1189
                          * @param string $tag_link The tag link html.
1190 1190
                          * @param object $term The tag term object.
1191 1191
                          */
1192
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1192
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1193 1193
                         $links[] = $tag_link;
1194 1194
                     } else {
1195
-                        $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>";
1195
+                        $tag_link = "<a href='".esc_attr(get_term_link($term->term_id, $term->taxonomy))."'>$term->name</a>";
1196 1196
                         /** This action is documented in geodirectory-template_actions.php */
1197
-                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term);
1197
+                        $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term);
1198 1198
                         $links[] = $tag_link;
1199 1199
                     }
1200 1200
                     $terms[] = $term;
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
             if (!isset($listing_label)) {
1205 1205
                 $listing_label = '';
1206 1206
             }
1207
-            $taxonomies[$post_type . '_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1207
+            $taxonomies[$post_type.'_tags'] = wp_sprintf(__('%s Tags: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1208 1208
         endif;
1209 1209
 
1210 1210
     }
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
                     $term = get_term_by('id', $post_term, $post_taxonomy);
1233 1233
 
1234 1234
                     if (is_object($term)) {
1235
-                        $term_link = "<a href='" . esc_attr(get_term_link($term, $post_taxonomy)) . "'>$term->name</a>";
1235
+                        $term_link = "<a href='".esc_attr(get_term_link($term, $post_taxonomy))."'>$term->name</a>";
1236 1236
                         /**
1237 1237
                          * Filter the category name on the details page.
1238 1238
                          *
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
                          * @param string $term_link The link html to the category.
1241 1241
                          * @param object $term The category term object.
1242 1242
                          */
1243
-                        $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term);
1243
+                        $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term);
1244 1244
                         $links[] = $term_link;
1245 1245
                         $terms[] = $term;
1246 1246
                     }
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
         if (!isset($listing_label)) {
1259 1259
             $listing_label = '';
1260 1260
         }
1261
-        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object)$terms);
1261
+        $taxonomies[$post_taxonomy] = wp_sprintf(__('%s Category: %l', 'geodirectory'), geodir_ucwords($listing_label), $links, (object) $terms);
1262 1262
 
1263 1263
     }
1264 1264
 
@@ -1271,14 +1271,14 @@  discard block
 block discarded – undo
1271 1271
      * @param string $listing_label The post type label.
1272 1272
      * @param string $listing_label The post type label with ucwords function.
1273 1273
      */
1274
-    $taxonomies = apply_filters('geodir_details_taxonomies_output',$taxonomies,$post_type,$listing_label,geodir_ucwords($listing_label));
1274
+    $taxonomies = apply_filters('geodir_details_taxonomies_output', $taxonomies, $post_type, $listing_label, geodir_ucwords($listing_label));
1275 1275
 
1276 1276
     if (isset($taxonomies[$post_taxonomy])) {
1277
-        echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>';
1277
+        echo '<span class="geodir-category">'.$taxonomies[$post_taxonomy].'</span>';
1278 1278
     }
1279 1279
 
1280
-    if (isset($taxonomies[$post_type . '_tags']))
1281
-        echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>';
1280
+    if (isset($taxonomies[$post_type.'_tags']))
1281
+        echo '<span class="geodir-tags">'.$taxonomies[$post_type.'_tags'].'</span>';
1282 1282
 
1283 1283
     ?>
1284 1284
     </p><?php
@@ -1299,11 +1299,11 @@  discard block
 block discarded – undo
1299 1299
  * @param object $post Optional. The post object or blank.
1300 1300
  * @package GeoDirectory
1301 1301
  */
1302
-function geodir_action_details_micordata($post='')
1302
+function geodir_action_details_micordata($post = '')
1303 1303
 {
1304 1304
 
1305 1305
     global $preview;
1306
-    if(empty($post)){global $post;}
1306
+    if (empty($post)) {global $post; }
1307 1307
     if ($preview || !geodir_is_page('detail')) {
1308 1308
         return;
1309 1309
     }
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
     } else {
1319 1319
         foreach ($post_reviews as $review) {
1320 1320
 
1321
-            if($rating_value = geodir_get_commentoverall($review->comment_ID)){
1321
+            if ($rating_value = geodir_get_commentoverall($review->comment_ID)) {
1322 1322
                 $reviews[] = array(
1323 1323
                     "@type" => "Review",
1324 1324
                     "author" => $review->comment_author,
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
                     "description" => $review->comment_content,
1327 1327
                     "reviewRating" => array(
1328 1328
                         "@type" => "Rating",
1329
-                        "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score.
1329
+                        "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score.
1330 1330
                         "ratingValue" => $rating_value,
1331 1331
                         "worstRating" => "1"
1332 1332
                     )
@@ -1356,13 +1356,13 @@  discard block
 block discarded – undo
1356 1356
     }
1357 1357
     //print_r($post);
1358 1358
     // external links
1359
-    $external_links =  array();
1359
+    $external_links = array();
1360 1360
     $external_links[] = $post->geodir_website;
1361 1361
     $external_links[] = $post->geodir_twitter;
1362 1362
     $external_links[] = $post->geodir_facebook;
1363 1363
     $external_links = array_filter($external_links);
1364 1364
 
1365
-    if(!empty($external_links)){
1365
+    if (!empty($external_links)) {
1366 1366
         $external_links = array_values($external_links);
1367 1367
     }
1368 1368
 
@@ -1372,17 +1372,17 @@  discard block
 block discarded – undo
1372 1372
 
1373 1373
     // schema type
1374 1374
     $schema_type = 'LocalBusiness';
1375
-    if(isset($post->default_category) && $post->default_category){
1375
+    if (isset($post->default_category) && $post->default_category) {
1376 1376
         $cat_schema = geodir_get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type);
1377
-        if($cat_schema){$schema_type = $cat_schema;}
1378
-        if(!$cat_schema && $schema_type=='LocalBusiness' && $post->post_type=='gd_event'){$schema_type = 'Event';}
1377
+        if ($cat_schema) {$schema_type = $cat_schema; }
1378
+        if (!$cat_schema && $schema_type == 'LocalBusiness' && $post->post_type == 'gd_event') {$schema_type = 'Event'; }
1379 1379
     }
1380 1380
 
1381 1381
     $schema = array();
1382 1382
     $schema['@context'] = "https://schema.org";
1383 1383
     $schema['@type'] = $schema_type;
1384 1384
     $schema['name'] = $post->post_title;
1385
-    $schema['description'] = wp_strip_all_tags( $post->post_content, true );
1385
+    $schema['description'] = wp_strip_all_tags($post->post_content, true);
1386 1386
     $schema['telephone'] = $post->geodir_contact;
1387 1387
     $schema['url'] = $c_url;
1388 1388
     $schema['sameAs'] = $external_links;
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
         "postalCode" => $post->post_zip
1397 1397
     );
1398 1398
 
1399
-    if($post->post_latitude && $post->post_longitude) {
1399
+    if ($post->post_latitude && $post->post_longitude) {
1400 1400
         $schema['geo'] = array(
1401 1401
             "@type" => "GeoCoordinates",
1402 1402
             "latitude" => $post->post_latitude,
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
         );
1405 1405
     }
1406 1406
 
1407
-    if($post_avgratings) {
1407
+    if ($post_avgratings) {
1408 1408
         $schema['aggregateRating'] = array(
1409 1409
             "@type" => "AggregateRating",
1410 1410
             "ratingValue" => $post_avgratings,
@@ -1423,10 +1423,10 @@  discard block
 block discarded – undo
1423 1423
      * @param array $schema The array of schema data to be filtered.
1424 1424
      * @param object $post The post object.
1425 1425
      */
1426
-    $schema = apply_filters('geodir_details_schema', $schema,$post);
1426
+    $schema = apply_filters('geodir_details_schema', $schema, $post);
1427 1427
 
1428 1428
 
1429
-    echo '<script type="application/ld+json">' . json_encode($schema) . '</script>';
1429
+    echo '<script type="application/ld+json">'.json_encode($schema).'</script>';
1430 1430
 
1431 1431
 
1432 1432
     $uploads = wp_upload_dir();
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
      * @param string $facebook_og The open graph html to be filtered.
1440 1440
      * @param object $post The post object.
1441 1441
      */
1442
-    echo apply_filters('geodir_details_facebook_og', $facebook_og,$post);
1442
+    echo apply_filters('geodir_details_facebook_og', $facebook_og, $post);
1443 1443
 
1444 1444
 
1445 1445
 
@@ -1462,9 +1462,9 @@  discard block
 block discarded – undo
1462 1462
     ?>
1463 1463
     <div class="geodir-pos_navigation clearfix">
1464 1464
     <div
1465
-        class="geodir-post_left"><?php previous_post_link('%link', '' . __('Previous', 'geodirectory'), false) ?></div>
1465
+        class="geodir-post_left"><?php previous_post_link('%link', ''.__('Previous', 'geodirectory'), false) ?></div>
1466 1466
     <div
1467
-        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory') . '', false) ?></div>
1467
+        class="geodir-post_right"><?php next_post_link('%link', __('Next', 'geodirectory').'', false) ?></div>
1468 1468
     </div><?php
1469 1469
 }
1470 1470
 
@@ -1533,12 +1533,12 @@  discard block
 block discarded – undo
1533 1533
     $gd_post_type = geodir_get_current_posttype();
1534 1534
     $post_type_info = get_post_type_object($gd_post_type);
1535 1535
 
1536
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
1536
+    $add_string_in_title = __('All', 'geodirectory').' ';
1537 1537
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1538
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
1538
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
1539 1539
     }
1540 1540
 
1541
-    $list_title = $add_string_in_title . __($post_type_info->labels->name, 'geodirectory');
1541
+    $list_title = $add_string_in_title.__($post_type_info->labels->name, 'geodirectory');
1542 1542
     $single_name = $post_type_info->labels->singular_name;
1543 1543
 
1544 1544
     $taxonomy = geodir_get_taxonomies($gd_post_type, true);
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
1567 1567
         if (!empty($current_term)) {
1568 1568
             $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1569
-            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1569
+            if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1570 1570
                 $location_last_char = substr($location_name, -1);
1571 1571
                 $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1572
-                $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1572
+                $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1573 1573
             } else {
1574
-                $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1574
+                $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1575 1575
             }
1576 1576
         } else {
1577 1577
             if (count($taxonomy) > 1) {
@@ -1579,12 +1579,12 @@  discard block
 block discarded – undo
1579 1579
 
1580 1580
                 if (!empty($current_term)) {
1581 1581
                     $current_term_name = __(geodir_utf8_ucfirst($current_term->name), 'geodirectory');
1582
-                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type . 'category') {
1582
+                    if ($current_term_name != '' && $location_name != '' && isset($current_term->taxonomy) && $current_term->taxonomy == $gd_post_type.'category') {
1583 1583
                         $location_last_char = substr($location_name, -1);
1584 1584
                         $location_name_attach = geodir_strtolower($location_last_char) == 's' ? __("'", 'geodirectory') : __("'s", 'geodirectory');
1585
-                        $list_title .= __(' in', 'geodirectory') . ' ' . $location_name . $location_name_attach . ' ' . $current_term_name;
1585
+                        $list_title .= __(' in', 'geodirectory').' '.$location_name.$location_name_attach.' '.$current_term_name;
1586 1586
                     } else {
1587
-                        $list_title .= __(' in', 'geodirectory') . " '" . $current_term_name . "'";
1587
+                        $list_title .= __(' in', 'geodirectory')." '".$current_term_name."'";
1588 1588
                     }
1589 1589
                 }
1590 1590
             }
@@ -1612,7 +1612,7 @@  discard block
 block discarded – undo
1612 1612
                 $gd_city = __(geodir_ucwords($gd_city), 'geodirectory');
1613 1613
             }
1614 1614
 
1615
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_city . "'";
1615
+            $list_title .= __(' in', 'geodirectory')." '".$gd_city."'";
1616 1616
         } else if ($gd_region != '') {
1617 1617
             if ($gd_region_actual != '') {
1618 1618
                 $gd_region = $gd_region_actual;
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
                 $gd_region = __(geodir_ucwords($gd_region), 'geodirectory');
1623 1623
             }
1624 1624
 
1625
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_region . "'";
1625
+            $list_title .= __(' in', 'geodirectory')." '".$gd_region."'";
1626 1626
         } else if ($gd_country != '') {
1627 1627
             if ($gd_country_actual != '') {
1628 1628
                 $gd_country = $gd_country_actual;
@@ -1632,12 +1632,12 @@  discard block
 block discarded – undo
1632 1632
                 $gd_country = __(geodir_ucwords($gd_country), 'geodirectory');
1633 1633
             }
1634 1634
 
1635
-            $list_title .= __(' in', 'geodirectory') . " '" . $gd_country . "'";
1635
+            $list_title .= __(' in', 'geodirectory')." '".$gd_country."'";
1636 1636
         }
1637 1637
     }
1638 1638
 
1639 1639
     if (is_search()) {
1640
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
1640
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
1641 1641
     }
1642 1642
     /** This action is documented in geodirectory_template_actions.php */
1643 1643
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
@@ -1647,26 +1647,26 @@  discard block
 block discarded – undo
1647 1647
 
1648 1648
     $title = $list_title;
1649 1649
     $gd_page = '';
1650
-    if(geodir_is_page('pt')){
1650
+    if (geodir_is_page('pt')) {
1651 1651
         $gd_page = 'pt';
1652
-        $title  = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1652
+        $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title;
1653 1653
     }
1654
-    elseif(geodir_is_page('listing')){
1654
+    elseif (geodir_is_page('listing')) {
1655 1655
         $gd_page = 'listing';
1656 1656
         global $wp_query;
1657 1657
         $current_term = $wp_query->get_queried_object();
1658
-        if (strpos($current_term->taxonomy,'_tags') !== false) {
1658
+        if (strpos($current_term->taxonomy, '_tags') !== false) {
1659 1659
             $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title;
1660
-        }else{
1660
+        } else {
1661 1661
             $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title;
1662 1662
         }
1663 1663
 
1664 1664
     }
1665
-    elseif(geodir_is_page('author')){
1665
+    elseif (geodir_is_page('author')) {
1666 1666
         $gd_page = 'author';
1667
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
1667
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
1668 1668
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
1669
-        }else{
1669
+        } else {
1670 1670
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
1671 1671
         }
1672 1672
 
@@ -1680,16 +1680,16 @@  discard block
 block discarded – undo
1680 1680
      * @param string $title The page title including variables.
1681 1681
      * @param string $gd_page The GeoDirectory page type if any.
1682 1682
      */
1683
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1683
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
1684 1684
 
1685
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
1685
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
1686 1686
         /**
1687 1687
          * Filter the listing page title.
1688 1688
          *
1689 1689
          * @since 1.0.0
1690 1690
          * @param string $list_title The title for the category page.
1691 1691
          */
1692
-        apply_filters('geodir_listing_page_title', $title) . '</h1></header>';
1692
+        apply_filters('geodir_listing_page_title', $title).'</h1></header>';
1693 1693
 }
1694 1694
 
1695 1695
 add_action('geodir_listings_page_description', 'geodir_action_listings_description', 10);
@@ -1708,16 +1708,16 @@  discard block
 block discarded – undo
1708 1708
     $gd_post_type = geodir_get_current_posttype();
1709 1709
     if (isset($current_term->term_id) && $current_term->term_id != '') {
1710 1710
 
1711
-        $term_desc = term_description($current_term->term_id, $gd_post_type . '_tags');
1711
+        $term_desc = term_description($current_term->term_id, $gd_post_type.'_tags');
1712 1712
         $saved_data = stripslashes(geodir_get_tax_meta($current_term->term_id, 'ct_cat_top_desc', false, $gd_post_type));
1713 1713
         if ($term_desc && !$saved_data) {
1714 1714
             $saved_data = $term_desc;
1715 1715
         }
1716 1716
 
1717 1717
         // stop payment manager filtering content length
1718
-        $filter_priority = has_filter( 'the_content', 'geodir_payments_the_content' );
1719
-        if ( false !== $filter_priority ) {
1720
-            remove_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1718
+        $filter_priority = has_filter('the_content', 'geodir_payments_the_content');
1719
+        if (false !== $filter_priority) {
1720
+            remove_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1721 1721
         }
1722 1722
 
1723 1723
         /**
@@ -1731,14 +1731,14 @@  discard block
 block discarded – undo
1731 1731
         $cat_description = apply_filters('the_content', $saved_data);
1732 1732
 
1733 1733
 
1734
-        if ( false !== $filter_priority ) {
1735
-            add_filter( 'the_content', 'geodir_payments_the_content', $filter_priority );
1734
+        if (false !== $filter_priority) {
1735
+            add_filter('the_content', 'geodir_payments_the_content', $filter_priority);
1736 1736
         }
1737 1737
 
1738 1738
         if ($cat_description) {
1739 1739
             ?>
1740 1740
 
1741
-            <div class="term_description"><?php echo $cat_description;?></div> <?php
1741
+            <div class="term_description"><?php echo $cat_description; ?></div> <?php
1742 1742
         }
1743 1743
 
1744 1744
     }
@@ -1788,13 +1788,13 @@  discard block
 block discarded – undo
1788 1788
 function geodir_action_sidebar_left_open($type = '', $id = '', $class = '', $itemtype = '')
1789 1789
 {
1790 1790
     if ($type == 'home-page' && $width = get_option('geodir_width_home_left_section')) {
1791
-        $width_css = 'style="width:' . $width . '%;"';
1791
+        $width_css = 'style="width:'.$width.'%;"';
1792 1792
     } elseif ($type == 'listings-page' && $width = get_option('geodir_width_listing_left_section')) {
1793
-        $width_css = 'style="width:' . $width . '%;"';
1793
+        $width_css = 'style="width:'.$width.'%;"';
1794 1794
     } elseif ($type == 'search-page' && $width = get_option('geodir_width_search_left_section')) {
1795
-        $width_css = 'style="width:' . $width . '%;"';
1795
+        $width_css = 'style="width:'.$width.'%;"';
1796 1796
     } elseif ($type == 'author-page' && $width = get_option('geodir_width_author_left_section')) {
1797
-        $width_css = 'style="width:' . $width . '%;"';
1797
+        $width_css = 'style="width:'.$width.'%;"';
1798 1798
     } else {
1799 1799
         $width_css = '';
1800 1800
     }
@@ -2099,11 +2099,11 @@  discard block
 block discarded – undo
2099 2099
 
2100 2100
     $title = apply_filters('geodir_add_listing_page_title_text', get_the_title());
2101 2101
 
2102
-    if(geodir_is_page('add-listing')){
2102
+    if (geodir_is_page('add-listing')) {
2103 2103
         $gd_page = 'add-listing';
2104
-        if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){
2104
+        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2105 2105
             $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title;
2106
-        }elseif(isset($listing_type)){
2106
+        }elseif (isset($listing_type)) {
2107 2107
             $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title;
2108 2108
         }
2109 2109
 
@@ -2117,9 +2117,9 @@  discard block
 block discarded – undo
2117 2117
      * @param string $title The page title including variables.
2118 2118
      * @param string $gd_page The GeoDirectory page type if any.
2119 2119
      */
2120
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2120
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2121 2121
 
2122
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">';
2122
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">';
2123 2123
     echo $title;
2124 2124
     echo '</h1></header>';
2125 2125
 }
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
  */
2134 2134
 function geodir_action_add_listing_page_mandatory()
2135 2135
 {?>
2136
-    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p>
2136
+    <p class="geodir-note "><span class="geodir-required">*</span>&nbsp;<?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p>
2137 2137
 <?php
2138 2138
 }
2139 2139
 
@@ -2168,7 +2168,7 @@  discard block
 block discarded – undo
2168 2168
 
2169 2169
     if (isset($_REQUEST['backandedit'])) {
2170 2170
         global $post;
2171
-        $post = (object)$gd_session->get('listing');
2171
+        $post = (object) $gd_session->get('listing');
2172 2172
         $listing_type = $post->listing_type;
2173 2173
         $title = $post->post_title;
2174 2174
         $desc = $post->post_desc;
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
         $thumb_img_arr = geodir_get_images($post->ID);
2184 2184
         if ($thumb_img_arr) {
2185 2185
             foreach ($thumb_img_arr as $post_img) {
2186
-                $curImages .= $post_img->src . ',';
2186
+                $curImages .= $post_img->src.',';
2187 2187
             }
2188 2188
         }
2189 2189
 
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
         $title = $post->post_title;
2192 2192
         $desc = $post->post_content;
2193 2193
         $kw_tags = $post->post_tags;
2194
-        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type . '_tags', array('fields' => 'names')));
2194
+        $kw_tags = implode(",", wp_get_object_terms($post->ID, $listing_type.'_tags', array('fields' => 'names')));
2195 2195
     } else {
2196 2196
         $listing_type = sanitize_text_field($_REQUEST['listing_type']);
2197 2197
     }
@@ -2202,20 +2202,20 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
     $post_type_info = geodir_get_posttype_info($listing_type);
2204 2204
 
2205
-    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing','geodirectory');
2205
+    $cpt_singular_name = (isset($post_type_info['labels']['singular_name']) && $post_type_info['labels']['singular_name']) ? __($post_type_info['labels']['singular_name'], 'geodirectory') : __('Listing', 'geodirectory');
2206 2206
     
2207 2207
     $package_info = array();
2208 2208
     $package_info = geodir_post_package_info($package_info, $post);
2209 2209
     ?>
2210
-    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" method="post" enctype="multipart/form-data">
2211
-        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/>
2212
-        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/>
2210
+    <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" method="post" enctype="multipart/form-data">
2211
+        <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2212
+        <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/>
2213 2213
         <?php if ($page_id) { ?>
2214
-        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id;?>"/>
2214
+        <input type="hidden" name="add_listing_page_id" value="<?php echo $page_id; ?>"/>
2215 2215
         <?php } if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?>
2216
-            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']);?>"/>
2216
+            <input type="hidden" name="pid" value="<?php echo sanitize_text_field($_REQUEST['pid']); ?>"/>
2217 2217
         <?php } if (isset($_REQUEST['backandedit'])) { ?>
2218
-            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']);?>"/>
2218
+            <input type="hidden" name="backandedit" value="<?php echo sanitize_text_field($_REQUEST['backandedit']); ?>"/>
2219 2219
         <?php
2220 2220
         } 
2221 2221
         /**
@@ -2227,7 +2227,7 @@  discard block
 block discarded – undo
2227 2227
          */
2228 2228
         do_action('geodir_before_detail_fields');
2229 2229
         ?>
2230
-        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5>
2230
+        <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5>
2231 2231
         <?php
2232 2232
         /**
2233 2233
          * Called at the top of the add listing page form for frontend.
@@ -2248,10 +2248,10 @@  discard block
 block discarded – undo
2248 2248
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2249 2249
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2250 2250
                  */
2251
-                echo apply_filters('geodir_add_listing_title_label', sprintf( __('%s Title', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span>*</span> </label>
2251
+                echo apply_filters('geodir_add_listing_title_label', sprintf(__('%s Title', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span>*</span> </label>
2252 2252
             <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield"
2253 2253
                    value="<?php echo esc_attr(stripslashes($title)); ?>"/>
2254
-            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span>
2254
+            <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span>
2255 2255
         </div>
2256 2256
         <?php
2257 2257
         $show_editor = get_option('geodir_tiny_editor_on_add_listing');
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
         $desc_limit_msg = apply_filters('geodir_description_field_desc_limit_msg', $desc_limit_msg, $desc_limit);
2298 2298
         
2299 2299
         $desc_class = '';
2300
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2300
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2301 2301
             /**
2302 2302
              * Called on the add listing page form for frontend just before the description field.
2303 2303
              *
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
             $desc_class = ' hidden';
2311 2311
         }
2312 2312
         ?>
2313
-        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class;?>">
2313
+        <div id="geodir_post_desc_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $desc_class; ?>">
2314 2314
             <label><?php
2315 2315
                 /**
2316 2316
                  * Filter the add listing page description input label.
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
                  * @param string $cpt_singular_name The singular title of the curent CPT.
2321 2321
                  * @param string $listing_type The CPT being requested. ie: gd_place.
2322 2322
                  */
2323
-                echo apply_filters('geodir_add_listing_description_label',sprintf( __('%s Description', 'geodirectory'), $cpt_singular_name ),$cpt_singular_name,$listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2323
+                echo apply_filters('geodir_add_listing_description_label', sprintf(__('%s Description', 'geodirectory'), $cpt_singular_name), $cpt_singular_name, $listing_type); ?><span><?php if ($desc_limit != '0') { echo '*'; } ?></span> </label>
2324 2324
             <?php
2325 2325
             if ($show_editor) {
2326 2326
                 $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);
@@ -2329,16 +2329,16 @@  discard block
 block discarded – undo
2329 2329
                     <?php wp_editor($desc, "post_desc", $editor_settings); ?>
2330 2330
                 </div>
2331 2331
             <?php if ($desc_limit != '') { ?>
2332
-                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script>
2332
+                <script type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script>
2333 2333
             <?php } } else { ?>
2334 2334
                 <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" maxlength="<?php echo $desc_limit; ?>"><?php echo $desc; ?></textarea>
2335 2335
             <?php } if ($desc_limit_msg != '') { ?>
2336 2336
                 <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span>
2337 2337
             <?php } ?>
2338
-            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span>
2338
+            <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span>
2339 2339
         </div>
2340 2340
         <?php
2341
-        if ($desc_limit === '' || (int)$desc_limit > 0) {
2341
+        if ($desc_limit === '' || (int) $desc_limit > 0) {
2342 2342
             /**
2343 2343
              * Called on the add listing page form for frontend just after the description field.
2344 2344
              *
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
         $kw_tags_msg = apply_filters('geodir_listing_tags_field_tags_msg', $kw_tags_msg, $kw_tags_count);
2378 2378
         
2379 2379
         $tags_class = '';
2380
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2380
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2381 2381
             /**
2382 2382
              * Called on the add listing page form for frontend just before the tags field.
2383 2383
              *
@@ -2388,14 +2388,14 @@  discard block
 block discarded – undo
2388 2388
             $tags_class = ' hidden';
2389 2389
         }
2390 2390
         ?>
2391
-        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class;?>">
2391
+        <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details<?php echo $tags_class; ?>">
2392 2392
             <label><?php echo TAGKW_TEXT; ?></label>
2393 2393
             <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield"
2394
-                   maxlength="<?php echo $kw_tags_count;?>"/>
2395
-            <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span>
2394
+                   maxlength="<?php echo $kw_tags_count; ?>"/>
2395
+            <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span>
2396 2396
         </div>
2397 2397
         <?php
2398
-        if ($kw_tags_count === '' || (int)$kw_tags_count > 0) {
2398
+        if ($kw_tags_count === '' || (int) $kw_tags_count > 0) {
2399 2399
             /**
2400 2400
              * Called on the add listing page form for frontend just after the tags field.
2401 2401
              *
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
         $thumb_img_arr = array();
2422 2422
         $totImg = 0;
2423 2423
         if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) {
2424
-            $post = (object)$gd_session->get('listing');
2424
+            $post = (object) $gd_session->get('listing');
2425 2425
             if (isset($post->post_images))
2426 2426
                 $curImages = trim($post->post_images, ",");
2427 2427
 
@@ -2434,7 +2434,7 @@  discard block
 block discarded – undo
2434 2434
             $listing_type = $post->listing_type;
2435 2435
 
2436 2436
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
2437
-            $post = geodir_get_post_info((int)$_REQUEST['pid']);
2437
+            $post = geodir_get_post_info((int) $_REQUEST['pid']);
2438 2438
             $listing_type = $post->post_type;
2439 2439
             $thumb_img_arr = geodir_get_images($_REQUEST['pid']);
2440 2440
 
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                 //$curImages = $img->src.",";
2449 2449
             }
2450 2450
 
2451
-            $totImg = count((array)$thumb_img_arr);
2451
+            $totImg = count((array) $thumb_img_arr);
2452 2452
         }
2453 2453
 
2454 2454
         if ($curImages != '')
@@ -2469,15 +2469,15 @@  discard block
 block discarded – undo
2469 2469
         if ($show_image_input_box) {
2470 2470
             ?>
2471 2471
 
2472
-            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?>
2472
+            <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?>
2473 2473
                 <?php if ($image_limit == 1) {
2474
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>';
2474
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('image with this package', 'geodirectory').')</small>';
2475 2475
                 } ?>
2476 2476
                 <?php if ($image_limit > 1) {
2477
-                    echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('images with this package', 'geodirectory') . ')</small>';
2477
+                    echo '<br /><small>('.__('You can upload', 'geodirectory').' '.$image_limit.' '.__('images with this package', 'geodirectory').')</small>';
2478 2478
                 } ?>
2479 2479
                 <?php if ($image_limit == '') {
2480
-                    echo '<br /><small>(' . __('You can upload unlimited images with this package', 'geodirectory') . ')</small>';
2480
+                    echo '<br /><small>('.__('You can upload unlimited images with this package', 'geodirectory').')</small>';
2481 2481
                 } ?>
2482 2482
             </h5>
2483 2483
 
@@ -2492,11 +2492,11 @@  discard block
 block discarded – undo
2492 2492
                 <div
2493 2493
                     class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>"
2494 2494
                     id="<?php echo $id; ?>plupload-upload-ui">
2495
-                    <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/>
2495
+                    <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/>
2496 2496
                     <input id="<?php echo $id; ?>plupload-browse-button" type="button"
2497 2497
                            value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/>
2498 2498
                     <span class="ajaxnonceplu"
2499
-                          id="ajaxnonceplu<?php echo wp_create_nonce($id . 'pluploadan'); ?>"></span>
2499
+                          id="ajaxnonceplu<?php echo wp_create_nonce($id.'pluploadan'); ?>"></span>
2500 2500
                     <?php if ($width && $height): ?>
2501 2501
                         <span class="plupload-resize"></span>
2502 2502
                         <span class="plupload-width" id="plupload-width<?php echo $width; ?>"></span>
@@ -2509,7 +2509,7 @@  discard block
 block discarded – undo
2509 2509
                      id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;">
2510 2510
                 </div>
2511 2511
                 <span
2512
-                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory');?></span>
2512
+                    id="upload-msg"><?php _e('Please drag &amp; drop the images to rearrange the order', 'geodirectory'); ?></span>
2513 2513
                 <span id="<?php echo $id; ?>upload-error" style="display:none"></span>
2514 2514
             </div>
2515 2515
 
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
          *
2522 2522
          * @since 1.0.0
2523 2523
          */
2524
-        do_action('geodir_after_main_form_fields');?>
2524
+        do_action('geodir_after_main_form_fields'); ?>
2525 2525
 
2526 2526
 
2527 2527
         <!-- add captcha code -->
@@ -2532,7 +2532,7 @@  discard block
 block discarded – undo
2532 2532
         </script>
2533 2533
         <noscript>
2534 2534
             <div>
2535
-                <label><?php _e('Type 64 into this box', 'geodirectory');?></label>
2535
+                <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label>
2536 2536
                 <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/>
2537 2537
             </div>
2538 2538
         </noscript>
@@ -2542,10 +2542,10 @@  discard block
 block discarded – undo
2542 2542
         <!-- end captcha code -->
2543 2543
 
2544 2544
         <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;">
2545
-            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>"
2546
-                   class="geodir_button" <?php echo $submit_button;?>/>
2545
+            <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>"
2546
+                   class="geodir_button" <?php echo $submit_button; ?>/>
2547 2547
             <span class="geodir_message_note"
2548
-                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span>
2548
+                  style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span>
2549 2549
         </div>
2550 2550
 
2551 2551
     </form>
@@ -2607,7 +2607,7 @@  discard block
 block discarded – undo
2607 2607
         class="<?php
2608 2608
         /** This action is documented in geodirectory_template_actions.php */
2609 2609
         echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>">
2610
-        <?php dynamic_sidebar('Reg/Login Top Section');?>
2610
+        <?php dynamic_sidebar('Reg/Login Top Section'); ?>
2611 2611
     </div><!-- clearfix ends here-->
2612 2612
 <?php
2613 2613
 }
@@ -2627,11 +2627,11 @@  discard block
 block discarded – undo
2627 2627
 
2628 2628
     global $user_login;
2629 2629
     
2630
-    $is_enable_signup = get_option( 'users_can_register' );
2630
+    $is_enable_signup = get_option('users_can_register');
2631 2631
     
2632 2632
     ?>
2633 2633
     <script type="text/javascript">
2634
-        <?php if ( $user_login ) { ?>
2634
+        <?php if ($user_login) { ?>
2635 2635
         setTimeout(function () {
2636 2636
             try {
2637 2637
                 d = document.getElementById('user_pass');
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
         <?php } ?>
2649 2649
     </script>
2650 2650
     <script type="text/javascript">
2651
-        <?php if ( $user_login ) { ?>
2651
+        <?php if ($user_login) { ?>
2652 2652
         setTimeout(function () {
2653 2653
             try {
2654 2654
                 d = document.getElementById('user_pass');
@@ -2673,7 +2673,7 @@  discard block
 block discarded – undo
2673 2673
         foreach ($errors as $errorsObj) {
2674 2674
             foreach ($errorsObj as $key => $val) {
2675 2675
                 for ($i = 0; $i < count($val); $i++) {
2676
-                    echo "<div class=error_msg_fix>" . $val[$i] . '</div>';
2676
+                    echo "<div class=error_msg_fix>".$val[$i].'</div>';
2677 2677
                     $registration_error_msg = 1;
2678 2678
                 }
2679 2679
             }
@@ -2690,10 +2690,10 @@  discard block
 block discarded – undo
2690 2690
              *
2691 2691
              * @since 1.0.0
2692 2692
              */
2693
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2693
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2694 2694
         </div>
2695 2695
 
2696
-    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup ) { ?>
2696
+    <?php } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'login' && isset($_REQUEST['page1']) && $_REQUEST['page1'] == 'sign_up' && $is_enable_signup) { ?>
2697 2697
 
2698 2698
         <div class="registration_form">
2699 2699
             <?php
@@ -2702,7 +2702,7 @@  discard block
 block discarded – undo
2702 2702
              *
2703 2703
              * @since 1.0.0
2704 2704
              */
2705
-            include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2705
+            include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2706 2706
         </div>
2707 2707
 
2708 2708
     <?php } else { ?>
@@ -2714,10 +2714,10 @@  discard block
 block discarded – undo
2714 2714
              *
2715 2715
              * @since 1.0.0
2716 2716
              */
2717
-            include(geodir_plugin_path() . "/geodirectory-templates/login_frm.php"); ?>
2717
+            include(geodir_plugin_path()."/geodirectory-templates/login_frm.php"); ?>
2718 2718
         </div>
2719 2719
         
2720
-        <?php if ( $is_enable_signup ) { ?>
2720
+        <?php if ($is_enable_signup) { ?>
2721 2721
             <div class="registration_form_r">
2722 2722
                 <?php
2723 2723
                 /**
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
                  *
2726 2726
                  * @since 1.0.0
2727 2727
                  */
2728
-                include(geodir_plugin_path() . "/geodirectory-templates/reg_frm.php"); ?>
2728
+                include(geodir_plugin_path()."/geodirectory-templates/reg_frm.php"); ?>
2729 2729
             </div>
2730 2730
         <?php } ?>
2731 2731
 
@@ -2762,12 +2762,12 @@  discard block
 block discarded – undo
2762 2762
     $gd_post_type = geodir_get_current_posttype();
2763 2763
     $post_type_info = get_post_type_object($gd_post_type);
2764 2764
 
2765
-    $add_string_in_title = __('All', 'geodirectory') . ' ';
2765
+    $add_string_in_title = __('All', 'geodirectory').' ';
2766 2766
     if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2767
-        $add_string_in_title = __('My Favorite', 'geodirectory') . ' ';
2767
+        $add_string_in_title = __('My Favorite', 'geodirectory').' ';
2768 2768
     }
2769 2769
 
2770
-    $list_title = $add_string_in_title . $post_type_info->labels->name;
2770
+    $list_title = $add_string_in_title.$post_type_info->labels->name;
2771 2771
     $single_name = $post_type_info->labels->singular_name;
2772 2772
 
2773 2773
     $taxonomy = geodir_get_taxonomies($gd_post_type);
@@ -2775,12 +2775,12 @@  discard block
 block discarded – undo
2775 2775
     if (!empty($term)) {
2776 2776
         $current_term = get_term_by('slug', $term, $taxonomy[0]);
2777 2777
         if (!empty($current_term))
2778
-            $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'";
2778
+            $list_title .= __(' in', 'geodirectory')." '".geodir_ucwords($current_term->name)."'";
2779 2779
     }
2780 2780
 
2781 2781
 
2782 2782
     if (is_search()) {
2783
-        $list_title = __('Search', 'geodirectory') . ' ' . __($post_type_info->labels->name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
2783
+        $list_title = __('Search', 'geodirectory').' '.__($post_type_info->labels->name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
2784 2784
 
2785 2785
     }
2786 2786
     /** This action is documented in geodirectory_template_actions.php */
@@ -2789,11 +2789,11 @@  discard block
 block discarded – undo
2789 2789
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
2790 2790
 
2791 2791
     $title = $list_title;
2792
-    if(geodir_is_page('author')){
2792
+    if (geodir_is_page('author')) {
2793 2793
         $gd_page = 'author';
2794
-        if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){
2794
+        if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') {
2795 2795
             $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title;
2796
-        }else{
2796
+        } else {
2797 2797
             $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title;
2798 2798
         }
2799 2799
 
@@ -2807,16 +2807,16 @@  discard block
 block discarded – undo
2807 2807
      * @param string $title The page title including variables.
2808 2808
      * @param string $gd_page The GeoDirectory page type if any.
2809 2809
      */
2810
-    $title =  apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2810
+    $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page);
2811 2811
 
2812
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
2812
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
2813 2813
         /**
2814 2814
          * Filter the author page title text.
2815 2815
          *
2816 2816
          * @since 1.0.0
2817 2817
          * @param string $list_title The title for the page.
2818 2818
          */
2819
-        apply_filters('geodir_author_page_title_text', $title) . '</h1></header>';
2819
+        apply_filters('geodir_author_page_title_text', $title).'</h1></header>';
2820 2820
 }
2821 2821
 
2822 2822
 
@@ -3021,19 +3021,19 @@  discard block
 block discarded – undo
3021 3021
     $post_type_info = get_post_type_object($gd_post_type);
3022 3022
 
3023 3023
     $pt_name = '';
3024
-    if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;}
3024
+    if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; }
3025 3025
 
3026 3026
     if (is_search()) {
3027
-        $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'";
3027
+        $list_title = __('Search', 'geodirectory').' '.__($pt_name, 'geodirectory').__(' For :', 'geodirectory')." '".get_search_query()."'";
3028 3028
 
3029 3029
     }
3030 3030
     /** This action is documented in geodirectory_template_actions.php */
3031 3031
     $class = apply_filters('geodir_page_title_class', 'entry-title fn');
3032 3032
     /** This action is documented in geodirectory_template_actions.php */
3033 3033
     $class_header = apply_filters('geodir_page_title_header_class', 'entry-header');
3034
-    echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' .
3034
+    echo '<header class="'.$class_header.'"><h1 class="'.$class.'">'.
3035 3035
         /** This action is documented in geodirectory_template_actions.php */
3036
-        apply_filters('geodir_listing_page_title', wptexturize($list_title)) . '</h1></header>';
3036
+        apply_filters('geodir_listing_page_title', wptexturize($list_title)).'</h1></header>';
3037 3037
 }
3038 3038
 
3039 3039
 // action for adding the listings page top widget area
@@ -3437,7 +3437,7 @@  discard block
 block discarded – undo
3437 3437
         $gd_post_type = geodir_get_current_posttype();
3438 3438
         $post_type_info = get_post_type_object($gd_post_type);
3439 3439
 
3440
-        $list_title = __('Search', 'geodirectory') . ' ' . __(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory') . __(' :', 'geodirectory');
3440
+        $list_title = __('Search', 'geodirectory').' '.__(geodir_utf8_ucfirst($post_type_info->labels->name), 'geodirectory').__(' :', 'geodirectory');
3441 3441
     }
3442 3442
     return $list_title;
3443 3443
 }
@@ -3453,7 +3453,7 @@  discard block
 block discarded – undo
3453 3453
  * @param string $position Position to add the post content. 'before' or 'after'. Default 'before'.
3454 3454
  * @param string $gd_page The geodirectory page type. Default null.
3455 3455
  */
3456
-function geodir_add_page_content( $position = 'before', $gd_page = '' ) {
3456
+function geodir_add_page_content($position = 'before', $gd_page = '') {
3457 3457
     global $post;
3458 3458
 
3459 3459
     $gd_page_id = NULL;
@@ -3529,17 +3529,17 @@  discard block
 block discarded – undo
3529 3529
  * @param WP_Post $post           WP_Post object.
3530 3530
  * @return string Filtered SQL JOIN clause.
3531 3531
  */
3532
-function geodir_previous_next_post_join( $join, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3532
+function geodir_previous_next_post_join($join, $in_same_term, $excluded_terms, $taxonomy, $post) {
3533 3533
     global $plugin_prefix;
3534 3534
 
3535
-    if ( !empty($post->post_type) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3536
-        $join .= " INNER JOIN " . $plugin_prefix . $post->post_type . "_detail AS gd ON gd.post_id = p.ID";
3535
+    if (!empty($post->post_type) && in_array($post->post_type, geodir_get_posttypes())) {
3536
+        $join .= " INNER JOIN ".$plugin_prefix.$post->post_type."_detail AS gd ON gd.post_id = p.ID";
3537 3537
     }
3538 3538
     
3539 3539
     return $join;
3540 3540
 }
3541
-add_filter( 'get_previous_post_join', 'geodir_previous_next_post_join', 10, 5 );
3542
-add_filter( 'get_next_post_join', 'geodir_previous_next_post_join', 10, 5 );
3541
+add_filter('get_previous_post_join', 'geodir_previous_next_post_join', 10, 5);
3542
+add_filter('get_next_post_join', 'geodir_previous_next_post_join', 10, 5);
3543 3543
 
3544 3544
 /**
3545 3545
  * Filters the WHERE clause in the SQL for an adjacent post query.
@@ -3557,32 +3557,32 @@  discard block
 block discarded – undo
3557 3557
  * @param WP_Post $post          WP_Post object.
3558 3558
  * @return string Filtered SQL WHERE clause.
3559 3559
  */
3560
-function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) {
3560
+function geodir_previous_next_post_where($where, $in_same_term, $excluded_terms, $taxonomy, $post) {
3561 3561
     global $wpdb, $plugin_prefix;
3562 3562
 
3563
-    if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) {
3563
+    if (!empty($post->post_type) && (!empty($post->country_slug) || !empty($post->region_slug) || !empty($post->city_slug)) && in_array($post->post_type, geodir_get_posttypes())) {
3564 3564
         $post_locations = '';
3565 3565
         $post_locations_var = array();
3566 3566
         
3567
-        if ( !empty( $post->country_slug ) ) {
3567
+        if (!empty($post->country_slug)) {
3568 3568
             $post_locations .= " AND post_locations LIKE %s";
3569
-            $post_locations_var[] = "%,[" . $post->country_slug . "]";
3569
+            $post_locations_var[] = "%,[".$post->country_slug."]";
3570 3570
         }
3571 3571
 
3572
-        if ( !empty( $post->region_slug ) ) {
3572
+        if (!empty($post->region_slug)) {
3573 3573
             $post_locations .= " AND post_locations LIKE %s";
3574
-            $post_locations_var[] = "%,[" . $post->region_slug . "],%";
3574
+            $post_locations_var[] = "%,[".$post->region_slug."],%";
3575 3575
         }
3576 3576
 
3577
-        if ( !empty( $post->city_slug ) ) {
3577
+        if (!empty($post->city_slug)) {
3578 3578
             $post_locations .= " AND post_locations LIKE %s";
3579
-            $post_locations_var[] = "[" . $post->city_slug . "],%";
3579
+            $post_locations_var[] = "[".$post->city_slug."],%";
3580 3580
         }
3581 3581
         
3582
-        $where .= $wpdb->prepare( $post_locations, $post_locations_var );
3582
+        $where .= $wpdb->prepare($post_locations, $post_locations_var);
3583 3583
     }
3584 3584
     
3585 3585
     return $where;
3586 3586
 }
3587
-add_filter( 'get_previous_post_where', 'geodir_previous_next_post_where', 10, 5 );
3588
-add_filter( 'get_next_post_where', 'geodir_previous_next_post_where', 10, 5 );
3589 3587
\ No newline at end of file
3588
+add_filter('get_previous_post_where', 'geodir_previous_next_post_where', 10, 5);
3589
+add_filter('get_next_post_where', 'geodir_previous_next_post_where', 10, 5);
3590 3590
\ No newline at end of file
Please login to merge, or discard this patch.