| @@ -32,10 +32,13 @@ | ||
| 32 | 32 | if(isset($_POST['listing_post_id'])) |
| 33 | 33 | $listing_post_id = sanitize_text_field($_POST['listing_post_id']); |
| 34 | 34 | |
| 35 | 35 | $listing = $this->load->listing_m->get($listing_post_id, TRUE); |
| 36 | + | |
| 37 | + if (!$listing || $listing->post_status != 'publish' || !empty($listing->post_password)) { | |
| 38 | + return false; | |
| 39 | + } | |
| 36 | 40 | |
| 37 | - | |
| 38 | 41 | /* protect check */ |
| 39 | 42 | if ( |
| 40 | 43 | !wdk_field_value('is_activated', $listing, false) || !wdk_field_value('is_approved', $listing,false) |
| 41 | 44 | ) { |
| @@ -71,9 +74,21 @@ | ||
| 71 | 74 | $listing_post_id = sanitize_text_field($_POST['listing_post_id']); |
| 72 | 75 | |
| 73 | 76 | $listing = $this->load->listing_m->get($listing_post_id, TRUE); |
| 74 | 77 | |
| 78 | + | |
| 79 | + if (!$listing || $listing->post_status != 'publish' || !empty($listing->post_password)) { | |
| 80 | + return false; | |
| 81 | + } | |
| 75 | 82 | |
| 83 | + /* protect check */ | |
| 84 | + if ( | |
| 85 | + !wdk_field_value('is_activated', $listing, false) || !wdk_field_value('is_approved', $listing,false) | |
| 86 | + ) { | |
| 87 | + $data['popup_content'] = __( 'Listing is not public', 'wpdirectorykit' ); | |
| 88 | + $this->output($data); | |
| 89 | + } | |
| 90 | + | |
| 76 | 91 | if(!empty($listing)) { |
| 77 | 92 | $data['popup_content'] = wdk_listing_card($listing, [], false, '<div class="infobox map-box">%1$s<div>', 'result_item_card_dash_edit'); |
| 78 | 93 | } else { |
| 79 | 94 | $data['popup_content'] = __( 'Listing is missing', 'wpdirectorykit' ); |
| @@ -312,8 +327,10 @@ | ||
| 312 | 327 | $results[$ind_order]['value'] = $row; |
| 313 | 328 | } |
| 314 | 329 | } else { |
| 315 | 330 | $results[$ind_order]['value'] = $level_gen |
| 331 | + // Dynamic field values are registered in the translation catalog separately. | |
| 332 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 316 | 333 | .esc_html__(wmvc_show_data($attr_val, $row), 'wpdirectorykit'); |
| 317 | 334 | } |
| 318 | 335 | $ind_order++; |
| 319 | 336 | } |
| @@ -343,8 +360,10 @@ | ||
| 343 | 360 | .wmvc_show_data('display_name', $row); |
| 344 | 361 | |
| 345 | 362 | } else { |
| 346 | 363 | $data['curr_val'] = $level_gen |
| 364 | + // Dynamic field values are registered in the translation catalog separately. | |
| 365 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 347 | 366 | .esc_html__(wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row), 'wpdirectorykit'); |
| 348 | 367 | } |
| 349 | 368 | |
| 350 | 369 | |
| @@ -514,8 +533,10 @@ | ||
| 514 | 533 | $level_gen = str_pad('', $row->level*12, ' ').''; |
| 515 | 534 | |
| 516 | 535 | $results[$ind_order]['key'] = wmvc_show_data($attr_id, $row); |
| 517 | 536 | $results[$ind_order]['value'] = $level_gen |
| 537 | + // Dynamic field values are registered in the translation catalog separately. | |
| 538 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 518 | 539 | .esc_html__(wmvc_show_data($attr_val, $row), 'wpdirectorykit'); |
| 519 | 540 | $ind_order++; |
| 520 | 541 | } |
| 521 | 542 | |
| @@ -528,10 +549,11 @@ | ||
| 528 | 549 | { |
| 529 | 550 | $level_gen=''; |
| 530 | 551 | if(isset($row->level)) |
| 531 | 552 | $level_gen = str_pad('', $row->level*12, ' ').''; |
| 532 | - | |
| 533 | - $data['curr_val'] = $level_gen | |
| 553 | + $data['curr_val'] = $level_gen | |
| 554 | + // Dynamic field values are registered in the translation catalog separately. | |
| 555 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 534 | 556 | .esc_html__(wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row), 'wpdirectorykit'); |
| 535 | 557 | |
| 536 | 558 | } |
| 537 | 559 | else |
| @@ -675,9 +697,8 @@ | ||
| 675 | 697 | } |
| 676 | 698 | |
| 677 | 699 | $db_results_total = $this->$model_name->total($where); |
| 678 | 700 | $db_results = $this->$model_name->get_pagination($limit,$offset, $where); |
| 679 | - $data['output'] = $db_results; | |
| 680 | 701 | |
| 681 | 702 | if (!$db_results) { |
| 682 | 703 | $data['errors'] = ''; |
| 683 | 704 | } else { |
| @@ -688,8 +709,10 @@ | ||
| 688 | 709 | $level_gen = str_pad('', $row->level*12, ' ').''; |
| 689 | 710 | |
| 690 | 711 | $results[] = [ |
| 691 | 712 | 'id'=> wmvc_show_data($key_column, $row), |
| 713 | + // Dynamic field values are registered in the translation catalog separately. | |
| 714 | +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 692 | 715 | 'text'=> $level_gen.esc_html__(trim(wmvc_show_data($print_column, $row)), 'wpdirectorykit'), |
| 693 | 716 | ]; |
| 694 | 717 | } |
| 695 | 718 | |
| @@ -739,9 +762,13 @@ | ||
| 739 | 762 | $offset = (intval($parameters['page_result']) - 1) * $limit; |
| 740 | 763 | } |
| 741 | 764 | |
| 742 | 765 | $this->load->model($model_name); |
| 743 | - $search_column = 'display_name,user_email,user_login,ID'; | |
| 766 | + $search_column = 'display_name,user_login,ID'; | |
| 767 | + if(current_user_can('administrator')) { | |
| 768 | + $search_column = 'display_name,user_email,user_login,ID'; | |
| 769 | + } | |
| 770 | + | |
| 744 | 771 | $where = array(); |
| 745 | 772 | if(!empty($_POST['q']['term']) && !empty($search_column)) { |
| 746 | 773 | $sql_search = ''; |
| 747 | 774 | foreach (explode(',', $search_column) as $column) { |
| @@ -910,8 +937,10 @@ | ||
| 910 | 937 | |
| 911 | 938 | foreach($db_results as $row) { |
| 912 | 939 | $results[] = [ |
| 913 | 940 | 'id'=> wmvc_show_data($key_column, $row), |
| 941 | + // Dynamic field values are registered in the translation catalog separately. | |
| 942 | +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 914 | 943 | 'text'=> esc_html__(trim(wmvc_show_data($print_column, $row)),'wpdirectorykit'), |
| 915 | 944 | ]; |
| 916 | 945 | } |
| 917 | 946 | |
| @@ -993,9 +1022,11 @@ | ||
| 993 | 1022 | 'field_key' => 'search_category', |
| 994 | 1023 | 'value' => $row->category_title, |
| 995 | 1024 | 'print' => [ |
| 996 | 1025 | 'parsed_content' => [ |
| 997 | - 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? wmvc_show_data('font_icon_code', $row) : 'fa fa-tag', | |
| 1026 | + 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? esc_attr(wmvc_show_data('font_icon_code', $row)): 'fa fa-tag', | |
| 1027 | + // Dynamic field values are registered in the translation catalog separately. | |
| 1028 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 998 | 1029 | 'title' => esc_html__($row->category_title, 'wpdirectorykit'), |
| 999 | 1030 | 'sub_title' => '', |
| 1000 | 1031 | 'right_text' => __('Category', 'wpdirectorykit') |
| 1001 | 1032 | ] |
| @@ -1046,10 +1077,14 @@ | ||
| 1046 | 1077 | 'field_key' => 'search_location', |
| 1047 | 1078 | 'value' => $row->location_title, |
| 1048 | 1079 | 'print' => [ |
| 1049 | 1080 | 'parsed_content' => [ |
| 1050 | - 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? wmvc_show_data('font_icon_code', $row) : 'fa fa-map-marker', | |
| 1081 | + 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? esc_attr(wmvc_show_data('font_icon_code', $row)) : 'fa fa-map-marker', | |
| 1082 | + // Dynamic field values are registered in the translation catalog separately. | |
| 1083 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 1051 | 1084 | 'title' => esc_html__($row->location_title, 'wpdirectorykit'), |
| 1085 | + // Dynamic field values are registered in the translation catalog separately. | |
| 1086 | + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText | |
| 1052 | 1087 | 'sub_title' => esc_html__($subtitle, 'wpdirectorykit'), |
| 1053 | 1088 | 'right_text' => __('Location', 'wpdirectorykit') |
| 1054 | 1089 | ] |
| 1055 | 1090 | ] |