Completed
Pull Request — master (#206)
by Kiran
05:47
created
geodirectory-functions/custom_functions.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
  * @param array $package_info Package info array.
154 154
  * @param object|string $post The post object.
155 155
  * @param string $post_type The post type.
156
- * @return object Returns filtered package info as an object.
156
+ * @return string Returns filtered package info as an object.
157 157
  */
158 158
 function geodir_post_package_info($package_info, $post = '', $post_type = '')
159 159
 {
Please login to merge, or discard this patch.
Indentation   +1327 added lines, -1327 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Custom functions
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Custom functions
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 /**
10 10
  * Front end listing view template selection.
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * @global object $gd_session GeoDirectory Session object.
18 18
  */
19 19
 function geodir_list_view_select() {
20
-    global $gd_session;
20
+	global $gd_session;
21 21
 	?>
22 22
     <script type="text/javascript">
23 23
 	function geodir_list_view_select(list) {
@@ -86,63 +86,63 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function geodir_max_excerpt($charlength)
88 88
 {
89
-    global $post;
90
-    if ($charlength == '0') {
91
-        return;
92
-    }
93
-    $out = '';
89
+	global $post;
90
+	if ($charlength == '0') {
91
+		return;
92
+	}
93
+	$out = '';
94 94
 	
95 95
 	$temp_post = $post;
96 96
 	$excerpt = get_the_excerpt();
97 97
 
98
-    $charlength++;
99
-    $excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
100
-    if (mb_strlen($excerpt) > $charlength) {
101
-        if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
102
-            $excut = -(mb_strlen($excerpt_more));
103
-            $subex = mb_substr($excerpt, 0, $excut);
104
-            if ($charlength > 0 && mb_strlen($subex) > $charlength) {
105
-                $subex = mb_substr($subex, 0, $charlength);
106
-            }
107
-            $out .= $subex;
108
-        } else {
109
-            $subex = mb_substr($excerpt, 0, $charlength - 5);
110
-            $exwords = explode(' ', $subex);
111
-            $excut = -(mb_strlen($exwords[count($exwords) - 1]));
112
-            if ($excut < 0) {
113
-                $out .= mb_substr($subex, 0, $excut);
114
-            } else {
115
-                $out .= $subex;
116
-            }
117
-        }
118
-        $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
119
-        /**
120
-         * Filter excerpt read more text.
121
-         *
122
-         * @since 1.0.0
123
-         */
124
-        $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
125
-        $out .= '</a>';
126
-
127
-    } else {
128
-        if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129
-            $excut = -(mb_strlen($excerpt_more));
130
-            $out .= mb_substr($excerpt, 0, $excut);
131
-            $out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
132
-            /**
133
-             * Filter excerpt read more text.
134
-             *
135
-             * @since 1.0.0
136
-             */
137
-            $out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
138
-            $out .= '</a>';
139
-        } else {
140
-            $out .= $excerpt;
141
-        }
142
-    }
98
+	$charlength++;
99
+	$excerpt_more = function_exists('geodirf_excerpt_more') ? geodirf_excerpt_more('') : geodir_excerpt_more('');
100
+	if (mb_strlen($excerpt) > $charlength) {
101
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
102
+			$excut = -(mb_strlen($excerpt_more));
103
+			$subex = mb_substr($excerpt, 0, $excut);
104
+			if ($charlength > 0 && mb_strlen($subex) > $charlength) {
105
+				$subex = mb_substr($subex, 0, $charlength);
106
+			}
107
+			$out .= $subex;
108
+		} else {
109
+			$subex = mb_substr($excerpt, 0, $charlength - 5);
110
+			$exwords = explode(' ', $subex);
111
+			$excut = -(mb_strlen($exwords[count($exwords) - 1]));
112
+			if ($excut < 0) {
113
+				$out .= mb_substr($subex, 0, $excut);
114
+			} else {
115
+				$out .= $subex;
116
+			}
117
+		}
118
+		$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
119
+		/**
120
+		 * Filter excerpt read more text.
121
+		 *
122
+		 * @since 1.0.0
123
+		 */
124
+		$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
125
+		$out .= '</a>';
126
+
127
+	} else {
128
+		if (mb_strlen($excerpt_more) > 0 && mb_strpos($excerpt, $excerpt_more) !== false) {
129
+			$excut = -(mb_strlen($excerpt_more));
130
+			$out .= mb_substr($excerpt, 0, $excut);
131
+			$out .= ' <a class="excerpt-read-more" href="' . get_permalink() . '" title="' . get_the_title() . '">';
132
+			/**
133
+			 * Filter excerpt read more text.
134
+			 *
135
+			 * @since 1.0.0
136
+			 */
137
+			$out .= apply_filters('geodir_max_excerpt_end', __('Read more [...]', 'geodirectory'));
138
+			$out .= '</a>';
139
+		} else {
140
+			$out .= $excerpt;
141
+		}
142
+	}
143 143
 	$post = $temp_post;
144 144
 
145
-    return $out;
145
+	return $out;
146 146
 }
147 147
 
148 148
 /**
@@ -157,34 +157,34 @@  discard block
 block discarded – undo
157 157
  */
158 158
 function geodir_post_package_info($package_info, $post = '', $post_type = '')
159 159
 {
160
-    $package_info['pid'] = 0;
161
-    $package_info['days'] = 0;
162
-    $package_info['amount'] = 0;
163
-    $package_info['is_featured'] = 0;
164
-    $package_info['image_limit'] = '';
165
-    $package_info['google_analytics'] = 1;
166
-    $package_info['sendtofriend'] = 1;
167
-
168
-    /**
169
-     * Filter listing package info.
170
-     *
171
-     * @since 1.0.0
172
-     * @param array $package_info {
173
-     *    Attributes of the package_info.
174
-     *
175
-     *    @type int $pid Package ID. Default 0.
176
-     *    @type int $days Package validity in Days. Default 0.
177
-     *    @type int $amount Package amount. Default 0.
178
-     *    @type int $is_featured Is this featured package? Default 0.
179
-     *    @type string $image_limit Image limit for this package. Default "".
180
-     *    @type int $google_analytics Add analytics to this package. Default 1.
181
-     *    @type int $sendtofriend Send to friend. Default 1.
182
-     *
183
-     * }
184
-     * @param object|string $post The post object.
185
-     * @param string $post_type The post type.
186
-     */
187
-    return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
160
+	$package_info['pid'] = 0;
161
+	$package_info['days'] = 0;
162
+	$package_info['amount'] = 0;
163
+	$package_info['is_featured'] = 0;
164
+	$package_info['image_limit'] = '';
165
+	$package_info['google_analytics'] = 1;
166
+	$package_info['sendtofriend'] = 1;
167
+
168
+	/**
169
+	 * Filter listing package info.
170
+	 *
171
+	 * @since 1.0.0
172
+	 * @param array $package_info {
173
+	 *    Attributes of the package_info.
174
+	 *
175
+	 *    @type int $pid Package ID. Default 0.
176
+	 *    @type int $days Package validity in Days. Default 0.
177
+	 *    @type int $amount Package amount. Default 0.
178
+	 *    @type int $is_featured Is this featured package? Default 0.
179
+	 *    @type string $image_limit Image limit for this package. Default "".
180
+	 *    @type int $google_analytics Add analytics to this package. Default 1.
181
+	 *    @type int $sendtofriend Send to friend. Default 1.
182
+	 *
183
+	 * }
184
+	 * @param object|string $post The post object.
185
+	 * @param string $post_type The post type.
186
+	 */
187
+	return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
188 188
 
189 189
 }
190 190
 
@@ -212,127 +212,127 @@  discard block
 block discarded – undo
212 212
  */
213 213
 function geodir_send_inquiry($request)
214 214
 {
215
-    global $wpdb;
215
+	global $wpdb;
216 216
 
217
-    // strip slashes from text
218
-    $request = !empty($request) ? stripslashes_deep($request) : $request;
217
+	// strip slashes from text
218
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
219 219
 
220
-    $yourname = $request['inq_name'];
221
-    $youremail = $request['inq_email'];
222
-    $inq_phone = $request['inq_phone'];
223
-    $frnd_comments = $request['inq_msg'];
224
-    $pid = $request['pid'];
220
+	$yourname = $request['inq_name'];
221
+	$youremail = $request['inq_email'];
222
+	$inq_phone = $request['inq_phone'];
223
+	$frnd_comments = $request['inq_msg'];
224
+	$pid = $request['pid'];
225 225
 
226
-    $author_id = '';
227
-    $post_title = '';
226
+	$author_id = '';
227
+	$post_title = '';
228 228
 
229
-    if ($request['pid']) {
229
+	if ($request['pid']) {
230 230
 
231
-        $productinfosql = $wpdb->prepare(
232
-            "select ID,post_author,post_title from $wpdb->posts where ID =%d",
233
-            array($request['pid'])
234
-        );
235
-        $productinfo = $wpdb->get_row($productinfosql);
231
+		$productinfosql = $wpdb->prepare(
232
+			"select ID,post_author,post_title from $wpdb->posts where ID =%d",
233
+			array($request['pid'])
234
+		);
235
+		$productinfo = $wpdb->get_row($productinfosql);
236 236
 
237
-        $author_id = $productinfo->post_author;
238
-        $post_title = $productinfo->post_title;
239
-    }
237
+		$author_id = $productinfo->post_author;
238
+		$post_title = $productinfo->post_title;
239
+	}
240 240
 
241
-    $post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
241
+	$post_title = '<a href="' . get_permalink($pid) . '">' . $post_title . '</a>';
242 242
 
243
-    $user_info = get_userdata($author_id);
244
-    $to_email = geodir_get_post_meta($pid, 'geodir_email', true);
245
-    $to_name = geodir_get_client_name($author_id);
243
+	$user_info = get_userdata($author_id);
244
+	$to_email = geodir_get_post_meta($pid, 'geodir_email', true);
245
+	$to_name = geodir_get_client_name($author_id);
246 246
 
247
-    if ($to_email == '') {
248
-        $to_email = get_option('admin_email');
249
-    }
247
+	if ($to_email == '') {
248
+		$to_email = get_option('admin_email');
249
+	}
250 250
 
251
-    /**
252
-     * Called after the send enquiry var have been set but before the email has been sent.
253
-     *
254
-     * @since 1.0.0
255
-     * @param array $request {
256
-     *    The submitted form fields as an array.
257
-     *
258
-     *    @type string $sendact Enquiry type. Default "send_inqury".
259
-     *    @type string $pid Post ID.
260
-     *    @type string $inq_name Sender name.
261
-     *    @type string $inq_email Sender mail.
262
-     *    @type string $inq_phone Sender phone.
263
-     *    @type string $inq_msg Email message.
264
-     *
265
-     * }
266
-     * @param string $type The form type, default: `Enquiry`.
267
-     */
268
-    do_action('geodir_after_send_enquiry', $request, 'Enquiry');
269
-
270
-    $client_message = $frnd_comments;
271
-    $client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
272
-    /**
273
-     * Filter client message text.
274
-     *
275
-     * @since 1.0.0
276
-     * @param string $client_message Client message text.
277
-     */
278
-    $client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
279
-
280
-    /**
281
-     * Called before the send enquiry email is sent.
282
-     *
283
-     * @since 1.0.0
284
-     * @param array $request {
285
-     *    The submitted form fields as an array.
286
-     *
287
-     *    @type string $sendact Enquiry type. Default "send_inqury".
288
-     *    @type string $pid Post ID.
289
-     *    @type string $inq_name Sender name.
290
-     *    @type string $inq_email Sender mail.
291
-     *    @type string $inq_phone Sender phone.
292
-     *    @type string $inq_msg Email message.
293
-     *
294
-     * }
295
-     */
296
-    do_action('geodir_before_send_enquiry_email', $request);
297
-    if ($to_email) {
298
-        // strip slashes message
299
-        $client_message = stripslashes_deep($client_message);
300
-
301
-        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
302
-    }
251
+	/**
252
+	 * Called after the send enquiry var have been set but before the email has been sent.
253
+	 *
254
+	 * @since 1.0.0
255
+	 * @param array $request {
256
+	 *    The submitted form fields as an array.
257
+	 *
258
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
259
+	 *    @type string $pid Post ID.
260
+	 *    @type string $inq_name Sender name.
261
+	 *    @type string $inq_email Sender mail.
262
+	 *    @type string $inq_phone Sender phone.
263
+	 *    @type string $inq_msg Email message.
264
+	 *
265
+	 * }
266
+	 * @param string $type The form type, default: `Enquiry`.
267
+	 */
268
+	do_action('geodir_after_send_enquiry', $request, 'Enquiry');
303 269
 
304
-    /**
305
-     * Called after the send enquiry email is sent.
306
-     *
307
-     * @since 1.0.0
308
-     * @param array $request {
309
-     *    The submitted form fields as an array.
310
-     *
311
-     *    @type string $sendact Enquiry type. Default "send_inqury".
312
-     *    @type string $pid Post ID.
313
-     *    @type string $inq_name Sender name.
314
-     *    @type string $inq_email Sender mail.
315
-     *    @type string $inq_phone Sender phone.
316
-     *    @type string $inq_msg Email message.
317
-     *
318
-     * }
319
-     */
320
-    do_action('geodir_after_send_enquiry_email', $request);
321
-    $url = get_permalink($pid);
322
-    if (strstr($url, '?')) {
323
-        $url = $url . "&send_inquiry=success";
324
-    } else {
325
-        $url = $url . "?send_inquiry=success";
326
-    }
327
-    /**
328
-     * Filter redirect url after the send enquiry email is sent.
329
-     *
330
-     * @since 1.0.0
331
-     * @param string $url Redirect url.
332
-     */
333
-    $url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
334
-    wp_redirect($url);
335
-    exit;
270
+	$client_message = $frnd_comments;
271
+	$client_message .= '<br>' . __('From :', 'geodirectory') . ' ' . $yourname . '<br>' . __('Phone :', 'geodirectory') . ' ' . $inq_phone . '<br>' . __('Email :', 'geodirectory') . ' ' . $youremail . '<br><br>' . __('Sent from', 'geodirectory') . ' - <b><a href="' . trailingslashit(home_url()) . '">' . get_option('blogname') . '</a></b>.';
272
+	/**
273
+	 * Filter client message text.
274
+	 *
275
+	 * @since 1.0.0
276
+	 * @param string $client_message Client message text.
277
+	 */
278
+	$client_message = apply_filters('geodir_inquiry_email_msg', $client_message);
279
+
280
+	/**
281
+	 * Called before the send enquiry email is sent.
282
+	 *
283
+	 * @since 1.0.0
284
+	 * @param array $request {
285
+	 *    The submitted form fields as an array.
286
+	 *
287
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
288
+	 *    @type string $pid Post ID.
289
+	 *    @type string $inq_name Sender name.
290
+	 *    @type string $inq_email Sender mail.
291
+	 *    @type string $inq_phone Sender phone.
292
+	 *    @type string $inq_msg Email message.
293
+	 *
294
+	 * }
295
+	 */
296
+	do_action('geodir_before_send_enquiry_email', $request);
297
+	if ($to_email) {
298
+		// strip slashes message
299
+		$client_message = stripslashes_deep($client_message);
300
+
301
+		geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
302
+	}
303
+
304
+	/**
305
+	 * Called after the send enquiry email is sent.
306
+	 *
307
+	 * @since 1.0.0
308
+	 * @param array $request {
309
+	 *    The submitted form fields as an array.
310
+	 *
311
+	 *    @type string $sendact Enquiry type. Default "send_inqury".
312
+	 *    @type string $pid Post ID.
313
+	 *    @type string $inq_name Sender name.
314
+	 *    @type string $inq_email Sender mail.
315
+	 *    @type string $inq_phone Sender phone.
316
+	 *    @type string $inq_msg Email message.
317
+	 *
318
+	 * }
319
+	 */
320
+	do_action('geodir_after_send_enquiry_email', $request);
321
+	$url = get_permalink($pid);
322
+	if (strstr($url, '?')) {
323
+		$url = $url . "&send_inquiry=success";
324
+	} else {
325
+		$url = $url . "?send_inquiry=success";
326
+	}
327
+	/**
328
+	 * Filter redirect url after the send enquiry email is sent.
329
+	 *
330
+	 * @since 1.0.0
331
+	 * @param string $url Redirect url.
332
+	 */
333
+	$url = apply_filters('geodir_send_enquiry_after_submit_redirect', $url);
334
+	wp_redirect($url);
335
+	exit;
336 336
 
337 337
 }
338 338
 
@@ -361,85 +361,85 @@  discard block
 block discarded – undo
361 361
  */
362 362
 function geodir_send_friend($request)
363 363
 {
364
-    global $wpdb;
365
-
366
-    // strip slashes from text
367
-    $request = !empty($request) ? stripslashes_deep($request) : $request;
368
-
369
-    $yourname = $request['yourname'];
370
-    $youremail = $request['youremail'];
371
-    $frnd_subject = $request['frnd_subject'];
372
-    $frnd_comments = $request['frnd_comments'];
373
-    $pid = $request['pid'];
374
-    $to_email = $request['to_email'];
375
-    $to_name = $request['to_name'];
376
-    if ($request['pid']) {
377
-        $productinfosql = $wpdb->prepare(
378
-            "select ID,post_title from $wpdb->posts where ID =%d",
379
-            array($request['pid'])
380
-        );
381
-        $productinfo = $wpdb->get_results($productinfosql);
382
-        foreach ($productinfo as $productinfoObj) {
383
-            $post_title = $productinfoObj->post_title;
384
-        }
385
-    }
364
+	global $wpdb;
365
+
366
+	// strip slashes from text
367
+	$request = !empty($request) ? stripslashes_deep($request) : $request;
368
+
369
+	$yourname = $request['yourname'];
370
+	$youremail = $request['youremail'];
371
+	$frnd_subject = $request['frnd_subject'];
372
+	$frnd_comments = $request['frnd_comments'];
373
+	$pid = $request['pid'];
374
+	$to_email = $request['to_email'];
375
+	$to_name = $request['to_name'];
376
+	if ($request['pid']) {
377
+		$productinfosql = $wpdb->prepare(
378
+			"select ID,post_title from $wpdb->posts where ID =%d",
379
+			array($request['pid'])
380
+		);
381
+		$productinfo = $wpdb->get_results($productinfosql);
382
+		foreach ($productinfo as $productinfoObj) {
383
+			$post_title = $productinfoObj->post_title;
384
+		}
385
+	}
386 386
 
387
-    /**
388
-     * Called before the send to friend email is sent.
389
-     *
390
-     * @since 1.0.0
391
-     * @param array $request {
392
-     *    The submitted form fields as an array.
393
-     *
394
-     *    @type string $sendact Enquiry type. Default "email_frnd".
395
-     *    @type string $pid Post ID.
396
-     *    @type string $to_name Friend name.
397
-     *    @type string $to_email Friend email.
398
-     *    @type string $yourname Sender name.
399
-     *    @type string $youremail Sender email.
400
-     *    @type string $frnd_subject Email subject.
401
-     *    @type string $frnd_comments Email Message.
402
-     *
403
-     * }
404
-     */
405
-    do_action('geodir_before_send_to_friend_email', $request);
406
-    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
407
-
408
-    /**
409
-     * Called after the send to friend email is sent.
410
-     *
411
-     * @since 1.0.0
412
-     * @param array $request {
413
-     *    The submitted form fields as an array.
414
-     *
415
-     *    @type string $sendact Enquiry type. Default "email_frnd".
416
-     *    @type string $pid Post ID.
417
-     *    @type string $to_name Friend name.
418
-     *    @type string $to_email Friend email.
419
-     *    @type string $yourname Sender name.
420
-     *    @type string $youremail Sender email.
421
-     *    @type string $frnd_subject Email subject.
422
-     *    @type string $frnd_comments Email Message.
423
-     *
424
-     * }
425
-     */
426
-    do_action('geodir_after_send_to_friend_email', $request);
427
-
428
-    $url = get_permalink($pid);
429
-    if (strstr($url, '?')) {
430
-        $url = $url . "&sendtofrnd=success";
431
-    } else {
432
-        $url = $url . "?sendtofrnd=success";
433
-    }
434
-    /**
435
-     * Filter redirect url after the send to friend email is sent.
436
-     *
437
-     * @since 1.0.0
438
-     * @param string $url Redirect url.
439
-     */
440
-    $url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
441
-    wp_redirect($url);
442
-    exit;
387
+	/**
388
+	 * Called before the send to friend email is sent.
389
+	 *
390
+	 * @since 1.0.0
391
+	 * @param array $request {
392
+	 *    The submitted form fields as an array.
393
+	 *
394
+	 *    @type string $sendact Enquiry type. Default "email_frnd".
395
+	 *    @type string $pid Post ID.
396
+	 *    @type string $to_name Friend name.
397
+	 *    @type string $to_email Friend email.
398
+	 *    @type string $yourname Sender name.
399
+	 *    @type string $youremail Sender email.
400
+	 *    @type string $frnd_subject Email subject.
401
+	 *    @type string $frnd_comments Email Message.
402
+	 *
403
+	 * }
404
+	 */
405
+	do_action('geodir_before_send_to_friend_email', $request);
406
+	geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
407
+
408
+	/**
409
+	 * Called after the send to friend email is sent.
410
+	 *
411
+	 * @since 1.0.0
412
+	 * @param array $request {
413
+	 *    The submitted form fields as an array.
414
+	 *
415
+	 *    @type string $sendact Enquiry type. Default "email_frnd".
416
+	 *    @type string $pid Post ID.
417
+	 *    @type string $to_name Friend name.
418
+	 *    @type string $to_email Friend email.
419
+	 *    @type string $yourname Sender name.
420
+	 *    @type string $youremail Sender email.
421
+	 *    @type string $frnd_subject Email subject.
422
+	 *    @type string $frnd_comments Email Message.
423
+	 *
424
+	 * }
425
+	 */
426
+	do_action('geodir_after_send_to_friend_email', $request);
427
+
428
+	$url = get_permalink($pid);
429
+	if (strstr($url, '?')) {
430
+		$url = $url . "&sendtofrnd=success";
431
+	} else {
432
+		$url = $url . "?sendtofrnd=success";
433
+	}
434
+	/**
435
+	 * Filter redirect url after the send to friend email is sent.
436
+	 *
437
+	 * @since 1.0.0
438
+	 * @param string $url Redirect url.
439
+	 */
440
+	$url = apply_filters('geodir_send_to_friend_after_submit_redirect', $url);
441
+	wp_redirect($url);
442
+	exit;
443 443
 }
444 444
 
445 445
 /**
@@ -453,28 +453,28 @@  discard block
 block discarded – undo
453 453
  */
454 454
 function geodir_before_tab_content($hash_key)
455 455
 {
456
-    switch ($hash_key) {
457
-        case 'post_info' :
458
-            echo '<div class="geodir-company_info field-group">';
459
-            break;
460
-        case 'post_images' :
461
-            /**
462
-             * Filter post gallery HTML id.
463
-             *
464
-             * @since 1.0.0
465
-             */
466
-            echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
467
-            break;
468
-        case 'reviews' :
469
-            echo '<div id="reviews-wrap" class="clearfix"> ';
470
-            break;
471
-        case 'post_video':
472
-            echo ' <div id="post_video-wrap" class="clearfix">';
473
-            break;
474
-        case 'special_offers':
475
-            echo '<div id="special_offers-wrap" class="clearfix">';
476
-            break;
477
-    }
456
+	switch ($hash_key) {
457
+		case 'post_info' :
458
+			echo '<div class="geodir-company_info field-group">';
459
+			break;
460
+		case 'post_images' :
461
+			/**
462
+			 * Filter post gallery HTML id.
463
+			 *
464
+			 * @since 1.0.0
465
+			 */
466
+			echo ' <div id="' . apply_filters('geodir_post_gallery_id', 'geodir-post-gallery') . '" class="clearfix" >';
467
+			break;
468
+		case 'reviews' :
469
+			echo '<div id="reviews-wrap" class="clearfix"> ';
470
+			break;
471
+		case 'post_video':
472
+			echo ' <div id="post_video-wrap" class="clearfix">';
473
+			break;
474
+		case 'special_offers':
475
+			echo '<div id="special_offers-wrap" class="clearfix">';
476
+			break;
477
+	}
478 478
 }
479 479
 
480 480
 /**
@@ -488,23 +488,23 @@  discard block
 block discarded – undo
488 488
  */
489 489
 function geodir_after_tab_content($hash_key)
490 490
 {
491
-    switch ($hash_key) {
492
-        case 'post_info' :
493
-            echo '</div>';
494
-            break;
495
-        case 'post_images' :
496
-            echo '</div>';
497
-            break;
498
-        case 'reviews' :
499
-            echo '</div>';
500
-            break;
501
-        case 'post_video':
502
-            echo '</div>';
503
-            break;
504
-        case 'special_offers':
505
-            echo '</div>';
506
-            break;
507
-    }
491
+	switch ($hash_key) {
492
+		case 'post_info' :
493
+			echo '</div>';
494
+			break;
495
+		case 'post_images' :
496
+			echo '</div>';
497
+			break;
498
+		case 'reviews' :
499
+			echo '</div>';
500
+			break;
501
+		case 'post_video':
502
+			echo '</div>';
503
+			break;
504
+		case 'special_offers':
505
+			echo '</div>';
506
+			break;
507
+	}
508 508
 }
509 509
 
510 510
 
@@ -520,21 +520,21 @@  discard block
 block discarded – undo
520 520
 function geodir_get_posts_default_sort($post_type)
521 521
 {
522 522
 
523
-    global $wpdb;
523
+	global $wpdb;
524 524
 
525
-    if ($post_type != '') {
525
+	if ($post_type != '') {
526 526
 
527
-        $all_postypes = geodir_get_posttypes();
527
+		$all_postypes = geodir_get_posttypes();
528 528
 
529
-        if (!in_array($post_type, $all_postypes))
530
-            return false;
529
+		if (!in_array($post_type, $all_postypes))
530
+			return false;
531 531
 
532
-        $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
532
+		$sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 533
 
534
-        if (!empty($sort_field_info))
535
-            return $sort_field_info;
534
+		if (!empty($sort_field_info))
535
+			return $sort_field_info;
536 536
 
537
-    }
537
+	}
538 538
 
539 539
 }
540 540
 
@@ -549,24 +549,24 @@  discard block
 block discarded – undo
549 549
  * @return bool|mixed|void Returns sort results, when the post type is valid. Otherwise returns false.
550 550
  */
551 551
 function geodir_get_sort_options($post_type) {
552
-    global $wpdb;
553
-
554
-    if ($post_type != '') {
555
-        $all_postypes = geodir_get_posttypes();
556
-
557
-        if (!in_array($post_type, $all_postypes))
558
-            return false;
559
-
560
-        $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561
-        /**
562
-         * Filter post sort options.
563
-         *
564
-         * @since 1.0.0
565
-         * @param array $sort_field_info Unfiltered sort field array.
566
-         * @param string $post_type Post type.
567
-         */
568
-        return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
569
-    }
552
+	global $wpdb;
553
+
554
+	if ($post_type != '') {
555
+		$all_postypes = geodir_get_posttypes();
556
+
557
+		if (!in_array($post_type, $all_postypes))
558
+			return false;
559
+
560
+		$sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561
+		/**
562
+		 * Filter post sort options.
563
+		 *
564
+		 * @since 1.0.0
565
+		 * @param array $sort_field_info Unfiltered sort field array.
566
+		 * @param string $post_type Post type.
567
+		 */
568
+		return apply_filters('geodir_get_sort_options', $sort_field_info, $post_type);
569
+	}
570 570
 
571 571
 }
572 572
 
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
  */
581 581
 function geodir_display_sort_options()
582 582
 {
583
-    global $wp_query;
583
+	global $wp_query;
584 584
 	
585 585
 	/**
586 586
 	 * On search pages there should be no sort options, sorting is done by search criteria.
@@ -591,57 +591,57 @@  discard block
 block discarded – undo
591 591
 		return;
592 592
 	}
593 593
 
594
-    $sort_by = '';
594
+	$sort_by = '';
595 595
 
596
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
596
+	if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
597 597
 
598
-    $gd_post_type = geodir_get_current_posttype();
598
+	$gd_post_type = geodir_get_current_posttype();
599 599
 
600
-    $sort_options = geodir_get_sort_options($gd_post_type);
600
+	$sort_options = geodir_get_sort_options($gd_post_type);
601 601
 
602 602
 
603
-    $sort_field_options = '';
603
+	$sort_field_options = '';
604 604
 
605
-    if (!empty($sort_options)) {
606
-        foreach ($sort_options as $sort) {
605
+	if (!empty($sort_options)) {
606
+		foreach ($sort_options as $sort) {
607 607
 			$sort = stripslashes_deep($sort); // strip slashes
608 608
 
609
-            $label = __($sort->site_title, 'geodirectory');
609
+			$label = __($sort->site_title, 'geodirectory');
610 610
 
611
-            if ($sort->field_type == 'random') {
612
-                $key = $sort->field_type;
613
-                ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
615
-            }
611
+			if ($sort->field_type == 'random') {
612
+				$key = $sort->field_type;
613
+				($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
615
+			}
616 616
 
617
-            if ($sort->htmlvar_name == 'comment_count') {
618
-                $sort->htmlvar_name = 'rating_count';
619
-            }
617
+			if ($sort->htmlvar_name == 'comment_count') {
618
+				$sort->htmlvar_name = 'rating_count';
619
+			}
620 620
 
621
-            if ($sort->sort_asc) {
622
-                $key = $sort->htmlvar_name . '_asc';
623
-                $label = $sort->site_title;
624
-                if ($sort->asc_title)
625
-                    $label = $sort->asc_title;
626
-                ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628
-            }
621
+			if ($sort->sort_asc) {
622
+				$key = $sort->htmlvar_name . '_asc';
623
+				$label = $sort->site_title;
624
+				if ($sort->asc_title)
625
+					$label = $sort->asc_title;
626
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628
+			}
629 629
 
630
-            if ($sort->sort_desc) {
631
-                $key = $sort->htmlvar_name . '_desc';
632
-                $label = $sort->site_title;
633
-                if ($sort->desc_title)
634
-                    $label = $sort->desc_title;
635
-                ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637
-            }
630
+			if ($sort->sort_desc) {
631
+				$key = $sort->htmlvar_name . '_desc';
632
+				$label = $sort->site_title;
633
+				if ($sort->desc_title)
634
+					$label = $sort->desc_title;
635
+				($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
+				$sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637
+			}
638 638
 
639
-        }
640
-    }
639
+		}
640
+	}
641 641
 
642
-    if ($sort_field_options != '') {
642
+	if ($sort_field_options != '') {
643 643
 
644
-        ?>
644
+		?>
645 645
 
646 646
         <div class="geodir-tax-sort">
647 647
 
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
                 <option
651 651
                     value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
652 652
 
653
-                echo $sort_field_options;?>
653
+				echo $sort_field_options;?>
654 654
 
655 655
             </select>
656 656
 
657 657
         </div>
658 658
     <?php
659 659
 
660
-    }
660
+	}
661 661
 
662 662
 }
663 663
 
@@ -677,10 +677,10 @@  discard block
 block discarded – undo
677 677
 function geodir_advance_customfields_heading($title, $field_type)
678 678
 {
679 679
 
680
-    if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
681
-        $title = '';
682
-    }
683
-    return $title;
680
+	if (in_array($field_type, array('multiselect', 'textarea', 'taxonomy'))) {
681
+		$title = '';
682
+	}
683
+	return $title;
684 684
 }
685 685
 
686 686
 
@@ -697,69 +697,69 @@  discard block
 block discarded – undo
697 697
  * @return string Returns related posts html.
698 698
  */
699 699
 function geodir_related_posts_display($request) {
700
-    if (!empty($request)) {
701
-        $before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
702
-        $after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
703
-
704
-        $title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
705
-        $post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
706
-        $relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
707
-        $layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
708
-        $add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
709
-        $listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
710
-        $list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
711
-        $character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
712
-
713
-        global $wpdb, $post, $gd_session;
714
-        $origi_post = $post;
715
-        $post_type = '';
716
-        $post_id = '';
717
-        $category_taxonomy = '';
718
-        $tax_field = 'id';
719
-        $category = array();
720
-
721
-        if (isset($_REQUEST['backandedit'])) {
722
-            $post = (object)$gd_session->get('listing');
723
-            $post_type = $post->listing_type;
724
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
725
-                $post_id = $_REQUEST['pid'];
726
-        } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
727
-            $post = geodir_get_post_info($_REQUEST['pid']);
728
-            $post_type = $post->post_type;
729
-            $post_id = $_REQUEST['pid'];
730
-        } elseif (isset($post->post_type) && $post->post_type != '') {
731
-            $post_type = $post->post_type;
732
-            $post_id = $post->ID;
733
-        }
700
+	if (!empty($request)) {
701
+		$before_title = (isset($request['before_title']) && !empty($request['before_title'])) ? $request['before_title'] : '';
702
+		$after_title = (isset($request['after_title']) && !empty($request['after_title'])) ? $request['after_title'] : '';
703
+
704
+		$title = (isset($request['title']) && !empty($request['title'])) ? $request['title'] : __('Related Listings', 'geodirectory');
705
+		$post_number = (isset($request['post_number']) && !empty($request['post_number'])) ? $request['post_number'] : '5';
706
+		$relate_to = (isset($request['relate_to']) && !empty($request['relate_to'])) ? $request['relate_to'] : 'category';
707
+		$layout = (isset($request['layout']) && !empty($request['layout'])) ? $request['layout'] : 'gridview_onehalf';
708
+		$add_location_filter = (isset($request['add_location_filter']) && !empty($request['add_location_filter'])) ? $request['add_location_filter'] : '0';
709
+		$listing_width = (isset($request['listing_width']) && !empty($request['listing_width'])) ? $request['listing_width'] : '';
710
+		$list_sort = (isset($request['list_sort']) && !empty($request['list_sort'])) ? $request['list_sort'] : 'latest';
711
+		$character_count = (isset($request['character_count']) && !empty($request['character_count'])) ? $request['character_count'] : '';
712
+
713
+		global $wpdb, $post, $gd_session;
714
+		$origi_post = $post;
715
+		$post_type = '';
716
+		$post_id = '';
717
+		$category_taxonomy = '';
718
+		$tax_field = 'id';
719
+		$category = array();
720
+
721
+		if (isset($_REQUEST['backandedit'])) {
722
+			$post = (object)$gd_session->get('listing');
723
+			$post_type = $post->listing_type;
724
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
725
+				$post_id = $_REQUEST['pid'];
726
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
727
+			$post = geodir_get_post_info($_REQUEST['pid']);
728
+			$post_type = $post->post_type;
729
+			$post_id = $_REQUEST['pid'];
730
+		} elseif (isset($post->post_type) && $post->post_type != '') {
731
+			$post_type = $post->post_type;
732
+			$post_id = $post->ID;
733
+		}
734 734
 
735
-        if ($relate_to == 'category') {
735
+		if ($relate_to == 'category') {
736 736
 
737
-            $category_taxonomy = $post_type . $relate_to;
738
-            if (isset($post->$category_taxonomy) && $post->$category_taxonomy != '')
739
-                $category = explode(',', trim($post->$category_taxonomy, ','));
737
+			$category_taxonomy = $post_type . $relate_to;
738
+			if (isset($post->$category_taxonomy) && $post->$category_taxonomy != '')
739
+				$category = explode(',', trim($post->$category_taxonomy, ','));
740 740
 
741
-        } elseif ($relate_to == 'tags') {
741
+		} elseif ($relate_to == 'tags') {
742 742
 
743
-            $category_taxonomy = $post_type . '_' . $relate_to;
744
-            if ($post->post_tags != '')
745
-                $category = explode(',', trim($post->post_tags, ','));
746
-            $tax_field = 'name';
747
-        }
743
+			$category_taxonomy = $post_type . '_' . $relate_to;
744
+			if ($post->post_tags != '')
745
+				$category = explode(',', trim($post->post_tags, ','));
746
+			$tax_field = 'name';
747
+		}
748 748
 
749
-        /* --- return false in invalid request --- */
750
-        if (empty($category))
751
-            return false;
749
+		/* --- return false in invalid request --- */
750
+		if (empty($category))
751
+			return false;
752 752
 
753
-        $all_postypes = geodir_get_posttypes();
753
+		$all_postypes = geodir_get_posttypes();
754 754
 
755
-        if (!in_array($post_type, $all_postypes))
756
-            return false;
755
+		if (!in_array($post_type, $all_postypes))
756
+			return false;
757 757
 
758
-        /* --- return false in invalid request --- */
758
+		/* --- return false in invalid request --- */
759 759
 
760
-       $location_url = '';
761
-        if ($add_location_filter != '0') {
762
-            $location_url = array();
760
+	   $location_url = '';
761
+		if ($add_location_filter != '0') {
762
+			$location_url = array();
763 763
 			$geodir_show_location_url = get_option('geodir_show_location_url');
764 764
 			
765 765
 			$gd_city = get_query_var('gd_city');
@@ -767,13 +767,13 @@  discard block
 block discarded – undo
767 767
 			if ($gd_city) {
768 768
 				$gd_country = get_query_var('gd_country');
769 769
 				$gd_region = get_query_var('gd_region');
770
-            } else {
771
-                $location = geodir_get_default_location();
770
+			} else {
771
+				$location = geodir_get_default_location();
772 772
 				
773 773
 				$gd_country = isset($location->country_slug) ? $location->country_slug : '';
774 774
 				$gd_region = isset($location->region_slug) ? $location->region_slug : '';
775 775
 				$gd_city = isset($location->city_slug) ? $location->city_slug : '';
776
-            }
776
+			}
777 777
 			
778 778
 			if ($geodir_show_location_url == 'all') {
779 779
 				$location_url[] = $gd_country;
@@ -786,92 +786,92 @@  discard block
 block discarded – undo
786 786
 			
787 787
 			$location_url[] = $gd_city;
788 788
 
789
-            $location_url = implode('/', $location_url);
790
-        }
789
+			$location_url = implode('/', $location_url);
790
+		}
791 791
 
792 792
 
793
-        if (!empty($category)) {
794
-            global $geodir_add_location_url;
795
-            $geodir_add_location_url = '0';
796
-            if ($add_location_filter != '0') {
797
-                $geodir_add_location_url = '1';
798
-            }
799
-            $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
800
-            $geodir_add_location_url = NULL;
801
-        }
802
-        ob_start();
803
-        ?>
793
+		if (!empty($category)) {
794
+			global $geodir_add_location_url;
795
+			$geodir_add_location_url = '0';
796
+			if ($add_location_filter != '0') {
797
+				$geodir_add_location_url = '1';
798
+			}
799
+			$viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
800
+			$geodir_add_location_url = NULL;
801
+		}
802
+		ob_start();
803
+		?>
804 804
 
805 805
 
806 806
         <div class="geodir_locations geodir_location_listing">
807 807
 
808 808
             <?php
809
-            if (isset($request['is_widget']) && $request['is_widget'] == '1') {
810
-                /** geodir_before_title filter Documented in geodirectory_widgets.php */
811
-                $before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
812
-                /** geodir_after_title filter Documented in geodirectory_widgets.php */
813
-                $after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
814
-                ?>
809
+			if (isset($request['is_widget']) && $request['is_widget'] == '1') {
810
+				/** geodir_before_title filter Documented in geodirectory_widgets.php */
811
+				$before_title = isset($before_title) ? $before_title : apply_filters('geodir_before_title', '<h3 class="widget-title">');
812
+				/** geodir_after_title filter Documented in geodirectory_widgets.php */
813
+				$after_title = isset($after_title) ? $after_title : apply_filters('geodir_after_title', '</h3>');
814
+				?>
815 815
                 <div class="location_list_heading clearfix">
816 816
                     <?php echo $before_title . $title . $after_title; ?>
817 817
                 </div>
818 818
             <?php
819
-            }
820
-            $query_args = array(
821
-                'posts_per_page' => $post_number,
822
-                'is_geodir_loop' => true,
823
-                'gd_location' => ($add_location_filter) ? true : false,
824
-                'post_type' => $post_type,
825
-                'order_by' => $list_sort,
826
-                'post__not_in' => array($post_id),
827
-                'excerpt_length' => $character_count,
828
-            );
819
+			}
820
+			$query_args = array(
821
+				'posts_per_page' => $post_number,
822
+				'is_geodir_loop' => true,
823
+				'gd_location' => ($add_location_filter) ? true : false,
824
+				'post_type' => $post_type,
825
+				'order_by' => $list_sort,
826
+				'post__not_in' => array($post_id),
827
+				'excerpt_length' => $character_count,
828
+			);
829 829
 
830
-            $tax_query = array('taxonomy' => $category_taxonomy,
831
-                'field' => $tax_field,
832
-                'terms' => $category
833
-            );
830
+			$tax_query = array('taxonomy' => $category_taxonomy,
831
+				'field' => $tax_field,
832
+				'terms' => $category
833
+			);
834 834
 
835
-            $query_args['tax_query'] = array($tax_query);
835
+			$query_args['tax_query'] = array($tax_query);
836 836
 
837 837
 
838
-            global $gridview_columns, $post;
838
+			global $gridview_columns, $post;
839 839
 
840 840
 
841
-            query_posts($query_args);
841
+			query_posts($query_args);
842 842
 
843
-            if (strstr($layout, 'gridview')) {
844
-                $listing_view_exp = explode('_', $layout);
845
-                $gridview_columns = $layout;
846
-                $layout = $listing_view_exp[0];
847
-            } else if ($layout == 'list') {
848
-                $gridview_columns = '';
849
-            }
850
-            $related_posts = true;
851
-
852
-            /**
853
-             * Filters related listing listview template.
854
-             *
855
-             * @since 1.0.0
856
-             */
857
-            $template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
858
-
859
-            /**
860
-             * Includes related listing listview template.
861
-             *
862
-             * @since 1.0.0
863
-             */
864
-            include($template);
865
-
866
-            wp_reset_query();
867
-            $post = $origi_post;
868
-            ?>
843
+			if (strstr($layout, 'gridview')) {
844
+				$listing_view_exp = explode('_', $layout);
845
+				$gridview_columns = $layout;
846
+				$layout = $listing_view_exp[0];
847
+			} else if ($layout == 'list') {
848
+				$gridview_columns = '';
849
+			}
850
+			$related_posts = true;
851
+
852
+			/**
853
+			 * Filters related listing listview template.
854
+			 *
855
+			 * @since 1.0.0
856
+			 */
857
+			$template = apply_filters("geodir_template_part-related-listing-listview", geodir_locate_template('listing-listview'));
858
+
859
+			/**
860
+			 * Includes related listing listview template.
861
+			 *
862
+			 * @since 1.0.0
863
+			 */
864
+			include($template);
865
+
866
+			wp_reset_query();
867
+			$post = $origi_post;
868
+			?>
869 869
 
870 870
         </div>
871 871
         <?php
872
-        return $html = ob_get_clean();
872
+		return $html = ob_get_clean();
873 873
 
874
-    }
874
+	}
875 875
 
876 876
 }
877 877
 
@@ -887,17 +887,17 @@  discard block
 block discarded – undo
887 887
  */
888 888
 function geodir_category_count_script()
889 889
 {
890
-    global $geodir_post_category_str;
890
+	global $geodir_post_category_str;
891 891
 
892
-    if (!empty($geodir_post_category_str)) {
893
-        $geodir_post_category_str = serialize($geodir_post_category_str);
894
-    }
892
+	if (!empty($geodir_post_category_str)) {
893
+		$geodir_post_category_str = serialize($geodir_post_category_str);
894
+	}
895 895
 
896
-    $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
897
-    $script = "var post_category_array = " . json_encode($all_var) . ';';
898
-    echo '<script>';
899
-    echo $script;
900
-    echo '</script>';
896
+	$all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
897
+	$script = "var post_category_array = " . json_encode($all_var) . ';';
898
+	echo '<script>';
899
+	echo $script;
900
+	echo '</script>';
901 901
 
902 902
 }
903 903
 
@@ -910,16 +910,16 @@  discard block
 block discarded – undo
910 910
  */
911 911
 function geodir_get_map_default_language()
912 912
 {
913
-    $geodir_default_map_language = get_option('geodir_default_map_language');
914
-    if (empty($geodir_default_map_language))
915
-        $geodir_default_map_language = 'en';
916
-    /**
917
-     * Filter default map language.
918
-     *
919
-     * @since 1.0.0
920
-     * @param string $geodir_default_map_language Default map language.
921
-     */
922
-    return apply_filters('geodir_default_map_language', $geodir_default_map_language);
913
+	$geodir_default_map_language = get_option('geodir_default_map_language');
914
+	if (empty($geodir_default_map_language))
915
+		$geodir_default_map_language = 'en';
916
+	/**
917
+	 * Filter default map language.
918
+	 *
919
+	 * @since 1.0.0
920
+	 * @param string $geodir_default_map_language Default map language.
921
+	 */
922
+	return apply_filters('geodir_default_map_language', $geodir_default_map_language);
923 923
 }
924 924
 
925 925
 
@@ -936,12 +936,12 @@  discard block
 block discarded – undo
936 936
  */
937 937
 function geodir_add_meta_keywords()
938 938
 {
939
-    global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
939
+	global $wp, $post, $wp_query, $wpdb, $geodir_addon_list;
940 940
 
941
-    $is_geodir_page = geodir_is_geodir_page();
942
-    if (!$is_geodir_page) {
943
-        return;
944
-    }// if non GD page, bail
941
+	$is_geodir_page = geodir_is_geodir_page();
942
+	if (!$is_geodir_page) {
943
+		return;
944
+	}// if non GD page, bail
945 945
 
946 946
 	$use_gd_meta = true;
947 947
 	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
@@ -956,182 +956,182 @@  discard block
 block discarded – undo
956 956
 		return;
957 957
 	}// bail if Yoast Wordpress SEO or All_in_One_SEO_Pack active.
958 958
 
959
-    $current_term = $wp_query->get_queried_object();
959
+	$current_term = $wp_query->get_queried_object();
960 960
 
961
-    $all_postypes = geodir_get_posttypes();
961
+	$all_postypes = geodir_get_posttypes();
962 962
 
963
-    $geodir_taxonomies = geodir_get_taxonomies('', true);
963
+	$geodir_taxonomies = geodir_get_taxonomies('', true);
964 964
 
965
-    $meta_desc = '';
966
-    $meta_key = '';
967
-    if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
968
-        /**
969
-         * Filter SEO meta location description.
970
-         *
971
-         * @since 1.0.0
972
-         */
973
-        $meta_desc = apply_filters('geodir_seo_meta_location_description', '');
974
-        $meta_desc .= '';
975
-    }
976
-    if (have_posts() && is_single() OR is_page()) {
977
-        while (have_posts()) {
978
-            the_post();
979
-
980
-            if (has_excerpt()) {
981
-                $out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
982
-                if (empty($out_excerpt)) {
983
-                    $out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
984
-                }
985
-                $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
986
-            } else {
987
-                $out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
988
-                $out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
989
-                if (empty($out_excerpt)) {
990
-                    $out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
991
-                }
992
-                $out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
993
-            }
965
+	$meta_desc = '';
966
+	$meta_key = '';
967
+	if (isset($current_term->ID) && $current_term->ID == geodir_location_page_id()) {
968
+		/**
969
+		 * Filter SEO meta location description.
970
+		 *
971
+		 * @since 1.0.0
972
+		 */
973
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', '');
974
+		$meta_desc .= '';
975
+	}
976
+	if (have_posts() && is_single() OR is_page()) {
977
+		while (have_posts()) {
978
+			the_post();
979
+
980
+			if (has_excerpt()) {
981
+				$out_excerpt = strip_tags(strip_shortcodes(get_the_excerpt()));
982
+				if (empty($out_excerpt)) {
983
+					$out_excerpt = strip_tags(do_shortcode(get_the_excerpt()));
984
+				}
985
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $out_excerpt);
986
+			} else {
987
+				$out_excerpt = str_replace(array("\r\n", "\r", "\n"), "", $post->post_content);
988
+				$out_excerpt = strip_tags(strip_shortcodes($out_excerpt));
989
+				if (empty($out_excerpt)) {
990
+					$out_excerpt = strip_tags(do_shortcode($out_excerpt)); // parse short code from content
991
+				}
992
+				$out_excerpt = trim(wp_trim_words($out_excerpt, 35, ''), '.!?,;:-');
993
+			}
994 994
 
995
-            $meta_desc .= $out_excerpt;
996
-        }
997
-    } elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
998
-        if (is_category()) {
999
-            $meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1000
-        } elseif (is_tag()) {
1001
-            $meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1002
-        }
1003
-    } elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1004
-        $meta_desc .= isset($current_term->description) ? $current_term->description : '';
1005
-    }
995
+			$meta_desc .= $out_excerpt;
996
+		}
997
+	} elseif ((is_category() || is_tag()) && isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
998
+		if (is_category()) {
999
+			$meta_desc .= __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE));
1000
+		} elseif (is_tag()) {
1001
+			$meta_desc .= __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE));
1002
+		}
1003
+	} elseif (isset($current_term->taxonomy) && in_array($current_term->taxonomy, $geodir_taxonomies)) {
1004
+		$meta_desc .= isset($current_term->description) ? $current_term->description : '';
1005
+	}
1006 1006
 
