Test Failed
Push — master ( c225a4...a5e425 )
by Stiofan
05:24
created
geodirectory-functions/comments_functions.php 2 patches
Indentation   +471 added lines, -471 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function geodir_comment_meta_row_action($a)
33 33
 {
34
-    global $comment;
34
+	global $comment;
35 35
 
36
-    $rating = geodir_get_commentoverall($comment->comment_ID);
37
-    if ($rating != 0) {
38
-        echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
-    }
40
-    return $a;
36
+	$rating = geodir_get_commentoverall($comment->comment_ID);
37
+	if ($rating != 0) {
38
+		echo geodir_get_rating_stars($rating, $comment->comment_ID);
39
+	}
40
+	return $a;
41 41
 }
42 42
 
43 43
 add_action('add_meta_boxes_comment', 'geodir_comment_add_meta_box');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  */
53 53
 function geodir_comment_add_meta_box($comment)
54 54
 {
55
-    add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
55
+	add_meta_box('gd-comment-rating', __('Comment Rating', 'geodirectory'), 'geodir_comment_rating_meta', 'comment', 'normal', 'high');
56 56
 }
57 57
 
58 58
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
  * @param object $comment The comment object.
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69
-    $post_type = get_post_type($comment->comment_post_ID);
69
+	$post_type = get_post_type($comment->comment_post_ID);
70 70
 	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
@@ -106,24 +106,24 @@  discard block
 block discarded – undo
106 106
  * @global object $post The post object.
107 107
  */
108 108
 function geodir_comment_rating_fields() {
109
-    global $post;
109
+	global $post;
110 110
 
111
-    $post_types = geodir_get_posttypes();
111
+	$post_types = geodir_get_posttypes();
112 112
 
113
-    if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
-        $star_texts = array();
115
-        $star_texts[] = __('Terrible', 'geodirectory');
116
-        $star_texts[] = __('Poor', 'geodirectory');
117
-        $star_texts[] = __('Average', 'geodirectory');
118
-        $star_texts[] = __('Very Good', 'geodirectory');
119
-        $star_texts[] = __('Excellent', 'geodirectory');
113
+	if (!empty($post->post_type) && in_array($post->post_type, $post_types) && !(!empty($post->post_type) && geodir_cpt_has_rating_disabled($post->post_type))) {
114
+		$star_texts = array();
115
+		$star_texts[] = __('Terrible', 'geodirectory');
116
+		$star_texts[] = __('Poor', 'geodirectory');
117
+		$star_texts[] = __('Average', 'geodirectory');
118
+		$star_texts[] = __('Very Good', 'geodirectory');
119
+		$star_texts[] = __('Excellent', 'geodirectory');
120 120
         
121
-        $gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
-        echo $gd_rating_html;
123
-        ?>
121
+		$gd_rating_html = apply_filters('gd_rating_form_html', '<div class="gd_rating" data-average="0" data-id="5"></div>', $star_texts);
122
+		echo $gd_rating_html;
123
+		?>
124 124
         <input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="0"/>
125 125
         <?php
126
-    }
126
+	}
127 127
 }
128 128
 
129 129
 add_filter('comment_reply_link', 'geodir_comment_replaylink');
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 function geodir_comment_replaylink($link)
140 140
 {
141 141
 
142
-    if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
-    }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
142
+	if (strpos($link, 'wp-login.php?') !== false) {
143
+		$link = str_replace(wp_login_url(),geodir_login_url(),$link);
144
+	}
145
+	$link = '<div class="gd_comment_replaylink">' . $link . '</div>';
146 146
 
147
-    return $link;
147
+	return $link;
148 148
 }
149 149
 
150 150
 add_filter('cancel_comment_reply_link', 'geodir_cancle_replaylink');
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+	$link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
163 163
 
164
-    return $link;
164
+	return $link;
165 165
 }
166 166
 
167 167
 add_action('comment_post', 'geodir_save_rating');
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
  */
178 178
 function geodir_save_rating($comment = 0)
179 179
 {
180
-    global $wpdb, $user_ID, $plugin_prefix;
180
+	global $wpdb, $user_ID, $plugin_prefix;
181 181
 
182
-    $comment_info = get_comment($comment);
182
+	$comment_info = get_comment($comment);
183 183
 
184
-    $post_id = $comment_info->comment_post_ID;
185
-    $status = $comment_info->comment_approved;
186
-    $rating_ip = getenv("REMOTE_ADDR");
184
+	$post_id = $comment_info->comment_post_ID;
185
+	$status = $comment_info->comment_approved;
186
+	$rating_ip = getenv("REMOTE_ADDR");
187 187
 	
188
-    $post = geodir_get_post_info($post_id);
189
-    if (empty($post)) {
190
-        return;
191
-    }
192
-
193
-    if ($post->post_status == 'publish') {
194
-        $post_status = '1';
195
-    } else {
196
-        $post_status = '0';
197
-    }
188
+	$post = geodir_get_post_info($post_id);
189
+	if (empty($post)) {
190
+		return;
191
+	}
192
+
193
+	if ($post->post_status == 'publish') {
194
+		$post_status = '1';
195
+	} else {
196
+		$post_status = '0';
197
+	}
198 198
 	
199
-    if (isset($_REQUEST['geodir_overallrating'])) {
200
-        $overall_rating = $_REQUEST['geodir_overallrating'];
199
+	if (isset($_REQUEST['geodir_overallrating'])) {
200
+		$overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202 202
 		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
203
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
203
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+			$sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 					post_latitude	= %s,
221 221
 					comment_content	= %s 
222 222
 					",
223
-                array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
-            );
225
-
226
-            $wpdb->query($sqlqry);
227
-
228
-            /**
229
-             * Called after saving the comment.
230
-             *
231
-             * @since 1.0.0
232
-             * @package GeoDirectory
233
-             * @param array $_REQUEST {
234
-             *    Attributes of the $_REQUEST variable.
235
-             *
236
-             *    @type string $geodir_overallrating Overall rating.
237
-             *    @type string $comment Comment text.
238
-             *    @type string $submit Submit button text.
239
-             *    @type string $comment_post_ID Comment post ID.
240
-             *    @type string $comment_parent Comment Parent ID.
241
-             *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
-             *
243
-             * }
244
-             */
245
-            do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
-
247
-            if ($status) {
248
-                geodir_update_postrating($post_id);
249
-            }
250
-        }
251
-    }
223
+				array($post_id, $post->post_type, $post->post_title, $user_ID, $comment, $rating_ip, $overall_rating, $status, $post_status, date_i18n('Y-m-d H:i:s', current_time('timestamp')), $post->post_city, $post->post_region, $post->post_country, $post->post_latitude, $post->post_longitude, $comment_info->comment_content)
224
+			);
225
+
226
+			$wpdb->query($sqlqry);
227
+
228
+			/**
229
+			 * Called after saving the comment.
230
+			 *
231
+			 * @since 1.0.0
232
+			 * @package GeoDirectory
233
+			 * @param array $_REQUEST {
234
+			 *    Attributes of the $_REQUEST variable.
235
+			 *
236
+			 *    @type string $geodir_overallrating Overall rating.
237
+			 *    @type string $comment Comment text.
238
+			 *    @type string $submit Submit button text.
239
+			 *    @type string $comment_post_ID Comment post ID.
240
+			 *    @type string $comment_parent Comment Parent ID.
241
+			 *    @type string $_wp_unfiltered_html_comment Unfiltered html comment string.
242
+			 *
243
+			 * }
244
+			 */
245
+			do_action('geodir_after_save_comment', $_REQUEST, 'Comment Your Post');
246
+
247
+			if ($status) {
248
+				geodir_update_postrating($post_id);
249
+			}
250
+		}
251
+	}
252 252
 }
253 253
 
254 254
 
@@ -266,51 +266,51 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function geodir_update_rating_status_change($comment_id, $status)
268 268
 {
269
-    if ($status == 'delete') {
270
-        return;
271
-    }
272
-    global $wpdb, $plugin_prefix, $user_ID;
269
+	if ($status == 'delete') {
270
+		return;
271
+	}
272
+	global $wpdb, $plugin_prefix, $user_ID;
273 273
 
274
-    $comment_info = get_comment($comment_id);
274
+	$comment_info = get_comment($comment_id);
275 275
 
276
-    $post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
276
+	$post_id = isset($comment_info->comment_post_ID) ? $comment_info->comment_post_ID : '';
277 277
 
278
-    if (!empty($comment_info))
279
-        $status = $comment_info->comment_approved;
278
+	if (!empty($comment_info))
279
+		$status = $comment_info->comment_approved;
280 280
 
281
-    if ($status == 'approve' || $status == 1) {
282
-        $status = 1;
283
-    } else {
284
-        $status = 0;
285
-    }
281
+	if ($status == 'approve' || $status == 1) {
282
+		$status = 1;
283
+	} else {
284
+		$status = 0;
285
+	}
286 286
 
287
-    $comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
-    $old_rating = geodir_get_commentoverall($comment_info_ID);
287
+	$comment_info_ID = isset($comment_info->comment_ID) ? $comment_info->comment_ID : '';
288
+	$old_rating = geodir_get_commentoverall($comment_info_ID);
289 289
 
290
-    $post_type = get_post_type($post_id);
290
+	$post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+	$detail_table = $plugin_prefix . $post_type . '_detail';
293 293
 
294
-    if ($comment_id) {
294
+	if ($comment_id) {
295 295
 
296
-        $overall_rating = $old_rating;
296
+		$overall_rating = $old_rating;
297 297
 
298
-        if (isset($old_rating)) {
298
+		if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+			$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
304 304
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
305 305
 
306
-            $wpdb->query($sqlqry);
306
+			$wpdb->query($sqlqry);
307 307
 
308
-            //update rating
309
-            geodir_update_postrating($post_id, $post_type);
308
+			//update rating
309
+			geodir_update_postrating($post_id, $post_type);
310 310
 
311
-        }
311
+		}
312 312
 
313
-    }
313
+	}
314 314
 
315 315
 }
316 316
 
@@ -329,41 +329,41 @@  discard block
 block discarded – undo
329 329
 function geodir_update_rating($comment_id = 0)
330 330
 {
331 331
 
332
-    global $wpdb, $plugin_prefix, $user_ID;
332
+	global $wpdb, $plugin_prefix, $user_ID;
333 333
 
334
-    $comment_info = get_comment($comment_id);
334
+	$comment_info = get_comment($comment_id);
335 335
 
336
-    $post_id = $comment_info->comment_post_ID;
337
-    $status = $comment_info->comment_approved;
338
-    $old_rating = geodir_get_commentoverall($comment_info->comment_ID);
336
+	$post_id = $comment_info->comment_post_ID;
337
+	$status = $comment_info->comment_approved;
338
+	$old_rating = geodir_get_commentoverall($comment_info->comment_ID);
339 339
 
340
-    $post_type = get_post_type($post_id);
340
+	$post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+	$detail_table = $plugin_prefix . $post_type . '_detail';
343 343
 
344
-    if (isset($_REQUEST['geodir_overallrating'])) {
344
+	if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346
-        $overall_rating = $_REQUEST['geodir_overallrating'];
346
+		$overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
-            $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
348
+		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
349
+			$overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351
-            if (isset($old_rating)) {
351
+			if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+				$sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
357 357
 						WHERE comment_id = %d ", array($overall_rating, $status, $comment_info->comment_content, $comment_id));
358 358
 
359
-                $wpdb->query($sqlqry);
359
+				$wpdb->query($sqlqry);
360 360
 
361
-                //update rating
362
-                geodir_update_postrating($post_id, $post_type);
361
+				//update rating
362
+				geodir_update_postrating($post_id, $post_type);
363 363
 
364
-            }
365
-        }
366
-    }
364
+			}
365
+		}
366
+	}
367 367
 
368 368
 
369 369
 }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
  */
380 380
 function geodir_comment_delete_comment($comment_id)
381 381
 {
382
-    global $wpdb;
382
+	global $wpdb;
383 383
 
384
-    $review_info = geodir_get_review($comment_id);
385
-    if ($review_info) {
386
-        geodir_update_postrating($review_info->post_id);
387
-    }
384
+	$review_info = geodir_get_review($comment_id);
385
+	if ($review_info) {
386
+		geodir_update_postrating($review_info->post_id);
387
+	}
388 388
 
389
-    $wpdb->query(
390
-        $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
-            array($comment_id)
393
-        )
394
-    );
389
+	$wpdb->query(
390
+		$wpdb->prepare(
391
+			"DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
392
+			array($comment_id)
393
+		)
394
+	);
395 395
 
396 396
 }
397 397
 
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
-        if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
413
-        } else {
414
-            return $content;
415
-        }
416
-    } else {
417
-        $rating = 0;
418
-        if (!empty($comment))
419
-            $rating = geodir_get_commentoverall($comment->comment_ID);
420
-        if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
-        } else
423
-            return $content;
424
-    }
410
+	if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
411
+		if (!is_admin()) {
412
+			return '<div class="description">' . $content . '</div>';
413
+		} else {
414
+			return $content;
415
+		}
416
+	} else {
417
+		$rating = 0;
418
+		if (!empty($comment))
419
+			$rating = geodir_get_commentoverall($comment->comment_ID);
420
+		if ($rating != 0 && !is_admin()) {
421
+			return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
422
+		} else
423
+			return $content;
424
+	}
425 425
 }
426 426
 
427 427
 
@@ -438,41 +438,41 @@  discard block
 block discarded – undo
438 438
  */
439 439
 function geodir_update_postrating($post_id = 0, $post_type = '', $delete = false)
440 440
 {
441
-    global $wpdb, $plugin_prefix, $comment;
442
-    if (!$post_type) {
443
-        $post_type = get_post_type($post_id);
444
-    }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
446
-    $post_newrating = geodir_get_post_rating($post_id, 1);
447
-    $post_newrating_count = geodir_get_review_count_total($post_id);
441
+	global $wpdb, $plugin_prefix, $comment;
442
+	if (!$post_type) {
443
+		$post_type = get_post_type($post_id);
444
+	}
445
+	$detail_table = $plugin_prefix . $post_type . '_detail';
446
+	$post_newrating = geodir_get_post_rating($post_id, 1);
447
+	$post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450
-    //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
450
+	//$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
453 453
 
454
-        $wpdb->query(
455
-            $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
454
+		$wpdb->query(
455
+			$wpdb->prepare(
456
+				"UPDATE " . $detail_table . " SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
460
-                array($post_newrating, $post_newrating_count, $post_id)
461
-            )
462
-        );
463
-
464
-        update_post_meta($post_id, 'overall_rating', $post_newrating);
465
-        update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
-    }
467
-    /**
468
-     * Called after Updating post overall rating and rating count.
469
-     *
470
-     * @since 1.0.0
471
-     * @since 1.4.3 Added `$post_id` param.
472
-     * @package GeoDirectory
473
-     * @param int $post_id The post ID.
474
-     */
475
-    do_action('geodir_update_postrating',$post_id);
460
+				array($post_newrating, $post_newrating_count, $post_id)
461
+			)
462
+		);
463
+
464
+		update_post_meta($post_id, 'overall_rating', $post_newrating);
465
+		update_post_meta($post_id, 'rating_count', $post_newrating_count);
466
+	}
467
+	/**
468
+	 * Called after Updating post overall rating and rating count.
469
+	 *
470
+	 * @since 1.0.0
471
+	 * @since 1.4.3 Added `$post_id` param.
472
+	 * @package GeoDirectory
473
+	 * @param int $post_id The post ID.
474
+	 */
475
+	do_action('geodir_update_postrating',$post_id);
476 476
 
477 477
 }
478 478
 
@@ -490,29 +490,29 @@  discard block
 block discarded – undo
490 490
  */
491 491
 function geodir_get_postoverall($post_id = 0)
492 492
 {
493
-    global $wpdb, $plugin_prefix;
493
+	global $wpdb, $plugin_prefix;
494 494
 
495
-    $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
495
+	$post_type = get_post_type($post_id);
496
+	$detail_table = $plugin_prefix . $post_type . '_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+	if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
499 499
 
500
-        $post_ratings = $wpdb->get_var(
501
-            $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
-                array($post_id)
504
-            )
505
-        );
500
+		$post_ratings = $wpdb->get_var(
501
+			$wpdb->prepare(
502
+				"SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
503
+				array($post_id)
504
+			)
505
+		);
506 506
 
507 507
 
508
-    } else {
509
-        $post_ratings = get_post_meta($post_id, 'overall_rating');
510
-    }
508
+	} else {
509
+		$post_ratings = get_post_meta($post_id, 'overall_rating');
510
+	}
511 511
 
512
-    if ($post_ratings)
513
-        return $post_ratings;
514
-    else
515
-        return false;
512
+	if ($post_ratings)
513
+		return $post_ratings;
514
+	else
515
+		return false;
516 516
 }
517 517
 
518 518
 
@@ -529,19 +529,19 @@  discard block
 block discarded – undo
529 529
  */
530 530
 function geodir_get_review($comment_id = 0)
