@@ -67,10 +67,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
@@ -137,7 +137,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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> |
@@ -82,16 +82,16 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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> |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | if ($is_wpml && !empty($wp->query_vars['page_id'])) {
|
| 69 | 69 | wp_redirect(geodir_getlink(get_permalink($wp->query_vars['page_id']), array('listing_type' => $post_type)));
|
| 70 | 70 | } else {
|
| 71 | - wp_redirect(trailingslashit(get_site_url()) . $pagename . '/?listing_type=' . $post_type); |
|
| 71 | + wp_redirect(trailingslashit(get_site_url()).$pagename.'/?listing_type='.$post_type); |
|
| 72 | 72 | } |
| 73 | 73 | gd_die(); |
| 74 | 74 | } |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | case 'listing-listview': |
| 127 | 127 | $template = locate_template(array("geodirectory/listing-listview.php"));
|
| 128 | 128 | if (!$template) {
|
| 129 | - $template = geodir_plugin_path() . '/geodirectory-templates/listing-listview.php'; |
|
| 129 | + $template = geodir_plugin_path().'/geodirectory-templates/listing-listview.php'; |
|
| 130 | 130 | } |
| 131 | 131 | return $template; |
| 132 | 132 | break; |
| 133 | 133 | case 'widget-listing-listview': |
| 134 | 134 | $template = locate_template(array("geodirectory/widget-listing-listview.php"));
|
| 135 | 135 | if (!$template) {
|
| 136 | - $template = geodir_plugin_path() . '/geodirectory-templates/widget-listing-listview.php'; |
|
| 136 | + $template = geodir_plugin_path().'/geodirectory-templates/widget-listing-listview.php'; |
|
| 137 | 137 | } |
| 138 | 138 | return $template; |
| 139 | 139 | break; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | $template = geodir_locate_template('signup');
|
| 193 | 193 | |
| 194 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-signup.php'; |
|
| 194 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-signup.php'; |
|
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | 197 | * Filter the signup template path. |
@@ -205,11 +205,11 @@ discard block |
||
| 205 | 205 | if (geodir_is_page('add-listing') || $geodir_custom_page_list['geodir_add_listing_page']) {
|
| 206 | 206 | if (!geodir_is_default_location_set()) {
|
| 207 | 207 | global $information; |
| 208 | - $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\'' . admin_url('admin.php?page=geodirectory&tab=default_location_settings') . '\'>', '</a>');
|
|
| 208 | + $information = sprintf(__('Please %sclick here%s to set a default location, this will make the plugin work properly.', 'geodirectory'), '<a href=\''.admin_url('admin.php?page=geodirectory&tab=default_location_settings').'\'>', '</a>');
|
|
| 209 | 209 | |
| 210 | 210 | $template = geodir_locate_template('information');
|
| 211 | 211 | |
| 212 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 212 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 213 | 213 | /** |
| 214 | 214 | * Filter the information template path. |
| 215 | 215 | * |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | // check if pid exists in the record if yes then check if this post belongs to the user who is logged in. |
| 222 | 222 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') {
|
| 223 | 223 | /// WPML |
| 224 | - if (geodir_wpml_is_post_type_translated(get_post_type((int)$_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int)$_GET['pid'])) {
|
|
| 224 | + if (geodir_wpml_is_post_type_translated(get_post_type((int) $_GET['pid'])) && $duplicate_of = wpml_get_master_post_from_duplicate((int) $_GET['pid'])) {
|
|
| 225 | 225 | global $sitepress; |
| 226 | 226 | |
| 227 | - $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_' . get_post_type($duplicate_of)); |
|
| 227 | + $lang_of_duplicate = geodir_get_language_for_element($duplicate_of, 'post_'.get_post_type($duplicate_of)); |
|
| 228 | 228 | $sitepress->switch_lang($lang_of_duplicate, true); |
| 229 | 229 | |
| 230 | 230 | $redirect_to = get_permalink(geodir_add_listing_page_id()); |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | if (!$is_current_user_owner) {
|
| 244 | 244 | $template = geodir_locate_template('information');
|
| 245 | 245 | |
| 246 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-information.php'; |
|
| 246 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-information.php'; |
|
| 247 | 247 | /** |
| 248 | 248 | * Filter the information template path. |
| 249 | 249 | * |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | |
| 266 | 266 | $template = geodir_locate_template('add-listing');
|
| 267 | 267 | |
| 268 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/add-listing.php'; |
|
| 268 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/add-listing.php'; |
|
| 269 | 269 | /** |
| 270 | 270 | * Filter the add listing template path. |
| 271 | 271 | * |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | |
| 283 | 283 | $template = geodir_locate_template('preview');
|
| 284 | 284 | |
| 285 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 285 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php'; |
|
| 286 | 286 | /** |
| 287 | 287 | * Filter the preview template path. |
| 288 | 288 | * |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $template = geodir_locate_template('success');
|
| 300 | 300 | |
| 301 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-success.php'; |
|
| 301 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-success.php'; |
|
| 302 | 302 | /** |
| 303 | 303 | * Filter the success template path. |
| 304 | 304 | * |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $template = geodir_locate_template('detail');
|
| 315 | 315 | |
| 316 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/listing-detail.php'; |
|
| 316 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/listing-detail.php'; |
|
| 317 | 317 | /** |
| 318 | 318 | * Filter the detail template path. |
| 319 | 319 | * |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | $template = geodir_locate_template('listing');
|
| 330 | 330 | |
| 331 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-listing.php'; |
|
| 331 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-listing.php'; |
|
| 332 | 332 | /** |
| 333 | 333 | * Filter the listing template path. |
| 334 | 334 | * |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $template = geodir_locate_template('search');
|
| 345 | 345 | |
| 346 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-search.php'; |
|
| 346 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-search.php'; |
|
| 347 | 347 | /** |
| 348 | 348 | * Filter the search template path. |
| 349 | 349 | * |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | $template = geodir_locate_template('author');
|
| 360 | 360 | |
| 361 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-author.php'; |
|
| 361 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-author.php'; |
|
| 362 | 362 | /** |
| 363 | 363 | * Filter the author template path. |
| 364 | 364 | * |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if ( geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 372 | + if (geodir_is_page('home') || geodir_is_page('location')) {
|
|
| 373 | 373 | |
| 374 | 374 | global $post, $wp_query; |
| 375 | 375 | |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $template = geodir_locate_template('geodir-home');
|
| 381 | 381 | |
| 382 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-home.php'; |
|
| 382 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-home.php'; |
|
| 383 | 383 | /** |
| 384 | 384 | * Filter the home page template path. |
| 385 | 385 | * |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | $template = geodir_locate_template('location');
|
| 394 | 394 | |
| 395 | - if (!$template) $template = geodir_plugin_path() . '/geodirectory-templates/geodir-location.php'; |
|
| 395 | + if (!$template) $template = geodir_plugin_path().'/geodirectory-templates/geodir-location.php'; |
|
| 396 | 396 | /** |
| 397 | 397 | * Filter the location template path. |
| 398 | 398 | * |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | */ |
| 435 | 435 | do_action("geodir_get_template_part_{$slug}", $slug, $name);
|
| 436 | 436 | $templates = array(); |
| 437 | - $name = (string)$name; |
|
| 437 | + $name = (string) $name; |
|
| 438 | 438 | if ('' !== $name) {
|
| 439 | 439 | $template_name = "{$slug}-{$name}.php";
|
| 440 | 440 | |
@@ -442,14 +442,14 @@ discard block |
||
| 442 | 442 | $template_name = "{$slug}.php";
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | - if (!locate_template(array("geodirectory/" . $template_name))) :
|
|
| 445 | + if (!locate_template(array("geodirectory/".$template_name))) :
|
|
| 446 | 446 | /** |
| 447 | 447 | * Filter the template part with slug and name. |
| 448 | 448 | * |
| 449 | 449 | * @since 1.0.0 |
| 450 | 450 | * @param string $template_name The template name. |
| 451 | 451 | */ |
| 452 | - $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path() . '/geodirectory-templates/' . $template_name);
|
|
| 452 | + $template = apply_filters("geodir_template_part-{$slug}-{$name}", geodir_plugin_path().'/geodirectory-templates/'.$template_name);
|
|
| 453 | 453 | /** |
| 454 | 454 | * Includes the template part with slug and name. |
| 455 | 455 | * |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | include($template); |
| 459 | 459 | else: |
| 460 | - locate_template(array("geodirectory/" . $template_name), true, false);
|
|
| 460 | + locate_template(array("geodirectory/".$template_name), true, false);
|
|
| 461 | 461 | endif; |
| 462 | 462 | |
| 463 | 463 | } |
@@ -485,9 +485,9 @@ discard block |
||
| 485 | 485 | $gdp_post_type = $gdp_post_type != '' && !empty($all_postypes) && in_array($gdp_post_type, $all_postypes) ? $gdp_post_type : NULL; |
| 486 | 486 | |
| 487 | 487 | if ($gdp_post_id && $gdp_post_type) {
|
| 488 | - $append_class = 'gd-post-' . $gdp_post_type; |
|
| 488 | + $append_class = 'gd-post-'.$gdp_post_type; |
|
| 489 | 489 | $append_class .= isset($post->is_featured) && $post->is_featured > 0 ? ' gd-post-featured' : ''; |
| 490 | - $class = $class != '' ? $class . ' ' . $append_class : $append_class; |
|
| 490 | + $class = $class != '' ? $class.' '.$append_class : $append_class; |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | return $class; |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | */ |
| 520 | 520 | $message = apply_filters('geodir_message_listing_not_found', $message, $template_listview, $favorite);
|
| 521 | 521 | |
| 522 | - echo '<li class="no-listing">' . $message . '</li>'; |
|
| 522 | + echo '<li class="no-listing">'.$message.'</li>'; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /** |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | function geodir_convert_listing_view_class($columns = '') {
|
| 549 | 549 | $class = ''; |
| 550 | 550 | |
| 551 | - switch ((int)$columns) {
|
|
| 551 | + switch ((int) $columns) {
|
|
| 552 | 552 | case 1: |
| 553 | 553 | $class = ''; |
| 554 | 554 | break; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | $html .= '<option value=""></option>'; |
| 614 | 614 | if (!empty($star_texts) && is_array($star_texts)) {
|
| 615 | 615 | foreach ($star_texts as $i => $text) {
|
| 616 | - $html .= '<option ' . selected((int)($i + 1), (int)$default, false) . ' value="' . (int)($i + 1) . '">' . $text . '</option>'; |
|
| 616 | + $html .= '<option '.selected((int) ($i + 1), (int) $default, false).' value="'.(int) ($i + 1).'">'.$text.'</option>'; |
|
| 617 | 617 | } |
| 618 | 618 | } else {
|
| 619 | 619 | $html .= '<option value="1">1</option>'; |
@@ -642,14 +642,14 @@ discard block |
||
| 642 | 642 | function geodir_font_awesome_rating_stars_html($html, $rating, $star_count = 5) {
|
| 643 | 643 | if (get_option('geodir_reviewrating_enable_font_awesome') == '1') {
|
| 644 | 644 | $rating = min($rating, $star_count); |
| 645 | - $full_stars = floor( $rating ); |
|
| 646 | - $half_stars = ceil( $rating - $full_stars ); |
|
| 645 | + $full_stars = floor($rating); |
|
| 646 | + $half_stars = ceil($rating - $full_stars); |
|
| 647 | 647 | $empty_stars = $star_count - $full_stars - $half_stars; |
| 648 | 648 | |
| 649 | 649 | $html = '<div class="gd-star-rating gd-fa-star-rating">'; |
| 650 | - $html .= str_repeat( '<i class="fa fa-star gd-full-star"></i>', $full_stars ); |
|
| 651 | - $html .= str_repeat( '<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars ); |
|
| 652 | - $html .= str_repeat( '<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars); |
|
| 650 | + $html .= str_repeat('<i class="fa fa-star gd-full-star"></i>', $full_stars);
|
|
| 651 | + $html .= str_repeat('<i class="fa fa-star-o fa-star-half-full gd-half-star"></i>', $half_stars);
|
|
| 652 | + $html .= str_repeat('<i class="fa fa-star-o gd-empty-star"></i>', $empty_stars);
|
|
| 653 | 653 | $html .= '</div>'; |
| 654 | 654 | } |
| 655 | 655 | |
@@ -668,46 +668,46 @@ discard block |
||
| 668 | 668 | $full_color = get_option('geodir_reviewrating_fa_full_rating_color', '#757575');
|
| 669 | 669 | if ($full_color != '#757575') {
|
| 670 | 670 | echo '<style type="text/css">.br-theme-fontawesome-stars .br-widget a.br-active:after,.br-theme-fontawesome-stars .br-widget a.br-selected:after, |
| 671 | - .gd-star-rating i.fa {color:' . stripslashes($full_color) . '!important;}</style>';
|
|
| 671 | + .gd-star-rating i.fa {color:' . stripslashes($full_color).'!important;}</style>';
|
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | -function geodir_parse_shortcodes( $content, $shortcode, $first = true ) {
|
|
| 677 | - if ( empty( $content ) || empty( $shortcode ) ) {
|
|
| 676 | +function geodir_parse_shortcodes($content, $shortcode, $first = true) {
|
|
| 677 | + if (empty($content) || empty($shortcode)) {
|
|
| 678 | 678 | return array(); |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | - if ( false === strpos( $content, '[' ) ) {
|
|
| 681 | + if (false === strpos($content, '[')) {
|
|
| 682 | 682 | return array(); |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - if ( ! has_shortcode( $content, $shortcode ) ) {
|
|
| 685 | + if (!has_shortcode($content, $shortcode)) {
|
|
| 686 | 686 | return array(); |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | $shortcodes = array(); |
| 690 | - if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ) ) {
|
|
| 691 | - foreach ( $matches as $match ) {
|
|
| 692 | - if ( $shortcode === $match[2] ) {
|
|
| 693 | - $shortcode_attrs = shortcode_parse_atts( $match[3] ); |
|
| 694 | - if ( ! is_array( $shortcode_attrs ) ) {
|
|
| 690 | + if (preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER)) {
|
|
| 691 | + foreach ($matches as $match) {
|
|
| 692 | + if ($shortcode === $match[2]) {
|
|
| 693 | + $shortcode_attrs = shortcode_parse_atts($match[3]); |
|
| 694 | + if (!is_array($shortcode_attrs)) {
|
|
| 695 | 695 | $shortcode_attrs = array(); |
| 696 | 696 | } |
| 697 | 697 | $shortcode_attrs['shortcode_tag'] = $shortcode; |
| 698 | - if ( !empty( $match[5] ) ) {
|
|
| 698 | + if (!empty($match[5])) {
|
|
| 699 | 699 | $shortcode_attrs['shortcode_content'] = $match[5]; |
| 700 | 700 | } |
| 701 | 701 | $shortcodes[] = $shortcode_attrs; |
| 702 | - if ( $first === true ) {
|
|
| 702 | + if ($first === true) {
|
|
| 703 | 703 | break; |
| 704 | 704 | } |
| 705 | 705 | } |
| 706 | 706 | } |
| 707 | - if ( $first === true && !empty( $shortcodes ) ) {
|
|
| 707 | + if ($first === true && !empty($shortcodes)) {
|
|
| 708 | 708 | $shortcodes = $shortcodes[0]; |
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - return apply_filters( 'geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first ); |
|
| 712 | + return apply_filters('geodir_parse_shortcodes', $shortcodes, $content, $shortcode, $first);
|
|
| 713 | 713 | } |
| 714 | 714 | \ No newline at end of file |