1007 1007
 
1008
-    $geodir_post_type = geodir_get_current_posttype();
1009
-    $geodir_post_type_info = get_post_type_object($geodir_post_type);
1010
-    $geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1011
-
1012
-    $category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1013
-    $tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true);
1014
-
1015
-    $geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1016
-    $geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1017
-
1018
-    $geodir_is_search = geodir_is_page('search') ? true : false;
1019
-    $geodir_is_location = geodir_is_page('location') ? true : false;
1020
-    $geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1021
-    $godir_location_terms = geodir_get_current_location_terms('query_vars');
1022
-    $gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL;
1023
-    $gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL;
1024
-    $gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL;
1025
-    $replace_location = __('Everywhere', 'geodirectory');
1026
-    $location_id = NULL;
1027
-    if ($geodir_location_manager) {
1028
-        $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1029
-        $location_id = (int)$wpdb->get_var($sql);
1030
-        $location_type = geodir_what_is_current_location();
1031
-        if ($location_type == 'city') {
1032
-            $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1033
-        } elseif ($location_type == 'region') {
1034
-            $replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1035
-        } elseif ($location_type == 'country') {
1036
-            $replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1037
-            $replace_location = __($replace_location, 'geodirectory');
1038
-        }
1039
-        $country = get_query_var('gd_country');
1040
-        $region = get_query_var('gd_region');
1041
-        $city = get_query_var('gd_city');
1042
-        $current_location = '';
1043
-        if ($country != '') {
1044
-            $current_location = get_actual_location_name('country', $country, true);
1045
-        }
1046
-        if ($region != '') {
1047
-            $current_location = get_actual_location_name('region', $region);
1048
-        }
1049
-        if ($city != '') {
1050
-            $current_location = get_actual_location_name('city', $city);
1051
-        }
1052
-        $replace_location = $current_location != '' ? $current_location : $replace_location;
1053
-    }
1008
+	$geodir_post_type = geodir_get_current_posttype();
1009
+	$geodir_post_type_info = get_post_type_object($geodir_post_type);
1010
+	$geodir_is_page_listing = geodir_is_page('listing') ? true : false;
1011
+
1012
+	$category_taxonomy = geodir_get_taxonomies($geodir_post_type);
1013
+	$tag_taxonomy = geodir_get_taxonomies($geodir_post_type, true);
1014
+
1015
+	$geodir_is_category = isset($category_taxonomy[0]) && get_query_var($category_taxonomy[0]) ? get_query_var($category_taxonomy[0]) : false;
1016
+	$geodir_is_tag = isset($tag_taxonomy[0]) && get_query_var($tag_taxonomy[0]) ? true : false;
1017
+
1018
+	$geodir_is_search = geodir_is_page('search') ? true : false;
1019
+	$geodir_is_location = geodir_is_page('location') ? true : false;
1020
+	$geodir_location_manager = isset($geodir_addon_list['geodir_location_manager']) && $geodir_addon_list['geodir_location_manager'] = 'yes' ? true : false;
1021
+	$godir_location_terms = geodir_get_current_location_terms('query_vars');
1022
+	$gd_city = $geodir_location_manager && isset($godir_location_terms['gd_city']) ? $godir_location_terms['gd_city'] : NULL;
1023
+	$gd_region = $geodir_location_manager && isset($godir_location_terms['gd_region']) ? $godir_location_terms['gd_region'] : NULL;
1024
+	$gd_country = $geodir_location_manager && isset($godir_location_terms['gd_country']) ? $godir_location_terms['gd_country'] : NULL;
1025
+	$replace_location = __('Everywhere', 'geodirectory');
1026
+	$location_id = NULL;
1027
+	if ($geodir_location_manager) {
1028
+		$sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1029
+		$location_id = (int)$wpdb->get_var($sql);
1030
+		$location_type = geodir_what_is_current_location();
1031
+		if ($location_type == 'city') {
1032
+			$replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
1033
+		} elseif ($location_type == 'region') {
1034
+			$replace_location = geodir_get_current_location(array('what' => 'region', 'echo' => false));
1035
+		} elseif ($location_type == 'country') {
1036
+			$replace_location = geodir_get_current_location(array('what' => 'country', 'echo' => false));
1037
+			$replace_location = __($replace_location, 'geodirectory');
1038
+		}
1039
+		$country = get_query_var('gd_country');
1040
+		$region = get_query_var('gd_region');
1041
+		$city = get_query_var('gd_city');
1042
+		$current_location = '';
1043
+		if ($country != '') {
1044
+			$current_location = get_actual_location_name('country', $country, true);
1045
+		}
1046
+		if ($region != '') {
1047
+			$current_location = get_actual_location_name('region', $region);
1048
+		}
1049
+		if ($city != '') {
1050
+			$current_location = get_actual_location_name('city', $city);
1051
+		}
1052
+		$replace_location = $current_location != '' ? $current_location : $replace_location;
1053
+	}
1054 1054
 
1055
-    $geodir_meta_keys = '';
1056
-    $geodir_meta_desc = '';
1057
-    if ($is_geodir_page && !empty($geodir_post_type_info)) {
1058
-        if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1059
-            $geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1060
-
1061
-            $geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1062
-            $geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1063
-
1064
-            if ($geodir_is_category) {
1065
-                $category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
1066
-                if (isset($category->term_id) && !empty($category->term_id)) {
1067
-                    $category_id = $category->term_id;
1068
-                    $category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1069
-                    if ($location_id) {
1070
-                        $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1071
-                        $cat_loc_option = get_option($option_name);
1072
-
1073
-                        $gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1074
-                        if (!$gd_cat_loc_default) {
1075
-                            $option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1076
-                            $option = get_option($option_name);
1077
-                            $category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1078
-                        }
1079
-                    }
1080
-                    $geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1081
-                }
1082
-            } else if ($geodir_is_tag) {
1083
-                $geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1084
-            }
1085
-        }
1086
-    }
1055
+	$geodir_meta_keys = '';
1056
+	$geodir_meta_desc = '';
1057
+	if ($is_geodir_page && !empty($geodir_post_type_info)) {
1058
+		if ($geodir_is_page_listing || $geodir_is_search || geodir_is_page('add-listing')) {
1059
+			$geodir_meta_keys = isset($geodir_post_type_info->seo['meta_keyword']) && $geodir_post_type_info->seo['meta_keyword'] != '' ? $geodir_post_type_info->seo['meta_keyword'] : $geodir_meta_keys;
1060
+
1061
+			$geodir_meta_desc = isset($geodir_post_type_info->description) ? $geodir_post_type_info->description : $geodir_meta_desc;
1062
+			$geodir_meta_desc = isset($geodir_post_type_info->seo['meta_description']) && $geodir_post_type_info->seo['meta_description'] != '' ? $geodir_post_type_info->seo['meta_description'] : $geodir_meta_desc;
1063
+
1064
+			if ($geodir_is_category) {
1065
+				$category = $geodir_is_category ? get_term_by('slug', $geodir_is_category, $category_taxonomy[0]) : NULL;
1066
+				if (isset($category->term_id) && !empty($category->term_id)) {
1067
+					$category_id = $category->term_id;
1068
+					$category_desc = trim($category->description) != '' ? trim($category->description) : get_tax_meta($category_id, 'ct_cat_top_desc', false, $geodir_post_type);
1069
+					if ($location_id) {
1070
+						$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id;
1071
+						$cat_loc_option = get_option($option_name);
1072
+
1073
+						$gd_cat_loc_default = !empty($cat_loc_option) && isset($cat_loc_option['gd_cat_loc_default']) && $cat_loc_option['gd_cat_loc_default'] > 0 ? true : false;
1074
+						if (!$gd_cat_loc_default) {
1075
+							$option_name = 'geodir_cat_loc_' . $geodir_post_type . '_' . $category_id . '_' . $location_id;
1076
+							$option = get_option($option_name);
1077
+							$category_desc = isset($option['gd_cat_loc_desc']) && trim($option['gd_cat_loc_desc']) != '' ? trim($option['gd_cat_loc_desc']) : $category_desc;
1078
+						}
1079
+					}
1080
+					$geodir_meta_desc = __("Posts related to Category:", 'geodirectory') . " " . ucfirst(single_cat_title("", FALSE)) . '. ' . $category_desc;
1081
+				}
1082
+			} else if ($geodir_is_tag) {
1083
+				$geodir_meta_desc = __("Posts related to Tag:", 'geodirectory') . " " . ucfirst(single_tag_title("", FALSE)) . '. ' . $geodir_meta_desc;
1084
+			}
1085
+		}
1086
+	}
1087 1087
 
1088 1088
 
1089
-    $gd_page = '';
1090
-    if(geodir_is_page('home')){
1091
-        $gd_page = 'home';
1092
-        $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1093
-    }
1094
-    elseif(geodir_is_page('detail')){
1095
-        $gd_page = 'detail';
1096
-        $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1097
-    }
1098
-    elseif(geodir_is_page('pt')){
1099
-        $gd_page = 'pt';
1100
-        $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1101
-    }
1102
-    elseif(geodir_is_page('listing')){
1103
-        $gd_page = 'listing';
1104
-        $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1105
-    }
1106
-    elseif(geodir_is_page('location')){
1107
-        $gd_page = 'location';
1108
-        $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1109
-        $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1089
+	$gd_page = '';
1090
+	if(geodir_is_page('home')){
1091
+		$gd_page = 'home';
1092
+		$meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1093
+	}
1094
+	elseif(geodir_is_page('detail')){
1095
+		$gd_page = 'detail';
1096
+		$meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1097
+	}
1098
+	elseif(geodir_is_page('pt')){
1099
+		$gd_page = 'pt';
1100
+		$meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1101
+	}
1102
+	elseif(geodir_is_page('listing')){
1103
+		$gd_page = 'listing';
1104
+		$meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1105
+	}
1106
+	elseif(geodir_is_page('location')){
1107
+		$gd_page = 'location';
1108
+		$meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1109
+		$meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1110 1110
 
1111
-    }
1112
-    elseif(geodir_is_page('search')){
1113
-        $gd_page = 'search';
1114
-        $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1115
-    }
1116
-    elseif(geodir_is_page('add-listing')){
1117
-        $gd_page = 'add-listing';
1118
-        $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1119
-    }
1120
-    elseif(geodir_is_page('author')){
1121
-        $gd_page = 'author';
1122
-        $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1123
-    }
1124
-    elseif(geodir_is_page('login')){
1125
-        $gd_page = 'login';
1126
-        $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1127
-    }
1128
-    elseif(geodir_is_page('listing-success')){
1129
-        $gd_page = 'listing-success';
1130
-        $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1131
-    }
1111
+	}
1112
+	elseif(geodir_is_page('search')){
1113
+		$gd_page = 'search';
1114
+		$meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1115
+	}
1116
+	elseif(geodir_is_page('add-listing')){
1117
+		$gd_page = 'add-listing';
1118
+		$meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1119
+	}
1120
+	elseif(geodir_is_page('author')){
1121
+		$gd_page = 'author';
1122
+		$meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1123
+	}
1124
+	elseif(geodir_is_page('login')){
1125
+		$gd_page = 'login';
1126
+		$meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1127
+	}
1128
+	elseif(geodir_is_page('listing-success')){
1129
+		$gd_page = 'listing-success';
1130
+		$meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1131
+	}
1132 1132
 
1133 1133
 
1134
-    /*
1134
+	/*
1135 1135
     $geodir_meta_desc = $geodir_meta_desc != '' ? $geodir_meta_desc : $meta_desc;
1136 1136
     if ($geodir_meta_desc != '') {
1137 1137
         $geodir_meta_desc = strip_tags($geodir_meta_desc);
@@ -1144,74 +1144,74 @@  discard block
 block discarded – undo
1144 1144
     */
1145 1145
 
1146 1146
 
1147
-    if ($meta_desc) {
1148
-        $meta_desc = stripslashes_deep($meta_desc);
1149
-        /**
1150
-         * Filter page description to replace variables.
1151
-         *
1152
-         * @since 1.5.4
1153
-         * @param string $title The page description including variables.
1154
-         * @param string $gd_page The GeoDirectory page type if any.
1155
-         */
1156
-        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1157
-
1158
-        /**
1159
-         * Filter SEO meta description.
1160
-         *
1161
-         * @since 1.0.0
1162
-         * @param string $meta_desc Meta description content.
1163
-         */
1164
-        echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1165
-    }
1147
+	if ($meta_desc) {
1148
+		$meta_desc = stripslashes_deep($meta_desc);
1149
+		/**
1150
+		 * Filter page description to replace variables.
1151
+		 *
1152
+		 * @since 1.5.4
1153
+		 * @param string $title The page description including variables.
1154
+		 * @param string $gd_page The GeoDirectory page type if any.
1155
+		 */
1156
+		$meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1157
+
1158
+		/**
1159
+		 * Filter SEO meta description.
1160
+		 *
1161
+		 * @since 1.0.0
1162
+		 * @param string $meta_desc Meta description content.
1163
+		 */
1164
+		echo apply_filters('geodir_seo_meta_description', '<meta name="description" content="' . $meta_desc . '" />', $meta_desc);
1165
+	}
1166 1166
 
1167
-    // meta keywords
1168
-    if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1169
-        $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1170
-        $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1171
-
1172
-        $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1173
-    } else {
1174
-        $posttags = get_the_tags();
1175
-        if ($posttags) {
1176
-            foreach ($posttags as $tag) {
1177
-                $meta_key .= $tag->name . ' ';
1178
-            }
1179
-        } else {
1180
-            $tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1181
-            $xt = 1;
1167
+	// meta keywords
1168
+	if (isset($post->post_type) && in_array($post->post_type, $all_postypes)) {
1169
+		$place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1170
+		$place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1171
+
1172
+		$meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1173
+	} else {
1174
+		$posttags = get_the_tags();
1175
+		if ($posttags) {
1176
+			foreach ($posttags as $tag) {
1177
+				$meta_key .= $tag->name . ' ';
1178
+			}
1179
+		} else {
1180
+			$tags = get_tags(array('orderby' => 'count', 'order' => 'DESC'));
1181
+			$xt = 1;
1182 1182
 
1183
-            foreach ($tags as $tag) {
1184
-                if ($xt <= 20) {
1185
-                    $meta_key .= $tag->name . ", ";
1186
-                }
1183
+			foreach ($tags as $tag) {
1184
+				if ($xt <= 20) {
1185
+					$meta_key .= $tag->name . ", ";
1186
+				}
1187 1187
 
1188
-                $xt++;
1189
-            }
1190
-        }
1191
-    }
1188
+				$xt++;
1189
+			}
1190
+		}
1191
+	}
1192 1192
 
1193
-    $meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1194
-    $geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1195
-    if ($geodir_meta_keys != '') {
1196
-        $geodir_meta_keys = strip_tags($geodir_meta_keys);
1197
-        $geodir_meta_keys = esc_html($geodir_meta_keys);
1198
-        $geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1199
-        $geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1200
-        $geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1193
+	$meta_key = $meta_key != '' ? rtrim(trim($meta_key), ",") : $meta_key;
1194
+	$geodir_meta_keys = $geodir_meta_keys != '' ? ($meta_key != '' ? $meta_key . ', ' . $geodir_meta_keys : $geodir_meta_keys) : $meta_key;
1195
+	if ($geodir_meta_keys != '') {
1196
+		$geodir_meta_keys = strip_tags($geodir_meta_keys);
1197
+		$geodir_meta_keys = esc_html($geodir_meta_keys);
1198
+		$geodir_meta_keys = geodir_strtolower($geodir_meta_keys);
1199
+		$geodir_meta_keys = wp_html_excerpt($geodir_meta_keys, 1000, '');
1200
+		$geodir_meta_keys = str_replace('%location%', $replace_location, $geodir_meta_keys);
1201 1201
 
1202
-        $meta_key = rtrim(trim($geodir_meta_keys), ",");
1203
-    }
1202
+		$meta_key = rtrim(trim($geodir_meta_keys), ",");
1203
+	}
1204 1204
 
1205
-    if ($meta_key) {
1206
-        $meta_key = stripslashes_deep($meta_key);
1207
-        /**
1208
-         * Filter SEO meta keywords.
1209
-         *
1210
-         * @since 1.0.0
1211
-         * @param string $meta_desc Meta keywords.
1212
-         */
1213
-        echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1214
-    }
1205
+	if ($meta_key) {
1206
+		$meta_key = stripslashes_deep($meta_key);
1207
+		/**
1208
+		 * Filter SEO meta keywords.
1209
+		 *
1210
+		 * @since 1.0.0
1211
+		 * @param string $meta_desc Meta keywords.
1212
+		 */
1213
+		echo apply_filters('geodir_seo_meta_keywords', '<meta name="keywords" content="' . $meta_key . '" />', $meta_key);
1214
+	}
1215 1215
 
1216 1216
 }
1217 1217
 
@@ -1226,14 +1226,14 @@  discard block
 block discarded – undo
1226 1226
  */
1227 1227
 function geodir_detail_page_tabs_key_value_array()
1228 1228
 {
1229
-    $geodir_detail_page_tabs_key_value_array = array();
1229
+	$geodir_detail_page_tabs_key_value_array = array();
1230 1230
 
1231
-    $geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1231
+	$geodir_detail_page_tabs_array = geodir_detail_page_tabs_array();
1232 1232
 
1233
-    foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1234
-        $geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1235
-    }
1236
-    return $geodir_detail_page_tabs_key_value_array;
1233
+	foreach ($geodir_detail_page_tabs_array as $key => $tabs_obj) {
1234
+		$geodir_detail_page_tabs_key_value_array[$key] = $tabs_obj['heading_text'];
1235
+	}
1236
+	return $geodir_detail_page_tabs_key_value_array;
1237 1237
 }
1238 1238
 
1239 1239
 /**
@@ -1246,73 +1246,73 @@  discard block
 block discarded – undo
1246 1246
 function geodir_detail_page_tabs_array()
1247 1247
 {
1248 1248
 
1249
-    $arr_tabs = array();
1250
-    /**
1251
-     * Filter detail page tab display.
1252
-     *
1253
-     * @since 1.0.0
1254
-     */
1255
-    $arr_tabs['post_profile'] = array(
1256
-        'heading_text' => __('Profile', 'geodirectory'),
1257
-        'is_active_tab' => true,
1258
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1259
-        'tab_content' => ''
1260
-    );
1261
-    $arr_tabs['post_info'] = array(
1262
-        'heading_text' => __('More Info', 'geodirectory'),
1263
-        'is_active_tab' => false,
1264
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1265
-        'tab_content' => ''
1266
-    );
1267
-
1268
-    $arr_tabs['post_images'] = array(
1269
-        'heading_text' => __('Photo', 'geodirectory'),
1270
-        'is_active_tab' => false,
1271
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1272
-        'tab_content' => ''
1273
-    );
1274
-
1275
-    $arr_tabs['post_video'] = array(
1276
-        'heading_text' => __('Video', 'geodirectory'),
1277
-        'is_active_tab' => false,
1278
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1279
-        'tab_content' => ''
1280
-    );
1281
-
1282
-    $arr_tabs['special_offers'] = array(
1283
-        'heading_text' => __('Special Offers', 'geodirectory'),
1284
-        'is_active_tab' => false,
1285
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1286
-        'tab_content' => ''
1287
-    );
1288
-
1289
-    $arr_tabs['post_map'] = array(
1290
-        'heading_text' => __('Map', 'geodirectory'),
1291
-        'is_active_tab' => false,
1292
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1293
-        'tab_content' => ''
1294
-    );
1295
-
1296
-    $arr_tabs['reviews'] = array(
1297
-        'heading_text' => __('Reviews', 'geodirectory'),
1298
-        'is_active_tab' => false,
1299
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1300
-        'tab_content' => 'review display'
1301
-    );
1302
-
1303
-    $arr_tabs['related_listing'] = array(
1304
-        'heading_text' => __('Related Listing', 'geodirectory'),
1305
-        'is_active_tab' => false,
1306
-        'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1307
-        'tab_content' => ''
1308
-    );
1309
-
1310
-    /**
1311
-     * Filter the tabs array.
1312
-     *
1313
-     * @since 1.0.0
1314
-     */
1315
-    return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1249
+	$arr_tabs = array();
1250
+	/**
1251
+	 * Filter detail page tab display.
1252
+	 *
1253
+	 * @since 1.0.0
1254
+	 */
1255
+	$arr_tabs['post_profile'] = array(
1256
+		'heading_text' => __('Profile', 'geodirectory'),
1257
+		'is_active_tab' => true,
1258
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_profile'),
1259
+		'tab_content' => ''
1260
+	);
1261
+	$arr_tabs['post_info'] = array(
1262
+		'heading_text' => __('More Info', 'geodirectory'),
1263
+		'is_active_tab' => false,
1264
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_info'),
1265
+		'tab_content' => ''
1266
+	);
1267
+
1268
+	$arr_tabs['post_images'] = array(
1269
+		'heading_text' => __('Photo', 'geodirectory'),
1270
+		'is_active_tab' => false,
1271
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_images'),
1272
+		'tab_content' => ''
1273
+	);
1274
+
1275
+	$arr_tabs['post_video'] = array(
1276
+		'heading_text' => __('Video', 'geodirectory'),
1277
+		'is_active_tab' => false,
1278
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_video'),
1279
+		'tab_content' => ''
1280
+	);
1281
+
1282
+	$arr_tabs['special_offers'] = array(
1283
+		'heading_text' => __('Special Offers', 'geodirectory'),
1284
+		'is_active_tab' => false,
1285
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'special_offers'),
1286
+		'tab_content' => ''
1287
+	);
1288
+
1289
+	$arr_tabs['post_map'] = array(
1290
+		'heading_text' => __('Map', 'geodirectory'),
1291
+		'is_active_tab' => false,
1292
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'post_map'),
1293
+		'tab_content' => ''
1294
+	);
1295
+
1296
+	$arr_tabs['reviews'] = array(
1297
+		'heading_text' => __('Reviews', 'geodirectory'),
1298
+		'is_active_tab' => false,
1299
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'reviews'),
1300
+		'tab_content' => 'review display'
1301
+	);
1302
+
1303
+	$arr_tabs['related_listing'] = array(
1304
+		'heading_text' => __('Related Listing', 'geodirectory'),
1305
+		'is_active_tab' => false,
1306
+		'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'related_listing'),
1307
+		'tab_content' => ''
1308
+	);
1309
+
1310
+	/**
1311
+	 * Filter the tabs array.
1312
+	 *
1313
+	 * @since 1.0.0
1314
+	 */
1315
+	return apply_filters('geodir_detail_page_tab_list_extend', $arr_tabs);
1316 1316
 
1317 1317
 
1318 1318
 }
@@ -1329,15 +1329,15 @@  discard block
 block discarded – undo
1329 1329
 {
1330 1330
 
1331 1331
 
1332
-    $tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1333
-    $tabs_array = geodir_detail_page_tabs_array();
1334
-    if (!empty($tabs_excluded)) {
1335
-        foreach ($tabs_excluded as $tab) {
1336
-            if (array_key_exists($tab, $tabs_array))
1337
-                unset($tabs_array[$tab]);
1338
-        }
1339
-    }
1340
-    return $tabs_array;
1332
+	$tabs_excluded = get_option('geodir_detail_page_tabs_excluded');
1333
+	$tabs_array = geodir_detail_page_tabs_array();
1334
+	if (!empty($tabs_excluded)) {
1335
+		foreach ($tabs_excluded as $tab) {
1336
+			if (array_key_exists($tab, $tabs_array))
1337
+				unset($tabs_array[$tab]);
1338
+		}
1339
+	}
1340
+	return $tabs_array;
1341 1341
 
1342 1342
 }
1343 1343
 
@@ -1357,132 +1357,132 @@  discard block
 block discarded – undo
1357 1357
 function geodir_show_detail_page_tabs()
1358 1358
 {
1359 1359
 
1360
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1360
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1361 1361
 
1362
-    $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1363
-    $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1364
-    $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
1362
+	$post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1363
+	$request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1364
+	$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
1365 1365
 
1366
-    if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1367
-        $post = geodir_get_post_info($request_post_id);
1368
-        setup_postdata($post);
1369
-    }
1366
+	if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
1367
+		$post = geodir_get_post_info($request_post_id);
1368
+		setup_postdata($post);
1369
+	}
1370 1370
 
1371
-    $geodir_post_detail_fields = geodir_show_listing_info('detail');
1371
+	$geodir_post_detail_fields = geodir_show_listing_info('detail');
1372 1372
 