531 531
 {
532
-    global $wpdb;
533
-
534
-    $reatings = $wpdb->get_row(
535
-        $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
-            array($comment_id)
538
-        )
539
-    );
540
-
541
-    if (!empty($reatings))
542
-        return $reatings;
543
-    else
544
-        return false;
532
+	global $wpdb;
533
+
534
+	$reatings = $wpdb->get_row(
535
+		$wpdb->prepare(
536
+			"SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
537
+			array($comment_id)
538
+		)
539
+	);
540
+
541
+	if (!empty($reatings))
542
+		return $reatings;
543
+	else
544
+		return false;
545 545
 }
546 546
 
547 547
 /**
@@ -557,19 +557,19 @@  discard block
 block discarded – undo
557 557
  */
558 558
 function geodir_get_review_total($post_id = 0)
559 559
 {
560
-    global $wpdb;
561
-
562
-    $results = $wpdb->get_var(
563
-        $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
-            array($post_id)
566
-        )
567
-    );
568
-
569
-    if (!empty($results))
570
-        return $results;
571
-    else
572
-        return false;
560
+	global $wpdb;
561
+
562
+	$results = $wpdb->get_var(
563
+		$wpdb->prepare(
564
+			"SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
565
+			array($post_id)
566
+		)
567
+	);
568
+
569
+	if (!empty($results))
570
+		return $results;
571
+	else
572
+		return false;
573 573
 }
574 574
 
575 575
 /**
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
  */
586 586
 function geodir_get_review_count_by_user_id($user_id = 0)
587 587
 {
588
-    global $wpdb;
589
-    $results = $wpdb->get_var(
590
-        $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
-            array($user_id)
593
-        )
594
-    );
595
-
596
-    if (!empty($results))
597
-        return $results;
598
-    else
599
-        return false;
588
+	global $wpdb;
589
+	$results = $wpdb->get_var(
590
+		$wpdb->prepare(
591
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
592
+			array($user_id)
593
+		)
594
+	);
595
+
596
+	if (!empty($results))
597
+		return $results;
598
+	else
599
+		return false;
600 600
 }
601 601
 
602 602
 /**
@@ -614,27 +614,27 @@  discard block
 block discarded – undo
614 614
  */
615 615
 function geodir_get_post_rating($post_id = 0, $force_query = 0)
616 616
 {
617
-    global $wpdb, $post;
618
-
619
-    if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
-        if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
-            return $post->overall_rating;
622
-        } else {
623
-            return 0;
624
-        }
625
-    }
626
-
627
-    $results = $wpdb->get_var(
628
-        $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
-            array($post_id)
631
-        )
632
-    );
633
-
634
-    if (!empty($results))
635
-        return $results;
636
-    else
637
-        return false;
617
+	global $wpdb, $post;
618
+
619
+	if (isset($post->ID) && $post->ID == $post_id && !$force_query) {
620
+		if (isset($post->rating_count) && $post->rating_count > 0 && isset($post->overall_rating) && $post->overall_rating > 0) {
621
+			return $post->overall_rating;
622
+		} else {
623
+			return 0;
624
+		}
625
+	}
626
+
627
+	$results = $wpdb->get_var(
628
+		$wpdb->prepare(
629
+			"SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
630
+			array($post_id)
631
+		)
632
+	);
633
+
634
+	if (!empty($results))
635
+		return $results;
636
+	else
637
+		return false;
638 638
 }
639 639
 
640 640
 /**
@@ -650,19 +650,19 @@  discard block
 block discarded – undo
650 650
  */
651 651
 function geodir_get_review_count_total($post_id = 0)
652 652
 {
653
-    global $wpdb;
654
-
655
-    $results = $wpdb->get_var(
656
-        $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
-            array($post_id)
659
-        )
660
-    );
661
-
662
-    if (!empty($results))
663
-        return $results;
664
-    else
665
-        return false;
653
+	global $wpdb;
654
+
655
+	$results = $wpdb->get_var(
656
+		$wpdb->prepare(
657
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
658
+			array($post_id)
659
+		)
660
+	);
661
+
662
+	if (!empty($results))
663
+		return $results;
664
+	else
665
+		return false;
666 666
 }
667 667
 
668 668
 /**
@@ -679,20 +679,20 @@  discard block
 block discarded – undo
679 679
  */
680 680
 function geodir_get_comments_number($post_id = 0)
681 681
 {
682
-    global $wpdb;
682
+	global $wpdb;
683 683
 
684
-    $results = $wpdb->get_var(
685
-        $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
-            array($post_id)
688
-        )
689
-    );
684
+	$results = $wpdb->get_var(
685
+		$wpdb->prepare(
686
+			"SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
687
+			array($post_id)
688
+		)
689
+	);
690 690
 
691 691
 
692
-    if (!empty($results))
693
-        return $results;
694
-    else
695
-        return false;
692
+	if (!empty($results))
693
+		return $results;
694
+	else
695
+		return false;
696 696
 }
697 697
 
698 698
 /**
@@ -708,19 +708,19 @@  discard block
 block discarded – undo
708 708
  */
709 709
 function geodir_get_commentoverall($comment_id = 0)
710 710
 {
711
-    global $wpdb;
712
-
713
-    $reatings = $wpdb->get_var(
714
-        $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
-            array($comment_id)
717
-        )
718
-    );
719
-
720
-    if ($reatings)
721
-        return $reatings;
722
-    else
723
-        return false;
711
+	global $wpdb;
712
+
713
+	$reatings = $wpdb->get_var(
714
+		$wpdb->prepare(
715
+			"SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
716
+			array($comment_id)
717
+		)
718
+	);
719
+
720
+	if ($reatings)
721
+		return $reatings;
722
+	else
723
+		return false;
724 724
 }
725 725
 
726 726
 /**
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
  */
735 735
 function geodir_get_commentoverall_number($post_id = 0)
736 736
 {
737
-    return geodir_get_post_rating($post_id);
737
+	return geodir_get_post_rating($post_id);
738 738
 }
739 739
 
740 740
 
@@ -752,102 +752,102 @@  discard block
 block discarded – undo
752 752
  */
753 753
 function geodir_comment_template($comment_template)
754 754
 {
755
-    global $post;
755
+	global $post;
756 756
 
757
-    $post_types = geodir_get_posttypes();
757
+	$post_types = geodir_get_posttypes();
758 758
 
759
-    if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
-        return;
761
-    }
762
-    if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
-        if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
-            return $comment_template;
765
-        }
759
+	if (!(is_singular() && (have_comments() || (isset($post->comment_status) && 'open' == $post->comment_status)))) {
760
+		return;
761
+	}
762
+	if (in_array($post->post_type, $post_types)) { // assuming there is a post type called business
763
+		if (geodir_cpt_has_rating_disabled($post->post_type)) {
764
+			return $comment_template;
765
+		}
766 766
         
767
-        $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
-        if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
770
-        }
771
-        return $template;
772
-    }
767
+		$template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768
+		if (!$template) {
769
+			$template = dirname(__FILE__) . '/reviews.php';
770
+		}
771
+		return $template;
772
+	}
773 773
 }
774 774
 
775 775
 add_filter("comments_template", "geodir_comment_template");
776 776
 
777 777
 
778 778
 if (!function_exists('geodir_comment')) {
779
-    /**
780
-     * Comment HTML markup.
781
-     *
782
-     * @since 1.0.0
783
-     * @package GeoDirectory
784
-     * @global object $post The current post object.
785
-     * @param object $comment The comment object.
786
-     * @param string|array $args {
787
-     *     Optional. Formatting options.
788
-     *
789
-     *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
-     *     @type int    $max_depth         The maximum comments depth. Default empty.
791
-     *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
-     *     @type string $callback          Callback function to use. Default null.
793
-     *     @type string $end-callback      Callback function to use at the end. Default null.
794
-     *     @type string $type              Type of comments to list.
795
-     *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
-     *     @type int    $page              Page ID to list comments for. Default empty.
797
-     *     @type int    $per_page          Number of comments to list per page. Default empty.
798
-     *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
-     *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
-     *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
-     *     @type string $format            How to format the comments list.
802
-     *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
-     *     @type bool   $short_ping        Whether to output short pings. Default false.
804
-     *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
-     * }
806
-     * @param int $depth Depth of comment.
807
-     */
808
-    function geodir_comment($comment, $args, $depth)
809
-    {
810
-        $GLOBALS['comment'] = $comment;
811
-        switch ($comment->comment_type) :
812
-            case 'pingback' :
813
-            case 'trackback' :
814
-                // Display trackbacks differently than normal comments.
815
-                ?>
779
+	/**
780
+	 * Comment HTML markup.
781
+	 *
782
+	 * @since 1.0.0
783
+	 * @package GeoDirectory
784
+	 * @global object $post The current post object.
785
+	 * @param object $comment The comment object.
786
+	 * @param string|array $args {
787
+	 *     Optional. Formatting options.
788
+	 *
789
+	 *     @type object $walker            Instance of a Walker class to list comments. Default null.
790
+	 *     @type int    $max_depth         The maximum comments depth. Default empty.
791
+	 *     @type string $style             The style of list ordering. Default 'ul'. Accepts 'ul', 'ol'.
792
+	 *     @type string $callback          Callback function to use. Default null.
793
+	 *     @type string $end-callback      Callback function to use at the end. Default null.
794
+	 *     @type string $type              Type of comments to list.
795
+	 *                                     Default 'all'. Accepts 'all', 'comment', 'pingback', 'trackback', 'pings'.
796
+	 *     @type int    $page              Page ID to list comments for. Default empty.
797
+	 *     @type int    $per_page          Number of comments to list per page. Default empty.
798
+	 *     @type int    $avatar_size       Height and width dimensions of the avatar size. Default 32.
799
+	 *     @type string $reverse_top_level Ordering of the listed comments. Default null. Accepts 'desc', 'asc'.
800
+	 *     @type bool   $reverse_children  Whether to reverse child comments in the list. Default null.
801
+	 *     @type string $format            How to format the comments list.
802
+	 *                                     Default 'html5' if the theme supports it. Accepts 'html5', 'xhtml'.
803
+	 *     @type bool   $short_ping        Whether to output short pings. Default false.
804
+	 *     @type bool   $echo              Whether to echo the output or return it. Default true.
805
+	 * }
806
+	 * @param int $depth Depth of comment.
807
+	 */
808
+	function geodir_comment($comment, $args, $depth)
809
+	{
810
+		$GLOBALS['comment'] = $comment;
811
+		switch ($comment->comment_type) :
812
+			case 'pingback' :
813
+			case 'trackback' :
814
+				// Display trackbacks differently than normal comments.
815
+				?>
816 816
                 <li <?php comment_class('geodir-comment'); ?> id="comment-<?php comment_ID(); ?>">
817 817
                 <p><?php _e('Pingback:', 'geodirectory'); ?> <?php comment_author_link(); ?> <?php edit_comment_link(__('(Edit)', 'geodirectory'), '<span class="edit-link">', '</span>'); ?></p>
818 818
                 <?php
819
-                break;
820
-            default :
821
-                // Proceed with normal comments.
822
-                global $post;
823
-                ?>
819
+				break;
820
+			default :
821
+				// Proceed with normal comments.
822
+				global $post;
823
+				?>
824 824
             <li <?php comment_class('geodir-comment'); ?> id="li-comment-<?php comment_ID(); ?>">
825 825
                 <article id="comment-<?php comment_ID(); ?>" class="comment">
826 826
                     <header class="comment-meta comment-author vcard">
827 827
                         <?php
828
-                        /**
829
-                         * Filter to modify comment avatar size
830
-                         *
831
-                         * You can use this filter to change comment avatar size.
832
-                         *
833
-                         * @since 1.0.0
834
-                         * @package GeoDirectory
835
-                         */
836
-                        $avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
-                        echo get_avatar($comment, $avatar_size);
838
-                        printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
-                            get_comment_author_link(),
840
-                            // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
-                        );
843
-                        echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
-                        printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
-                            esc_url(get_comment_link($comment->comment_ID)),
846
-                            get_comment_time('c'),
847
-                            /* translators: 1: date, 2: time */
848
-                            sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
-                        );
850
-                        ?>
828
+						/**
829
+						 * Filter to modify comment avatar size
830
+						 *
831
+						 * You can use this filter to change comment avatar size.
832
+						 *
833
+						 * @since 1.0.0
834
+						 * @package GeoDirectory
835
+						 */
836
+						$avatar_size = apply_filters('geodir_comment_avatar_size', 44);
837
+						echo get_avatar($comment, $avatar_size);
838
+						printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839
+							get_comment_author_link(),
840
+							// If current post author is also comment author, make it known visually.
841
+							($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
842
+						);
843
+						echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844
+						printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
845
+							esc_url(get_comment_link($comment->comment_ID)),
846
+							get_comment_time('c'),
847
+							/* translators: 1: date, 2: time */
848
+							sprintf(__('%1$s at %2$s', 'geodirectory'), get_comment_date(), get_comment_time())
849
+						);
850
+						?>
851 851
                     </header>
852 852
                     <!-- .comment-meta -->
853 853
 
@@ -871,47 +871,47 @@  discard block
 block discarded – undo
871 871
                 </article>
872 872
                 <!-- #comment-## -->
873 873
                 <?php
874
-                break;
875
-        endswitch; // end comment_type check
876
-    }
874
+				break;
875
+		endswitch; // end comment_type check
876
+	}
877 877
 }
878 878
 
879 879
 
880 880
 add_filter('get_comments_number', 'geodir_fix_comment_count', 10, 2);
881 881
 if (!function_exists('geodir_fix_comment_count')) {
882
-    /**
883
-     * Fix comment count by not listing replies as reviews
884
-     *
885
-     * @since 1.0.0
886
-     * @package GeoDirectory
887
-     * @global object $post The current post object.
888
-     * @param int $count The comment count.
889
-     * @param int $post_id The post ID.
890
-     * @todo $post is unreachable since the function return the count before that variable.
891
-     * @return bool|null|string The comment count.
892
-     */
893
-    function geodir_fix_comment_count($count, $post_id)
894
-    {
895
-        if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
-            global $post;
897
-            $post_types = geodir_get_posttypes();
898
-
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
-                $review_count = geodir_get_review_count_total($post_id);
901
-                return $review_count;
902
-
903
-                if ($post && isset($post->rating_count)) {
904
-                    return $post->rating_count;
905
-                } else {
906
-                    return geodir_get_comments_number($post_id);
907
-                }
908
-            } else {
909
-                return $count;
910
-            }
911
-        } else {
912
-            return $count;
913
-        }
914
-    }
882
+	/**
883
+	 * Fix comment count by not listing replies as reviews
884
+	 *
885
+	 * @since 1.0.0
886
+	 * @package GeoDirectory
887
+	 * @global object $post The current post object.
888
+	 * @param int $count The comment count.
889
+	 * @param int $post_id The post ID.
890
+	 * @todo $post is unreachable since the function return the count before that variable.
891
+	 * @return bool|null|string The comment count.
892
+	 */
893
+	function geodir_fix_comment_count($count, $post_id)
894
+	{
895
+		if (!is_admin() || strpos($_SERVER['REQUEST_URI'], 'admin-ajax.php')) {
896
+			global $post;
897
+			$post_types = geodir_get_posttypes();
898
+
899
+			if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
900
+				$review_count = geodir_get_review_count_total($post_id);
901
+				return $review_count;
902
+
903
+				if ($post && isset($post->rating_count)) {
904
+					return $post->rating_count;
905
+				} else {
906
+					return geodir_get_comments_number($post_id);
907
+				}
908
+			} else {
909
+				return $count;
910
+			}
911
+		} else {
912
+			return $count;
913
+		}
914
+	}
915 915
 }
916 916
 
917 917
 /**
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
-        return NULL;
934
-    }
935
-    $a_rating = $rating / 5 * 100;
936
-
937
-    if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
-    } else {
932
+	if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
933
+		return NULL;
934
+	}
935
+	$a_rating = $rating / 5 * 100;
936
+
937
+	if ($small) {
938
+		$r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
939
+	} else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 			}
954 954
 			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
955 955
 		}
956
-    }
957
-    return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
956
+	}
957
+	return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
958 958
 }
959 959
 
960 960
 /**
@@ -968,23 +968,23 @@  discard block
 block discarded – undo
968 968
 function geodir_is_reviews_show($pageview = '')
969 969
 {
970 970
 
971
-    $active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
-
973
-    $is_display = true;
974
-    if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
-        $is_display = false;
976
-
977
-    /**
978
-     * Filter to change display value.
979
-     *
980
-     * You can use this filter to change the is_display value.
981
-     *
982
-     * @since 1.0.0
983
-     * @package GeoDirectory
984
-     * @param bool $is_display Display ratings when set to true.
985
-     * @param string $pageview The view template. Ex: listview, gridview etc.
986
-     */
987
-    return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
971
+	$active_tabs = get_option('geodir_detail_page_tabs_excluded');
972
+
973
+	$is_display = true;
974
+	if (!empty($active_tabs) && in_array('reviews', $active_tabs))
975
+		$is_display = false;
976
+
977
+	/**
978
+	 * Filter to change display value.
979
+	 *
980
+	 * You can use this filter to change the is_display value.
981
+	 *
982
+	 * @since 1.0.0
983
+	 * @package GeoDirectory
984
+	 * @param bool $is_display Display ratings when set to true.
985
+	 * @param string $pageview The view template. Ex: listview, gridview etc.
986
+	 */
987
+	return apply_filters('geodir_is_reviews_show', $is_display, $pageview);
988 988
 }
