@@ -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,8 +258,8 @@ 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 | 265 | |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | |
327 | 327 | /////// GEO DIRECOTORY CUSTOM HOOKS /// |
328 | 328 | |
329 | -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 |
|
330 | -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 |
|
329 | +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 |
|
330 | +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 |
|
331 | 331 | |
332 | 332 | // Detail page sidebar content |
333 | 333 | add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1); |
@@ -427,8 +427,8 @@ discard block |
||
427 | 427 | do_action('geodir_after_social_sharing_buttons'); |
428 | 428 | $content_html = ob_get_clean(); |
429 | 429 | if (trim($content_html) != '') |
430 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
431 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
430 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>'; |
|
431 | + if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
432 | 432 | /** |
433 | 433 | * Filter the geodir_social_sharing_buttons() function content. |
434 | 434 | * |
@@ -468,12 +468,12 @@ discard block |
||
468 | 468 | $post_id = $post->ID; |
469 | 469 | |
470 | 470 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
471 | - $post_id = (int)$_REQUEST['pid']; |
|
471 | + $post_id = (int) $_REQUEST['pid']; |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | $postlink = get_permalink(geodir_add_listing_page_id()); |
475 | 475 | $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
476 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
476 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>'; |
|
477 | 477 | } |
478 | 478 | }// end of if, if its a preview or not |
479 | 479 | /** |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | do_action('geodir_after_edit_post_link'); |
485 | 485 | $content_html = ob_get_clean(); |
486 | 486 | if (trim($content_html) != '') |
487 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
488 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
487 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>'; |
|
488 | + if ((int) get_option('geodir_disable_user_links_section') != 1) { |
|
489 | 489 | /** |
490 | 490 | * Filter the geodir_edit_post_link() function content. |
491 | 491 | * |
@@ -506,8 +506,8 @@ discard block |
||
506 | 506 | */ |
507 | 507 | function geodir_detail_page_google_analytics() |
508 | 508 | { |
509 | - global $post,$preview; |
|
510 | - if($preview){return '';} |
|
509 | + global $post, $preview; |
|
510 | + if ($preview) {return ''; } |
|
511 | 511 | $package_info = array(); |
512 | 512 | $package_info = geodir_post_package_info($package_info, $post); |
513 | 513 | |
@@ -539,14 +539,14 @@ discard block |
||
539 | 539 | $hide_refresh = get_option('geodir_ga_auto_refresh'); |
540 | 540 | |
541 | 541 | $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
542 | - 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' )) ) { |
|
542 | + 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'))) { |
|
543 | 543 | $page_url = urlencode($_SERVER['REQUEST_URI']); |
544 | 544 | ?> |
545 | 545 | <script type="text/javascript"> |
546 | 546 | var gd_gaTimeOut; |
547 | - var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
|
548 | - var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>; |
|
549 | - var gd_gaAutoRefresh = <?php echo $auto_refresh;?>; |
|
547 | + var gd_gaTime = parseInt('<?php echo $refresh_time; ?>'); |
|
548 | + var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>; |
|
549 | + var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>; |
|
550 | 550 | ga_data1 = false; |
551 | 551 | ga_data2 = false; |
552 | 552 | ga_data3 = false; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | function gdga_noResults() { |
690 | - jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>'); |
|
690 | + jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>'); |
|
691 | 691 | jQuery('#gdga-legend-container').html(''); |
692 | 692 | } |
693 | 693 | |
@@ -719,18 +719,18 @@ discard block |
||
719 | 719 | var data2 = results[1].rows.map(function(row) { return +row[2]; }); |
720 | 720 | //var labelsN = results[0].rows.map(function(row) { return +row[1]; }); |
721 | 721 | |
722 | - var labels = ['<?php _e('Jan', 'geodirectory');?>', |
|
723 | - '<?php _e('Feb', 'geodirectory');?>', |
|
724 | - '<?php _e('Mar', 'geodirectory');?>', |
|
725 | - '<?php _e('Apr', 'geodirectory');?>', |
|
726 | - '<?php _e('May', 'geodirectory');?>', |
|
727 | - '<?php _e('Jun', 'geodirectory');?>', |
|
728 | - '<?php _e('Jul', 'geodirectory');?>', |
|
729 | - '<?php _e('Aug', 'geodirectory');?>', |
|
730 | - '<?php _e('Sep', 'geodirectory');?>', |
|
731 | - '<?php _e('Oct', 'geodirectory');?>', |
|
732 | - '<?php _e('Nov', 'geodirectory');?>', |
|
733 | - '<?php _e('Dec', 'geodirectory');?>']; |
|
722 | + var labels = ['<?php _e('Jan', 'geodirectory'); ?>', |
|
723 | + '<?php _e('Feb', 'geodirectory'); ?>', |
|
724 | + '<?php _e('Mar', 'geodirectory'); ?>', |
|
725 | + '<?php _e('Apr', 'geodirectory'); ?>', |
|
726 | + '<?php _e('May', 'geodirectory'); ?>', |
|
727 | + '<?php _e('Jun', 'geodirectory'); ?>', |
|
728 | + '<?php _e('Jul', 'geodirectory'); ?>', |
|
729 | + '<?php _e('Aug', 'geodirectory'); ?>', |
|
730 | + '<?php _e('Sep', 'geodirectory'); ?>', |
|
731 | + '<?php _e('Oct', 'geodirectory'); ?>', |
|
732 | + '<?php _e('Nov', 'geodirectory'); ?>', |
|
733 | + '<?php _e('Dec', 'geodirectory'); ?>']; |
|
734 | 734 | |
735 | 735 | // Ensure the data arrays are at least as long as the labels array. |
736 | 736 | // Chart.js bar charts don't (yet) accept sparse datasets. |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | labels : labels, |
744 | 744 | datasets : [ |
745 | 745 | { |
746 | - label: '<?php _e('Last Year', 'geodirectory');?>', |
|
746 | + label: '<?php _e('Last Year', 'geodirectory'); ?>', |
|
747 | 747 | fillColor : "rgba(220,220,220,0.5)", |
748 | 748 | strokeColor : "rgba(220,220,220,1)", |
749 | 749 | data : data2 |
750 | 750 | }, |
751 | 751 | { |
752 | - label: '<?php _e('This Year', 'geodirectory');?>', |
|
752 | + label: '<?php _e('This Year', 'geodirectory'); ?>', |
|
753 | 753 | fillColor : "rgba(151,187,205,0.5)", |
754 | 754 | strokeColor : "rgba(151,187,205,1)", |
755 | 755 | data : data1 |
@@ -794,30 +794,30 @@ discard block |
||
794 | 794 | |
795 | 795 | <?php |
796 | 796 | // Here we list the shorthand days of the week so it can be used in translation. |
797 | - __("Mon",'geodirectory'); |
|
798 | - __("Tue",'geodirectory'); |
|
799 | - __("Wed",'geodirectory'); |
|
800 | - __("Thu",'geodirectory'); |
|
801 | - __("Fri",'geodirectory'); |
|
802 | - __("Sat",'geodirectory'); |
|
803 | - __("Sun",'geodirectory'); |
|
797 | + __("Mon", 'geodirectory'); |
|
798 | + __("Tue", 'geodirectory'); |
|
799 | + __("Wed", 'geodirectory'); |
|
800 | + __("Thu", 'geodirectory'); |
|
801 | + __("Fri", 'geodirectory'); |
|
802 | + __("Sat", 'geodirectory'); |
|
803 | + __("Sun", 'geodirectory'); |
|
804 | 804 | ?> |
805 | 805 | |
806 | 806 | labels = [ |
807 | - "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
|
808 | - "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>", |
|
809 | - "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>", |
|
810 | - "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>", |
|
811 | - "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>", |
|
812 | - "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>", |
|
813 | - "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>" |
|
807 | + "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>", |
|
808 | + "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>", |
|
809 | + "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>", |
|
810 | + "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>", |
|
811 | + "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>", |
|
812 | + "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>", |
|
813 | + "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>" |
|
814 | 814 | ]; |
815 | 815 | |
816 | 816 | var data = { |
817 | 817 | labels : labels, |
818 | 818 | datasets : [ |
819 | 819 | { |
820 | - label: '<?php _e('Last Week', 'geodirectory');?>', |
|
820 | + label: '<?php _e('Last Week', 'geodirectory'); ?>', |
|
821 | 821 | fillColor : "rgba(220,220,220,0.5)", |
822 | 822 | strokeColor : "rgba(220,220,220,1)", |
823 | 823 | pointColor : "rgba(220,220,220,1)", |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | data : data2 |
826 | 826 | }, |
827 | 827 | { |
828 | - label: '<?php _e('This Week', 'geodirectory');?>', |
|
828 | + label: '<?php _e('This Week', 'geodirectory'); ?>', |
|
829 | 829 | fillColor : "rgba(151,187,205,0.5)", |
830 | 830 | strokeColor : "rgba(151,187,205,1)", |
831 | 831 | pointColor : "rgba(151,187,205,1)", |
@@ -1032,18 +1032,18 @@ discard block |
||
1032 | 1032 | </style> |
1033 | 1033 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> |
1034 | 1034 | <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script> |
1035 | - <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button> |
|
1035 | + <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button> |
|
1036 | 1036 | <span id="ga_stats" class="gdga-analytics-box" style="display:none"> |
1037 | - <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div> |
|
1037 | + <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div> |
|
1038 | 1038 | <div id="gd-active-users-container"> |
1039 | - <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');?> |
|
1039 | + <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'); ?> |
|
1040 | 1040 | <b class="gd-ActiveUsers-value">0</b> |
1041 | 1041 | </div> |
1042 | 1042 | </div> |
1043 | 1043 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;"> |
1044 | - <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option> |
|
1045 | - <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option> |
|
1046 | - <option value="country"><?php _e("Top Countries", 'geodirectory');?></option> |
|
1044 | + <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option> |
|
1045 | + <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option> |
|
1046 | + <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option> |
|
1047 | 1047 | </select> |
1048 | 1048 | <div class="Chartjs-figure" id="gdga-chart-container"></div> |
1049 | 1049 | <ol class="Chartjs-legend" id="gdga-legend-container"></ol> |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | do_action('geodir_after_google_analytics'); |
1060 | 1060 | $content_html = ob_get_clean(); |
1061 | 1061 | if (trim($content_html) != '') |
1062 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1063 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1062 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>'; |
|
1063 | + if ((int) get_option('geodir_disable_google_analytics_section') != 1) { |
|
1064 | 1064 | /** |
1065 | 1065 | * Filter the geodir_edit_post_link() function content. |
1066 | 1066 | * |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | { |
1087 | 1087 | global $post, $preview, $post_images; |
1088 | 1088 | |
1089 | - if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) { |
|
1089 | + if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) { |
|
1090 | 1090 | return; |
1091 | 1091 | } |
1092 | 1092 | ob_start(); // Start buffering; |
@@ -1121,10 +1121,10 @@ discard block |
||
1121 | 1121 | |
1122 | 1122 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1123 | 1123 | |
1124 | - $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 />'; |
|
1124 | + $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 />'; |
|
1125 | 1125 | |
1126 | 1126 | $html .= '<span class="item">'; |
1127 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1127 | + $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>'; |
|
1128 | 1128 | |
1129 | 1129 | if ($post_images) { |
1130 | 1130 | foreach ($post_images as $img) { |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | if (isset($post_img) && $post_img) { |
1137 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1137 | + $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />'; |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | $html .= '</span>'; |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | do_action('geodir_after_detail_page_review_rating'); |
1162 | 1162 | $content_html = ob_get_clean(); |
1163 | 1163 | if (trim($content_html) != '') { |
1164 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1164 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>'; |
|
1165 | 1165 | } |
1166 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1166 | + if ((int) get_option('geodir_disable_rating_info_section') != 1) { |
|
1167 | 1167 | /** |
1168 | 1168 | * Filter the geodir_detail_page_review_rating() function content. |
1169 | 1169 | * |
@@ -1202,8 +1202,8 @@ discard block |
||
1202 | 1202 | |
1203 | 1203 | $content_html = ob_get_clean(); |
1204 | 1204 | if (trim($content_html) != '') |
1205 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1206 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1205 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>'; |
|
1206 | + if ((int) get_option('geodir_disable_listing_info_section') != 1) { |
|
1207 | 1207 | /** |
1208 | 1208 | * Filter the output html for function geodir_detail_page_more_info(). |
1209 | 1209 | * |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
1303 | 1303 | 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
1304 | 1304 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1305 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1305 | + 'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1306 | 1306 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1307 | 1307 | 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
1308 | 1308 | 'geodir_map_name' => geodir_map_name(), |
@@ -1331,10 +1331,10 @@ discard block |
||
1331 | 1331 | foreach ($arr_alert_msg as $key => $value) { |
1332 | 1332 | if (!is_scalar($value)) |
1333 | 1333 | continue; |
1334 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1334 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1335 | 1335 | } |
1336 | 1336 | |
1337 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1337 | + $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';'; |
|
1338 | 1338 | echo '<script>'; |
1339 | 1339 | echo $script; |
1340 | 1340 | echo '</script>'; |
@@ -1424,7 +1424,7 @@ discard block |
||
1424 | 1424 | $geodir_old_sidebars = get_option('geodir_sidebars'); |
1425 | 1425 | if (is_array($geodir_old_sidebars)) { |
1426 | 1426 | foreach ($geodir_old_sidebars as $key => $val) { |
1427 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1427 | + if (0 === strpos($key, 'geodir_'))// if gd widget |
|
1428 | 1428 | { |
1429 | 1429 | $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
1430 | 1430 | } |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | global $post; |
1504 | 1504 | $term_condition = ''; |
1505 | 1505 | if (isset($_REQUEST['backandedit'])) { |
1506 | - $post = (object)$gd_session->get('listing'); |
|
1506 | + $post = (object) $gd_session->get('listing'); |
|
1507 | 1507 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
1508 | 1508 | } |
1509 | 1509 | |
@@ -1517,7 +1517,7 @@ discard block |
||
1517 | 1517 | echo 'checked="checked"'; |
1518 | 1518 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
1519 | 1519 | class="geodir_textfield" value="1" |
1520 | - 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> |
|
1520 | + 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> |
|
1521 | 1521 | </span> |
1522 | 1522 | </div> |
1523 | 1523 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
@@ -1557,7 +1557,7 @@ discard block |
||
1557 | 1557 | /** This action is documented in geodirectory_template_actions.php */ |
1558 | 1558 | $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
1559 | 1559 | |
1560 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1560 | + if (!($desc_limit === '' || (int) $desc_limit > 0)) { |
|
1561 | 1561 | $is_display = false; |
1562 | 1562 | } |
1563 | 1563 | } |
@@ -1605,16 +1605,16 @@ discard block |
||
1605 | 1605 | global $wpdb, $plugin_prefix; |
1606 | 1606 | |
1607 | 1607 | // Remove unused virtual page |
1608 | - $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1608 | + $listings_page_id = (int) get_option('geodir_listing_page'); |
|
1609 | 1609 | if ($listings_page_id) { |
1610 | - $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'))); |
|
1610 | + $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'))); |
|
1611 | 1611 | delete_option('geodir_listing_page'); |
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | if (!get_option('geodir_changes_in_custom_fields_table')) { |
1615 | 1615 | $wpdb->query( |
1616 | 1616 | $wpdb->prepare( |
1617 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1617 | + "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1618 | 1618 | array('1', '1', 'admin') |
1619 | 1619 | ) |
1620 | 1620 | ); |
@@ -1622,9 +1622,9 @@ discard block |
||
1622 | 1622 | |
1623 | 1623 | /* --- terms meta value set --- */ |
1624 | 1624 | |
1625 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1625 | + update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png'); |
|
1626 | 1626 | |
1627 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1627 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1628 | 1628 | |
1629 | 1629 | if (!empty($options_data)) { |
1630 | 1630 | |
@@ -1632,7 +1632,7 @@ discard block |
||
1632 | 1632 | |
1633 | 1633 | $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
1634 | 1634 | |
1635 | - $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))); |
|
1635 | + $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))); |
|
1636 | 1636 | |
1637 | 1637 | if (!empty($taxonomies_data)) { |
1638 | 1638 | |
@@ -1641,17 +1641,17 @@ discard block |
||
1641 | 1641 | $taxObject = get_taxonomy($taxobj->taxonomy); |
1642 | 1642 | $post_type = $taxObject->object_type[0]; |
1643 | 1643 | |
1644 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1644 | + $opt_value = 'tax_meta_'.$post_type.'_'.$option_val; |
|
1645 | 1645 | |
1646 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1646 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val))); |
|
1647 | 1647 | |
1648 | 1648 | if ($duplicate_data) { |
1649 | 1649 | |
1650 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1650 | + $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1651 | 1651 | |
1652 | 1652 | } else { |
1653 | 1653 | |
1654 | - $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))); |
|
1654 | + $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))); |
|
1655 | 1655 | |
1656 | 1656 | } |
1657 | 1657 | |
@@ -1685,14 +1685,14 @@ discard block |
||
1685 | 1685 | |
1686 | 1686 | global $wpdb, $table_prefix; |
1687 | 1687 | |
1688 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1688 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug))); |
|
1689 | 1689 | |
1690 | 1690 | if ($slug_exists) { |
1691 | 1691 | |
1692 | 1692 | $suffix = 1; |
1693 | 1693 | do { |
1694 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1695 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1694 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1695 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name))); |
|
1696 | 1696 | $suffix++; |
1697 | 1697 | } while ($location_slug_check && $suffix < 100); |
1698 | 1698 | |
@@ -1746,7 +1746,7 @@ discard block |
||
1746 | 1746 | |
1747 | 1747 | $suffix = 1; |
1748 | 1748 | do { |
1749 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1749 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1750 | 1750 | |
1751 | 1751 | /** This action is documented in geodirectory_hooks_actions.php */ |
1752 | 1752 | $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
@@ -1758,7 +1758,7 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
1760 | 1760 | |
1761 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1761 | + $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1762 | 1762 | |
1763 | 1763 | } |
1764 | 1764 | |
@@ -1767,18 +1767,18 @@ discard block |
||
1767 | 1767 | $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
1768 | 1768 | |
1769 | 1769 | $post_types = geodir_get_posttypes(); |
1770 | - if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) { |
|
1771 | - $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1770 | + if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) { |
|
1771 | + $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1772 | 1772 | |
1773 | 1773 | if (!empty($posts_obj)) { |
1774 | 1774 | foreach ($posts_obj as $post_obj) { |
1775 | 1775 | $post_id = $post_obj->object_id; |
1776 | 1776 | |
1777 | - $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names')); |
|
1777 | + $raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names')); |
|
1778 | 1778 | $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : ''; |
1779 | 1779 | |
1780 | - $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
1781 | - $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1780 | + $listing_table = $plugin_prefix.$post_type.'_detail'; |
|
1781 | + $wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1782 | 1782 | } |
1783 | 1783 | } |
1784 | 1784 | } |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
1813 | 1813 | return $slug_exists = true; |
1814 | 1814 | |
1815 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1815 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1816 | 1816 | return $slug_exists = true; |
1817 | 1817 | |
1818 | 1818 | return $slug_exists; |
@@ -1853,43 +1853,43 @@ discard block |
||
1853 | 1853 | |
1854 | 1854 | |
1855 | 1855 | $gd_page = ''; |
1856 | - if(geodir_is_page('home')){ |
|
1856 | + if (geodir_is_page('home')) { |
|
1857 | 1857 | $gd_page = 'home'; |
1858 | 1858 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
1859 | 1859 | } |
1860 | - elseif(geodir_is_page('detail')){ |
|
1860 | + elseif (geodir_is_page('detail')) { |
|
1861 | 1861 | $gd_page = 'detail'; |
1862 | 1862 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
1863 | 1863 | } |
1864 | - elseif(geodir_is_page('pt')){ |
|
1864 | + elseif (geodir_is_page('pt')) { |
|
1865 | 1865 | $gd_page = 'pt'; |
1866 | 1866 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
1867 | 1867 | } |
1868 | - elseif(geodir_is_page('listing')){ |
|
1868 | + elseif (geodir_is_page('listing')) { |
|
1869 | 1869 | $gd_page = 'listing'; |
1870 | 1870 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
1871 | 1871 | } |
1872 | - elseif(geodir_is_page('location')){ |
|
1872 | + elseif (geodir_is_page('location')) { |
|
1873 | 1873 | $gd_page = 'location'; |
1874 | 1874 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
1875 | 1875 | } |
1876 | - elseif(geodir_is_page('search')){ |
|
1876 | + elseif (geodir_is_page('search')) { |
|
1877 | 1877 | $gd_page = 'search'; |
1878 | 1878 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
1879 | 1879 | } |
1880 | - elseif(geodir_is_page('add-listing')){ |
|
1880 | + elseif (geodir_is_page('add-listing')) { |
|
1881 | 1881 | $gd_page = 'add-listing'; |
1882 | 1882 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
1883 | 1883 | } |
1884 | - elseif(geodir_is_page('author')){ |
|
1884 | + elseif (geodir_is_page('author')) { |
|
1885 | 1885 | $gd_page = 'author'; |
1886 | 1886 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
1887 | 1887 | } |
1888 | - elseif(geodir_is_page('login')){ |
|
1888 | + elseif (geodir_is_page('login')) { |
|
1889 | 1889 | $gd_page = 'login'; |
1890 | 1890 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
1891 | 1891 | } |
1892 | - elseif(geodir_is_page('listing-success')){ |
|
1892 | + elseif (geodir_is_page('listing-success')) { |
|
1893 | 1893 | $gd_page = 'listing-success'; |
1894 | 1894 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
1895 | 1895 | } |
@@ -1921,12 +1921,12 @@ discard block |
||
1921 | 1921 | |
1922 | 1922 | if (!get_option('geodir_set_post_attachments')) { |
1923 | 1923 | |
1924 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1925 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1924 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
1925 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
1926 | 1926 | |
1927 | 1927 | $all_postypes = geodir_get_posttypes(); |
1928 | 1928 | |
1929 | - foreach($all_postypes as $post_type){ |
|
1929 | + foreach ($all_postypes as $post_type) { |
|
1930 | 1930 | $args = array( |
1931 | 1931 | 'posts_per_page' => -1, |
1932 | 1932 | 'post_type' => $post_type, |
@@ -2020,7 +2020,7 @@ discard block |
||
2020 | 2020 | { |
2021 | 2021 | $user_id = get_current_user_id(); |
2022 | 2022 | |
2023 | - if(!$user_id){return $post;} |
|
2023 | + if (!$user_id) {return $post; } |
|
2024 | 2024 | |
2025 | 2025 | $gd_post_types = geodir_get_posttypes(); |
2026 | 2026 | |
@@ -2129,7 +2129,7 @@ discard block |
||
2129 | 2129 | |
2130 | 2130 | if (array_key_exists('post_video', $tabs_arr)) { |
2131 | 2131 | |
2132 | - $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))); |
|
2132 | + $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))); |
|
2133 | 2133 | |
2134 | 2134 | if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
2135 | 2135 | $tabs_arr['post_video']['heading_text'] = $field_title; |
@@ -2137,7 +2137,7 @@ discard block |
||
2137 | 2137 | |
2138 | 2138 | if (array_key_exists('special_offers', $tabs_arr)) { |
2139 | 2139 | |
2140 | - $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))); |
|
2140 | + $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))); |
|
2141 | 2141 | |
2142 | 2142 | if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
2143 | 2143 | $tabs_arr['special_offers']['heading_text'] = $field_title; |
@@ -2158,7 +2158,7 @@ discard block |
||
2158 | 2158 | */ |
2159 | 2159 | function geodir_remove_template_redirect_actions() |
2160 | 2160 | { |
2161 | - if (geodir_is_page('login')){ |
|
2161 | + if (geodir_is_page('login')) { |
|
2162 | 2162 | remove_all_actions('template_redirect'); |
2163 | 2163 | remove_action('init', 'avia_modify_front', 10); |
2164 | 2164 | } |
@@ -2205,25 +2205,25 @@ discard block |
||
2205 | 2205 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
2206 | 2206 | |
2207 | 2207 | $wpdb->query( |
2208 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2208 | + $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ", |
|
2209 | 2209 | array($post_id, $split_img_file_path) |
2210 | 2210 | ) |
2211 | 2211 | ); |
2212 | 2212 | |
2213 | 2213 | $attachment_data = $wpdb->get_row( |
2214 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2214 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d", |
|
2215 | 2215 | array($post_id) |
2216 | 2216 | ) |
2217 | 2217 | ); |
2218 | 2218 | |
2219 | 2219 | if (!empty($attachment_data)) { |
2220 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2220 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2221 | 2221 | } |
2222 | 2222 | |
2223 | 2223 | |
2224 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2224 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
2225 | 2225 | |
2226 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2226 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id); |
|
2227 | 2227 | |
2228 | 2228 | geodir_set_wp_featured_image($post_id); |
2229 | 2229 | |
@@ -2251,9 +2251,9 @@ discard block |
||
2251 | 2251 | |
2252 | 2252 | foreach ($all_postypes as $posttype) { |
2253 | 2253 | |
2254 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2254 | + $tablename = $plugin_prefix.$posttype.'_detail'; |
|
2255 | 2255 | |
2256 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2256 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename); |
|
2257 | 2257 | |
2258 | 2258 | if (!empty($get_post_data)) { |
2259 | 2259 | |
@@ -2261,7 +2261,7 @@ discard block |
||
2261 | 2261 | |
2262 | 2262 | $post_id = $data->post_id; |
2263 | 2263 | |
2264 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2264 | + $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''"); |
|
2265 | 2265 | |
2266 | 2266 | if (!empty($attachment_data)) { |
2267 | 2267 | |
@@ -2278,22 +2278,22 @@ discard block |
||
2278 | 2278 | |
2279 | 2279 | $file_name = $file_info['basename']; |
2280 | 2280 | |
2281 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2281 | + $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name; |
|
2282 | 2282 | |
2283 | 2283 | if (!file_exists($img_arr['path'])) { |
2284 | 2284 | |
2285 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2285 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID); |
|
2286 | 2286 | |
2287 | 2287 | } |
2288 | 2288 | |
2289 | 2289 | } |
2290 | 2290 | |
2291 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2291 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id"); |
|
2292 | 2292 | |
2293 | 2293 | if (!empty($attachment_data)) { |
2294 | 2294 | |
2295 | 2295 | if ($attachment_data->ID) |
2296 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2296 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2297 | 2297 | |
2298 | 2298 | } else { |
2299 | 2299 | |
@@ -2307,7 +2307,7 @@ discard block |
||
2307 | 2307 | |
2308 | 2308 | } |
2309 | 2309 | |
2310 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2310 | + $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id); |
|
2311 | 2311 | |
2312 | 2312 | geodir_set_wp_featured_image($post_id); |
2313 | 2313 | |
@@ -2336,7 +2336,7 @@ discard block |
||
2336 | 2336 | { |
2337 | 2337 | |
2338 | 2338 | if (!get_option('geodir_default_rating_star_icon')) { |
2339 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2339 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png'); |
|
2340 | 2340 | } |
2341 | 2341 | |
2342 | 2342 | } |
@@ -2353,10 +2353,10 @@ discard block |
||
2353 | 2353 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
2354 | 2354 | * @return array User listing count for each post type. |
2355 | 2355 | */ |
2356 | -function geodir_user_post_listing_count($user_id=null) |
|
2356 | +function geodir_user_post_listing_count($user_id = null) |
|
2357 | 2357 | { |
2358 | 2358 | global $wpdb, $plugin_prefix, $current_user; |
2359 | - if(!$user_id){ |
|
2359 | + if (!$user_id) { |
|
2360 | 2360 | $user_id = $current_user->ID; |
2361 | 2361 | } |
2362 | 2362 | |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | $user_listing = array(); |
2368 | 2368 | if (is_array($all_posts) && !empty($all_posts)) { |
2369 | 2369 | foreach ($all_posts as $ptype) { |
2370 | - $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' )"); |
|
2370 | + $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' )"); |
|
2371 | 2371 | |
2372 | 2372 | if ($total_posts > 0) { |
2373 | 2373 | $user_listing[$ptype] = $total_posts; |
@@ -2408,19 +2408,19 @@ discard block |
||
2408 | 2408 | |
2409 | 2409 | $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
2410 | 2410 | //remove video and special offers if it is already set to show |
2411 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2411 | + if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) { |
|
2412 | 2412 | $unset_video = true; |
2413 | 2413 | } |
2414 | 2414 | |
2415 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2415 | + if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) { |
|
2416 | 2416 | $unset_special_offers = true; |
2417 | 2417 | } |
2418 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2419 | - foreach($custom_fields as $key => $custom_field){ |
|
2420 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2418 | + if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) { |
|
2419 | + foreach ($custom_fields as $key => $custom_field) { |
|
2420 | + if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) { |
|
2421 | 2421 | unset($custom_fields[$key]); |
2422 | 2422 | } |
2423 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2423 | + if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) { |
|
2424 | 2424 | unset($custom_fields[$key]); |
2425 | 2425 | } |
2426 | 2426 | } |
@@ -2437,7 +2437,7 @@ discard block |
||
2437 | 2437 | $post->{$field_name} = $_REQUEST[$field_name]; |
2438 | 2438 | } |
2439 | 2439 | |
2440 | - 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'))) { |
|
2440 | + 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'))) { |
|
2441 | 2441 | if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
2442 | 2442 | continue; |
2443 | 2443 | } |
@@ -2470,7 +2470,7 @@ discard block |
||
2470 | 2470 | $post->{$field_name} = $_REQUEST[$field_name]; |
2471 | 2471 | } |
2472 | 2472 | |
2473 | - 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'))) { |
|
2473 | + 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'))) { |
|
2474 | 2474 | $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
2475 | 2475 | $site_title = trim($field['site_title']); |
2476 | 2476 | $type = $field; |
@@ -2486,21 +2486,21 @@ discard block |
||
2486 | 2486 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
2487 | 2487 | $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : ''; |
2488 | 2488 | |
2489 | - }else{ |
|
2489 | + } else { |
|
2490 | 2490 | $i = 0; |
2491 | 2491 | $fieldset_count++; |
2492 | 2492 | $field_set_start = 1; |
2493 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2493 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count; |
|
2494 | 2494 | $fieldset_arr[$fieldset_count]['label'] = $label; |
2495 | 2495 | } |
2496 | 2496 | |
2497 | 2497 | |
2498 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2498 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; } |
|
2499 | 2499 | $type = stripslashes_deep($type); // strip slashes |
2500 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2500 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; } |
|
2501 | 2501 | $html = ''; |
2502 | 2502 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
2503 | - if($html_var=='post'){$html_var='post_address';} |
|
2503 | + if ($html_var == 'post') {$html_var = 'post_address'; } |
|
2504 | 2504 | $field_icon = geodir_field_icon_proccess($type); |
2505 | 2505 | $filed_type = $type['type']; |
2506 | 2506 | |
@@ -2513,7 +2513,7 @@ discard block |
||
2513 | 2513 | * @param string $fields_location The location the field is to be show. |
2514 | 2514 | * @param array $type The array of field values. |
2515 | 2515 | */ |
2516 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2516 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type); |
|
2517 | 2517 | |
2518 | 2518 | |
2519 | 2519 | /** |
@@ -2559,7 +2559,7 @@ discard block |
||
2559 | 2559 | * @param string $htmlvar_name The field HTML var name. |
2560 | 2560 | */ |
2561 | 2561 | 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
2562 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2562 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>' |
|
2563 | 2563 | ); |
2564 | 2564 | } |
2565 | 2565 | } else { |
@@ -2621,7 +2621,7 @@ discard block |
||
2621 | 2621 | } |
2622 | 2622 | $status .= ")</strong>"; |
2623 | 2623 | |
2624 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2624 | + $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>'; |
|
2625 | 2625 | } |
2626 | 2626 | } |
2627 | 2627 | |
@@ -2690,7 +2690,7 @@ discard block |
||
2690 | 2690 | * @return array Modified class array. |
2691 | 2691 | */ |
2692 | 2692 | function geodir_body_class_active_map($classes = array()) { |
2693 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2693 | + $classes[] = 'gd-map-'.geodir_map_name(); |
|
2694 | 2694 | |
2695 | 2695 | return $classes; |
2696 | 2696 | } |
@@ -2705,7 +2705,7 @@ discard block |
||
2705 | 2705 | * @return string Modified class string. |
2706 | 2706 | */ |
2707 | 2707 | function geodir_admin_body_class_active_map($class = '') { |
2708 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2708 | + $class .= ' gd-map-'.geodir_map_name(); |
|
2709 | 2709 | |
2710 | 2710 | return $class; |
2711 | 2711 | } |
@@ -2725,7 +2725,7 @@ discard block |
||
2725 | 2725 | * @return array Translation texts. |
2726 | 2726 | */ |
2727 | 2727 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2728 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2728 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array(); |
|
2729 | 2729 | |
2730 | 2730 | $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'); |
2731 | 2731 | |
@@ -2791,17 +2791,17 @@ discard block |
||
2791 | 2791 | * @param array $args The array of menu arguments. |
2792 | 2792 | * @return array The modified arguments. |
2793 | 2793 | */ |
2794 | -function geodir_add_nav_menu_class( $args ) |
|
2794 | +function geodir_add_nav_menu_class($args) |
|
2795 | 2795 | { |
2796 | 2796 | |
2797 | - if(isset($args['menu_class'])){ |
|
2797 | + if (isset($args['menu_class'])) { |
|
2798 | 2798 | $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
2799 | 2799 | } |
2800 | 2800 | |
2801 | 2801 | return $args; |
2802 | 2802 | } |
2803 | 2803 | |
2804 | -add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
|
2804 | +add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class'); |
|
2805 | 2805 | |
2806 | 2806 | /** |
2807 | 2807 | * Filters WordPress locale ID. |
@@ -2841,9 +2841,9 @@ discard block |
||
2841 | 2841 | } |
2842 | 2842 | |
2843 | 2843 | add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2); |
2844 | - add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
2844 | + add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1); |
|
2845 | 2845 | if (is_admin()) { |
2846 | - add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
2846 | + add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1); |
|
2847 | 2847 | } |
2848 | 2848 | } |
2849 | 2849 | } |
@@ -2872,7 +2872,7 @@ discard block |
||
2872 | 2872 | } |
2873 | 2873 | |
2874 | 2874 | if (!empty($keep_vars)) { |
2875 | - foreach ( $languages as $code => $url) { |
|
2875 | + foreach ($languages as $code => $url) { |
|
2876 | 2876 | $filter_url = $url['url']; |
2877 | 2877 | |
2878 | 2878 | foreach ($keep_vars as $var) { |
@@ -2891,7 +2891,7 @@ discard block |
||
2891 | 2891 | |
2892 | 2892 | return $languages; |
2893 | 2893 | } |
2894 | -add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 ); |
|
2894 | +add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1); |
|
2895 | 2895 | |
2896 | 2896 | /** |
2897 | 2897 | * Remove Yoast SEO hook if disabled on GD pages. |
@@ -2899,18 +2899,18 @@ discard block |
||
2899 | 2899 | * @since 1.6.18 |
2900 | 2900 | * |
2901 | 2901 | */ |
2902 | -function geodir_remove_yoast_seo_metas(){ |
|
2903 | - if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) { |
|
2902 | +function geodir_remove_yoast_seo_metas() { |
|
2903 | + if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) { |
|
2904 | 2904 | $wpseo = WPSEO_Frontend::get_instance(); |
2905 | 2905 | |
2906 | - remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
2907 | - remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
2908 | - remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
2909 | - remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
2910 | - remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
2911 | - remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
2906 | + remove_action('wp_head', array($wpseo, 'metadesc'), 6); |
|
2907 | + remove_action('wp_head', array($wpseo, 'metakeywords'), 11); |
|
2908 | + remove_filter('pre_get_document_title', array($wpseo, 'title'), 15); |
|
2909 | + remove_filter('wp_title', array($wpseo, 'title'), 15, 3); |
|
2910 | + remove_filter('thematic_doctitle', array($wpseo, 'title'), 15); |
|
2911 | + remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99); |
|
2912 | 2912 | |
2913 | - remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
2913 | + remove_action('template_redirect', 'wpseo_frontend_head_init', 999); |
|
2914 | 2914 | } |
2915 | 2915 | } |
2916 | 2916 | |
@@ -2925,22 +2925,22 @@ discard block |
||
2925 | 2925 | * |
2926 | 2926 | */ |
2927 | 2927 | function geodir_wpml_ajax_set_guest_lang() { |
2928 | - if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) { |
|
2929 | - if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) { |
|
2928 | + if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) { |
|
2929 | + if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) { |
|
2930 | 2930 | global $sitepress; |
2931 | 2931 | |
2932 | 2932 | $referer = wp_get_referer(); |
2933 | 2933 | |
2934 | 2934 | $current_lang = $sitepress->get_current_language(); |
2935 | - $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
2935 | + $referrer_lang = $sitepress->get_language_from_url($referer); |
|
2936 | 2936 | |
2937 | - if ( $referrer_lang && $current_lang != $referrer_lang ) { |
|
2937 | + if ($referrer_lang && $current_lang != $referrer_lang) { |
|
2938 | 2938 | $_GET['lang'] = $referrer_lang; |
2939 | 2939 | } |
2940 | 2940 | } |
2941 | 2941 | } |
2942 | 2942 | } |
2943 | -add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 ); |
|
2943 | +add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1); |
|
2944 | 2944 | |
2945 | 2945 | /** |
2946 | 2946 | * Change country slug czech-republic to czechia and redirect. |
@@ -2961,18 +2961,18 @@ discard block |
||
2961 | 2961 | } |
2962 | 2962 | |
2963 | 2963 | $redirect = false; |
2964 | - if (strpos($current_url, '/' . $search . '/') !== false) { |
|
2964 | + if (strpos($current_url, '/'.$search.'/') !== false) { |
|
2965 | 2965 | $redirect = true; |
2966 | - $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1); |
|
2966 | + $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1); |
|
2967 | 2967 | } |
2968 | 2968 | |
2969 | 2969 | if ($has_slash != "/") { |
2970 | 2970 | $current_url = trim($current_url, '/'); |
2971 | 2971 | } |
2972 | 2972 | |
2973 | - if (strpos($current_url, 'gd_country=' . $search) !== false) { |
|
2973 | + if (strpos($current_url, 'gd_country='.$search) !== false) { |
|
2974 | 2974 | $redirect = true; |
2975 | - $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url); |
|
2975 | + $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url); |
|
2976 | 2976 | } |
2977 | 2977 | |
2978 | 2978 | if ($redirect) { |
@@ -2998,10 +2998,10 @@ discard block |
||
2998 | 2998 | * @param int $post_parent Post parent ID |
2999 | 2999 | * @param string $original_slug The original post slug. |
3000 | 3000 | */ |
3001 | -function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { |
|
3001 | +function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) { |
|
3002 | 3002 | global $wpdb, $sitepress; |
3003 | 3003 | |
3004 | - if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) { |
|
3004 | + if ($post_type && strpos($post_type, 'gd_') === 0) { |
|
3005 | 3005 | $wpml_post_join = ""; |
3006 | 3006 | $wpml_post_where = ""; |
3007 | 3007 | $wpml_term_join = ""; |
@@ -3015,28 +3015,28 @@ discard block |
||
3015 | 3015 | } |
3016 | 3016 | |
3017 | 3017 | $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)"; |
3018 | - $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3018 | + $wpml_post_where = " AND icl_t.language_code = '".$post_language."'"; |
|
3019 | 3019 | |
3020 | 3020 | $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)"; |
3021 | - $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3021 | + $wpml_term_where = " AND icl_t.language_code = '".$post_language."'"; |
|
3022 | 3022 | } |
3023 | 3023 | |
3024 | - $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 ) ); |
|
3024 | + $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)); |
|
3025 | 3025 | |
3026 | - if ( $term_slug_check ) { |
|
3026 | + if ($term_slug_check) { |
|
3027 | 3027 | $suffix = 1; |
3028 | 3028 | |
3029 | 3029 | do { |
3030 | - $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
3030 | + $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
3031 | 3031 | |
3032 | - $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 ) ); |
|
3032 | + $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)); |
|
3033 | 3033 | |
3034 | - $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 ) ); |
|
3034 | + $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)); |
|
3035 | 3035 | |
3036 | 3036 | $term_slug_check = $term_check || $post_check; |
3037 | 3037 | |
3038 | 3038 | $suffix++; |
3039 | - } while ( $term_slug_check ); |
|
3039 | + } while ($term_slug_check); |
|
3040 | 3040 | |
3041 | 3041 | $slug = $alt_slug; |
3042 | 3042 | } |
@@ -3044,7 +3044,7 @@ discard block |
||
3044 | 3044 | |
3045 | 3045 | return $slug; |
3046 | 3046 | } |
3047 | -add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 ); |
|
3047 | +add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6); |
|
3048 | 3048 | |
3049 | 3049 | /** |
3050 | 3050 | * Check whether a post name with slug exists or not. |
@@ -3061,48 +3061,48 @@ discard block |
||
3061 | 3061 | * @param int $term_id The term ID. |
3062 | 3062 | * @return bool true when exists. false when not exists. |
3063 | 3063 | */ |
3064 | -function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) { |
|
3064 | +function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) { |
|
3065 | 3065 | global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
3066 | 3066 | |
3067 | - if ( $slug_exists ) { |
|
3067 | + if ($slug_exists) { |
|
3068 | 3068 | return $slug_exists; |
3069 | 3069 | } |
3070 | 3070 | |
3071 | - if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) { |
|
3071 | + if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) { |
|
3072 | 3072 | $taxonomy = $gd_term_taxonomy[$term_id]; |
3073 | 3073 | } else { |
3074 | - $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
3074 | + $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id)); |
|
3075 | 3075 | $gd_term_taxonomy[$term_id] = $taxonomy; |
3076 | 3076 | } |
3077 | 3077 | |
3078 | - if ( empty($taxonomy) ) { |
|
3078 | + if (empty($taxonomy)) { |
|
3079 | 3079 | return $slug_exists; |
3080 | 3080 | } |
3081 | 3081 | |
3082 | - if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) { |
|
3082 | + if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) { |
|
3083 | 3083 | $post_type = $gd_term_post_type[$term_id]; |
3084 | 3084 | } else { |
3085 | - $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
3086 | - $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
3085 | + $taxonomy_obj = get_taxonomy($taxonomy); |
|
3086 | + $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL; |
|
3087 | 3087 | } |
3088 | 3088 | |
3089 | 3089 | $wpml_post_join = ""; |
3090 | 3090 | $wpml_post_where = ""; |
3091 | 3091 | |
3092 | 3092 | if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) { |
3093 | - $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
3093 | + $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language(); |
|
3094 | 3094 | if (!$term_language) { |
3095 | 3095 | $term_language = $sitepress->get_current_language(); |
3096 | 3096 | } |
3097 | 3097 | |
3098 | 3098 | $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)"; |
3099 | - $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
3099 | + $wpml_post_where = " AND icl_t.language_code = '".$term_language."'"; |
|
3100 | 3100 | } |
3101 | 3101 | |
3102 | - 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 ) ) ) { |
|
3102 | + 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))) { |
|
3103 | 3103 | $slug_exists = true; |
3104 | 3104 | } |
3105 | 3105 | |
3106 | 3106 | return $slug_exists; |
3107 | 3107 | } |
3108 | -add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 ); |
|
3109 | 3108 | \ No newline at end of file |
3109 | +add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3); |
|
3110 | 3110 | \ No newline at end of file |