| @@ -52,9 +52,9 @@ | ||
| 52 | 52 | $output = json_decode($response); |
| 53 | 53 | $count = 0; |
| 54 | 54 | foreach ($output as $key => $value) { |
| 55 | 55 | $data['rss'][] = array( |
| 56 | - 'date' => wdk_get_date(wmvc_show_data('date', $value, date('Y-m-d H:i:s'), TRUE, TRUE), false), | |
| 56 | + 'date' => wdk_get_date(wmvc_show_data('date', $value, gmdate('Y-m-d H:i:s'), TRUE, TRUE), false), | |
| 57 | 57 | 'title' => wmvc_show_data('title', $value, '', TRUE, TRUE), |
| 58 | 58 | 'link' => wmvc_show_data('link', $value, '', TRUE, TRUE), |
| 59 | 59 | ); |
| 60 | 60 | $count++; |
| @@ -267,9 +267,9 @@ | ||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $image_url = wp_get_attachment_image_url($image_id, 'large'); |
| 270 | 270 | if ($image_url) { |
| 271 | - $parsed = parse_url($image_url); | |
| 271 | + $parsed = wp_parse_url($image_url); | |
| 272 | 272 | $next_path = substr($parsed['path'], strpos($parsed['path'], 'uploads/') + 8); |
| 273 | 273 | |
| 274 | 274 | if (!empty($listing_data['listing_images_path_medium'])) |
| 275 | 275 | $listing_data['listing_images_path_medium'] .= ','; |
| @@ -633,12 +633,9 @@ | ||
| 633 | 633 | } |
| 634 | 634 | $table_listing_fields = $wpdb->prefix . 'wdk_listings_fields'; |
| 635 | 635 | if(!empty($existing_listing_fields)) foreach ($existing_listing_fields as $field_listing_col => $field_listing) { |
| 636 | 636 | if(substr($field_listing_col, 0, 6) == 'field_') { |
| 637 | - $sql = "ALTER TABLE `{$table_listing_fields}` | |
| 638 | - DROP `$field_listing_col`;"; | |
| 639 | - | |
| 640 | - $wpdb->query( $sql ); | |
| 637 | + $wpdb->query( $wpdb->prepare( "ALTER TABLE `{$table_listing_fields}` DROP `$field_listing_col`;" ) ); | |
| 641 | 638 | } |
| 642 | 639 | } |
| 643 | 640 | |
| 644 | 641 | |
| @@ -805,8 +802,51 @@ | ||
| 805 | 802 | $data['popup_text_error'] = __('Page not Created', 'wpdirectorykit'); |
| 806 | 803 | } else { |
| 807 | 804 | $data['page_id'] = $new_page->ID; |
| 808 | 805 | } |
| 806 | + | |
| 807 | + if (empty($data['popup_text_error'])) { | |
| 808 | + $data['success'] = true; | |
| 809 | + } | |
| 810 | + | |
| 811 | + $this->output($data); | |
| 812 | + } | |
| 813 | + | |
| 814 | + public function wdk_save_ai_search_fields() | |
| 815 | + { | |
| 816 | + $data = array(); | |
| 817 | + $data['message'] = ''; | |
| 818 | + $data['popup_text_success'] = ''; | |
| 819 | + $data['popup_text_error'] = ''; | |
| 820 | + $data['parameters'] = $_POST; | |
| 821 | + $data['success'] = false; | |
| 822 | + $data['page_id'] = false; | |
| 823 | + $data['page_title'] = false; | |
| 824 | + $data['results'] = array(); | |
| 825 | + | |
| 826 | + /* protect */ | |
| 827 | + if(!wmvc_user_in_role('administrator')) { | |
| 828 | + $data['message'] = __('Disabled for current user', 'wpdirectorykit'); | |
| 829 | + $this->output($data); | |
| 830 | + } | |
| 831 | + | |
| 832 | + // Check _wpnonce | |
| 833 | + check_admin_referer( 'wdk-backendajax', '_wpnonce' ); | |
| 834 | + | |
| 835 | + $fields = isset($_POST['fields']) | |
| 836 | + ? array_filter( | |
| 837 | + array_map('intval', (array) wp_unslash($_POST['fields'])), | |
| 838 | + function($val) { return is_int($val) && $val > 0; } | |
| 839 | + ) | |
| 840 | + : []; | |
| 841 | + | |
| 842 | + | |
| 843 | + update_option( | |
| 844 | + 'wdk_ai_search_fields', | |
| 845 | + $fields | |
| 846 | + ); | |
| 847 | + | |
| 848 | + $data['popup_text_success'] = __('AI Search fields updated successfully.', 'wpdirectorykit'); | |
| 809 | 849 | |
| 810 | 850 | if (empty($data['popup_text_error'])) { |
| 811 | 851 | $data['success'] = true; |
| 812 | 852 | } |