989 989
 
990 990
 
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994 994
 if(function_exists('dsq_can_replace')) {
995
-    remove_filter('comments_template', 'dsq_comments_template');
996
-    add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
995
+	remove_filter('comments_template', 'dsq_comments_template');
996
+	add_filter('comments_template', 'dsq_comments_template', 100);
997
+	add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
998 998
 }
999 999
 
1000 1000
 
@@ -1008,14 +1008,14 @@  discard block
 block discarded – undo
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010 1010
 function geodir_option_disqus_active($disqus_active){
1011
-    global $post;
1012
-    $all_postypes = geodir_get_posttypes();
1011
+	global $post;
1012
+	$all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
-        $disqus_active = '0';
1016
-    }
1014
+	if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1015
+		$disqus_active = '0';
1016
+	}
1017 1017
 
1018
-    return $disqus_active;
1018
+	return $disqus_active;
1019 1019
 }
1020 1020
 
1021 1021
 /**
@@ -1029,23 +1029,23 @@  discard block
 block discarded – undo
1029 1029
  * @return array Modified tabs array.
1030 1030
  */
1031 1031
 function geodir_detail_reviews_tab_title($tabs_arr) {
1032
-    $post_type = geodir_get_current_posttype();
1032
+	$post_type = geodir_get_current_posttype();
1033 1033
 
1034
-    if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
-        $label_reviews = __('Comments', 'geodirectory');
1034
+	if (!empty($tabs_arr) && !empty($tabs_arr['reviews']) && isset($tabs_arr['reviews']['heading_text']) && $post_type != '' && geodir_cpt_has_rating_disabled($post_type)) {
1035
+		$label_reviews = __('Comments', 'geodirectory');
1036 1036
         
1037
-        if (defined('GEODIR_CP_VERSION')) {
1038
-            $post_types = geodir_get_posttypes('array');
1037
+		if (defined('GEODIR_CP_VERSION')) {
1038
+			$post_types = geodir_get_posttypes('array');
1039 1039
             
1040
-            if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
-                $label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
-            }
1043
-        }
1040
+			if (!empty($post_types[$post_type]['labels']['label_reviews'])) {
1041
+				$label_reviews = stripslashes(__($post_types[$post_type]['labels']['label_reviews'], 'geodirectory'));
1042
+			}
1043
+		}
1044 1044
         
1045
-        $tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
-    }
1045
+		$tabs_arr['reviews']['heading_text'] = $label_reviews;
1046
+	}
1047 1047
     
1048
-    return $tabs_arr;
1048
+	return $tabs_arr;
1049 1049
 }
1050 1050
 add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_reviews_tab_title', 1000, 1);
1051 1051
 
@@ -1056,13 +1056,13 @@  discard block
 block discarded – undo
1056 1056
  * @since 1.6.21
1057 1057
  */
1058 1058
 function geodir_jetpack_disable_comments(){
1059
-    //only run if jetpack installed
1060
-    if(defined('JETPACK__VERSION')){
1061
-        $post_types = geodir_get_posttypes();
1062
-        foreach($post_types as $post_type){
1063
-            add_filter('jetpack_comment_form_enabled_for_' . $post_type, '__return_false');
1064
-        }
1065
-    }
1059
+	//only run if jetpack installed
1060
+	if(defined('JETPACK__VERSION')){
1061
+		$post_types = geodir_get_posttypes();
1062
+		foreach($post_types as $post_type){
1063
+			add_filter('jetpack_comment_form_enabled_for_' . $post_type, '__return_false');
1064
+		}
1065
+	}
1066 1066
 }
1067 1067
 
1068 1068
 add_action('plugins_loaded','geodir_jetpack_disable_comments');
@@ -1077,13 +1077,13 @@  discard block
 block discarded – undo
1077 1077
  * @return bool True if allowed otherwise False.
1078 1078
  */
1079 1079
 function geodir_check_reviews_open( $open, $post_id ) {
1080
-    if ( $open && $post_id && geodir_is_page( 'detail' ) ) {
1081
-        if ( in_array( get_post_status( $post_id ), array( 'draft', 'pending', 'auto-draft', 'trash' ) ) ) {
1082
-            $open = false;
1083
-        }
1084
-    }
1080
+	if ( $open && $post_id && geodir_is_page( 'detail' ) ) {
1081
+		if ( in_array( get_post_status( $post_id ), array( 'draft', 'pending', 'auto-draft', 'trash' ) ) ) {
1082
+			$open = false;
1083
+		}
1084
+	}
1085 1085
     
1086
-    return $open;
1086
+	return $open;
1087 1087
 }
1088 1088
 add_filter( 'comments_open', 'geodir_check_reviews_open', 10, 2 );
1089 1089
 
@@ -1098,10 +1098,10 @@  discard block
 block discarded – undo
1098 1098
  * @return string Filtered comment content.
1099 1099
  */
1100 1100
 function geodir_remove_img_tags_from_comment( $comment_text, $comment = array(), $args = array() ) {
1101
-    if ( !empty( $comment_text ) && !empty( $comment ) && strpos( $comment_text, '[img' ) !== false && strpos( get_post_type( $comment->comment_post_ID ), 'gd_' ) === 0 ) {
1102
-        $comment_text = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_text );
1103
-        $comment_text = trim( $comment_text );
1104
-    }
1105
-    return $comment_text;
1101
+	if ( !empty( $comment_text ) && !empty( $comment ) && strpos( $comment_text, '[img' ) !== false && strpos( get_post_type( $comment->comment_post_ID ), 'gd_' ) === 0 ) {
1102
+		$comment_text = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_text );
1103
+		$comment_text = trim( $comment_text );
1104
+	}
1105
+	return $comment_text;
1106 1106
 }
1107 1107
 add_filter( 'comment_text', 'geodir_remove_img_tags_from_comment', 10, 3 );
1108 1108
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
  */