1373
-    if (geodir_is_page('detail')) {
1373
+	if (geodir_is_page('detail')) {
1374 1374
 
1375
-        $video = geodir_get_video($post->ID);
1376
-        $special_offers = geodir_get_special_offers($post->ID);
1377
-        $related_listing_array = array();
1378
-        if (get_option('geodir_add_related_listing_posttypes'))
1379
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1375
+		$video = geodir_get_video($post->ID);
1376
+		$special_offers = geodir_get_special_offers($post->ID);
1377
+		$related_listing_array = array();
1378
+		if (get_option('geodir_add_related_listing_posttypes'))
1379
+			$related_listing_array = get_option('geodir_add_related_listing_posttypes');
1380 1380
 
1381
-        $related_listing = '';
1382
-        if (in_array($post->post_type, $related_listing_array)) {
1383
-            $request = array('post_number' => get_option('geodir_related_post_count'),
1384
-                'relate_to' => get_option('geodir_related_post_relate_to'),
1385
-                'layout' => get_option('geodir_related_post_listing_view'),
1386
-                'add_location_filter' => get_option('geodir_related_post_location_filter'),
1387
-                'list_sort' => get_option('geodir_related_post_sortby'),
1388
-                'character_count' => get_option('geodir_related_post_excerpt'));
1381
+		$related_listing = '';
1382
+		if (in_array($post->post_type, $related_listing_array)) {
1383
+			$request = array('post_number' => get_option('geodir_related_post_count'),
1384
+				'relate_to' => get_option('geodir_related_post_relate_to'),
1385
+				'layout' => get_option('geodir_related_post_listing_view'),
1386
+				'add_location_filter' => get_option('geodir_related_post_location_filter'),
1387
+				'list_sort' => get_option('geodir_related_post_sortby'),
1388
+				'character_count' => get_option('geodir_related_post_excerpt'));
1389 1389
 
1390
-            $related_listing = geodir_related_posts_display($request);
1391
-        }
1390
+			$related_listing = geodir_related_posts_display($request);
1391
+		}
1392 1392
 
1393
-        $post_images = geodir_get_images($post->ID, 'thumbnail');
1394
-        $thumb_image = '';
1395
-        if (!empty($post_images)) {
1396
-            foreach ($post_images as $image) {
1397
-                $caption = (!empty($image->caption)) ? $image->caption : '';
1398
-                $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1399
-                $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1400
-                $thumb_image .= '</a>';
1401
-            }
1402
-        }
1393
+		$post_images = geodir_get_images($post->ID, 'thumbnail');
1394
+		$thumb_image = '';
1395
+		if (!empty($post_images)) {
1396
+			foreach ($post_images as $image) {
1397
+				$caption = (!empty($image->caption)) ? $image->caption : '';
1398
+				$thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1399
+				$thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1400
+				$thumb_image .= '</a>';
1401
+			}
1402
+		}
1403 1403
 
1404
-        $map_args = array();
1405
-        $map_args['map_canvas_name'] = 'detail_page_map_canvas';
1406
-        $map_args['width'] = '600';
1407
-        $map_args['height'] = '300';
1408
-        if ($post->post_mapzoom) {
1409
-            $map_args['zoom'] = '' . $post->post_mapzoom . '';
1410
-        }
1411
-        $map_args['autozoom'] = false;
1412
-        $map_args['child_collapse'] = '0';
1413
-        $map_args['enable_cat_filters'] = false;
1414
-        $map_args['enable_text_search'] = false;
1415
-        $map_args['enable_post_type_filters'] = false;
1416
-        $map_args['enable_location_filters'] = false;
1417
-        $map_args['enable_jason_on_load'] = true;
1418
-        $map_args['enable_map_direction'] = true;
1419
-        $map_args['map_class_name'] = 'geodir-map-detail-page';
1420
-        $map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1421
-
1422
-
1423
-    } elseif (geodir_is_page('preview')) {
1424
-
1425
-        $video = isset($post->geodir_video) ? $post->geodir_video : '';
1426
-        $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1427
-
1428
-        if (isset($post->post_images))
1429
-            $post->post_images = trim($post->post_images, ",");
1430
-
1431
-        if (isset($post->post_images) && !empty($post->post_images))
1432
-            $post_images = explode(",", $post->post_images);
1433
-
1434
-        $thumb_image = '';
1435
-        if (!empty($post_images)) {
1436
-            foreach ($post_images as $image) {
1437
-                if ($image != '') {
1438
-                    $thumb_image .= '<a href="' . $image . '">';
1439
-                    $thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1440
-                    $thumb_image .= '</a>';
1441
-                }
1442
-            }
1443
-        }
1404
+		$map_args = array();
1405
+		$map_args['map_canvas_name'] = 'detail_page_map_canvas';
1406
+		$map_args['width'] = '600';
1407
+		$map_args['height'] = '300';
1408
+		if ($post->post_mapzoom) {
1409
+			$map_args['zoom'] = '' . $post->post_mapzoom . '';
1410
+		}
1411
+		$map_args['autozoom'] = false;
1412
+		$map_args['child_collapse'] = '0';
1413
+		$map_args['enable_cat_filters'] = false;
1414
+		$map_args['enable_text_search'] = false;
1415
+		$map_args['enable_post_type_filters'] = false;
1416
+		$map_args['enable_location_filters'] = false;
1417
+		$map_args['enable_jason_on_load'] = true;
1418
+		$map_args['enable_map_direction'] = true;
1419
+		$map_args['map_class_name'] = 'geodir-map-detail-page';
1420
+		$map_args['maptype'] = (!empty($post->post_mapview)) ? $post->post_mapview : 'ROADMAP';
1421
+
1422
+
1423
+	} elseif (geodir_is_page('preview')) {
1424
+
1425
+		$video = isset($post->geodir_video) ? $post->geodir_video : '';
1426
+		$special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1427
+
1428
+		if (isset($post->post_images))
1429
+			$post->post_images = trim($post->post_images, ",");
1430
+
1431
+		if (isset($post->post_images) && !empty($post->post_images))
1432
+			$post_images = explode(",", $post->post_images);
1433
+
1434
+		$thumb_image = '';
1435
+		if (!empty($post_images)) {
1436
+			foreach ($post_images as $image) {
1437
+				if ($image != '') {
1438
+					$thumb_image .= '<a href="' . $image . '">';
1439
+					$thumb_image .= geodir_show_image(array('src' => $image), 'thumbnail', true, false);
1440
+					$thumb_image .= '</a>';
1441
+				}
1442
+			}
1443
+		}
1444 1444
 
1445
-        global $map_jason;
1446
-        $map_jason[] = $post->marker_json;
1445
+		global $map_jason;
1446
+		$map_jason[] = $post->marker_json;
1447 1447
 
1448
-        $address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
1449
-        $address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1450
-        $mapview = isset($post->post_mapview) ? $post->post_mapview : '';
1451
-        $mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1452
-        if (!$mapzoom) {
1453
-            $mapzoom = 12;
1454
-        }
1448
+		$address_latitude = isset($post->post_latitude) ? $post->post_latitude : '';
1449
+		$address_longitude = isset($post->post_longitude) ? $post->post_longitude : '';
1450
+		$mapview = isset($post->post_mapview) ? $post->post_mapview : '';
1451
+		$mapzoom = isset($post->post_mapzoom) ? $post->post_mapzoom : '';
1452
+		if (!$mapzoom) {
1453
+			$mapzoom = 12;
1454
+		}
1455 1455
 
1456
-        $map_args = array();
1457
-        $map_args['map_canvas_name'] = 'preview_map_canvas';
1458
-        $map_args['width'] = '950';
1459
-        $map_args['height'] = '300';
1460
-        $map_args['child_collapse'] = '0';
1461
-        $map_args['maptype'] = $mapview;
1462
-        $map_args['autozoom'] = false;
1463
-        $map_args['zoom'] = "$mapzoom";
1464
-        $map_args['latitude'] = $address_latitude;
1465
-        $map_args['longitude'] = $address_longitude;
1466
-        $map_args['enable_cat_filters'] = false;
1467
-        $map_args['enable_text_search'] = false;
1468
-        $map_args['enable_post_type_filters'] = false;
1469
-        $map_args['enable_location_filters'] = false;
1470
-        $map_args['enable_jason_on_load'] = true;
1471
-        $map_args['enable_map_direction'] = true;
1472
-        $map_args['map_class_name'] = 'geodir-map-preview-page';
1456
+		$map_args = array();
1457
+		$map_args['map_canvas_name'] = 'preview_map_canvas';
1458
+		$map_args['width'] = '950';
1459
+		$map_args['height'] = '300';
1460
+		$map_args['child_collapse'] = '0';
1461
+		$map_args['maptype'] = $mapview;
1462
+		$map_args['autozoom'] = false;
1463
+		$map_args['zoom'] = "$mapzoom";
1464
+		$map_args['latitude'] = $address_latitude;
1465
+		$map_args['longitude'] = $address_longitude;
1466
+		$map_args['enable_cat_filters'] = false;
1467
+		$map_args['enable_text_search'] = false;
1468
+		$map_args['enable_post_type_filters'] = false;
1469
+		$map_args['enable_location_filters'] = false;
1470
+		$map_args['enable_jason_on_load'] = true;
1471
+		$map_args['enable_map_direction'] = true;
1472
+		$map_args['map_class_name'] = 'geodir-map-preview-page';
1473 1473
 
1474
-    }
1474
+	}
1475 1475
 
1476 1476
 
1477
-    $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1477
+	$arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1478 1478
 
1479
-    $active_tab_name = '';
1480
-    foreach($arr_detail_page_tabs as $tabs){
1481
-        if(isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && isset($tabs['heading_text']) && $tabs['heading_text']){
1482
-            $active_tab_name = __($tabs['heading_text'],'geodirectory');
1483
-        }
1484
-    }
1485
-    ?>
1479
+	$active_tab_name = '';
1480
+	foreach($arr_detail_page_tabs as $tabs){
1481
+		if(isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && isset($tabs['heading_text']) && $tabs['heading_text']){
1482
+			$active_tab_name = __($tabs['heading_text'],'geodirectory');
1483
+		}
1484
+	}
1485
+	?>
1486 1486
 
1487 1487
     <div class="geodir-tabs" id="gd-tabs" style="position:relative;">
1488 1488
 
@@ -1494,19 +1494,19 @@  discard block
 block discarded – undo
1494 1494
 
1495 1495
         <dl class="geodir-tab-head">
1496 1496
             <?php
1497
-            /**
1498
-             * Called before the details page tab list headings, inside the `dl` tag.
1499
-             *
1500
-             * @since 1.0.0
1501
-             * @see 'geodir_after_tab_list'
1502
-             */
1503
-            do_action('geodir_before_tab_list'); ?>
1497
+			/**
1498
+			 * Called before the details page tab list headings, inside the `dl` tag.
1499
+			 *
1500
+			 * @since 1.0.0
1501
+			 * @see 'geodir_after_tab_list'
1502
+			 */
1503
+			do_action('geodir_before_tab_list'); ?>
1504 1504
             <?php
1505 1505
 
1506 1506
 
1507
-            foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1508
-                if ($detail_page_tab['is_display']) {
1509
-                    ?>
1507
+			foreach ($arr_detail_page_tabs as $tab_index => $detail_page_tab) {
1508
+				if ($detail_page_tab['is_display']) {
1509
+					?>
1510 1510
                     <dt></dt> <!-- added to comply with validation -->
1511 1511
                     <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php }?> >
1512 1512
                         <a data-tab="#<?php echo $tab_index;?>"
@@ -1514,134 +1514,134 @@  discard block
 block discarded – undo
1514 1514
                     </dd>
1515 1515
 
1516 1516
                     <?php
1517
-                    ob_start() // start tab content buffering
1518
-                    ?>
1517
+					ob_start() // start tab content buffering
1518
+					?>
1519 1519
                     <li id="<?php echo $tab_index;?>Tab" <?php if ($tab_index == 'post_profile') {
1520
-                        //echo 'itemprop="description"';
1521
-                    }?>>
1520
+						//echo 'itemprop="description"';
1521
+					}?>>
1522 1522
                         <div id="<?php echo $tab_index;?>" class="hash-offset"></div>
1523 1523
                         <?php
1524
-                        /**
1525
-                         * Called before the details tab content is output per tab.
1526
-                         *
1527
-                         * @since 1.0.0
1528
-                         * @param string $tab_index The tab name ID.
1529
-                         */
1530
-                        do_action('geodir_before_tab_content', $tab_index);
1531
-
1532
-                        /**
1533
-                         * Called before the details tab content is output per tab.
1534
-                         *
1535
-                         * Uses dynamic hook name: geodir_before_$tab_index_tab_content
1536
-                         *
1537
-                         * @since 1.0.0
1538
-                         * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1539
-                         */
1540
-                        do_action('geodir_before_' . $tab_index . '_tab_content');
1541
-                        /// write a code to generate content of each tab
1542
-                        switch ($tab_index) {
1543
-                            case 'post_profile':
1544
-                                /**
1545
-                                 * Called before the listing description content on the details page tab.
1546
-                                 *
1547
-                                 * @since 1.0.0
1548
-                                 */
1549
-                                do_action('geodir_before_description_on_listing_detail');
1550
-                                if (geodir_is_page('detail')) {
1551
-                                    the_content();
1552
-                                } else {
1553
-                                    /** This action is documented in geodirectory_template_actions.php */
1554
-                                    echo apply_filters('the_content', stripslashes($post->post_desc));
1555
-                                }
1556
-
1557
-                                /**
1558
-                                 * Called after the listing description content on the details page tab.
1559
-                                 *
1560
-                                 * @since 1.0.0
1561
-                                 */
1562
-                                do_action('geodir_after_description_on_listing_detail');
1563
-                                break;
1564
-                            case 'post_info':
1565
-                                echo $geodir_post_detail_fields;
1566
-                                break;
1567
-                            case 'post_images':
1568
-                                echo $thumb_image;
1569
-                                break;
1570
-                            case 'post_video':
1571
-                                /** This action is documented in geodirectory_template_actions.php */
1572
-                                echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1573
-                                break;
1574
-                            case 'special_offers':
1575
-                                echo wpautop(stripslashes($special_offers));
1576
-
1577
-                                break;
1578
-                            case 'post_map':
1579
-                                geodir_draw_map($map_args);
1580
-                                break;
1581
-                            case 'reviews':
1582
-                                comments_template();
1583
-                                break;
1584
-                            case 'related_listing':
1585
-                                echo $related_listing;
1586
-                                break;
1587
-                            default: {
1588
-                                if ((isset($post->$tab_index) || (!isset($post->$tab_index) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1589
-                                    echo $detail_page_tab['tab_content'];
1590
-                                }
1591
-                            }
1592
-                                break;
1593
-                        }
1594
-
1595
-                        /**
1596
-                         * Called after the details tab content is output per tab.
1597
-                         *
1598
-                         * @since 1.0.0
1599
-                         */
1600
-                        do_action('geodir_after_tab_content', $tab_index);
1601
-
1602
-                        /**
1603
-                         * Called after the details tab content is output per tab.
1604
-                         *
1605
-                         * Uses dynamic hook name: geodir_after_$tab_index_tab_content
1606
-                         *
1607
-                         * @since 1.0.0
1608
-                         * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1609
-                         */
1610
-                        do_action('geodir_after_' . $tab_index . '_tab_content');
1611
-                        ?> </li>
1524
+						/**
1525
+						 * Called before the details tab content is output per tab.
1526
+						 *
1527
+						 * @since 1.0.0
1528
+						 * @param string $tab_index The tab name ID.
1529
+						 */
1530
+						do_action('geodir_before_tab_content', $tab_index);
1531
+
1532
+						/**
1533
+						 * Called before the details tab content is output per tab.
1534
+						 *
1535
+						 * Uses dynamic hook name: geodir_before_$tab_index_tab_content
1536
+						 *
1537
+						 * @since 1.0.0
1538
+						 * @todo do we need this if we have the hook above? 'geodir_before_tab_content'
1539
+						 */
1540
+						do_action('geodir_before_' . $tab_index . '_tab_content');
1541
+						/// write a code to generate content of each tab
1542
+						switch ($tab_index) {
1543
+							case 'post_profile':
1544
+								/**
1545
+								 * Called before the listing description content on the details page tab.
1546
+								 *
1547
+								 * @since 1.0.0
1548
+								 */
1549
+								do_action('geodir_before_description_on_listing_detail');
1550
+								if (geodir_is_page('detail')) {
1551
+									the_content();
1552
+								} else {
1553
+									/** This action is documented in geodirectory_template_actions.php */
1554
+									echo apply_filters('the_content', stripslashes($post->post_desc));
1555
+								}
1556
+
1557
+								/**
1558
+								 * Called after the listing description content on the details page tab.
1559
+								 *
1560
+								 * @since 1.0.0
1561
+								 */
1562
+								do_action('geodir_after_description_on_listing_detail');
1563
+								break;
1564
+							case 'post_info':
1565
+								echo $geodir_post_detail_fields;
1566
+								break;
1567
+							case 'post_images':
1568
+								echo $thumb_image;
1569
+								break;
1570
+							case 'post_video':
1571
+								/** This action is documented in geodirectory_template_actions.php */
1572
+								echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1573
+								break;
1574
+							case 'special_offers':
1575
+								echo wpautop(stripslashes($special_offers));
1576
+
1577
+								break;
1578
+							case 'post_map':
1579
+								geodir_draw_map($map_args);
1580
+								break;
1581
+							case 'reviews':
1582
+								comments_template();
1583
+								break;
1584
+							case 'related_listing':
1585
+								echo $related_listing;
1586
+								break;
1587
+							default: {
1588
+								if ((isset($post->$tab_index) || (!isset($post->$tab_index) && (strpos($tab_index, 'gd_tab_') !== false || $tab_index == 'link_business'))) && !empty($detail_page_tab['tab_content'])) {
1589
+									echo $detail_page_tab['tab_content'];
1590
+								}
1591
+							}
1592
+								break;
1593
+						}
1594
+
1595
+						/**
1596
+						 * Called after the details tab content is output per tab.
1597
+						 *
1598
+						 * @since 1.0.0
1599
+						 */
1600
+						do_action('geodir_after_tab_content', $tab_index);
1601
+
1602
+						/**
1603
+						 * Called after the details tab content is output per tab.
1604
+						 *
1605
+						 * Uses dynamic hook name: geodir_after_$tab_index_tab_content
1606
+						 *
1607
+						 * @since 1.0.0
1608
+						 * @todo do we need this if we have the hook above? 'geodir_after_tab_content'
1609
+						 */
1610
+						do_action('geodir_after_' . $tab_index . '_tab_content');
1611
+						?> </li>
1612 1612
                     <?php
1613
-                    /**
1614
-                     * Filter the current tab content.
1615
-                     *
1616
-                     * @since 1.0.0
1617
-                     */
1618
-                    $arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1619
-                } // end of if for is_display
1620
-            }// end of foreach
1621
-
1622
-            /**
1623
-             * Called after the details page tab list headings, inside the `dl` tag.
1624
-             *
1625
-             * @since 1.0.0
1626
-             * @see 'geodir_before_tab_list'
1627
-             */
1628
-            do_action('geodir_after_tab_list');
1629
-            ?>
1613
+					/**
1614
+					 * Filter the current tab content.
1615
+					 *
1616
+					 * @since 1.0.0
1617
+					 */
1618
+					$arr_detail_page_tabs[$tab_index]['tab_content'] = apply_filters("geodir_modify_" . $detail_page_tab['tab_content'] . "_tab_content", ob_get_clean());
1619
+				} // end of if for is_display
1620
+			}// end of foreach
1621
+
1622
+			/**
1623
+			 * Called after the details page tab list headings, inside the `dl` tag.
1624
+			 *
1625
+			 * @since 1.0.0
1626
+			 * @see 'geodir_before_tab_list'
1627
+			 */
1628
+			do_action('geodir_after_tab_list');
1629
+			?>
1630 1630
         </dl>
1631 1631
         <ul class="geodir-tabs-content entry-content" style="position:relative;">
1632 1632
             <?php
1633
-            foreach ($arr_detail_page_tabs as $detail_page_tab) {
1634
-                if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1635
-                    echo $detail_page_tab['tab_content'];
1636
-                }// end of if
1637
-            }// end of foreach
1638
-
1639
-            /**
1640
-             * Called after all the tab content is output in `li` tags, called before the closing `ul` tag.
1641
-             *
1642
-             * @since 1.0.0
1643
-             */
1644
-            do_action('geodir_add_tab_content'); ?>
1633
+			foreach ($arr_detail_page_tabs as $detail_page_tab) {
1634
+				if ($detail_page_tab['is_display'] && !empty($detail_page_tab['tab_content'])) {
1635
+					echo $detail_page_tab['tab_content'];
1636
+				}// end of if
1637
+			}// end of foreach
1638
+
1639
+			/**
1640
+			 * Called after all the tab content is output in `li` tags, called before the closing `ul` tag.
1641
+			 *
1642
+			 * @since 1.0.0
1643
+			 */
1644
+			do_action('geodir_add_tab_content'); ?>
1645 1645
         </ul>
1646 1646
         <!--gd-tabs-content ul end-->
1647 1647
     </div>
@@ -1678,119 +1678,119 @@  discard block
 block discarded – undo
1678 1678
  */
1679 1679
 function geodir_exif($file)
1680 1680
 {
1681
-    if (empty($file) || !is_array($file)) {
1682
-        return $file;
1683
-    }
1681
+	if (empty($file) || !is_array($file)) {
1682
+		return $file;
1683
+	}
1684 1684
     
1685
-    $file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1686
-    if (!($file_path && file_exists($file_path))) {
1687
-        return $file;
1688
-    }
1689
-    $file['file'] = $file_path;
1685
+	$file_path = !empty($file['tmp_name']) ? sanitize_text_field($file['tmp_name']) : '';
1686
+	if (!($file_path && file_exists($file_path))) {
1687
+		return $file;
1688
+	}
1689
+	$file['file'] = $file_path;
1690 1690
     
1691
-    if (!file_is_valid_image($file_path)) {
1692
-        return $file; // Bail if file is not an image.
1693
-    }
1691
+	if (!file_is_valid_image($file_path)) {
1692
+		return $file; // Bail if file is not an image.
1693
+	}
1694 1694
     
1695
-    if (!function_exists('wp_get_image_editor') || !function_exists('exif_read_data')) {
1696
-        return $file;
1697
-    }
1695
+	if (!function_exists('wp_get_image_editor') || !function_exists('exif_read_data')) {
1696
+		return $file;
1697
+	}
1698 1698
    
1699
-    $exif = exif_read_data($file_path);
1699
+	$exif = exif_read_data($file_path);
1700 1700
     
1701
-    $rotate = false;
1702
-    $flip = false;
1703
-    $modify = false;
1704
-    if (!empty($exif) && isset($exif['Orientation'])) {
1705
-        switch ((int)$exif['Orientation']) {
1706
-            case 1:
1707
-                // do nothing
1708
-                break;
1709
-            case 2:
1710
-                $flip = array(false, true);
1711
-                $modify = true;
1712
-                break;
1713
-            case 3:
1714
-                $orientation = -180;
1715
-                $rotate = true;
1716
-                $modify = true;
1717
-                break;
1718
-            case 4:
1719
-                $flip = array(true, false);
1720
-                $modify = true;
1721
-                break;
1722
-            case 5:
1723
-                $orientation = -90;
1724
-                $rotate = true;
1725
-                $flip = array(false, true);
1726
-                $modify = true;
1727
-                break;
1728
-            case 6:
1729
-                $orientation = -90;
1730
-                $rotate = true;
1731
-                $modify = true;
1732
-                break;
1733
-            case 7:
1734
-                $orientation = -270;
1735
-                $rotate = true;
1736
-                $flip = array(false, true);
1737
-                $modify = true;
1738
-                break;
1739
-            case 8:
1740
-            case 9:
1741
-                $orientation = -270;
1742
-                $rotate = true;
1743
-                $modify = true;
1744
-                break;
1745
-            default:
1746
-                $orientation = 0;
1747
-                $rotate = true;
1748
-                $modify = true;
1749
-                break;
1750
-        }
1751
-    }
1701
+	$rotate = false;
1702
+	$flip = false;
1703
+	$modify = false;
1704
+	if (!empty($exif) && isset($exif['Orientation'])) {
1705
+		switch ((int)$exif['Orientation']) {
1706
+			case 1:
1707
+				// do nothing
1708
+				break;
1709
+			case 2:
1710
+				$flip = array(false, true);
1711
+				$modify = true;
1712
+				break;
1713
+			case 3:
1714
+				$orientation = -180;
1715
+				$rotate = true;
1716
+				$modify = true;
1717
+				break;
1718
+			case 4:
1719
+				$flip = array(true, false);
1720
+				$modify = true;
1721
+				break;
1722
+			case 5:
1723
+				$orientation = -90;
1724
+				$rotate = true;
1725
+				$flip = array(false, true);
1726
+				$modify = true;
1727
+				break;
1728
+			case 6:
1729
+				$orientation = -90;
1730
+				$rotate = true;
1731
+				$modify = true;
1732
+				break;
1733
+			case 7:
1734
+				$orientation = -270;
1735
+				$rotate = true;
1736
+				$flip = array(false, true);
1737
+				$modify = true;
1738
+				break;
1739
+			case 8:
1740
+			case 9:
1741
+				$orientation = -270;
1742
+				$rotate = true;
1743
+				$modify = true;
1744
+				break;
1745
+			default:
1746
+				$orientation = 0;
1747
+				$rotate = true;
1748
+				$modify = true;
1749
+				break;
1750
+		}
1751
+	}
1752 1752
     
1753
-    $mime_type = $file['type'];
1754
-    $quality = null;
1755
-    /**
1756
-     * Filter the image quality.
1757
-     *
1758
-     * @since 1.5.7
1759
-     * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1760
-     * @param string $quality Image mime type.
1761
-     */
1762
-    $quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1763
-    if ($quality !== null) {
1764
-        $modify = true;
1765
-    }
1753
+	$mime_type = $file['type'];
1754
+	$quality = null;
1755
+	/**
1756
+	 * Filter the image quality.
1757
+	 *
1758
+	 * @since 1.5.7
1759
+	 * @param int|null $quality Image Compression quality between 1-100% scale. Default null.
1760
+	 * @param string $quality Image mime type.
1761
+	 */
1762
+	$quality = apply_filters('geodir_image_upload_set_quality', $quality, $mime_type);
1763
+	if ($quality !== null) {
1764
+		$modify = true;
1765
+	}
1766 1766
 
1767
-    if (!$modify) {
1768
-        return $file; // no change
1769
-    }
1767
+	if (!$modify) {
1768
+		return $file; // no change
1769
+	}
1770 1770
 
1771
-    $image = wp_get_image_editor($file_path);
1772
-    if (!is_wp_error($image)) {
1773
-        if ($rotate) {
1774
-            $image->rotate($orientation);
1775
-        }
1771
+	$image = wp_get_image_editor($file_path);
1772
+	if (!is_wp_error($image)) {
1773
+		if ($rotate) {
1774
+			$image->rotate($orientation);
1775
+		}
1776 1776
         
1777
-        if (!empty($flip)) {
1778
-            $image->flip($flip[0], $flip[1]);
1779
-        }
1777
+		if (!empty($flip)) {
1778
+			$image->flip($flip[0], $flip[1]);
1779
+		}
1780 1780
         
1781
-        if ($quality !== null) {
1782
-            $image->set_quality((int)$quality);
1783
-        }
1781
+		if ($quality !== null) {
1782
+			$image->set_quality((int)$quality);
1783
+		}
1784 1784
         
1785
-       $result = $image->save($file_path);
1786
-       if (!is_wp_error($result)) {
1787
-           $file['file'] = $result['path'];
1788
-           $file['tmp_name'] = $result['path'];
1789
-       }
1790
-    }
1785
+	   $result = $image->save($file_path);
1786
+	   if (!is_wp_error($result)) {
1787
+		   $file['file'] = $result['path'];
1788
+		   $file['tmp_name'] = $result['path'];
1789
+	   }
1790
+	}
1791 1791
     
1792
-    // The image orientation is fixed, pass it back for further processing
1793
-    return $file;
1792
+	// The image orientation is fixed, pass it back for further processing
1793
+	return $file;
1794 1794
 }
1795 1795
 
1796 1796
 /**
@@ -1809,138 +1809,138 @@  discard block
 block discarded – undo
1809 1809
  * @return string Returns the recent reviews html.
1810 1810
  */
1811 1811
 function geodir_get_recent_reviews($g_size = 60, $no_comments = 10, $comment_lenth = 60, $show_pass_post = false) {
1812
-    global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1813
-    $tablecomments = $wpdb->comments;
1814
-    $tableposts = $wpdb->posts;
1815
-
1816
-    $comments_echo = '';
1817
-    $city_filter = '';
1818
-    $region_filter = '';
1819
-    $country_filter = '';
1820
-
1821
-    if ($gd_session->get('gd_multi_location')) {
1822
-        if ($gd_ses_country = $gd_session->get('gd_country')) {
1823
-            $country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1824
-        }
1812
+	global $wpdb, $tablecomments, $tableposts, $rating_table_name, $gd_session;
1813
+	$tablecomments = $wpdb->comments;
1814
+	$tableposts = $wpdb->posts;
1815
+
1816
+	$comments_echo = '';
1817
+	$city_filter = '';
1818
+	$region_filter = '';
1819
+	$country_filter = '';
1820
+
1821
+	if ($gd_session->get('gd_multi_location')) {
1822
+		if ($gd_ses_country = $gd_session->get('gd_country')) {
1823
+			$country_filter = $wpdb->prepare(" AND r.post_country=%s ", str_replace("-", " ", $gd_ses_country));
1824
+		}
1825 1825
 
1826
-        if ($gd_ses_region = $gd_session->get('gd_region')) {
1827
-            $region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1828
-        }
1826
+		if ($gd_ses_region = $gd_session->get('gd_region')) {
1827
+			$region_filter = $wpdb->prepare(" AND r.post_region=%s ", str_replace("-", " ", $gd_ses_region));
1828
+		}
1829 1829
 
1830
-        if ($gd_ses_city = $gd_session->get('gd_city')) {
1831
-            $city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1832
-        }
1833
-    }
1830
+		if ($gd_ses_city = $gd_session->get('gd_city')) {
1831
+			$city_filter = $wpdb->prepare(" AND r.post_city=%s ", str_replace("-", " ", $gd_ses_city));
1832
+		}
1833
+	}
1834 1834
 	
1835
-    $review_table = GEODIR_REVIEW_TABLE;
1836
-    $request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1837
-
1838
-    $comments = $wpdb->get_results($request);
1839
-
1840
-    foreach ($comments as $comment) {
1841
-        // Set the extra comment info needed.
1842
-        $comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1843
-        //echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1844
-        $comment->comment_content = $comment_extra->comment_content;
1845
-        $comment->comment_author = $comment_extra->comment_author;
1846
-        $comment->comment_author_email = $comment_extra->comment_author_email;
1847
-
1848
-        $comment_id = '';
1849
-        $comment_id = $comment->comment_ID;
1850
-        $comment_content = strip_tags($comment->comment_content);
1851
-
1852
-        $comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1853
-
1854
-        $permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1855
-        $comment_author_email = $comment->comment_author_email;
1856
-        $comment_post_ID = $comment->post_id;
1857
-
1858
-        $na = true;
1859
-        if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1860
-            $comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1861
-            if ($comment_post_ID == $comment_post_ID2) {
1862
-            } else {
1863
-                $na = false;
1864
-            }
1865
-        }
1835
+	$review_table = GEODIR_REVIEW_TABLE;
1836
+	$request = "SELECT r.id as ID, r.post_type, r.comment_id as comment_ID, r.post_date as comment_date,r.overall_rating, r.user_id, r.post_id FROM $review_table as r WHERE r.post_status = 1 AND r.status =1 AND r.overall_rating>=1 $country_filter $region_filter $city_filter ORDER BY r.post_date DESC, r.id DESC LIMIT $no_comments";
1837
+
1838
+	$comments = $wpdb->get_results($request);
1839
+
1840
+	foreach ($comments as $comment) {
1841
+		// Set the extra comment info needed.
1842
+		$comment_extra = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID");
1843
+		//echo "SELECT * FROM $wpdb->comments WHERE comment_ID =$comment->comment_ID";
1844
+		$comment->comment_content = $comment_extra->comment_content;
1845
+		$comment->comment_author = $comment_extra->comment_author;
1846
+		$comment->comment_author_email = $comment_extra->comment_author_email;
1847
+
1848
+		$comment_id = '';
1849
+		$comment_id = $comment->comment_ID;
1850
+		$comment_content = strip_tags($comment->comment_content);
1851
+
1852
+		$comment_content = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_content);
1853
+
1854
+		$permalink = get_permalink($comment->ID) . "#comment-" . $comment->comment_ID;
1855
+		$comment_author_email = $comment->comment_author_email;
1856
+		$comment_post_ID = $comment->post_id;
1857
+
1858
+		$na = true;
1859
+		if (function_exists('icl_object_id') && icl_object_id($comment_post_ID, $comment->post_type, true)) {
1860
+			$comment_post_ID2 = icl_object_id($comment_post_ID, $comment->post_type, false);
1861
+			if ($comment_post_ID == $comment_post_ID2) {
1862
+			} else {
1863
+				$na = false;
1864
+			}
1865
+		}
1866 1866
 
1867
-        $post_title = get_the_title($comment_post_ID);
1868
-        $permalink = get_permalink($comment_post_ID);
1869
-        $comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1870
-        $read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1867
+		$post_title = get_the_title($comment_post_ID);
1868
+		$permalink = get_permalink($comment_post_ID);
1869
+		$comment_permalink = $permalink . "#comment-" . $comment->comment_ID;
1870
+		$read_more = '<a class="comment_excerpt" href="' . $comment_permalink . '">' . __('Read more', 'geodirectory') . '</a>';
1871 1871
 
1872
-        $comment_content_length = strlen($comment_content);
1873
-        if ($comment_content_length > $comment_lenth) {
1874
-            $comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1875
-        } else {
1876
-            $comment_excerpt = $comment_content;
1877
-        }
1872
+		$comment_content_length = strlen($comment_content);
1873
+		if ($comment_content_length > $comment_lenth) {
1874
+			$comment_excerpt = mb_substr($comment_content, 0, $comment_lenth) . '... ' . $read_more;
1875
+		} else {
1876
+			$comment_excerpt = $comment_content;
1877
+		}
1878 1878
 
1879
-        if ($comment->user_id) {
1880
-            $user_profile_url = get_author_posts_url($comment->user_id);
1881
-        } else {
1882
-            $user_profile_url = '';
1883
-        }
1879
+		if ($comment->user_id) {
1880
+			$user_profile_url = get_author_posts_url($comment->user_id);
1881
+		} else {
1882
+			$user_profile_url = '';
1883
+		}
1884 1884
 
1885
-        if ($comment_id && $na) {
1886
-            $comments_echo .= '<li class="clearfix">';
1887
-            $comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1888
-            if (function_exists('get_avatar')) {
1889
-                if (!isset($comment->comment_type)) {
1890
-                    if ($user_profile_url) {
1891
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1892
-                    }
1893
-                    $comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1894
-                    if ($user_profile_url) {
1895
-                        $comments_echo .= '</a>';
1896
-                    }
1897
-                } elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1898
-                    if ($user_profile_url) {
1899
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1900
-                    }
1901
-                    $comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1902
-                }
1903
-            } elseif (function_exists('gravatar')) {
1904
-                if ($user_profile_url) {
1905
-                    $comments_echo .= '<a href="' . $user_profile_url . '">';
1906
-                }
1907
-                $comments_echo .= "<img src=\"";
1908
-                if ('' == $comment->comment_type) {
1909
-                    $comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1910
-                    if ($user_profile_url) {
1911
-                        $comments_echo .= '</a>';
1912
-                    }
1913
-                } elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1914
-                    if ($user_profile_url) {
1915
-                        $comments_echo .= '<a href="' . $user_profile_url . '">';
1916
-                    }
1917
-                    $comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1918
-                    if ($user_profile_url) {
1919
-                        $comments_echo .= '</a>';
1920
-                    }
1921
-                }
1922
-                $comments_echo .= "\" alt=\"\" class=\"avatar\" />";
1923
-            }
1885
+		if ($comment_id && $na) {
1886
+			$comments_echo .= '<li class="clearfix">';
1887
+			$comments_echo .= "<span class=\"li" . $comment_id . " geodir_reviewer_image\">";
1888
+			if (function_exists('get_avatar')) {
1889
+				if (!isset($comment->comment_type)) {
1890
+					if ($user_profile_url) {
1891
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1892
+					}
1893
+					$comments_echo .= get_avatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1894
+					if ($user_profile_url) {
1895
+						$comments_echo .= '</a>';
1896
+					}
1897
+				} elseif ((isset($comment->comment_type) && $comment->comment_type == 'trackback') || (isset($comment->comment_type) && $comment->comment_type == 'pingback')) {
1898
+					if ($user_profile_url) {
1899
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1900
+					}
1901
+					$comments_echo .= get_avatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1902
+				}
1903
+			} elseif (function_exists('gravatar')) {
1904
+				if ($user_profile_url) {
1905
+					$comments_echo .= '<a href="' . $user_profile_url . '">';
1906
+				}
1907
+				$comments_echo .= "<img src=\"";
1908
+				if ('' == $comment->comment_type) {
1909
+					$comments_echo .= gravatar($comment->comment_author_email, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1910
+					if ($user_profile_url) {
1911
+						$comments_echo .= '</a>';
1912
+					}
1913
+				} elseif (('trackback' == $comment->comment_type) || ('pingback' == $comment->comment_type)) {
1914
+					if ($user_profile_url) {
1915
+						$comments_echo .= '<a href="' . $user_profile_url . '">';
1916
+					}
1917
+					$comments_echo .= gravatar($comment->comment_author_url, $g_size, geodir_plugin_url() . '/geodirectory-assets/images/gravatar2.png');
1918
+					if ($user_profile_url) {
1919
+						$comments_echo .= '</a>';
1920
+					}
1921
+				}
1922
+				$comments_echo .= "\" alt=\"\" class=\"avatar\" />";
1923
+			}
1924 1924
 
1925
-            $comments_echo .= "</span>\n";
1926
-
1927
-            $comments_echo .= '<span class="geodir_reviewer_content">';
1928
-            if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1929
-            $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1930
-            if($comment->user_id){$comments_echo .= '</a>';}
1931
-            $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1932
-            $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
1933
-            $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
1934
-            $comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
1935
-            //echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
1936
-            $comments_echo .= '</p>';
1937
-
1938
-            $comments_echo .= "</span>\n";
1939
-            $comments_echo .= '</li>';
1940
-        }
1941
-    }
1925
+			$comments_echo .= "</span>\n";
1926
+
1927
+			$comments_echo .= '<span class="geodir_reviewer_content">';
1928
+			if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1929
+			$comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1930
+			if($comment->user_id){$comments_echo .= '</a>';}
1931
+			$comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1932
+			$comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
1933
+			$comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
1934
+			$comments_echo .= '<p class="geodir_reviewer_text">' . $comment_excerpt . '';
1935
+			//echo preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_excerpt);
1936
+			$comments_echo .= '</p>';
1937
+
1938
+			$comments_echo .= "</span>\n";
1939
+			$comments_echo .= '</li>';
1940
+		}
1941
+	}
1942 1942
 
1943
-    return $comments_echo;
1943
+	return $comments_echo;
1944 1944
 }
1945 1945
 
1946 1946
 /**
@@ -1952,29 +1952,29 @@  discard block
 block discarded – undo
1952 1952
  */
1953 1953
 function geodir_home_map_cats_key_value_array()
1954 1954
 {
1955
-    $post_types = geodir_get_posttypes('object');
1955
+	$post_types = geodir_get_posttypes('object');
1956 1956
 
1957
-    $return = array();
1958
-    if (!empty($post_types)) {
1959
-        foreach ($post_types as $key => $post_type) {
1960
-            $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
1961
-            $post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
1962
-            $taxonomies = geodir_get_taxonomies($key);
1963
-            $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
1964
-            $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
1957
+	$return = array();
1958
+	if (!empty($post_types)) {
1959
+		foreach ($post_types as $key => $post_type) {
1960
+			$cpt_name = __($post_type->labels->singular_name, 'geodirectory');
1961
+			$post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
1962
+			$taxonomies = geodir_get_taxonomies($key);
1963
+			$cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
1964
+			$cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
1965 1965
 
1966
-            if (!empty($cat_terms)) {
1967
-                $return['optgroup_start-' . $key] = $post_type_name;
1966
+			if (!empty($cat_terms)) {
1967
+				$return['optgroup_start-' . $key] = $post_type_name;
1968 1968
 
1969
-                foreach ($cat_terms as $cat_term) {
1970
-                    $return[$key . '_' . $cat_term->term_id] = $cat_term->name;
1971
-                }
1969
+				foreach ($cat_terms as $cat_term) {
1970
+					$return[$key . '_' . $cat_term->term_id] = $cat_term->name;
1971
+				}
1972 1972
 
1973
-                $return['optgroup_end-' . $key] = $post_type_name;
1974
-            }
1975
-        }
1976
-    }
1977
-    return $return;
1973
+				$return['optgroup_end-' . $key] = $post_type_name;
1974
+			}
1975
+		}
1976
+	}
1977
+	return $return;
1978 1978
 }
