PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.9
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / inc / TemplateHooks / Order / AdminOrderListTemplate.php

AdminOrderListTemplate.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.9, at inc/TemplateHooks/Order/AdminOrderListTemplate.php

55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace LearnPress\TemplateHooks\Order;
4
5 use LearnPress\Helpers\Singleton;
6 use LearnPress\Helpers\Template;
7 use LP_Helper;
8
9 /**
10 * class AdminOrderListTemplate
11 *
12 * @since 4.3.2.8
13 * @version 1.0.0
14 */
15 class AdminOrderListTemplate {
16
17 use Singleton;
18
19 public function init() {
20 add_action( 'manage_posts_extra_tablenav', array( $this, 'add_export_order_button' ) );
21 }
22
23 public function add_export_order_button( $which ) {
24 if ( $which !== 'top' ) {
25 return;
26 }
27
28 $screen = get_current_screen();
29 if ( ! $screen || $screen->base !== 'edit' || $screen->post_type !== LP_ORDER_CPT ) {
30 return;
31 }
32
33 $order_data = [
34 'action' => 'export_order_csv',
35 'export_id' => time() . '-' . uniqid(),
36 ];
37
38 $data_get = LP_Helper::sanitize_params_submitted( $_GET );
39 $order_data = array_merge( $data_get, $order_data );
40
41 $section = [
42 'wrap-start' => '<div class="alignleft actions">',
43 'btn-export-start' => sprintf(
44 '<button type="button" class="button lp-button lp-btn-export-order-to-csv" data-send="%s">',
45 esc_attr( Template::convert_data_to_json( $order_data ) )
46 ),
47 'btn-text' => esc_html__( 'Export to CSV', 'learnpress' ),
48 'btn-export-end' => '</button>',
49 'wrap-end' => '</div>',
50 ];
51
52 echo Template::combine_components( $section );
53 }
54 }
55