Test Failed
Pull Request — master (#450)
by Kiran
19:15
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.