1979 1979
 
1980 1980
 /**
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
  */
1987 1987
 function geodir_twitter_tweet_button()
1988 1988
 {
1989
-    ?>
1989
+	?>
1990 1990
     <a href="http://twitter.com/share"
1991 1991
        class="twitter-share-button"><?php _e('Tweet', 'geodirectory'); ?></a>
1992 1992
     <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
@@ -2004,11 +2004,11 @@  discard block
 block discarded – undo
2004 2004
  */
2005 2005
 function geodir_fb_like_button()
2006 2006
 {
2007
-    global $post;
2008
-    ?>
2007
+	global $post;
2008
+	?>
2009 2009
     <iframe <?php if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
2010
-        echo 'allowtransparency="true"';
2011
-    } ?> class="facebook"
2010
+		echo 'allowtransparency="true"';
2011
+	} ?> class="facebook"
2012 2012
          src="//www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light"
2013 2013
          style="border:none; overflow:hidden; width:100px; height:20px"></iframe>
2014 2014
 <?php
@@ -2024,7 +2024,7 @@  discard block
 block discarded – undo
2024 2024
  */
2025 2025
 function geodir_google_plus_button()
2026 2026
 {
2027
-    ?>
2027
+	?>
2028 2028
     <div id="plusone-div" class="g-plusone" data-size="medium"></div>
2029 2029
     <script type="text/javascript">
2030 2030
         (function () {
@@ -2050,8 +2050,8 @@  discard block
 block discarded – undo
2050 2050
  */
2051 2051
 function geodir_share_this_button_code()
2052 2052
 {
2053
-    global $post;
2054
-    ?>
2053
+	global $post;
2054
+	?>
2055 2055
     <div class="addthis_toolbox addthis_default_style">
2056 2056
         <span id='st_sharethis'></span>
2057 2057
         <script type="text/javascript">var switchTo5x = false;</script>
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 			jQuery(listSel).children('li').switchClass('gridview_onehalf gridview_onethird gridview_onefourth', 'gridview_onefifth', 600);
52 52
 		}
53 53
 
54
-		jQuery.post("<?php echo geodir_get_ajax_url();?>&gd_listing_view=" + val, function (data) {
54
+		jQuery.post("<?php echo geodir_get_ajax_url(); ?>&gd_listing_view=" + val, function (data) {
55 55
 			//alert(data );
56 56
 		});
57 57
 	}
58 58
     </script>
59 59
     <div class="geodir-list-view-select">
60 60
         <select name="gd_list_view" id="gd_list_view" onchange="geodir_list_view_select(this);">
61
-            <?php $listing_view = (int)$gd_session->get('gd_listing_view'); ?>
62
-            <option value=""><?php _e('View:', 'geodirectory');?></option>
63
-            <option value="1" <?php selected(1, $listing_view);?>><?php _e('View: List', 'geodirectory');?></option>
64
-            <option value="2" <?php selected(2, $listing_view);?>><?php _e('View: Grid 2', 'geodirectory');?></option>
65
-            <option value="3" <?php selected(3, $listing_view);?>><?php _e('View: Grid 3', 'geodirectory');?></option>
66
-            <option value="4" <?php selected(4, $listing_view);?>><?php _e('View: Grid 4', 'geodirectory');?></option>
67
-            <option value="5" <?php selected(5, $listing_view);?>><?php _e('View: Grid 5', 'geodirectory');?></option>
61
+            <?php $listing_view = (int) $gd_session->get('gd_listing_view'); ?>
62
+            <option value=""><?php _e('View:', 'geodirectory'); ?></option>
63
+            <option value="1" <?php selected(1, $listing_view); ?>><?php _e('View: List', 'geodirectory'); ?></option>
64
+            <option value="2" <?php selected(2, $listing_view); ?>><?php _e('View: Grid 2', 'geodirectory'); ?></option>
65
+            <option value="3" <?php selected(3, $listing_view); ?>><?php _e('View: Grid 3', 'geodirectory'); ?></option>
66
+            <option value="4" <?php selected(4, $listing_view); ?>><?php _e('View: Grid 4', 'geodirectory'); ?></option>
67
+            <option value="5" <?php selected(5, $listing_view); ?>><?php _e('View: Grid 5', 'geodirectory'); ?></option>
68 68
         </select>
69 69
     </div>
70 70
 <?php
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      * @param object|string $post The post object.
185 185
      * @param string $post_type The post type.
186 186
      */
187
-    return (object)apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
187
+    return (object) apply_filters('geodir_post_package_info', $package_info, $post, $post_type);
188 188
 
189 189
 }
190 190
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         // strip slashes message
299 299
         $client_message = stripslashes_deep($client_message);
300 300
 
301
-        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']);//To client email
301
+        geodir_sendEmail($youremail, $yourname, $to_email, $to_name, '', $client_message, $extra = '', 'send_enquiry', $request['pid']); //To client email
302 302
     }
303 303
 
304 304
     /**
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      * }
404 404
      */
405 405
     do_action('geodir_before_send_to_friend_email', $request);
406
-    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']);//To client email
406
+    geodir_sendEmail($youremail, $yourname, $to_email, $to_name, $frnd_subject, $frnd_comments, $extra = '', 'send_friend', $request['pid']); //To client email
407 407
 
408 408
     /**
409 409
      * Called after the send to friend email is sent.
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 *
588 588
 	 * @since 1.4.4
589 589
 	 */
590
-	if ( is_search() ) {
590
+	if (is_search()) {
591 591
 		return;
592 592
 	}
593 593
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
             if ($sort->field_type == 'random') {
612 612
                 $key = $sort->field_type;
613 613
                 ($sort_by == $key || ($sort->is_default == '1' && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
614
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
614
+                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . __($label, 'geodirectory') . '</option>';
615 615
             }
616 616
 
617 617
             if ($sort->htmlvar_name == 'comment_count') {
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
                 if ($sort->asc_title)
625 625
                     $label = $sort->asc_title;
626 626
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
627
+                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . __($label, 'geodirectory') . '</option>';
628 628
             }
629 629
 
630 630
             if ($sort->sort_desc) {
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
                 if ($sort->desc_title)
634 634
                     $label = $sort->desc_title;
635 635
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636
-                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
636
+                $sort_field_options .= '<option ' . $selected . ' value="' . esc_url(add_query_arg('sort_by', $key)) . '">' . __($label, 'geodirectory') . '</option>';
637 637
             }
638 638
 
639 639
         }
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
649 649
 
650 650
                 <option
651
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
651
+                    value="<?php echo esc_url(add_query_arg('sort_by', '')); ?>" <?php if ($sort_by == '') echo 'selected="selected"'; ?>><?php _e('Sort By', 'geodirectory'); ?></option><?php
652 652
 
653
-                echo $sort_field_options;?>
653
+                echo $sort_field_options; ?>
654 654
 
655 655
             </select>
656 656
 
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
         $category = array();
720 720
 
721 721
         if (isset($_REQUEST['backandedit'])) {
722
-            $post = (object)$gd_session->get('listing');
722
+            $post = (object) $gd_session->get('listing');
723 723
             $post_type = $post->listing_type;
724 724
             if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
725 725
                 $post_id = $_REQUEST['pid'];
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
             if ($add_location_filter != '0') {
797 797
                 $geodir_add_location_url = '1';
798 798
             }
799
-            $viewall_url = get_term_link((int)$category[0], $post_type . $category_taxonomy);
799
+            $viewall_url = get_term_link((int) $category[0], $post_type . $category_taxonomy);
800 800
             $geodir_add_location_url = NULL;
801 801
         }
802 802
         ob_start();
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
         $geodir_post_category_str = serialize($geodir_post_category_str);
894 894
     }
895 895
 
896
-    $all_var['post_category_array'] = html_entity_decode((string)$geodir_post_category_str, ENT_QUOTES, 'UTF-8');
896
+    $all_var['post_category_array'] = html_entity_decode((string) $geodir_post_category_str, ENT_QUOTES, 'UTF-8');
897 897
     $script = "var post_category_array = " . json_encode($all_var) . ';';
898 898
     echo '<script>';
899 899
     echo $script;
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
     $location_id = NULL;
1027 1027
     if ($geodir_location_manager) {
1028 1028
         $sql = $wpdb->prepare("SELECT location_id FROM " . POST_LOCATION_TABLE . " WHERE city_slug=%s ORDER BY location_id ASC LIMIT 1", array($gd_city));
1029
-        $location_id = (int)$wpdb->get_var($sql);
1029
+        $location_id = (int) $wpdb->get_var($sql);
1030 1030
         $location_type = geodir_what_is_current_location();
1031 1031
         if ($location_type == 'city') {
1032 1032
             $replace_location = geodir_get_current_location(array('what' => 'city', 'echo' => false));
@@ -1087,45 +1087,45 @@  discard block
 block discarded – undo
1087 1087
 
1088 1088
 
1089 1089
     $gd_page = '';
1090
-    if(geodir_is_page('home')){
1090
+    if (geodir_is_page('home')) {
1091 1091
         $gd_page = 'home';
1092 1092
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1093 1093
     }
1094
-    elseif(geodir_is_page('detail')){
1094
+    elseif (geodir_is_page('detail')) {
1095 1095
         $gd_page = 'detail';
1096 1096
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1097 1097
     }
1098
-    elseif(geodir_is_page('pt')){
1098
+    elseif (geodir_is_page('pt')) {
1099 1099
         $gd_page = 'pt';
1100 1100
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1101 1101
     }
1102
-    elseif(geodir_is_page('listing')){
1102
+    elseif (geodir_is_page('listing')) {
1103 1103
         $gd_page = 'listing';
1104 1104
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1105 1105
     }
1106
-    elseif(geodir_is_page('location')){
1106
+    elseif (geodir_is_page('location')) {
1107 1107
         $gd_page = 'location';
1108 1108
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1109 1109
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1110 1110
 
1111 1111
     }
1112
-    elseif(geodir_is_page('search')){
1112
+    elseif (geodir_is_page('search')) {
1113 1113
         $gd_page = 'search';
1114 1114
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1115 1115
     }
1116
-    elseif(geodir_is_page('add-listing')){
1116
+    elseif (geodir_is_page('add-listing')) {
1117 1117
         $gd_page = 'add-listing';
1118 1118
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1119 1119
     }
1120
-    elseif(geodir_is_page('author')){
1120
+    elseif (geodir_is_page('author')) {
1121 1121
         $gd_page = 'author';
1122 1122
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1123 1123
     }
1124
-    elseif(geodir_is_page('login')){
1124
+    elseif (geodir_is_page('login')) {
1125 1125
         $gd_page = 'login';
1126 1126
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1127 1127
     }
1128
-    elseif(geodir_is_page('listing-success')){
1128
+    elseif (geodir_is_page('listing-success')) {
1129 1129
         $gd_page = 'listing-success';
1130 1130
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1131 1131
     }
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
          * @param string $title The page description including variables.
1154 1154
          * @param string $gd_page The GeoDirectory page type if any.
1155 1155
          */
1156
-        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'),$gd_page,'');
1156
+        $meta_desc = apply_filters('geodir_seo_meta_description_pre', __($meta_desc, 'geodirectory'), $gd_page, '');
1157 1157
 
1158 1158
         /**
1159 1159
          * Filter SEO meta description.
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
         $place_tags = wp_get_post_terms($post->ID, $post->post_type . '_tags', array("fields" => "names"));
1170 1170
         $place_cats = wp_get_post_terms($post->ID, $post->post_type . 'category', array("fields" => "names"));
1171 1171
 
1172
-        $meta_key .= implode(", ", array_merge((array)$place_cats, (array)$place_tags));
1172
+        $meta_key .= implode(", ", array_merge((array) $place_cats, (array) $place_tags));
1173 1173
     } else {
1174 1174
         $posttags = get_the_tags();
1175 1175
         if ($posttags) {
@@ -1359,8 +1359,8 @@  discard block
 block discarded – undo
1359 1359
 
1360 1360
     global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1361 1361
 
1362
-    $post_id = !empty($post) && isset($post->ID) ? (int)$post->ID : 0;
1363
-    $request_post_id = !empty($_REQUEST['p']) ? (int)$_REQUEST['p'] : 0;
1362
+    $post_id = !empty($post) && isset($post->ID) ? (int) $post->ID : 0;
1363
+    $request_post_id = !empty($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
1364 1364
     $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
1365 1365
 
1366 1366
     if ($is_backend_preview && !$post_id > 0 && $request_post_id > 0) {
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
         if (!empty($post_images)) {
1396 1396
             foreach ($post_images as $image) {
1397 1397
                 $caption = (!empty($image->caption)) ? $image->caption : '';
1398
-                $thumb_image .= '<a href="' . $image->src . '" title="'.$caption.'">';
1398
+                $thumb_image .= '<a href="' . $image->src . '" title="' . $caption . '">';
1399 1399
                 $thumb_image .= geodir_show_image($image, 'thumbnail', true, false);
1400 1400
                 $thumb_image .= '</a>';
1401 1401
             }
@@ -1474,12 +1474,12 @@  discard block
 block discarded – undo
1474 1474
     }
1475 1475
 
1476 1476
 
1477
-    $arr_detail_page_tabs = geodir_detail_page_tabs_list();// get this sooner so we can get the active tab for the user
1477
+    $arr_detail_page_tabs = geodir_detail_page_tabs_list(); // get this sooner so we can get the active tab for the user
1478 1478
 
1479 1479
     $active_tab_name = '';
1480
-    foreach($arr_detail_page_tabs as $tabs){
1481
-        if(isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && isset($tabs['heading_text']) && $tabs['heading_text']){
1482
-            $active_tab_name = __($tabs['heading_text'],'geodirectory');
1480
+    foreach ($arr_detail_page_tabs as $tabs) {
1481
+        if (isset($tabs['is_active_tab']) && $tabs['is_active_tab'] && isset($tabs['heading_text']) && $tabs['heading_text']) {
1482
+            $active_tab_name = __($tabs['heading_text'], 'geodirectory');
1483 1483
         }
1484 1484
     }
1485 1485
     ?>
@@ -1488,7 +1488,7 @@  discard block
 block discarded – undo
1488 1488
 
1489 1489
         <div id="geodir-tab-mobile-menu" >
1490 1490
             <i class="fa fa-bars"></i>
1491
-            <span class="geodir-mobile-active-tab"><?php echo $active_tab_name;?></span>
1491
+            <span class="geodir-mobile-active-tab"><?php echo $active_tab_name; ?></span>
1492 1492
             <i class="fa fa-sort-desc"></i>
1493 1493
         </div>
1494 1494
 
@@ -1508,18 +1508,18 @@  discard block
 block discarded – undo
1508 1508
                 if ($detail_page_tab['is_display']) {
1509 1509
                     ?>
1510 1510
                     <dt></dt> <!-- added to comply with validation -->
1511
-                    <dd <?php if ($detail_page_tab['is_active_tab']){ ?>class="geodir-tab-active"<?php }?> >
1512
-                        <a data-tab="#<?php echo $tab_index;?>"
1513
-                           data-status="enable"><?php _e($detail_page_tab['heading_text'],'geodirectory');?></a>
1511
+                    <dd <?php if ($detail_page_tab['is_active_tab']) { ?>class="geodir-tab-active"<?php }?> >
1512
+                        <a data-tab="#<?php echo $tab_index; ?>"
1513
+                           data-status="enable"><?php _e($detail_page_tab['heading_text'], 'geodirectory'); ?></a>
1514 1514
                     </dd>
1515 1515
 
1516 1516
                     <?php
1517 1517
                     ob_start() // start tab content buffering
1518 1518
                     ?>
1519
-                    <li id="<?php echo $tab_index;?>Tab" <?php if ($tab_index == 'post_profile') {
1519
+                    <li id="<?php echo $tab_index; ?>Tab" <?php if ($tab_index == 'post_profile') {
1520 1520
                         //echo 'itemprop="description"';
1521 1521
                     }?>>
1522
-                        <div id="<?php echo $tab_index;?>" class="hash-offset"></div>
1522
+                        <div id="<?php echo $tab_index; ?>" class="hash-offset"></div>
1523 1523
                         <?php
1524 1524
                         /**
1525 1525
                          * Called before the details tab content is output per tab.
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
                                 break;
1570 1570
                             case 'post_video':
1571 1571
                                 /** This action is documented in geodirectory_template_actions.php */
1572
-                                echo apply_filters('the_content', stripslashes($video));// we apply the_content filter so oembed works also;
1572
+                                echo apply_filters('the_content', stripslashes($video)); // we apply the_content filter so oembed works also;
1573 1573
                                 break;
1574 1574
                             case 'special_offers':
1575 1575
                                 echo wpautop(stripslashes($special_offers));
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
     $flip = false;
1703 1703
     $modify = false;
1704 1704
     if (!empty($exif) && isset($exif['Orientation'])) {
1705
-        switch ((int)$exif['Orientation']) {
1705
+        switch ((int) $exif['Orientation']) {
1706 1706
             case 1:
1707 1707
                 // do nothing
1708 1708
                 break;
@@ -1779,7 +1779,7 @@  discard block
 block discarded – undo
1779 1779
         }
1780 1780
         
1781 1781
         if ($quality !== null) {
1782
-            $image->set_quality((int)$quality);
1782
+            $image->set_quality((int) $quality);
1783 1783
         }
1784 1784
         
1785 1785
        $result = $image->save($file_path);
@@ -1925,9 +1925,9 @@  discard block
 block discarded – undo
1925 1925
             $comments_echo .= "</span>\n";
1926 1926
 
1927 1927
             $comments_echo .= '<span class="geodir_reviewer_content">';
1928
-            if($comment->user_id){$comments_echo .= '<a href="'.get_author_posts_url( $comment->user_id ).'">';}
1928
+            if ($comment->user_id) {$comments_echo .= '<a href="' . get_author_posts_url($comment->user_id) . '">'; }
1929 1929
             $comments_echo .= '<span class="geodir_reviewer_author">' . $comment->comment_author . '</span> ';
1930
-            if($comment->user_id){$comments_echo .= '</a>';}
1930
+            if ($comment->user_id) {$comments_echo .= '</a>'; }
1931 1931
             $comments_echo .= '<span class="geodir_reviewer_reviewed">' . __('reviewed', 'geodirectory') . '</span> ';
1932 1932
             $comments_echo .= '<a href="' . $permalink . '" class="geodir_reviewer_title">' . $post_title . '</a>';
1933 1933
             $comments_echo .= geodir_get_rating_stars($comment->overall_rating, $comment_post_ID);
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
     if (!empty($post_types)) {
1959 1959
         foreach ($post_types as $key => $post_type) {
1960 1960
             $cpt_name = __($post_type->labels->singular_name, 'geodirectory');
1961
-            $post_type_name =   sprintf(__('%s Categories', 'geodirectory'),$cpt_name);
1961
+            $post_type_name = sprintf(__('%s Categories', 'geodirectory'), $cpt_name);
1962 1962
             $taxonomies = geodir_get_taxonomies($key);
1963 1963
             $cat_taxonomy = !empty($taxonomies[0]) ? $taxonomies[0] : NULL;
1964 1964
             $cat_terms = $cat_taxonomy ? get_terms($cat_taxonomy) : NULL;
@@ -2065,10 +2065,10 @@  discard block
 block discarded – undo
2065 2065
             stWidget.addEntry({
2066 2066
                 "service": "sharethis",
2067 2067
                 "element": document.getElementById('st_sharethis'),
2068
-                "url": "<?php echo geodir_curPageURL();?>",
2069
-                "title": "<?php echo $post->post_title;?>",
2068
+                "url": "<?php echo geodir_curPageURL(); ?>",
2069
+                "title": "<?php echo $post->post_title; ?>",
2070 2070
                 "type": "chicklet",
2071
-                "text": "<?php _e( 'Share', 'geodirectory' );?>"
2071
+                "text": "<?php _e('Share', 'geodirectory'); ?>"
2072 2072
             });</script>
2073 2073
 
2074 2074
     </div>
Please login to merge, or discard this patch.
Braces   +61 added lines, -50 removed lines patch added patch discarded remove patch
@@ -526,13 +526,15 @@  discard block
 block discarded – undo
526 526
 
527 527
         $all_postypes = geodir_get_posttypes();
528 528
 
529
-        if (!in_array($post_type, $all_postypes))
530
-            return false;
529
+        if (!in_array($post_type, $all_postypes)) {
530
+                    return false;
531
+        }
531 532
 
532 533
         $sort_field_info = $wpdb->get_var($wpdb->prepare("select default_order from " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " where	post_type= %s and is_active=%d and is_default=%d", array($post_type, 1, 1)));
533 534
 
534
-        if (!empty($sort_field_info))
535
-            return $sort_field_info;
535
+        if (!empty($sort_field_info)) {
536
+                    return $sort_field_info;
537
+        }
536 538
 
537 539
     }
538 540
 
@@ -554,8 +556,9 @@  discard block
 block discarded – undo
554 556
     if ($post_type != '') {
555 557
         $all_postypes = geodir_get_posttypes();
556 558
 
557
-        if (!in_array($post_type, $all_postypes))
558
-            return false;
559
+        if (!in_array($post_type, $all_postypes)) {
560
+                    return false;
561
+        }
559 562
 
560 563
         $sort_field_info = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE . " WHERE post_type=%s AND is_active=%d AND (sort_asc=1 || sort_desc=1 || field_type='random') AND field_type != 'address' ORDER BY sort_order ASC", array($post_type, 1)));
561 564
         /**
@@ -593,7 +596,9 @@  discard block
 block discarded – undo
593 596
 
594 597
     $sort_by = '';
595 598
 
596
-    if (isset($_REQUEST['sort_by'])) $sort_by = $_REQUEST['sort_by'];
599
+    if (isset($_REQUEST['sort_by'])) {
600
+    	$sort_by = $_REQUEST['sort_by'];
601
+    }
597 602
 
598 603
     $gd_post_type = geodir_get_current_posttype();
599 604
 
@@ -621,8 +626,9 @@  discard block
 block discarded – undo
621 626
             if ($sort->sort_asc) {
622 627
                 $key = $sort->htmlvar_name . '_asc';
623 628
                 $label = $sort->site_title;
624
-                if ($sort->asc_title)
625
-                    $label = $sort->asc_title;
629
+                if ($sort->asc_title) {
630
+                                    $label = $sort->asc_title;
631
+                }
626 632
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
627 633
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
628 634
             }
@@ -630,8 +636,9 @@  discard block
 block discarded – undo
630 636
             if ($sort->sort_desc) {
631 637
                 $key = $sort->htmlvar_name . '_desc';
632 638
                 $label = $sort->site_title;
633
-                if ($sort->desc_title)
634
-                    $label = $sort->desc_title;
639
+                if ($sort->desc_title) {
640
+                                    $label = $sort->desc_title;
641
+                }
635 642
                 ($sort_by == $key || ($sort->is_default == '1' && $sort->default_order == $key && !isset($_REQUEST['sort_by']))) ? $selected = 'selected="selected"' : $selected = '';
636 643
                 $sort_field_options .= '<option ' . $selected . ' value="' . esc_url( add_query_arg('sort_by', $key) ) . '">' . __($label, 'geodirectory') . '</option>';
637 644
             }
@@ -648,7 +655,10 @@  discard block
 block discarded – undo
648 655
             <select name="sort_by" id="sort_by" onchange="javascript:window.location=this.value;">
649 656
 
650 657
                 <option
651
-                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') echo 'selected="selected"';?>><?php _e('Sort By', 'geodirectory');?></option><?php
658
+                    value="<?php echo esc_url( add_query_arg('sort_by', '') );?>" <?php if ($sort_by == '') {
659
+	echo 'selected="selected"';
660
+}
661
+?>><?php _e('Sort By', 'geodirectory');?></option><?php
652 662
 
653 663
                 echo $sort_field_options;?>
654 664
 
@@ -721,8 +731,9 @@  discard block
 block discarded – undo
721 731
         if (isset($_REQUEST['backandedit'])) {
722 732
             $post = (object)$gd_session->get('listing');
723 733
             $post_type = $post->listing_type;
724
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '')
725
-                $post_id = $_REQUEST['pid'];
734
+            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
735
+                            $post_id = $_REQUEST['pid'];
736
+            }
726 737
         } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
727 738
             $post = geodir_get_post_info($_REQUEST['pid']);
728 739
             $post_type = $post->post_type;
@@ -735,25 +746,29 @@  discard block
 block discarded – undo
735 746
         if ($relate_to == 'category') {
736 747
 
737 748
             $category_taxonomy = $post_type . $relate_to;
738
-            if (isset($post->$category_taxonomy) && $post->$category_taxonomy != '')
739
-                $category = explode(',', trim($post->$category_taxonomy, ','));
749
+            if (isset($post->$category_taxonomy) && $post->$category_taxonomy != '') {
750
+                            $category = explode(',', trim($post->$category_taxonomy, ','));
751
+            }
740 752
 
741 753
         } elseif ($relate_to == 'tags') {
742 754
 
743 755
             $category_taxonomy = $post_type . '_' . $relate_to;
744
-            if ($post->post_tags != '')
745
-                $category = explode(',', trim($post->post_tags, ','));
756
+            if ($post->post_tags != '') {
757
+                            $category = explode(',', trim($post->post_tags, ','));
758
+            }
746 759
             $tax_field = 'name';
747 760
         }
748 761
 
749 762
         /* --- return false in invalid request --- */
750
-        if (empty($category))
751
-            return false;
763
+        if (empty($category)) {
764
+                    return false;
765
+        }
752 766
 
753 767
         $all_postypes = geodir_get_posttypes();
754 768
 
755
-        if (!in_array($post_type, $all_postypes))
756
-            return false;
769
+        if (!in_array($post_type, $all_postypes)) {
770
+                    return false;
771
+        }
757 772
 
758 773
         /* --- return false in invalid request --- */
759 774
 
@@ -911,8 +926,9 @@  discard block
 block discarded – undo
911 926
 function geodir_get_map_default_language()
912 927
 {
913 928
     $geodir_default_map_language = get_option('geodir_default_map_language');
914
-    if (empty($geodir_default_map_language))
915
-        $geodir_default_map_language = 'en';
929
+    if (empty($geodir_default_map_language)) {
930
+            $geodir_default_map_language = 'en';
931
+    }
916 932
     /**
917 933
      * Filter default map language.
918 934
      *
@@ -1090,42 +1106,33 @@  discard block
 block discarded – undo
1090 1106
     if(geodir_is_page('home')){
1091 1107
         $gd_page = 'home';
1092 1108
         $meta_desc = (get_option('geodir_meta_desc_homepage')) ? get_option('geodir_meta_desc_homepage') : $meta_desc;
1093
-    }
1094
-    elseif(geodir_is_page('detail')){
1109
+    } elseif(geodir_is_page('detail')){
1095 1110
         $gd_page = 'detail';
1096 1111
         $meta_desc = (get_option('geodir_meta_desc_detail')) ? get_option('geodir_meta_desc_detail') : $meta_desc;
1097
-    }
1098
-    elseif(geodir_is_page('pt')){
1112
+    } elseif(geodir_is_page('pt')){
1099 1113
         $gd_page = 'pt';
1100 1114
         $meta_desc = (get_option('geodir_meta_desc_pt')) ? get_option('geodir_meta_desc_pt') : $meta_desc;
1101
-    }
1102
-    elseif(geodir_is_page('listing')){
1115
+    } elseif(geodir_is_page('listing')){
1103 1116
         $gd_page = 'listing';
1104 1117
         $meta_desc = (get_option('geodir_meta_desc_listing')) ? get_option('geodir_meta_desc_listing') : $meta_desc;
1105
-    }
1106
-    elseif(geodir_is_page('location')){
1118
+    } elseif(geodir_is_page('location')){
1107 1119
         $gd_page = 'location';
1108 1120
         $meta_desc = (get_option('geodir_meta_desc_location')) ? get_option('geodir_meta_desc_location') : $meta_desc;
1109 1121
         $meta_desc = apply_filters('geodir_seo_meta_location_description', $meta_desc);
1110 1122
 
1111
-    }
1112
-    elseif(geodir_is_page('search')){
1123
+    } elseif(geodir_is_page('search')){
1113 1124
         $gd_page = 'search';
1114 1125
         $meta_desc = (get_option('geodir_meta_desc_search')) ? get_option('geodir_meta_desc_search') : $meta_desc;
1115
-    }
1116
-    elseif(geodir_is_page('add-listing')){
1126
+    } elseif(geodir_is_page('add-listing')){
1117 1127
         $gd_page = 'add-listing';
1118 1128
         $meta_desc = (get_option('geodir_meta_desc_add-listing')) ? get_option('geodir_meta_desc_add-listing') : $meta_desc;
1119
-    }
1120
-    elseif(geodir_is_page('author')){
1129
+    } elseif(geodir_is_page('author')){
1121 1130
         $gd_page = 'author';
1122 1131
         $meta_desc = (get_option('geodir_meta_desc_author')) ? get_option('geodir_meta_desc_author') : $meta_desc;
1123
-    }
1124
-    elseif(geodir_is_page('login')){
1132
+    } elseif(geodir_is_page('login')){
1125 1133
         $gd_page = 'login';
1126 1134
         $meta_desc = (get_option('geodir_meta_desc_login')) ? get_option('geodir_meta_desc_login') : $meta_desc;
1127
-    }
1128
-    elseif(geodir_is_page('listing-success')){
1135
+    } elseif(geodir_is_page('listing-success')){
1129 1136
         $gd_page = 'listing-success';
1130 1137
         $meta_desc = (get_option('geodir_meta_desc_listing-success')) ? get_option('geodir_meta_desc_listing-success') : $meta_desc;
1131 1138
     }
@@ -1333,8 +1340,9 @@  discard block
 block discarded – undo
1333 1340
     $tabs_array = geodir_detail_page_tabs_array();
1334 1341
     if (!empty($tabs_excluded)) {
1335 1342
         foreach ($tabs_excluded as $tab) {
1336
-            if (array_key_exists($tab, $tabs_array))
1337
-                unset($tabs_array[$tab]);
1343
+            if (array_key_exists($tab, $tabs_array)) {
1344
+                            unset($tabs_array[$tab]);
1345
+            }
1338 1346
         }
1339 1347
     }
1340 1348
     return $tabs_array;
@@ -1375,8 +1383,9 @@  discard block
 block discarded – undo
1375 1383
         $video = geodir_get_video($post->ID);
1376 1384
         $special_offers = geodir_get_special_offers($post->ID);
1377 1385
         $related_listing_array = array();
1378
-        if (get_option('geodir_add_related_listing_posttypes'))
1379
-            $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1386
+        if (get_option('geodir_add_related_listing_posttypes')) {
1387
+                    $related_listing_array = get_option('geodir_add_related_listing_posttypes');
1388
+        }
1380 1389
 
1381 1390
         $related_listing = '';
1382 1391
         if (in_array($post->post_type, $related_listing_array)) {
@@ -1425,11 +1434,13 @@  discard block
 block discarded – undo
1425 1434
         $video = isset($post->geodir_video) ? $post->geodir_video : '';
1426 1435
         $special_offers = isset($post->geodir_special_offers) ? $post->geodir_special_offers : '';
1427 1436
 
1428
-        if (isset($post->post_images))
1429
-            $post->post_images = trim($post->post_images, ",");
1437
+        if (isset($post->post_images)) {
1438
+                    $post->post_images = trim($post->post_images, ",");
1439
+        }
1430 1440
 
1431
-        if (isset($post->post_images) && !empty($post->post_images))
1432
-            $post_images = explode(",", $post->post_images);
1441
+        if (isset($post->post_images) && !empty($post->post_images)) {
1442
+                    $post_images = explode(",", $post->post_images);
1443
+        }
1433 1444
 
1434 1445
         $thumb_image = '';
1435 1446
         if (!empty($post_images)) {
Please login to merge, or discard this patch.
geodirectory_hooks_actions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2203,7 +2203,7 @@
 block discarded – undo
2203 2203
  * @global object $wpdb WordPress Database object.
2204 2204
  * @global string $plugin_prefix Geodirectory plugin table prefix.
2205 2205
  * @param int $attachment_id Attachment ID.
2206
- * @return bool|void Returns false on failure.
2206
+ * @return false|null Returns false on failure.
2207 2207
  */
2208 2208
 function geodirectory_before_featured_image_delete($attachment_id)
2209 2209
 {
Please login to merge, or discard this patch.
Indentation   +1487 added lines, -1487 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_get_ajax_url()
21 21
 {
22
-    return admin_url('admin-ajax.php?action=geodir_ajax_action');
22
+	return admin_url('admin-ajax.php?action=geodir_ajax_action');
23 23
 }
24 24
 
25 25
 /////////////////////
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 add_filter('query_vars', 'geodir_add_geodir_page_var');
88 88
 add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8
89 89
 if (get_option('permalink_structure') != '')
90
-    add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
90
+	add_filter('parse_request', 'geodir_set_location_var_in_session_in_core');
91 91
 
92 92
 add_filter('parse_query', 'geodir_modified_query');
93 93
 
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
 /* POST AND LOOP ACTIONS */
155 155
 ////////////////////////
156 156
 if (!is_admin()) {
157
-    add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
-    add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
-    /** Exclude Virtual Pages From Pages List **/
160
-    add_action('pre_get_posts', 'set_listing_request', 0);
161
-    add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
-    add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
-    add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
-    add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
157
+	add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtural page from everywhere
158
+	add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100);
159
+	/** Exclude Virtual Pages From Pages List **/
160
+	add_action('pre_get_posts', 'set_listing_request', 0);
161
+	add_action('pre_get_posts', 'geodir_listing_loop_filter', 1);
162
+	add_filter('excerpt_more', 'geodir_excerpt_more', 1000);
163
+	add_filter('excerpt_length', 'geodir_excerpt_length', 1000);
164
+	add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter
165 165
 }
166 166
 
167 167
 
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
  */
222 222
 function geodir_unset_prev_theme_nav_location($newname)
223 223
 {
224
-    $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
-    if ($geodir_theme_location) {
226
-        update_option('geodir_theme_location_nav', $geodir_theme_location);
227
-    } else {
228
-        update_option('geodir_theme_location_nav', '');
229
-    }
224
+	$geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname);
225
+	if ($geodir_theme_location) {
226
+		update_option('geodir_theme_location_nav', $geodir_theme_location);
227
+	} else {
228
+		update_option('geodir_theme_location_nav', '');
229
+	}
230 230
 }
231 231
 
232 232
 /// add action for theme switch to blank previous theme navigation location setting
@@ -247,32 +247,32 @@  discard block
 block discarded – undo
247 247
  */
248 248
 function geodir_add_post_filters()
249 249
 {
250
-    /**
251
-     * Contains all function for filtering listing.
252
-     *
253
-     * @since 1.0.0
254
-     * @package GeoDirectory
255
-     */
256
-    include_once('geodirectory-functions/listing_filters.php');
250
+	/**
251
+	 * Contains all function for filtering listing.
252
+	 *
253
+	 * @since 1.0.0
254
+	 * @package GeoDirectory
255
+	 */
256
+	include_once('geodirectory-functions/listing_filters.php');
257 257
 }
258 258
 
259 259
 
260 260
 if (!function_exists('geodir_init_defaults')) {
261
-    /**
262
-     * Calls the function to register the GeoDirectory default CPT and taxonomies.
263
-     *
264
-     * @since 1.0.0
265
-     * @package GeoDirectory
266
-     */
267
-    function geodir_init_defaults()
268
-    {
269
-        if (function_exists('geodir_register_defaults')) {
261
+	/**
262
+	 * Calls the function to register the GeoDirectory default CPT and taxonomies.
263
+	 *
264
+	 * @since 1.0.0
265
+	 * @package GeoDirectory
266
+	 */
267
+	function geodir_init_defaults()
268
+	{
269
+		if (function_exists('geodir_register_defaults')) {
270 270
 
271
-            geodir_register_defaults();
271
+			geodir_register_defaults();
272 272
 
273
-        }
273
+		}
274 274
 
275
-    }
275
+	}
276 276
 }
277 277
 
278 278
 
@@ -294,26 +294,26 @@  discard block
 block discarded – undo
294 294
 // CALLED ON 'sidebars_widgets' FILTER
295 295
 
296 296
 if (!function_exists('geodir_restrict_widget')) {
297
-    /**
298
-     * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
299
-     *
300
-     * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
301
-     * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
302
-     * @since 1.0.0
303
-     * @package GeoDirectory
304
-     */
305
-    function geodir_restrict_widget()
306
-    {
307
-        global $is_listing, $is_single_place;
297
+	/**
298
+	 * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page.
299
+	 *
300
+	 * @global bool $is_listing Sets the global value to true if on a GD category page. False if not.
301
+	 * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not.
302
+	 * @since 1.0.0
303
+	 * @package GeoDirectory
304
+	 */
305
+	function geodir_restrict_widget()
306
+	{
307
+		global $is_listing, $is_single_place;
308 308
 
309
-        // set is listing	
310
-        (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
309
+		// set is listing	
310
+		(geodir_is_page('listing')) ? $is_listing = true : $is_listing = false;
311 311
 
312
-        // set is single place
313
-        (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
312
+		// set is single place
313
+		(geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false;
314 314
 
315 315
 
316
-    }
316
+	}
317 317
 }
318 318
 
319 319
 
@@ -334,32 +334,32 @@  discard block
 block discarded – undo
334 334
  */
335 335
 function geodir_detail_page_sidebar_content_sorting()
336 336
 {
337
-    $arr_detail_page_sidebar_content =
338
-        /**
339
-         * An array of functions to be called to be displayed on the details (post) page sidebar.
340
-         *
341
-         * This filter can be used to remove sections of the details page sidebar,
342
-         * add new sections or rearrange the order of the sections.
343
-         *
344
-         * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
345
-         * @since 1.0.0
346
-         */
347
-        apply_filters('geodir_detail_page_sidebar_content',
348
-            array('geodir_social_sharing_buttons',
349
-                'geodir_share_this_button',
350
-                'geodir_detail_page_google_analytics',
351
-                'geodir_edit_post_link',
352
-                'geodir_detail_page_review_rating',
353
-                'geodir_detail_page_more_info'
354
-            ) // end of array 
355
-        ); // end of apply filter
356
-    if (!empty($arr_detail_page_sidebar_content)) {
357
-        foreach ($arr_detail_page_sidebar_content as $content_function) {
358
-            if (function_exists($content_function)) {
359
-                add_action('geodir_detail_page_sidebar', $content_function);
360
-            }
361
-        }
362
-    }
337
+	$arr_detail_page_sidebar_content =
338
+		/**
339
+		 * An array of functions to be called to be displayed on the details (post) page sidebar.
340
+		 *
341
+		 * This filter can be used to remove sections of the details page sidebar,
342
+		 * add new sections or rearrange the order of the sections.
343
+		 *
344
+		 * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called.
345
+		 * @since 1.0.0
346
+		 */
347
+		apply_filters('geodir_detail_page_sidebar_content',
348
+			array('geodir_social_sharing_buttons',
349
+				'geodir_share_this_button',
350
+				'geodir_detail_page_google_analytics',
351
+				'geodir_edit_post_link',
352
+				'geodir_detail_page_review_rating',
353
+				'geodir_detail_page_more_info'
354
+			) // end of array 
355
+		); // end of apply filter
356
+	if (!empty($arr_detail_page_sidebar_content)) {
357
+		foreach ($arr_detail_page_sidebar_content as $content_function) {
358
+			if (function_exists($content_function)) {
359
+				add_action('geodir_detail_page_sidebar', $content_function);
360
+			}
361
+		}
362
+	}
363 363
 }
364 364
 
365 365
 add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1);
@@ -374,14 +374,14 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function geodir_add_to_favourite_link()
376 376
 {
377
-    global $post, $preview;
378
-    if (!$preview && geodir_is_page('detail')) {
379
-        ?>
377
+	global $post, $preview;
378
+	if (!$preview && geodir_is_page('detail')) {
379
+		?>
380 380
         <p class="edit_link">
381 381
             <?php geodir_favourite_html($post->post_author, $post->ID); ?>
382 382
         </p>
383 383
     <?php
384
-    }
384
+	}
385 385
 }
386 386
 
387 387
 /**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
  */
396 396
 function geodir_social_sharing_buttons()
397 397
 {
398
-    global $preview;
399
-    ob_start(); // Start  buffering;
400
-    /**
401
-     * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
-     *
403
-     * @since 1.0.0
404
-     */
405
-    do_action('geodir_before_social_sharing_buttons');
406
-    if (!$preview) {
407
-        ?>
398
+	global $preview;
399
+	ob_start(); // Start  buffering;
400
+	/**
401
+	 * This action is called before the social buttons twitter,facebook and google plus are output in a containing div.
402
+	 *
403
+	 * @since 1.0.0
404
+	 */
405
+	do_action('geodir_before_social_sharing_buttons');
406
+	if (!$preview) {
407
+		?>
408 408
         <div class="likethis">
409 409
             <?php geodir_twitter_tweet_button(); ?>
410 410
             <?php geodir_fb_like_button(); ?>
411 411
             <?php geodir_google_plus_button(); ?>
412 412
         </div>
413 413
     <?php
414
-    }// end of if, if its a preview or not
415
-
416
-    /**
417
-     * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
-     *
419
-     * @since 1.0.0
420
-     */
421
-    do_action('geodir_after_social_sharing_buttons');
422
-    $content_html = ob_get_clean();
423
-    if (trim($content_html) != '')
424
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
-    if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
-        /**
427
-         * Filter the geodir_social_sharing_buttons() function content.
428
-         *
429
-         * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
-         */
431
-        echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
-    }
414
+	}// end of if, if its a preview or not
415
+
416
+	/**
417
+	 * This action is called after the social buttons twitter,facebook and google plus are output in a containing div.
418
+	 *
419
+	 * @since 1.0.0
420
+	 */
421
+	do_action('geodir_after_social_sharing_buttons');
422
+	$content_html = ob_get_clean();
423
+	if (trim($content_html) != '')
424
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>';
425
+	if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) {
426
+		/**
427
+		 * Filter the geodir_social_sharing_buttons() function content.
428
+		 *
429
+		 * @param string $content_html The output html of the geodir_social_sharing_buttons() function.
430
+		 */
431
+		echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html);
432
+	}
433 433
 
434 434
 
435 435
 }
@@ -445,39 +445,39 @@  discard block
 block discarded – undo
445 445
  */
446 446
 function geodir_share_this_button()
447 447
 {
448
-    global $preview;
449
-    ob_start(); // Start buffering;
450
-    /**
451
-     * This is called before the share this html in the function geodir_share_this_button()
452
-     *
453
-     * @since 1.0.0
454
-     */
455
-    do_action('geodir_before_share_this_button');
456
-    if (!$preview) {
457
-        ?>
448
+	global $preview;
449
+	ob_start(); // Start buffering;
450
+	/**
451
+	 * This is called before the share this html in the function geodir_share_this_button()
452
+	 *
453
+	 * @since 1.0.0
454
+	 */
455
+	do_action('geodir_before_share_this_button');
456
+	if (!$preview) {
457
+		?>
458 458
         <div class="share clearfix">
459 459
             <?php geodir_share_this_button_code(); ?>
460 460
         </div>
461 461
     <?php
462
-    }// end of if, if its a preview or not
463
-    /**
464
-     * This is called after the share this html in the function geodir_share_this_button()
465
-     *
466
-     * @since 1.0.0
467
-     */
468
-    do_action('geodir_after_share_this_button');
469
-    $content_html = ob_get_clean();
470
-    if (trim($content_html) != '')
471
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
-    if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473
-        /**
474
-         * Filter the geodir_share_this_button() function content.
475
-         *
476
-         * @param string $content_html The output html of the geodir_share_this_button() function.
477
-         * @since 1.0.0
478
-         */
479
-        echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
480
-    }
462
+	}// end of if, if its a preview or not
463
+	/**
464
+	 * This is called after the share this html in the function geodir_share_this_button()
465
+	 *
466
+	 * @since 1.0.0
467
+	 */
468
+	do_action('geodir_after_share_this_button');
469
+	$content_html = ob_get_clean();
470
+	if (trim($content_html) != '')
471
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>';
472
+	if ((int)get_option('geodir_disable_sharethis_button_section') != 1) {
473
+		/**
474
+		 * Filter the geodir_share_this_button() function content.
475
+		 *
476
+		 * @param string $content_html The output html of the geodir_share_this_button() function.
477
+		 * @since 1.0.0
478
+		 */
479
+		echo $content_html = apply_filters('geodir_share_this_button_html', $content_html);
480
+	}
481 481
 
482 482
 }
483 483
 
@@ -493,46 +493,46 @@  discard block
 block discarded – undo
493 493
  */
494 494
 function geodir_edit_post_link()
495 495
 {
496
-    global $post, $preview;
497
-    ob_start(); // Start buffering;
498
-    /**
499
-     * This is called before the edit post link html in the function geodir_edit_post_link()
500
-     *
501
-     * @since 1.0.0
502
-     */
503
-    do_action('geodir_before_edit_post_link');
504
-    if (!$preview) {
505
-        $is_current_user_owner = geodir_listing_belong_to_current_user();
496
+	global $post, $preview;
497
+	ob_start(); // Start buffering;
498
+	/**
499
+	 * This is called before the edit post link html in the function geodir_edit_post_link()
500
+	 *
501
+	 * @since 1.0.0
502
+	 */
503
+	do_action('geodir_before_edit_post_link');
504
+	if (!$preview) {
505
+		$is_current_user_owner = geodir_listing_belong_to_current_user();
506 506
         
507
-        if ($is_current_user_owner) {
508
-            $post_id = $post->ID;
507
+		if ($is_current_user_owner) {
508
+			$post_id = $post->ID;
509 509
             
510
-            if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
-                $post_id = (int)$_REQUEST['pid'];
512
-            }
510
+			if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
511
+				$post_id = (int)$_REQUEST['pid'];
512
+			}
513 513
 
514
-            $postlink = get_permalink(geodir_add_listing_page_id());
515
-            $editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
516
-            echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
-        }
518
-    }// end of if, if its a preview or not
519
-    /**
520
-     * This is called after the edit post link html in the function geodir_edit_post_link()
521
-     *
522
-     * @since 1.0.0
523
-     */
524
-    do_action('geodir_after_edit_post_link');
525
-    $content_html = ob_get_clean();
526
-    if (trim($content_html) != '')
527
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
-    if ((int)get_option('geodir_disable_user_links_section') != 1) {
529
-        /**
530
-         * Filter the geodir_edit_post_link() function content.
531
-         *
532
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
533
-         */
534
-        echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
535
-    }
514
+			$postlink = get_permalink(geodir_add_listing_page_id());
515
+			$editlink = geodir_getlink($postlink, array('pid' => $post_id), false);
516
+			echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>';
517
+		}
518
+	}// end of if, if its a preview or not
519
+	/**
520
+	 * This is called after the edit post link html in the function geodir_edit_post_link()
521
+	 *
522
+	 * @since 1.0.0
523
+	 */
524
+	do_action('geodir_after_edit_post_link');
525
+	$content_html = ob_get_clean();
526
+	if (trim($content_html) != '')
527
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>';
528
+	if ((int)get_option('geodir_disable_user_links_section') != 1) {
529
+		/**
530
+		 * Filter the geodir_edit_post_link() function content.
531
+		 *
532
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
533
+		 */
534
+		echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html);
535
+	}
536 536
 }
537 537
 
538 538
 /**
@@ -546,27 +546,27 @@  discard block
 block discarded – undo
546 546
  */
547 547
 function geodir_detail_page_google_analytics()
548 548
 {
549
-    global $post;
550
-    $package_info = array();
551
-    $package_info = geodir_post_package_info($package_info, $post);
549
+	global $post;
550
+	$package_info = array();
551
+	$package_info = geodir_post_package_info($package_info, $post);
552 552
 
553
-    $id = trim(get_option('geodir_ga_id'));
553
+	$id = trim(get_option('geodir_ga_id'));
554 554
 
555
-    if (!$id) {
556
-        return; //if no Google Analytics ID then bail.
557
-    }
555
+	if (!$id) {
556
+		return; //if no Google Analytics ID then bail.
557
+	}
558 558
 
559
-    ob_start(); // Start buffering;
560
-    /**
561
-     * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
562
-     *
563
-     * @since 1.0.0
564
-     */
565
-    do_action('geodir_before_google_analytics');
559
+	ob_start(); // Start buffering;
560
+	/**
561
+	 * This is called before the edit post link html in the function geodir_detail_page_google_analytics()
562
+	 *
563
+	 * @since 1.0.0
564
+	 */
565
+	do_action('geodir_before_google_analytics');
566 566
     
567
-    if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
568
-        $page_url = urlencode($_SERVER['REQUEST_URI']);
569
-        ?>
567
+	if (get_option('geodir_ga_stats') && is_user_logged_in() &&  (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) {
568
+		$page_url = urlencode($_SERVER['REQUEST_URI']);
569
+		?>
570 570
         <script type="text/javascript">
571 571
             ga_data1 = false;
572 572
             ga_data2 = false;
@@ -795,15 +795,15 @@  discard block
 block discarded – undo
795 795
                     var labels = results[1].rows.map(function(row) { return +row[0]; });
796 796
 
797 797
                     <?php
798
-                    // Here we list the shorthand days of the week so it can be used in translation.
799
-                    __("Mon",'geodirectory');
800
-                    __("Tue",'geodirectory');
801
-                    __("Wed",'geodirectory');
802
-                    __("Thu",'geodirectory');
803
-                    __("Fri",'geodirectory');
804
-                    __("Sat",'geodirectory');
805
-                    __("Sun",'geodirectory');
806
-                    ?>
798
+					// Here we list the shorthand days of the week so it can be used in translation.
799
+					__("Mon",'geodirectory');
800
+					__("Tue",'geodirectory');
801
+					__("Wed",'geodirectory');
802
+					__("Thu",'geodirectory');
803
+					__("Fri",'geodirectory');
804
+					__("Sat",'geodirectory');
805
+					__("Sun",'geodirectory');
806
+					?>
807 807
 
808 808
                     labels = [
809 809
                         "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>",
@@ -1028,24 +1028,24 @@  discard block
 block discarded – undo
1028 1028
         </span>
1029 1029
 
1030 1030
     <?php
1031
-    }
1032
-    /**
1033
-     * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1034
-     *
1035
-     * @since 1.0.0
1036
-     */
1037
-    do_action('geodir_after_google_analytics');
1038
-    $content_html = ob_get_clean();
1039
-    if (trim($content_html) != '')
1040
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1041
-    if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1042
-        /**
1043
-         * Filter the geodir_edit_post_link() function content.
1044
-         *
1045
-         * @param string $content_html The output html of the geodir_edit_post_link() function.
1046
-         */
1047
-        echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1048
-    }
1031
+	}
1032
+	/**
1033
+	 * This is called after the edit post link html in the function geodir_detail_page_google_analytics()
1034
+	 *
1035
+	 * @since 1.0.0
1036
+	 */
1037
+	do_action('geodir_after_google_analytics');
1038
+	$content_html = ob_get_clean();
1039
+	if (trim($content_html) != '')
1040
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>';
1041
+	if ((int)get_option('geodir_disable_google_analytics_section') != 1) {
1042
+		/**
1043
+		 * Filter the geodir_edit_post_link() function content.
1044
+		 *
1045
+		 * @param string $content_html The output html of the geodir_edit_post_link() function.
1046
+		 */
1047
+		echo $content_html = apply_filters('geodir_google_analytic_html', $content_html);
1048
+	}
1049 1049
 }
1050 1050
 
1051 1051
 /**
@@ -1059,90 +1059,90 @@  discard block
 block discarded – undo
1059 1059
  */
1060 1060
 function geodir_detail_page_review_rating()
1061 1061
 {
1062
-    global $post, $preview, $post_images;
1063
-    ob_start(); // Start  buffering;
1064
-    /**
1065
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1066
-     *
1067
-     * This is called outside the check for an actual rating and the check for preview page.
1068
-     *
1069
-     * @since 1.0.0
1070
-     */
1071
-    do_action('geodir_before_detail_page_review_rating');
1072
-
1073
-    $comment_count = geodir_get_review_count_total($post->ID);
1074
-    $post_avgratings = geodir_get_post_rating($post->ID);
1075
-
1076
-    if ($post_avgratings != 0 && !$preview) {
1077
-        /**
1078
-         * This is called before the rating html in the function geodir_detail_page_review_rating().
1079
-         *
1080
-         * This is called inside the check for an actual rating and the check for preview page.
1081
-         *
1082
-         * @since 1.0.0
1083
-         * @param float $post_avgratings Average rating for the surrent post.
1084
-         * @param int $post->ID Current post ID.
1085
-         */
1086
-        do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1087
-
1088
-        $html = '<p style=" float:left;">';
1089
-        $html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1090
-        $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1091
-        $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1062
+	global $post, $preview, $post_images;
1063
+	ob_start(); // Start  buffering;
1064
+	/**
1065
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1066
+	 *
1067
+	 * This is called outside the check for an actual rating and the check for preview page.
1068
+	 *
1069
+	 * @since 1.0.0
1070
+	 */
1071
+	do_action('geodir_before_detail_page_review_rating');
1072
+
1073
+	$comment_count = geodir_get_review_count_total($post->ID);
1074
+	$post_avgratings = geodir_get_post_rating($post->ID);
1075
+
1076
+	if ($post_avgratings != 0 && !$preview) {
1077
+		/**
1078
+		 * This is called before the rating html in the function geodir_detail_page_review_rating().
1079
+		 *
1080
+		 * This is called inside the check for an actual rating and the check for preview page.
1081
+		 *
1082
+		 * @since 1.0.0
1083
+		 * @param float $post_avgratings Average rating for the surrent post.
1084
+		 * @param int $post->ID Current post ID.
1085
+		 */
1086
+		do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1087
+
1088
+		$html = '<p style=" float:left;">';
1089
+		$html .= geodir_get_rating_stars($post_avgratings, $post->ID);
1090
+		$html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">';
1091
+		$post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings;
1092 1092
        
1093 1093
 	   $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory');
1094 1094
 	   
1095 1095
 	   $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />';
1096 1096
 
1097
-        $html .= '<span class="item">';
1098
-        $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1097
+		$html .= '<span class="item">';
1098
+		$html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>';
1099 1099
 
1100
-        if ($post_images) {
1101
-            foreach ($post_images as $img) {
1102
-                $post_img = $img->src;
1103
-                break;
1104
-            }
1105
-        }
1106
-
1107
-        if (isset($post_img) && $post_img) {
1108
-            $html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />';
1109
-        }
1110
-
1111
-        $html .= '</span>';
1112
-
1113
-        echo $html .= '</div>';
1114
-        /**
1115
-         * This is called after the rating html in the function geodir_detail_page_review_rating().
1116
-         *
1117
-         * This is called inside the check for an actual rating and the check for preview page.
1118
-         *
1119
-         * @since 1.0.0
1120
-         * @param float $post_avgratings Average rating for the surrent post.
1121
-         * @param int $post->ID Current post ID.
1122
-         */
1123
-        do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
-    }
1125
-    /**
1126
-     * This is called before the rating html in the function geodir_detail_page_review_rating().
1127
-     *
1128
-     * This is called outside the check for an actual rating and the check for preview page.
1129
-     *
1130
-     * @since 1.0.0
1131
-     */
1132
-    do_action('geodir_after_detail_page_review_rating');
1133
-    $content_html = ob_get_clean();
1134
-    if (trim($content_html) != '') {
1135
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1136
-    }
1137
-    if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1138
-        /**
1139
-         * Filter the geodir_detail_page_review_rating() function content.
1140
-         *
1141
-         * @since 1.0.0
1142
-         * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1143
-         */
1144
-        echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1145
-    }
1100
+		if ($post_images) {
1101
+			foreach ($post_images as $img) {
1102
+				$post_img = $img->src;
1103
+				break;
1104
+			}
1105
+		}
1106
+
1107
+		if (isset($post_img) && $post_img) {
1108
+			$html .= '<br /><img src="' . $post_img . '" class="photo hreview-img" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo hreview-img" />';
1109
+		}
1110
+
1111
+		$html .= '</span>';
1112
+
1113
+		echo $html .= '</div>';
1114
+		/**
1115
+		 * This is called after the rating html in the function geodir_detail_page_review_rating().
1116
+		 *
1117
+		 * This is called inside the check for an actual rating and the check for preview page.
1118
+		 *
1119
+		 * @since 1.0.0
1120
+		 * @param float $post_avgratings Average rating for the surrent post.
1121
+		 * @param int $post->ID Current post ID.
1122
+		 */
1123
+		do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID);
1124
+	}
1125
+	/**
1126
+	 * This is called before the rating html in the function geodir_detail_page_review_rating().
1127
+	 *
1128
+	 * This is called outside the check for an actual rating and the check for preview page.
1129
+	 *
1130
+	 * @since 1.0.0
1131
+	 */
1132
+	do_action('geodir_after_detail_page_review_rating');
1133
+	$content_html = ob_get_clean();
1134
+	if (trim($content_html) != '') {
1135
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>';
1136
+	}
1137
+	if ((int)get_option('geodir_disable_rating_info_section') != 1) {
1138
+		/**
1139
+		 * Filter the geodir_detail_page_review_rating() function content.
1140
+		 *
1141
+		 * @since 1.0.0
1142
+		 * @param string $content_html The output html of the geodir_detail_page_review_rating() function.
1143
+		 */
1144
+		echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html);
1145
+	}
1146 1146
 }
1147 1147
 
1148 1148
 /**
@@ -1154,35 +1154,35 @@  discard block
 block discarded – undo
1154 1154
  */
1155 1155
 function geodir_detail_page_more_info()
1156 1156
 {
1157
-    ob_start(); // Start  buffering;
1158
-    /**
1159
-     * This is called before the info section html.
1160
-     *
1161
-     * @since 1.0.0
1162
-     */
1163
-    do_action('geodir_before_detail_page_more_info');
1164
-    if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1165
-        echo $geodir_post_detail_fields;
1166
-    }
1167
-    /**
1168
-     * This is called after the info section html.
1169
-     *
1170
-     * @since 1.0.0
1171
-     */
1172
-    do_action('geodir_after_detail_page_more_info');
1173
-
1174
-    $content_html = ob_get_clean();
1175
-    if (trim($content_html) != '')
1176
-        $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1177
-    if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1178
-        /**
1179
-         * Filter the output html for function geodir_detail_page_more_info().
1180
-         *
1181
-         * @since 1.0.0
1182
-         * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1183
-         */
1184
-        echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1185
-    }
1157
+	ob_start(); // Start  buffering;
1158
+	/**
1159
+	 * This is called before the info section html.
1160
+	 *
1161
+	 * @since 1.0.0
1162
+	 */
1163
+	do_action('geodir_before_detail_page_more_info');
1164
+	if ($geodir_post_detail_fields = geodir_show_listing_info()) {
1165
+		echo $geodir_post_detail_fields;
1166
+	}
1167
+	/**
1168
+	 * This is called after the info section html.
1169
+	 *
1170
+	 * @since 1.0.0
1171
+	 */
1172
+	do_action('geodir_after_detail_page_more_info');
1173
+
1174
+	$content_html = ob_get_clean();
1175
+	if (trim($content_html) != '')
1176
+		$content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>';
1177
+	if ((int)get_option('geodir_disable_listing_info_section') != 1) {
1178
+		/**
1179
+		 * Filter the output html for function geodir_detail_page_more_info().
1180
+		 *
1181
+		 * @since 1.0.0
1182
+		 * @param string $content_html The output html of the geodir_detail_page_more_info() function.
1183
+		 */
1184
+		echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html);
1185
+	}
1186 1186
 }
1187 1187
 
1188 1188
 
@@ -1196,15 +1196,15 @@  discard block
 block discarded – undo
1196 1196
  */
1197 1197
 function geodir_localize_all_js_msg()
1198 1198
 {// check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls
1199
-    if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1200
-        $ajax_url = admin_url('admin-ajax.php');
1201
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1202
-        $ajax_url = admin_url('admin-ajax.php');
1203
-    } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1204
-        $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1205
-    } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1206
-        $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1207
-    }
1199
+	if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1200
+		$ajax_url = admin_url('admin-ajax.php');
1201
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1202
+		$ajax_url = admin_url('admin-ajax.php');
1203
+	} elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) {
1204
+		$ajax_url = str_replace("https", "http", admin_url('admin-ajax.php'));
1205
+	} elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) {
1206
+		$ajax_url = str_replace("http", "https", admin_url('admin-ajax.php'));
1207
+	}
1208 1208
 	
1209 1209
 	/**
1210 1210
 	 * Filter the allowed image type extensions for post images.
@@ -1214,52 +1214,52 @@  discard block
 block discarded – undo
1214 1214
 	 */
1215 1215
 	$allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png'));
1216 1216
 	
1217
-    $arr_alert_msg = array(
1218
-        'geodir_plugin_url' => geodir_plugin_url(),
1219
-        'geodir_admin_ajax_url' => $ajax_url,
1220
-        'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1221
-        'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1222
-        'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1223
-        'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1224
-        //start not show alert msg
1225
-        'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1226
-        'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1227
-        'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1228
-        'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1229
-        'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1230
-        // end not show alert msg
1231
-        'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1232
-        //start not show alert msg
1233
-        'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1234
-        'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1235
-        'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1236
-        'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1237
-        'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1238
-        'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1239
-        'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1240
-        'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1241
-        'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1242
-        'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1243
-        'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1244
-        'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1245
-        'geodir_default_marker_icon' => get_option('geodir_default_marker_icon'),
1246
-        'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1247
-        'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1248
-        'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1249
-        'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1250
-        'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1251
-        'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1252
-        'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1253
-        'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1254
-        /* on/off dragging for phone devices */
1255
-        'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1256
-        'geodir_is_mobile' => wp_is_mobile() ? true : false,
1257
-        'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1258
-        'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1259
-        'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1260
-        'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1261
-        'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1262
-        'geodir_action_remove' => __('Remove', 'geodirectory'),
1217
+	$arr_alert_msg = array(
1218
+		'geodir_plugin_url' => geodir_plugin_url(),
1219
+		'geodir_admin_ajax_url' => $ajax_url,
1220
+		'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'),
1221
+		'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'),
1222
+		'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'),
1223
+		'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'),
1224
+		//start not show alert msg
1225
+		'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'),
1226
+		'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'),
1227
+		'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'),
1228
+		'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'),
1229
+		'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'),
1230
+		// end not show alert msg
1231
+		'my_place_listing_del' => __('Are you wish to delete this listing?', 'geodirectory'),
1232
+		//start not show alert msg
1233
+		'rating_error_msg' => __('Error : please retry', 'geodirectory'),
1234
+		'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'),
1235
+		'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'),
1236
+		'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'),
1237
+		'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'),
1238
+		'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'),
1239
+		'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'),
1240
+		'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'),
1241
+		'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'),
1242
+		'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'),
1243
+		'geodir_field_id_required' => __('This field is required.', 'geodirectory'),
1244
+		'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'),
1245
+		'geodir_default_marker_icon' => get_option('geodir_default_marker_icon'),
1246
+		'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG,
1247
+		'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG,
1248
+		'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'),
1249
+		'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'),
1250
+		'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'),
1251
+		'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'),
1252
+		'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'),
1253
+		'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'),
1254
+		/* on/off dragging for phone devices */
1255
+		'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false,
1256
+		'geodir_is_mobile' => wp_is_mobile() ? true : false,
1257
+		'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'),
1258
+		'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'),
1259
+		'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'),
1260
+		'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'),
1261
+		'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'),
1262
+		'geodir_action_remove' => __('Remove', 'geodirectory'),
1263 1263
 		'geodir_txt_all_files' => __('Allowed files', 'geodirectory'),