68 68
 function geodir_comment_rating_meta($comment) {
69 69
     $post_type = get_post_type($comment->comment_post_ID);
70
-	if (in_array($post_type, (array)geodir_get_posttypes()) && (int)$comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
70
+	if (in_array($post_type, (array) geodir_get_posttypes()) && (int) $comment->comment_parent == 0 && !(!empty($post_type) && geodir_cpt_has_rating_disabled($post_type))) {
71 71
 		$rating = geodir_get_commentoverall($comment->comment_ID);
72 72
 		
73
-		if ((int)get_option('geodir_reviewrating_enable_font_awesome') == 1) {
73
+		if ((int) get_option('geodir_reviewrating_enable_font_awesome') == 1) {
74 74
 			$star_texts = array();
75 75
 			$star_texts[] = __('Terrible', 'geodirectory');
76 76
 			$star_texts[] = __('Poor', 'geodirectory');
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
 			echo geodir_font_awesome_rating_form_html('', $star_texts, $rating);
82 82
 		} else {			
83 83
 			if ($rating) {
84
-				echo '<div class="gd_rating" data-average="' . $rating . '" data-id="5">';
84
+				echo '<div class="gd_rating" data-average="'.$rating.'" data-id="5">';
85 85
 
86 86
 			} else {
87 87
 				echo '<div class="gd_rating" data-average="0" data-id="5"></div>';
88 88
 			}
89 89
 		}
90
-		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="' . $rating . '"  />';
90
+		echo '<input type="hidden" id="geodir_overallrating" name="geodir_overallrating" value="'.$rating.'"  />';
91 91
 	}
92 92
 }
93 93
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 {
141 141
 
142 142
     if (strpos($link, 'wp-login.php?') !== false) {
143
-        $link = str_replace(wp_login_url(),geodir_login_url(),$link);
143
+        $link = str_replace(wp_login_url(), geodir_login_url(), $link);
144 144
     }
145
-    $link = '<div class="gd_comment_replaylink">' . $link . '</div>';
145
+    $link = '<div class="gd_comment_replaylink">'.$link.'</div>';
146 146
 
147 147
     return $link;
148 148
 }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 function geodir_cancle_replaylink($link)
160 160
 {
161 161
 
162
-    $link = '<span class="gd-cancel-replaylink">' . $link . '</span>';
162
+    $link = '<span class="gd-cancel-replaylink">'.$link.'</span>';
163 163
 
164 164
     return $link;
165 165
 }
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
     if (isset($_REQUEST['geodir_overallrating'])) {
200 200
         $overall_rating = $_REQUEST['geodir_overallrating'];
201 201
         
202
-		if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
202
+		if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
203 203
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
204 204
 
205
-            $sqlqry = $wpdb->prepare("INSERT INTO " . GEODIR_REVIEW_TABLE . " SET
205
+            $sqlqry = $wpdb->prepare("INSERT INTO ".GEODIR_REVIEW_TABLE." SET
206 206
 					post_id		= %d,
207 207
 					post_type = %s,
208 208
 					post_title	= %s,
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 
290 290
     $post_type = get_post_type($post_id);
291 291
 
292
-    $detail_table = $plugin_prefix . $post_type . '_detail';
292
+    $detail_table = $plugin_prefix.$post_type.'_detail';
293 293
 
294 294
     if ($comment_id) {
295 295
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
         if (isset($old_rating)) {
299 299
 
300
-            $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
300
+            $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
301 301
 						overall_rating = %f,
302 302
 						status		= %s,
303 303
 						comment_content = %s 
@@ -339,18 +339,18 @@  discard block
 block discarded – undo
339 339
 
340 340
     $post_type = get_post_type($post_id);
341 341
 
342
-    $detail_table = $plugin_prefix . $post_type . '_detail';
342
+    $detail_table = $plugin_prefix.$post_type.'_detail';
343 343
 
344 344
     if (isset($_REQUEST['geodir_overallrating'])) {
345 345
 
346 346
         $overall_rating = $_REQUEST['geodir_overallrating'];
347 347
 
348
-        if (isset($comment_info->comment_parent) && (int)$comment_info->comment_parent == 0) {
348
+        if (isset($comment_info->comment_parent) && (int) $comment_info->comment_parent == 0) {
349 349
             $overall_rating = $overall_rating > 0 ? $overall_rating : '0';
350 350
 
351 351
             if (isset($old_rating)) {
352 352
 
353
-                $sqlqry = $wpdb->prepare("UPDATE " . GEODIR_REVIEW_TABLE . " SET
353
+                $sqlqry = $wpdb->prepare("UPDATE ".GEODIR_REVIEW_TABLE." SET
354 354
 						overall_rating = %f,
355 355
 						status		= %s,
356 356
 						comment_content	= %s 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     $wpdb->query(
390 390
         $wpdb->prepare(
391
-            "DELETE FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id=%d",
391
+            "DELETE FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id=%d",
392 392
             array($comment_id)
393 393
         )
394 394
     );
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
  * @return string The comment content.
408 408
  */
409 409
 function geodir_wrap_comment_text($content, $comment = '') {
410
-    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int)$comment->comment_post_ID)) {
410
+    if (!empty($comment->comment_post_ID) && geodir_cpt_has_rating_disabled((int) $comment->comment_post_ID)) {
411 411
         if (!is_admin()) {
412
-            return '<div class="description">' . $content . '</div>';
412
+            return '<div class="description">'.$content.'</div>';
413 413
         } else {
414 414
             return $content;
415 415
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
         if (!empty($comment))
419 419
             $rating = geodir_get_commentoverall($comment->comment_ID);
420 420
         if ($rating != 0 && !is_admin()) {
421
-            return '<div><div class="gd-rating-text">' . __('Overall Rating', 'geodirectory') . ': <div class="rating">' . $rating . '</div></div>' . geodir_get_rating_stars($rating, $comment->comment_ID) . '</div><div class="description">' . $content . '</div>';
421
+            return '<div><div class="gd-rating-text">'.__('Overall Rating', 'geodirectory').': <div class="rating">'.$rating.'</div></div>'.geodir_get_rating_stars($rating, $comment->comment_ID).'</div><div class="description">'.$content.'</div>';
422 422
         } else
423 423
             return $content;
424 424
     }
@@ -442,18 +442,18 @@  discard block
 block discarded – undo
442 442
     if (!$post_type) {
443 443
         $post_type = get_post_type($post_id);
444 444
     }
445
-    $detail_table = $plugin_prefix . $post_type . '_detail';
445
+    $detail_table = $plugin_prefix.$post_type.'_detail';
446 446
     $post_newrating = geodir_get_post_rating($post_id, 1);
447 447
     $post_newrating_count = geodir_get_review_count_total($post_id);
448 448
 
449 449
 
450 450
     //$post_newrating = ( (float)$post_oldrating - (float)$old_rating ) + (float)$overall_rating ;
451 451
 
452
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
452
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
453 453
 
454 454
         $wpdb->query(
455 455
             $wpdb->prepare(
456
-                "UPDATE " . $detail_table . " SET
456
+                "UPDATE ".$detail_table." SET
457 457
 						overall_rating = %f,
458 458
 						rating_count = %f
459 459
 						where post_id = %d",
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
      * @package GeoDirectory
473 473
      * @param int $post_id The post ID.
474 474
      */
475
-    do_action('geodir_update_postrating',$post_id);
475
+    do_action('geodir_update_postrating', $post_id);
476 476
 
477 477
 }
478 478
 
@@ -493,13 +493,13 @@  discard block
 block discarded – undo
493 493
     global $wpdb, $plugin_prefix;
494 494
 
495 495
     $post_type = get_post_type($post_id);
496
-    $detail_table = $plugin_prefix . $post_type . '_detail';
496
+    $detail_table = $plugin_prefix.$post_type.'_detail';
497 497
 
498
-    if ($wpdb->get_var("SHOW TABLES LIKE '" . $detail_table . "'") == $detail_table) {
498
+    if ($wpdb->get_var("SHOW TABLES LIKE '".$detail_table."'") == $detail_table) {
499 499
 
500 500
         $post_ratings = $wpdb->get_var(
501 501
             $wpdb->prepare(
502
-                "SELECT overall_rating FROM " . $detail_table . " WHERE post_id = %d",
502
+                "SELECT overall_rating FROM ".$detail_table." WHERE post_id = %d",
503 503
                 array($post_id)
504 504
             )
505 505
         );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 
534 534
     $reatings = $wpdb->get_row(
535 535
         $wpdb->prepare(
536
-            "SELECT * FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
536
+            "SELECT * FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
537 537
             array($comment_id)
538 538
         )
539 539
     );
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 
562 562
     $results = $wpdb->get_var(
563 563
         $wpdb->prepare(
564
-            "SELECT SUM(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
564
+            "SELECT SUM(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
565 565
             array($post_id)
566 566
         )
567 567
     );
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
     global $wpdb;
589 589
     $results = $wpdb->get_var(
590 590
         $wpdb->prepare(
591
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE user_id = %d AND status=1 AND overall_rating>0",
591
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE user_id = %d AND status=1 AND overall_rating>0",
592 592
             array($user_id)
593 593
         )
594 594
     );
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 
627 627
     $results = $wpdb->get_var(
628 628
         $wpdb->prepare(
629
-            "SELECT COALESCE(avg(overall_rating),0) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
629
+            "SELECT COALESCE(avg(overall_rating),0) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
630 630
             array($post_id)
631 631
         )
632 632
     );
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 
655 655
     $results = $wpdb->get_var(
656 656
         $wpdb->prepare(
657
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
657
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
658 658
             array($post_id)
659 659
         )
660 660
     );
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
     $results = $wpdb->get_var(
685 685
         $wpdb->prepare(
686
-            "SELECT COUNT(overall_rating) FROM " . GEODIR_REVIEW_TABLE . " WHERE post_id = %d AND status=1 AND overall_rating>0",
686
+            "SELECT COUNT(overall_rating) FROM ".GEODIR_REVIEW_TABLE." WHERE post_id = %d AND status=1 AND overall_rating>0",
687 687
             array($post_id)
688 688
         )
689 689
     );
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
     $reatings = $wpdb->get_var(
714 714
         $wpdb->prepare(
715
-            "SELECT overall_rating FROM " . GEODIR_REVIEW_TABLE . " WHERE comment_id = %d",
715
+            "SELECT overall_rating FROM ".GEODIR_REVIEW_TABLE." WHERE comment_id = %d",
716 716
             array($comment_id)
717 717
         )
718 718
     );
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
         
767 767
         $template = locate_template(array("geodirectory/reviews.php")); // Use theme template if available
768 768
         if (!$template) {
769
-            $template = dirname(__FILE__) . '/reviews.php';
769
+            $template = dirname(__FILE__).'/reviews.php';
770 770
         }
771 771
         return $template;
772 772
     }
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
                         printf('<cite><b class="reviewer">%1$s</b> %2$s</cite>',
839 839
                             get_comment_author_link(),
840 840
                             // If current post author is also comment author, make it known visually.
841
-                            ($comment->user_id === $post->post_author) ? '<span>' . __('Post author', 'geodirectory') . '</span>' : ''
841
+                            ($comment->user_id === $post->post_author) ? '<span>'.__('Post author', 'geodirectory').'</span>' : ''
842 842
                         );
843 843
                         echo "<span class='item'><small><span class='fn'>$post->post_title</span></small></span>";
844 844
                         printf('<a href="%1$s"><time datetime="%2$s" class="dtreviewed">%3$s<span class="value-title" title="%2$s"></span></time></a>',
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
             global $post;
897 897
             $post_types = geodir_get_posttypes();
898 898
 
899
-            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int)$post_id)) {
899
+            if (in_array(get_post_type($post_id), $post_types) && !geodir_cpt_has_rating_disabled((int) $post_id)) {
900 900
                 $review_count = geodir_get_review_count_total($post_id);
901 901
                 return $review_count;
902 902
 
@@ -929,29 +929,29 @@  discard block
 block discarded – undo
929 929
  */
930 930
 function geodir_get_rating_stars($rating, $post_id, $small = false)
931 931
 {
932
-    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int)$post_id)) {
932
+    if (!empty($post_id) && geodir_cpt_has_rating_disabled((int) $post_id)) {
933 933
         return NULL;
934 934
     }
935 935
     $a_rating = $rating / 5 * 100;
936 936
 
937 937
     if ($small) {
938
-        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star_small"></div></div></div>';
938
+        $r_html = '<div class="rating"><div class="gd_rating_map" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingColor" ></div><div class="geodir_RatingAverage_small" style="width: '.$a_rating.'%;"></div><div class="geodir_Star_small"></div></div></div>';
939 939
     } else {
940 940
 		if (function_exists('geodir_reviewrating_draw_overall_rating')) {
941 941
 			// Show rating stars from review rating manager
942 942
 			$r_html = geodir_reviewrating_draw_overall_rating($rating);
943 943
 		} else {
944
-			$rating_img = '<img alt="rating icon" src="' . get_option('geodir_default_rating_star_icon') . '" />';
944
+			$rating_img = '<img alt="rating icon" src="'.get_option('geodir_default_rating_star_icon').'" />';
945 945
 			
946 946
 			/* fix rating star for safari */
947 947
 			$star_width = 23 * 5;
948 948
 			
949 949
 			if ($star_width > 0) {
950
-				$attach_style = 'max-width:' . $star_width . 'px';
950
+				$attach_style = 'max-width:'.$star_width.'px';
951 951
 			} else {
952 952
 				$attach_style = '';
953 953
 			}
954
-			$r_html = '<div class="geodir-rating" style="' . $attach_style . '"><div class="gd_rating_show" data-average="' . $rating . '" data-id="' . $post_id . '"><div class="geodir_RatingAverage" style="width: ' . $a_rating . '%;"></div><div class="geodir_Star">' . $rating_img . $rating_img . $rating_img . $rating_img . $rating_img . '</div></div></div>';
954
+			$r_html = '<div class="geodir-rating" style="'.$attach_style.'"><div class="gd_rating_show" data-average="'.$rating.'" data-id="'.$post_id.'"><div class="geodir_RatingAverage" style="width: '.$a_rating.'%;"></div><div class="geodir_Star">'.$rating_img.$rating_img.$rating_img.$rating_img.$rating_img.'</div></div></div>';
955 955
 		}
956 956
     }
957 957
     return apply_filters('geodir_get_rating_stars_html', $r_html, $rating, 5);
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 /*
992 992
  * If Disqus plugin is active, do some fixes to show on blogs but no on GD post types
993 993
  */
994
-if(function_exists('dsq_can_replace')) {
994
+if (function_exists('dsq_can_replace')) {
995 995
     remove_filter('comments_template', 'dsq_comments_template');
996 996
     add_filter('comments_template', 'dsq_comments_template', 100);
997
-    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active',10,1);
997
+    add_filter('pre_option_disqus_active', 'geodir_option_disqus_active', 10, 1);
998 998
 }
999 999
 
1000 1000
 
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
  * @param string $disqus_active Hook called before DB call for option so this is empty.
1008 1008
  * @return string `1` if active `0` if disabled.
1009 1009
  */
1010
-function geodir_option_disqus_active($disqus_active){
1010
+function geodir_option_disqus_active($disqus_active) {
1011 1011
     global $post;
1012 1012
     $all_postypes = geodir_get_posttypes();
1013 1013
 
1014
-    if(isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type,$all_postypes)){
1014
+    if (isset($post->post_type) && is_array($all_postypes) && in_array($post->post_type, $all_postypes)) {
1015 1015
         $disqus_active = '0';
1016 1016
     }
1017 1017
 
@@ -1055,17 +1055,17 @@  discard block
 block discarded – undo
1055 1055
  *
1056 1056
  * @since 1.6.21
1057 1057
  */
1058
-function geodir_jetpack_disable_comments(){
1058
+function geodir_jetpack_disable_comments() {
1059 1059
     //only run if jetpack installed
1060
-    if(defined('JETPACK__VERSION')){
1060
+    if (defined('JETPACK__VERSION')) {
1061 1061
         $post_types = geodir_get_posttypes();
1062
-        foreach($post_types as $post_type){
1063
-            add_filter('jetpack_comment_form_enabled_for_' . $post_type, '__return_false');
1062
+        foreach ($post_types as $post_type) {
1063
+            add_filter('jetpack_comment_form_enabled_for_'.$post_type, '__return_false');
1064 1064
         }
1065 1065
     }
1066 1066
 }
1067 1067
 
1068
-add_action('plugins_loaded','geodir_jetpack_disable_comments');
1068
+add_action('plugins_loaded', 'geodir_jetpack_disable_comments');
1069 1069
 
1070 1070
 /**
1071 1071
  * Check whether the current post is open for reviews.
@@ -1076,16 +1076,16 @@  discard block
 block discarded – undo
1076 1076
  * @param int  $post_id The post ID.
1077 1077
  * @return bool True if allowed otherwise False.
1078 1078
  */
1079
-function geodir_check_reviews_open( $open, $post_id ) {
1080
-    if ( $open && $post_id && geodir_is_page( 'detail' ) ) {
1081
-        if ( in_array( get_post_status( $post_id ), array( 'draft', 'pending', 'auto-draft', 'trash' ) ) ) {
1079
+function geodir_check_reviews_open($open, $post_id) {
1080
+    if ($open && $post_id && geodir_is_page('detail')) {
1081
+        if (in_array(get_post_status($post_id), array('draft', 'pending', 'auto-draft', 'trash'))) {
1082 1082
             $open = false;
1083 1083
         }
1084 1084
     }
1085 1085
     
1086 1086
     return $open;
1087 1087
 }
1088
-add_filter( 'comments_open', 'geodir_check_reviews_open', 10, 2 );
1088
+add_filter('comments_open', 'geodir_check_reviews_open', 10, 2);
1089 1089
 
1090 1090
 /**
1091 1091
  * Filter the [img] tags from comment.
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
  * @param array           $args         An array of arguments.
1098 1098
  * @return string Filtered comment content.
1099 1099
  */
1100
-function geodir_remove_img_tags_from_comment( $comment_text, $comment = array(), $args = array() ) {
1101
-    if ( !empty( $comment_text ) && !empty( $comment ) && strpos( $comment_text, '[img' ) !== false && strpos( get_post_type( $comment->comment_post_ID ), 'gd_' ) === 0 ) {
1102
-        $comment_text = preg_replace( '#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_text );
1103
-        $comment_text = trim( $comment_text );
1100
+function geodir_remove_img_tags_from_comment($comment_text, $comment = array(), $args = array()) {
1101
+    if (!empty($comment_text) && !empty($comment) && strpos($comment_text, '[img') !== false && strpos(get_post_type($comment->comment_post_ID), 'gd_') === 0) {
1102
+        $comment_text = preg_replace('#(\\[img\\]).+(\\[\\/img\\])#', '', $comment_text);
1103
+        $comment_text = trim($comment_text);
1104 1104
     }
1105 1105
     return $comment_text;
1106 1106
 }
1107
-add_filter( 'comment_text', 'geodir_remove_img_tags_from_comment', 10, 3 );
1108 1107
\ No newline at end of file
1108
+add_filter('comment_text', 'geodir_remove_img_tags_from_comment', 10, 3);
1109 1109
\ No newline at end of file
Please login to merge, or discard this patch.
geodirectory-widgets/geodirectory_related_listing_widget.php 2 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -14,160 +14,160 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class geodir_related_listing_postview extends WP_Widget
16 16
 {
17
-    /**
17
+	/**
18 18
 	 * Register the related listing widget.
19 19
 	 *
20 20
 	 * @since 1.0.0
21
-     * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
21
+	 * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct.
22 22
 	 */
23
-    public function __construct() {
24
-        $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory'));
25
-        parent::__construct(
26
-            'post_related_listing', // Base ID
27
-            __('GD > Related Listing', 'geodirectory'), // Name
28
-            $widget_ops// Args
29
-        );
30
-    }
23
+	public function __construct() {
24
+		$widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory'));
25
+		parent::__construct(
26
+			'post_related_listing', // Base ID
27
+			__('GD > Related Listing', 'geodirectory'), // Name
28
+			$widget_ops// Args
29
+		);
30
+	}
31 31
 
32 32
 	/**
33 33
 	 * Front-end display content for related listing widget.
34 34
 	 *
35 35
 	 * @since 1.0.0
36
-     * @since 1.5.1 Declare function public.
36
+	 * @since 1.5.1 Declare function public.
37 37
 	 *
38 38
 	 * @param array $args     Widget arguments.
39 39
 	 * @param array $instance Saved values from database.
40 40
 	 */
41
-    public function widget($args, $instance)
42
-    {
41
+	public function widget($args, $instance)
42
+	{
43 43
 
44
-        // prints the widget
45
-        extract($args, EXTR_SKIP);
44
+		// prints the widget
45
+		extract($args, EXTR_SKIP);
46 46
 
47
-        /** This filter is documented in geodirectory_widgets.php */
48
-        $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
47
+		/** This filter is documented in geodirectory_widgets.php */
48
+		$title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory'));
49 49
 
50
-        /** This filter is documented in geodirectory-functions/general_functions.php */
50
+		/** This filter is documented in geodirectory-functions/general_functions.php */
51 51
 		$post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
52 52
 
53
-        /**
54
-         * Filter the relation type to get related listing.
55
-         *
56
-         * @since 1.0.0
57
-         * @param string $instance['relate_to'] Can be tags or category.
58
-         */
53
+		/**
54
+		 * Filter the relation type to get related listing.
55
+		 *
56
+		 * @since 1.0.0
57
+		 * @param string $instance['relate_to'] Can be tags or category.
58
+		 */
59 59
 		$relate_to = empty($instance['relate_to']) ? 'category' : apply_filters('widget_relate_to', $instance['relate_to']);
60 60
 
61
-        /** This filter is documented in geodirectory-functions/general_functions.php */
61
+		/** This filter is documented in geodirectory-functions/general_functions.php */
62 62
 		$layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']);
63 63
 
64
-        /** This filter is documented in geodirectory-functions/general_functions.php */
64
+		/** This filter is documented in geodirectory-functions/general_functions.php */
65 65
 		$add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']);
66 66
 
67
-        /** This filter is documented in geodirectory-functions/general_functions.php */
67
+		/** This filter is documented in geodirectory-functions/general_functions.php */
68 68
 		$listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']);
69 69
 
70
-        /** This filter is documented in geodirectory-functions/general_functions.php */
70
+		/** This filter is documented in geodirectory-functions/general_functions.php */
71 71
 		$list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']);
72 72
 
73
-        /** This filter is documented in geodirectory-functions/general_functions.php */
73
+		/** This filter is documented in geodirectory-functions/general_functions.php */
74 74
 		$character_count = empty($instance['character_count']) ? 20 : apply_filters('widget_list_character_count', $instance['character_count']);
75 75
 
76
-        $arr = array(
77
-            'before_title' => $before_title,
78
-            'after_title' => $after_title,
79
-            'title' => $title,
80
-            'post_number' => $post_number,
81
-            'relate_to' => $relate_to,
82
-            'layout' => $layout,
83
-            'add_location_filter' => $add_location_filter,
84
-            'listing_width' => $listing_width,
85
-            'list_sort' => $list_sort,
86
-            'character_count' => $character_count,
87
-            'is_widget' => '1'
88
-        );
89
-
90
-        if ($widget_display = geodir_related_posts_display($arr)) {
91
-
92
-            echo $before_widget;
93
-            echo $widget_display;
94
-            echo $after_widget;
95
-        }
96
-    }
76
+		$arr = array(
77
+			'before_title' => $before_title,
78
+			'after_title' => $after_title,
79
+			'title' => $title,
80
+			'post_number' => $post_number,
81
+			'relate_to' => $relate_to,
82
+			'layout' => $layout,
83
+			'add_location_filter' => $add_location_filter,
84
+			'listing_width' => $listing_width,
85
+			'list_sort' => $list_sort,
86
+			'character_count' => $character_count,
87
+			'is_widget' => '1'
88
+		);
89
+
90
+		if ($widget_display = geodir_related_posts_display($arr)) {
91
+
92
+			echo $before_widget;
93
+			echo $widget_display;
94
+			echo $after_widget;
95
+		}
96
+	}
97 97
 
98 98
 	/**
99 99
 	 * Sanitize related listing widget form values as they are saved.
100 100
 	 *
101 101
 	 * @since 1.0.0
102
-     * @since 1.5.1 Declare function public.
102
+	 * @since 1.5.1 Declare function public.
103 103
 	 *
104 104
 	 * @param array $new_instance Values just sent to be saved.
105 105
 	 * @param array $old_instance Previously saved values from database.
106 106
 	 *
107 107
 	 * @return array Updated safe values to be saved.
108 108
 	 */
109
-    public function update($new_instance, $old_instance)
110
-    {
111
-        //save the widget
112
-        $instance = $old_instance;
113
-
114
-        $instance['title'] = strip_tags($new_instance['title']);
115
-        $instance['post_number'] = strip_tags($new_instance['post_number']);
116
-        $instance['relate_to'] = strip_tags($new_instance['relate_to']);
117
-        $instance['layout'] = strip_tags($new_instance['layout']);
118
-        $instance['listing_width'] = strip_tags($new_instance['listing_width']);
119
-        $instance['list_sort'] = strip_tags($new_instance['list_sort']);
120
-        $instance['character_count'] = $new_instance['character_count'];
121
-        if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
122
-            $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
123
-        else
124
-            $instance['add_location_filter'] = '0';
125
-
126
-        return $instance;
127
-    }
109
+	public function update($new_instance, $old_instance)
110
+	{
111
+		//save the widget
112
+		$instance = $old_instance;
113
+
114
+		$instance['title'] = strip_tags($new_instance['title']);
115
+		$instance['post_number'] = strip_tags($new_instance['post_number']);
116
+		$instance['relate_to'] = strip_tags($new_instance['relate_to']);
117
+		$instance['layout'] = strip_tags($new_instance['layout']);
118
+		$instance['listing_width'] = strip_tags($new_instance['listing_width']);
119
+		$instance['list_sort'] = strip_tags($new_instance['list_sort']);
120
+		$instance['character_count'] = $new_instance['character_count'];
121
+		if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '')
122
+			$instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']);
123
+		else
124
+			$instance['add_location_filter'] = '0';
125
+
126
+		return $instance;
127
+	}
128 128
 
129 129
 	/**
130 130
 	 * Back-end related listing widget settings form.
131 131
 	 *
132 132
 	 * @since 1.0.0
133
-     * @since 1.5.1 Declare function public.
133
+	 * @since 1.5.1 Declare function public.
134 134
 	 *
135 135
 	 * @param array $instance Previously saved values from database.
136 136
 	 */
137
-    public function form($instance)
138
-    {
139
-        //widgetform in backend
140
-        $instance = wp_parse_args((array)$instance,
141
-            array('title' => '',
142
-                'list_sort' => '',
143
-                'list_order' => '',
144
-                'post_number' => '5',
145
-                'relate_to' => '',
146
-                'layout' => 'gridview_onehalf',
147
-                'listing_width' => '',
148
-                'add_location_filter' => '1',
149
-                'character_count' => '20')
150
-        );
137
+	public function form($instance)
138
+	{
139
+		//widgetform in backend
140
+		$instance = wp_parse_args((array)$instance,
141
+			array('title' => '',
142
+				'list_sort' => '',
143
+				'list_order' => '',
144
+				'post_number' => '5',
145
+				'relate_to' => '',
146
+				'layout' => 'gridview_onehalf',
147
+				'listing_width' => '',
148
+				'add_location_filter' => '1',
149
+				'character_count' => '20')
150
+		);
151 151
 
152
-        $title = strip_tags($instance['title']);
152
+		$title = strip_tags($instance['title']);
153 153
 
154
-        $list_sort = strip_tags($instance['list_sort']);
154
+		$list_sort = strip_tags($instance['list_sort']);
155 155
 
156
-        $list_order = strip_tags($instance['list_order']);
156
+		$list_order = strip_tags($instance['list_order']);
157 157
 
158
-        $post_number = strip_tags($instance['post_number']);
158
+		$post_number = strip_tags($instance['post_number']);
159 159
 
160
-        $relate_to = strip_tags($instance['relate_to']);
160
+		$relate_to = strip_tags($instance['relate_to']);
161 161
 
162
-        $layout = strip_tags($instance['layout']);
162
+		$layout = strip_tags($instance['layout']);
163 163
 
164
-        $listing_width = strip_tags($instance['listing_width']);
164
+		$listing_width = strip_tags($instance['listing_width']);
165 165
 
166
-        $add_location_filter = strip_tags($instance['add_location_filter']);
166
+		$add_location_filter = strip_tags($instance['add_location_filter']);
167 167
 
168
-        $character_count = $instance['character_count'];
168
+		$character_count = $instance['character_count'];
169 169
 
170
-        ?>
170
+		?>
171 171
         <p>
172 172
             <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
173 173
 
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
                 <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>"
204 204
                         name="<?php echo $this->get_field_name('relate_to'); ?>">
205 205
                     <option <?php if ($relate_to == 'category') {
206
-                        echo 'selected="selected"';
207
-                    } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option>
206
+						echo 'selected="selected"';
207
+					} ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option>
208 208
                     <option <?php if ($relate_to == 'tags') {
209
-                        echo 'selected="selected"';
210
-                    } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option>
209
+						echo 'selected="selected"';
210
+					} ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option>
211 211
                 </select>
212 212
             </label>
213 213
         </p>
@@ -218,24 +218,24 @@  discard block
 block discarded – undo
218 218
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
219 219
                         name="<?php echo $this->get_field_name('layout'); ?>">
220 220
                     <option <?php if ($layout == 'gridview_onehalf') {
221
-                        echo 'selected="selected"';
222
-                    } ?>
221
+						echo 'selected="selected"';
222
+					} ?>
223 223
                         value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option>
224 224
                     <option <?php if ($layout == 'gridview_onethird') {
225
-                        echo 'selected="selected"';
226
-                    } ?>
225
+						echo 'selected="selected"';
226
+					} ?>
227 227
                         value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option>
228 228
                     <option <?php if ($layout == 'gridview_onefourth') {
229
-                        echo 'selected="selected"';
230
-                    } ?>
229
+						echo 'selected="selected"';
230
+					} ?>
231 231
                         value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option>
232 232
                     <option <?php if ($layout == 'gridview_onefifth') {
233
-                        echo 'selected="selected"';
234
-                    } ?>
233
+						echo 'selected="selected"';
234
+					} ?>
235 235
                         value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option>
236 236
                     <option <?php if ($layout == 'list') {
237
-                        echo 'selected="selected"';
238
-                    } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
237
+						echo 'selected="selected"';
238
+					} ?> value="list"><?php _e('List view', 'geodirectory'); ?></option>
239 239
 
240 240
                 </select>
241 241
             </label>
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         </p>
268 268
 
269 269
     <?php
270
-    }
270
+	}
271 271
 } // class geodir_related_listing_postview
272 272
 
273 273
 register_widget('geodir_related_listing_postview');
274 274
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public function form($instance)
138 138
     {
139 139
         //widgetform in backend
140
-        $instance = wp_parse_args((array)$instance,
140
+        $instance = wp_parse_args((array) $instance,
141 141
             array('title' => '',
142 142
                 'list_sort' => '',
143 143
                 'list_order' => '',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
         ?>
171 171
         <p>
172
-            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?>
172
+            <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?>
173 173
 
174 174
                 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
175 175
                        name="<?php echo $this->get_field_name('title'); ?>" type="text"
@@ -177,20 +177,20 @@  discard block
 block discarded – undo
177 177
             </label>
178 178
         </p>
179 179
         <p>
180
-            <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?>
180
+            <label for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?>
181 181
                 <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" name="<?php echo $this->get_field_name('list_sort'); ?>">
182
-                    <option value="latest"<?php selected( $list_sort, 'latest' ); ?>><?php _e('Latest', 'geodirectory'); ?></option>
183
-                    <option value="featured"<?php selected( $list_sort, 'featured' ); ?>><?php _e('Featured', 'geodirectory'); ?></option>
184
-                    <option value="high_review"<?php selected( $list_sort, 'high_review' ); ?>><?php _e('Review', 'geodirectory'); ?></option>
185
-                    <option value="high_rating"<?php selected( $list_sort, 'high_rating' ); ?>><?php _e('Rating', 'geodirectory'); ?></option>
186
-                    <option value="random"<?php selected( $list_sort, 'random' ); ?>><?php _e('Random', 'geodirectory'); ?></option>
187
-                    <option value="nearest"<?php selected( $list_sort, 'nearest' ); ?>><?php _e('Nearest', 'geodirectory'); ?></option>
182
+                    <option value="latest"<?php selected($list_sort, 'latest'); ?>><?php _e('Latest', 'geodirectory'); ?></option>
183
+                    <option value="featured"<?php selected($list_sort, 'featured'); ?>><?php _e('Featured', 'geodirectory'); ?></option>
184
+                    <option value="high_review"<?php selected($list_sort, 'high_review'); ?>><?php _e('Review', 'geodirectory'); ?></option>
185
+                    <option value="high_rating"<?php selected($list_sort, 'high_rating'); ?>><?php _e('Rating', 'geodirectory'); ?></option>
186
+                    <option value="random"<?php selected($list_sort, 'random'); ?>><?php _e('Random', 'geodirectory'); ?></option>
187
+                    <option value="nearest"<?php selected($list_sort, 'nearest'); ?>><?php _e('Nearest', 'geodirectory'); ?></option>
188 188
                 </select>
189 189
             </label>
190 190
         </p>
191 191
         <p>
192 192
             <label
193
-                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?>
193
+                for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?>
194 194
 
195 195
                 <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>"
196 196
                        name="<?php echo $this->get_field_name('post_number'); ?>" type="text"
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
         </p>
200 200
         <p>
201 201
             <label for="<?php echo $this->get_field_id('relate_to'); ?>">
202
-                <?php _e('Relate to:', 'geodirectory');?>
202
+                <?php _e('Relate to:', 'geodirectory'); ?>
203 203
                 <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>"
204 204
                         name="<?php echo $this->get_field_name('relate_to'); ?>">
205 205
                     <option <?php if ($relate_to == 'category') {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         <p>
215 215
         <p>
216 216
             <label for="<?php echo $this->get_field_id('layout'); ?>">
217
-                <?php _e('Layout:', 'geodirectory');?>
217
+                <?php _e('Layout:', 'geodirectory'); ?>
218 218
                 <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>"
219 219
                         name="<?php echo $this->get_field_name('layout'); ?>">
220 220
                     <option <?php if ($layout == 'gridview_onehalf') {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         </p>
243 243
         <p>
244 244
             <label
245
-                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?>
245
+                for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?>
246 246
 
247 247
                 <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>"
248 248
                        name="<?php echo $this->get_field_name('listing_width'); ?>" type="text"
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         </p>
252 252
         <p>
253 253
             <label
254
-                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?>
254
+                for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?>
255 255
                 <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>"
256 256
                        name="<?php echo $this->get_field_name('character_count'); ?>" type="text"
257 257
                        value="<?php echo esc_attr($character_count); ?>"/>
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
         </p>
260 260
         <p>
261 261
             <label for="<?php echo $this->get_field_id('add_location_filter'); ?>">
262
-                <?php _e('Enable Location Filter:', 'geodirectory');?>
262
+                <?php _e('Enable Location Filter:', 'geodirectory'); ?>
263 263
                 <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>"
264
-                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?>
264
+                       name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?>
265 265
                        value="1"/>
266 266
             </label>
267 267
         </p>
Please login to merge, or discard this patch.
geodirectory-functions/map-functions/map_on_add_listing_page.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
     window.gdMaps = window.gdMaps || gdMaps;
83 83
     
84 84
     user_address = false;
85
-    jQuery('#<?php echo $prefix.'address';?>').keypress(function () {
85
+    jQuery('#<?php echo $prefix.'address'; ?>').keypress(function () {
86 86
         user_address = true;
87 87
     });
88 88
 
89 89
     baseMarker = '';
90 90
     geocoder = '';
91
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat :  '39.952484'; ?>;
92
-    var <?php echo $prefix;?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng :  '-75.163786'; ?>;
93
-    <?php if($lat_lng_blank){$lat='';$lng='';}?>
94
-    var <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12;?>;
91
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LAT = <?php echo ($lat) ? $lat : '39.952484'; ?>;
92
+    var <?php echo $prefix; ?>CITY_MAP_CENTER_LNG = <?php echo ($lng) ? $lng : '-75.163786'; ?>;
93
+    <?php if ($lat_lng_blank) {$lat = ''; $lng = ''; }?>
94
+    var <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT = <?php echo ($mapzoom) ? $mapzoom : 12; ?>;
95 95
     var minZoomLevel = <?php echo ($is_map_restrict) ? 5 : 0; ?>;
96 96
     var oldstr_address;
97 97
     var oldstr_zip;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
              *
296 296
              * @since 1.6.16
297 297
              */
298
-            echo apply_filters("geodir_geocode_region_level",'["GB","ES"]');?>;
298
+            echo apply_filters("geodir_geocode_region_level", '["GB","ES"]'); ?>;
299 299
             if (jQuery.inArray(rr, $country_arr) !== -1) {
300 300
                 if (administrative_area_level_2.long_name) {
301 301
                     getState = administrative_area_level_2.long_name;
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
             do_action('geodir_add_listing_geocode_js_vars');
405 405
             ?>
406 406
             <?php if ($is_map_restrict) { ?>
407
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
408
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
409
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
407
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
408
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
409
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
410 410
                 jQuery.goMap.map.setCenter(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
411 411
                 baseMarker.setPosition(new google.maps.LatLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
412 412
                 updateMarkerPosition(baseMarker.getPosition());
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
             <?php } ?>
416 416
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
417 417
         } else {
418
-            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
418
+            updateMarkerAddress('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
419 419
         }
420 420
     }
421 421
     function centerMap(latlng) {
422
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
422
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
423 423
         if (window.gdMaps == 'google') {
424 424
             jQuery.goMap.map.panTo(baseMarker.getPosition());
425 425
         } else if (window.gdMaps == 'osm') {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
         }
429 429
     }
430 430
     function centerMarker() {
431
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
431
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
432 432
         var center = jQuery.goMap.map.getCenter();
433 433
         if (window.gdMaps == 'google') {
434 434
             baseMarker.setPosition(center);
@@ -437,48 +437,48 @@  discard block
 block discarded – undo
437 437
         }
438 438
     }
439 439
     function updateMapZoom(zoom) {
440
-        jQuery('#<?php echo $prefix.'mapzoom';?>').val(zoom);
440
+        jQuery('#<?php echo $prefix.'mapzoom'; ?>').val(zoom);
441 441
     }
442 442
     function updateMarkerPosition(markerlatLng) {
443
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
444
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat());
445
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng());
443
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
444
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat());
445
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng());
446 446
     }
447 447
     function updateMarkerPositionOSM(markerlatLng) {
448
-        jQuery('#<?php echo $prefix.'latitude';?>').val(markerlatLng.lat);
449
-        jQuery('#<?php echo $prefix.'longitude';?>').val(markerlatLng.lng);
448
+        jQuery('#<?php echo $prefix.'latitude'; ?>').val(markerlatLng.lat);
449
+        jQuery('#<?php echo $prefix.'longitude'; ?>').val(markerlatLng.lng);
450 450
     }
451 451
     function updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry) {
452
-        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields);?>';
453
-        <?php ob_start();?>
454
-        var old_country = jQuery("#<?php echo $prefix.'country';?>").val();
455
-        var old_region = jQuery("#<?php echo $prefix.'region';?>").val();
452
+        var set_map_val_in_fields = '<?php echo addslashes_gpc($auto_change_map_fields); ?>';
453
+        <?php ob_start(); ?>
454
+        var old_country = jQuery("#<?php echo $prefix.'country'; ?>").val();
455
+        var old_region = jQuery("#<?php echo $prefix.'region'; ?>").val();
456 456
         
457
-        if (user_address == false || jQuery('#<?php echo $prefix.'address';?>').val() == '') {
458
-            jQuery("#<?php echo $prefix.'address';?>").val(getAddress).trigger("blur");
457
+        if (user_address == false || jQuery('#<?php echo $prefix.'address'; ?>').val() == '') {
458
+            jQuery("#<?php echo $prefix.'address'; ?>").val(getAddress).trigger("blur");
459 459
         }
460 460
         if (getAddress) {
461 461
             oldstr_address = getAddress;
462 462
         }
463 463
 
464
-        jQuery("#<?php echo $prefix.'zip';?>").val(getZip);
464
+        jQuery("#<?php echo $prefix.'zip'; ?>").val(getZip);
465 465
         if (getZip) {
466 466
             oldstr_zip = getZip;
467 467
         }
468 468
         if (set_map_val_in_fields) {
469 469
             if (getCountry) {
470
-                jQuery('#<?php echo $prefix .'country'; ?> option[value=""]').attr("selected",false);
471
-                jQuery('#<?php echo $prefix.'country';?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
472
-                jQuery("#<?php echo $prefix.'country';?>").trigger("chosen:updated");
470
+                jQuery('#<?php echo $prefix.'country'; ?> option[value=""]').attr("selected",false);
471
+                jQuery('#<?php echo $prefix.'country'; ?> option[data-country_code="' + getCountryISO + '"]').attr("selected", true);
472
+                jQuery("#<?php echo $prefix.'country'; ?>").trigger("chosen:updated");
473 473
             }
474 474
             if (getState) {
475
-                if (jQuery('input[id="<?php echo $prefix.'region';?>"]').attr('id')) {
476
-                    jQuery("#<?php echo $prefix.'region';?>").val(getState);
475
+                if (jQuery('input[id="<?php echo $prefix.'region'; ?>"]').attr('id')) {
476
+                    jQuery("#<?php echo $prefix.'region'; ?>").val(getState);
477 477
                 }
478 478
             }
479 479
             if (getCity) {
480
-                if (jQuery('input[id="<?php echo $prefix.'city';?>"]').attr('id')) {
481
-                    jQuery("#<?php echo $prefix.'city';?>").val(getCity);
480
+                if (jQuery('input[id="<?php echo $prefix.'city'; ?>"]').attr('id')) {
481
+                    jQuery("#<?php echo $prefix.'city'; ?>").val(getCity);
482 482
                 }
483 483
             }
484 484
         }
@@ -494,23 +494,23 @@  discard block
 block discarded – undo
494 494
         ?>
495 495
     }
496 496
     function geodir_codeAddress(set_on_map) {
497
-        var address = jQuery('#<?php echo $prefix.'address';?>').val();
498
-        var zip = jQuery('#<?php echo $prefix.'zip';?>').val();
499
-        var city = jQuery('#<?php echo $prefix.'city';?>').val();
500
-        var region = jQuery('#<?php echo $prefix.'region';?>').val();
501
-        var country = jQuery('#<?php echo $prefix.'country';?>').val();
502
-        var country_selected = jQuery('#<?php echo $prefix.'country';?>').find('option:selected');
497
+        var address = jQuery('#<?php echo $prefix.'address'; ?>').val();
498
+        var zip = jQuery('#<?php echo $prefix.'zip'; ?>').val();
499
+        var city = jQuery('#<?php echo $prefix.'city'; ?>').val();
500
+        var region = jQuery('#<?php echo $prefix.'region'; ?>').val();
501
+        var country = jQuery('#<?php echo $prefix.'country'; ?>').val();
502
+        var country_selected = jQuery('#<?php echo $prefix.'country'; ?>').find('option:selected');
503 503
         var ISO2 = country_selected.data('country_code');
504
-        if (!ISO2 && jQuery('#<?php echo $prefix.'country';?>').data('country_code')) {
505
-            ISO2 = jQuery('#<?php echo $prefix.'country';?>').data('country_code');
504
+        if (!ISO2 && jQuery('#<?php echo $prefix.'country'; ?>').data('country_code')) {
505
+            ISO2 = jQuery('#<?php echo $prefix.'country'; ?>').data('country_code');
506 506
         }
507 507
         if(!ISO2){
508 508
             <?php
509
-            if(!defined('GEODIRLOCATION_TEXTDOMAIN')){
509
+            if (!defined('GEODIRLOCATION_TEXTDOMAIN')) {
510 510
                 global $wpdb;
511 511
                 $location_result = geodir_get_default_location();
512
-                if(!empty($location_result)){
513
-                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM " . GEODIR_COUNTRIES_TABLE . " WHERE Country=%s",$location_result->country));
512
+                if (!empty($location_result)) {
513
+                    $ISO2 = $wpdb->get_var($wpdb->prepare("SELECT ISO2 FROM ".GEODIR_COUNTRIES_TABLE." WHERE Country=%s", $location_result->country));
514 514
                     echo "ISO2 = '$ISO2';";
515 515
                 }
516 516
             }
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
             zip = '';
527 527
         }
528 528
         if (typeof city == "undefined") {
529
-            city = '<?php echo addslashes_gpc($city);?>';
529
+            city = '<?php echo addslashes_gpc($city); ?>';
530 530
         }
531 531
         if (typeof region == "undefined") {
532
-            region = '<?php echo addslashes_gpc($region);?>';
532
+            region = '<?php echo addslashes_gpc($region); ?>';
533 533
         }
534 534
         if (typeof country == "undefined") {
535
-            country = '<?php echo addslashes_gpc($country);?>';
535
+            country = '<?php echo addslashes_gpc($country); ?>';
536 536
         }
537 537
         var is_restrict = '<?php echo $is_map_restrict; ?>';
538 538
         <?php ob_start();
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
             if( address == city || address == region || address == country || address == zip )
551 551
                 address = '';
552 552
             <?php
553
-            if(is_admin() && isset($_REQUEST['tab'])){?>
553
+            if (is_admin() && isset($_REQUEST['tab'])) {?>
554 554
             if (jQuery.trim(city) == '' || jQuery.trim(region) == '') {
555 555
                 address = '';
556 556
             }
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
             geocoder.geocode({'address': address, 'country': ISO2},
598 598
                 function (results, status) {
599 599
                     console.log(status);
600
-                    jQuery("#<?php echo $prefix.'map';?>").goMap();
600
+                    jQuery("#<?php echo $prefix.'map'; ?>").goMap();
601 601
                     if (status == google.maps.GeocoderStatus.OK) {
602 602
                         baseMarker.setPosition(results[0].geometry.location);
603 603
                         jQuery.goMap.map.setCenter(results[0].geometry.location);
@@ -614,21 +614,21 @@  discard block
 block discarded – undo
614 614
                         geocodePosition(baseMarker.getPosition(), {'address': address, 'country': ISO2});
615 615
                         //}
616 616
                     } else {
617
-                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:','geodirectory'));?> ' + status);
617
+                        alert('<?php echo addslashes_gpc(__('Geocode was not successful for the following reason:', 'geodirectory')); ?> ' + status);
618 618
                     }
619 619
                 });
620 620
         }
621 621
     }
622 622
     function gdMaxMap() {
623
-        jQuery("#<?php echo $prefix.'map';?>").goMap();
623
+        jQuery("#<?php echo $prefix.'map'; ?>").goMap();
624 624
 
625
-        jQuery('#<?php echo $prefix.'map';?>').toggleClass('map-fullscreen');
625
+        jQuery('#<?php echo $prefix.'map'; ?>').toggleClass('map-fullscreen');
626 626
         jQuery('.map_category').toggleClass('map_category_fullscreen');
627
-        jQuery('#<?php echo $prefix;?>trigger').toggleClass('map_category_fullscreen');
627
+        jQuery('#<?php echo $prefix; ?>trigger').toggleClass('map_category_fullscreen');
628 628
         jQuery('body').toggleClass('body_fullscreen');
629
-        jQuery('#<?php echo $prefix;?>loading_div').toggleClass('loading_div_fullscreen');
630
-        jQuery('#<?php echo $prefix;?>advmap_nofound').toggleClass('nofound_fullscreen');
631
-        jQuery('#<?php echo $prefix;?>triggermap').toggleClass('triggermap_fullscreen');
629
+        jQuery('#<?php echo $prefix; ?>loading_div').toggleClass('loading_div_fullscreen');
630
+        jQuery('#<?php echo $prefix; ?>advmap_nofound').toggleClass('nofound_fullscreen');
631
+        jQuery('#<?php echo $prefix; ?>triggermap').toggleClass('triggermap_fullscreen');
632 632
         jQuery('.TopLeft').toggleClass('TopLeft_fullscreen');
633 633
         window.setTimeout(function () {
634 634
             if (window.gdMaps == 'google') {
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
             do_action('geodir_add_listing_geocode_js_vars');
665 665
             ?>
666 666
             <?php if ($is_map_restrict) { ?>
667
-            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city));?>') {
668
-                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.','geodirectory'), $city));?>');
669
-                jQuery("#<?php echo $prefix.'map';?>").goMap();
667
+            if (getCity.toLowerCase() != '<?php echo geodir_strtolower(addslashes_gpc($city)); ?>') {
668
+                alert('<?php echo addslashes_gpc(wp_sprintf(__('Please choose any address of the (%s) city only.', 'geodirectory'), $city)); ?>');
669
+                jQuery("#<?php echo $prefix.'map'; ?>").goMap();
670 670
                 centerMap(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
671 671
                 baseMarker.setLatLng(new L.latLng('<?php echo $default_lat; ?>', '<?php echo $default_lng; ?>'));
672 672
                 updateMarkerPositionOSM(baseMarker.getLatLng());
@@ -675,39 +675,39 @@  discard block
 block discarded – undo
675 675
             <?php } ?>
676 676
             updateMarkerAddress(getAddress, getZip, getCity, getState, getCountry);
677 677
         } else {
678
-            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.','geodirectory'));?>');
678
+            alert('<?php echo addslashes_gpc(__('Cannot determine address at this location.', 'geodirectory')); ?>');
679 679
         }
680 680
     }
681 681
     
682 682
     jQuery(function ($) {
683
-        $("#<?php echo $prefix.'map';?>").goMap({
684
-            latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
685
-            longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
686
-            zoom: <?php echo $prefix;?>CITY_MAP_ZOOMING_FACT,
683
+        $("#<?php echo $prefix.'map'; ?>").goMap({
684
+            latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
685
+            longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
686
+            zoom: <?php echo $prefix; ?>CITY_MAP_ZOOMING_FACT,
687 687
             maptype: 'ROADMAP', // Map type - HYBRID, ROADMAP, SATELLITE, TERRAIN
688 688
             streetViewControl: true,
689
-            <?php if(get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,';}?>
689
+            <?php if (get_option('geodir_add_listing_mouse_scroll')) { echo 'scrollwheel: false,'; }?>
690 690
         });
691 691
 
692 692
         if (window.gdMaps) {
693 693
             geocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : [];
694 694
 
695 695
             baseMarker = $.goMap.createMarker({
696
-                latitude: <?php echo $prefix;?>CITY_MAP_CENTER_LAT,
697
-                longitude: <?php echo $prefix;?>CITY_MAP_CENTER_LNG,
696
+                latitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LAT,
697
+                longitude: <?php echo $prefix; ?>CITY_MAP_CENTER_LNG,
698 698
                 id: 'baseMarker',
699
-                icon: '<?php echo $marker_icon;?>',
699
+                icon: '<?php echo $marker_icon; ?>',
700 700
                 draggable: true,
701 701
                 addToMap: true, // For OSM
702
-                w: parseFloat('<?php echo $icon_size['w'];?>'),
703
-                h: parseFloat('<?php echo $icon_size['h'];?>'),
702
+                w: parseFloat('<?php echo $icon_size['w']; ?>'),
703
+                h: parseFloat('<?php echo $icon_size['h']; ?>'),
704 704
             });
705 705
         } else {
706
-            jQuery('#<?php echo $prefix.'advmap_nofound';?>').hide();
707
-            jQuery('#<?php echo $prefix.'advmap_notloaded';?>').show();
706
+            jQuery('#<?php echo $prefix.'advmap_nofound'; ?>').hide();
707
+            jQuery('#<?php echo $prefix.'advmap_notloaded'; ?>').show();
708 708
         }
709 709
         
710
-        $("#<?php echo $prefix;?>set_address_button").click(function () {
710
+        $("#<?php echo $prefix; ?>set_address_button").click(function () {
711 711
             var set_on_map = true;
712 712
             geodir_codeAddress(set_on_map);
713 713
         });
@@ -742,14 +742,14 @@  discard block
 block discarded – undo
742 742
                 updateMapZoom($.goMap.map.zoom);
743 743
             });
744 744
 
745
-            var maxMap = document.getElementById('<?php echo $prefix;?>triggermap');
745
+            var maxMap = document.getElementById('<?php echo $prefix; ?>triggermap');
746 746
             google.maps.event.addDomListener(maxMap, 'click', gdMaxMap);
747 747
 
748 748
             <?php if ($is_map_restrict) { ?>
749
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country);?>';
749
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).','.addslashes_gpc($region).','.addslashes_gpc($country); ?>';
750 750
             geocoder.geocode({'address': CITY_ADDRESS},
751 751
                 function (results, status) {
752
-                    $("#<?php echo $prefix.'map';?>").goMap();
752
+                    $("#<?php echo $prefix.'map'; ?>").goMap();
753 753
                     if (status == google.maps.GeocoderStatus.OK) {
754 754
                         // Bounds for North America
755 755
                         var bound_lat_lng = String(results[0].geometry.bounds);
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
                             new google.maps.LatLng(bound_lat_lng[2], bound_lat_lng[3])
761 761
                         );
762 762
                     } else {
763
-                        alert("<?php _e('Geocode was not successful for the following reason:','geodirectory');?> " + status);
763
+                        alert("<?php _e('Geocode was not successful for the following reason:', 'geodirectory'); ?> " + status);
764 764
                     }
765 765
                 });
766 766
             <?php } ?>
767 767
             // Limit the zoom level
768 768
             google.maps.event.addListener($.goMap.map, 'zoom_changed', function () {
769
-                $("#<?php echo $prefix.'map';?>").goMap();
769
+                $("#<?php echo $prefix.'map'; ?>").goMap();
770 770
                 if ($.goMap.map.getZoom() < minZoomLevel) $.goMap.map.setZoom(minZoomLevel);
771 771
             });
772 772
         } else if (window.gdMaps == 'osm') {
@@ -792,10 +792,10 @@  discard block
 block discarded – undo
792 792
                 updateMapZoom($.goMap.map.getZoom());
793 793
             });
794 794
 
795
-            L.DomEvent.addListener($('<?php echo $prefix;?>triggermap'), 'click', gdMaxMap);
795
+            L.DomEvent.addListener($('<?php echo $prefix; ?>triggermap'), 'click', gdMaxMap);
796 796
 
797 797
             <?php if ($is_map_restrict) { ?>
798
-            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country);?>';
798
+            var CITY_ADDRESS = '<?php echo addslashes_gpc($city).', '.addslashes_gpc($region).', '.addslashes_gpc($country); ?>';
799 799
             geocodePositionOSM('', CITY_ADDRESS);
800 800
             <?php } ?>
801 801
             // Limit the zoom level
@@ -818,14 +818,14 @@  discard block
 block discarded – undo
818 818
 <div class="top_banner_section_inn geodir_map_container clearfix" style="margin-top:10px;">
819 819
     <div class="TopLeft"><span id="<?php echo $prefix; ?>triggermap" style="margin-top:-11px;margin-left:-12px;"></span></div>
820 820
     <div class="TopRight"></div>
821
-    <div id="<?php echo $prefix . 'map'; ?>" class="geodir_map" style="height:300px">
821
+    <div id="<?php echo $prefix.'map'; ?>" class="geodir_map" style="height:300px">
822 822
         <!-- new map start -->
823 823
         <div class="iprelative">
824
-            <div id="<?php echo $prefix . 'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
824
+            <div id="<?php echo $prefix.'map'; ?>" style="float:right;height:300px;position:relative;" class="form_row clearfix"></div>
825 825
             <div id="<?php echo $prefix; ?>loading_div" style="height:300px"></div>
826 826
             <div id="<?php echo $prefix; ?>advmap_counter"></div>
827 827
             <div id="<?php echo $prefix; ?>advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div>
828
-            <div id="<?php echo $prefix;?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
828
+            <div id="<?php echo $prefix; ?>advmap_notloaded" class="advmap_notloaded"><?php _e('<h3>Map Not Loaded</h3><p>Sorry, unable to load Maps API.', 'geodirectory'); ?></div>
829 829
         </div>
830 830
         <!-- new map end -->
831 831
     </div>
Please login to merge, or discard this patch.
geodirectory-functions/template_functions.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
  * @global object $post The current post object.
418 418
  * @global object $geodirectory Not yet implemented.
419 419
  * @param string $slug The template slug.
420
- * @param null $name The template name.
420
+ * @param string $name The template name.
421 421
  */
422 422
 function geodir_get_template_part($slug = '', $name = NULL)
423 423
 {
@@ -673,6 +673,9 @@  discard block
 block discarded – undo
673 673
 	}
674 674
 }
675 675
 
676
+/**
677
+ * @param string $shortcode
678
+ */
676 679
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
677 680
     if ( empty( $content ) || empty( $shortcode ) ) {
678 681
         return array();
Please login to merge, or discard this patch.
Indentation   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -19,127 +19,127 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function geodir_locate_template($template = '')
21 21
 {
22
-    global $post_type, $wp, $post;
23
-    $fields = array();
24
-
25
-    switch ($template):
26
-        case 'signup':
27
-            return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
-            break;
29
-        case 'add-listing':
30
-            $gd_post_types = geodir_get_posttypes();
22
+	global $post_type, $wp, $post;
23
+	$fields = array();
24
+
25
+	switch ($template):
26
+		case 'signup':
27
+			return $template = locate_template(array("geodirectory/geodir-signup.php"));
28
+			break;
29
+		case 'add-listing':
30
+			$gd_post_types = geodir_get_posttypes();
31 31
             
32
-            if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
-                $post_type = '';
34
-            }
32
+			if (!(!empty($post_type) && in_array($post_type, $gd_post_types))) {
33
+				$post_type = '';
34
+			}
35 35
             
36
-            $sc_post_type = '';
37
-            if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
-                $listing_page_id = $post->ID;
39
-                if (!empty($shortcode['listing_type'])) {
40
-                    $sc_post_type = $shortcode['listing_type'];
41
-                }
42
-            } else {
43
-                $listing_page_id = geodir_add_listing_page_id();
44
-            }
36
+			$sc_post_type = '';
37
+			if (is_page() && !empty($post->post_content) && ($shortcode = geodir_parse_shortcodes($post->post_content, 'gd_add_listing'))) {
38
+				$listing_page_id = $post->ID;
39
+				if (!empty($shortcode['listing_type'])) {
40
+					$sc_post_type = $shortcode['listing_type'];
41
+				}
42
+			} else {
43
+				$listing_page_id = geodir_add_listing_page_id();
44
+			}
45 45
             
46
-            $is_wpml = geodir_is_wpml() ? true : false;
46
+			$is_wpml = geodir_is_wpml() ? true : false;
47 47
 
48
-            if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
-                && in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
51
-            }
48
+			if ($listing_page_id != '' && (is_page($listing_page_id) || ($is_wpml && !empty($wp->query_vars['page_id']))) && isset($_REQUEST['listing_type'])
49
+				&& in_array($_REQUEST['listing_type'], $gd_post_types)) {
50
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
51
+			}
52 52
             
53
-            if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
-                $pagename = $wp->query_vars['pagename'];
53
+			if (empty($post_type) && !isset($_REQUEST['pid'])) {
54
+				$pagename = $wp->query_vars['pagename'];
55 55
                 
56
-                if (!empty($gd_post_types)) {
57
-                    $post_type = $gd_post_types[0];
58
-                }
56
+				if (!empty($gd_post_types)) {
57
+					$post_type = $gd_post_types[0];
58
+				}
59 59
                 
60
-                if ($sc_post_type != '') {
61
-                    $post_type = $sc_post_type;
62
-                }
60
+				if ($sc_post_type != '') {
61
+					$post_type = $sc_post_type;
62
+				}
63 63
                 
64
-                if (empty($post_type) && !empty($gd_post_types)) {
65
-                    $post_type = $gd_post_types[0];
66
-                }
64
+				if (empty($post_type) && !empty($gd_post_types)) {
65
+					$post_type = $gd_post_types[0];
66
+				}
67 67
                 
68
-                if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
-                    wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
-                } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
-                }
73
-                gd_die();
74
-            }
75
-            return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
-            break;
77
-        case 'success':
78
-            $success_page_id = geodir_success_page_id();
79
-            if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
-                && in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
-            )
82
-                $post_type = sanitize_text_field($_REQUEST['listing_type']);
83
-            return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
-            break;
85
-        case 'detail':
86
-        case 'preview':
87
-            if (in_array(get_post_type(), geodir_get_posttypes()))
88
-                $post_type = get_post_type();
89
-            return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
-            break;
91
-        case 'listing':
92
-            $templates = array();
93
-            if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
-                $post_type = get_post_type();
95
-                $templates[] = "geodirectory/archive-$post_type.php";
96
-            }
97
-
98
-
99
-            if (is_tax() && geodir_get_taxonomy_posttype()) {
100
-                $query_obj = get_queried_object();
101
-                $curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
-                $curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
-                $templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
-            }
106
-
107
-            $templates[] = "geodirectory/geodir-listing.php";
108
-
109
-            return $template = locate_template($templates);
110
-            break;
111
-        case 'information':
112
-            return $template = locate_template(array("geodirectory/geodir-information.php"));
113
-            break;
114
-        case 'author':
115
-            return $template = locate_template(array("geodirectory/geodir-author.php"));
116
-            break;
117
-        case 'search':
118
-            return $template = locate_template(array("geodirectory/geodir-search.php"));
119
-            break;
120
-        case 'location':
121
-            return $template = locate_template(array("geodirectory/geodir-location.php"));
122
-            break;
123
-        case 'geodir-home':
124
-            return $template = locate_template(array("geodirectory/geodir-home.php"));
125
-            break;
126
-        case 'listing-listview':
127
-            $template = locate_template(array("geodirectory/listing-listview.php"));
128
-            if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
-            }
131
-            return $template;
132
-            break;
133
-        case 'widget-listing-listview':
134
-            $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
-            if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
-            }
138
-            return $template;
139
-            break;
140
-    endswitch;
141
-
142
-    return false;
68
+				if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69
+					wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70
+				} else {
71
+					wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
72
+				}
73
+				gd_die();
74
+			}
75
+			return $template = locate_template(array("geodirectory/add-{$post_type}.php", "geodirectory/add-listing.php"));
76
+			break;
77
+		case 'success':
78
+			$success_page_id = geodir_success_page_id();
79
+			if ($success_page_id != '' && is_page($success_page_id) && isset($_REQUEST['listing_type'])
80
+				&& in_array($_REQUEST['listing_type'], geodir_get_posttypes())
81
+			)
82
+				$post_type = sanitize_text_field($_REQUEST['listing_type']);
83
+			return $template = locate_template(array("geodirectory/{$post_type}-success.php", "geodirectory/listing-success.php"));
84
+			break;
85
+		case 'detail':
86
+		case 'preview':
87
+			if (in_array(get_post_type(), geodir_get_posttypes()))
88
+				$post_type = get_post_type();
89
+			return $template = locate_template(array("geodirectory/single-{$post_type}.php", "geodirectory/listing-detail.php"));
90
+			break;
91
+		case 'listing':
92
+			$templates = array();
93
+			if (is_post_type_archive() && in_array(get_post_type(), geodir_get_posttypes())) {
94
+				$post_type = get_post_type();
95
+				$templates[] = "geodirectory/archive-$post_type.php";
96
+			}
97
+
98
+
99
+			if (is_tax() && geodir_get_taxonomy_posttype()) {
100
+				$query_obj = get_queried_object();
101
+				$curr_taxonomy = isset($query_obj->taxonomy) ? $query_obj->taxonomy : '';
102
+				$curr_term = isset($query_obj->slug) ? $query_obj->slug : '';
103
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy-$curr_term.php";
104
+				$templates[] = "geodirectory/taxonomy-$curr_taxonomy.php";
105
+			}
106
+
107
+			$templates[] = "geodirectory/geodir-listing.php";
108
+
109
+			return $template = locate_template($templates);
110
+			break;
111
+		case 'information':
112
+			return $template = locate_template(array("geodirectory/geodir-information.php"));
113
+			break;
114
+		case 'author':
115
+			return $template = locate_template(array("geodirectory/geodir-author.php"));
116
+			break;
117
+		case 'search':
118
+			return $template = locate_template(array("geodirectory/geodir-search.php"));
119
+			break;
120
+		case 'location':
121
+			return $template = locate_template(array("geodirectory/geodir-location.php"));
122
+			break;
123
+		case 'geodir-home':
124
+			return $template = locate_template(array("geodirectory/geodir-home.php"));
125
+			break;
126
+		case 'listing-listview':
127
+			$template = locate_template(array("geodirectory/listing-listview.php"));
128
+			if (!$template) {
129
+				$template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
130
+			}
131
+			return $template;
132
+			break;
133
+		case 'widget-listing-listview':
134
+			$template = locate_template(array("geodirectory/widget-listing-listview.php"));
135
+			if (!$template) {
136
+				$template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
137
+			}
138
+			return $template;
139
+			break;
140
+	endswitch;
141
+
142
+	return false;
143 143
 
144 144
 }
145 145
 
@@ -158,255 +158,255 @@  discard block
 block discarded – undo
158 158
 function geodir_template_loader($template)
159 159
 {
160 160
 
161
-    global $wp_query;
162
-
163
-    /**
164
-     * Filter the custom page list.
165
-     *
166
-     * @since 1.0.0
167
-     */
168
-    $geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
169
-        'geodir_signup_page' =>
170
-            apply_filters('geodir_set_custom_signup_page', false),
171
-        'geodir_add_listing_page' =>
172
-            apply_filters('geodir_set_custom_add_listing_page', false),
173
-        'geodir_preview_page' =>
174
-            apply_filters('geodir_set_custom_preview_page', false),
175
-        'geodir_listing_success_page' =>
176
-            apply_filters('geodir_set_custom_listing_success_page', false),
177
-        'geodir_listing_detail_page' =>
178
-            apply_filters('geodir_set_custom_listing_detail_page', false),
179
-        'geodir_listing_page' =>
180
-            apply_filters('geodir_set_custom_listing_page', false),
181
-        'geodir_search_page' =>
182
-            apply_filters('geodir_set_custom_search_page', false),
183
-        'geodir_author_page' =>
184
-            apply_filters('geodir_set_custom_author_page', false),
185
-        'geodir_home_map_page' =>
186
-            apply_filters('geodir_set_custom_home_map_page', false)
187
-    ));
188
-
189
-
190
-    if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
191
-
192
-        $template = geodir_locate_template('signup');
193
-
194
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
195
-
196
-        /**
197
-         * Filter the signup template path.
198
-         *
199
-         * @since 1.0.0
200
-         * @param string $template The template path.
201
-         */
202
-        return $template = apply_filters('geodir_template_signup', $template);
203
-    }
204
-
205
-    if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
206
-        if (!geodir_is_default_location_set()) {
207
-            global $information;
208
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
209
-
210
-            $template = geodir_locate_template('information');
211
-
212
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
213
-            /**
214
-             * Filter the information template path.
215
-             *
216
-             * @since 1.0.0
217
-             * @param string $template The template path.
218
-             */
219
-            return $template = apply_filters('geodir_template_information', $template);
220
-        }
221
-        // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
222
-        if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
223
-            /// WPML
224
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
225
-                global $sitepress;
161
+	global $wp_query;
162
+
163
+	/**
164
+	 * Filter the custom page list.
165
+	 *
166
+	 * @since 1.0.0
167
+	 */
168
+	$geodir_custom_page_list = apply_filters('geodir_set_custom_pages', array(
169
+		'geodir_signup_page' =>
170
+			apply_filters('geodir_set_custom_signup_page', false),
171
+		'geodir_add_listing_page' =>
172
+			apply_filters('geodir_set_custom_add_listing_page', false),
173
+		'geodir_preview_page' =>
174
+			apply_filters('geodir_set_custom_preview_page', false),
175
+		'geodir_listing_success_page' =>
176
+			apply_filters('geodir_set_custom_listing_success_page', false),
177
+		'geodir_listing_detail_page' =>
178
+			apply_filters('geodir_set_custom_listing_detail_page', false),
179
+		'geodir_listing_page' =>
180
+			apply_filters('geodir_set_custom_listing_page', false),
181
+		'geodir_search_page' =>
182
+			apply_filters('geodir_set_custom_search_page', false),
183
+		'geodir_author_page' =>
184
+			apply_filters('geodir_set_custom_author_page', false),
185
+		'geodir_home_map_page' =>
186
+			apply_filters('geodir_set_custom_home_map_page', false)
187
+	));
188
+
189
+
190
+	if (geodir_is_page('login') || $geodir_custom_page_list['geodir_signup_page']) {
191
+
192
+		$template = geodir_locate_template('signup');
193
+
194
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
195
+
196
+		/**
197
+		 * Filter the signup template path.
198
+		 *
199
+		 * @since 1.0.0
200
+		 * @param string $template The template path.
201
+		 */
202
+		return $template = apply_filters('geodir_template_signup', $template);
203
+	}
204
+
205
+	if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
206
+		if (!geodir_is_default_location_set()) {
207
+			global $information;
208
+			$information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
209
+
210
+			$template = geodir_locate_template('information');
211
+
212
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
213
+			/**
214
+			 * Filter the information template path.
215
+			 *
216
+			 * @since 1.0.0
217
+			 * @param string $template The template path.
218
+			 */
219
+			return $template = apply_filters('geodir_template_information', $template);
220
+		}
221
+		// check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
222
+		if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
223
+			/// WPML
224
+			if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
225
+				global $sitepress;
226 226
                 
227
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
228
-                $sitepress->switch_lang($lang_of_duplicate, true);
227
+				$lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
228
+				$sitepress->switch_lang($lang_of_duplicate, true);
229 229
         
230
-                $redirect_to = get_permalink(geodir_add_listing_page_id());
231
-                $_GET['pid'] = $duplicate_of;
232
-                if (!empty($_GET)) {
233
-                    $redirect_to = add_query_arg($_GET, $redirect_to);
234
-                }
235
-                wp_redirect($redirect_to);
236
-                exit;
237
-            }
238
-            /// WPML
230
+				$redirect_to = get_permalink(geodir_add_listing_page_id());
231
+				$_GET['pid'] = $duplicate_of;
232
+				if (!empty($_GET)) {
233
+					$redirect_to = add_query_arg($_GET, $redirect_to);
234
+				}
235
+				wp_redirect($redirect_to);
236
+				exit;
237
+			}
238
+			/// WPML
239 239
             
240
-            global $information;
241
-            $information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
242
-            $is_current_user_owner = geodir_listing_belong_to_current_user();
243
-            if (!$is_current_user_owner) {
244
-                $template = geodir_locate_template('information');
245
-
246
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
247
-                /**
248
-                 * Filter the information template path.
249
-                 *
250
-                 * @since 1.0.0
251
-                 * @param string $template The template path.
252
-                 */
253
-                return $template = apply_filters('geodir_template_information', $template);
254
-            }
240
+			global $information;
241
+			$information = __('This listing does not belong to your account, please check the listing id carefully.', 'geodirectory');
242
+			$is_current_user_owner = geodir_listing_belong_to_current_user();
243
+			if (!$is_current_user_owner) {
244
+				$template = geodir_locate_template('information');
245
+
246
+				if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
247
+				/**
248
+				 * Filter the information template path.
249
+				 *
250
+				 * @since 1.0.0
251
+				 * @param string $template The template path.
252
+				 */
253
+				return $template = apply_filters('geodir_template_information', $template);
254
+			}
255 255
 
256 256
 
257
-        }
257
+		}
258 258
 
259
-        //geodir_is_login(true);
260
-        global $current_user;
261
-        if (!$current_user->ID) {
262
-            wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
263
-            exit;
264
-        }
259
+		//geodir_is_login(true);
260
+		global $current_user;
261
+		if (!$current_user->ID) {
262
+			wp_redirect(geodir_login_url(array('redirect_add_listing'=>urlencode(geodir_curPageURL()))), 302);
263
+			exit;
264
+		}
265 265
 
266
-        $template = geodir_locate_template('add-listing');
267
-
268
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
269
-        /**
270
-         * Filter the add listing template path.
271
-         *
272
-         * @since 1.0.0
273
-         * @param string $template The template path.
274
-         */
275
-        return $template = apply_filters('geodir_template_add_listing', $template);
276
-    }
266
+		$template = geodir_locate_template('add-listing');
277 267
 
268
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
269
+		/**
270
+		 * Filter the add listing template path.
271
+		 *
272
+		 * @since 1.0.0
273
+		 * @param string $template The template path.
274
+		 */
275
+		return $template = apply_filters('geodir_template_add_listing', $template);
276
+	}
278 277
 
279
-    if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
280
-        global $preview;
281
-        $preview = true;
282 278
 
283
-        $template = geodir_locate_template('preview');
279
+	if (geodir_is_page('preview') || $geodir_custom_page_list['geodir_preview_page']) {
280
+		global $preview;
281
+		$preview = true;
284 282
 
285
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
286
-        /**
287
-         * Filter the preview template path.
288
-         *
289
-         * @since 1.0.0
290
-         * @param string $template The template path.
291
-         */
292
-        return $template = apply_filters('geodir_template_preview', $template);
283
+		$template = geodir_locate_template('preview');
293 284
 
294
-    }
285
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
286
+		/**
287
+		 * Filter the preview template path.
288
+		 *
289
+		 * @since 1.0.0
290
+		 * @param string $template The template path.
291
+		 */
292
+		return $template = apply_filters('geodir_template_preview', $template);
295 293
 
294
+	}
296 295
 
297
-    if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
298 296
 
299
-        $template = geodir_locate_template('success');
297
+	if (geodir_is_page('listing-success') || $geodir_custom_page_list['geodir_listing_success_page']) {
300 298
 
301
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
302
-        /**
303
-         * Filter the success template path.
304
-         *
305
-         * @since 1.0.0
306
-         * @param string $template The template path.
307
-         */
308
-        return $template = apply_filters('geodir_template_success', $template);
299
+		$template = geodir_locate_template('success');
309 300
 
310
-    }
301
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
302
+		/**
303
+		 * Filter the success template path.
304
+		 *
305
+		 * @since 1.0.0
306
+		 * @param string $template The template path.
307
+		 */
308
+		return $template = apply_filters('geodir_template_success', $template);
311 309
 
312
-    if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
310
+	}
313 311
 
314
-        $template = geodir_locate_template('detail');
312
+	if (geodir_is_page('detail') || $geodir_custom_page_list['geodir_listing_detail_page']) {
315 313
 
316
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
317
-        /**
318
-         * Filter the detail template path.
319
-         *
320
-         * @since 1.0.0
321
-         * @param string $template The template path.
322
-         */
323
-        return $template = apply_filters('geodir_template_detail', $template);
314
+		$template = geodir_locate_template('detail');
324 315
 
325
-    }
316
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
317
+		/**
318
+		 * Filter the detail template path.
319
+		 *
320
+		 * @since 1.0.0
321
+		 * @param string $template The template path.
322
+		 */
323
+		return $template = apply_filters('geodir_template_detail', $template);
326 324
 
327
-    if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
325
+	}
328 326
 
329
-        $template = geodir_locate_template('listing');
327
+	if (geodir_is_page('listing') || $geodir_custom_page_list['geodir_listing_page']) {
330 328
 
331
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
332
-        /**
333
-         * Filter the listing template path.
334
-         *
335
-         * @since 1.0.0
336
-         * @param string $template The template path.
337
-         */
338
-        return $template = apply_filters('geodir_template_listing', $template);
329
+		$template = geodir_locate_template('listing');
339 330
 
340
-    }
331
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
332
+		/**
333
+		 * Filter the listing template path.
334
+		 *
335
+		 * @since 1.0.0
336
+		 * @param string $template The template path.
337
+		 */
338
+		return $template = apply_filters('geodir_template_listing', $template);
341 339
 
342
-    if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
340
+	}
343 341
 
344
-        $template = geodir_locate_template('search');
342
+	if (geodir_is_page('search') || $geodir_custom_page_list['geodir_search_page']) {
345 343
 
346
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
347
-        /**
348
-         * Filter the search template path.
349
-         *
350
-         * @since 1.0.0
351
-         * @param string $template The template path.
352
-         */
353
-        return $template = apply_filters('geodir_template_search', $template);
344
+		$template = geodir_locate_template('search');
354 345
 
355
-    }
346
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
347
+		/**
348
+		 * Filter the search template path.
349
+		 *
350
+		 * @since 1.0.0
351
+		 * @param string $template The template path.
352
+		 */
353
+		return $template = apply_filters('geodir_template_search', $template);
356 354
 
357
-    if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
355
+	}
358 356
 
359
-        $template = geodir_locate_template('author');
357
+	if (geodir_is_page('author') || $geodir_custom_page_list['geodir_author_page']) {
360 358
 
361
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
362
-        /**
363
-         * Filter the author template path.
364
-         *
365
-         * @since 1.0.0
366
-         * @param string $template The template path.
367
-         */
368
-        return $template = apply_filters('geodir_template_author', $template);
359
+		$template = geodir_locate_template('author');
369 360
 
370
-    }
361
+		if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
362
+		/**
363
+		 * Filter the author template path.
364
+		 *
365
+		 * @since 1.0.0
366
+		 * @param string $template The template path.
367
+		 */
368
+		return $template = apply_filters('geodir_template_author', $template);
371 369
 
372
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
370
+	}
373 371
 
374
-        global $post, $wp_query;
372
+	if ( geodir_is_page('home') || geodir_is_page('location')) {
375 373
 
376
-        if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
377
-            || (is_home() && !$wp_query->is_posts_page)
378
-        ) {
374
+		global $post, $wp_query;
379 375
 
380
-            $template = geodir_locate_template('geodir-home');
376
+		if (geodir_is_page('home') || ('page' == get_option('show_on_front') && isset($post->ID) && $post->ID == get_option('page_on_front'))
377
+			|| (is_home() && !$wp_query->is_posts_page)
378
+		) {
381 379
 
382
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
383
-            /**
384
-             * Filter the home page template path.
385
-             *
386
-             * @since 1.0.0
387
-             * @param string $template The template path.
388
-             */
389
-            return $template = apply_filters('geodir_template_homepage', $template);
380
+			$template = geodir_locate_template('geodir-home');
390 381
 
391
-        } elseif (geodir_is_page('location')) {
382
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
383
+			/**
384
+			 * Filter the home page template path.
385
+			 *
386
+			 * @since 1.0.0
387
+			 * @param string $template The template path.
388
+			 */
389
+			return $template = apply_filters('geodir_template_homepage', $template);
392 390
 
393
-            $template = geodir_locate_template('location');
391
+		} elseif (geodir_is_page('location')) {
394 392
 
395
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
396
-            /**
397
-             * Filter the location template path.
398
-             *
399
-             * @since 1.0.0
400
-             * @param string $template The template path.
401
-             */
402
-            return $template = apply_filters('geodir_template_location', $template);
393
+			$template = geodir_locate_template('location');
403 394
 
404
-        } else
405
-            return $template;
395
+			if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
396
+			/**
397
+			 * Filter the location template path.
398
+			 *
399
+			 * @since 1.0.0
400
+			 * @param string $template The template path.
401
+			 */
402
+			return $template = apply_filters('geodir_template_location', $template);
406 403
 
407
-    }
404
+		} else
405
+			return $template;
408 406
 
409
-    return $template;
407
+	}
408
+
409
+	return $template;
410 410
 }
411 411
 
412 412
 /**
@@ -421,44 +421,44 @@  discard block
 block discarded – undo
421 421
  */
422 422
 function geodir_get_template_part($slug = '', $name = NULL)
423 423
 {
424
-    global $geodirectory, $post;
425
-    /**
426
-     * Called at the start for the geodir_get_template_part() function.
427
-     *
428
-     * Used dynamic hook name: geodir_get_template_part_{$slug}
429
-     *
430
-     * @since 1.0.0
431
-     * @package GeoDirectory
432
-     * @param string $slug The template slug.
433
-     * @param string $name The template name.
434
-     */
435
-    do_action("geodir_get_template_part_{$slug}", $slug, $name);
436
-    $templates = array();
437
-    $name = (string)$name;
438
-    if ('' !== $name) {
439
-        $template_name = "{$slug}-{$name}.php";
440
-
441
-    } else {
442
-        $template_name = "{$slug}.php";
443
-    }
444
-
445
-    if (!locate_template(array("geodirectory/" . $template_name))) :
446
-        /**
447
-         * Filter the template part with slug and name.
448
-         *
449
-         * @since 1.0.0
450
-         * @param string $template_name The template name.
451
-         */
452
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
453
-        /**
454
-         * Includes the template part with slug and name.
455
-         *
456
-         * @since 1.0.0
457
-         */
458
-        include($template);
459
-    else:
460
-        locate_template(array("geodirectory/" . $template_name), true, false);
461
-    endif;
424
+	global $geodirectory, $post;
425
+	/**
426
+	 * Called at the start for the geodir_get_template_part() function.
427
+	 *
428
+	 * Used dynamic hook name: geodir_get_template_part_{$slug}
429
+	 *
430
+	 * @since 1.0.0
431
+	 * @package GeoDirectory
432
+	 * @param string $slug The template slug.
433
+	 * @param string $name The template name.
434
+	 */
435
+	do_action("geodir_get_template_part_{$slug}", $slug, $name);
436
+	$templates = array();
437
+	$name = (string)$name;
438
+	if ('' !== $name) {
439
+		$template_name = "{$slug}-{$name}.php";
440
+
441
+	} else {
442
+		$template_name = "{$slug}.php";
443
+	}
444
+
445
+	if (!locate_template(array("geodirectory/" . $template_name))) :
446
+		/**
447
+		 * Filter the template part with slug and name.
448
+		 *
449
+		 * @since 1.0.0
450
+		 * @param string $template_name The template name.
451
+		 */
452
+		$template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
453
+		/**
454
+		 * Includes the template part with slug and name.
455
+		 *
456
+		 * @since 1.0.0
457
+		 */
458
+		include($template);
459
+	else:
460
+		locate_template(array("geodirectory/" . $template_name), true, false);
461
+	endif;
462 462
 
463 463
 }
464 464
 
@@ -474,23 +474,23 @@  discard block
 block discarded – undo
474 474
  */
475 475
 function geodir_core_post_view_extra_class($class, $all_postypes = '')
476 476
 {
477
-    global $post;
477
+	global $post;
478 478
 
479
-    if (!$all_postypes) {
480
-        $all_postypes = geodir_get_posttypes();
481
-    }
479
+	if (!$all_postypes) {
480
+		$all_postypes = geodir_get_posttypes();
481
+	}
482 482
 
483
-    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
484
-    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
485
-    $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
483
+	$gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
484
+	$gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;
485
+	$gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
486 486
 
487
-    if ($gdp_post_id && $gdp_post_type) {
488
-        $append_class = 'gd-post-' . $gdp_post_type;
489
-        $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
490
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
491
-    }
487
+	if ($gdp_post_id && $gdp_post_type) {
488
+		$append_class = 'gd-post-' . $gdp_post_type;
489
+		$append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
490
+		$class = $class != '' ? $class . ' ' . $append_class : $append_class;
491
+	}
492 492
 
493
-    return $class;
493
+	return $class;
494 494
 }
495 495
 
496 496
 /**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
  * @param bool $favorite Listing Optional. Are favorite listings results? Default: false.
505 505
  */
506 506
 function geodir_display_message_not_found_on_listing($template_listview = 'listing-listview', $favorite = false) {
507
-    if ($favorite) {
507
+	if ($favorite) {
508 508
 		$message = __('No favorite listings found which match your selection.', 'geodirectory');
509 509
 	} else {
510 510
 		$message = __('No listings found which match your selection.', 'geodirectory');
@@ -674,40 +674,40 @@  discard block
 block discarded – undo
674 674
 }
675 675
 
676 676
 function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
677
-    if ( empty( $content ) || empty( $shortcode ) ) {
678
-        return array();
679
-    }
677
+	if ( empty( $content ) || empty( $shortcode ) ) {
678
+		return array();
679
+	}
680 680
     
681
-    if ( false === strpos( $content, '[' ) ) {
682
-        return array();
683
-    }
684
-
685
-    if ( ! has_shortcode( $content, $shortcode ) ) {
686
-        return array();
687
-    }
688
-
689
-    $shortcodes = array();
690
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
691
-        foreach ( $matches as $match ) {
692
-            if ( $shortcode === $match[2] ) {
693
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
694
-                if ( ! is_array( $shortcode_attrs ) ) {
695
-                    $shortcode_attrs = array();
696
-                }
697
-                $shortcode_attrs['shortcode_tag'] = $shortcode;
698
-                if ( !empty( $match[5] ) ) {
699
-                    $shortcode_attrs['shortcode_content'] = $match[5];
700
-                }
701
-                $shortcodes[] = $shortcode_attrs;
702
-                if ( $first === true ) {
703
-                    break;
704
-                }
705
-            }
706
-        }
707
-        if ( $first === true && !empty( $shortcodes ) ) {
708
-            $shortcodes = $shortcodes[0];
709
-        }
710
-    }
711
-
712
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
681
+	if ( false === strpos( $content, '[' ) ) {
682
+		return array();
683
+	}
684
+
685
+	if ( ! has_shortcode( $content, $shortcode ) ) {
686
+		return array();
687
+	}
688
+
689
+	$shortcodes = array();
690
+	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
691
+		foreach ( $matches as $match ) {
692
+			if ( $shortcode === $match[2] ) {
693
+				$shortcode_attrs = shortcode_parse_atts( $match[3] );
694
+				if ( ! is_array( $shortcode_attrs ) ) {
695
+					$shortcode_attrs = array();
696
+				}
697
+				$shortcode_attrs['shortcode_tag'] = $shortcode;
698
+				if ( !empty( $match[5] ) ) {
699
+					$shortcode_attrs['shortcode_content'] = $match[5];
700
+				}
701
+				$shortcodes[] = $shortcode_attrs;
702
+				if ( $first === true ) {
703
+					break;
704
+				}
705
+			}
706
+		}
707
+		if ( $first === true && !empty( $shortcodes ) ) {
708
+			$shortcodes = $shortcodes[0];
709
+		}
710
+	}
711
+
712
+	return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
713 713
 }
