1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Mollie admin. |
4
|
|
|
* |
5
|
|
|
* @author Pronamic <[email protected]> |
6
|
|
|
* @copyright 2005-2020 Pronamic |
7
|
|
|
* @license GPL-3.0-or-later |
8
|
|
|
* @package Pronamic\WordPress\Pay |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Mollie; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Title: Mollie admin |
15
|
|
|
* Description: |
16
|
|
|
* Copyright: 2005-2020 Pronamic |
17
|
|
|
* Company: Pronamic |
18
|
|
|
* |
19
|
|
|
* @author Remco Tolsma |
20
|
|
|
* @version 2.0.9 |
21
|
|
|
* @since 1.0.0 |
22
|
|
|
*/ |
23
|
|
|
class Admin { |
24
|
|
|
/** |
25
|
|
|
* Construct and intialize Mollie admin. |
26
|
|
|
*/ |
27
|
|
|
public function __construct() { |
28
|
|
|
$function = array( __CLASS__, 'user_profile' ); |
29
|
|
|
|
30
|
|
|
if ( ! has_action( 'show_user_profile', $function ) ) { |
31
|
|
|
add_action( 'show_user_profile', $function ); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
if ( ! has_action( 'edit_user_profile', $function ) ) { |
35
|
|
|
add_action( 'edit_user_profile', $function ); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Menu. |
40
|
|
|
* |
41
|
|
|
* @link https://metabox.io/create-hidden-admin-page/ |
42
|
|
|
*/ |
43
|
|
|
add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Admin menu. |
48
|
|
|
*/ |
49
|
|
|
public function admin_menu() { |
50
|
|
|
add_menu_page( |
51
|
|
|
__( 'Mollie', 'pronamic_ideal' ), |
52
|
|
|
__( 'Mollie', 'pronamic_ideal' ), |
53
|
|
|
'manage_options', |
54
|
|
|
'pronamic_pay_mollie', |
55
|
|
|
array( $this, 'page_mollie' ) |
56
|
|
|
); |
57
|
|
|
|
58
|
|
|
add_submenu_page( |
59
|
|
|
'pronamic_pay_mollie', |
60
|
|
|
__( 'Mollie Customers', 'pronamic_ideal' ), |
61
|
|
|
__( 'Customers', 'pronamic_ideal' ), |
62
|
|
|
'manage_options', |
63
|
|
|
'pronamic_pay_mollie_customers', |
64
|
|
|
array( $this, 'page_mollie_customers' ) |
65
|
|
|
); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Page Mollie. |
70
|
|
|
*/ |
71
|
|
|
public function page_mollie() { |
72
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Page Mollie customers. |
77
|
|
|
*/ |
78
|
|
|
public function page_mollie_customers() { |
79
|
|
|
if ( filter_has_var( INPUT_GET, 'id' ) ) { |
80
|
|
|
include __DIR__ . '/../views/page-customer.php'; |
81
|
|
|
|
82
|
|
|
return; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
include __DIR__ . '/../views/page-customers.php'; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* User profile. |
90
|
|
|
* |
91
|
|
|
* @since 1.1.6 |
92
|
|
|
* @link https://github.com/WordPress/WordPress/blob/4.5.2/wp-admin/user-edit.php#L578-L600 |
93
|
|
|
* @param WP_User $user WordPress user. |
|
|
|
|
94
|
|
|
* @return void |
95
|
|
|
*/ |
96
|
|
|
public static function user_profile( $user ) { |
97
|
|
|
include __DIR__ . '/../views/html-admin-user-profile.php'; |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|