1264 1264
 		'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'),
1265 1265
 		'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '',
@@ -1267,28 +1267,28 @@  discard block
 block discarded – undo
1267 1267
 		'geodir_txt_form_searching' => __('Searching...', 'geodirectory'),
1268 1268
 		'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '',
1269 1269
 		'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '',
1270
-    );
1271
-
1272
-    /**
1273
-     * Filters the translated JS strings from function geodir_localize_all_js_msg().
1274
-     *
1275
-     * With this filter you can add, remove or change translated JS strings.
1276
-     * You should add your own translations to this if you are building an addon rather than adding another script block.
1277
-     *
1278
-     * @since 1.0.0
1279
-     */
1280
-    $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1281
-
1282
-    foreach ($arr_alert_msg as $key => $value) {
1283
-        if (!is_scalar($value))
1284
-            continue;
1285
-        $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1286
-    }
1270
+	);
1287 1271
 
1288
-    $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1289
-    echo '<script>';
1290
-    echo $script;
1291
-    echo '</script>';
1272
+	/**
1273
+	 * Filters the translated JS strings from function geodir_localize_all_js_msg().
1274
+	 *
1275
+	 * With this filter you can add, remove or change translated JS strings.
1276
+	 * You should add your own translations to this if you are building an addon rather than adding another script block.
1277
+	 *
1278
+	 * @since 1.0.0
1279
+	 */
1280
+	$arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg);
1281
+
1282
+	foreach ($arr_alert_msg as $key => $value) {
1283
+		if (!is_scalar($value))
1284
+			continue;
1285
+		$arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8');
1286
+	}
1287
+
1288
+	$script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';';
1289
+	echo '<script>';
1290
+	echo $script;
1291
+	echo '</script>';
1292 1292
 }
1293 1293
 
1294 1294
 add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31);
@@ -1304,9 +1304,9 @@  discard block
 block discarded – undo
1304 1304
  */
1305 1305
 function geodir_admin_bar_site_menu($wp_admin_bar)
1306 1306
 {
1307
-    if (get_option("geodir_installed")) {
1308
-        $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1309
-    }
1307
+	if (get_option("geodir_installed")) {
1308
+		$wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory')));
1309
+	}
1310 1310
 }
1311 1311
 
1312 1312
 add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/
@@ -1332,25 +1332,25 @@  discard block
 block discarded – undo
1332 1332
  */
1333 1333
 function geodir_store_sidebars()
1334 1334
 {
1335
-    global $geodir_sidebars;
1336
-    global $sidebars_widgets;
1337
-
1338
-    if (!is_array($sidebars_widgets))
1339
-        $sidebars_widgets = wp_get_sidebars_widgets();
1340
-    $geodir_old_sidebars = array();
1341
-
1342
-    if (is_array($geodir_sidebars)) {
1343
-        foreach ($geodir_sidebars as $val) {
1344
-            if (is_array($sidebars_widgets)) {
1345
-                if (array_key_exists($val, $sidebars_widgets))
1346
-                    $geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1347
-                else
1348
-                    $geodir_old_sidebars[$val] = array();
1349
-            }
1350
-        }
1351
-    }
1352
-    update_option('geodir_sidebars', $geodir_old_sidebars);
1353
-    geodir_option_version_backup('geodir_sidebars');
1335
+	global $geodir_sidebars;
1336
+	global $sidebars_widgets;
1337
+
1338
+	if (!is_array($sidebars_widgets))
1339
+		$sidebars_widgets = wp_get_sidebars_widgets();
1340
+	$geodir_old_sidebars = array();
1341
+
1342
+	if (is_array($geodir_sidebars)) {
1343
+		foreach ($geodir_sidebars as $val) {
1344
+			if (is_array($sidebars_widgets)) {
1345
+				if (array_key_exists($val, $sidebars_widgets))
1346
+					$geodir_old_sidebars[$val] = $sidebars_widgets[$val];
1347
+				else
1348
+					$geodir_old_sidebars[$val] = array();
1349
+			}
1350
+		}
1351
+	}
1352
+	update_option('geodir_sidebars', $geodir_old_sidebars);
1353
+	geodir_option_version_backup('geodir_sidebars');
1354 1354
 
1355 1355
 }
1356 1356
 
@@ -1364,34 +1364,34 @@  discard block
 block discarded – undo
1364 1364
  */
1365 1365
 function geodir_restore_sidebars()
1366 1366
 {
1367
-    global $sidebars_widgets;
1368
-
1369
-    if (!is_array($sidebars_widgets))
1370
-        $sidebars_widgets = wp_get_sidebars_widgets();
1371
-
1372
-    if (is_array($sidebars_widgets)) {
1373
-        $geodir_old_sidebars = get_option('geodir_sidebars');
1374
-        if (is_array($geodir_old_sidebars)) {
1375
-            foreach ($geodir_old_sidebars as $key => $val) {
1376
-                //if(array_key_exists($key, $sidebars_widgets))
1377
-                {
1378
-                    $sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1379
-                }
1367
+	global $sidebars_widgets;
1380 1368
 
1369
+	if (!is_array($sidebars_widgets))
1370
+		$sidebars_widgets = wp_get_sidebars_widgets();
1381 1371
 
1382
-            }
1383
-        }
1372
+	if (is_array($sidebars_widgets)) {
1373
+		$geodir_old_sidebars = get_option('geodir_sidebars');
1374
+		if (is_array($geodir_old_sidebars)) {
1375
+			foreach ($geodir_old_sidebars as $key => $val) {
1376
+				//if(array_key_exists($key, $sidebars_widgets))
1377
+				{
1378
+					$sidebars_widgets[$key] = $geodir_old_sidebars[$key];
1379
+				}
1384 1380
 
1385
-        // now clear all non geodiretory sidebars 
1386
-        foreach ($sidebars_widgets as $key => $val) {
1387
-            if (!array_key_exists($key, $geodir_old_sidebars)) {
1388
-                $sidebars_widgets[$key] = array();
1389
-            }
1390
-        }
1391
-    }
1392 1381
 
1393
-    update_option('sidebars_widgets', $sidebars_widgets);
1394
-    update_option('geodir_sidebars', '');
1382
+			}
1383
+		}
1384
+
1385
+		// now clear all non geodiretory sidebars 
1386
+		foreach ($sidebars_widgets as $key => $val) {
1387
+			if (!array_key_exists($key, $geodir_old_sidebars)) {
1388
+				$sidebars_widgets[$key] = array();
1389
+			}
1390
+		}
1391
+	}
1392
+
1393
+	update_option('sidebars_widgets', $sidebars_widgets);
1394
+	update_option('geodir_sidebars', '');
1395 1395
 }
1396 1396
 
1397 1397
 add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview');
@@ -1404,9 +1404,9 @@  discard block
 block discarded – undo
1404 1404
  */
1405 1405
 function geodir_after_listing_post_gridview()
1406 1406
 {
1407
-    global $gridview_columns;
1407
+	global $gridview_columns;
1408 1408
 
1409
-    $gridview_columns = '';
1409
+	$gridview_columns = '';
1410 1410
 
1411 1411
 }
1412 1412
 
@@ -1434,11 +1434,11 @@  discard block
 block discarded – undo
1434 1434
  */
1435 1435
 function so_handle_038($url, $original_url, $_context)
1436 1436
 {
1437
-    if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1438
-        $url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1439
-    }
1437
+	if (strstr($url, "maps.google.com/maps/api/js") !== false) {
1438
+		$url = str_replace("&#038;", "&amp;", $url); // or $url = $original_url
1439
+	}
1440 1440
 
1441
-    return $url;
1441
+	return $url;
1442 1442
 }
1443 1443
 
1444 1444
 
@@ -1454,34 +1454,34 @@  discard block
 block discarded – undo
1454 1454
 function geodir_after_main_form_fields() {
1455 1455
 	global $gd_session;
1456 1456
 	
1457
-    if (get_option('geodir_accept_term_condition')) {
1458
-        global $post;
1459
-        $term_condition = '';
1460
-        if (isset($_REQUEST['backandedit'])) {
1461
-            $post = (object)$gd_session->get('listing');
1462
-            $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1463
-        }
1464
-
1465
-        ?>
1457
+	if (get_option('geodir_accept_term_condition')) {
1458
+		global $post;
1459
+		$term_condition = '';
1460
+		if (isset($_REQUEST['backandedit'])) {
1461
+			$post = (object)$gd_session->get('listing');
1462
+			$term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : '';
1463
+		}
1464
+
1465
+		?>
1466 1466
         <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix">
1467 1467
             <label>&nbsp;</label>
1468 1468
 
1469 1469
             <div class="geodir_taxonomy_field" style="float:left; width:70%;">
1470 1470
 				<span style="display:block"> 
1471 1471
 				<input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') {
1472
-                    echo 'checked="checked"';
1473
-                } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1472
+					echo 'checked="checked"';
1473
+				} ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition"
1474 1474
                        class="geodir_textfield" value="1"
1475 1475
                        style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a>
1476 1476
 				</span>
1477 1477
             </div>
1478 1478
             <span class="geodir_message_error"><?php if (isset($required_msg)) {
1479
-                    _e($required_msg, 'geodirectory');
1480
-                } ?></span>
1479
+					_e($required_msg, 'geodirectory');
1480
+				} ?></span>
1481 1481
         </div>
1482 1482
     <?php
1483 1483
 
1484
-    }
1484
+	}
1485 1485
 }
1486 1486
 
1487 1487
 
@@ -1507,25 +1507,25 @@  discard block
 block discarded – undo
1507 1507
 function geodir_detail_page_tab_is_display($is_display, $tab)
1508 1508
 {
1509 1509
 
1510
-    global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1510
+	global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields;
1511 1511
 
1512
-    if ($tab == 'post_info')
1513
-        $is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1512
+	if ($tab == 'post_info')
1513
+		$is_display = (!empty($geodir_post_detail_fields)) ? true : false;
1514 1514
 
1515
-    if ($tab == 'post_images')
1516
-        $is_display = (!empty($post_images)) ? true : false;
1515
+	if ($tab == 'post_images')
1516
+		$is_display = (!empty($post_images)) ? true : false;
1517 1517
 
1518
-    if ($tab == 'post_video')
1519
-        $is_display = (!empty($video)) ? true : false;
1518
+	if ($tab == 'post_video')
1519
+		$is_display = (!empty($video)) ? true : false;
1520 1520
 
1521
-    if ($tab == 'special_offers')
1522
-        $is_display = (!empty($special_offers)) ? true : false;
1521
+	if ($tab == 'special_offers')
1522
+		$is_display = (!empty($special_offers)) ? true : false;
1523 1523
 
1524
-    if ($tab == 'reviews')
1525
-        $is_display = (geodir_is_page('detail')) ? true : false;
1524
+	if ($tab == 'reviews')
1525
+		$is_display = (geodir_is_page('detail')) ? true : false;
1526 1526
 
1527
-    if ($tab == 'related_listing') {
1528
-       $message = __('No listings found which match your selection.', 'geodirectory');
1527
+	if ($tab == 'related_listing') {
1528
+	   $message = __('No listings found which match your selection.', 'geodirectory');
1529 1529
 	   
1530 1530
 	   /** This action is documented in geodirectory-functions/template_functions.php */
1531 1531
 	   $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false);
@@ -1534,7 +1534,7 @@  discard block
 block discarded – undo
1534 1534
 	}
1535 1535
 
1536 1536
 
1537
-    return $is_display;
1537
+	return $is_display;
1538 1538
 }
1539 1539
 
1540 1540
 
@@ -1553,14 +1553,14 @@  discard block
 block discarded – undo
1553 1553
  */
1554 1554
 function geodir_after_core_plugin_row($plugin_file, $plugin_data, $status)
