PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / 4.1.1
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets v4.1.1
4.1.1 3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / actions / wp_ajax_auto_detect_sf.php
wp-all-import / actions Last commit date
add_attachment.php 1 month ago admin_head.php 1 month ago admin_init.php 1 month ago admin_menu.php 1 month ago admin_notices.php 1 month ago attachment_updated.php 1 month ago delete_post.php 1 month ago pmxi_after_xml_import.php 1 month ago pmxi_before_xml_import.php 1 month ago pmxi_extend_options_custom_fields.php 1 month ago wp_ajax_auto_detect_cf.php 1 month ago wp_ajax_auto_detect_sf.php 1 month ago wp_ajax_delete_import.php 1 month ago wp_ajax_dismiss_notifications.php 1 month ago wp_ajax_import_failed.php 1 month ago wp_ajax_test_images.php 1 month ago wp_ajax_wpai_dismiss_review_modal.php 1 month ago wp_ajax_wpai_send_feedback.php 1 month ago wpmu_new_blog.php 1 month ago
wp_ajax_auto_detect_sf.php
62 lines
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3 function pmxi_wp_ajax_auto_detect_sf(){
4
5 if ( ! check_ajax_referer( 'wp_all_import_secure', 'security', false )){
6 exit( json_encode(array('result' => array(), 'msg' => __('Security check', 'wp-all-import'))) );
7 }
8
9 if ( ! current_user_can( PMXI_Plugin::$capabilities ) ){
10 exit( json_encode(array('result' => array(), 'msg' => __('Security check', 'wp-all-import'))) );
11 }
12
13 $input = new PMXI_Input();
14 $fieldName = $input->post('name', '');
15 $post_type = $input->post('post_type', 'post');
16 global $wpdb;
17
18 $result = array();
19
20 if ($fieldName) {
21
22 switch ($post_type){
23 case 'import_users':
24 case 'shop_customer':
25 // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
26 $values = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT usermeta.meta_value FROM {$wpdb->usermeta} as usermeta WHERE usermeta.meta_key = %s", $fieldName), ARRAY_A);
27 // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
28 break;
29 case 'taxonomies':
30 // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
31 $values = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT termmeta.meta_value FROM {$wpdb->termmeta} as termmeta WHERE termmeta.meta_key = %s", $fieldName), ARRAY_A);
32 // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
33 break;
34 default:
35 // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
36 $values = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT postmeta.meta_value FROM {$wpdb->postmeta} as postmeta WHERE postmeta.meta_key = %s", $fieldName), ARRAY_A);
37 // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
38 break;
39 }
40
41 if ( ! empty($values) ){
42 foreach ($values as $key => $value) {
43 if ( ! empty($value['meta_value']) and is_serialized($value['meta_value'])){
44 $v = \pmxi_maybe_unserialize($value['meta_value']);
45 if ( ! empty($v) and is_array($v) ){
46 foreach ($v as $skey => $svalue) {
47 $result[] = array(
48 'key' => $skey,
49 'val' => maybe_serialize($svalue),
50 );
51 }
52 break;
53 }
54 }
55 }
56 }
57
58 }
59
60 exit( json_encode(array('result' => $result)) );
61
62 }