public function init_available_data() { global $wpdb; $table_prefix = $wpdb->prefix; // Prepare existing taxonomies if ('specific' == $this->post['export_type'] and !self::$is_user_export and !self::$is_comment_export) { $this->_existing_taxonomies = wp_all_export_get_existing_taxonomies_by_cpt(self::$post_types[0]); $this->_existing_meta_keys = wp_all_export_get_existing_meta_by_cpt(self::$post_types[0]); } if ('advanced' == $this->post['export_type'] and !self::$is_user_export and !self::$is_comment_export) { $meta_keys = $wpdb->get_results("SELECT DISTINCT meta_key FROM {$table_prefix}postmeta WHERE {$table_prefix}postmeta.meta_key NOT LIKE '_edit%' LIMIT 500"); if (!empty($meta_keys)) { $exclude_keys = array('_first_variation_attributes', '_is_first_variation_created'); foreach ($meta_keys as $meta_key) { if (strpos($meta_key->meta_key, "_tmp") === false && strpos($meta_key->meta_key, "_v_") === false && !in_array($meta_key->meta_key, $exclude_keys)) { $this->_existing_meta_keys[] = $meta_key->meta_key; } } } global $wp_taxonomies; foreach ($wp_taxonomies as $key => $obj) { if (in_array($obj->name, array('nav_menu'))) { continue; } if (strpos($obj->name, "pa_") !== 0 and strlen($obj->name) > 3) { $this->_existing_taxonomies[] = array('name' => empty($obj->label) ? $obj->name : $obj->label, 'label' => $obj->name, 'type' => 'cats'); } } } // Prepare existing ACF groups & fields self::$acf_export->init($this->_existing_meta_keys); // Prepare existing WooCommerce data self::$woo_export->init($this->_existing_meta_keys); // Prepare existing WooCommerce Order data self::$woo_order_export->init($this->_existing_meta_keys); // Prepare existing WooCommerce Coupon data self::$woo_coupon_export->init($this->_existing_meta_keys); // Prepare existing Users data self::$user_export->init($this->_existing_meta_keys); // Prepare existing Comments data self::$comment_export->init($this->_existing_meta_keys); return $this->get_available_data(); }
public function get_all_fields_for_order_items() { $meta_keys = wp_all_export_get_existing_meta_by_cpt('product'); $this->filter_meta_keys($meta_keys); $default_data = $this->get_default_fields_for_order_items(); $product_data = $this->get_fields_for_product_data_section(); $taxes_data = array(); foreach ($product_data as $field) { if (!in_array($field['label'], array('_sku', 'attributes'))) { $default_data[] = $field; } } $existing_taxonomies = wp_all_export_get_existing_taxonomies_by_cpt('product'); foreach ($existing_taxonomies as $taxonomy) { $tx = get_taxonomy($taxonomy['label']); if ($taxonomy['label'] == 'product_shipping_class') { $product_data[] = array('name' => 'Shipping Class', 'label' => $taxonomy['name'], 'type' => 'cats', 'auto' => true); } else { $taxes_data[] = array('name' => $taxonomy['label'] == 'product_type' ? 'Product Type' : $tx->label, 'label' => $taxonomy['label'], 'type' => 'cats', 'auto' => true); } } return array('product_data' => array('title' => __('Product Data', 'wp_all_export_plugin'), 'meta' => $default_data), 'taxonomies' => array('title' => __('Taxonomies', 'wp_all_export_plugin'), 'meta' => $taxes_data), 'cf' => array('title' => __('Custom Fields', 'wp_all_export_plugin'), 'meta' => $meta_keys), 'attributes' => array('title' => __('Attributes', 'wp_all_export_plugin'), 'meta' => $this->get_fields_for_product_attributes_section()), 'advanced' => array('title' => __('Advanced', 'wp_all_export_plugin'), 'meta' => $this->get_fields_for_product_advanced_section())); }