1555 1555
 {
1556
-    //echo $plugin_file . " " .  $plugin_data . " " . $status ;
1557
-    if (is_plugin_active($plugin_file)) {
1558
-        $wp_list_table = _get_list_table('WP_Plugins_List_Table');
1556
+	//echo $plugin_file . " " .  $plugin_data . " " . $status ;
1557
+	if (is_plugin_active($plugin_file)) {
1558
+		$wp_list_table = _get_list_table('WP_Plugins_List_Table');
1559 1559
 
1560
-        echo '<tr class="plugin-update-tr active update"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="geodir-plugin-row-warning">';
1561
-        _e('Deactivate all GeoDirectory dependent add-ons first before deactivating GeoDirectory.', 'geodirectory');
1562
-        echo '</div></td></tr>';
1563
-    }
1560
+		echo '<tr class="plugin-update-tr active update"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="geodir-plugin-row-warning">';
1561
+		_e('Deactivate all GeoDirectory dependent add-ons first before deactivating GeoDirectory.', 'geodirectory');
1562
+		echo '</div></td></tr>';
1563
+	}
1564 1564
 }
1565 1565
 
1566 1566
 
@@ -1576,17 +1576,17 @@  discard block
 block discarded – undo
1576 1576
  * @global string $plugin_prefix Geodirectory plugin table prefix.
1577 1577
  */
1578 1578
 function geodir_changes_in_custom_fields_table() {
1579
-    global $wpdb, $plugin_prefix;
1579
+	global $wpdb, $plugin_prefix;
1580 1580
 	
1581 1581
 	// Remove unused virtual page
1582 1582
 	$listings_page_id = (int)get_option('geodir_listing_page');
1583 1583
 	if ($listings_page_id) {
1584 1584
 		$wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page')));
1585
-        delete_option('geodir_listing_page');
1585
+		delete_option('geodir_listing_page');
1586 1586
 	}
1587 1587
 
1588
-    // updated custom field table(add field to show custom field as a tab)
1589
-    /*if (!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'show_as_tab'")) {
1588
+	// updated custom field table(add field to show custom field as a tab)
1589
+	/*if (!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'show_as_tab'")) {
1590 1590
 		$wpdb->query("ALTER TABLE `".GEODIR_CUSTOM_FIELDS_TABLE."` ADD `show_as_tab` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `show_on_detail`");
1591 1591
 	}
1592 1592
 	
@@ -1594,66 +1594,66 @@  discard block
 block discarded – undo
1594 1594
 		$wpdb->query("ALTER TABLE `".GEODIR_CUSTOM_FIELDS_TABLE."` ADD `for_admin_use` ENUM( '0', '1' ) NOT NULL DEFAULT '0'");
1595 1595
 	}*/
1596 1596
 
1597
-    if (!get_option('geodir_changes_in_custom_fields_table')) {
1597
+	if (!get_option('geodir_changes_in_custom_fields_table')) {
1598 1598
 
1599
-        $post_types = geodir_get_posttypes();
1599
+		$post_types = geodir_get_posttypes();
1600 1600
 
1601
-        /*if(!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'is_admin'"))
1601
+		/*if(!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'is_admin'"))
1602 1602
 					$wpdb->query("ALTER TABLE `".GEODIR_CUSTOM_FIELDS_TABLE."` ADD `is_admin` ENUM( '0', '1' ) NOT NULL DEFAULT '0' AFTER `is_default`");*/
1603 1603
 
1604
-        $wpdb->query(
1605
-            $wpdb->prepare(
1606
-                "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1607
-                array('1', '1', 'admin')
1608
-            )
1609
-        );
1604
+		$wpdb->query(
1605
+			$wpdb->prepare(
1606
+				"UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s",
1607
+				array('1', '1', 'admin')
1608
+			)
1609
+		);
1610 1610
 
1611 1611
 
1612
-        /* --- terms meta value set --- */
1612
+		/* --- terms meta value set --- */
1613 1613
 
1614
-        update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1614
+		update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png');
1615 1615
 
1616
-        $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1616
+		$options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%')));
1617 1617
 
1618
-        if (!empty($options_data)) {
1618
+		if (!empty($options_data)) {
1619 1619
 
1620
-            foreach ($options_data as $optobj) {
1620
+			foreach ($options_data as $optobj) {
1621 1621
 
1622
-                $option_val = str_replace('tax_meta_', '', $optobj->option_name);
1622
+				$option_val = str_replace('tax_meta_', '', $optobj->option_name);
1623 1623
 
1624
-                $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1624
+				$taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val)));
1625 1625
 
1626
-                if (!empty($taxonomies_data)) {
1626
+				if (!empty($taxonomies_data)) {
1627 1627
 
1628
-                    foreach ($taxonomies_data as $taxobj) {
1628
+					foreach ($taxonomies_data as $taxobj) {
1629 1629
 
1630
-                        $taxObject = get_taxonomy($taxobj->taxonomy);
1631
-                        $post_type = $taxObject->object_type[0];
1630
+						$taxObject = get_taxonomy($taxobj->taxonomy);
1631
+						$post_type = $taxObject->object_type[0];
1632 1632
 
1633
-                        $opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1633
+						$opt_value = 'tax_meta_' . $post_type . '_' . $option_val;
1634 1634
 
1635
-                        $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1635
+						$duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val)));
1636 1636
 
1637
-                        if ($duplicate_data) {
1637
+						if ($duplicate_data) {
1638 1638
 
1639
-                            $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1639
+							$wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET	option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id)));
1640 1640
 
1641
-                        } else {
1641
+						} else {
1642 1642
 
1643
-                            $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1643
+							$wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload)));
1644 1644
 
1645
-                        }
1645
+						}
1646 1646
 
1647
-                    }
1647
+					}
1648 1648
 
1649
-                }
1649
+				}
1650 1650
 
1651
-            }
1652
-        }
1651
+			}
1652
+		}
1653 1653
 
1654
-        update_option('geodir_changes_in_custom_fields_table', '1');
1654
+		update_option('geodir_changes_in_custom_fields_table', '1');
1655 1655
 
1656
-    }
1656
+	}
1657 1657
 
1658 1658
 }
1659 1659
 
@@ -1672,24 +1672,24 @@  discard block
 block discarded – undo
1672 1672
 function geodir_location_slug_check($slug)
1673 1673
 {
1674 1674
 
1675
-    global $wpdb, $table_prefix;
1675
+	global $wpdb, $table_prefix;
1676 1676
 
1677
-    $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1677
+	$slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug)));
1678 1678
 
1679
-    if ($slug_exists) {
1679
+	if ($slug_exists) {
1680 1680
 
1681
-        $suffix = 1;
1682
-        do {
1683
-            $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1684
-            $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1685
-            $suffix++;
1686
-        } while ($location_slug_check && $suffix < 100);
1681
+		$suffix = 1;
1682
+		do {
1683
+			$alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1684
+			$location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name)));
1685
+			$suffix++;
1686
+		} while ($location_slug_check && $suffix < 100);
1687 1687
 
1688
-        $slug = $alt_location_name;
1688
+		$slug = $alt_location_name;
1689 1689
 
1690
-    }
1690
+	}
1691 1691
 
1692
-    return $slug;
1692
+	return $slug;
1693 1693
 
1694 1694
 }
1695 1695
 
@@ -1714,42 +1714,42 @@  discard block
 block discarded – undo
1714 1714
 function geodir_update_term_slug($term_id, $tt_id, $taxonomy)
1715 1715
 {
1716 1716
 
1717
-    global $wpdb, $plugin_prefix, $table_prefix;
1717
+	global $wpdb, $plugin_prefix, $table_prefix;
1718 1718
 
1719
-    $tern_data = get_term_by('id', $term_id, $taxonomy);
1719
+	$tern_data = get_term_by('id', $term_id, $taxonomy);
1720 1720
 
1721
-    $slug = $tern_data->slug;
1721
+	$slug = $tern_data->slug;
1722 1722
 
1723
-    /**
1724
-     * Filter if a term slug exists.
1725
-     *
1726
-     * @since 1.0.0
1727
-     * @package GeoDirectory
1728
-     * @param bool $bool Default: false.
1729
-     * @param string $slug The term slug.
1730
-     * @param int $term_id The term ID.
1731
-     */
1732
-    $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1723
+	/**
1724
+	 * Filter if a term slug exists.
1725
+	 *
1726
+	 * @since 1.0.0
1727
+	 * @package GeoDirectory
1728
+	 * @param bool $bool Default: false.
1729
+	 * @param string $slug The term slug.
1730
+	 * @param int $term_id The term ID.
1731
+	 */
1732
+	$slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id);
1733 1733
 
1734
-    if ($slug_exists) {
1734
+	if ($slug_exists) {
1735 1735
 
1736
-        $suffix = 1;
1737
-        do {
1738
-            $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1736
+		$suffix = 1;
1737
+		do {
1738
+			$new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix";
1739 1739
 
1740
-            /** This action is documented in geodirectory_hooks_actions.php */
1741
-            $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1740
+			/** This action is documented in geodirectory_hooks_actions.php */
1741
+			$term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id);
1742 1742
 
1743
-            $suffix++;
1744
-        } while ($term_slug_check && $suffix < 100);
1743
+			$suffix++;
1744
+		} while ($term_slug_check && $suffix < 100);
1745 1745
 
1746
-        $slug = $new_slug;
1746
+		$slug = $new_slug;
1747 1747
 
1748
-        //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1748
+		//wp_update_term( $term_id, $taxonomy, array('slug' => $slug) );
1749 1749
 
1750
-        $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1750
+		$wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id)));
1751 1751
 
1752
-    }
1752
+	}
1753 1753
 	
1754 1754
 	// Update tag in detail table.
1755 1755
 	$taxonomy_obj = get_taxonomy($taxonomy);
@@ -1790,21 +1790,21 @@  discard block
 block discarded – undo
1790 1790
 function geodir_term_slug_is_exists($slug_exists, $slug, $term_id)
1791 1791
 {
1792 1792
 
1793
-    global $wpdb, $table_prefix;
1793
+	global $wpdb, $table_prefix;
1794 1794
 
1795
-    $default_location = geodir_get_default_location();
1795
+	$default_location = geodir_get_default_location();
1796 1796
 
1797
-    $country_slug = $default_location->country_slug;
1798
-    $region_slug = $default_location->region_slug;
1799
-    $city_slug = $default_location->city_slug;
1797
+	$country_slug = $default_location->country_slug;
1798
+	$region_slug = $default_location->region_slug;
1799
+	$city_slug = $default_location->city_slug;
1800 1800
 
1801
-    if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1802
-        return $slug_exists = true;
1801
+	if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug)
1802
+		return $slug_exists = true;
1803 1803
 
1804
-    if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1805
-        return $slug_exists = true;
1804
+	if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id))))
1805
+		return $slug_exists = true;
1806 1806
 
1807
-    return $slug_exists;
1807
+	return $slug_exists;
1808 1808
 }
1809 1809
 
1810 1810
 
@@ -1823,75 +1823,75 @@  discard block
 block discarded – undo
1823 1823
  */
1824 1824
 function geodir_custom_page_title($title = '', $sep = '')
1825 1825
 {
1826
-    global $wp;
1827
-    if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1828
-        return $title;
1829
-    }
1826
+	global $wp;
1827
+	if (class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) {
1828
+		return $title;
1829
+	}
1830 1830
 
1831
-    if ($sep == '') {
1832
-        /**
1833
-         * Filter the page title separator.
1834
-         *
1835
-         * @since 1.0.0
1836
-         * @package GeoDirectory
1837
-         * @param string $sep The separator, default: `|`.
1838
-         */
1839
-        $sep = apply_filters('geodir_page_title_separator', '|');
1840
-    }
1831
+	if ($sep == '') {
1832
+		/**
1833
+		 * Filter the page title separator.
1834
+		 *
1835
+		 * @since 1.0.0
1836
+		 * @package GeoDirectory
1837
+		 * @param string $sep The separator, default: `|`.
1838
+		 */
1839
+		$sep = apply_filters('geodir_page_title_separator', '|');
1840
+	}
1841 1841
 
1842 1842
 
1843
-    $gd_page = '';
1844
-    if(geodir_is_page('home')){
1845
-        $gd_page = 'home';
1846
-        $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1847
-    }
1848
-    elseif(geodir_is_page('detail')){
1849
-        $gd_page = 'detail';
1850
-        $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1851
-    }
1852
-    elseif(geodir_is_page('pt')){
1853
-        $gd_page = 'pt';
1854
-        $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1855
-    }
1856
-    elseif(geodir_is_page('listing')){
1857
-        $gd_page = 'listing';
1858
-        $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1859
-    }
1860
-    elseif(geodir_is_page('location')){
1861
-        $gd_page = 'location';
1862
-        $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1863
-    }
1864
-    elseif(geodir_is_page('search')){
1865
-        $gd_page = 'search';
1866
-        $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1867
-    }
1868
-    elseif(geodir_is_page('add-listing')){
1869
-        $gd_page = 'add-listing';
1870
-        $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1871
-    }
1872
-    elseif(geodir_is_page('author')){
1873
-        $gd_page = 'author';
1874
-        $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1875
-    }
1876
-    elseif(geodir_is_page('login')){
1877
-        $gd_page = 'login';
1878
-        $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1879
-    }
1880
-    elseif(geodir_is_page('listing-success')){
1881
-        $gd_page = 'listing-success';
1882
-        $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1883
-    }
1843
+	$gd_page = '';
1844
+	if(geodir_is_page('home')){
1845
+		$gd_page = 'home';
1846
+		$title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title;
1847
+	}
1848
+	elseif(geodir_is_page('detail')){
1849
+		$gd_page = 'detail';
1850
+		$title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title;
1851
+	}
1852
+	elseif(geodir_is_page('pt')){
1853
+		$gd_page = 'pt';
1854
+		$title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title;
1855
+	}
1856
+	elseif(geodir_is_page('listing')){
1857
+		$gd_page = 'listing';
1858
+		$title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title;
1859
+	}
1860
+	elseif(geodir_is_page('location')){
1861
+		$gd_page = 'location';
1862
+		$title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title;
1863
+	}
1864
+	elseif(geodir_is_page('search')){
1865
+		$gd_page = 'search';
1866
+		$title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title;
1867
+	}
1868
+	elseif(geodir_is_page('add-listing')){
1869
+		$gd_page = 'add-listing';
1870
+		$title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title;
1871
+	}
1872
+	elseif(geodir_is_page('author')){
1873
+		$gd_page = 'author';
1874
+		$title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title;
1875
+	}
1876
+	elseif(geodir_is_page('login')){
1877
+		$gd_page = 'login';
1878
+		$title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title;
1879
+	}
1880
+	elseif(geodir_is_page('listing-success')){
1881
+		$gd_page = 'listing-success';
1882
+		$title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title;
1883
+	}
1884 1884
 
1885 1885
 
1886
-    /**
1887
-     * Filter page meta title to replace variables.
1888
-     *
1889
-     * @since 1.5.4
1890
-     * @param string $title The page title including variables.
1891
-     * @param string $gd_page The GeoDirectory page type if any.
1892
-     * @param string $sep The title separator symbol.
1893
-     */
1894
-    return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1886
+	/**
1887
+	 * Filter page meta title to replace variables.
1888
+	 *
1889
+	 * @since 1.5.4
1890
+	 * @param string $title The page title including variables.
1891
+	 * @param string $gd_page The GeoDirectory page type if any.
1892
+	 * @param string $sep The title separator symbol.
1893
+	 */
1894
+	return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep);
1895 1895
 
1896 1896
 }
1897 1897
 
@@ -1907,33 +1907,33 @@  discard block
 block discarded – undo
1907 1907
 function geodir_set_post_attachment()
1908 1908
 {
1909 1909
 
1910
-    if (!get_option('geodir_set_post_attachments')) {
1910
+	if (!get_option('geodir_set_post_attachments')) {
1911 1911
 
1912
-        require_once(ABSPATH . 'wp-admin/includes/image.php');
1913
-        require_once(ABSPATH . 'wp-admin/includes/file.php');
1912
+		require_once(ABSPATH . 'wp-admin/includes/image.php');
1913
+		require_once(ABSPATH . 'wp-admin/includes/file.php');
1914 1914
 
1915
-        $all_postypes = geodir_get_posttypes();
1915
+		$all_postypes = geodir_get_posttypes();
1916 1916
 
1917
-        $args = array(
1918
-            'posts_per_page' => -1,
1919
-            'post_type' => $all_postypes,
1920
-            'post_status' => 'publish');
1917
+		$args = array(
1918
+			'posts_per_page' => -1,
1919
+			'post_type' => $all_postypes,
1920
+			'post_status' => 'publish');
1921 1921
 
1922
-        $posts_array = get_posts($args);
1922
+		$posts_array = get_posts($args);
1923 1923
 
1924
-        if (!empty($posts_array)) {
1924
+		if (!empty($posts_array)) {
1925 1925
 
1926
-            foreach ($posts_array as $post) {
1926
+			foreach ($posts_array as $post) {
1927 1927
 
1928
-                geodir_set_wp_featured_image($post->ID);
1928
+				geodir_set_wp_featured_image($post->ID);
1929 1929
 
1930
-            }
1930
+			}
1931 1931
 
1932
-        }
1932
+		}
1933 1933
 
1934
-        update_option('geodir_set_post_attachments', '1');
1934
+		update_option('geodir_set_post_attachments', '1');
1935 1935
 
1936
-    }
1936
+	}
1937 1937
 
1938 1938
 }
1939 1939
 
@@ -1950,19 +1950,19 @@  discard block
 block discarded – undo
1950 1950
 function geodir_remove_url_seperator()
1951 1951
 {
1952 1952
 
1953
-    if (!get_option('geodir_remove_url_seperator')) {
1953
+	if (!get_option('geodir_remove_url_seperator')) {
1954 1954
 
1955
-        if (get_option('geodir_listingurl_separator'))
1956
-            delete_option('geodir_listingurl_separator');
1955
+		if (get_option('geodir_listingurl_separator'))
1956
+			delete_option('geodir_listingurl_separator');
1957 1957
 
1958
-        if (get_option('geodir_detailurl_separator'))
1959
-            delete_option('geodir_detailurl_separator');
1958
+		if (get_option('geodir_detailurl_separator'))
1959
+			delete_option('geodir_detailurl_separator');
1960 1960
 
1961
-        flush_rewrite_rules(false);
1961
+		flush_rewrite_rules(false);
1962 1962
 
1963
-        update_option('geodir_remove_url_seperator', '1');
1963
+		update_option('geodir_remove_url_seperator', '1');
1964 1964
 
1965
-    }
1965
+	}
1966 1966
 
1967 1967
 }
1968 1968
 
@@ -1978,39 +1978,39 @@  discard block
 block discarded – undo
1978 1978
  */
1979 1979
 function geodir_remove_url_seperator_form_permalink_settings($permalink_arr)
1980 1980
 {
1981
-    foreach ($permalink_arr as $key => $value) {
1981
+	foreach ($permalink_arr as $key => $value) {
1982 1982
 
1983
-        if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1984
-            unset($permalink_arr[$key]);
1983
+		if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator')
1984
+			unset($permalink_arr[$key]);
1985 1985
 
1986
-    }
1986
+	}
1987 1987
 
1988
-    return $permalink_arr;
1988
+	return $permalink_arr;
1989 1989
 
1990 1990
 }
1991 1991
 
1992 1992
 if (!is_admin()) {
1993
-    add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1993
+	add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post');
1994 1994
 }
1995 1995
 /**
1996
- * Set status from draft to publish.
1997
- *
1998
- * @since 1.0.0
1999
- * @package GeoDirectory
2000
- * @global object $wp WordPress object.
2001
- * @param object $post Post object.
2002
- * @return object Modified post object.
2003
- */
1996
+	 * Set status from draft to publish.
1997
+	 *
1998
+	 * @since 1.0.0
1999
+	 * @package GeoDirectory
2000
+	 * @global object $wp WordPress object.
2001
+	 * @param object $post Post object.
2002
+	 * @return object Modified post object.
2003
+	 */
2004 2004
 function geodir_set_status_draft_to_publish_for_own_post($post)
2005 2005
 {
2006
-    global $wp;
2007
-    $user_id = get_current_user_id();
2006
+	global $wp;
2007
+	$user_id = get_current_user_id();
2008 2008
 
2009
-    if (!empty($post) && $post[0]->post_author == $user_id) {
2010
-        $post[0]->post_status = 'publish';
2011
-    }
2012
-    //print_r($post) ;
2013
-    return $post;
2009
+	if (!empty($post) && $post[0]->post_author == $user_id) {
2010
+		$post[0]->post_status = 'publish';
2011
+	}
2012
+	//print_r($post) ;
2013
+	return $post;
2014 2014
 }
2015 2015
 
2016 2016
 
@@ -2102,33 +2102,33 @@  discard block
 block discarded – undo
2102 2102
  */
2103 2103
 function geodir_detail_page_tab_headings_change($tabs_arr)
2104 2104
 {
2105
-    global $wpdb;
2105
+	global $wpdb;
2106 2106
 
2107
-    $post_type = geodir_get_current_posttype();
2107
+	$post_type = geodir_get_current_posttype();
2108 2108
 
2109
-    $all_postypes = geodir_get_posttypes();
2109
+	$all_postypes = geodir_get_posttypes();
2110 2110
 
2111
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2111
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) {
2112 2112
 
2113
-        if (array_key_exists('post_video', $tabs_arr)) {
2113
+		if (array_key_exists('post_video', $tabs_arr)) {
2114 2114
 
2115
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2115
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type)));
2116 2116
 
2117
-            if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2118
-                $tabs_arr['post_video']['heading_text'] = $field_title;
2119
-        }
2117
+			if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '')
2118
+				$tabs_arr['post_video']['heading_text'] = $field_title;
2119
+		}
2120 2120
 
2121
-        if (array_key_exists('special_offers', $tabs_arr)) {
2121
+		if (array_key_exists('special_offers', $tabs_arr)) {
2122 2122
 
2123
-            $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2123
+			$field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type)));
2124 2124
 
2125
-            if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2126
-                $tabs_arr['special_offers']['heading_text'] = $field_title;
2127
-        }
2125
+			if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '')
2126
+				$tabs_arr['special_offers']['heading_text'] = $field_title;
2127
+		}
2128 2128
 
2129
-    }
2129
+	}
2130 2130
 
2131
-    return $tabs_arr;
2131
+	return $tabs_arr;
2132 2132
 
2133 2133
 }
2134 2134
 
@@ -2141,10 +2141,10 @@  discard block
 block discarded – undo
2141 2141
  */
2142 2142
 function geodir_remove_template_redirect_actions()
2143 2143
 {
2144
-    if (geodir_is_page('login')){
2145
-        remove_all_actions('template_redirect');
2146
-        remove_action('init', 'avia_modify_front', 10);
2147
-    }
2144
+	if (geodir_is_page('login')){
2145
+		remove_all_actions('template_redirect');
2146
+		remove_action('init', 'avia_modify_front', 10);
2147
+	}
2148 2148
 }
2149 2149
 
2150 2150
 
@@ -2166,51 +2166,51 @@  discard block
 block discarded – undo
2166 2166
 function geodirectory_before_featured_image_delete($attachment_id)
2167 2167
 {
2168 2168
 
2169
-    global $wpdb, $plugin_prefix;
2169
+	global $wpdb, $plugin_prefix;
2170 2170
 
2171
-    $post_id = get_post_field('post_parent', $attachment_id);
2171
+	$post_id = get_post_field('post_parent', $attachment_id);
2172 2172
 
2173
-    $attachment_url = wp_get_attachment_url($attachment_id);
2173
+	$attachment_url = wp_get_attachment_url($attachment_id);
2174 2174
 
2175
-    if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2175
+	if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) {
2176 2176
 
2177
-        $post_type = get_post_type($post_id);
2177
+		$post_type = get_post_type($post_id);
2178 2178
 
2179
-        $all_postypes = geodir_get_posttypes();
2179
+		$all_postypes = geodir_get_posttypes();
2180 2180
 
2181
-        if (!in_array($post_type, $all_postypes) || !is_admin())
2182
-            return false;
2181
+		if (!in_array($post_type, $all_postypes) || !is_admin())
2182
+			return false;
2183 2183
 
2184
-        $uploads = wp_upload_dir();
2184
+		$uploads = wp_upload_dir();
2185 2185
 
2186
-        $split_img_path = explode($uploads['baseurl'], $attachment_url);
2186
+		$split_img_path = explode($uploads['baseurl'], $attachment_url);
2187 2187
 
2188
-        $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2188
+		$split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : '';
2189 2189
 
2190
-        $wpdb->query(
2191
-            $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2192
-                array($post_id, $split_img_file_path)
2193
-            )
2194
-        );
2190
+		$wpdb->query(
2191
+			$wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ",
2192
+				array($post_id, $split_img_file_path)
2193
+			)
2194
+		);
2195 2195
 
2196
-        $attachment_data = $wpdb->get_row(
2197
-            $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2198
-                array($post_id)
2199
-            )
2200
-        );
2196
+		$attachment_data = $wpdb->get_row(
2197
+			$wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d",
2198
+				array($post_id)
2199
+			)
2200
+		);
2201 2201
 
2202
-        if (!empty($attachment_data)) {
2203
-            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2204
-        }
2202
+		if (!empty($attachment_data)) {
2203
+			$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2204
+		}
2205 2205
 
2206 2206
 
2207
-        $table_name = $plugin_prefix . $post_type . '_detail';
2207
+		$table_name = $plugin_prefix . $post_type . '_detail';
2208 2208
 
2209
-        $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2209
+		$wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id);
2210 2210
 
2211
-        geodir_set_wp_featured_image($post_id);
2211
+		geodir_set_wp_featured_image($post_id);
2212 2212
 
2213
-    }
2213
+	}
2214 2214
 
2215 2215
 }
2216 2216
 
@@ -2228,80 +2228,80 @@  discard block
 block discarded – undo
2228 2228
 function geodir_temp_set_post_attachment()
2229 2229
 {
2230 2230
 
2231
-    global $wpdb, $plugin_prefix;
2231
+	global $wpdb, $plugin_prefix;
2232 2232
 
2233
-    $all_postypes = geodir_get_posttypes();
2233
+	$all_postypes = geodir_get_posttypes();
2234 2234
 
2235
-    foreach ($all_postypes as $posttype) {
2235
+	foreach ($all_postypes as $posttype) {
2236 2236
 
2237
-        $tablename = $plugin_prefix . $posttype . '_detail';
2237
+		$tablename = $plugin_prefix . $posttype . '_detail';
2238 2238
 
2239
-        $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2239
+		$get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename);
2240 2240
 
2241
-        if (!empty($get_post_data)) {
2241
+		if (!empty($get_post_data)) {
2242 2242
 
2243
-            foreach ($get_post_data as $data) {
2243
+			foreach ($get_post_data as $data) {
2244 2244
 
2245
-                $post_id = $data->post_id;
2245
+				$post_id = $data->post_id;
2246 2246
 
2247
-                $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2247
+				$attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''");
2248 2248
 
2249
-                if (!empty($attachment_data)) {
2249
+				if (!empty($attachment_data)) {
2250 2250
 
2251
-                    foreach ($attachment_data as $attach) {
2251
+					foreach ($attachment_data as $attach) {
2252 2252
 
2253
-                        $file_info = pathinfo($attach->file);
2253
+						$file_info = pathinfo($attach->file);
2254 2254
 
2255
-                        $sub_dir = '';
2256
-                        if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2257
-                            $sub_dir = stripslashes_deep($file_info['dirname']);
2255
+						$sub_dir = '';
2256
+						if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..')
2257
+							$sub_dir = stripslashes_deep($file_info['dirname']);
2258 2258
 
2259
-                        $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2260
-                        $uploads_baseurl = $uploads['baseurl'];
2261
-                        $uploads_path = $uploads['basedir'];
2259
+						$uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs
2260
+						$uploads_baseurl = $uploads['baseurl'];
2261
+						$uploads_path = $uploads['basedir'];
2262 2262
 
2263
-                        $file_name = $file_info['basename'];
2263
+						$file_name = $file_info['basename'];
2264 2264
 
2265
-                        $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2265
+						$img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name;
2266 2266
 
2267
-                        if (!file_exists($img_arr['path'])) {
2267
+						if (!file_exists($img_arr['path'])) {
2268 2268
 
2269
-                            $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2269
+							$wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID);
2270 2270
 
2271
-                        }
2271
+						}
2272 2272
 
2273
-                    }
2273
+					}
2274 2274
 
2275
-                    $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2275
+					$attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id");
2276 2276
 
2277
-                    if (!empty($attachment_data)) {
2277
+					if (!empty($attachment_data)) {
2278 2278
 
2279
-                        if ($attachment_data->ID)
2280
-                            $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2279
+						if ($attachment_data->ID)
2280
+							$wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID);
2281 2281
 
2282
-                    } else {
2282
+					} else {
2283 2283
 
2284
-                        if (has_post_thumbnail($post_id)) {
2284
+						if (has_post_thumbnail($post_id)) {
2285 2285
 
2286
-                            $post_thumbnail_id = get_post_thumbnail_id($post_id);
2286
+							$post_thumbnail_id = get_post_thumbnail_id($post_id);
2287 2287
 
2288
-                            wp_delete_attachment($post_thumbnail_id);
2288
+							wp_delete_attachment($post_thumbnail_id);
2289 2289
 
2290
-                        }
2290
+						}
2291 2291
 
2292
-                    }
2292
+					}
2293 2293
 
2294
-                    $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2294
+					$wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id);
2295 2295
 
2296
-                    geodir_set_wp_featured_image($post_id);
2296
+					geodir_set_wp_featured_image($post_id);
2297 2297
 
2298
-                }
2298
+				}
2299 2299
 
2300
-            }
2300
+			}
2301 2301
 
2302
-        }
2302
+		}
2303 2303
 
2304
-    }
2304
+	}
2305 2305
 
2306 2306
 }
2307 2307
 
@@ -2319,9 +2319,9 @@  discard block
 block discarded – undo
2319 2319
 function geodir_default_rating_star_icon()
2320 2320
 {
2321 2321
 
2322
-    if (!get_option('geodir_default_rating_star_icon')) {
2323
-        update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2324
-    }
2322
+	if (!get_option('geodir_default_rating_star_icon')) {
2323
+		update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png');
2324
+	}
2325 2325
 
2326 2326
 }
2327 2327
 
@@ -2339,24 +2339,24 @@  discard block
 block discarded – undo
2339 2339
  */
2340 2340
 function geodir_user_post_listing_count()
2341 2341
 {
2342
-    global $wpdb, $plugin_prefix, $current_user;
2342
+	global $wpdb, $plugin_prefix, $current_user;
2343 2343
 
2344
-    $user_id = $current_user->ID;
2345
-    $all_postypes = geodir_get_posttypes();
2346
-    $all_posts = get_option('geodir_listing_link_user_dashboard');
2344
+	$user_id = $current_user->ID;
2345
+	$all_postypes = geodir_get_posttypes();
2346
+	$all_posts = get_option('geodir_listing_link_user_dashboard');
2347 2347
 
2348
-    $user_listing = array();
2349
-    if (is_array($all_posts) && !empty($all_posts)) {
2350
-        foreach ($all_posts as $ptype) {
2351
-            $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2348
+	$user_listing = array();
2349
+	if (is_array($all_posts) && !empty($all_posts)) {
2350
+		foreach ($all_posts as $ptype) {
2351
+			$total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )");
2352 2352
 
2353
-            if ($total_posts > 0) {
2354
-                $user_listing[$ptype] = $total_posts;
2355
-            }
2356
-        }
2357
-    }
2353
+			if ($total_posts > 0) {
2354
+				$user_listing[$ptype] = $total_posts;
2355
+			}
2356
+		}
2357
+	}
2358 2358
 
2359
-    return $user_listing;
2359
+	return $user_listing;
2360 2360
 }
2361 2361
 
2362 2362
 
@@ -2373,27 +2373,27 @@  discard block
 block discarded – undo
2373 2373
  */
2374 2374
 function geodir_user_favourite_listing_count()
2375 2375
 {
2376
-    global $wpdb, $plugin_prefix, $current_user;
2376
+	global $wpdb, $plugin_prefix, $current_user;
2377 2377
 
2378
-    $user_id = $current_user->ID;
2379
-    $all_postypes = geodir_get_posttypes();
2380
-    $user_favorites = get_user_meta($user_id, 'gd_user_favourite_post', true);
2381
-    $all_posts = get_option('geodir_favorite_link_user_dashboard');
2378
+	$user_id = $current_user->ID;
2379
+	$all_postypes = geodir_get_posttypes();
2380
+	$user_favorites = get_user_meta($user_id, 'gd_user_favourite_post', true);
2381
+	$all_posts = get_option('geodir_favorite_link_user_dashboard');
2382 2382
 
2383
-    $user_listing = array();
2384
-    if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
2385
-        $user_favorites = "'" . implode("','", $user_favorites) . "'";
2383
+	$user_listing = array();
2384
+	if (is_array($all_posts) && !empty($all_posts) && is_array($user_favorites) && !empty($user_favorites)) {
2385
+		$user_favorites = "'" . implode("','", $user_favorites) . "'";
2386 2386
 
2387
-        foreach ($all_posts as $ptype) {
2388
-            $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 . ")");
2387
+		foreach ($all_posts as $ptype) {
2388
+			$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 . ")");
2389 2389
 
2390
-            if ($total_posts > 0) {
2391
-                $user_listing[$ptype] = $total_posts;
2392
-            }
2393
-        }
2394
-    }
2390
+			if ($total_posts > 0) {
2391
+				$user_listing[$ptype] = $total_posts;
2392
+			}
2393
+		}
2394
+	}
2395 2395
 
2396
-    return $user_listing;
2396
+	return $user_listing;
2397 2397
 }
2398 2398
 
2399 2399
 add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_custom_field_tab');
@@ -2410,584 +2410,584 @@  discard block
 block discarded – undo
2410 2410
  */
2411 2411
 function geodir_detail_page_custom_field_tab($tabs_arr)
2412 2412
 {
2413
-    global $post;
2414
-
2415
-    $post_type = geodir_get_current_posttype();
2416
-    $all_postypes = geodir_get_posttypes();
2417
-
2418
-    if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2419
-        $package_info = array();
2420
-        $package_info = geodir_post_package_info($package_info, $post);
2421
-        $post_package_id = $package_info->pid;
2422
-        $fields_location = 'detail';
2423
-
2424
-        $custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2425
-        if (!empty($custom_fields)) {
2426
-            $parse_custom_fields = array();
2427
-            foreach ($custom_fields as $field) {
2428
-                $field = stripslashes_deep($field); // strip slashes
2413
+	global $post;
2414
+
2415
+	$post_type = geodir_get_current_posttype();
2416
+	$all_postypes = geodir_get_posttypes();
2417
+
2418
+	if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) {
2419
+		$package_info = array();
2420
+		$package_info = geodir_post_package_info($package_info, $post);
2421
+		$post_package_id = $package_info->pid;
2422
+		$fields_location = 'detail';
2423
+
2424
+		$custom_fields = geodir_post_custom_fields($post_package_id, 'default', $post_type, $fields_location);
2425
+		if (!empty($custom_fields)) {
2426
+			$parse_custom_fields = array();
2427
+			foreach ($custom_fields as $field) {
2428
+				$field = stripslashes_deep($field); // strip slashes
2429 2429
                 
2430
-                $type = $field;
2431
-                $field_name = $field['htmlvar_name'];
2432
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2433
-                    $post->$field_name = $_REQUEST[$field_name];
2434
-                }
2435
-
2436
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2437
-                    if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2438
-                        continue;
2439
-                    }
2440
-
2441
-                    $parse_custom_fields[] = $field;
2442
-                }
2443
-            }
2444
-            $custom_fields = $parse_custom_fields;
2445
-        }
2446
-
2447
-        if (!empty($custom_fields)) {
2448
-            $field_set_start = 0;
2449
-            $fieldset_count = 0;
2450
-            $fieldset = '';
2451
-            $total_fields = count($custom_fields);
2452
-            $count_field = 0;
2453
-            $fieldset_arr = array();
2454
-            $i = 0;
2455
-            $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2456
-
2457
-            foreach ($custom_fields as $field) {
2458
-                $count_field++;
2459
-                $field_name = $field['htmlvar_name'];
2460
-                if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2461
-                    $post->$field_name = $_REQUEST[$field_name];
2462
-                }
2463
-
2464
-                if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2465
-                    $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2466
-                    $site_title = trim($field['site_title']);
2467
-                    $type = $field;
2468
-                    $html = '';
2469
-                    $html_var = $field_name;
2470
-                    $field_icon = '';
2471
-                    $variables_array = array();
2472
-
2473
-                    if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2474
-                        continue;
2475
-                    }
2476
-
2477
-                    if ($type['type'] != 'fieldset') {
2478
-                        $i++;
2479
-                        $variables_array['post_id'] = $post->ID;
2480
-                        $variables_array['label'] = __($type['site_title'], 'geodirectory');
2481
-                        $variables_array['value'] = '';
2482
-                        $variables_array['value'] = $post->$type['htmlvar_name'];
2483
-                    }
2484
-
2485
-                    if (strpos($type['field_icon'], 'http') !== false) {
2486
-                        $field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2487
-                    } elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2488
-                        $field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2489
-                    }
2430
+				$type = $field;
2431
+				$field_name = $field['htmlvar_name'];
2432
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2433
+					$post->$field_name = $_REQUEST[$field_name];
2434
+				}
2435
+
2436
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2437
+					if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2438
+						continue;
2439
+					}
2440
+
2441
+					$parse_custom_fields[] = $field;
2442
+				}
2443
+			}
2444
+			$custom_fields = $parse_custom_fields;
2445
+		}
2490 2446
 