714 714
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                 if ($is_wpml && !empty($wp->query_vars['page_id'])) {
69 69
                     wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
70 70
                 } else {
71
-                    wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type);
71
+                    wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type);
72 72
                 }
73 73
                 gd_die();
74 74
             }
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
         case 'listing-listview':
127 127
             $template = locate_template(array("geodirectory/listing-listview.php"));
128 128
             if (!$template) {
129
-                $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php';
129
+                $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php';
130 130
             }
131 131
             return $template;
132 132
             break;
133 133
         case 'widget-listing-listview':
134 134
             $template = locate_template(array("geodirectory/widget-listing-listview.php"));
135 135
             if (!$template) {
136
-                $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php';
136
+                $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php';
137 137
             }
138 138
             return $template;
139 139
             break;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
         $template = geodir_locate_template('signup');
193 193
 
194
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php';
194
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php';
195 195
 
196 196
         /**
197 197
          * Filter the signup template path.
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
     if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
206 206
         if (!geodir_is_default_location_set()) {
207 207
             global $information;
208
-            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
208
+            $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>');
209 209
 
210 210
             $template = geodir_locate_template('information');
211 211
 
212
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
212
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
213 213
             /**
214 214
              * Filter the information template path.
215 215
              *
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
         // check if pid exists in the record if yes then check if this post belongs to the user who is logged in.
222 222
         if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
223 223
             /// WPML
224
-            if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
224
+            if (geodir_wpml_is_post_type_translated(get_post_type((int) $_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
225 225
                 global $sitepress;
226 226
                 
227
-                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of));
227
+                $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of));
228 228
                 $sitepress->switch_lang($lang_of_duplicate, true);
229 229
         
230 230
                 $redirect_to = get_permalink(geodir_add_listing_page_id());
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
             if (!$is_current_user_owner) {
244 244
                 $template = geodir_locate_template('information');
245 245
 
246
-                if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php';
246
+                if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php';
247 247
                 /**
248 248
                  * Filter the information template path.
249 249
                  *
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
         $template = geodir_locate_template('add-listing');
267 267
 
268
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php';
268
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php';
269 269
         /**
270 270
          * Filter the add listing template path.
271 271
          *
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 
283 283
         $template = geodir_locate_template('preview');
284 284
 
285
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
285
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
286 286
         /**
287 287
          * Filter the preview template path.
288 288
          *
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
         $template = geodir_locate_template('success');
300 300
 
301
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php';
301
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php';
302 302
         /**
303 303
          * Filter the success template path.
304 304
          *
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         $template = geodir_locate_template('detail');
315 315
 
316
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php';
316
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php';
317 317
         /**
318 318
          * Filter the detail template path.
319 319
          *
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 
329 329
         $template = geodir_locate_template('listing');
330 330
 
331
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php';
331
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php';
332 332
         /**
333 333
          * Filter the listing template path.
334 334
          *
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
         $template = geodir_locate_template('search');
345 345
 
346
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php';
346
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php';
347 347
         /**
348 348
          * Filter the search template path.
349 349
          *
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
         $template = geodir_locate_template('author');
360 360
 
361
-        if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php';
361
+        if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php';
362 362
         /**
363 363
          * Filter the author template path.
364 364
          *
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
     }
371 371
 
372
-    if ( geodir_is_page('home') || geodir_is_page('location')) {
372
+    if (geodir_is_page('home') || geodir_is_page('location')) {
373 373
 
374 374
         global $post, $wp_query;
375 375
 
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 
380 380
             $template = geodir_locate_template('geodir-home');
381 381
 
382
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php';
382
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php';
383 383
             /**
384 384
              * Filter the home page template path.
385 385
              *
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
             $template = geodir_locate_template('location');
394 394
 
395
-            if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php';
395
+            if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php';
396 396
             /**
397 397
              * Filter the location template path.
398 398
              *
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      */
435 435
     do_action("geodir_get_template_part_{$slug}", $slug, $name);
