PluginProbe
Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export / 2.0
Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export v2.0
3.0 2.24.2 2.24.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 2.0 2.0.1 2.1 2.1.1 2.1.2 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.16.1 2.16.2 All 96 releases
wp-ultimate-exporter / exportExtensions / ExportHandler.php

ExportHandler.php in Export All Posts, Products, Orders & Users | WP Ultimate Exporter | WordPress CSV Export 2.0, at exportExtensions/ExportHandler.php

83 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * WP Ultimate Exporter plugin file.
4 *
5 * Copyright (C) 2010-2020, Smackcoders Inc - info@smackcoders.com
6 */
7
8 namespace Smackcoders\SMEXP;
9
10 if ( ! defined( 'ABSPATH' ) )
11 exit; // Exit if accessed directly
12
13 class ExportHandler extends ExportExtension{
14 protected static $instance = null,$export_extension;
15 public static function getInstance() {
16 if ( null == self::$instance ) {
17 self::$instance = new self;
18 self::$instance->doHooks();
19 ExportHandler::$export_extension = ExportExtension::getInstance();
20 }
21 return self::$instance;
22 }
23
24 public function doHooks(){
25 add_action('wp_ajax_get_post_types',array($this,'getPostTypes'));
26 add_action('wp_ajax_get_taxonomies',array($this,'getTaxonomies'));
27 add_action('wp_ajax_get_authors',array($this,'getAuthors'));
28 }
29
30 /**
31 * SmackUCIExporter constructor.
32 *
33 * Set values into global variables based on post value
34 */
35 public function __construct() {
36 $this->plugin = Plugin::getInstance();
37 }
38
39
40 public function getPostTypes(){
41 check_ajax_referer('smack-ultimate-csv-importer', 'securekey');
42 $i = 0;
43 $get_post_types = get_post_types();
44 array_push($get_post_types, 'widgets');
45 foreach ($get_post_types as $key => $value) {
46 if (($value !== 'featured_image') && ($value !== 'attachment') && ($value !== 'wpsc-product') && ($value !== 'wpsc-product-file') && ($value !== 'revision') && ($value !== 'post') && ($value !== 'page') && ($value !== 'wp-types-group') && ($value !== 'wp-types-user-group') && ($value !== 'product') && ($value !== 'product_variation') && ($value !== 'shop_order') && ($value !== 'shop_coupon') && ($value !== 'acf') && ($value !== 'acf-field') && ($value !== 'acf-field-group') && ($value !== '_pods_pod') && ($value !== '_pods_field') && ($value !== 'shop_order_refund') && ($value !== 'shop_webhook')) {
47 $response['custom_post_type'][$i] = $value;
48 $i++;
49 }
50 }
51 echo wp_json_encode($response);
52 wp_die();
53 }
54
55 public function getAuthors(){
56 check_ajax_referer('smack-ultimate-csv-importer', 'securekey');
57 $i = 0;
58 $blogusers = get_users( [ 'role__in' => [ 'administrator', 'author' ] ] );
59 foreach( $blogusers as $user ) {
60 $response['user_name'][$i] = $user->display_name;
61 $response['user_id'][$i] = $user->ID;
62 $i++;
63 }
64 echo wp_json_encode($response);
65 wp_die();
66 }
67
68 public function getTaxonomies(){
69 check_ajax_referer('smack-ultimate-csv-importer', 'securekey');
70 $get_taxonomies = array('product_cat','product_tag','post_tag');
71 $i = 0;
72 foreach ($get_taxonomies as $key => $value) {
73 $response['taxonomies'][$i] = $value;
74 $i++;
75 }
76 echo wp_json_encode($response);
77 wp_die();
78 }
79 }
80
81 global $export_handler_class;
82 $export_handler_class = new ExportHandler();
83