2491
-                    switch ($type['type']) {
2492
-                        case 'fieldset': {
2493
-                            $i = 0;
2494
-                            $fieldset_count++;
2495
-                            $field_set_start = 1;
2496
-                            $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2497
-                            $fieldset_arr[$fieldset_count]['label'] = $label;
2498
-                        }
2499
-                            break;
2500
-                        case 'url': {
2501
-                            if (strpos($field_icon, 'http') !== false) {
2502
-                                $field_icon_af = '';
2503
-                            } elseif ($field_icon == '') {
2504
-
2505
-                                if ($type['name'] == 'geodir_facebook') {
2506
-                                    $field_icon_af = '<i class="fa fa-facebook-square"></i>';
2507
-                                } elseif ($type['name'] == 'geodir_twitter') {
2508
-                                    $field_icon_af = '<i class="fa fa-twitter-square"></i>';
2509
-                                } else {
2510
-                                    $field_icon_af = '<i class="fa fa-link"></i>';
2511
-                                }
2512
-
2513
-                            } else {
2514
-                                $field_icon_af = $field_icon;
2515
-                                $field_icon = '';
2516
-                            }
2447
+		if (!empty($custom_fields)) {
2448
+			$field_set_start = 0;
2449
+			$fieldset_count = 0;
2450
+			$fieldset = '';
2451
+			$total_fields = count($custom_fields);
2452
+			$count_field = 0;
2453
+			$fieldset_arr = array();
2454
+			$i = 0;
2455
+			$geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL;
2456
+
2457
+			foreach ($custom_fields as $field) {
2458
+				$count_field++;
2459
+				$field_name = $field['htmlvar_name'];
2460
+				if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->$field_name) && isset($_REQUEST[$field_name])) {
2461
+					$post->$field_name = $_REQUEST[$field_name];
2462
+				}
2463
+
2464
+				if (isset($field['show_as_tab']) && $field['show_as_tab'] == 1 && ((isset($post->$field_name) && $post->$field_name != '') || $field['type'] == 'fieldset') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file'))) {
2465
+					$label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title'];
2466
+					$site_title = trim($field['site_title']);
2467
+					$type = $field;
2468
+					$html = '';
2469
+					$html_var = $field_name;
2470
+					$field_icon = '';
2471
+					$variables_array = array();
2472
+
2473
+					if ($type['type'] == 'datepicker' && ($post->$type['htmlvar_name'] == '' || $post->$type['htmlvar_name'] == '0000-00-00')) {
2474
+						continue;
2475
+					}
2476
+
2477
+					if ($type['type'] != 'fieldset') {
2478
+						$i++;
2479
+						$variables_array['post_id'] = $post->ID;
2480
+						$variables_array['label'] = __($type['site_title'], 'geodirectory');
2481
+						$variables_array['value'] = '';
2482
+						$variables_array['value'] = $post->$type['htmlvar_name'];
2483
+					}
2484
+
2485
+					if (strpos($type['field_icon'], 'http') !== false) {
2486
+						$field_icon = ' background: url(' . $type['field_icon'] . ') no-repeat left center;background-size:18px 18px;padding-left: 21px;';
2487
+					} elseif (strpos($type['field_icon'], 'fa fa-') !== false) {
2488
+						$field_icon = '<i class="' . $type['field_icon'] . '"></i>';
2489
+					}
2490
+
2491
+					switch ($type['type']) {
2492
+						case 'fieldset': {
2493
+							$i = 0;
2494
+							$fieldset_count++;
2495
+							$field_set_start = 1;
2496
+							$fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count;
2497
+							$fieldset_arr[$fieldset_count]['label'] = $label;
2498
+						}
2499
+							break;
2500
+						case 'url': {
2501
+							if (strpos($field_icon, 'http') !== false) {
2502
+								$field_icon_af = '';
2503
+							} elseif ($field_icon == '') {
2504
+
2505
+								if ($type['name'] == 'geodir_facebook') {
2506
+									$field_icon_af = '<i class="fa fa-facebook-square"></i>';
2507
+								} elseif ($type['name'] == 'geodir_twitter') {
2508
+									$field_icon_af = '<i class="fa fa-twitter-square"></i>';
2509
+								} else {
2510
+									$field_icon_af = '<i class="fa fa-link"></i>';
2511
+								}
2512
+
2513
+							} else {
2514
+								$field_icon_af = $field_icon;
2515
+								$field_icon = '';
2516
+							}
2517 2517
                             
2518
-                            $a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2519
-
2520
-                            $website = !empty($a_url['url']) ? $a_url['url'] : '';
2521
-                            $title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2522
-                            $title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2523
-
2524
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2525
-
2526
-                            // all search engines that use the nofollow value exclude links that use it from their ranking calculation
2527
-                            $rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2528
-
2529
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2530
-                                /**
2531
-                                 * Filer the custom field website name.
2532
-                                 *
2533
-                                 * @since 1.0.0
2534
-                                 * @param string $title The field name default: "Website".
2535
-                                 * @param string $website The website address.
2536
-                                 * @param int $post->ID The post ID.
2537
-                                 */
2538
-                                apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2539
-                        }
2540
-                            break;
2541
-                        case 'phone': {
2542
-                            if (strpos($field_icon, 'http') !== false) {
2543
-                                $field_icon_af = '';
2544
-                            } elseif ($field_icon == '') {
2545
-                                $field_icon_af = '<i class="fa fa-phone"></i>';
2546
-                            } else {
2547
-                                $field_icon_af = $field_icon;
2548
-                                $field_icon = '';
2549
-                            }
2550
-
2551
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2552
-
2553
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2554
-                            if ($field_set_start == 1 && $site_title != '') {
2555
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2556
-                            }
2557
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2558
-                        }
2559
-                            break;
2560
-                        case 'time': {
2561
-                            $value = '';
2562
-                            if ($post->$type['htmlvar_name'] != '')
2563
-                                //$value = date('h:i',strtotime($post->$type['htmlvar_name']));
2564
-                                $value = date(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2565
-
2566
-                            if (strpos($field_icon, 'http') !== false) {
2567
-                                $field_icon_af = '';
2568
-                            } elseif ($field_icon == '') {
2569
-                                $field_icon_af = '<i class="fa fa-clock-o"></i>';
2570
-                            } else {
2571
-                                $field_icon_af = $field_icon;
2572
-                                $field_icon = '';
2573
-                            }
2574
-
2575
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2576
-
2577
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2578
-                            if ($field_set_start == 1 && $site_title != '') {
2579
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2580
-                            }
2581
-                            $html .= ' </span>' . stripslashes($value) . '</div>';
2582
-                        }
2583
-                            break;
2584
-                        case 'datepicker': {
2585
-                            $date_format = geodir_default_date_format();
2586
-                            if ($type['extra_fields'] != '') {
2587
-                                $date_format = unserialize($type['extra_fields']);
2588
-                                $date_format = $date_format['date_format'];
2589
-                            }
2590
-
2591
-                            $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2592
-                            $replace = array('d','j','l','m','n','F','Y');//PHP date format
2593
-
2594
-                            $date_format = str_replace($search, $replace, $date_format);
2595
-
2596
-                            $post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2597
-
2598
-                            $value = '';
2599
-                            if ($post->$type['htmlvar_name'] != '')
2600
-                                $value = date($date_format, strtotime($post_htmlvar_value));
2601
-
2602
-                            if (strpos($field_icon, 'http') !== false) {
2603
-                                $field_icon_af = '';
2604
-                            } elseif ($field_icon == '') {
2605
-                                $field_icon_af = '<i class="fa fa-calendar"></i>';
2606
-                            } else {
2607
-                                $field_icon_af = $field_icon;
2608
-                                $field_icon = '';
2609
-                            }
2610
-
2611
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2612
-
2613
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2614
-                            if ($field_set_start == 1 && $site_title != '') {
2615
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2616
-                            }
2617
-                            $html .= ' </span>' . $value . '</div>';
2618
-                        }
2619
-                            break;
2620
-                        case 'text': {
2621
-                            if (strpos($field_icon, 'http') !== false) {
2622
-                                $field_icon_af = '';
2623
-                            } elseif ($field_icon == '') {
2624
-                                $field_icon_af = '';
2625
-                            } else {
2626
-                                $field_icon_af = $field_icon;
2627
-                                $field_icon = '';
2628
-                            }
2629
-
2630
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2631
-
2632
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2633
-                            if ($field_set_start == 1 && $site_title != '') {
2634
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2635
-                            }
2636
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2637
-                        }
2638
-                            break;
2639
-                        case 'radio': {
2640
-
2641
-                            if ($post->$type['htmlvar_name'] != '') {
2642
-                                if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2643
-                                    $html_val = __('No', 'geodirectory');
2644
-                                } else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2645
-                                    $html_val = __('Yes', 'geodirectory');
2646
-                                } else {
2647
-                                    $html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2518
+							$a_url = geodir_parse_custom_field_url($post->$type['htmlvar_name']);
2519
+
2520
+							$website = !empty($a_url['url']) ? $a_url['url'] : '';
2521
+							$title = !empty($a_url['label']) ? $a_url['label'] : $type['site_title'];
2522
+							$title = $title != '' ? __(stripslashes($title), 'geodirectory') : '';
2523
+
2524
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2525
+
2526
+							// all search engines that use the nofollow value exclude links that use it from their ranking calculation
2527
+							$rel = strpos($website, get_site_url()) !== false ? '' : 'rel="nofollow"';
2528
+
2529
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '"><span class="geodir-i-website" style="' . $field_icon . '">' . $field_icon_af . ' <a href="' . $website . '" target="_blank" ' . $rel . ' ><strong>' .
2530
+								/**
2531
+								 * Filer the custom field website name.
2532
+								 *
2533
+								 * @since 1.0.0
2534
+								 * @param string $title The field name default: "Website".
2535
+								 * @param string $website The website address.
2536
+								 * @param int $post->ID The post ID.
2537
+								 */
2538
+								apply_filters('geodir_custom_field_website_name', $title, $website, $post->ID) . '</strong></a></span></div>';
2539
+						}
2540
+							break;
2541
+						case 'phone': {
2542
+							if (strpos($field_icon, 'http') !== false) {
2543
+								$field_icon_af = '';
2544
+							} elseif ($field_icon == '') {
2545
+								$field_icon_af = '<i class="fa fa-phone"></i>';
2546
+							} else {
2547
+								$field_icon_af = $field_icon;
2548
+								$field_icon = '';
2549
+							}
2550
+
2551
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2552
+
2553
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-contact" style="' . $field_icon . '">' . $field_icon_af;
2554
+							if ($field_set_start == 1 && $site_title != '') {
2555
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2556
+							}
2557
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2558
+						}
2559
+							break;
2560
+						case 'time': {
2561
+							$value = '';
2562
+							if ($post->$type['htmlvar_name'] != '')
2563
+								//$value = date('h:i',strtotime($post->$type['htmlvar_name']));
2564
+								$value = date(get_option('time_format'), strtotime($post->$type['htmlvar_name']));
2565
+
2566
+							if (strpos($field_icon, 'http') !== false) {
2567
+								$field_icon_af = '';
2568
+							} elseif ($field_icon == '') {
2569
+								$field_icon_af = '<i class="fa fa-clock-o"></i>';
2570
+							} else {
2571
+								$field_icon_af = $field_icon;
2572
+								$field_icon = '';
2573
+							}
2574
+
2575
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2576
+
2577
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-time" style="' . $field_icon . '">' . $field_icon_af;
2578
+							if ($field_set_start == 1 && $site_title != '') {
2579
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2580
+							}
2581
+							$html .= ' </span>' . stripslashes($value) . '</div>';
2582
+						}
2583
+							break;
2584
+						case 'datepicker': {
2585
+							$date_format = geodir_default_date_format();
2586
+							if ($type['extra_fields'] != '') {
2587
+								$date_format = unserialize($type['extra_fields']);
2588
+								$date_format = $date_format['date_format'];
2589
+							}
2590
+
2591
+							$search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format
2592
+							$replace = array('d','j','l','m','n','F','Y');//PHP date format
2593
+
2594
+							$date_format = str_replace($search, $replace, $date_format);
2595
+
2596
+							$post_htmlvar_value = $date_format == 'd/m/Y' ? str_replace('/', '-', $post->$type['htmlvar_name']) : $post->$type['htmlvar_name']; // PHP doesn't work well with dd/mm/yyyy format
2597
+
2598
+							$value = '';
2599
+							if ($post->$type['htmlvar_name'] != '')
2600
+								$value = date($date_format, strtotime($post_htmlvar_value));
2601
+
2602
+							if (strpos($field_icon, 'http') !== false) {
2603
+								$field_icon_af = '';
2604
+							} elseif ($field_icon == '') {
2605
+								$field_icon_af = '<i class="fa fa-calendar"></i>';
2606
+							} else {
2607
+								$field_icon_af = $field_icon;
2608
+								$field_icon = '';
2609
+							}
2610
+
2611
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2612
+
2613
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-datepicker" style="' . $field_icon . '">' . $field_icon_af;
2614
+							if ($field_set_start == 1 && $site_title != '') {
2615
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2616
+							}
2617
+							$html .= ' </span>' . $value . '</div>';
2618
+						}
2619
+							break;
2620
+						case 'text': {
2621
+							if (strpos($field_icon, 'http') !== false) {
2622
+								$field_icon_af = '';
2623
+							} elseif ($field_icon == '') {
2624
+								$field_icon_af = '';
2625
+							} else {
2626
+								$field_icon_af = $field_icon;
2627
+								$field_icon = '';
2628
+							}
2629
+
2630
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2631
+
2632
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2633
+							if ($field_set_start == 1 && $site_title != '') {
2634
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2635
+							}
2636
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2637
+						}
2638
+							break;
2639
+						case 'radio': {
2640
+
2641
+							if ($post->$type['htmlvar_name'] != '') {
2642
+								if ($post->$type['htmlvar_name'] == 'f' || $post->$type['htmlvar_name'] == '0') {
2643
+									$html_val = __('No', 'geodirectory');
2644
+								} else if ($post->$type['htmlvar_name'] == 't' || $post->$type['htmlvar_name'] == '1') {
2645
+									$html_val = __('Yes', 'geodirectory');
2646
+								} else {
2647
+									$html_val = __($post->$type['htmlvar_name'], 'geodirectory');
2648 2648
                                     
2649
-                                    if (!empty($type['option_values'])) {
2650
-                                        $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2649
+									if (!empty($type['option_values'])) {
2650
+										$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2651 2651
                                         
2652
-                                        if (!empty($cf_option_values)) {
2653
-                                            foreach ($cf_option_values as $cf_option_value) {
2654
-                                                if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2655
-                                                    $html_val = $cf_option_value['label'];
2656
-                                                }
2657
-                                            }
2658
-                                        }
2659
-                                    }
2660
-                                }
2661
-
2662
-                                if (strpos($field_icon, 'http') !== false) {
2663
-                                    $field_icon_af = '';
2664
-                                } else if ($field_icon == '') {
2665
-                                    $field_icon_af = '';
2666
-                                } else {
2667
-                                    $field_icon_af = $field_icon;
2668
-                                    $field_icon = '';
2669
-                                }
2670
-
2671
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2672
-
2673
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2674
-
2675
-                                if ($field_set_start == 1 && $site_title != '') {
2676
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2677
-                                }
2678
-
2679
-                                $html .= ' </span>' . $html_val . '</div>';
2680
-                            }
2681
-                        }
2682
-                            break;
2683
-                        case 'checkbox': {
2684
-                            $html_var = $type['htmlvar_name'];
2685
-                            $html_val = $type['htmlvar_name'];
2686
-
2687
-                            if ((int)$post->$html_var == 1) {
2688
-
2689
-                                if ($post->$type['htmlvar_name'] == '1') {
2690
-                                    $html_val = __('Yes', 'geodirectory');
2691
-                                } else {
2692
-                                    $html_val = __('No', 'geodirectory');
2693
-                                }
2694
-
2695
-                                if (strpos($field_icon, 'http') !== false) {
2696
-                                    $field_icon_af = '';
2697
-                                } else if ($field_icon == '') {
2698
-                                    $field_icon_af = '';
2699
-                                } else {
2700
-                                    $field_icon_af = $field_icon;
2701
-                                    $field_icon = '';
2702
-                                }
2703
-
2704
-                                $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2705
-
2706
-                                $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2707
-
2708
-                                if ($field_set_start == 1 && $site_title != '') {
2709
-                                    $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2710
-                                }
2711
-
2712
-                                $html .= ' </span>' . $html_val . '</div>';
2713
-                            }
2714
-                        }
2715
-                            break;
2716
-                        case 'select': {
2717
-                            if (strpos($field_icon, 'http') !== false) {
2718
-                                $field_icon_af = '';
2719
-                            } elseif ($field_icon == '') {
2720
-                                $field_icon_af = '';
2721
-                            } else {
2722
-                                $field_icon_af = $field_icon;
2723
-                                $field_icon = '';
2724
-                            }
2652
+										if (!empty($cf_option_values)) {
2653
+											foreach ($cf_option_values as $cf_option_value) {
2654
+												if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2655
+													$html_val = $cf_option_value['label'];
2656
+												}
2657
+											}
2658
+										}
2659
+									}
2660
+								}
2661
+
2662
+								if (strpos($field_icon, 'http') !== false) {
2663
+									$field_icon_af = '';
2664
+								} else if ($field_icon == '') {
2665
+									$field_icon_af = '';
2666
+								} else {
2667
+									$field_icon_af = $field_icon;
2668
+									$field_icon = '';
2669
+								}
2670
+
2671
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2672
+
2673
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-radio" style="' . $field_icon . '">' . $field_icon_af;
2674
+
2675
+								if ($field_set_start == 1 && $site_title != '') {
2676
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2677
+								}
2678
+
2679
+								$html .= ' </span>' . $html_val . '</div>';
2680
+							}
2681
+						}
2682
+							break;
2683
+						case 'checkbox': {
2684
+							$html_var = $type['htmlvar_name'];
2685
+							$html_val = $type['htmlvar_name'];
2686
+
2687
+							if ((int)$post->$html_var == 1) {
2688
+
2689
+								if ($post->$type['htmlvar_name'] == '1') {
2690
+									$html_val = __('Yes', 'geodirectory');
2691
+								} else {
2692
+									$html_val = __('No', 'geodirectory');
2693
+								}
2694
+
2695
+								if (strpos($field_icon, 'http') !== false) {
2696
+									$field_icon_af = '';
2697
+								} else if ($field_icon == '') {
2698
+									$field_icon_af = '';
2699
+								} else {
2700
+									$field_icon_af = $field_icon;
2701
+									$field_icon = '';
2702
+								}
2703
+
2704
+								$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2705
+
2706
+								$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-checkbox" style="' . $field_icon . '">' . $field_icon_af;
2707
+
2708
+								if ($field_set_start == 1 && $site_title != '') {
2709
+									$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2710
+								}
2711
+
2712
+								$html .= ' </span>' . $html_val . '</div>';
2713
+							}
2714
+						}
2715
+							break;
2716
+						case 'select': {
2717
+							if (strpos($field_icon, 'http') !== false) {
2718
+								$field_icon_af = '';
2719
+							} elseif ($field_icon == '') {
2720
+								$field_icon_af = '';
2721
+							} else {
2722
+								$field_icon_af = $field_icon;
2723
+								$field_icon = '';
2724
+							}
2725 2725
                             
2726
-                            $field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2726
+							$field_value = __($post->$type['htmlvar_name'], 'geodirectory');
2727 2727
                             
2728
-                            if (!empty($type['option_values'])) {
2729
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2728
+							if (!empty($type['option_values'])) {
2729
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2730 2730
                                 
2731
-                                if (!empty($cf_option_values)) {
2732
-                                    foreach ($cf_option_values as $cf_option_value) {
2733
-                                        if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2734
-                                            $field_value = $cf_option_value['label'];
2735
-                                        }
2736
-                                    }
2737
-                                }
2738
-                            }
2739
-
2740
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2741
-
2742
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2743
-                            if ($field_set_start == 1 && $site_title != '') {
2744
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2745
-                            }
2746
-                            $html .= ' </span>' . $field_value . '</div>';
2747
-                        }
2748
-                            break;
2749
-                        case 'multiselect': {
2750
-                            if (is_array($post->$type['htmlvar_name'])) {
2751
-                                $post->$type['htmlvar_name'] = implode(', ', $post->$type['htmlvar_name']);
2752
-                            }
2753
-
2754
-                            if (strpos($field_icon, 'http') !== false) {
2755
-                                $field_icon_af = '';
2756
-                            } elseif ($field_icon == '') {
2757
-                                $field_icon_af = '';
2758
-                            } else {
2759
-                                $field_icon_af = $field_icon;
2760
-                                $field_icon = '';
2761
-                            }
2762
-
2763
-                            $field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2764
-
2765
-                            $option_values = array();
2766
-                            if (!empty($type['option_values'])) {
2767
-                                $cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2731
+								if (!empty($cf_option_values)) {
2732
+									foreach ($cf_option_values as $cf_option_value) {
2733
+										if (isset($cf_option_value['value']) && $cf_option_value['value'] == $post->$type['htmlvar_name']) {
2734
+											$field_value = $cf_option_value['label'];
2735
+										}
2736
+									}
2737
+								}
2738
+							}
2739
+
2740
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2741
+
2742
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2743
+							if ($field_set_start == 1 && $site_title != '') {
2744
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2745
+							}
2746
+							$html .= ' </span>' . $field_value . '</div>';
2747
+						}
2748
+							break;
2749
+						case 'multiselect': {
2750
+							if (is_array($post->$type['htmlvar_name'])) {
2751
+								$post->$type['htmlvar_name'] = implode(', ', $post->$type['htmlvar_name']);
2752
+							}
2753
+
2754
+							if (strpos($field_icon, 'http') !== false) {
2755
+								$field_icon_af = '';
2756
+							} elseif ($field_icon == '') {
2757
+								$field_icon_af = '';
2758
+							} else {
2759
+								$field_icon_af = $field_icon;
2760
+								$field_icon = '';
2761
+							}
2762
+
2763
+							$field_values = explode(',', trim($post->$type['htmlvar_name'], ","));
2764
+
2765
+							$option_values = array();
2766
+							if (!empty($type['option_values'])) {
2767
+								$cf_option_values = geodir_string_values_to_options(stripslashes_deep($type['option_values']), true);
2768 2768
                                 
2769
-                                if (!empty($cf_option_values)) {
2770
-                                    foreach ($cf_option_values as $cf_option_value) {
2771
-                                        if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2772
-                                            $option_values[] = $cf_option_value['label'];
2773
-                                        }
2774
-                                    }
2775
-                                }
2776
-                            }
2777
-
2778
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2779
-
2780
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2781
-                            if ($field_set_start == 1 && $site_title != '') {
2782
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2783
-                            }
2784
-                            $html .= ' </span>';
2785
-
2786
-                            if (count($option_values) > 1) {
2787
-                                $html .= '<ul>';
2788
-                                foreach ($option_values as $val) {
2789
-                                    $html .= '<li>' . $val . '</li>';
2790
-                                }
2791
-                                $html .= '</ul>';
2792
-                            } else {
2793
-                                $html .= $post->$type['htmlvar_name'];
2794
-                            }
2795
-                            $html .= '</div>';
2796
-                        }
2797
-                            break;
2798
-                        case 'email': {
2799
-                            if (strpos($field_icon, 'http') !== false) {
2800
-                                $field_icon_af = '';
2801
-                            } elseif ($field_icon == '') {
2802
-                                $field_icon_af = '<i class="fa fa-envelope"></i>';
2803
-                            } else {
2804
-                                $field_icon_af = $field_icon;
2805
-                                $field_icon = '';
2806
-                            }
2807
-
2808
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2809
-
2810
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2811
-                            if ($field_set_start == 1 && $site_title != '') {
2812
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2813
-                            }
2814
-                            $html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2815
-                        }
2816
-                            break;
2817
-                        case 'textarea': {
2818
-                            if (strpos($field_icon, 'http') !== false) {
2819
-                                $field_icon_af = '';
2820
-                            } elseif ($field_icon == '') {
2821
-                                $field_icon_af = '';
2822
-                            } else {
2823
-                                $field_icon_af = $field_icon;
2824
-                                $field_icon = '';
2825
-                            }
2826
-
2827
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2828
-
2829
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2830
-                            if ($field_set_start == 1 && $site_title != '') {
2831
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2832
-                            }
2833
-                            $html .= '</span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2834
-                        }
2835
-                            break;
2836
-                        case 'html': {
2837
-                            if (strpos($field_icon, 'http') !== false) {
2838
-                                $field_icon_af = '';
2839
-                            } elseif ($field_icon == '') {
2840
-                                $field_icon_af = '';
2841
-                            } else {
2842
-                                $field_icon_af = $field_icon;
2843
-                                $field_icon = '';
2844
-                            }
2845
-
2846
-                            $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2847
-
2848
-                            $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2849
-                            if ($field_set_start == 1 && $site_title != '') {
2850
-                                $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2851
-                            }
2852
-                            $html .= ' </span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2853
-                        }
2854
-                        break;
2855
-                        case 'file': {
2856
-                            $html_var = $type['htmlvar_name'];
2857
-
2858
-                            if (!empty($post->$type['htmlvar_name'])) {
2859
-                                $files = explode(",", $post->$type['htmlvar_name']);
2860
-
2861
-                                if (!empty($files)) {
2862
-                                    $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2863
-                                    $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2769
+								if (!empty($cf_option_values)) {
2770
+									foreach ($cf_option_values as $cf_option_value) {
2771
+										if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) {
2772
+											$option_values[] = $cf_option_value['label'];
2773
+										}
2774
+									}
2775
+								}
2776
+							}
2777
+
2778
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2779
+
2780
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-select" style="' . $field_icon . '">' . $field_icon_af;
2781
+							if ($field_set_start == 1 && $site_title != '') {
2782
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2783
+							}
2784
+							$html .= ' </span>';
2785
+
2786
+							if (count($option_values) > 1) {
2787
+								$html .= '<ul>';
2788
+								foreach ($option_values as $val) {
2789
+									$html .= '<li>' . $val . '</li>';
2790
+								}
2791
+								$html .= '</ul>';
2792
+							} else {
2793
+								$html .= $post->$type['htmlvar_name'];
2794
+							}
2795
+							$html .= '</div>';
2796
+						}
2797
+							break;
2798
+						case 'email': {
2799
+							if (strpos($field_icon, 'http') !== false) {
2800
+								$field_icon_af = '';
2801
+							} elseif ($field_icon == '') {
2802
+								$field_icon_af = '<i class="fa fa-envelope"></i>';
2803
+							} else {
2804
+								$field_icon_af = $field_icon;
2805
+								$field_icon = '';
2806
+							}
2807
+
2808
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2809
+
2810
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-email" style="' . $field_icon . '">' . $field_icon_af;
2811
+							if ($field_set_start == 1 && $site_title != '') {
2812
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2813
+							}
2814
+							$html .= ' </span>' . stripslashes($post->$type['htmlvar_name']) . '</div>';
2815
+						}
2816
+							break;
2817
+						case 'textarea': {
2818
+							if (strpos($field_icon, 'http') !== false) {
2819
+								$field_icon_af = '';
2820
+							} elseif ($field_icon == '') {
2821
+								$field_icon_af = '';
2822
+							} else {
2823
+								$field_icon_af = $field_icon;
2824
+								$field_icon = '';
2825
+							}
2826
+
2827
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2828
+
2829
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2830
+							if ($field_set_start == 1 && $site_title != '') {
2831
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2832
+							}
2833
+							$html .= '</span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2834
+						}
2835
+							break;
2836
+						case 'html': {
2837
+							if (strpos($field_icon, 'http') !== false) {
2838
+								$field_icon_af = '';
2839
+							} elseif ($field_icon == '') {
2840
+								$field_icon_af = '';
2841
+							} else {
2842
+								$field_icon_af = $field_icon;
2843
+								$field_icon = '';
2844
+							}
2845
+
2846
+							$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2847
+
2848
+							$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . '" style="clear:both;"><span class="geodir-i-text" style="' . $field_icon . '">' . $field_icon_af;
2849
+							if ($field_set_start == 1 && $site_title != '') {
2850
+								$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2851
+							}
2852
+							$html .= ' </span>' . wpautop(stripslashes($post->$type['htmlvar_name'])) . '</div>';
2853
+						}
2854
+						break;
2855
+						case 'file': {
2856
+							$html_var = $type['htmlvar_name'];
2857
+
2858
+							if (!empty($post->$type['htmlvar_name'])) {
2859
+								$files = explode(",", $post->$type['htmlvar_name']);
2860
+
2861
+								if (!empty($files)) {
2862
+									$extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL;
2863
+									$allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : '';
2864 2864
                                
2865
-                                    $file_paths = '';
2866
-                                    foreach ($files as $file) {
2867
-                                        if (!empty($file)) {
2868
-                                            $filetype = wp_check_filetype($file);
2869
-                                            $image_name_arr = explode('/', $file);
2870
-                                            $curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2871
-                                            $filename = end($image_name_arr);
2872
-                                            $img_name_arr = explode('.', $filename);
2873
-
2874
-                                            $arr_file_type = wp_check_filetype($filename);
2875
-                                            if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2876
-                                                continue;
2877
-                                            }
2878
-                                            $uploaded_file_type = $arr_file_type['type'];
2879
-                                            $uploaded_file_ext = $arr_file_type['ext'];
2865
+									$file_paths = '';
2866
+									foreach ($files as $file) {
2867
+										if (!empty($file)) {
2868
+											$filetype = wp_check_filetype($file);
2869
+											$image_name_arr = explode('/', $file);
2870
+											$curr_img_dir = $image_name_arr[count($image_name_arr) - 2];
2871
+											$filename = end($image_name_arr);
2872
+											$img_name_arr = explode('.', $filename);
2873
+
2874
+											$arr_file_type = wp_check_filetype($filename);
2875
+											if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) {
2876
+												continue;
2877
+											}
2878
+											$uploaded_file_type = $arr_file_type['type'];
2879
+											$uploaded_file_ext = $arr_file_type['ext'];
2880 2880
                                             
2881
-                                            if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2882
-                                                continue; // Invalid file type.
2883
-                                            }
2884
-
2885
-                                            //$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2886
-                                            $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2887
-
2888
-                                            // If the uploaded file is image
2889
-                                            if (in_array($uploaded_file_type, $image_file_types)) {
2890
-                                                $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2891
-                                                $file_paths .= '<a href="'.$file.'">';
2892
-                                                $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2893
-                                                $file_paths .= '</a>';
2894
-                                                $file_paths .= '</div>';
2895
-                                            } else {
2896
-                                                $ext_path = '_' . $html_var . '_';
2897
-                                                $filename = explode($ext_path, $filename);
2898
-                                                $file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2899
-                                            }
2900
-                                        }
2901
-                                    }
2902
-
2903
-                                    if (strpos($field_icon, 'http') !== false) {
2904
-                                        $field_icon_af = '';
2905
-                                    } else if ($field_icon == '') {
2906
-                                        $field_icon_af = '';
2907
-                                    } else {
2908
-                                        $field_icon_af = $field_icon;
2909
-                                        $field_icon = '';
2910
-                                    }
2911
-
2912
-                                    $geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913
-
2914
-
2915
-                                    $html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2916
-
2917
-                                    if ($field_set_start == 1 && $site_title != '') {
2918
-                                        $html .= ' ' . __($site_title, 'geodirectory') . ': ';
2919
-                                    }
2920
-
2921
-                                    $html .= ' </span>' . $file_paths . '</div>';
2922
-                                }
2923
-                            }
2924
-                        }
2925
-                            break;
2926
-                    }
2927
-
2928
-
2929
-                    /**
2930
-                     * Filter custom field output in tab.
2931
-                     *
2932
-                     * @since 1.5.6
2933
-                     *
2934
-                     * @param string $html_var The HTML variable name for the field.
2935
-                     * @param string $html Custom field unfiltered HTML.
2936
-                     * @param array $variables_array Custom field variables array.
2937
-                     */
2938
-                    $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2939
-
2940
-
2941
-                    if ($field_set_start == 1) {
2942
-                        $add_html = false;
2943
-                        if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2944
-                            if ($fieldset != '') {
2945
-                                $add_html = true;
2946
-                                $label = $fieldset_arr[$fieldset_count - 1]['label'];
2947
-                                $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2948
-                            }
2949
-                            $fieldset_html = $fieldset;
2950
-                            $fieldset = '';
2951
-                        } else {
2952
-                            $fieldset .= $html;
2953
-                            if ($total_fields == $count_field && $fieldset != '') {
2954
-                                $add_html = true;
2955
-                                $label = $fieldset_arr[$fieldset_count]['label'];
2956
-                                $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2957
-                                $fieldset_html = $fieldset;
2958
-                            }
2959
-                        }
2960
-
2961
-                        if ($add_html) {
2962
-                            $tabs_arr[$htmlvar_name] = array(
2963
-                                'heading_text' => __($label, 'geodirectory'),
2964
-                                'is_active_tab' => false,
2965
-                                /**
2966
-                                 * Filter if a custom field should be displayed on the details page tab.
2967
-                                 *
2968
-                                 * @since 1.0.0
2969
-                                 * @param string $htmlvar_name The field HTML var name.
2970
-                                 */
2971
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
-                                'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2973
-                            );
2974
-                        }
2975
-                    } else {
2976
-                        if ($html != '') {
2977
-                            $tabs_arr[$field['htmlvar_name']] = array(
2978
-                                'heading_text' => __($label, 'geodirectory'),
2979
-                                'is_active_tab' => false,
2980
-                                /** This action is documented in geodirectory_hooks_actions.php */
2981
-                                'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2982
-                                'tab_content' => $html
2983
-                            );
2984
-                        }
2985
-                    }
2986
-                }
2987
-            }
2988
-        }
2989
-    }
2990
-    return $tabs_arr;
2881
+											if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) {
2882
+												continue; // Invalid file type.
2883
+											}
2884
+
2885
+											//$allowed_file_types = array('application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'text/csv', 'text/plain');
2886
+											$image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon');
2887
+
2888
+											// If the uploaded file is image
2889
+											if (in_array($uploaded_file_type, $image_file_types)) {
2890
+												$file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">';
2891
+												$file_paths .= '<a href="'.$file.'">';
2892
+												$file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false);
2893
+												$file_paths .= '</a>';
2894
+												$file_paths .= '</div>';
2895
+											} else {
2896
+												$ext_path = '_' . $html_var . '_';
2897
+												$filename = explode($ext_path, $filename);
2898
+												$file_paths .= '<a href="' . $file . '" target="_blank">' . $filename[count($filename) - 1] . '</a>';
2899
+											}
2900
+										}
2901
+									}
2902
+
2903
+									if (strpos($field_icon, 'http') !== false) {
2904
+										$field_icon_af = '';
2905
+									} else if ($field_icon == '') {
2906
+										$field_icon_af = '';
2907
+									} else {
2908
+										$field_icon_af = $field_icon;
2909
+										$field_icon = '';
2910
+									}
2911
+
2912
+									$geodir_odd_even = $field_set_start == 1 && $i % 2 == 0 ? 'geodir_more_info_even' : 'geodir_more_info_odd';
2913
+
2914
+
2915
+									$html = '<div class="geodir_more_info ' . $geodir_odd_even . ' ' . $type['css_class'] . ' ' . $type['htmlvar_name'] . ' geodir-custom-file-box" style="clear:both;"><span class="geodir-i-file" style="display:inline-block;vertical-align:top;padding-right:14px;' . $field_icon . '">' . $field_icon_af;
2916
+
2917
+									if ($field_set_start == 1 && $site_title != '') {
2918
+										$html .= ' ' . __($site_title, 'geodirectory') . ': ';
2919
+									}
2920
+
2921
+									$html .= ' </span>' . $file_paths . '</div>';
2922
+								}
2923
+							}
2924
+						}
2925
+							break;
2926
+					}
2927
+
2928
+
2929
+					/**
2930
+					 * Filter custom field output in tab.
2931
+					 *
2932
+					 * @since 1.5.6
2933
+					 *
2934
+					 * @param string $html_var The HTML variable name for the field.
2935
+					 * @param string $html Custom field unfiltered HTML.
2936
+					 * @param array $variables_array Custom field variables array.
2937
+					 */
2938
+					$html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array);
2939
+
2940
+
2941
+					if ($field_set_start == 1) {
2942
+						$add_html = false;
2943
+						if ($type['type'] == 'fieldset' && $fieldset_count > 1) {
2944
+							if ($fieldset != '') {
2945
+								$add_html = true;
2946
+								$label = $fieldset_arr[$fieldset_count - 1]['label'];
2947
+								$htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name'];
2948
+							}
2949
+							$fieldset_html = $fieldset;
2950
+							$fieldset = '';
2951
+						} else {
2952
+							$fieldset .= $html;
2953
+							if ($total_fields == $count_field && $fieldset != '') {
2954
+								$add_html = true;
2955
+								$label = $fieldset_arr[$fieldset_count]['label'];
2956
+								$htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name'];
2957
+								$fieldset_html = $fieldset;
2958
+							}
2959
+						}
2960
+
2961
+						if ($add_html) {
2962
+							$tabs_arr[$htmlvar_name] = array(
2963
+								'heading_text' => __($label, 'geodirectory'),
2964
+								'is_active_tab' => false,
2965
+								/**
2966
+								 * Filter if a custom field should be displayed on the details page tab.
2967
+								 *
2968
+								 * @since 1.0.0
2969
+								 * @param string $htmlvar_name The field HTML var name.
2970
+								 */
2971
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name),
2972
+								'tab_content' => '<div class="geodir-company_info field-group">' . $fieldset_html . '</html>'
2973
+							);
2974
+						}
2975
+					} else {
2976
+						if ($html != '') {
2977
+							$tabs_arr[$field['htmlvar_name']] = array(
2978
+								'heading_text' => __($label, 'geodirectory'),
2979
+								'is_active_tab' => false,
2980
+								/** This action is documented in geodirectory_hooks_actions.php */
2981
+								'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']),
2982
+								'tab_content' => $html
2983
+							);
2984
+						}
2985
+					}
2986
+				}
2987
+			}
2988
+		}
2989
+	}
2990
+	return $tabs_arr;
2991 2991
 }
2992 2992
 
2993 2993
 /* display add listing page for wpml */
@@ -3011,37 +3011,37 @@  discard block
 block discarded – undo
3011 3011
  */
3012 3012
 function geodir_add_post_status_author_page()