436 436
     $templates = array();
437
-    $name = (string)$name;
437
+    $name = (string) $name;
438 438
     if ('' !== $name) {
439 439
         $template_name = "{$slug}-{$name}.php";
440 440
 
@@ -442,14 +442,14 @@  discard block
 block discarded – undo
442 442
         $template_name = "{$slug}.php";
443 443
     }
444 444
 
445
-    if (!locate_template(array("geodirectory/" . $template_name))) :
445
+    if (!locate_template(array("geodirectory/".$template_name))) :
446 446
         /**
447 447
          * Filter the template part with slug and name.
448 448
          *
449 449
          * @since 1.0.0
450 450
          * @param string $template_name The template name.
451 451
          */
452
-        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
452
+        $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
453 453
         /**
454 454
          * Includes the template part with slug and name.
455 455
          *
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
          */
458 458
         include($template);
459 459
     else:
460
-        locate_template(array("geodirectory/" . $template_name), true, false);
460
+        locate_template(array("geodirectory/".$template_name), true, false);
461 461
     endif;
462 462
 
463 463
 }
@@ -485,9 +485,9 @@  discard block
 block discarded – undo
485 485
     $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL;
486 486
 
487 487
     if ($gdp_post_id && $gdp_post_type) {
488
-        $append_class = 'gd-post-' . $gdp_post_type;
488
+        $append_class = 'gd-post-'.$gdp_post_type;
489 489
         $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : '';
490
-        $class = $class != '' ? $class . ' ' . $append_class : $append_class;
490
+        $class = $class != '' ? $class.' '.$append_class : $append_class;
491 491
     }
