@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /* ON TEMPLATE INCLUDE */ |
137 | 137 | ///////////////////////// |
138 | 138 | |
139 | -add_filter('template_include', 'geodir_template_loader',9); |
|
139 | +add_filter('template_include', 'geodir_template_loader', 9); |
|
140 | 140 | |
141 | 141 | ///////////////////////// |
142 | 142 | /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */ |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | /* WP REVIEW COUNT ACTIONS */ |
177 | 177 | //////////////////////// |
178 | 178 | |
179 | -add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1); |
|
179 | +add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1); |
|
180 | 180 | //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100); |
181 | -add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3); |
|
181 | +add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3); |
|
182 | 182 | //add_action('created_term', 'geodir_term_review_count_force_update', 100); |
183 | 183 | add_action('edited_term', 'geodir_term_review_count_force_update', 100); |
184 | 184 | add_action('delete_term', 'geodir_term_review_count_force_update', 100); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_unset_prev_theme_nav_location($newname) |
225 | 225 | { |
226 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
226 | + $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname); |
|
227 | 227 | if ($geodir_theme_location) { |
228 | 228 | update_option('geodir_theme_location_nav', $geodir_theme_location); |
229 | 229 | } else { |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | include_once('geodirectory-functions/listing_filters.php'); |
259 | 259 | |
260 | 260 | // Theme My Login compatibility fix |
261 | - if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) { |
|
262 | - remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
261 | + if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) { |
|
262 | + remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts')); |
|
263 | 263 | } |
264 | 264 | |
265 | - if ( isset( $_REQUEST['geodir_search'] ) ) { |
|
266 | - add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
267 | - add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
265 | + if (isset($_REQUEST['geodir_search'])) { |
|
266 | + add_filter('geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3); |
|
267 | + add_filter('geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | |
332 | 332 | /////// GEO DIRECOTORY CUSTOM HOOKS /// |
333 | 333 | |
334 | -add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content |
|
335 | -add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content |
|
334 | +add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content |
|
335 | +add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content |
|
336 | 336 | |
337 | 337 | // Detail page sidebar content |
338 | 338 | add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1); |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | do_action('geodir_after_social_sharing_buttons'); |
433 | 433 | $content_html = ob_get_clean(); |
434 | 434 | if (trim($content_html) != '') |
435 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
436 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
435 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>'; |
|
436 | + if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
437 | 437 | /** |
438 | 438 | * Filter the geodir_social_sharing_buttons() function content. |
439 | 439 | * |
@@ -473,12 +473,12 @@ discard block |
||
473 | 473 | $post_id = $post->ID; |
474 | 474 | |
475 | 475 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
476 | - $post_id = (int)$_REQUEST['pid']; |
|
476 | + $post_id = (int) $_REQUEST['pid']; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $postlink = get_permalink(geodir_add_listing_page_id()); |
480 | 480 | $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
481 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
481 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>'; |
|
482 | 482 | } |
483 | 483 | }// end of if, if its a preview or not |
484 | 484 | /** |
@@ -489,8 +489,8 @@ discard block |
||
489 | 489 | do_action('geodir_after_edit_post_link'); |
490 | 490 | $content_html = ob_get_clean(); |
491 | 491 | if (trim($content_html) != '') |
492 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
493 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
492 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>'; |
|
493 | + if ((int) get_option('geodir_disable_user_links_section') != 1) { |
|
494 | 494 | /** |
495 | 495 | * Filter the geodir_edit_post_link() function content. |
496 | 496 | * |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | */ |
512 | 512 | function geodir_detail_page_google_analytics() |
513 | 513 | { |
514 | - global $post,$preview; |
|
515 | - if($preview){return '';} |
|
514 | + global $post, $preview; |
|
515 | + if ($preview) {return ''; } |
|
516 | 516 | $package_info = array(); |
517 | 517 | $package_info = geodir_post_package_info($package_info, $post); |
518 | 518 | |
@@ -544,14 +544,14 @@ discard block |
||
544 | 544 | $hide_refresh = get_option('geodir_ga_auto_refresh'); |
545 | 545 | |
546 | 546 | $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
547 | - if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
547 | + if (get_option('geodir_ga_stats') && is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) { |
|
548 | 548 | $page_url = urlencode($_SERVER['REQUEST_URI']); |
549 | 549 | ?> |
550 | 550 | <script type="text/javascript"> |
551 | 551 | var gd_gaTimeOut; |
552 | - var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
|
553 | - var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>; |
|
554 | - var gd_gaAutoRefresh = <?php echo $auto_refresh;?>; |
|
552 | + var gd_gaTime = parseInt('<?php echo $refresh_time; ?>'); |
|
553 | + var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>; |
|
554 | + var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>; |
|
555 | 555 | ga_data1 = false; |
556 | 556 | ga_data2 = false; |
557 | 557 | ga_data3 = false; |
@@ -692,7 +692,7 @@ discard block |
||
692 | 692 | } |
693 | 693 | |
694 | 694 | function gdga_noResults() { |
695 | - jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>'); |
|
695 | + jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>'); |
|
696 | 696 | jQuery('#gdga-legend-container').html(''); |
697 | 697 | } |
698 | 698 | |
@@ -724,18 +724,18 @@ discard block |
||
724 | 724 | var data2 = results[1].rows.map(function(row) { return +row[2]; }); |
725 | 725 | //var labelsN = results[0].rows.map(function(row) { return +row[1]; }); |
726 | 726 | |
727 | - var labels = ['<?php _e('Jan', 'geodirectory');?>', |
|
728 | - '<?php _e('Feb', 'geodirectory');?>', |
|
729 | - '<?php _e('Mar', 'geodirectory');?>', |
|
730 | - '<?php _e('Apr', 'geodirectory');?>', |
|
731 | - '<?php _e('May', 'geodirectory');?>', |
|
732 | - '<?php _e('Jun', 'geodirectory');?>', |
|
733 | - '<?php _e('Jul', 'geodirectory');?>', |
|
734 | - '<?php _e('Aug', 'geodirectory');?>', |
|
735 | - '<?php _e('Sep', 'geodirectory');?>', |
|
736 | - '<?php _e('Oct', 'geodirectory');?>', |
|
737 | - '<?php _e('Nov', 'geodirectory');?>', |
|
738 | - '<?php _e('Dec', 'geodirectory');?>']; |
|
727 | + var labels = ['<?php _e('Jan', 'geodirectory'); ?>', |
|
728 | + '<?php _e('Feb', 'geodirectory'); ?>', |
|
729 | + '<?php _e('Mar', 'geodirectory'); ?>', |
|
730 | + '<?php _e('Apr', 'geodirectory'); ?>', |
|
731 | + '<?php _e('May', 'geodirectory'); ?>', |
|
732 | + '<?php _e('Jun', 'geodirectory'); ?>', |
|
733 | + '<?php _e('Jul', 'geodirectory'); ?>', |
|
734 | + '<?php _e('Aug', 'geodirectory'); ?>', |
|
735 | + '<?php _e('Sep', 'geodirectory'); ?>', |
|
736 | + '<?php _e('Oct', 'geodirectory'); ?>', |
|
737 | + '<?php _e('Nov', 'geodirectory'); ?>', |
|
738 | + '<?php _e('Dec', 'geodirectory'); ?>']; |
|
739 | 739 | |
740 | 740 | // Ensure the data arrays are at least as long as the labels array. |
741 | 741 | // Chart.js bar charts don't (yet) accept sparse datasets. |
@@ -748,13 +748,13 @@ discard block |
||
748 | 748 | labels : labels, |
749 | 749 | datasets : [ |
750 | 750 | { |
751 | - label: '<?php _e('Last Year', 'geodirectory');?>', |
|
751 | + label: '<?php _e('Last Year', 'geodirectory'); ?>', |
|
752 | 752 | fillColor : "rgba(220,220,220,0.5)", |
753 | 753 | strokeColor : "rgba(220,220,220,1)", |
754 | 754 | data : data2 |
755 | 755 | }, |
756 | 756 | { |
757 | - label: '<?php _e('This Year', 'geodirectory');?>', |
|
757 | + label: '<?php _e('This Year', 'geodirectory'); ?>', |
|
758 | 758 | fillColor : "rgba(151,187,205,0.5)", |
759 | 759 | strokeColor : "rgba(151,187,205,1)", |
760 | 760 | data : data1 |
@@ -799,30 +799,30 @@ discard block |
||
799 | 799 | |
800 | 800 | <?php |
801 | 801 | // Here we list the shorthand days of the week so it can be used in translation. |
802 | - __("Mon",'geodirectory'); |
|
803 | - __("Tue",'geodirectory'); |
|
804 | - __("Wed",'geodirectory'); |
|
805 | - __("Thu",'geodirectory'); |
|
806 | - __("Fri",'geodirectory'); |
|
807 | - __("Sat",'geodirectory'); |
|
808 | - __("Sun",'geodirectory'); |
|
802 | + __("Mon", 'geodirectory'); |
|
803 | + __("Tue", 'geodirectory'); |
|
804 | + __("Wed", 'geodirectory'); |
|
805 | + __("Thu", 'geodirectory'); |
|
806 | + __("Fri", 'geodirectory'); |
|
807 | + __("Sat", 'geodirectory'); |
|
808 | + __("Sun", 'geodirectory'); |
|
809 | 809 | ?> |
810 | 810 | |
811 | 811 | labels = [ |
812 | - "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
|
813 | - "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>", |
|
814 | - "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>", |
|
815 | - "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>", |
|
816 | - "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>", |
|
817 | - "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>", |
|
818 | - "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>" |
|
812 | + "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>", |
|
813 | + "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>", |
|
814 | + "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>", |
|
815 | + "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>", |
|
816 | + "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>", |
|
817 | + "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>", |
|
818 | + "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>" |
|
819 | 819 | ]; |
820 | 820 | |
821 | 821 | var data = { |
822 | 822 | labels : labels, |
823 | 823 | datasets : [ |
824 | 824 | { |
825 | - label: '<?php _e('Last Week', 'geodirectory');?>', |
|
825 | + label: '<?php _e('Last Week', 'geodirectory'); ?>', |
|
826 | 826 | fillColor : "rgba(220,220,220,0.5)", |
827 | 827 | strokeColor : "rgba(220,220,220,1)", |
828 | 828 | pointColor : "rgba(220,220,220,1)", |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | data : data2 |
831 | 831 | }, |
832 | 832 | { |
833 | - label: '<?php _e('This Week', 'geodirectory');?>', |
|
833 | + label: '<?php _e('This Week', 'geodirectory'); ?>', |
|
834 | 834 | fillColor : "rgba(151,187,205,0.5)", |
835 | 835 | strokeColor : "rgba(151,187,205,1)", |
836 | 836 | pointColor : "rgba(151,187,205,1)", |
@@ -1037,18 +1037,18 @@ discard block |
||
1037 | 1037 | </style> |
1038 | 1038 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> |
1039 | 1039 | <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script> |
1040 | - <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button> |
|
1040 | + <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button> |
|
1041 | 1041 | <span id="ga_stats" class="gdga-analytics-box" style="display:none"> |
1042 | - <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div> |
|
1042 | + <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div> |
|
1043 | 1043 | <div id="gd-active-users-container"> |
1044 | - <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?> |
|
1044 | + <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?> |
|
1045 | 1045 | <b class="gd-ActiveUsers-value">0</b> |
1046 | 1046 | </div> |
1047 | 1047 | </div> |
1048 | 1048 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;"> |
1049 | - <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option> |
|
1050 | - <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option> |
|
1051 | - <option value="country"><?php _e("Top Countries", 'geodirectory');?></option> |
|
1049 | + <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option> |
|
1050 | + <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option> |
|
1051 | + <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option> |
|
1052 | 1052 | </select> |
1053 | 1053 | <div class="Chartjs-figure" id="gdga-chart-container"></div> |
1054 | 1054 | <ol class="Chartjs-legend" id="gdga-legend-container"></ol> |
@@ -1064,8 +1064,8 @@ discard block |
||
1064 | 1064 | do_action('geodir_after_google_analytics'); |
1065 | 1065 | $content_html = ob_get_clean(); |
1066 | 1066 | if (trim($content_html) != '') |
1067 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1068 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1067 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>'; |
|
1068 | + if ((int) get_option('geodir_disable_google_analytics_section') != 1) { |
|
1069 | 1069 | /** |
1070 | 1070 | * Filter the geodir_edit_post_link() function content. |
1071 | 1071 | * |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | { |
1092 | 1092 | global $post, $preview, $post_images; |
1093 | 1093 | |
1094 | - if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) { |
|
1094 | + if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) { |
|
1095 | 1095 | return; |
1096 | 1096 | } |
1097 | 1097 | ob_start(); // Start buffering; |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | |
1127 | 1127 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1128 | 1128 | |
1129 | - $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />'; |
|
1129 | + $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />'; |
|
1130 | 1130 | |
1131 | 1131 | $html .= '<span class="item">'; |
1132 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1132 | + $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>'; |
|
1133 | 1133 | |
1134 | 1134 | if ($post_images) { |
1135 | 1135 | foreach ($post_images as $img) { |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | if (isset($post_img) && $post_img) { |
1142 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1142 | + $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />'; |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | $html .= '</span>'; |
@@ -1166,9 +1166,9 @@ discard block |
||
1166 | 1166 | do_action('geodir_after_detail_page_review_rating'); |
1167 | 1167 | $content_html = ob_get_clean(); |
1168 | 1168 | if (trim($content_html) != '') { |
1169 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1169 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>'; |
|
1170 | 1170 | } |
1171 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1171 | + if ((int) get_option('geodir_disable_rating_info_section') != 1) { |
|
1172 | 1172 | /** |
1173 | 1173 | * Filter the geodir_detail_page_review_rating() function content. |
1174 | 1174 | * |
@@ -1207,8 +1207,8 @@ discard block |
||
1207 | 1207 | |
1208 | 1208 | $content_html = ob_get_clean(); |
1209 | 1209 | if (trim($content_html) != '') |
1210 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1211 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1210 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>'; |
|
1211 | + if ((int) get_option('geodir_disable_listing_info_section') != 1) { |
|
1212 | 1212 | /** |
1213 | 1213 | * Filter the output html for function geodir_detail_page_more_info(). |
1214 | 1214 | * |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
1308 | 1308 | 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
1309 | 1309 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1310 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1310 | + 'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1311 | 1311 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1312 | 1312 | 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
1313 | 1313 | 'geodir_map_name' => geodir_map_name(), |
@@ -1336,10 +1336,10 @@ discard block |
||
1336 | 1336 | foreach ($arr_alert_msg as $key => $value) { |
1337 | 1337 | if (!is_scalar($value)) |
1338 | 1338 | continue; |
1339 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1339 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1342 | + $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';'; |
|
1343 | 1343 | echo '<script>'; |
1344 | 1344 | echo $script; |
1345 | 1345 | echo '</script>'; |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | $geodir_old_sidebars = get_option('geodir_sidebars'); |
1430 | 1430 | if (is_array($geodir_old_sidebars)) { |
1431 | 1431 | foreach ($geodir_old_sidebars as $key => $val) { |
1432 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1432 | + if (0 === strpos($key, 'geodir_'))// if gd widget |
|
1433 | 1433 | { |
1434 | 1434 | $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
1435 | 1435 | } |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | global $post; |
1509 | 1509 | $term_condition = ''; |
1510 | 1510 | if (isset($_REQUEST['backandedit'])) { |
1511 | - $post = (object)$gd_session->get('listing'); |
|
1511 | + $post = (object) $gd_session->get('listing'); |
|
1512 | 1512 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
1513 | 1513 | } |
1514 | 1514 | |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | echo 'checked="checked"'; |
1523 | 1523 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
1524 | 1524 | class="geodir_textfield" value="1" |
1525 | - style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
|
1525 | + style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
|
1526 | 1526 | </span> |
1527 | 1527 | </div> |
1528 | 1528 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
@@ -1562,7 +1562,7 @@ discard block |
||
1562 | 1562 | /** This action is documented in geodirectory_template_actions.php */ |
1563 | 1563 | $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
1564 | 1564 | |
1565 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1565 | + if (!($desc_limit === '' || (int) $desc_limit > 0)) { |
|
1566 | 1566 | $is_display = false; |
1567 | 1567 | } |
1568 | 1568 | } |
@@ -1610,16 +1610,16 @@ discard block |
||
1610 | 1610 | global $wpdb, $plugin_prefix; |
1611 | 1611 | |
1612 | 1612 | // Remove unused virtual page |
1613 | - $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1613 | + $listings_page_id = (int) get_option('geodir_listing_page'); |
|
1614 | 1614 | if ($listings_page_id) { |
1615 | - $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
|
1615 | + $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
|
1616 | 1616 | delete_option('geodir_listing_page'); |
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | if (!get_option('geodir_changes_in_custom_fields_table')) { |
1620 | 1620 | $wpdb->query( |
1621 | 1621 | $wpdb->prepare( |
1622 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1622 | + "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1623 | 1623 | array('1', '1', 'admin') |
1624 | 1624 | ) |
1625 | 1625 | ); |
@@ -1627,9 +1627,9 @@ discard block |
||
1627 | 1627 | |
1628 | 1628 | /* --- terms meta value set --- */ |
1629 | 1629 | |
1630 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1630 | + update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png'); |
|
1631 | 1631 | |
1632 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1632 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1633 | 1633 | |
1634 | 1634 | if (!empty($options_data)) { |
1635 | 1635 | |
@@ -1637,7 +1637,7 @@ discard block |
||
1637 | 1637 | |
1638 | 1638 | $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
1639 | 1639 | |
1640 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1640 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1641 | 1641 | |
1642 | 1642 | if (!empty($taxonomies_data)) { |
1643 | 1643 | |
@@ -1646,17 +1646,17 @@ discard block |
||
1646 | 1646 | $taxObject = get_taxonomy($taxobj->taxonomy); |
1647 | 1647 | $post_type = $taxObject->object_type[0]; |
1648 | 1648 | |
1649 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1649 | + $opt_value = 'tax_meta_'.$post_type.'_'.$option_val; |
|
1650 | 1650 | |
1651 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1651 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val))); |
|
1652 | 1652 | |
1653 | 1653 | if ($duplicate_data) { |
1654 | 1654 | |
1655 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1655 | + $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1656 | 1656 | |
1657 | 1657 | } else { |
1658 | 1658 | |
1659 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1659 | + $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1660 | 1660 | |
1661 | 1661 | } |
1662 | 1662 | |
@@ -1690,14 +1690,14 @@ discard block |
||
1690 | 1690 | |
1691 | 1691 | global $wpdb, $table_prefix; |
1692 | 1692 | |
1693 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1693 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug))); |
|
1694 | 1694 | |
1695 | 1695 | if ($slug_exists) { |
1696 | 1696 | |
1697 | 1697 | $suffix = 1; |
1698 | 1698 | do { |
1699 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1700 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1699 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1700 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name))); |
|
1701 | 1701 | $suffix++; |
1702 | 1702 | } while ($location_slug_check && $suffix < 100); |
1703 | 1703 | |
@@ -1751,7 +1751,7 @@ discard block |
||
1751 | 1751 | |
1752 | 1752 | $suffix = 1; |
1753 | 1753 | do { |
1754 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1754 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1755 | 1755 | |
1756 | 1756 | /** This action is documented in geodirectory_hooks_actions.php */ |
1757 | 1757 | $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
1765 | 1765 | |
1766 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1766 | + $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1767 | 1767 | |
1768 | 1768 | } |
1769 | 1769 | |
@@ -1772,18 +1772,18 @@ discard block |
||
1772 | 1772 | $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
1773 | 1773 | |
1774 | 1774 | $post_types = geodir_get_posttypes(); |
1775 | - if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) { |
|
1776 | - $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1775 | + if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) { |
|
1776 | + $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1777 | 1777 | |
1778 | 1778 | if (!empty($posts_obj)) { |
1779 | 1779 | foreach ($posts_obj as $post_obj) { |
1780 | 1780 | $post_id = $post_obj->object_id; |
1781 | 1781 | |
1782 | - $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names')); |
|
1782 | + $raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names')); |
|
1783 | 1783 | $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : ''; |
1784 | 1784 | |
1785 | - $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
1786 | - $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1785 | + $listing_table = $plugin_prefix.$post_type.'_detail'; |
|
1786 | + $wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1787 | 1787 | } |
1788 | 1788 | } |
1789 | 1789 | } |
@@ -1817,7 +1817,7 @@ discard block |
||
1817 | 1817 | if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
1818 | 1818 | return $slug_exists = true; |
1819 | 1819 | |
1820 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1820 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1821 | 1821 | return $slug_exists = true; |
1822 | 1822 | |
1823 | 1823 | return $slug_exists; |
@@ -1858,43 +1858,43 @@ discard block |
||
1858 | 1858 | |
1859 | 1859 | |
1860 | 1860 | $gd_page = ''; |
1861 | - if(geodir_is_page('home')){ |
|
1861 | + if (geodir_is_page('home')) { |
|
1862 | 1862 | $gd_page = 'home'; |
1863 | 1863 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
1864 | 1864 | } |
1865 | - elseif(geodir_is_page('detail')){ |
|
1865 | + elseif (geodir_is_page('detail')) { |
|
1866 | 1866 | $gd_page = 'detail'; |
1867 | 1867 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
1868 | 1868 | } |
1869 | - elseif(geodir_is_page('pt')){ |
|
1869 | + elseif (geodir_is_page('pt')) { |
|
1870 | 1870 | $gd_page = 'pt'; |
1871 | 1871 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
1872 | 1872 | } |
1873 | - elseif(geodir_is_page('listing')){ |
|
1873 | + elseif (geodir_is_page('listing')) { |
|
1874 | 1874 | $gd_page = 'listing'; |
1875 | 1875 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
1876 | 1876 | } |
1877 | - elseif(geodir_is_page('location')){ |
|
1877 | + elseif (geodir_is_page('location')) { |
|
1878 | 1878 | $gd_page = 'location'; |
1879 | 1879 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
1880 | 1880 | } |
1881 | - elseif(geodir_is_page('search')){ |
|
1881 | + elseif (geodir_is_page('search')) { |
|
1882 | 1882 | $gd_page = 'search'; |
1883 | 1883 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
1884 | 1884 | } |
1885 | - elseif(geodir_is_page('add-listing')){ |
|
1885 | + elseif (geodir_is_page('add-listing')) { |
|
1886 | 1886 | $gd_page = 'add-listing'; |
1887 | 1887 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
1888 | 1888 | } |
1889 | - elseif(geodir_is_page('author')){ |
|
1889 | + elseif (geodir_is_page('author')) { |
|
1890 | 1890 | $gd_page = 'author'; |
1891 | 1891 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
1892 | 1892 | } |
1893 | - elseif(geodir_is_page('login')){ |
|
1893 | + elseif (geodir_is_page('login')) { |
|
1894 | 1894 | $gd_page = 'login'; |
1895 | 1895 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
1896 | 1896 | } |
1897 | - elseif(geodir_is_page('listing-success')){ |
|
1897 | + elseif (geodir_is_page('listing-success')) { |
|
1898 | 1898 | $gd_page = 'listing-success'; |
1899 | 1899 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
1900 | 1900 | } |
@@ -1926,12 +1926,12 @@ discard block |
||
1926 | 1926 | |
1927 | 1927 | if (!get_option('geodir_set_post_attachments')) { |
1928 | 1928 | |
1929 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1930 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1929 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
1930 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
1931 | 1931 | |
1932 | 1932 | $all_postypes = geodir_get_posttypes(); |
1933 | 1933 | |
1934 | - foreach($all_postypes as $post_type){ |
|
1934 | + foreach ($all_postypes as $post_type) { |
|
1935 | 1935 | $args = array( |
1936 | 1936 | 'posts_per_page' => -1, |
1937 | 1937 | 'post_type' => $post_type, |
@@ -2025,7 +2025,7 @@ discard block |
||
2025 | 2025 | { |
2026 | 2026 | $user_id = get_current_user_id(); |
2027 | 2027 | |
2028 | - if(!$user_id){return $post;} |
|
2028 | + if (!$user_id) {return $post; } |
|
2029 | 2029 | |
2030 | 2030 | $gd_post_types = geodir_get_posttypes(); |
2031 | 2031 | |
@@ -2134,7 +2134,7 @@ discard block |
||
2134 | 2134 | |
2135 | 2135 | if (array_key_exists('post_video', $tabs_arr)) { |
2136 | 2136 | |
2137 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2137 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2138 | 2138 | |
2139 | 2139 | if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
2140 | 2140 | $tabs_arr['post_video']['heading_text'] = $field_title; |
@@ -2142,7 +2142,7 @@ discard block |
||
2142 | 2142 | |
2143 | 2143 | if (array_key_exists('special_offers', $tabs_arr)) { |
2144 | 2144 | |
2145 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2145 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2146 | 2146 | |
2147 | 2147 | if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
2148 | 2148 | $tabs_arr['special_offers']['heading_text'] = $field_title; |
@@ -2163,7 +2163,7 @@ discard block |
||
2163 | 2163 | */ |
2164 | 2164 | function geodir_remove_template_redirect_actions() |
2165 | 2165 | { |
2166 | - if (geodir_is_page('login')){ |
|
2166 | + if (geodir_is_page('login')) { |
|
2167 | 2167 | remove_all_actions('template_redirect'); |
2168 | 2168 | remove_action('init', 'avia_modify_front', 10); |
2169 | 2169 | } |
@@ -2210,25 +2210,25 @@ discard block |
||
2210 | 2210 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
2211 | 2211 | |
2212 | 2212 | $wpdb->query( |
2213 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2213 | + $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ", |
|
2214 | 2214 | array($post_id, $split_img_file_path) |
2215 | 2215 | ) |
2216 | 2216 | ); |
2217 | 2217 | |
2218 | 2218 | $attachment_data = $wpdb->get_row( |
2219 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2219 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d", |
|
2220 | 2220 | array($post_id) |
2221 | 2221 | ) |
2222 | 2222 | ); |
2223 | 2223 | |
2224 | 2224 | if (!empty($attachment_data)) { |
2225 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2225 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2226 | 2226 | } |
2227 | 2227 | |
2228 | 2228 | |
2229 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2229 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
2230 | 2230 | |
2231 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2231 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id); |
|
2232 | 2232 | |
2233 | 2233 | geodir_set_wp_featured_image($post_id); |
2234 | 2234 | |
@@ -2256,9 +2256,9 @@ discard block |
||
2256 | 2256 | |
2257 | 2257 | foreach ($all_postypes as $posttype) { |
2258 | 2258 | |
2259 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2259 | + $tablename = $plugin_prefix.$posttype.'_detail'; |
|
2260 | 2260 | |
2261 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2261 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename); |
|
2262 | 2262 | |
2263 | 2263 | if (!empty($get_post_data)) { |
2264 | 2264 | |
@@ -2266,7 +2266,7 @@ discard block |
||
2266 | 2266 | |
2267 | 2267 | $post_id = $data->post_id; |
2268 | 2268 | |
2269 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2269 | + $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''"); |
|
2270 | 2270 | |
2271 | 2271 | if (!empty($attachment_data)) { |
2272 | 2272 | |
@@ -2283,22 +2283,22 @@ discard block |
||
2283 | 2283 | |
2284 | 2284 | $file_name = $file_info['basename']; |
2285 | 2285 | |
2286 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2286 | + $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name; |
|
2287 | 2287 | |
2288 | 2288 | if (!file_exists($img_arr['path'])) { |
2289 | 2289 | |
2290 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2290 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID); |
|
2291 | 2291 | |
2292 | 2292 | } |
2293 | 2293 | |
2294 | 2294 | } |
2295 | 2295 | |
2296 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2296 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id"); |
|
2297 | 2297 | |
2298 | 2298 | if (!empty($attachment_data)) { |
2299 | 2299 | |
2300 | 2300 | if ($attachment_data->ID) |
2301 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2301 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2302 | 2302 | |
2303 | 2303 | } else { |
2304 | 2304 | |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | |
2313 | 2313 | } |
2314 | 2314 | |
2315 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2315 | + $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id); |
|
2316 | 2316 | |
2317 | 2317 | geodir_set_wp_featured_image($post_id); |
2318 | 2318 | |
@@ -2341,7 +2341,7 @@ discard block |
||
2341 | 2341 | { |
2342 | 2342 | |
2343 | 2343 | if (!get_option('geodir_default_rating_star_icon')) { |
2344 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2344 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png'); |
|
2345 | 2345 | } |
2346 | 2346 | |
2347 | 2347 | } |
@@ -2361,7 +2361,7 @@ discard block |
||
2361 | 2361 | function geodir_user_post_listing_count($user_id = 0) |
2362 | 2362 | { |
2363 | 2363 | global $wpdb, $plugin_prefix, $current_user; |
2364 | - if(!$user_id){ |
|
2364 | + if (!$user_id) { |
|
2365 | 2365 | $user_id = $current_user->ID; |
2366 | 2366 | } |
2367 | 2367 | |
@@ -2370,7 +2370,7 @@ discard block |
||
2370 | 2370 | $user_listing = array(); |
2371 | 2371 | if ($user_id && is_array($all_posts) && !empty($all_posts)) { |
2372 | 2372 | foreach ($all_posts as $ptype) { |
2373 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2373 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' )"); |
|
2374 | 2374 | |
2375 | 2375 | if ($total_posts > 0) { |
2376 | 2376 | $user_listing[$ptype] = $total_posts; |
@@ -2411,19 +2411,19 @@ discard block |
||
2411 | 2411 | |
2412 | 2412 | $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
2413 | 2413 | //remove video and special offers if it is already set to show |
2414 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2414 | + if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) { |
|
2415 | 2415 | $unset_video = true; |
2416 | 2416 | } |
2417 | 2417 | |
2418 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2418 | + if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) { |
|
2419 | 2419 | $unset_special_offers = true; |
2420 | 2420 | } |
2421 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2422 | - foreach($custom_fields as $key => $custom_field){ |
|
2423 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2421 | + if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) { |
|
2422 | + foreach ($custom_fields as $key => $custom_field) { |
|
2423 | + if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) { |
|
2424 | 2424 | unset($custom_fields[$key]); |
2425 | 2425 | } |
2426 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2426 | + if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) { |
|
2427 | 2427 | unset($custom_fields[$key]); |
2428 | 2428 | } |
2429 | 2429 | } |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | $post->{$field_name} = $_REQUEST[$field_name]; |
2441 | 2441 | } |
2442 | 2442 | |
2443 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2443 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
2444 | 2444 | if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
2445 | 2445 | continue; |
2446 | 2446 | } |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $post->{$field_name} = $_REQUEST[$field_name]; |
2474 | 2474 | } |
2475 | 2475 | |
2476 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2476 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
2477 | 2477 | $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
2478 | 2478 | $site_title = trim($field['site_title']); |
2479 | 2479 | $type = $field; |
@@ -2489,21 +2489,21 @@ discard block |
||
2489 | 2489 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
2490 | 2490 | $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : ''; |
2491 | 2491 | |
2492 | - }else{ |
|
2492 | + } else { |
|
2493 | 2493 | $i = 0; |
2494 | 2494 | $fieldset_count++; |
2495 | 2495 | $field_set_start = 1; |
2496 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2496 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count; |
|
2497 | 2497 | $fieldset_arr[$fieldset_count]['label'] = $label; |
2498 | 2498 | } |
2499 | 2499 | |
2500 | 2500 | |
2501 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2501 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; } |
|
2502 | 2502 | $type = stripslashes_deep($type); // strip slashes |
2503 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2503 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; } |
|
2504 | 2504 | $html = ''; |
2505 | 2505 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
2506 | - if($html_var=='post'){$html_var='post_address';} |
|
2506 | + if ($html_var == 'post') {$html_var = 'post_address'; } |
|
2507 | 2507 | $field_icon = geodir_field_icon_proccess($type); |
2508 | 2508 | $filed_type = $type['type']; |
2509 | 2509 | |
@@ -2516,7 +2516,7 @@ discard block |
||
2516 | 2516 | * @param string $fields_location The location the field is to be show. |
2517 | 2517 | * @param array $type The array of field values. |
2518 | 2518 | */ |
2519 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2519 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type); |
|
2520 | 2520 | |
2521 | 2521 | |
2522 | 2522 | /** |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | * @param string $htmlvar_name The field HTML var name. |
2563 | 2563 | */ |
2564 | 2564 | 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
2565 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2565 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>' |
|
2566 | 2566 | ); |
2567 | 2567 | } |
2568 | 2568 | } else { |
@@ -2624,7 +2624,7 @@ discard block |
||
2624 | 2624 | } |
2625 | 2625 | $status .= ")</strong>"; |
2626 | 2626 | |
2627 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2627 | + $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>'; |
|
2628 | 2628 | } |
2629 | 2629 | } |
2630 | 2630 | |
@@ -2693,7 +2693,7 @@ discard block |
||
2693 | 2693 | * @return array Modified class array. |
2694 | 2694 | */ |
2695 | 2695 | function geodir_body_class_active_map($classes = array()) { |
2696 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2696 | + $classes[] = 'gd-map-'.geodir_map_name(); |
|
2697 | 2697 | |
2698 | 2698 | return $classes; |
2699 | 2699 | } |
@@ -2708,7 +2708,7 @@ discard block |
||
2708 | 2708 | * @return string Modified class string. |
2709 | 2709 | */ |
2710 | 2710 | function geodir_admin_body_class_active_map($class = '') { |
2711 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2711 | + $class .= ' gd-map-'.geodir_map_name(); |
|
2712 | 2712 | |
2713 | 2713 | return $class; |
2714 | 2714 | } |
@@ -2728,7 +2728,7 @@ discard block |
||
2728 | 2728 | * @return array Translation texts. |
2729 | 2729 | */ |
2730 | 2730 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2731 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2731 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array(); |
|
2732 | 2732 | |
2733 | 2733 | $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
2734 | 2734 | |
@@ -2794,17 +2794,17 @@ discard block |
||
2794 | 2794 | * @param array $args The array of menu arguments. |
2795 | 2795 | * @return array The modified arguments. |
2796 | 2796 | */ |
2797 | -function geodir_add_nav_menu_class( $args ) |
|
2797 | +function geodir_add_nav_menu_class($args) |
|
2798 | 2798 | { |
2799 | 2799 | |
2800 | - if(isset($args['menu_class'])){ |
|
2800 | + if (isset($args['menu_class'])) { |
|
2801 | 2801 | $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
2802 | 2802 | } |
2803 | 2803 | |
2804 | 2804 | return $args; |
2805 | 2805 | } |
2806 | 2806 | |
2807 | -add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
|
2807 | +add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class'); |
|
2808 | 2808 | |
2809 | 2809 | /** |
2810 | 2810 | * Filters WordPress locale ID. |
@@ -2844,9 +2844,9 @@ discard block |
||
2844 | 2844 | } |
2845 | 2845 | |
2846 | 2846 | add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2); |
2847 | - add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
2847 | + add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1); |
|
2848 | 2848 | if (is_admin()) { |
2849 | - add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
2849 | + add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1); |
|
2850 | 2850 | } |
2851 | 2851 | } |
2852 | 2852 | } |
@@ -2875,7 +2875,7 @@ discard block |
||
2875 | 2875 | } |
2876 | 2876 | |
2877 | 2877 | if (!empty($keep_vars)) { |
2878 | - foreach ( $languages as $code => $url) { |
|
2878 | + foreach ($languages as $code => $url) { |
|
2879 | 2879 | $filter_url = $url['url']; |
2880 | 2880 | |
2881 | 2881 | foreach ($keep_vars as $var) { |
@@ -2894,7 +2894,7 @@ discard block |
||
2894 | 2894 | |
2895 | 2895 | return $languages; |
2896 | 2896 | } |
2897 | -add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 ); |
|
2897 | +add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1); |
|
2898 | 2898 | |
2899 | 2899 | /** |
2900 | 2900 | * Remove Yoast SEO hook if disabled on GD pages. |
@@ -2902,18 +2902,18 @@ discard block |
||
2902 | 2902 | * @since 1.6.18 |
2903 | 2903 | * |
2904 | 2904 | */ |
2905 | -function geodir_remove_yoast_seo_metas(){ |
|
2906 | - if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) { |
|
2905 | +function geodir_remove_yoast_seo_metas() { |
|
2906 | + if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) { |
|
2907 | 2907 | $wpseo = WPSEO_Frontend::get_instance(); |
2908 | 2908 | |
2909 | - remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
2910 | - remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
2911 | - remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
2912 | - remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
2913 | - remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
2914 | - remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
2909 | + remove_action('wp_head', array($wpseo, 'metadesc'), 6); |
|
2910 | + remove_action('wp_head', array($wpseo, 'metakeywords'), 11); |
|
2911 | + remove_filter('pre_get_document_title', array($wpseo, 'title'), 15); |
|
2912 | + remove_filter('wp_title', array($wpseo, 'title'), 15, 3); |
|
2913 | + remove_filter('thematic_doctitle', array($wpseo, 'title'), 15); |
|
2914 | + remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99); |
|
2915 | 2915 | |
2916 | - remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
2916 | + remove_action('template_redirect', 'wpseo_frontend_head_init', 999); |
|
2917 | 2917 | } |
2918 | 2918 | } |
2919 | 2919 | |
@@ -2928,22 +2928,22 @@ discard block |
||
2928 | 2928 | * |
2929 | 2929 | */ |
2930 | 2930 | function geodir_wpml_ajax_set_guest_lang() { |
2931 | - if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) { |
|
2932 | - if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) { |
|
2931 | + if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) { |
|
2932 | + if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) { |
|
2933 | 2933 | global $sitepress; |
2934 | 2934 | |
2935 | 2935 | $referer = wp_get_referer(); |
2936 | 2936 | |
2937 | 2937 | $current_lang = $sitepress->get_current_language(); |
2938 | - $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
2938 | + $referrer_lang = $sitepress->get_language_from_url($referer); |
|
2939 | 2939 | |
2940 | - if ( $referrer_lang && $current_lang != $referrer_lang ) { |
|
2940 | + if ($referrer_lang && $current_lang != $referrer_lang) { |
|
2941 | 2941 | $_GET['lang'] = $referrer_lang; |
2942 | 2942 | } |
2943 | 2943 | } |
2944 | 2944 | } |
2945 | 2945 | } |
2946 | -add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 ); |
|
2946 | +add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1); |
|
2947 | 2947 | |
2948 | 2948 | /** |
2949 | 2949 | * Change country slug czech-republic to czechia and redirect. |
@@ -2964,18 +2964,18 @@ discard block |
||
2964 | 2964 | } |
2965 | 2965 | |
2966 | 2966 | $redirect = false; |
2967 | - if (strpos($current_url, '/' . $search . '/') !== false) { |
|
2967 | + if (strpos($current_url, '/'.$search.'/') !== false) { |
|
2968 | 2968 | $redirect = true; |
2969 | - $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1); |
|
2969 | + $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1); |
|
2970 | 2970 | } |
2971 | 2971 | |
2972 | 2972 | if ($has_slash != "/") { |
2973 | 2973 | $current_url = trim($current_url, '/'); |
2974 | 2974 | } |
2975 | 2975 | |
2976 | - if (strpos($current_url, 'gd_country=' . $search) !== false) { |
|
2976 | + if (strpos($current_url, 'gd_country='.$search) !== false) { |
|
2977 | 2977 | $redirect = true; |
2978 | - $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url); |
|
2978 | + $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url); |
|
2979 | 2979 | } |
2980 | 2980 | |
2981 | 2981 | if ($redirect) { |
@@ -3001,10 +3001,10 @@ discard block |
||
3001 | 3001 | * @param int $post_parent Post parent ID |
3002 | 3002 | * @param string $original_slug The original post slug. |
3003 | 3003 | */ |
3004 | -function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { |
|
3004 | +function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) { |
|
3005 | 3005 | global $wpdb, $sitepress; |
3006 | 3006 | |
3007 | - if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) { |
|
3007 | + if ($post_type && strpos($post_type, 'gd_') === 0) { |
|
3008 | 3008 | $wpml_post_join = ""; |
3009 | 3009 | $wpml_post_where = ""; |
3010 | 3010 | $wpml_term_join = ""; |
@@ -3018,28 +3018,28 @@ discard block |
||
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
3021 | - $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3021 | + $wpml_post_where = " AND icl_t.language_code = '".$post_language."'"; |
|
3022 | 3022 | |
3023 | 3023 | $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)"; |
3024 | - $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3024 | + $wpml_term_where = " AND icl_t.language_code = '".$post_language."'"; |
|
3025 | 3025 | } |
3026 | 3026 | |
3027 | - $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) ); |
|
3027 | + $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug)); |
|
3028 | 3028 | |
3029 | - if ( $term_slug_check ) { |
|
3029 | + if ($term_slug_check) { |
|
3030 | 3030 | $suffix = 1; |
3031 | 3031 | |
3032 | 3032 | do { |
3033 | - $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
3033 | + $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
3034 | 3034 | |
3035 | - $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) ); |
|
3035 | + $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug)); |
|
3036 | 3036 | |
3037 | - $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) ); |
|
3037 | + $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID)); |
|
3038 | 3038 | |
3039 | 3039 | $term_slug_check = $term_check || $post_check; |
3040 | 3040 | |
3041 | 3041 | $suffix++; |
3042 | - } while ( $term_slug_check ); |
|
3042 | + } while ($term_slug_check); |
|
3043 | 3043 | |
3044 | 3044 | $slug = $alt_slug; |
3045 | 3045 | } |
@@ -3047,7 +3047,7 @@ discard block |
||
3047 | 3047 | |
3048 | 3048 | return $slug; |
3049 | 3049 | } |
3050 | -add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 ); |
|
3050 | +add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6); |
|
3051 | 3051 | |
3052 | 3052 | /** |
3053 | 3053 | * Check whether a post name with slug exists or not. |
@@ -3064,48 +3064,48 @@ discard block |
||
3064 | 3064 | * @param int $term_id The term ID. |
3065 | 3065 | * @return bool true when exists. false when not exists. |
3066 | 3066 | */ |
3067 | -function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) { |
|
3067 | +function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) { |
|
3068 | 3068 | global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
3069 | 3069 | |
3070 | - if ( $slug_exists ) { |
|
3070 | + if ($slug_exists) { |
|
3071 | 3071 | return $slug_exists; |
3072 | 3072 | } |
3073 | 3073 | |
3074 | - if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) { |
|
3074 | + if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) { |
|
3075 | 3075 | $taxonomy = $gd_term_taxonomy[$term_id]; |
3076 | 3076 | } else { |
3077 | - $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
3077 | + $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id)); |
|
3078 | 3078 | $gd_term_taxonomy[$term_id] = $taxonomy; |
3079 | 3079 | } |
3080 | 3080 | |
3081 | - if ( empty($taxonomy) ) { |
|
3081 | + if (empty($taxonomy)) { |
|
3082 | 3082 | return $slug_exists; |
3083 | 3083 | } |
3084 | 3084 | |
3085 | - if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) { |
|
3085 | + if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) { |
|
3086 | 3086 | $post_type = $gd_term_post_type[$term_id]; |
3087 | 3087 | } else { |
3088 | - $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
3089 | - $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
3088 | + $taxonomy_obj = get_taxonomy($taxonomy); |
|
3089 | + $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL; |
|
3090 | 3090 | } |
3091 | 3091 | |
3092 | 3092 | $wpml_post_join = ""; |
3093 | 3093 | $wpml_post_where = ""; |
3094 | 3094 | |
3095 | 3095 | if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) { |
3096 | - $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
3096 | + $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language(); |
|
3097 | 3097 | if (!$term_language) { |
3098 | 3098 | $term_language = $sitepress->get_current_language(); |
3099 | 3099 | } |
3100 | 3100 | |
3101 | 3101 | $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
3102 | - $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
3102 | + $wpml_post_where = " AND icl_t.language_code = '".$term_language."'"; |
|
3103 | 3103 | } |
3104 | 3104 | |
3105 | - if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) { |
|
3105 | + if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type))) { |
|
3106 | 3106 | $slug_exists = true; |
3107 | 3107 | } |
3108 | 3108 | |
3109 | 3109 | return $slug_exists; |
3110 | 3110 | } |
3111 | -add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 ); |
|
3112 | 3111 | \ No newline at end of file |
3112 | +add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3); |
|
3113 | 3113 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $_redirect = $_REQUEST['redirect_to']; |
22 | 22 | } |
23 | 23 | |
24 | - wp_safe_redirect($_redirect , 302); |
|
24 | + wp_safe_redirect($_redirect, 302); |
|
25 | 25 | exit; |
26 | 26 | } |
27 | 27 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @global string $s_A Extra parameters. |
66 | 66 | * @global string $s_SA Extra parameters. |
67 | 67 | */ |
68 | -function set_listing_request($query ) |
|
68 | +function set_listing_request($query) |
|
69 | 69 | { |
70 | 70 | global $wp_query, $wpdb, $geodir_post_type, $table, $dist, $mylat, $mylon, $s, $snear, $s, $s_A, $s_SA; |
71 | 71 | |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | } // Distance |
100 | 100 | |
101 | 101 | if (isset($_REQUEST['sgeo_lat'])) { |
102 | - $mylat = (float)esc_attr($_REQUEST['sgeo_lat']); |
|
102 | + $mylat = (float) esc_attr($_REQUEST['sgeo_lat']); |
|
103 | 103 | } else { |
104 | - $mylat = (float)geodir_get_current_city_lat(); |
|
104 | + $mylat = (float) geodir_get_current_city_lat(); |
|
105 | 105 | } // Latitude |
106 | 106 | |
107 | 107 | if (isset($_REQUEST['sgeo_lon'])) { |
108 | - $mylon = (float)esc_attr($_REQUEST['sgeo_lon']); |
|
108 | + $mylon = (float) esc_attr($_REQUEST['sgeo_lon']); |
|
109 | 109 | } else { |
110 | - $mylon = (float)geodir_get_current_city_lng(); |
|
110 | + $mylon = (float) geodir_get_current_city_lng(); |
|
111 | 111 | } // Distance |
112 | 112 | |
113 | 113 | if (isset($_REQUEST['snear'])) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | if ($snear == 'NEAR ME') { |
122 | 122 | $ip = $_SERVER['REMOTE_ADDR']; |
123 | - $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $ip)); |
|
123 | + $addr_details = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); |
|
124 | 124 | $mylat = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_latitude])); |
125 | 125 | $mylon = stripslashes(geodir_utf8_ucfirst($addr_details[geoplugin_longitude])); |
126 | 126 | } |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | $s_AA = str_replace(" ", "", $s); |
131 | 131 | $s_A = explode(",", $s_AA); |
132 | 132 | $s_A = implode('","', $s_A); |
133 | - $s_A = '"' . $s_A . '"'; |
|
133 | + $s_A = '"'.$s_A.'"'; |
|
134 | 134 | } else { |
135 | - $s_A = '"' . $s . '"'; |
|
135 | + $s_A = '"'.$s.'"'; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | if (strstr($s, ' ')) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) { |
195 | 195 | |
196 | - $table = $plugin_prefix . $geodir_post_type . '_detail'; |
|
196 | + $table = $plugin_prefix.$geodir_post_type.'_detail'; |
|
197 | 197 | |
198 | 198 | add_filter('posts_fields', 'geodir_posts_fields', 1); |
199 | 199 | add_filter('posts_join', 'geodir_posts_join', 1); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | global $wp_query, $wpdb, $geodir_post_type, $table, $plugin_prefix, $dist, $mylat, $mylon, $snear, $gd_session; |
234 | 234 | |
235 | 235 | // Filter-Location-Manager to add location table. |
236 | - $fields .= ", " . $table . ".* "; |
|
236 | + $fields .= ", ".$table.".* "; |
|
237 | 237 | |
238 | 238 | if ($snear != '' || $gd_session->get('all_near_me')) { |
239 | 239 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | $mylon = $gd_session->get('user_lon'); |
244 | 244 | } |
245 | 245 | |
246 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
246 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | global $s; |
250 | 250 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
251 | 251 | $keywords = explode(" ", $s); |
252 | 252 | |
253 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
254 | - foreach($keywords as $kkey=>$kword){ |
|
255 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
253 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
254 | + foreach ($keywords as $kkey=>$kword) { |
|
255 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
256 | 256 | unset($keywords[$kkey]); |
257 | 257 | } |
258 | 258 | } |
@@ -270,24 +270,24 @@ discard block |
||
270 | 270 | $count = 0; |
271 | 271 | foreach ($keywords as $keyword) { |
272 | 272 | $keyword = trim($keyword); |
273 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
273 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
274 | 274 | $count++; |
275 | 275 | if ($count < count($keywords)) { |
276 | 276 | // $gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' " . $key . " "; |
277 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) " . $key . " "; |
|
277 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) ".$key." "; |
|
278 | 278 | } else { |
279 | 279 | //$gd_titlematch_part .= $wpdb->posts . ".post_title LIKE '%%" . $keyword . "%%' "; |
280 | - $gd_titlematch_part .= "( " . $wpdb->posts . ".post_title LIKE '" . $keyword . "' OR " . $wpdb->posts . ".post_title LIKE '" . $keyword . "%%' OR " . $wpdb->posts . ".post_title LIKE '%% " . $keyword . "%%' ) "; |
|
280 | + $gd_titlematch_part .= "( ".$wpdb->posts.".post_title LIKE '".$keyword."' OR ".$wpdb->posts.".post_title LIKE '".$keyword."%%' OR ".$wpdb->posts.".post_title LIKE '%% ".$keyword."%%' ) "; |
|
281 | 281 | } |
282 | 282 | } |
283 | - $gd_titlematch_part .= "THEN 1 ELSE 0 END AS " . $part . ","; |
|
283 | + $gd_titlematch_part .= "THEN 1 ELSE 0 END AS ".$part.","; |
|
284 | 284 | } |
285 | 285 | } else { |
286 | 286 | $gd_titlematch_part = ""; |
287 | 287 | } |
288 | - $s = stripslashes_deep( $s ); |
|
289 | - $s = wp_specialchars_decode($s,ENT_QUOTES); |
|
290 | - $fields .= $wpdb->prepare(", CASE WHEN " . $table . ".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN " . $wpdb->posts . ".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle," . $gd_titlematch_part . " CASE WHEN ( " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s OR " . $wpdb->posts . ".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s OR " . $wpdb->posts . ".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s . '%', '% ' . $s . '%', $s, $s . ' %', '% ' . $s . ' %', '% ' . $s)); |
|
288 | + $s = stripslashes_deep($s); |
|
289 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
290 | + $fields .= $wpdb->prepare(", CASE WHEN ".$table.".is_featured='1' THEN 1 ELSE 0 END AS gd_featured, CASE WHEN ".$wpdb->posts.".post_title LIKE %s THEN 1 ELSE 0 END AS gd_exacttitle,".$gd_titlematch_part." CASE WHEN ( ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s OR ".$wpdb->posts.".post_title LIKE %s ) THEN 1 ELSE 0 END AS gd_titlematch, CASE WHEN ( ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s OR ".$wpdb->posts.".post_content LIKE %s ) THEN 1 ELSE 0 END AS gd_content", array($s, $s, $s.'%', '% '.$s.'%', $s, $s.' %', '% '.$s.' %', '% '.$s)); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return $fields; |
@@ -311,18 +311,18 @@ discard block |
||
311 | 311 | |
312 | 312 | ########### WPML ########### |
313 | 313 | |
314 | - if ( geodir_wpml_is_post_type_translated( $geodir_post_type ) ) { |
|
314 | + if (geodir_wpml_is_post_type_translated($geodir_post_type)) { |
|
315 | 315 | global $sitepress; |
316 | 316 | $lang_code = ICL_LANGUAGE_CODE; |
317 | 317 | $default_lang_code = $sitepress->get_default_language(); |
318 | 318 | if ($lang_code) { |
319 | - $join .= "JOIN " . $table_prefix . "icl_translations icl_t ON icl_t.element_id = " . $table_prefix . "posts.ID"; |
|
319 | + $join .= "JOIN ".$table_prefix."icl_translations icl_t ON icl_t.element_id = ".$table_prefix."posts.ID"; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | } |
323 | 323 | ########### WPML ########### |
324 | 324 | |
325 | - $join .= " INNER JOIN " . $table . " ON (" . $table . ".post_id = $wpdb->posts.ID) "; |
|
325 | + $join .= " INNER JOIN ".$table." ON (".$table.".post_id = $wpdb->posts.ID) "; |
|
326 | 326 | //===old code start |
327 | 327 | //$join .= " INNER JOIN ".POST_LOCATION_TABLE." ON (".$table.".post_location_id = ".POST_LOCATION_TABLE.".location_id) " ;//===old code end |
328 | 328 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $sort_by = 'az'; |
392 | 392 | } |
393 | 393 | |
394 | - if ($snear != '' && $sort_by!='farthest') { |
|
394 | + if ($snear != '' && $sort_by != 'farthest') { |
|
395 | 395 | $sort_by = 'nearest'; |
396 | 396 | } |
397 | 397 | } |
@@ -405,20 +405,20 @@ discard block |
||
405 | 405 | break; |
406 | 406 | case 'low_review': |
407 | 407 | case 'rating_count_asc': |
408 | - $orderby = $table . ".rating_count ASC, " . $table . ".overall_rating ASC, "; |
|
408 | + $orderby = $table.".rating_count ASC, ".$table.".overall_rating ASC, "; |
|
409 | 409 | break; |
410 | 410 | case 'high_review': |
411 | 411 | case 'rating_count_desc': |
412 | - $orderby = $table . ".rating_count DESC, " . $table . ".overall_rating DESC, "; |
|
412 | + $orderby = $table.".rating_count DESC, ".$table.".overall_rating DESC, "; |
|
413 | 413 | break; |
414 | 414 | case 'low_rating': |
415 | - $orderby = "( " . $table . ".overall_rating ) ASC, " . $table . ".rating_count ASC, "; |
|
415 | + $orderby = "( ".$table.".overall_rating ) ASC, ".$table.".rating_count ASC, "; |
|
416 | 416 | break; |
417 | 417 | case 'high_rating': |
418 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
418 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
419 | 419 | break; |
420 | 420 | case 'featured': |
421 | - $orderby = $table . ".is_featured asc, "; |
|
421 | + $orderby = $table.".is_featured asc, "; |
|
422 | 422 | break; |
423 | 423 | case 'nearest': |
424 | 424 | $orderby = " distance asc, "; |
@@ -434,10 +434,10 @@ discard block |
||
434 | 434 | break; |
435 | 435 | // sort by rating |
436 | 436 | case 'overall_rating_desc': |
437 | - $orderby = " " . $table . ".overall_rating DESC, " . $table . ".rating_count DESC, "; |
|
437 | + $orderby = " ".$table.".overall_rating DESC, ".$table.".rating_count DESC, "; |
|
438 | 438 | break; |
439 | 439 | case 'overall_rating_asc': |
440 | - $orderby = " " . $table . ".overall_rating ASC, " . $table . ".rating_count ASC, "; |
|
440 | + $orderby = " ".$table.".overall_rating ASC, ".$table.".rating_count ASC, "; |
|
441 | 441 | break; |
442 | 442 | default: |
443 | 443 | |
@@ -458,24 +458,24 @@ discard block |
||
458 | 458 | |
459 | 459 | if (is_search() && isset($_REQUEST['geodir_search']) && $s && trim($s) != '') { |
460 | 460 | $keywords = explode(" ", $s); |
461 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
462 | - foreach($keywords as $kkey=>$kword){ |
|
463 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
461 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
462 | + foreach ($keywords as $kkey=>$kword) { |
|
463 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
464 | 464 | unset($keywords[$kkey]); |
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
468 | 468 | if ($sort_by == 'nearest' || $sort_by == 'farthest') { |
469 | 469 | if (count($keywords) > 1) { |
470 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
470 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, "; |
|
471 | 471 | } else { |
472 | - $orderby = $orderby . " ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
472 | + $orderby = $orderby." ( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, "; |
|
473 | 473 | } |
474 | 474 | } else { |
475 | 475 | if (count($keywords) > 1) { |
476 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, " . $orderby; |
|
476 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_alltitlematch_part * 100 + gd_titlematch_part * 50 + gd_content * 1.5) DESC, ".$orderby; |
|
477 | 477 | } else { |
478 | - $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, " . $orderby; |
|
478 | + $orderby = "( gd_titlematch * 2 + gd_featured * 5 + gd_exacttitle * 10 + gd_content * 1.5) DESC, ".$orderby; |
|
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | $orderby = apply_filters('geodir_posts_order_by_sort', $orderby, $sort_by, $table); |
492 | 492 | |
493 | - $orderby .= $table . ".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
493 | + $orderby .= $table.".is_featured asc, $wpdb->posts.post_date desc, $wpdb->posts.post_title "; |
|
494 | 494 | |
495 | 495 | return $orderby; |
496 | 496 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | global $wpdb; |
514 | 514 | |
515 | - if ($sort_by != '' && (!is_search() || ( isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear']=='' && ( $_REQUEST['s']=='' || $_REQUEST['s']==' ') ) )) { |
|
515 | + if ($sort_by != '' && (!is_search() || (isset($_REQUEST['s']) && isset($_REQUEST['snear']) && $_REQUEST['snear'] == '' && ($_REQUEST['s'] == '' || $_REQUEST['s'] == ' ')))) { |
|
516 | 516 | |
517 | 517 | $sort_array = explode('_', $sort_by); |
518 | 518 | |
@@ -522,31 +522,31 @@ discard block |
||
522 | 522 | |
523 | 523 | if ($sort_by_count > 1 && ($order == 'asc' || $order == 'desc')) { |
524 | 524 | |
525 | - $sort_by = str_replace('_' . $order, '', $sort_by); |
|
525 | + $sort_by = str_replace('_'.$order, '', $sort_by); |
|
526 | 526 | |
527 | 527 | switch ($sort_by): |
528 | 528 | |
529 | 529 | case 'post_date': |
530 | 530 | case 'comment_count': |
531 | 531 | |
532 | - $orderby = "$wpdb->posts." . $sort_by . " " . $order . ", ".$table . ".overall_rating " . $order . ", "; |
|
532 | + $orderby = "$wpdb->posts.".$sort_by." ".$order.", ".$table.".overall_rating ".$order.", "; |
|
533 | 533 | break; |
534 | 534 | |
535 | 535 | case 'distance': |
536 | - $orderby = $sort_by . " " . $order . ", "; |
|
536 | + $orderby = $sort_by." ".$order.", "; |
|
537 | 537 | break; |
538 | 538 | |
539 | 539 | |
540 | 540 | // sort by rating |
541 | 541 | case 'overall_rating': |
542 | - $orderby = " " . $table . "." . $sort_by . " " . $order . ", " . $table . ".rating_count " . $order . ", "; |
|
542 | + $orderby = " ".$table.".".$sort_by." ".$order.", ".$table.".rating_count ".$order.", "; |
|
543 | 543 | |
544 | 544 | break; |
545 | 545 | |
546 | 546 | |
547 | 547 | default: |
548 | 548 | if (geodir_column_exist($table, $sort_by)) { |
549 | - $orderby = $table . "." . $sort_by . " " . $order . ", "; |
|
549 | + $orderby = $table.".".$sort_by." ".$order.", "; |
|
550 | 550 | } |
551 | 551 | break; |
552 | 552 | |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | } |
595 | 595 | |
596 | 596 | //if (!geodir_is_page('detail')) |
597 | - add_filter('posts_where', 'geodir_default_where', 1);/**/ |
|
597 | + add_filter('posts_where', 'geodir_default_where', 1); /**/ |
|
598 | 598 | |
599 | 599 | //add_filter( 'user_has_cap', 'geodir_preview_post_cap', 10, 3 );// let subscribers edit their own posts |
600 | 600 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $q_post_type = isset($wp_query->query['post_type']) ? $wp_query->query['post_type'] : ''; |
666 | 666 | //echo '##########'.$q_post_type; |
667 | 667 | if ($lang_code && $q_post_type && geodir_wpml_is_post_type_translated($q_post_type)) { |
668 | - $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_" . $q_post_type . "') "; |
|
668 | + $where .= " AND icl_t.language_code = '$lang_code' AND icl_t.element_type IN('post_".$q_post_type."') "; |
|
669 | 669 | //$where .= " AND icl_t.language_code = '$lang_code' "; |
670 | 670 | } |
671 | 671 | |
@@ -732,8 +732,8 @@ discard block |
||
732 | 732 | } |
733 | 733 | |
734 | 734 | $s = trim($s); |
735 | - $s = wp_specialchars_decode($s ,ENT_QUOTES); |
|
736 | - $s_A = wp_specialchars_decode($s_A ,ENT_QUOTES); |
|
735 | + $s = wp_specialchars_decode($s, ENT_QUOTES); |
|
736 | + $s_A = wp_specialchars_decode($s_A, ENT_QUOTES); |
|
737 | 737 | |
738 | 738 | $where = ''; |
739 | 739 | $better_search_terms = ''; |
@@ -744,9 +744,9 @@ discard block |
||
744 | 744 | |
745 | 745 | if ($s != '') { |
746 | 746 | $keywords = explode(" ", $s); |
747 | - if(is_array($keywords) && $klimit = get_option('geodir_search_word_limit')){ |
|
748 | - foreach($keywords as $kkey=>$kword){ |
|
749 | - if(geodir_utf8_strlen($kword)<=$klimit){ |
|
747 | + if (is_array($keywords) && $klimit = get_option('geodir_search_word_limit')) { |
|
748 | + foreach ($keywords as $kkey=>$kword) { |
|
749 | + if (geodir_utf8_strlen($kword) <= $klimit) { |
|
750 | 750 | unset($keywords[$kkey]); |
751 | 751 | } |
752 | 752 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | if (!empty($keywords)) { |
756 | 756 | foreach ($keywords as $keyword) { |
757 | 757 | $keyword = trim($keyword); |
758 | - $keyword = wp_specialchars_decode($keyword ,ENT_QUOTES); |
|
758 | + $keyword = wp_specialchars_decode($keyword, ENT_QUOTES); |
|
759 | 759 | if ($keyword != '') { |
760 | 760 | /** |
761 | 761 | * Filter the search query keywords SQL. |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | * @param array $keywords The array of keywords for the query. |
767 | 767 | * @param string $keyword The single keyword being searched. |
768 | 768 | */ |
769 | - $better_search_terms .= apply_filters("geodir_search_better_search_terms",' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )',$keywords,$keyword); |
|
769 | + $better_search_terms .= apply_filters("geodir_search_better_search_terms", ' OR ( '.$wpdb->posts.'.post_title LIKE "'.$keyword.'" OR '.$wpdb->posts.'.post_title LIKE "'.$keyword.'%" OR '.$wpdb->posts.'.post_title LIKE "% '.$keyword.'%" )', $keywords, $keyword); |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | } |
@@ -774,10 +774,10 @@ discard block |
||
774 | 774 | |
775 | 775 | /* get taxonomy */ |
776 | 776 | $taxonomies = geodir_get_taxonomies($post_types, true); |
777 | - if($taxonomies) { |
|
777 | + if ($taxonomies) { |
|
778 | 778 | $taxonomies = implode("','", $taxonomies); |
779 | - $taxonomies = "'" . $taxonomies . "'"; |
|
780 | - }else{$taxonomies='';} |
|
779 | + $taxonomies = "'".$taxonomies."'"; |
|
780 | + } else {$taxonomies = ''; } |
|
781 | 781 | |
782 | 782 | $content_where = $terms_where = ''; |
783 | 783 | if ($s != '') { |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * @package GeoDirectory |
789 | 789 | * @param string $content_where The query values, default: `" OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") ") "`. |
790 | 790 | */ |
791 | - $content_where = apply_filters("geodir_search_content_where"," OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
791 | + $content_where = apply_filters("geodir_search_content_where", " OR ($wpdb->posts.post_content LIKE \"$s\" OR $wpdb->posts.post_content LIKE \"$s%\" OR $wpdb->posts.post_content LIKE \"% $s%\" OR $wpdb->posts.post_content LIKE \"%>$s%\" OR $wpdb->posts.post_content LIKE \"%\n$s%\") "); |
|
792 | 792 | /** |
793 | 793 | * Filter the search query term values. |
794 | 794 | * |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @package GeoDirectory |
797 | 797 | * @param string $terms_where The separator, default: `" AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "`. |
798 | 798 | */ |
799 | - $terms_where = apply_filters("geodir_search_terms_where"," AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
799 | + $terms_where = apply_filters("geodir_search_terms_where", " AND ($wpdb->terms.name LIKE \"$s\" OR $wpdb->terms.name LIKE \"$s%\" OR $wpdb->terms.name LIKE \"% $s%\" OR $wpdb->terms.name IN ($s_A)) "); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -813,13 +813,13 @@ discard block |
||
813 | 813 | $term_ids = array(); |
814 | 814 | $terms_sql = ''; |
815 | 815 | |
816 | - if(!empty($term_results)){ |
|
817 | - foreach($term_results as $term_id){ |
|
816 | + if (!empty($term_results)) { |
|
817 | + foreach ($term_results as $term_id) { |
|
818 | 818 | $term_ids[] = $term_id; |
819 | 819 | } |
820 | - if(!empty( $term_ids)){ |
|
820 | + if (!empty($term_ids)) { |
|
821 | 821 | |
822 | - foreach($term_ids as $term){ |
|
822 | + foreach ($term_ids as $term) { |
|
823 | 823 | $terms_sql .= " OR FIND_IN_SET($term->term_id , ".$table.".".$post_types."category) "; |
824 | 824 | } |
825 | 825 | } |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | ) |
851 | 851 | AND $wpdb->posts.post_type in ('{$post_types}') |
852 | 852 | AND ($wpdb->posts.post_status = 'publish') |
853 | - AND ( " . $table . ".post_latitude between $rlat1 and $rlat2 ) |
|
854 | - AND ( " . $table . ".post_longitude between $rlon1 and $rlon2 ) "; |
|
853 | + AND ( ".$table.".post_latitude between $rlat1 and $rlat2 ) |
|
854 | + AND ( ".$table.".post_longitude between $rlon1 and $rlon2 ) "; |
|
855 | 855 | |
856 | 856 | if (isset($_REQUEST['sdist']) && $_REQUEST['sdist'] != 'all') { |
857 | 857 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
858 | - $where .= " AND CONVERT((" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= " . $dist; |
|
858 | + $where .= " AND CONVERT((".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) ))),DECIMAL(64,4)) <= ".$dist; |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | } else { |
@@ -872,11 +872,11 @@ discard block |
||
872 | 872 | } |
873 | 873 | |
874 | 874 | ########### WPML ########### |
875 | - if ( geodir_wpml_is_post_type_translated( $post_types ) ) { |
|
875 | + if (geodir_wpml_is_post_type_translated($post_types)) { |
|
876 | 876 | $lang_code = ICL_LANGUAGE_CODE; |
877 | 877 | |
878 | 878 | if ($lang_code && $post_types) { |
879 | - $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_" . $post_types . "') "; |
|
879 | + $where .= " AND icl_t.language_code = '".$lang_code."' AND icl_t.element_type IN('post_".$post_types."') "; |
|
880 | 880 | } |
881 | 881 | } |
882 | 882 | ########### WPML ########### |
@@ -899,10 +899,10 @@ discard block |
||
899 | 899 | global $wpdb, $geodir_post_type, $table, $curr; |
900 | 900 | |
901 | 901 | $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); |
902 | - $user_id = !empty($curauth->ID) ? (int)$curauth->ID : 0; |
|
902 | + $user_id = !empty($curauth->ID) ? (int) $curauth->ID : 0; |
|
903 | 903 | |
904 | 904 | if (isset($_REQUEST['stype'])) { |
905 | - $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ",$_REQUEST['stype']); |
|
905 | + $where = $wpdb->prepare(" AND $wpdb->posts.post_type IN (%s) ", $_REQUEST['stype']); |
|
906 | 906 | } else { |
907 | 907 | $where = " AND $wpdb->posts.post_type IN ('gd_place') "; |
908 | 908 | } |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | } else |
916 | 916 | $where .= " AND $wpdb->posts.post_author = $user_id"; |
917 | 917 | |
918 | - if ($user_id == (int)get_current_user_id()) { |
|
918 | + if ($user_id == (int) get_current_user_id()) { |
|
919 | 919 | $where .= " AND $wpdb->posts.post_status IN ('publish','draft','pending') "; |
920 | 920 | } else { |
921 | 921 | $where .= " AND $wpdb->posts.post_status = 'publish' "; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | if (geodir_wpml_is_post_type_translated(sanitize_text_field($_REQUEST['stype']))) { |
929 | 929 | $lang_code = ICL_LANGUAGE_CODE; |
930 | 930 | if ($lang_code) { |
931 | - $where .= " AND icl_t.language_code='" . $lang_code . "' "; |
|
931 | + $where .= " AND icl_t.language_code='".$lang_code."' "; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | { |
952 | 952 | global $wp_query, $table; |
953 | 953 | if (!empty($wp_query->query['with_pics_only'])) { |
954 | - $join .= " LEFT JOIN " . GEODIR_ATTACHMENT_TABLE . " ON ( " . GEODIR_ATTACHMENT_TABLE . ".post_id=" . $table . ".post_id AND " . GEODIR_ATTACHMENT_TABLE . ".mime_type LIKE '%image%' )"; |
|
954 | + $join .= " LEFT JOIN ".GEODIR_ATTACHMENT_TABLE." ON ( ".GEODIR_ATTACHMENT_TABLE.".post_id=".$table.".post_id AND ".GEODIR_ATTACHMENT_TABLE.".mime_type LIKE '%image%' )"; |
|
955 | 955 | } |
956 | 956 | return $join; |
957 | 957 | } |
@@ -970,16 +970,16 @@ discard block |
||
970 | 970 | { |
971 | 971 | global $wp_query, $table; |
972 | 972 | if (!empty($wp_query->query['show_featured_only'])) { |
973 | - $where .= " AND " . $table . ".is_featured = '1'"; |
|
973 | + $where .= " AND ".$table.".is_featured = '1'"; |
|
974 | 974 | } |
975 | 975 | if (!empty($wp_query->query['show_special_only'])) { |
976 | - $where .= " AND ( " . $table . ".geodir_special_offers != '' AND " . $table . ".geodir_special_offers IS NOT NULL )"; |
|
976 | + $where .= " AND ( ".$table.".geodir_special_offers != '' AND ".$table.".geodir_special_offers IS NOT NULL )"; |
|
977 | 977 | } |
978 | 978 | if (!empty($wp_query->query['with_pics_only'])) { |
979 | - $where .= " AND " . GEODIR_ATTACHMENT_TABLE . ".ID IS NOT NULL GROUP BY " . $table . ".post_id"; |
|
979 | + $where .= " AND ".GEODIR_ATTACHMENT_TABLE.".ID IS NOT NULL GROUP BY ".$table.".post_id"; |
|
980 | 980 | } |
981 | 981 | if (!empty($wp_query->query['with_videos_only'])) { |
982 | - $where .= " AND ( " . $table . ".geodir_video != '' AND " . $table . ".geodir_video IS NOT NULL )"; |
|
982 | + $where .= " AND ( ".$table.".geodir_video != '' AND ".$table.".geodir_video IS NOT NULL )"; |
|
983 | 983 | } |
984 | 984 | return $where; |
985 | 985 | } |
@@ -988,18 +988,18 @@ discard block |
||
988 | 988 | function geodir_related_posts_fields($fields) { |
989 | 989 | global $wp_query, $wpdb, $table, $post; |
990 | 990 | |
991 | - $fields .= ", " . $table . ".* "; |
|
991 | + $fields .= ", ".$table.".* "; |
|
992 | 992 | |
993 | 993 | $DistanceRadius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
994 | 994 | |
995 | 995 | $mylat = $post->post_latitude; |
996 | 996 | $mylon = $post->post_longitude; |
997 | 997 | |
998 | - $fields .= " , (" . $DistanceRadius . " * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(" . $table . ".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(" . $table . ".post_latitude) * pi()/180) *POWER(SIN(($mylon - " . $table . ".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
998 | + $fields .= " , (".$DistanceRadius." * 2 * ASIN(SQRT( POWER(SIN((ABS($mylat) - ABS(".$table.".post_latitude)) * pi()/180 / 2), 2) +COS(ABS($mylat) * pi()/180) * COS( ABS(".$table.".post_latitude) * pi()/180) *POWER(SIN(($mylon - ".$table.".post_longitude) * pi()/180 / 2), 2) )))as distance "; |
|
999 | 999 | return $fields; |
1000 | 1000 | } |
1001 | 1001 | function geodir_related_posts_fields_filter($query) { |
1002 | - if ( isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1002 | + if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop'] |
|
1003 | 1003 | && isset($query->query_vars['order_by']) && $query->query_vars['order_by'] == 'nearest' |
1004 | 1004 | && isset($query->query_vars['related_listings']) && $query->query_vars['related_listings'] |
1005 | 1005 | ) { |
@@ -1018,25 +1018,25 @@ discard block |
||
1018 | 1018 | * @param string $table Listing table name. |
1019 | 1019 | * @return string|null If field exists in table returns order by clause else returns empty. |
1020 | 1020 | */ |
1021 | -function geodir_prepare_custom_sorting( $sorting, $table ) { |
|
1021 | +function geodir_prepare_custom_sorting($sorting, $table) { |
|
1022 | 1022 | $orderby = ''; |
1023 | 1023 | |
1024 | - if ( empty( $sorting ) || empty( $table ) ) { |
|
1024 | + if (empty($sorting) || empty($table)) { |
|
1025 | 1025 | return $orderby; |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - if ( strpos( strtoupper( $sorting ), '_ASC' ) !== false || strpos( strtoupper( $sorting ), '_DESC') !== false ) { |
|
1029 | - $sorting_array = explode( '_', $sorting ); |
|
1028 | + if (strpos(strtoupper($sorting), '_ASC') !== false || strpos(strtoupper($sorting), '_DESC') !== false) { |
|
1029 | + $sorting_array = explode('_', $sorting); |
|
1030 | 1030 | |
1031 | - if ( ( $count = count( $sorting_array ) ) > 1 ) { |
|
1032 | - $order = !empty( $sorting_array[$count - 1] ) ? strtoupper( $sorting_array[$count - 1] ) : ''; |
|
1033 | - array_pop( $sorting_array ); |
|
1031 | + if (($count = count($sorting_array)) > 1) { |
|
1032 | + $order = !empty($sorting_array[$count - 1]) ? strtoupper($sorting_array[$count - 1]) : ''; |
|
1033 | + array_pop($sorting_array); |
|
1034 | 1034 | |
1035 | - if ( !empty( $sorting_array ) && ( $order == 'ASC' || $order == 'DESC' ) ) { |
|
1036 | - $sort_by = implode( '_', $sorting_array ); |
|
1035 | + if (!empty($sorting_array) && ($order == 'ASC' || $order == 'DESC')) { |
|
1036 | + $sort_by = implode('_', $sorting_array); |
|
1037 | 1037 | |
1038 | - if ( geodir_column_exist( $table, $sort_by ) ) { |
|
1039 | - $orderby = $table . "." . $sort_by . " " . $order; |
|
1038 | + if (geodir_column_exist($table, $sort_by)) { |
|
1039 | + $orderby = $table.".".$sort_by." ".$order; |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | } |
@@ -1061,18 +1061,18 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return string Modified fields SQL. |
1063 | 1063 | */ |
1064 | -function geodir_search_widget_location_filter_fields( $fields, $table, $post_type ) { |
|
1064 | +function geodir_search_widget_location_filter_fields($fields, $table, $post_type) { |
|
1065 | 1065 | global $wpdb, $gd_query_args_widgets, $snear, $gd_session; |
1066 | 1066 | |
1067 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1068 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1067 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) { |
|
1068 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
1069 | 1069 | |
1070 | - if ( $location_allowed && strpos( strtolower( $fields ), ' as distance ' ) === false && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1071 | - $latitude = sanitize_text_field( $_REQUEST['sgeo_lat'] ); |
|
1072 | - $longitude = sanitize_text_field( $_REQUEST['sgeo_lon'] ); |
|
1073 | - $radius = geodir_getDistanceRadius( get_option( 'geodir_search_dist_1' ) ); |
|
1070 | + if ($location_allowed && strpos(strtolower($fields), ' as distance ') === false && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1071 | + $latitude = sanitize_text_field($_REQUEST['sgeo_lat']); |
|
1072 | + $longitude = sanitize_text_field($_REQUEST['sgeo_lon']); |
|
1073 | + $radius = geodir_getDistanceRadius(get_option('geodir_search_dist_1')); |
|
1074 | 1074 | |
1075 | - $fields .= $wpdb->prepare( ", (" . $radius . " * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(" . $table . ".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(" . $table . ".post_latitude) * PI() / 180) * POWER(SIN((%s - " . $table . ".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude ); |
|
1075 | + $fields .= $wpdb->prepare(", (".$radius." * 2 * ASIN(SQRT(POWER(SIN((ABS(%s) - ABS(".$table.".post_latitude)) * PI() / 180 / 2), 2) + COS(ABS(%s) * PI() / 180) * COS(ABS(".$table.".post_latitude) * PI() / 180) * POWER(SIN((%s - ".$table.".post_longitude) * PI() / 180 / 2), 2)))) AS distance ", $latitude, $latitude, $longitude); |
|
1076 | 1076 | } |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1094,14 +1094,14 @@ discard block |
||
1094 | 1094 | * |
1095 | 1095 | * @return string Modified fields SQL. |
1096 | 1096 | */ |
1097 | -function geodir_search_widget_location_filter_orderby( $orderby, $table, $post_type ) { |
|
1097 | +function geodir_search_widget_location_filter_orderby($orderby, $table, $post_type) { |
|
1098 | 1098 | global $gd_query_args_widgets, $snear, $gd_session; |
1099 | 1099 | |
1100 | - if ( !empty( $gd_query_args_widgets['gd_location'] ) && geodir_is_page( 'search' ) && !empty( $_REQUEST['sgeo_lat'] ) && !empty( $_REQUEST['sgeo_lon'] ) ) { |
|
1101 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $post_type ) ? false : true; |
|
1100 | + if (!empty($gd_query_args_widgets['gd_location']) && geodir_is_page('search') && !empty($_REQUEST['sgeo_lat']) && !empty($_REQUEST['sgeo_lon'])) { |
|
1101 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($post_type) ? false : true; |
|
1102 | 1102 | |
1103 | - if ( $location_allowed && ( $snear != '' || $gd_session->get( 'all_near_me' ) ) ) { |
|
1104 | - $orderby = "distance ASC, " . $orderby; |
|
1103 | + if ($location_allowed && ($snear != '' || $gd_session->get('all_near_me'))) { |
|
1104 | + $orderby = "distance ASC, ".$orderby; |
|
1105 | 1105 | } |
1106 | 1106 | } |
1107 | 1107 |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | * @since 1.0.0 |
61 | 61 | * @param string $menu_class The menu HTML class. |
62 | 62 | */ |
63 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
63 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
64 | 64 | /** |
65 | 65 | * Filter the menu a class. |
66 | 66 | * |
67 | 67 | * @since 1.0.0 |
68 | 68 | */ |
69 | 69 | $a_class = apply_filters('geodir_menu_a_class', ''); |
70 | - $items .= '<li class="' . $li_class . '"> |
|
71 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $a_class . '"> |
|
72 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
70 | + $items .= '<li class="'.$li_class.'"> |
|
71 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$a_class.'"> |
|
72 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
73 | 73 | </a> |
74 | 74 | </li>'; |
75 | 75 | } |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * @since 1.0.0 |
89 | 89 | * @param string $menu_class The menu HTML class. |
90 | 90 | */ |
91 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings ' . $menu_class); |
|
91 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-listings '.$menu_class); |
|
92 | 92 | /** |
93 | 93 | * Filter the sub menu li class. |
94 | 94 | * |
95 | 95 | * @since 1.0.0 |
96 | 96 | * @param string $menu_class The menu HTML class. |
97 | 97 | */ |
98 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
98 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
99 | 99 | /** |
100 | 100 | * Filter the sub menu ul class. |
101 | 101 | * |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | * @since 1.0.0 |
115 | 115 | */ |
116 | 116 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
117 | - $items .= '<li class="' . $li_class . '"> |
|
118 | - <a href="#" class="' . $a_class . '">' . __('Listing', 'geodirectory') . '</a> |
|
119 | - <ul class="' . $sub_ul_class . '">'; |
|
117 | + $items .= '<li class="'.$li_class.'"> |
|
118 | + <a href="#" class="' . $a_class.'">'.__('Listing', 'geodirectory').'</a> |
|
119 | + <ul class="' . $sub_ul_class.'">'; |
|
120 | 120 | $post_types = geodir_get_posttypes('object'); |
121 | 121 | |
122 | 122 | $show_listing_post_types = get_option('geodir_add_posttype_in_listing_nav'); |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
134 | 134 | $menu_class = 'current-menu-item'; |
135 | 135 | |
136 | - $items .= '<li class="' . $sub_li_class . '"> |
|
137 | - <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
|
138 | - ' . __(geodir_utf8_ucfirst($args->labels->name),'geodirectory') . ' |
|
136 | + $items .= '<li class="'.$sub_li_class.'"> |
|
137 | + <a href="' . get_post_type_archive_link($post_type).'" class="'.$sub_a_class.'"> |
|
138 | + ' . __(geodir_utf8_ucfirst($args->labels->name), 'geodirectory').' |
|
139 | 139 | </a> |
140 | 140 | </li>'; |
141 | 141 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * |
152 | 152 | * @since 1.5.9 |
153 | 153 | */ |
154 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
154 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
155 | 155 | $items .= '</li>'; |
156 | 156 | } |
157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * @since 1.0.0 |
185 | 185 | * @param string $menu_class The menu HTML class. |
186 | 186 | */ |
187 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
187 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
188 | 188 | /** |
189 | 189 | * Filter the menu a class. |
190 | 190 | * |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | */ |
193 | 193 | $a_class = apply_filters('geodir_menu_a_class', ''); |
194 | 194 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
195 | - $items .= '<li class="' . $li_class . '"> |
|
196 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
|
197 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
195 | + $items .= '<li class="'.$li_class.'"> |
|
196 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$a_class.'"> |
|
197 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
198 | 198 | </a> |
199 | 199 | </li>'; |
200 | 200 | } |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | * @since 1.0.0 |
219 | 219 | * @param string $menu_class The menu HTML class. |
220 | 220 | */ |
221 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing ' . $menu_class); |
|
221 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item menu-item-has-children menu-gd-add-listing '.$menu_class); |
|
222 | 222 | /** |
223 | 223 | * Filter the sub menu li class. |
224 | 224 | * |
225 | 225 | * @since 1.0.0 |
226 | 226 | * @param string $menu_class The menu HTML class. |
227 | 227 | */ |
228 | - $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item ' . $menu_class); |
|
228 | + $sub_li_class = apply_filters('geodir_sub_menu_li_class', 'menu-item '.$menu_class); |
|
229 | 229 | /** |
230 | 230 | * Filter the sub menu ul class. |
231 | 231 | * |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @since 1.0.0 |
245 | 245 | */ |
246 | 246 | $sub_a_class = apply_filters('geodir_sub_menu_a_class', ''); |
247 | - $items .= '<li class="' . $li_class . '"> |
|
248 | - <a href="#" class="' . $a_class . '">' . __('Add Listing', 'geodirectory') . '</a> |
|
249 | - <ul class="' . $sub_ul_class . '">'; |
|
247 | + $items .= '<li class="'.$li_class.'"> |
|
248 | + <a href="#" class="' . $a_class.'">'.__('Add Listing', 'geodirectory').'</a> |
|
249 | + <ul class="' . $sub_ul_class.'">'; |
|
250 | 250 | |
251 | 251 | $post_types = geodir_get_posttypes('object'); |
252 | 252 | |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @since 1.0.0 |
270 | 270 | * @param string $menu_class The menu HTML class. |
271 | 271 | */ |
272 | - $li_class = apply_filters('geodir_menu_li_class', 'menu-item ' . $menu_class); |
|
272 | + $li_class = apply_filters('geodir_menu_li_class', 'menu-item '.$menu_class); |
|
273 | 273 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
274 | - $items .= '<li class="' . $sub_li_class . '"> |
|
275 | - <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
|
276 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
274 | + $items .= '<li class="'.$sub_li_class.'"> |
|
275 | + <a href="' . geodir_get_addlisting_link($post_type).'" class="'.$sub_a_class.'"> |
|
276 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name).' |
|
277 | 277 | </a> |
278 | 278 | </li>'; |
279 | 279 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | $items .= ' </ul> '; |
288 | - $items .= apply_filters('geodir_menu_after_sub_ul',''); |
|
288 | + $items .= apply_filters('geodir_menu_after_sub_ul', ''); |
|
289 | 289 | $items .= '</li>'; |
290 | 290 | |
291 | 291 | } |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | $geodir_theme_location = get_option('geodir_theme_location_nav'); |
314 | 314 | $geodir_theme_location_nav = array(); |
315 | 315 | if (empty($locations) && empty($geodir_theme_location)) { |
316 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
316 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
317 | 317 | $geodir_theme_location_nav[] = $args['theme_location']; |
318 | 318 | update_option('geodir_theme_location_nav', $geodir_theme_location_nav); |
319 | 319 | } |
320 | 320 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
321 | 321 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
322 | 322 | else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
323 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
323 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items()."</ul></div>", $menu); |
|
324 | 324 | |
325 | 325 | return $menu; |
326 | 326 | |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | if (has_nav_menu($location) == '1' && is_array($geodir_theme_location) && in_array($location, $geodir_theme_location)) { |
350 | 350 | |
351 | - $items = $items . geodir_add_nav_menu_items(); |
|
351 | + $items = $items.geodir_add_nav_menu_items(); |
|
352 | 352 | return $items; |
353 | 353 | |
354 | 354 | } else { |
@@ -373,12 +373,12 @@ discard block |
||
373 | 373 | |
374 | 374 | $taxonomies = geodir_get_taxonomies(); |
375 | 375 | $taxonomies = implode("','", $taxonomies); |
376 | - $taxonomies = "'" . $taxonomies . "'"; |
|
376 | + $taxonomies = "'".$taxonomies."'"; |
|
377 | 377 | |
378 | 378 | $pn_categories = $wpdb->get_results( |
379 | 379 | $wpdb->prepare( |
380 | 380 | "SELECT $wpdb->terms.name as name, $wpdb->term_taxonomy.count as count, $wpdb->terms.term_id as cat_ID FROM $wpdb->term_taxonomy, $wpdb->terms WHERE $wpdb->term_taxonomy.term_id = %d AND $wpdb->term_taxonomy.taxonomy in ( $taxonomies ) ORDER BY name", |
381 | - array($wpdb->terms . term_id) |
|
381 | + array($wpdb->terms.term_id) |
|
382 | 382 | ) |
383 | 383 | ); |
384 | 384 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
410 | 410 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
411 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
411 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
412 | 412 | elseif (isset($_REQUEST['listing_type'])) |
413 | 413 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
414 | 414 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
435 | 435 | $geodir_post_type = ''; |
436 | 436 | |
437 | - if( defined( 'DOING_AJAX' ) && isset($_REQUEST['stype'])){ |
|
437 | + if (defined('DOING_AJAX') && isset($_REQUEST['stype'])) { |
|
438 | 438 | $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
439 | 439 | } |
440 | 440 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @since 1.6.9 |
446 | 446 | */ |
447 | - return apply_filters('geodir_get_current_posttype',$geodir_post_type); |
|
447 | + return apply_filters('geodir_get_current_posttype', $geodir_post_type); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
@@ -458,18 +458,18 @@ discard block |
||
458 | 458 | */ |
459 | 459 | function geodir_get_default_posttype() |
460 | 460 | { |
461 | - $post_types = apply_filters( 'geodir_get_default_posttype', geodir_get_posttypes( 'object' ) ); |
|
461 | + $post_types = apply_filters('geodir_get_default_posttype', geodir_get_posttypes('object')); |
|
462 | 462 | |
463 | 463 | $stype = false; |
464 | - foreach ( $post_types as $post_type => $info ) { |
|
464 | + foreach ($post_types as $post_type => $info) { |
|
465 | 465 | global $wpdb; |
466 | - $has_posts = $wpdb->get_row( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type ) ); |
|
467 | - if ( $has_posts ) { |
|
466 | + $has_posts = $wpdb->get_row($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type = %s AND post_status='publish' LIMIT 1", $post_type)); |
|
467 | + if ($has_posts) { |
|
468 | 468 | $stype = $post_type; break; |
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
472 | - if(!$stype){ |
|
472 | + if (!$stype) { |
|
473 | 473 | $stype = 'gd_place'; |
474 | 474 | } |
475 | 475 | |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | switch ($output): |
495 | 495 | case 'object': |
496 | 496 | case 'Object': |
497 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
497 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
498 | 498 | break; |
499 | 499 | case 'array': |
500 | 500 | case 'Array': |
501 | - $post_types = (array)$post_types; |
|
501 | + $post_types = (array) $post_types; |
|
502 | 502 | break; |
503 | 503 | case 'options': |
504 | - $post_types = (array)$post_types; |
|
504 | + $post_types = (array) $post_types; |
|
505 | 505 | |
506 | 506 | $options = array(); |
507 | 507 | if (!empty($post_types)) { |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $gd_taxonomies[] = $taxonomy; |
570 | 570 | } |
571 | 571 | |
572 | - if ($tages_taxonomies === false && substr($taxonomy , -5) == '_tags') { |
|
572 | + if ($tages_taxonomies === false && substr($taxonomy, -5) == '_tags') { |
|
573 | 573 | if (array_search($taxonomy, $gd_taxonomies) !== false) { |
574 | 574 | unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
575 | 575 | } |
@@ -615,15 +615,15 @@ discard block |
||
615 | 615 | |
616 | 616 | $categories = get_terms($taxonomies); |
617 | 617 | |
618 | - $html .= '<option value="0">' . __('All', 'geodirectory') . '</option>'; |
|
618 | + $html .= '<option value="0">'.__('All', 'geodirectory').'</option>'; |
|
619 | 619 | |
620 | 620 | foreach ($categories as $category_obj) { |
621 | 621 | $select_opt = ''; |
622 | 622 | if ($selected == $category_obj->term_id) { |
623 | 623 | $select_opt = 'selected="selected"'; |
624 | 624 | } |
625 | - $html .= '<option ' . $select_opt . ' value="' . $category_obj->term_id . '">' |
|
626 | - . geodir_utf8_ucfirst($category_obj->name) . '</option>'; |
|
625 | + $html .= '<option '.$select_opt.' value="'.$category_obj->term_id.'">' |
|
626 | + . geodir_utf8_ucfirst($category_obj->name).'</option>'; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | if ($echo) |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | } elseif (isset($wp_query->tax_query->queries)) { |
692 | 692 | $tax_arr = $wp_query->tax_query->queries; |
693 | 693 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
694 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
694 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); } |
|
695 | 695 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
696 | 696 | } |
697 | 697 | |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | |
746 | 746 | if ((!geodir_is_page('listing')) || (is_search() && $_REQUEST['search_taxonomy'] == '')) { |
747 | 747 | if ($cat_parent == 0) { |
748 | - $list_class = 'main_list gd-parent-cats-list gd-cats-display-' . $cat_display; |
|
748 | + $list_class = 'main_list gd-parent-cats-list gd-cats-display-'.$cat_display; |
|
749 | 749 | $main_list_class = 'class="main_list_selecter"'; |
750 | 750 | } else { |
751 | 751 | //$display = 'display:none'; |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | |
756 | 756 | if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
757 | 757 | $p = 0; |
758 | - $out = '<div class="' . $list_class . ' gd-cat-row-' . $cat_parent . '" style="margin-left:' . $p . 'px;' . $display . ';">'; |
|
758 | + $out = '<div class="'.$list_class.' gd-cat-row-'.$cat_parent.'" style="margin-left:'.$p.'px;'.$display.';">'; |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | foreach ($cat_terms as $cat_term) { |
@@ -770,12 +770,12 @@ discard block |
||
770 | 770 | } |
771 | 771 | |
772 | 772 | if ($cat_display == 'radio') |
773 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
773 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
774 | 774 | elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
775 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
775 | + $out .= '<option '.$main_list_class.' style="margin-left:'.$p.'px;" alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
776 | 776 | |
777 | 777 | else { |
778 | - $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . geodir_utf8_ucfirst($cat_term->name) . '</span>'; |
|
778 | + $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category['.$cat_term->taxonomy.'][]" '.$main_list_class.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" '.$checked.$onchange.' id="gd-cat-'.$cat_term->term_id.'" >'.$term_check.geodir_utf8_ucfirst($cat_term->name).'</span>'; |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | // Call recurson to print sub cats |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | $cat_exclude = serialize($exclude_cats); |
815 | 815 | |
816 | 816 | if (isset($_REQUEST['backandedit'])) { |
817 | - $post = (object)$gd_session->get('listing'); |
|
817 | + $post = (object) $gd_session->get('listing'); |
|
818 | 818 | |
819 | 819 | if (!is_array($post->post_category[$cat_taxonomy])) |
820 | 820 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | |
847 | 847 | if (!empty($post_category)) { |
848 | 848 | $cat1 = array_filter(explode(',', $post_category)); |
849 | - $post_category = ',' . implode(',', $cat1) . ','; |
|
849 | + $post_category = ','.implode(',', $cat1).','; |
|
850 | 850 | |
851 | 851 | } |
852 | 852 | |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | foreach ($post_category_upd as $cat) { |
858 | 858 | |
859 | 859 | if (!in_array($cat, $exclude_cats) && $cat != '') { |
860 | - $post_category_change .= ',' . $cat; |
|
860 | + $post_category_change .= ','.$cat; |
|
861 | 861 | } |
862 | 862 | } |
863 | 863 | $post_category = $post_category_change; |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
872 | - echo '<input type="hidden" id="cat_limit" value="' . $cat_limit . '" name="cat_limit[' . $cat_taxonomy . ']" />'; |
|
872 | + echo '<input type="hidden" id="cat_limit" value="'.$cat_limit.'" name="cat_limit['.$cat_taxonomy.']" />'; |
|
873 | 873 | |
874 | - echo '<input type="hidden" id="post_category" value="' . $post_category . '" name="post_category[' . $cat_taxonomy . ']" />'; |
|
874 | + echo '<input type="hidden" id="post_category" value="'.$post_category.'" name="post_category['.$cat_taxonomy.']" />'; |
|
875 | 875 | |
876 | - echo '<input type="hidden" id="post_category_str" value="' . $post_category_str . '" name="post_category_str[' . $cat_taxonomy . ']" />'; |
|
876 | + echo '<input type="hidden" id="post_category_str" value="'.$post_category_str.'" name="post_category_str['.$cat_taxonomy.']" />'; |
|
877 | 877 | |
878 | 878 | |
879 | 879 | ?> |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | |
893 | 893 | function show_subcatlist(main_cat, catObj) { |
894 | 894 | if (main_cat != '') { |
895 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
896 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
897 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
895 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
896 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
897 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
898 | 898 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); |
899 | - <?php if ((int)$cat_limit > 0) { ?> |
|
899 | + <?php if ((int) $cat_limit > 0) { ?> |
|
900 | 900 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); |
901 | 901 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { |
902 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>"); |
|
902 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>"); |
|
903 | 903 | return false; |
904 | 904 | } |
905 | 905 | <?php } ?> |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | } |
939 | 939 | |
940 | 940 | function update_listing_cat(el) { |
941 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
941 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
942 | 942 | var cat_ids = ''; |
943 | 943 | var main_cat = ''; |
944 | 944 | var sub_cat = ''; |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
1020 | 1020 | echo $style; |
1021 | 1021 | }?> "> |
1022 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1022 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
1023 | 1023 | ?> |
1024 | 1024 | </div> |
1025 | 1025 | <?php |
@@ -1046,9 +1046,9 @@ discard block |
||
1046 | 1046 | if ($exclude != '') { |
1047 | 1047 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
1048 | 1048 | |
1049 | - if(is_array( $exclude_cats)){ |
|
1050 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1051 | - }else{ |
|
1049 | + if (is_array($exclude_cats)) { |
|
1050 | + $exclude_cats = array_map('intval', $exclude_cats); |
|
1051 | + } else { |
|
1052 | 1052 | $exclude_cats = intval($exclude_cats); |
1053 | 1053 | } |
1054 | 1054 | |
@@ -1062,25 +1062,25 @@ discard block |
||
1062 | 1062 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1063 | 1063 | |
1064 | 1064 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
1065 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
1065 | + <img alt="move icon" src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png'; ?>" |
|
1066 | 1066 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/> |
1067 | 1067 | <?php /* ?> |
1068 | 1068 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> |
1069 | 1069 | <?php */ ?> |
1070 | 1070 | |
1071 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
1071 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
1072 | 1072 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()" |
1073 | 1073 | checked="checked" disabled="disabled"/> |
1074 | 1074 | <span> |
1075 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1075 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1076 | 1076 | </span> |
1077 | 1077 | <br/> |
1078 | 1078 | |
1079 | 1079 | <div class="post_default_category"> |
1080 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
1081 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1080 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
1081 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
1082 | 1082 | <span> |
1083 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1083 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1084 | 1084 | </span> |
1085 | 1085 | </div> |
1086 | 1086 | |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | $post_cat_str = $post_categories[$request_taxonomy]; |
1114 | 1114 | $post_cat_array = explode("#", $post_cat_str); |
1115 | 1115 | if (is_array($post_cat_array)) { |
1116 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1116 | + $post_cat_array = array_unique($post_cat_array); |
|
1117 | 1117 | |
1118 | 1118 | foreach ($post_cat_array as $post_cat_html) { |
1119 | 1119 | |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | } |
1129 | 1129 | $post_sub_catid = ''; |
1130 | 1130 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1131 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1131 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1152 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1152 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1181,9 +1181,9 @@ discard block |
||
1181 | 1181 | if (!$selected) |
1182 | 1182 | $option_slected = ' selected="selected" '; |
1183 | 1183 | |
1184 | - echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
|
1184 | + echo '<select field_type="select" id="'.sanitize_text_field($cat_taxonomy).'" class="chosen_select" '.$onchange.' option-ajaxChosen="false" >'; |
|
1185 | 1185 | |
1186 | - echo '<option value="" ' . $option_selected . ' >' . __('Select Category', 'geodirectory') . '</option>'; |
|
1186 | + echo '<option value="" '.$option_selected.' >'.__('Select Category', 'geodirectory').'</option>'; |
|
1187 | 1187 | |
1188 | 1188 | foreach ($cat_terms as $cat_term) { |
1189 | 1189 | $option_selected = ''; |
@@ -1191,10 +1191,10 @@ discard block |
||
1191 | 1191 | $option_selected = ' selected="selected" '; |
1192 | 1192 | |
1193 | 1193 | // Count child terms |
1194 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1195 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1194 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1)); |
|
1195 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
1196 | 1196 | |
1197 | - echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . geodir_utf8_ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . geodir_utf8_ucfirst($cat_term->name) . '</option>'; |
|
1197 | + echo '<option '.$option_selected.' alt="'.$cat_term->taxonomy.'" title="'.geodir_utf8_ucfirst($cat_term->name).'" value="'.$cat_term->term_id.'" _hc="'.$has_child.'" >'.geodir_utf8_ucfirst($cat_term->name).'</option>'; |
|
1198 | 1198 | } |
1199 | 1199 | echo '</select>'; |
1200 | 1200 | } |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | 2 => __('Custom field updated.', 'geodirectory'), |
1226 | 1226 | 3 => __('Custom field deleted.', 'geodirectory'), |
1227 | 1227 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
1228 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1228 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
1229 | 1229 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
1230 | 1230 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
1231 | 1231 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
@@ -1251,7 +1251,7 @@ discard block |
||
1251 | 1251 | |
1252 | 1252 | global $wpdb; |
1253 | 1253 | |
1254 | - $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
|
1254 | + $menu_icon = geodir_plugin_url().'/geodirectory-assets/images/favicon.ico'; |
|
1255 | 1255 | |
1256 | 1256 | if (!$listing_slug = get_option('geodir_listing_prefix')) |
1257 | 1257 | $listing_slug = 'places'; |
@@ -1264,11 +1264,11 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | $gd_placetags = array(); |
1266 | 1266 | $gd_placetags['object_type'] = 'gd_place'; |
1267 | - $gd_placetags['listing_slug'] = $listing_slug . '/tags'; |
|
1267 | + $gd_placetags['listing_slug'] = $listing_slug.'/tags'; |
|
1268 | 1268 | $gd_placetags['args'] = array( |
1269 | 1269 | 'public' => true, |
1270 | 1270 | 'hierarchical' => false, |
1271 | - 'rewrite' => array('slug' => $listing_slug . '/tags', 'with_front' => false, 'hierarchical' => true), |
|
1271 | + 'rewrite' => array('slug' => $listing_slug.'/tags', 'with_front' => false, 'hierarchical' => true), |
|
1272 | 1272 | 'query_var' => true, |
1273 | 1273 | |
1274 | 1274 | 'labels' => array( |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | 'menu_icon' => $menu_icon, |
1363 | 1363 | 'public' => true, |
1364 | 1364 | 'query_var' => true, |
1365 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1365 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true, 'feeds' => true), |
|
1366 | 1366 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
1367 | 1367 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
1368 | 1368 | |
@@ -1395,12 +1395,12 @@ discard block |
||
1395 | 1395 | return $_REQUEST['lang']; |
1396 | 1396 | } |
1397 | 1397 | |
1398 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1398 | + $url = str_replace(array("http://", "https://"), "", $url); |
|
1399 | 1399 | |
1400 | 1400 | // site_url() seems to work better than get_bloginfo('url') here, WPML can change get_bloginfo('url') to add the lang. |
1401 | - $site_url = str_replace(array("http://","https://"),"",site_url()); |
|
1401 | + $site_url = str_replace(array("http://", "https://"), "", site_url()); |
|
1402 | 1402 | |
1403 | - $url = str_replace($site_url,"",$url); |
|
1403 | + $url = str_replace($site_url, "", $url); |
|
1404 | 1404 | |
1405 | 1405 | $segments = explode('/', trim($url, '/')); |
1406 | 1406 | |
@@ -1466,9 +1466,9 @@ discard block |
||
1466 | 1466 | if (in_array($post->post_type, geodir_get_posttypes())) { |
1467 | 1467 | |
1468 | 1468 | // if we dont have a GD post then try to grab it |
1469 | - if(!isset($post->default_category)){ |
|
1469 | + if (!isset($post->default_category)) { |
|
1470 | 1470 | $gd_post = geodir_get_post_info($post->ID); |
1471 | - if(!empty($gd_post)){ |
|
1471 | + if (!empty($gd_post)) { |
|
1472 | 1472 | $post = $gd_post; |
1473 | 1473 | } |
1474 | 1474 | } |
@@ -1478,17 +1478,17 @@ discard block |
||
1478 | 1478 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
1479 | 1479 | |
1480 | 1480 | // Alter the CPT slug if WPML is set to do so |
1481 | - if(geodir_wpml_is_post_type_translated($post->post_type)){ |
|
1482 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1481 | + if (geodir_wpml_is_post_type_translated($post->post_type)) { |
|
1482 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1483 | 1483 | |
1484 | 1484 | $org_slug = $slug; |
1485 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1485 | + $slug = apply_filters('wpml_translate_single_string', |
|
1486 | 1486 | $slug, |
1487 | 1487 | 'WordPress', |
1488 | - 'URL slug: ' . $slug, |
|
1488 | + 'URL slug: '.$slug, |
|
1489 | 1489 | $language_code); |
1490 | 1490 | |
1491 | - if(!$slug){$slug = $org_slug;} |
|
1491 | + if (!$slug) {$slug = $org_slug; } |
|
1492 | 1492 | |
1493 | 1493 | } |
1494 | 1494 | } |
@@ -1510,11 +1510,11 @@ discard block |
||
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | $post_link = trailingslashit( |
1513 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1513 | + preg_replace("/".preg_quote($slug, "/")."/", $slug."/%gd_taxonomy%", $post_link, 1) |
|
1514 | 1514 | ); |
1515 | 1515 | |
1516 | 1516 | if ($fix_url) { |
1517 | - $post_link = $site_url . $post_link; |
|
1517 | + $post_link = $site_url.$post_link; |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | if (isset($comment_post_cache[$post->ID])) { |
@@ -1533,12 +1533,12 @@ discard block |
||
1533 | 1533 | $ID = $post->ID; |
1534 | 1534 | $post2 = $wpdb->get_row( |
1535 | 1535 | $wpdb->prepare( |
1536 | - "SELECT * from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1536 | + "SELECT * from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1537 | 1537 | array($post->ID) |
1538 | 1538 | ) |
1539 | 1539 | ); |
1540 | 1540 | |
1541 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1541 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
1542 | 1542 | |
1543 | 1543 | $comment_post_cache[$post->ID] = $post; |
1544 | 1544 | } |
@@ -1547,7 +1547,7 @@ discard block |
||
1547 | 1547 | |
1548 | 1548 | if (false !== strpos($post_link, '%gd_taxonomy%')) { |
1549 | 1549 | |
1550 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1550 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) { |
|
1551 | 1551 | $location_request = ''; |
1552 | 1552 | |
1553 | 1553 | |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1562 | 1562 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1563 | 1563 | |
1564 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1564 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1565 | 1565 | 'region_slug' => $post->region_slug, |
1566 | 1566 | 'city_slug' => $post->city_slug |
1567 | 1567 | ); |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | |
1575 | 1575 | $post_location_sql = $wpdb->get_results( |
1576 | 1576 | $wpdb->prepare( |
1577 | - "SELECT post_locations from " . $plugin_prefix . $post->post_type . "_detail WHERE post_id = %d ", |
|
1577 | + "SELECT post_locations from ".$plugin_prefix.$post->post_type."_detail WHERE post_id = %d ", |
|
1578 | 1578 | array($post->ID) |
1579 | 1579 | ) |
1580 | 1580 | ); |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1591 | 1591 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1592 | 1592 | |
1593 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1593 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1594 | 1594 | 'region_slug' => $post->region_slug, |
1595 | 1595 | 'city_slug' => $post->city_slug |
1596 | 1596 | ); |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | } |
1620 | 1620 | $location_slug[] = $city_slug; |
1621 | 1621 | |
1622 | - $location_request .= implode('/', $location_slug) . '/'; |
|
1622 | + $location_request .= implode('/', $location_slug).'/'; |
|
1623 | 1623 | } |
1624 | 1624 | } |
1625 | 1625 | |
@@ -1634,9 +1634,9 @@ discard block |
||
1634 | 1634 | } else { |
1635 | 1635 | $post_terms = ''; |
1636 | 1636 | |
1637 | - if(isset($_POST['post_default_category']) && $_POST['post_default_category']){ |
|
1637 | + if (isset($_POST['post_default_category']) && $_POST['post_default_category']) { |
|
1638 | 1638 | $post_terms = absint($_POST['post_default_category']); |
1639 | - }elseif(isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1639 | + }elseif (isset($_POST['post_category'][$taxonomies]) && $_POST['post_category'][$taxonomies]) { |
|
1640 | 1640 | $post_terms = is_array($_POST['post_category'][$taxonomies]) ? $_POST['post_category'][$taxonomies] : explode(",", trim($_POST['post_category'][$taxonomies], ",")); |
1641 | 1641 | $post_terms = !empty($post_terms) ? absint($post_terms[0]) : 0; |
1642 | 1642 | }elseif (isset($post->{$taxonomies})) { |
@@ -1682,14 +1682,14 @@ discard block |
||
1682 | 1682 | $request_term = trim($request_term, '/'); |
1683 | 1683 | |
1684 | 1684 | // Fix with WPML the location terms added twice when CPT slug is translated. |
1685 | - if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/' . $request_term . $detailurl_separator) !== false) { |
|
1685 | + if ($sample && !empty($location_request) && geodir_is_wpml() && strpos($post_link, '%gd_taxonomy%/'.$request_term.$detailurl_separator) !== false) { |
|
1686 | 1686 | $post_link = str_replace('%gd_taxonomy%/', '', $post_link); |
1687 | 1687 | } |
1688 | 1688 | |
1689 | 1689 | if (!empty($request_term)) |
1690 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1690 | + $post_link = str_replace('%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1691 | 1691 | else |
1692 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1692 | + $post_link = str_replace('/%gd_taxonomy%', $request_term.$detailurl_separator, $post_link); |
|
1693 | 1693 | //echo $post_link ; |
1694 | 1694 | } |
1695 | 1695 | // temp cache the permalink |
@@ -1764,9 +1764,9 @@ discard block |
||
1764 | 1764 | $url_separator = ''; |
1765 | 1765 | |
1766 | 1766 | if (get_option('permalink_structure') != '') { |
1767 | - $old_listing_slug = '/' . $listing_slug . '/'; |
|
1767 | + $old_listing_slug = '/'.$listing_slug.'/'; |
|
1768 | 1768 | $request_term = implode("/", $location_terms); |
1769 | - $new_listing_slug = '/' . $listing_slug . '/' . $request_term . '/'; |
|
1769 | + $new_listing_slug = '/'.$listing_slug.'/'.$request_term.'/'; |
|
1770 | 1770 | |
1771 | 1771 | $termlink = substr_replace($termlink, $new_listing_slug, strpos($termlink, $old_listing_slug), strlen($old_listing_slug)); |
1772 | 1772 | } else { |
@@ -1786,25 +1786,25 @@ discard block |
||
1786 | 1786 | // Alter the CPT slug if WPML is set to do so |
1787 | 1787 | if (geodir_is_wpml()) { |
1788 | 1788 | $post_types = get_option('geodir_post_types'); |
1789 | - $post_type = str_replace("category","",$taxonomy); |
|
1790 | - $post_type = str_replace("_tags","",$post_type); |
|
1789 | + $post_type = str_replace("category", "", $taxonomy); |
|
1790 | + $post_type = str_replace("_tags", "", $post_type); |
|
1791 | 1791 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1792 | 1792 | if (geodir_wpml_is_post_type_translated($post_type) && gd_wpml_slug_translation_turned_on($post_type)) { |
1793 | 1793 | global $sitepress; |
1794 | 1794 | $default_lang = $sitepress->get_default_language(); |
1795 | 1795 | $language_code = gd_wpml_get_lang_from_url($termlink); |
1796 | - if (!$language_code ) { |
|
1797 | - $language_code = $default_lang; |
|
1796 | + if (!$language_code) { |
|
1797 | + $language_code = $default_lang; |
|
1798 | 1798 | } |
1799 | 1799 | |
1800 | 1800 | $org_slug = $slug; |
1801 | - $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: ' . $slug, $language_code); |
|
1801 | + $slug = apply_filters('wpml_translate_single_string', $slug, 'WordPress', 'URL slug: '.$slug, $language_code); |
|
1802 | 1802 | |
1803 | 1803 | if (!$slug) { |
1804 | 1804 | $slug = $org_slug; |
1805 | 1805 | } |
1806 | 1806 | |
1807 | - $termlink = trailingslashit(preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug ,$termlink, 1)); |
|
1807 | + $termlink = trailingslashit(preg_replace("/".preg_quote($org_slug, "/")."/", $slug, $termlink, 1)); |
|
1808 | 1808 | } |
1809 | 1809 | } |
1810 | 1810 | } |
@@ -1834,7 +1834,7 @@ discard block |
||
1834 | 1834 | |
1835 | 1835 | if (in_array($post_type, geodir_get_posttypes())) { |
1836 | 1836 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1837 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1837 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1838 | 1838 | $location_terms = array( |
1839 | 1839 | 'gd_country' => $post->country_slug, |
1840 | 1840 | 'gd_region' => $post->region_slug, |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | $location_terms = implode("/", $location_terms); |
1852 | 1852 | $location_terms = rtrim($location_terms, '/'); |
1853 | 1853 | |
1854 | - $link .= urldecode($location_terms) . '/'; |
|
1854 | + $link .= urldecode($location_terms).'/'; |
|
1855 | 1855 | } else { |
1856 | 1856 | $link = geodir_getlink($link, $location_terms); |
1857 | 1857 | } |
@@ -1939,9 +1939,9 @@ discard block |
||
1939 | 1939 | return 0; |
1940 | 1940 | $where = 't.term_id = %d'; |
1941 | 1941 | if (!empty($taxonomy)) |
1942 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1942 | + return $wpdb->get_row($wpdb->prepare($tax_select.$where." AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1943 | 1943 | else |
1944 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1944 | + return $wpdb->get_var($wpdb->prepare($select.$where, $term)); |
|
1945 | 1945 | } |
1946 | 1946 | |
1947 | 1947 | $term = trim(wp_unslash($term)); |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | |
1954 | 1954 | $where_fields = array($slug); |
1955 | 1955 | if (!empty($taxonomy)) { |
1956 | - $parent = (int)$parent; |
|
1956 | + $parent = (int) $parent; |
|
1957 | 1957 | if ($parent > 0) { |
1958 | 1958 | $where_fields[] = $parent; |
1959 | 1959 | $else_where_fields[] = $parent; |
@@ -2017,13 +2017,13 @@ discard block |
||
2017 | 2017 | $post_types = geodir_get_posttypes(); |
2018 | 2018 | $tax_arr = array(); |
2019 | 2019 | foreach ($post_types as $post_type) { |
2020 | - $tax_arr[] = "'" . $post_type . "category'"; |
|
2020 | + $tax_arr[] = "'".$post_type."category'"; |
|
2021 | 2021 | } |
2022 | 2022 | $tax_c = implode(',', $tax_arr); |
2023 | 2023 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
2024 | 2024 | //$terms = get_terms( $taxonomy ); |
2025 | 2025 | |
2026 | - if($terms) { |
|
2026 | + if ($terms) { |
|
2027 | 2027 | foreach ($terms as $term) { |
2028 | 2028 | $post_type = str_replace("category", "", $term->taxonomy); |
2029 | 2029 | $a_terms[$post_type][] = $term; |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | } |
2032 | 2032 | } |
2033 | 2033 | |
2034 | - if($a_terms) { |
|
2034 | + if ($a_terms) { |
|
2035 | 2035 | foreach ($a_terms as $pt => $t2) { |
2036 | 2036 | |
2037 | 2037 | foreach ($t2 as $term) { |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | } |
2057 | 2057 | |
2058 | 2058 | if (is_ssl()) { |
2059 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
2059 | + $terms_icons = str_replace("http:", "https:", $terms_icons); |
|
2060 | 2060 | } |
2061 | 2061 | |
2062 | 2062 | return apply_filters('geodir_get_term_icons', $terms_icons, $term_id); |