3013 3013
 {
3014
-    global $wpdb, $post;
3015
-
3016
-    $html = '';
3017
-    if (get_current_user_id()) {
3018
-        if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3019
-
3020
-            // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3021
-            $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3022
-            $status = "<strong>(";
3023
-            $status_icon = '<i class="fa fa-play"></i>';
3024
-            if ($real_status == 'publish') {
3025
-                $status .= __('Published', 'geodirectory');
3026
-            } else {
3027
-                $status .= __('Not published', 'geodirectory');
3028
-                $status_icon = '<i class="fa fa-pause"></i>';
3029
-            }
3030
-            $status .= ")</strong>";
3014
+	global $wpdb, $post;
3015
+
3016
+	$html = '';
3017
+	if (get_current_user_id()) {
3018
+		if (geodir_is_page('author') && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) {
3019
+
3020
+			// we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them.
3021
+			$real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID");
3022
+			$status = "<strong>(";
3023
+			$status_icon = '<i class="fa fa-play"></i>';
3024
+			if ($real_status == 'publish') {
3025
+				$status .= __('Published', 'geodirectory');
3026
+			} else {
3027
+				$status .= __('Not published', 'geodirectory');
3028
+				$status_icon = '<i class="fa fa-pause"></i>';
3029
+			}
3030
+			$status .= ")</strong>";
3031 3031
 
3032
-            $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3033
-        }
3034
-    }
3032
+			$html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>';
3033
+		}
3034
+	}
3035 3035
 
3036
-    if ($html != '') {
3037
-        /**
3038
-         * Filter the post status text on the author page.
3039
-         *
3040
-         * @since 1.0.0
3041
-         * @param string $html The HTML of the status.
3042
-         */
3043
-        echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3044
-    }
3036
+	if ($html != '') {
3037
+		/**
3038
+		 * Filter the post status text on the author page.
3039
+		 *
3040
+		 * @since 1.0.0
3041
+		 * @param string $html The HTML of the status.
3042
+		 */
3043
+		echo apply_filters('geodir_filter_status_text_on_author_page', $html);
3044
+	}
3045 3045
 
3046 3046
 
3047 3047
 }
@@ -3055,21 +3055,21 @@  discard block
 block discarded – undo
3055 3055
  */
3056 3056
 function geodir_init_no_rating()
3057 3057
 {
3058
-    if (get_option('geodir_disable_rating')) {
3059
-        remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3060
-        remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3061
-        remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3062
-        remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3063
-        remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3064
-        remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3065
-        remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3066
-
3067
-        add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3068
-        add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3069
-        add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3070
-        add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3071
-        add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3072
-    }
3058
+	if (get_option('geodir_disable_rating')) {
3059
+		remove_action('comment_form_logged_in_after', 'geodir_comment_rating_fields');
3060
+		remove_action('comment_form_before_fields', 'geodir_comment_rating_fields');
3061
+		remove_action('comment_form_logged_in_after', 'geodir_reviewrating_comment_rating_fields');
3062
+		remove_action('comment_form_before_fields', 'geodir_reviewrating_comment_rating_fields');
3063
+		remove_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
3064
+		remove_action('add_meta_boxes', 'geodir_reviewrating_comment_metabox', 13);
3065
+		remove_filter('comment_text', 'geodir_wrap_comment_text', 40);
3066
+
3067
+		add_action('comment_form_logged_in_after', 'geodir_no_rating_rating_fields');
3068
+		add_action('comment_form_before_fields', 'geodir_no_rating_rating_fields');
3069
+		add_filter('comment_text', 'geodir_no_rating_comment_text', 100, 2);
3070
+		add_filter('geodir_detail_page_review_rating_html', 'geodir_no_rating_review_rating_html', 100);
3071
+		add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2);
3072
+	}
3073 3073
 }
3074 3074
 
3075 3075
 /**
@@ -3081,20 +3081,20 @@  discard block
 block discarded – undo
3081 3081
  */
3082 3082
 function geodir_no_rating_rating_fields()
3083 3083
 {
3084
-    global $post;
3084
+	global $post;
3085 3085
 
3086
-    $post_types = geodir_get_posttypes();
3086
+	$post_types = geodir_get_posttypes();
3087 3087
 
3088
-    if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3089
-        if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3090
-            echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3091
-            if (get_option('geodir_reviewrating_enable_images')) {
3092
-                geodir_reviewrating_rating_img_html();
3093
-            }
3094
-        } else {
3095
-            echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3096
-        }
3097
-    }
3088
+	if (!empty($post) && isset($post->post_type) && in_array($post->post_type, $post_types)) {
3089
+		if (is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php')) {
3090
+			echo '<input type="hidden" value="1" name="geodir_rating[overall]" />';
3091
+			if (get_option('geodir_reviewrating_enable_images')) {
3092
+				geodir_reviewrating_rating_img_html();
3093
+			}
3094
+		} else {
3095
+			echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="1" />';
3096
+		}
3097
+	}
3098 3098
 }
3099 3099
 
3100 3100
 /**
@@ -3108,11 +3108,11 @@  discard block
 block discarded – undo
3108 3108
  */
3109 3109
 function geodir_no_rating_comment_text($content, $comment = '')
3110 3110
 {
3111
-    if (!is_admin()) {
3112
-        return '<div class="description">' . $content . '</div>';
3113
-    } else {
3114
-        return $content;
3115
-    }
3111
+	if (!is_admin()) {
3112
+		return '<div class="description">' . $content . '</div>';
3113
+	} else {
3114
+		return $content;
3115
+	}
3116 3116
 }
3117 3117
 
3118 3118
 /**
@@ -3125,7 +3125,7 @@  discard block
 block discarded – undo
3125 3125
  */
3126 3126
 function geodir_no_rating_review_rating_html($content = '')
3127 3127
 {
3128
-    return NULL;
3128
+	return NULL;
3129 3129
 }
3130 3130
 
3131 3131
 /**
@@ -3139,19 +3139,19 @@  discard block
 block discarded – undo
3139 3139
  */
3140 3140
 function geodir_no_rating_get_sort_options($options, $post_type = '')
3141 3141
 {
3142
-    $new_options = array();
3143
-    if (!empty($options)) {
3144
-        foreach ($options as $option) {
3145
-            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3146
-                continue;
3147
-            }
3148
-            $new_options[] = $option;
3149
-        }
3142
+	$new_options = array();
3143
+	if (!empty($options)) {
3144
+		foreach ($options as $option) {
3145
+			if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
3146
+				continue;
3147
+			}
3148
+			$new_options[] = $option;
3149
+		}
3150 3150
 
3151
-        $options = $new_options;
3152
-    }
3151
+		$options = $new_options;
3152
+	}
3153 3153
 
3154
-    return $options;
3154
+	return $options;
3155 3155
 }
3156 3156
 
3157 3157
 add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
@@ -3165,11 +3165,11 @@  discard block
 block discarded – undo
3165 3165
  */
3166 3166
 function geodir_all_js_msg_no_rating($msg = array())
3167 3167
 {
3168
-    if (get_option('geodir_disable_rating')) {
3169
-        $msg['gd_cmt_no_rating'] = true;
3170
-    }
3168
+	if (get_option('geodir_disable_rating')) {
3169
+		$msg['gd_cmt_no_rating'] = true;
3170
+	}
3171 3171
 
3172
-    return $msg;
3172
+	return $msg;
3173 3173
 }
3174 3174
 
3175 3175
 add_filter('body_class', 'geodir_body_class_no_rating', 100);
@@ -3183,11 +3183,11 @@  discard block
 block discarded – undo
3183 3183
  */
3184 3184
 function geodir_body_class_no_rating($classes = array())
3185 3185
 {
3186
-    if (get_option('geodir_disable_rating')) {
3187
-        $classes[] = 'gd-no-rating';
3188
-    }
3186
+	if (get_option('geodir_disable_rating')) {
3187
+		$classes[] = 'gd-no-rating';
3188
+	}
3189 3189
 
3190
-    return $classes;
3190
+	return $classes;
3191 3191
 }
3192 3192
 
3193 3193
 add_filter('admin_body_class', 'geodir_admin_body_class_no_rating', 100);
@@ -3201,11 +3201,11 @@  discard block
 block discarded – undo
3201 3201
  */
3202 3202
 function geodir_admin_body_class_no_rating($class = '')
3203 3203
 {
3204
-    if (get_option('geodir_disable_rating')) {
3205
-        $class .= ' gd-no-rating';
3206
-    }
3204
+	if (get_option('geodir_disable_rating')) {
3205
+		$class .= ' gd-no-rating';
3206
+	}
3207 3207
 
3208
-    return $class;
3208
+	return $class;
3209 3209
 }
3210 3210
 
3211 3211
 add_action('wp_head', 'geodir_wp_head_no_rating');
@@ -3218,10 +3218,10 @@  discard block
 block discarded – undo
3218 3218
  */
3219 3219
 function geodir_wp_head_no_rating()
3220 3220
 {
3221
-    if (get_option('geodir_disable_rating')) {
3222
-        echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3223
-        echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3224
-    }
3221
+	if (get_option('geodir_disable_rating')) {
3222
+		echo '<style>body .geodir-rating, body .geodir-bubble-rating, body .gd_ratings_module_box{display:none!important;}</style>';
3223
+		echo '<script type="text/javascript">jQuery(function(){jQuery(".gd_rating_show").parent(".geodir-rating").remove();});</script>';
3224
+	}
3225 3225
 }
3226 3226
 
3227 3227
 add_filter('geodir_load_db_language', 'geodir_load_custom_field_translation');
@@ -3238,36 +3238,36 @@  discard block
 block discarded – undo
3238 3238
  * @return array Translation texts.
3239 3239
  */
3240 3240
 function geodir_load_gd_options_text_translation($translation_texts = array()) {
3241
-    $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3242
-
3243
-    $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content');
3244
-
3245
-    /**
3246
-     * Filters the geodirectory option names that requires to add for translation.
3247
-     *
3248
-     * @since 1.5.7
3249
-     * @package GeoDirectory
3250
-     *
3251
-     * @param  array $gd_options Array of option names.
3252
-     */
3253
-    $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3254
-    $gd_options = array_unique($gd_options);
3255
-
3256
-    if (!empty($gd_options)) {
3257
-        foreach ($gd_options as $gd_option) {
3258
-            if ($gd_option != '' && $option_value = get_option($gd_option)) {
3259
-                $option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3241
+	$translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array();
3242
+
3243
+	$gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content');
3244
+
3245
+	/**
3246
+	 * Filters the geodirectory option names that requires to add for translation.
3247
+	 *
3248
+	 * @since 1.5.7
3249
+	 * @package GeoDirectory
3250
+	 *
3251
+	 * @param  array $gd_options Array of option names.
3252
+	 */
3253
+	$gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options);
3254
+	$gd_options = array_unique($gd_options);
3255
+
3256
+	if (!empty($gd_options)) {
3257
+		foreach ($gd_options as $gd_option) {
3258
+			if ($gd_option != '' && $option_value = get_option($gd_option)) {
3259
+				$option_value = is_string($option_value) ? stripslashes_deep($option_value) : '';
3260 3260
                 
3261
-                if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3262
-                    $translation_texts[] = stripslashes_deep($option_value);
3263
-                }
3264
-            }
3265
-        }
3266
-    }
3261
+				if ($option_value != '' && !in_array($option_value, $translation_texts)) {
3262
+					$translation_texts[] = stripslashes_deep($option_value);
3263
+				}
3264
+			}
3265
+		}
3266
+	}
3267 3267
 
3268
-    $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3268
+	$translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts;
3269 3269
 
3270
-    return $translation_texts;
3270
+	return $translation_texts;
3271 3271
 }
3272 3272
 
3273 3273
 add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation');
Please login to merge, or discard this patch.
geodirectory-admin/option-pages/create_field.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Creates custom fields
4
- *
5
- * @since 1.0.0
6
- * @package GeoDirectory
7
- */
3
+	 * Creates custom fields
4
+	 *
5
+	 * @since 1.0.0
6
+	 * @package GeoDirectory
7
+	 */
8 8
 
9 9
 $data_type = isset($_REQUEST['data_type']) ? sanitize_text_field($_REQUEST['data_type']) : '';
10 10
 $field_type = isset($_REQUEST['field_type']) ? sanitize_text_field($_REQUEST['field_type']) : '';
@@ -15,95 +15,95 @@  discard block
 block discarded – undo
15 15
 
16 16
 $field_ids = array();
17 17
 if (!empty($_REQUEST['licontainer']) && is_array($_REQUEST['licontainer'])) {
18
-    foreach ($_REQUEST['licontainer'] as $lic_id) {
19
-        $field_ids[] = sanitize_text_field($lic_id);
20
-    }
18
+	foreach ($_REQUEST['licontainer'] as $lic_id) {
19
+		$field_ids[] = sanitize_text_field($lic_id);
20
+	}
21 21
 }
22 22
 
23 23
 /* ------- check nonce field ------- */
24 24
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
25
-    echo godir_set_field_order($field_ids);
25
+	echo godir_set_field_order($field_ids);
26 26
 }
27 27
 
28 28
 if (isset($_REQUEST['update']) && $_REQUEST['update'] == "update" && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
29
-    echo godir_set_sort_field_order($field_ids);
29
+	echo godir_set_sort_field_order($field_ids);
30 30
 }
31 31
 
32 32
 /* ---- Show field form in admin ---- */
33 33
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
34
-    geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
34
+	geodir_custom_field_adminhtml($field_type, $field_id, $field_action);
35 35
 }
36 36
 
37 37
 if ($field_type != '' && $field_id != '' && $field_action == 'new' && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
38
-    geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
38
+	geodir_custom_sort_field_adminhtml($field_type, $field_id, $field_action);
39 39
 }
40 40
 
41 41
 /* ---- Delete field ---- */
42 42
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
43
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
-        return;
43
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
44
+		return;
45 45
     
46
-    echo geodir_custom_field_delete($field_id);
46
+	echo geodir_custom_field_delete($field_id);
47 47
 }
48 48
 
49 49
 if ($field_id != '' && $field_action == 'delete' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
50
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
-        return;
50
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
51
+		return;
52 52
     
53
-    echo geodir_custom_sort_field_delete($field_id);
53
+	echo geodir_custom_sort_field_delete($field_id);
54 54
 }
55 55
 
56 56
 /* ---- Save field  ---- */
57 57
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'custom_fields') {
58
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
-        return;
60
-
61
-    foreach ($_REQUEST as $pkey => $pval) {
62
-        if (is_array($_REQUEST[$pkey])) {
63
-            $tags = 'skip_field';
64
-        } else {
65
-            $tags = '';
66
-        }
67
-
68
-        if ($tags != 'skip_field') {
69
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
-        }
71
-    }
72
-
73
-    $return = geodir_custom_field_save($_REQUEST);
74
-
75
-    if (is_int($return)) {
76
-        $lastid = $return;
77
-        geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
-    } else {
79
-        echo $return;
80
-    }
58
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
59
+		return;
60
+
61
+	foreach ($_REQUEST as $pkey => $pval) {
62
+		if (is_array($_REQUEST[$pkey])) {
63
+			$tags = 'skip_field';
64
+		} else {
65
+			$tags = '';
66
+		}
67
+
68
+		if ($tags != 'skip_field') {
69
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
70
+		}
71
+	}
72
+
73
+	$return = geodir_custom_field_save($_REQUEST);
74
+
75
+	if (is_int($return)) {
76
+		$lastid = $return;
77
+		geodir_custom_field_adminhtml($field_type, $lastid, 'submit');
78
+	} else {
79
+		echo $return;
80
+	}
81 81
 }
82 82
 
83 83
 /* ---- Save sort field  ---- */
84 84
 if ($field_id != '' && $field_action == 'submit' && isset($_REQUEST['_wpnonce']) && isset($_REQUEST['create_field']) && isset($_REQUEST['manage_field_type']) && $_REQUEST['manage_field_type'] == 'sorting_options') {
85
-    if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
-        return;
87
-
88
-    foreach ($_REQUEST as $pkey => $pval) {
89
-        if (is_array($_REQUEST[$pkey])) {
90
-            $tags = 'skip_field';
91
-        } else {
92
-            $tags = '';
93
-        }
94
-
95
-        if ($tags != 'skip_field') {
96
-            $_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
-        }
98
-    }
99
-
100
-    $return = geodir_custom_sort_field_save($_REQUEST);
101
-
102
-    if (is_int($return)) {
103
-        $lastid = $return;
104
-        $default = false;
105
-        geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
-    } else {
107
-        echo $return;
108
-    }
85
+	if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'custom_fields_' . $field_id))
86
+		return;
87
+
88
+	foreach ($_REQUEST as $pkey => $pval) {
89
+		if (is_array($_REQUEST[$pkey])) {
90
+			$tags = 'skip_field';
91
+		} else {
92
+			$tags = '';
93
+		}
94
+
95
+		if ($tags != 'skip_field') {
96
+			$_REQUEST[$pkey] = strip_tags($_REQUEST[$pkey], $tags);
97
+		}
98
+	}
99
+
100
+	$return = geodir_custom_sort_field_save($_REQUEST);
101
+
102
+	if (is_int($return)) {
103
+		$lastid = $return;
104
+		$default = false;
105
+		geodir_custom_sort_field_adminhtml($field_type, $lastid, 'submit', $default);
106
+	} else {
107
+		echo $return;
108
+	}
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/get_markers.php 2 patches
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -7,59 +7,59 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'homemap_catlist') {
10
-    $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11
-    $post_taxonomy = geodir_get_taxonomies($gd_post_type);
12
-    $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
14
-    echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15
-    die;
10
+	$gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11
+	$post_taxonomy = geodir_get_taxonomies($gd_post_type);
12
+	$map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
+	$child_collapse = (bool)$_REQUEST['child_collapse'];
14
+	echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15
+	die;
16 16
 }
17 17
 
18 18
 // Send the content-type header with correct encoding
19 19
 header("Content-type: text/javascript; charset=utf-8");
20 20
 
21 21
 if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'cat') { // Retrives markers data for categories
22
-    echo get_markers();
23
-    exit;
22
+	echo get_markers();
23
+	exit;
24 24
 } else if (isset($_REQUEST['ajax_action']) && $_REQUEST['ajax_action'] == 'info') { // Retrives marker info window html
25
-    /**
26
-     * @global object $wpdb WordPress Database object.
27
-     * @global string $plugin_prefix Geodirectory plugin table prefix.
28
-     * @global object $gd_session GeoDirectory Session object.
29
-     */
30
-    global $wpdb, $plugin_prefix, $gd_session;
31
-
32
-    if ($_REQUEST['m_id'] != '') {
33
-        $pid = (int)$_REQUEST['m_id'];
34
-    } else {
35
-        echo __('No marker data found', 'geodirectory');
36
-        exit;
37
-    }
38
-
39
-    if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
-        $post = (object)$gd_ses_listing;
41
-        echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42
-    } else {
43
-        $geodir_post_type = get_post_type($pid);
44
-
45
-        $table = $plugin_prefix . $geodir_post_type . '_detail';
46
-
47
-        $sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
48
-
49
-        $postinfo = $wpdb->get_results($sql);
50
-
51
-        $data_arr = array();
52
-
53
-        if ($postinfo) {
54
-            $srcharr = array("'", "/", "-", '"', '\\');
55
-            $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
56
-
57
-            foreach ($postinfo as $postinfo_obj) {
58
-                echo geodir_get_infowindow_html($postinfo_obj);
59
-            }
60
-        }
61
-    }
62
-    exit;
25
+	/**
26
+	 * @global object $wpdb WordPress Database object.
27
+	 * @global string $plugin_prefix Geodirectory plugin table prefix.
28
+	 * @global object $gd_session GeoDirectory Session object.
29
+	 */
30
+	global $wpdb, $plugin_prefix, $gd_session;
31
+
32
+	if ($_REQUEST['m_id'] != '') {
33
+		$pid = (int)$_REQUEST['m_id'];
34
+	} else {
35
+		echo __('No marker data found', 'geodirectory');
36
+		exit;
37
+	}
38
+
39
+	if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
+		$post = (object)$gd_ses_listing;
41
+		echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42
+	} else {
43
+		$geodir_post_type = get_post_type($pid);
44
+
45
+		$table = $plugin_prefix . $geodir_post_type . '_detail';
46
+
47
+		$sql = $wpdb->prepare("SELECT * FROM " . $table . " WHERE post_id = %d", array($pid));
48
+
49
+		$postinfo = $wpdb->get_results($sql);
50
+
51
+		$data_arr = array();
52
+
53
+		if ($postinfo) {
54
+			$srcharr = array("'", "/", "-", '"', '\\');
55
+			$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
56
+
57
+			foreach ($postinfo as $postinfo_obj) {
58
+				echo geodir_get_infowindow_html($postinfo_obj);
59
+			}
60
+		}
61
+	}
62
+	exit;
63 63
 }
64 64
 
65 65
 /**
@@ -75,80 +75,80 @@  discard block
 block discarded – undo
75 75
  * @return string
76 76
  */
77 77
 function get_markers() {
78
-    global $wpdb, $plugin_prefix, $geodir_cat_icons;
78
+	global $wpdb, $plugin_prefix, $geodir_cat_icons;
79 79
 
80
-    $search = '';
81
-    $main_query_array;
80
+	$search = '';
81
+	$main_query_array;
82 82
 
83
-    $srcharr = array("'", "/", "-", '"', '\\');
84
-    $replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
83
+	$srcharr = array("'", "/", "-", '"', '\\');
84
+	$replarr = array("&prime;", "&frasl;", "&ndash;", "&ldquo;", '');
85 85
 
86
-    $post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
86
+	$post_type = isset($_REQUEST['gd_posttype']) ? $_REQUEST['gd_posttype'] : 'gd_place';
87 87
 
88
-    $map_cat_ids_array = array('0');
89
-    $cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
88
+	$map_cat_ids_array = array('0');
89
+	$cat_find_array = array(" FIND_IN_SET(%d, pd." . $post_type . "category)");
90 90
 
91 91
 
92
-    $field_default_cat = '';
93
-    if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
94
-        $map_cat_arr = trim($_REQUEST['cat_id'], ',');
92
+	$field_default_cat = '';
93
+	if (isset($_REQUEST['cat_id']) && $_REQUEST['cat_id'] != '') {
94
+		$map_cat_arr = trim($_REQUEST['cat_id'], ',');
95 95
 
96
-        if (!empty($map_cat_arr)) {
97
-            $field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
96
+		if (!empty($map_cat_arr)) {
97
+			$field_default_cat .= "WHEN (default_category IN (" . $map_cat_arr . ")) THEN default_category ";
98 98
 
99
-            $map_cat_ids_array = explode(',', $map_cat_arr);
100
-            $cat_find_array = array();
101
-            foreach ($map_cat_ids_array as $cat_id) {
102
-                $field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
103
-                $cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
104
-                $main_query_array[] = $cat_id;
105
-            }
99
+			$map_cat_ids_array = explode(',', $map_cat_arr);
100
+			$cat_find_array = array();
101
+			foreach ($map_cat_ids_array as $cat_id) {
102
+				$field_default_cat .= "WHEN (FIND_IN_SET($cat_id, `" . $post_type . "category`) > 0) THEN $cat_id ";
103
+				$cat_find_array[] = " FIND_IN_SET(%d, pd." . $post_type . "category)";
104
+				$main_query_array[] = $cat_id;
105
+			}
106 106
 
107
-        }
108
-    }
107
+		}
108
+	}
109 109
 
110
-    if (!empty($field_default_cat))
111
-        $field_default_cat = '';
110
+	if (!empty($field_default_cat))
111
+		$field_default_cat = '';
112 112
 
113
-    if (!empty($cat_find_array))
114
-        $search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
113
+	if (!empty($cat_find_array))
114
+		$search .= "AND (" . implode(' OR ', $cat_find_array) . ")";
115 115
 
116
-    $main_query_array = $map_cat_ids_array;
116
+	$main_query_array = $map_cat_ids_array;
117 117
   
118
-    if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
119
-        $search .= " AND p.post_title LIKE %s";
120
-        $main_query_array[] = "%" . $_REQUEST['search'] . "%";
121
-    }
122
-
123
-    /**
124
-     * Filter the marker query search SQL, values are replaces with %s or %d.
125
-     *
126
-     * @since 1.5.3
127
-     *
128
-     * @param string $search The SQL query for search/where.
129
-     */
130
-    $search = apply_filters('geodir_marker_search', $search);
131
-    /**
132
-     * Filter the marker query search SQL values %s and %d, this is an array of values.
133
-     *
134
-     * @since 1.5.3
135
-     *
136
-     * @param array $main_query_array The SQL query values for search/where.
137
-     */
138
-    $main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
139
-
140
-    $gd_posttype = '';
141
-    if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
142
-        $table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
143
-        $gd_posttype = " AND p.post_type = %s";
144
-        $main_query_array[] = $_REQUEST['gd_posttype'];
145
-
146
-    } else
147
-        $table = $plugin_prefix . 'gd_place_detail';
148
-
149
-    $join = ", " . $table . " AS pd ";
150
-
151
-    /**
118
+	if (isset($_REQUEST['search']) && !empty($_REQUEST['search']) && $_REQUEST['search'] != __('Title', 'geodirectory')) {
119
+		$search .= " AND p.post_title LIKE %s";
120
+		$main_query_array[] = "%" . $_REQUEST['search'] . "%";
121
+	}
122
+
123
+	/**
124
+	 * Filter the marker query search SQL, values are replaces with %s or %d.
125
+	 *
126
+	 * @since 1.5.3
127
+	 *
128
+	 * @param string $search The SQL query for search/where.
129
+	 */
130
+	$search = apply_filters('geodir_marker_search', $search);
131
+	/**
132
+	 * Filter the marker query search SQL values %s and %d, this is an array of values.
133
+	 *
134
+	 * @since 1.5.3
135
+	 *
136
+	 * @param array $main_query_array The SQL query values for search/where.
137
+	 */
138
+	$main_query_array = apply_filters('geodir_marker_main_query_array', $main_query_array);
139
+
140
+	$gd_posttype = '';
141
+	if (isset($_REQUEST['gd_posttype']) && $_REQUEST['gd_posttype'] != '') {
142
+		$table = $plugin_prefix . $_REQUEST['gd_posttype'] . '_detail';
143
+		$gd_posttype = " AND p.post_type = %s";
144
+		$main_query_array[] = $_REQUEST['gd_posttype'];
145
+
146
+	} else
147
+		$table = $plugin_prefix . 'gd_place_detail';
148
+
149
+	$join = ", " . $table . " AS pd ";
150
+
151
+	/**
152 152
 	 * Filter the SQL JOIN clause for the markers data
153 153
 	 *
154 154
 	 * @since 1.0.0
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 * @param string $search Row of searched fields to use in WHERE clause.
166 166
 	 */
167 167
 	$search = apply_filters('geodir_home_map_listing_where', $search);
168
-    $search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
169
-    $cat_type = $post_type . 'category';
170
-    if ($post_type == 'gd_event') {
171
-        $event_select = ", pd.recurring_dates, pd.is_recurring";
172
-    } else {
173
-        $event_select = "";
174
-    }
175
-
176
-    $sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
177
-    /**
168
+	$search = str_replace(array("'%", "%'"), array("'%%", "%%'"), $search);
169
+	$cat_type = $post_type . 'category';
170
+	if ($post_type == 'gd_event') {
171
+		$event_select = ", pd.recurring_dates, pd.is_recurring";
172
+	} else {
173
+		$event_select = "";
174
+	}
175
+
176
+	$sql_select = 'SELECT pd.default_category, pd.' . $cat_type . ', pd.post_title, pd.post_id, pd.post_latitude, pd.post_longitude' . $event_select;
177
+	/**
178 178
 	 * Filter the SQL SELECT clause to retrive fields data
179 179
 	 *
180 180
 	 * @since 1.0.0
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
195 195
 
196
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
196
+	$catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
197 197
     
198 198
 	/**
199 199
 	 * Filter the SQL query to retrive markers data
@@ -205,112 +205,112 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	$catsql = apply_filters('geodir_home_map_listing_query', $catsql, $search);
207 207
 	
208
-    $catinfo = $wpdb->get_results($catsql);
208
+	$catinfo = $wpdb->get_results($catsql);
209 209
 	
210
-    $cat_content_info = array();
211
-    $content_data = array();
212
-    $post_ids = array();
213
-
214
-    /**
215
-     * Called before marker data is processed into JSON.
216
-     *
217
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
218
-     *
219
-     * @since 1.5.3
220
-     * @param object $catinfo The posts object containing all marker data.
221
-     * @see 'geodir_after_marker_post_process'
222
-     */
223
-    $catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
224
-
225
-    /**
226
-     * Called before marker data is processed into JSON.
227
-     *
228
-     * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
229
-     *
230
-     * @since 1.4.9
231
-     * @param object $catinfo The posts object containing all marker data.
232
-     * @see 'geodir_after_marker_post_process'
233
-     */
234
-    do_action('geodir_before_marker_post_process_action', $catinfo);
235
-
236
-    // Sort any posts into a ajax array
237
-    if (!empty($catinfo)) {
238
-        $geodir_cat_icons = geodir_get_term_icon();
239
-        global $geodir_date_format;
240
-
241
-        $today = strtotime(date_i18n('Y-m-d'));
210
+	$cat_content_info = array();
211
+	$content_data = array();
212
+	$post_ids = array();
213
+
214
+	/**
215
+	 * Called before marker data is processed into JSON.
216
+	 *
217
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
218
+	 *
219
+	 * @since 1.5.3
220
+	 * @param object $catinfo The posts object containing all marker data.
221
+	 * @see 'geodir_after_marker_post_process'
222
+	 */
223
+	$catinfo = apply_filters('geodir_before_marker_post_process', $catinfo);
224
+
225
+	/**
226
+	 * Called before marker data is processed into JSON.
227
+	 *
228
+	 * Called before marker data is processed into JSON, this action can be used to change the format or add/remove markers.
229
+	 *
230
+	 * @since 1.4.9
231
+	 * @param object $catinfo The posts object containing all marker data.
232
+	 * @see 'geodir_after_marker_post_process'
233
+	 */
234
+	do_action('geodir_before_marker_post_process_action', $catinfo);
235
+
236
+	// Sort any posts into a ajax array
237
+	if (!empty($catinfo)) {
238
+		$geodir_cat_icons = geodir_get_term_icon();
239
+		global $geodir_date_format;
240
+
241
+		$today = strtotime(date_i18n('Y-m-d'));
242 242
         
243
-        foreach ($catinfo as $catinfo_obj) {
244
-            $post_title = $catinfo_obj->post_title;
243
+		foreach ($catinfo as $catinfo_obj) {
244
+			$post_title = $catinfo_obj->post_title;
245 245
             
246
-            if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
247
-                $event_dates = '';
248
-                $recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
246
+			if ($post_type == 'gd_event' && !empty($catinfo_obj->recurring_dates)) {
247
+				$event_dates = '';
248
+				$recurring_data = isset($catinfo_obj->recurring_dates) ? maybe_unserialize($catinfo_obj->recurring_dates) : array();
249 249
                 
250
-                $post_info = geodir_get_post_info($catinfo_obj->post_id);
251
-                if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
252
-                    $recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
250
+				$post_info = geodir_get_post_info($catinfo_obj->post_id);
251
+				if (!empty($catinfo_obj->is_recurring) && !empty($recurring_data) && !empty($recurring_data['is_recurring']) && geodir_event_recurring_pkg($post_info)) {
252
+					$recurring_dates = explode(',', $recurring_data['event_recurring_dates']);
253 253
                     
254
-                    if (!empty($recurring_dates)) {					
255
-                        $e = 0;
256
-                        foreach ($recurring_dates as $date) {
257
-                            if (strtotime($date) >= $today) {
258
-                                $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
254
+					if (!empty($recurring_dates)) {					
255
+						$e = 0;
256
+						foreach ($recurring_dates as $date) {
257
+							if (strtotime($date) >= $today) {
258
+								$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($date));
259 259
                                 
260
-                                $e++;
261
-                                if ($e == 3) { // only show 3 event dates
262
-                                    break;
263
-                                }
264
-                            }
265
-                        }
266
-                    }
267
-                } else {
268
-                    $start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
269
-                    $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
260
+								$e++;
261
+								if ($e == 3) { // only show 3 event dates
262
+									break;
263
+								}
264
+							}
265
+						}
266
+					}
267
+				} else {
268
+					$start_date = !empty($recurring_data['event_start']) && $recurring_data['event_start'] != '0000-00-00 00:00:00' ? $recurring_data['event_start'] : '';
269
+					$end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
270 270
                 
271
-                    if ($end_date != '' && strtotime($end_date) >= $today) {
272
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
273
-                    }
274
-                }
275
-
276
-                if (empty($event_dates)) {
277
-                    continue;
278
-                }
271
+					if ($end_date != '' && strtotime($end_date) >= $today) {
272
+						$event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
273
+					}
274
+				}
275
+
276
+				if (empty($event_dates)) {
277
+					continue;
278
+				}
279 279
                 
280
-                $post_title .= $event_dates;
281
-            }
282
-
283
-            $icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
284
-            $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
285
-            $title = str_replace($srcharr, $replarr, $post_title);
286
-
287
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}';
288
-            $post_ids[] = $catinfo_obj->post_id;
289
-        }
290
-    }
291
-
292
-    /**
293
-     * Called after marker data is processed into JSON.
294
-     *
295
-     * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
296
-     *
297
-     * @since 1.4.9
298
-     * @param array $content_data The array containing all markers in JSON format.
299
-     * @param object $catinfo The posts object containing all marker data.
300
-     * @see 'geodir_before_marker_post_process'
301
-     */
302
-    do_action('geodir_after_marker_post_process', $content_data, $catinfo);
303
-
304
-    if (!empty($content_data)) {
305
-        $cat_content_info[] = implode(',', $content_data);
306
-    }
307
-
308
-    $totalcount = count(array_unique($post_ids));
309
-
310
-    if (!empty($cat_content_info)) {
311
-        return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
312
-    }
313
-    else {
314
-        return '[{"totalcount":"0"}]';
315
-    }
280
+				$post_title .= $event_dates;
281
+			}
282
+
283
+			$icon = !empty($geodir_cat_icons) && isset($geodir_cat_icons[$catinfo_obj->default_category]) ? $geodir_cat_icons[$catinfo_obj->default_category] : '';
284
+			$mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
285
+			$title = str_replace($srcharr, $replarr, $post_title);
286
+
287
+			$content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}';
288
+			$post_ids[] = $catinfo_obj->post_id;
289
+		}
290
+	}
291
+
292
+	/**
293
+	 * Called after marker data is processed into JSON.
294
+	 *
295
+	 * Called after marker data is processed into JSON, this action can be used to change the format or add/remove markers.
296
+	 *
297
+	 * @since 1.4.9
298
+	 * @param array $content_data The array containing all markers in JSON format.
299
+	 * @param object $catinfo The posts object containing all marker data.
300
+	 * @see 'geodir_before_marker_post_process'
301
+	 */
302
+	do_action('geodir_after_marker_post_process', $content_data, $catinfo);
303
+
304
+	if (!empty($content_data)) {
305
+		$cat_content_info[] = implode(',', $content_data);
306
+	}
307
+
308
+	$totalcount = count(array_unique($post_ids));
309
+
310
+	if (!empty($cat_content_info)) {
311
+		return '[{"totalcount":"' . $totalcount . '",' . substr(implode(',', $cat_content_info), 1) . ']';
312
+	}
313
+	else {
314
+		return '[{"totalcount":"0"}]';
315
+	}
316 316
 }
317 317
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
     $gd_post_type = sanitize_text_field($_REQUEST['post_type']);
11 11
     $post_taxonomy = geodir_get_taxonomies($gd_post_type);
12 12
     $map_canvas_name = sanitize_text_field($_REQUEST['map_canvas']);
13
-    $child_collapse = (bool)$_REQUEST['child_collapse'];
13
+    $child_collapse = (bool) $_REQUEST['child_collapse'];
14 14
     echo home_map_taxonomy_walker($post_taxonomy, 0, true, 0, $map_canvas_name, $child_collapse, true);
15 15
     die;
16 16
 }
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
     global $wpdb, $plugin_prefix, $gd_session;
31 31
 
32 32
     if ($_REQUEST['m_id'] != '') {
33
-        $pid = (int)$_REQUEST['m_id'];
33
+        $pid = (int) $_REQUEST['m_id'];
34 34
     } else {
35 35
         echo __('No marker data found', 'geodirectory');
36 36
         exit;
37 37
     }
38 38
 
39 39
     if (isset($_REQUEST['post_preview']) && $_REQUEST['post_preview'] != '' && $gd_ses_listing = $gd_session->get('listing')) {
40
-        $post = (object)$gd_ses_listing;
40
+        $post = (object) $gd_ses_listing;
41 41
         echo geodir_get_infowindow_html($post, $_REQUEST['post_preview']);
42 42
     } else {
43 43
         $geodir_post_type = get_post_type($pid);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	$groupby = apply_filters('geodir_home_map_listing_groupby', $groupby);
195 195
 
196
-    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby , $main_query_array);
196
+    $catsql = $wpdb->prepare("$select $field_default_cat FROM " . $wpdb->posts . " as p" . $join . " WHERE p.ID = pd.post_id AND p.post_status = 'publish' " . $search . $gd_posttype . $groupby, $main_query_array);
197 197
     
198 198
 	/**
199 199
 	 * Filter the SQL query to retrive markers data
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                     $end_date = !empty($recurring_data['event_end']) && $recurring_data['event_end'] != '0000-00-00 00:00:00' ? $recurring_data['event_end'] : $start_date;
270 270
                 
271 271
                     if ($end_date != '' && strtotime($end_date) >= $today) {
272
-                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) .' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
272
+                        $event_dates .= ' :: ' . date_i18n($geodir_date_format, strtotime($start_date)) . ' -> ' . date_i18n($geodir_date_format, strtotime($end_date));
273 273
                     }
274 274
                 }
275 275
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
             $mark_extra = (isset($catinfo_obj->marker_extra)) ? $catinfo_obj->marker_extra : '';
285 285
             $title = str_replace($srcharr, $replarr, $post_title);
286 286
 
287
-            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"'.$mark_extra.'}';
287
+            $content_data[] = '{"id":"' . $catinfo_obj->post_id . '","t": "' . $title . '","lt": "' . $catinfo_obj->post_latitude . '","ln": "' . $catinfo_obj->post_longitude . '","mk_id":"' . $catinfo_obj->post_id . '_' . $catinfo_obj->default_category . '","i":"' . $icon . '"' . $mark_extra . '}';
288 288
             $post_ids[] = $catinfo_obj->post_id;
289 289
         }
290 290
     }
Please login to merge, or discard this patch.