492 492
 
493 493
     return $class;
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	$message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
521 521
 	
522
-	echo '<li class="no-listing">' . $message . '</li>';
522
+	echo '<li class="no-listing">'.$message.'</li>';
523 523
 }
524 524
 
525 525
 /**
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 function geodir_convert_listing_view_class($columns = '') {
549 549
 	$class = '';
550 550
 	
551
-	switch ((int)$columns) {
551
+	switch ((int) $columns) {
552 552
 		case 1:
553 553
 			$class = '';
554 554
 		break;
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 		$html .= '<option value=""></option>';
614 614
 		if (!empty($star_texts) && is_array($star_texts)) {
615 615
 			foreach ($star_texts as $i => $text) {
616
-				$html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>';
616
+				$html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>';
617 617
 			}
618 618
 		} else {
619 619
 			$html .= '<option value="1">1</option>';
@@ -642,14 +642,14 @@  discard block
 block discarded – undo
642 642
 function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
643 643
 	if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
644 644
 		$rating = min($rating, $star_count);
645
-		$full_stars = floor( $rating );
646
-		$half_stars = ceil( $rating - $full_stars );
645
+		$full_stars = floor($rating);
646
+		$half_stars = ceil($rating - $full_stars);
647 647
 		$empty_stars = $star_count - $full_stars - $half_stars;
648 648
 		
649 649
 		$html = '<div class="gd-star-rating gd-fa-star-rating">';
650
-		$html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars );
651
-		$html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars );
652
-		$html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
650
+		$html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
651
+		$html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
652
+		$html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
653 653
 		$html .= '</div>';
654 654
 	}
655 655
 
@@ -668,46 +668,46 @@  discard block
 block discarded – undo
668 668
 		$full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
669 669
 		if ($full_color != '#757575') {
670 670
 			echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after,
671
-			.gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
671
+			.gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
672 672
 		}
673 673
 	}
674 674
 }
675 675
 
676
-function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
677
-    if ( empty( $content ) || empty( $shortcode ) ) {
676
+function geodir_parse_shortcodes($content, $shortcode, $first = true) {
677
+    if (empty($content) || empty($shortcode)) {
678 678
         return array();
679 679
     }
680 680
     
681
-    if ( false === strpos( $content, '[' ) ) {
681
+    if (false === strpos($content, '[')) {
682 682
         return array();
683 683
     }
684 684
 
685
-    if ( ! has_shortcode( $content, $shortcode ) ) {
685
+    if (!has_shortcode($content, $shortcode)) {
686 686
         return array();
687 687
     }
688 688
 
689 689
     $shortcodes = array();
690
-    if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
691
-        foreach ( $matches as $match ) {
692
-            if ( $shortcode === $match[2] ) {
693
-                $shortcode_attrs = shortcode_parse_atts( $match[3] );
694
-                if ( ! is_array( $shortcode_attrs ) ) {
690
+    if (preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER)) {
691
+        foreach ($matches as $match) {
692
+            if ($shortcode === $match[2]) {
693
+                $shortcode_attrs = shortcode_parse_atts($match[3]);
694
+                if (!is_array($shortcode_attrs)) {
695 695
                     $shortcode_attrs = array();
696 696
                 }
697 697
                 $shortcode_attrs['shortcode_tag'] = $shortcode;
698
-                if ( !empty( $match[5] ) ) {
698
+                if (!empty($match[5])) {
699 699
                     $shortcode_attrs['shortcode_content'] = $match[5];
700 700
                 }
701 701
                 $shortcodes[] = $shortcode_attrs;
702
-                if ( $first === true ) {
702
+                if ($first === true) {
703 703
                     break;
704 704
                 }
705 705
             }
706 706
         }
707
-        if ( $first === true && !empty( $shortcodes ) ) {
707
+        if ($first === true && !empty($shortcodes)) {
708 708
             $shortcodes = $shortcodes[0];
709 709
         }
710 710
     }
711 711
 
712
-    return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first );
712
+    return apply_filters('geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first);
713 713
 }
714 714
\ No newline at end of file
Please login to merge, or discard this patch.