PluginProbe ʕ •ᴥ•ʔ
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress / 4.17.0
Paid Membership Plugin, Ecommerce, User Registration Form, Login Form, User Profile & Restrict Content – ProfilePress v4.17.0
4.17.0 4.16.19 4.16.18 4.16.17 4.16.16 trunk 1.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.5a 1.1.6 1.1.7 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.4.2 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.7 1.7.1 1.7.2 1.8 1.8.1 1.8.10 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.1.9 2.2.10 2.2.11 2.2.12 2.2.13 2.2.14 2.2.15 2.2.16 2.2.2 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 3.0 3.1 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4.0.0 4.0.1 4.0.2 4.0.3 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10.0 4.10.1 4.10.2 4.10.3 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.13.3 4.13.4 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.15.0 4.15.1 4.15.10 4.15.11 4.15.12 4.15.13 4.15.14 4.15.15 4.15.16 4.15.17 4.15.18 4.15.19 4.15.2 4.15.20 4.15.20.1 4.15.21 4.15.22 4.15.23 4.15.24 4.15.25 4.15.3 4.15.4 4.15.5 4.15.6 4.15.7 4.15.8 4.15.9 4.16.0 4.16.1 4.16.10 4.16.11 4.16.12 4.16.13 4.16.14 4.16.15 4.16.2 4.16.3 4.16.4 4.16.5 4.16.6 4.16.7 4.16.8 4.16.9 4.2.0 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 4.6.0 4.7.0 4.8.0 4.9.0
wp-user-avatar / src / Admin / SettingsPages / Membership / ExportPage / SettingsPage.php
wp-user-avatar / src / Admin / SettingsPages / Membership / ExportPage Last commit date
views 3 years ago AbstractExport.php 1 year ago CustomersExport.php 6 months ago OrdersExport.php 3 years ago PlansExport.php 3 years ago ProductSalesExport.php 3 years ago SalesEarningsExport.php 3 years ago SettingsPage.php 1 year ago SubscriptionsExport.php 3 years ago index.php 3 years ago
SettingsPage.php
158 lines
1 <?php
2
3 namespace ProfilePress\Core\Admin\SettingsPages\Membership\ExportPage;
4
5 use ProfilePress\Core\Admin\SettingsPages\AbstractSettingsPage;
6 use ProfilePress\Core\Membership\Models\Order\OrderStatus;
7 use ProfilePress\Core\Membership\Models\Subscription\SubscriptionStatus;
8 use ProfilePress\Core\Membership\PaymentMethods\PaymentMethods;
9 use ProfilePress\Core\Membership\Repositories\PlanRepository;
10 use ProfilePress\Custom_Settings_Page_Api;
11
12 class SettingsPage extends AbstractSettingsPage
13 {
14 function __construct()
15 {
16 add_action('ppress_admin_settings_page_export', [$this, 'settings_page_function']);
17 add_filter('ppress_membership_dashboard_settings_page_title', [$this, 'admin_page_title']);
18
19 add_action('admin_init', [$this, 'handle_export']);
20 }
21
22 public function admin_page_title($title = '')
23 {
24 if (ppressGET_var('view') == 'export') {
25 $title = esc_html__('Export', 'wp-user-avatar');
26 }
27
28 return $title;
29 }
30
31 public function settings_page_function()
32 {
33 add_filter('wp_cspa_main_content_area', [$this, 'admin_settings_page_callback'], 10, 2);
34
35 $instance = Custom_Settings_Page_Api::instance();
36 $instance->option_name('ppview'); // adds ppview css class to #poststuff
37 $instance->page_header($this->admin_page_title());
38 $instance->remove_page_form_tag();
39 $instance->build(true);
40 }
41
42 public function handle_export()
43 {
44 if (isset($_POST['ppress_do_export'])) {
45
46 if (current_user_can('manage_options')) {
47
48 if (check_admin_referer('ppress_export_' . ppressPOST_var('ppress_export_type'))) {
49
50 $class = sprintf(
51 '\ProfilePress\Core\Admin\SettingsPages\Membership\ExportPage\%s',
52 sanitize_text_field(ppressPOST_var('ppress_export_type', ''))
53 );
54
55 if (class_exists($class) && method_exists($class, 'execute')) {
56 (new $class(ppress_clean($_POST)))->execute();
57 }
58 }
59 }
60 }
61 }
62
63 private function render_form_view($path)
64 {
65 $membership_plans = ppress_cache_transform('ppress_export_membership_plans', function () {
66 return PlanRepository::init()->retrieveAll();
67 });
68
69 $payment_methods = ppress_cache_transform('ppress_export_payment_methods', function () {
70 return PaymentMethods::get_instance()->get_all();
71 });
72
73 $order_statuses = ppress_cache_transform('ppress_export_order_statuses', function () {
74 return OrderStatus::get_all();
75 });
76
77 $subscription_statuses = ppress_cache_transform('ppress_export_subscription_statuses', function () {
78 return SubscriptionStatus::get_all();
79 });
80
81 ob_start();
82 require dirname(__FILE__) . '/views/' . $path . '.php';
83
84 return ob_get_clean();
85 }
86
87 public function admin_settings_page_callback()
88 {
89 $exports = apply_filters('ppress_csv_exports', [
90 'SalesEarningsExport' => [
91 'title' => esc_html__('Export Sales and Earnings', 'wp-user-avatar'),
92 'description' => esc_html__('Download a CSV of all sales or earnings on a day-by-day basis.', 'wp-user-avatar'),
93 'form' => $this->render_form_view('sales-earnings')
94 ],
95 'ProductSalesExport' => [
96 'title' => esc_html__('Export Plan Sales', 'wp-user-avatar'),
97 'description' => esc_html__('Download a CSV file containing a record of each sale of a plan along with the customer information.', 'wp-user-avatar'),
98 'form' => $this->render_form_view('product-sales')
99 ],
100 'OrdersExport' => [
101 'title' => esc_html__('Export Orders', 'wp-user-avatar'),
102 'description' => esc_html__('Download a CSV of all orders.', 'wp-user-avatar'),
103 'form' => $this->render_form_view('orders')
104 ],
105 'SubscriptionsExport' => [
106 'title' => esc_html__('Export Subscriptions', 'wp-user-avatar'),
107 'description' => esc_html__('Download a CSV of subscriptions.', 'wp-user-avatar'),
108 'form' => $this->render_form_view('subscriptions')
109 ],
110 'CustomersExport' => [
111 'title' => esc_html__('Export Customers', 'wp-user-avatar'),
112 'description' => esc_html__('Download a CSV of customers.', 'wp-user-avatar'),
113 'form' => $this->render_form_view('customers')
114 ],
115 'PlansExport' => [
116 'title' => esc_html__('Export Plans', 'wp-user-avatar'),
117 'description' => esc_html__('Download a CSV of membership plans.', 'wp-user-avatar'),
118 'form' => $this->render_form_view('plans')
119 ]
120 ], $this);
121 ?>
122 <div class="ppress-export-cards-wrap">
123
124 <dl class="ppress-export-card-item-wrap">
125
126 <?php foreach ($exports as $export_id => $export) : ?>
127
128 <div class="ppress-export-card-item">
129 <dt class="ppress-export-card-item-header">
130 <p><?php esc_html_e($export['title']); ?></p>
131 </dt>
132 <dd class="ppress-export-card-item-inside">
133 <p><?php esc_html_e($export['description']); ?></p>
134 <form id="ppress-export-sales-earnings" class="ppress-export-form" method="post">
135 <?php echo $export['form']; ?>
136 <?php wp_nonce_field('ppress_export_' . $export_id); ?>
137 <input type="hidden" name="ppress_export_type" value="<?php esc_attr_e($export_id); ?>">
138 <input class="button" type="submit" name="ppress_do_export" value="<?php esc_html_e('Export', 'wp-user-avatar'); ?>">
139 </form>
140 </dd>
141 </div>
142 <?php endforeach; ?>
143 </dl>
144 </div>
145 <?php
146 }
147
148 public static function get_instance()
149 {
150 static $instance = null;
151
152 if (is_null($instance)) {
153 $instance = new self();
154 }
155
156 return $instance;
157 }
158 }