@@ -17,9 +17,9 @@ |
||
17 | 17 | id="activate_<?php echo esc_attr($payment_method->slug()) ?>" |
18 | 18 | > |
19 | 19 | <?php printf( |
20 | - esc_html__("Activate %s Payment Method?", "event_espresso"), |
|
21 | - $payment_method->admin_name() |
|
22 | - ); ?> |
|
20 | + esc_html__("Activate %s Payment Method?", "event_espresso"), |
|
21 | + $payment_method->admin_name() |
|
22 | + ); ?> |
|
23 | 23 | </a> |
24 | 24 | </td> |
25 | 25 | </tr> |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | </th> |
33 | 33 | <td> |
34 | 34 | <?php |
35 | - if ($payment_log->object() instanceof EE_Transaction) { |
|
36 | - esc_html_e('Unknown', 'event_espresso'); |
|
37 | - } else { |
|
38 | - echo $payment_method |
|
39 | - ? esc_html($payment_method->admin_name()) |
|
40 | - : esc_html__("No Longer Exists", 'event_espresso'); |
|
41 | - } |
|
42 | - ?> |
|
35 | + if ($payment_log->object() instanceof EE_Transaction) { |
|
36 | + esc_html_e('Unknown', 'event_espresso'); |
|
37 | + } else { |
|
38 | + echo $payment_method |
|
39 | + ? esc_html($payment_method->admin_name()) |
|
40 | + : esc_html__("No Longer Exists", 'event_espresso'); |
|
41 | + } |
|
42 | + ?> |
|
43 | 43 | </td> |
44 | 44 | </tr> |
45 | 45 | <tr> |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | </th> |
51 | 51 | <td> |
52 | 52 | <?php echo $transaction |
53 | - ? absint($transaction->ID()) |
|
54 | - : esc_html__('Could not be determined', 'event_espresso'); |
|
55 | - ?> |
|
53 | + ? absint($transaction->ID()) |
|
54 | + : esc_html__('Could not be determined', 'event_espresso'); |
|
55 | + ?> |
|
56 | 56 | </td> |
57 | 57 | </tr> |
58 | 58 | <tr> |
@@ -15,153 +15,153 @@ |
||
15 | 15 | class Payments_Admin_Page_Init extends EE_Admin_Page_Init |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var TableAnalysis $table_analysis |
|
20 | - */ |
|
21 | - protected $_table_analysis; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @throws EE_Error |
|
26 | - * @throws ReflectionException |
|
27 | - */ |
|
28 | - public function __construct() |
|
29 | - { |
|
30 | - // define some page related constants |
|
31 | - define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
32 | - define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG)); |
|
33 | - define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments/'); |
|
34 | - define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates/'); |
|
35 | - define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/'); |
|
36 | - $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true); |
|
37 | - // check that there are active gateways on all admin page loads. but don't do it just yet |
|
38 | - add_action('admin_notices', [$this, 'check_payment_gateway_setup']); |
|
39 | - |
|
40 | - // Show/hide PP Standard alongside PP Express. |
|
41 | - add_filter( |
|
42 | - 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
|
43 | - [$this, 'unset_pp_standard'] |
|
44 | - ); |
|
45 | - |
|
46 | - parent::__construct(); |
|
47 | - } |
|
48 | - |
|
49 | - |
|
50 | - protected function _set_init_properties() |
|
51 | - { |
|
52 | - $this->label = esc_html__('Payment Methods', 'event_espresso'); |
|
53 | - } |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * _set_menu_map |
|
58 | - * |
|
59 | - * @return void |
|
60 | - * @throws EE_Error |
|
61 | - */ |
|
62 | - protected function _set_menu_map() |
|
63 | - { |
|
64 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
65 | - [ |
|
66 | - 'menu_group' => 'settings', |
|
67 | - 'menu_order' => 30, |
|
68 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
69 | - 'parent_slug' => 'espresso_events', |
|
70 | - 'menu_slug' => EE_PAYMENTS_PG_SLUG, |
|
71 | - 'menu_label' => esc_html__('Payment Methods', 'event_espresso'), |
|
72 | - 'capability' => 'ee_manage_gateways', |
|
73 | - 'admin_init_page' => $this, |
|
74 | - ] |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Checks that there is at least one active gateway. If not, add a notice |
|
81 | - * |
|
82 | - * @throws EE_Error |
|
83 | - */ |
|
84 | - public function check_payment_gateway_setup() |
|
85 | - { |
|
86 | - // ONLY do this check if models can query |
|
87 | - // and avoid a bug where when we nuke EE4's data that this causes a fatal error |
|
88 | - // because the tables are deleted just before this request runs. |
|
89 | - // see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
|
90 | - if ( |
|
91 | - ! EE_Maintenance_Mode::instance()->models_can_query() |
|
92 | - || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
|
93 | - ) { |
|
94 | - return; |
|
95 | - } |
|
96 | - |
|
97 | - $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
98 | - if ($actives < 1) { |
|
99 | - $url = EE_Admin_Page::add_query_args_and_nonce([], EE_PAYMENTS_ADMIN_URL); |
|
100 | - echo '<div class="error"> |
|
18 | + /** |
|
19 | + * @var TableAnalysis $table_analysis |
|
20 | + */ |
|
21 | + protected $_table_analysis; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @throws EE_Error |
|
26 | + * @throws ReflectionException |
|
27 | + */ |
|
28 | + public function __construct() |
|
29 | + { |
|
30 | + // define some page related constants |
|
31 | + define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
32 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG)); |
|
33 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments/'); |
|
34 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates/'); |
|
35 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/'); |
|
36 | + $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true); |
|
37 | + // check that there are active gateways on all admin page loads. but don't do it just yet |
|
38 | + add_action('admin_notices', [$this, 'check_payment_gateway_setup']); |
|
39 | + |
|
40 | + // Show/hide PP Standard alongside PP Express. |
|
41 | + add_filter( |
|
42 | + 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
|
43 | + [$this, 'unset_pp_standard'] |
|
44 | + ); |
|
45 | + |
|
46 | + parent::__construct(); |
|
47 | + } |
|
48 | + |
|
49 | + |
|
50 | + protected function _set_init_properties() |
|
51 | + { |
|
52 | + $this->label = esc_html__('Payment Methods', 'event_espresso'); |
|
53 | + } |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * _set_menu_map |
|
58 | + * |
|
59 | + * @return void |
|
60 | + * @throws EE_Error |
|
61 | + */ |
|
62 | + protected function _set_menu_map() |
|
63 | + { |
|
64 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
65 | + [ |
|
66 | + 'menu_group' => 'settings', |
|
67 | + 'menu_order' => 30, |
|
68 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
69 | + 'parent_slug' => 'espresso_events', |
|
70 | + 'menu_slug' => EE_PAYMENTS_PG_SLUG, |
|
71 | + 'menu_label' => esc_html__('Payment Methods', 'event_espresso'), |
|
72 | + 'capability' => 'ee_manage_gateways', |
|
73 | + 'admin_init_page' => $this, |
|
74 | + ] |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Checks that there is at least one active gateway. If not, add a notice |
|
81 | + * |
|
82 | + * @throws EE_Error |
|
83 | + */ |
|
84 | + public function check_payment_gateway_setup() |
|
85 | + { |
|
86 | + // ONLY do this check if models can query |
|
87 | + // and avoid a bug where when we nuke EE4's data that this causes a fatal error |
|
88 | + // because the tables are deleted just before this request runs. |
|
89 | + // see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
|
90 | + if ( |
|
91 | + ! EE_Maintenance_Mode::instance()->models_can_query() |
|
92 | + || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
|
93 | + ) { |
|
94 | + return; |
|
95 | + } |
|
96 | + |
|
97 | + $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
98 | + if ($actives < 1) { |
|
99 | + $url = EE_Admin_Page::add_query_args_and_nonce([], EE_PAYMENTS_ADMIN_URL); |
|
100 | + echo '<div class="error"> |
|
101 | 101 | <p>' |
102 | - . sprintf( |
|
103 | - esc_html__( |
|
104 | - "There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", |
|
105 | - "event_espresso" |
|
106 | - ), |
|
107 | - "<a href='$url'>", |
|
108 | - "</a>" |
|
109 | - ) |
|
110 | - . '</p> |
|
102 | + . sprintf( |
|
103 | + esc_html__( |
|
104 | + "There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", |
|
105 | + "event_espresso" |
|
106 | + ), |
|
107 | + "<a href='$url'>", |
|
108 | + "</a>" |
|
109 | + ) |
|
110 | + . '</p> |
|
111 | 111 | </div>'; |
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * Gets the injected table analyzer, or throws an exception |
|
118 | - * |
|
119 | - * @return TableAnalysis |
|
120 | - * @throws EE_Error |
|
121 | - */ |
|
122 | - protected function _get_table_analysis() |
|
123 | - { |
|
124 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
125 | - return $this->_table_analysis; |
|
126 | - } else { |
|
127 | - throw new EE_Error( |
|
128 | - sprintf( |
|
129 | - esc_html__('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
130 | - get_class($this) |
|
131 | - ) |
|
132 | - ); |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - |
|
137 | - /** |
|
138 | - * Hide PayPal Standard for "new" users. |
|
139 | - * |
|
140 | - * @throws EE_Error |
|
141 | - * @throws ReflectionException |
|
142 | - */ |
|
143 | - public static function unset_pp_standard($payment_method_types) |
|
144 | - { |
|
145 | - $pps = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard'); |
|
146 | - $paypal_standard_active = ! empty($pps) && $pps->active(); |
|
147 | - $paypal_standard_active_before = false; |
|
148 | - if ($pps) { |
|
149 | - // PP Standard used before ? |
|
150 | - $paypal_id = $pps->get_extra_meta('paypal_id', true); |
|
151 | - if ($paypal_id && ! empty($paypal_id)) { |
|
152 | - $paypal_standard_active_before = true; |
|
153 | - } |
|
154 | - } |
|
155 | - |
|
156 | - // Not using PP Standard? Then display only PayPal Express, do not show PayPal Standard. |
|
157 | - if ( |
|
158 | - apply_filters( |
|
159 | - 'FHEE__EE_PMT_Paypal_Express__register_payment_methods__hide_paypal_standard', |
|
160 | - ! $paypal_standard_active && ! $paypal_standard_active_before |
|
161 | - ) |
|
162 | - ) { |
|
163 | - unset($payment_method_types['paypal_standard']); |
|
164 | - } |
|
165 | - return $payment_method_types; |
|
166 | - } |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * Gets the injected table analyzer, or throws an exception |
|
118 | + * |
|
119 | + * @return TableAnalysis |
|
120 | + * @throws EE_Error |
|
121 | + */ |
|
122 | + protected function _get_table_analysis() |
|
123 | + { |
|
124 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
125 | + return $this->_table_analysis; |
|
126 | + } else { |
|
127 | + throw new EE_Error( |
|
128 | + sprintf( |
|
129 | + esc_html__('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
130 | + get_class($this) |
|
131 | + ) |
|
132 | + ); |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + |
|
137 | + /** |
|
138 | + * Hide PayPal Standard for "new" users. |
|
139 | + * |
|
140 | + * @throws EE_Error |
|
141 | + * @throws ReflectionException |
|
142 | + */ |
|
143 | + public static function unset_pp_standard($payment_method_types) |
|
144 | + { |
|
145 | + $pps = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard'); |
|
146 | + $paypal_standard_active = ! empty($pps) && $pps->active(); |
|
147 | + $paypal_standard_active_before = false; |
|
148 | + if ($pps) { |
|
149 | + // PP Standard used before ? |
|
150 | + $paypal_id = $pps->get_extra_meta('paypal_id', true); |
|
151 | + if ($paypal_id && ! empty($paypal_id)) { |
|
152 | + $paypal_standard_active_before = true; |
|
153 | + } |
|
154 | + } |
|
155 | + |
|
156 | + // Not using PP Standard? Then display only PayPal Express, do not show PayPal Standard. |
|
157 | + if ( |
|
158 | + apply_filters( |
|
159 | + 'FHEE__EE_PMT_Paypal_Express__register_payment_methods__hide_paypal_standard', |
|
160 | + ! $paypal_standard_active && ! $paypal_standard_active_before |
|
161 | + ) |
|
162 | + ) { |
|
163 | + unset($payment_method_types['paypal_standard']); |
|
164 | + } |
|
165 | + return $payment_method_types; |
|
166 | + } |
|
167 | 167 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | { |
30 | 30 | // define some page related constants |
31 | 31 | define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
32 | - define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG)); |
|
33 | - define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments/'); |
|
34 | - define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates/'); |
|
35 | - define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/'); |
|
32 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG)); |
|
33 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments/'); |
|
34 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates/'); |
|
35 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/'); |
|
36 | 36 | $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true); |
37 | 37 | // check that there are active gateways on all admin page loads. but don't do it just yet |
38 | 38 | add_action('admin_notices', [$this, 'check_payment_gateway_setup']); |
@@ -12,117 +12,117 @@ discard block |
||
12 | 12 | class Payment_Log_Admin_List_Table extends EE_Admin_List_Table |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var Payments_Admin_Page $_admin_page |
|
17 | - */ |
|
18 | - protected $_admin_page; |
|
15 | + /** |
|
16 | + * @var Payments_Admin_Page $_admin_page |
|
17 | + */ |
|
18 | + protected $_admin_page; |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @param EE_Admin_Page $admin_page |
|
23 | - */ |
|
24 | - public function __construct($admin_page) |
|
25 | - { |
|
26 | - parent::__construct($admin_page); |
|
27 | - } |
|
21 | + /** |
|
22 | + * @param EE_Admin_Page $admin_page |
|
23 | + */ |
|
24 | + public function __construct($admin_page) |
|
25 | + { |
|
26 | + parent::__construct($admin_page); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * _setup_data |
|
32 | - * |
|
33 | - * @return void |
|
34 | - */ |
|
35 | - protected function _setup_data() |
|
36 | - { |
|
37 | - $this->_data = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page); |
|
38 | - // if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') { |
|
39 | - // $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page, false); |
|
40 | - // } else { |
|
41 | - // $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, false); |
|
42 | - // } |
|
43 | - $this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true); |
|
44 | - add_action( |
|
45 | - 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', |
|
46 | - [$this, 'add_download_logs_checkbox'] |
|
47 | - ); |
|
48 | - } |
|
30 | + /** |
|
31 | + * _setup_data |
|
32 | + * |
|
33 | + * @return void |
|
34 | + */ |
|
35 | + protected function _setup_data() |
|
36 | + { |
|
37 | + $this->_data = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page); |
|
38 | + // if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash') { |
|
39 | + // $this->_data = $this->_admin_page->get_trashed_questions($this->_per_page, $this->_current_page, false); |
|
40 | + // } else { |
|
41 | + // $this->_data = $this->_admin_page->get_questions($this->_per_page, $this->_current_page, false); |
|
42 | + // } |
|
43 | + $this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, true); |
|
44 | + add_action( |
|
45 | + 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', |
|
46 | + [$this, 'add_download_logs_checkbox'] |
|
47 | + ); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * add_download_logs_checkbox |
|
53 | - * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters |
|
54 | - * |
|
55 | - * @return void |
|
56 | - */ |
|
57 | - public function add_download_logs_checkbox() |
|
58 | - { |
|
59 | - echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='" |
|
60 | - . esc_html__('Download Results', 'event_espresso') . "'>"; |
|
61 | - } |
|
51 | + /** |
|
52 | + * add_download_logs_checkbox |
|
53 | + * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters |
|
54 | + * |
|
55 | + * @return void |
|
56 | + */ |
|
57 | + public function add_download_logs_checkbox() |
|
58 | + { |
|
59 | + echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='" |
|
60 | + . esc_html__('Download Results', 'event_espresso') . "'>"; |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * _set_properties |
|
66 | - * |
|
67 | - * @return void |
|
68 | - */ |
|
69 | - protected function _set_properties() |
|
70 | - { |
|
71 | - $this->_wp_list_args = [ |
|
72 | - 'singular' => esc_html__('payment log', 'event_espresso'), |
|
73 | - 'plural' => esc_html__('payment logs', 'event_espresso'), |
|
74 | - 'ajax' => true, // for now, |
|
75 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
76 | - ]; |
|
77 | - $this->_columns = [ |
|
78 | - 'cb' => '<input type="checkbox" />', |
|
79 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
80 | - 'LOG_time' => esc_html__('Time', 'event_espresso'), |
|
81 | - 'PMD_ID' => esc_html__('Payment Method', 'event_espresso'), |
|
82 | - 'TXN_ID' => esc_html__('Transaction ID', 'event_espresso'), |
|
83 | - ]; |
|
84 | - $this->_sortable_columns = [ |
|
85 | - 'LOG_time' => ['LOG_time' => true], |
|
86 | - ]; |
|
87 | - $this->_hidden_columns = []; |
|
88 | - } |
|
64 | + /** |
|
65 | + * _set_properties |
|
66 | + * |
|
67 | + * @return void |
|
68 | + */ |
|
69 | + protected function _set_properties() |
|
70 | + { |
|
71 | + $this->_wp_list_args = [ |
|
72 | + 'singular' => esc_html__('payment log', 'event_espresso'), |
|
73 | + 'plural' => esc_html__('payment logs', 'event_espresso'), |
|
74 | + 'ajax' => true, // for now, |
|
75 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
76 | + ]; |
|
77 | + $this->_columns = [ |
|
78 | + 'cb' => '<input type="checkbox" />', |
|
79 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
80 | + 'LOG_time' => esc_html__('Time', 'event_espresso'), |
|
81 | + 'PMD_ID' => esc_html__('Payment Method', 'event_espresso'), |
|
82 | + 'TXN_ID' => esc_html__('Transaction ID', 'event_espresso'), |
|
83 | + ]; |
|
84 | + $this->_sortable_columns = [ |
|
85 | + 'LOG_time' => ['LOG_time' => true], |
|
86 | + ]; |
|
87 | + $this->_hidden_columns = []; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * _get_table_filters |
|
93 | - * |
|
94 | - * @return array |
|
95 | - * @throws EE_Error |
|
96 | - * @throws ReflectionException |
|
97 | - */ |
|
98 | - protected function _get_table_filters() |
|
99 | - { |
|
100 | - $filters = []; |
|
101 | - // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
|
102 | - /** @var EE_Payment_Method[] $payment_methods */ |
|
103 | - $payment_methods = EEM_Payment_Method::instance()->get_all(); |
|
104 | - $payment_method_names = [ |
|
105 | - ['id' => 'all', 'text' => esc_html__("All", 'event_espresso')], |
|
106 | - ['id' => '0', 'text' => esc_html__("Unknown Payment Method", 'event_espresso')], |
|
107 | - ]; |
|
108 | - foreach ($payment_methods as $payment_method) { |
|
109 | - $payment_method_names[] = ['id' => $payment_method->ID(), 'text' => $payment_method->admin_name()]; |
|
110 | - } |
|
111 | - $filters[] = EEH_Form_Fields::select_input( |
|
112 | - '_payment_method', |
|
113 | - $payment_method_names, |
|
114 | - isset($this->_req_data['_payment_method']) |
|
115 | - ? $this->_req_data['_payment_method'] |
|
116 | - : 'all' |
|
117 | - ); |
|
118 | - $start_date = isset($this->_req_data['payment-filter-start-date']) |
|
119 | - ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) |
|
120 | - : date('m/d/Y', strtotime('-6 months')); |
|
121 | - $end_date = isset($this->_req_data['payment-filter-end-date']) |
|
122 | - ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) |
|
123 | - : date('m/d/Y'); |
|
124 | - ob_start(); |
|
125 | - ?> |
|
91 | + /** |
|
92 | + * _get_table_filters |
|
93 | + * |
|
94 | + * @return array |
|
95 | + * @throws EE_Error |
|
96 | + * @throws ReflectionException |
|
97 | + */ |
|
98 | + protected function _get_table_filters() |
|
99 | + { |
|
100 | + $filters = []; |
|
101 | + // todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods. |
|
102 | + /** @var EE_Payment_Method[] $payment_methods */ |
|
103 | + $payment_methods = EEM_Payment_Method::instance()->get_all(); |
|
104 | + $payment_method_names = [ |
|
105 | + ['id' => 'all', 'text' => esc_html__("All", 'event_espresso')], |
|
106 | + ['id' => '0', 'text' => esc_html__("Unknown Payment Method", 'event_espresso')], |
|
107 | + ]; |
|
108 | + foreach ($payment_methods as $payment_method) { |
|
109 | + $payment_method_names[] = ['id' => $payment_method->ID(), 'text' => $payment_method->admin_name()]; |
|
110 | + } |
|
111 | + $filters[] = EEH_Form_Fields::select_input( |
|
112 | + '_payment_method', |
|
113 | + $payment_method_names, |
|
114 | + isset($this->_req_data['_payment_method']) |
|
115 | + ? $this->_req_data['_payment_method'] |
|
116 | + : 'all' |
|
117 | + ); |
|
118 | + $start_date = isset($this->_req_data['payment-filter-start-date']) |
|
119 | + ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) |
|
120 | + : date('m/d/Y', strtotime('-6 months')); |
|
121 | + $end_date = isset($this->_req_data['payment-filter-end-date']) |
|
122 | + ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) |
|
123 | + : date('m/d/Y'); |
|
124 | + ob_start(); |
|
125 | + ?> |
|
126 | 126 | <label for="payment-filter-start-date"> |
127 | 127 | <?php esc_html_e('Display Transactions from ', 'event_espresso'); ?> |
128 | 128 | </label> |
@@ -144,139 +144,139 @@ discard block |
||
144 | 144 | size="15" |
145 | 145 | /> |
146 | 146 | <?php |
147 | - $filters[] = ob_get_clean(); |
|
148 | - return $filters; |
|
149 | - } |
|
147 | + $filters[] = ob_get_clean(); |
|
148 | + return $filters; |
|
149 | + } |
|
150 | 150 | |
151 | 151 | |
152 | - /** |
|
153 | - * _add_view_counts |
|
154 | - * |
|
155 | - * @return void |
|
156 | - */ |
|
157 | - protected function _add_view_counts() |
|
158 | - { |
|
159 | - $this->_views['all']['count'] = $this->_admin_page->get_payment_logs( |
|
160 | - $this->_per_page, |
|
161 | - $this->_current_page, |
|
162 | - true |
|
163 | - ); |
|
164 | - } |
|
152 | + /** |
|
153 | + * _add_view_counts |
|
154 | + * |
|
155 | + * @return void |
|
156 | + */ |
|
157 | + protected function _add_view_counts() |
|
158 | + { |
|
159 | + $this->_views['all']['count'] = $this->_admin_page->get_payment_logs( |
|
160 | + $this->_per_page, |
|
161 | + $this->_current_page, |
|
162 | + true |
|
163 | + ); |
|
164 | + } |
|
165 | 165 | |
166 | 166 | |
167 | - /** |
|
168 | - * column_cb |
|
169 | - * |
|
170 | - * @param EE_Change_Log $item |
|
171 | - * @return string |
|
172 | - * @throws EE_Error |
|
173 | - * @throws ReflectionException |
|
174 | - */ |
|
175 | - public function column_cb($item) |
|
176 | - { |
|
177 | - return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
178 | - } |
|
167 | + /** |
|
168 | + * column_cb |
|
169 | + * |
|
170 | + * @param EE_Change_Log $item |
|
171 | + * @return string |
|
172 | + * @throws EE_Error |
|
173 | + * @throws ReflectionException |
|
174 | + */ |
|
175 | + public function column_cb($item) |
|
176 | + { |
|
177 | + return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
178 | + } |
|
179 | 179 | |
180 | 180 | |
181 | - /** |
|
182 | - * column_id |
|
183 | - * |
|
184 | - * @param EE_Change_Log $item |
|
185 | - * @return string |
|
186 | - * @throws EE_Error |
|
187 | - * @throws ReflectionException |
|
188 | - */ |
|
189 | - public function column_id(EE_Change_Log $item) |
|
190 | - { |
|
191 | - $ID = absint($item->ID()); |
|
192 | - $details_query_args = [ |
|
193 | - 'action' => 'payment_log_details', |
|
194 | - 'ID' => $ID, |
|
195 | - ]; |
|
196 | - $url = esc_url_raw( |
|
197 | - EE_Admin_Page::add_query_args_and_nonce($details_query_args, EE_PAYMENTS_ADMIN_URL) |
|
198 | - ); |
|
199 | - return "<a href='$url'>{$ID}</a>"; |
|
200 | - } |
|
181 | + /** |
|
182 | + * column_id |
|
183 | + * |
|
184 | + * @param EE_Change_Log $item |
|
185 | + * @return string |
|
186 | + * @throws EE_Error |
|
187 | + * @throws ReflectionException |
|
188 | + */ |
|
189 | + public function column_id(EE_Change_Log $item) |
|
190 | + { |
|
191 | + $ID = absint($item->ID()); |
|
192 | + $details_query_args = [ |
|
193 | + 'action' => 'payment_log_details', |
|
194 | + 'ID' => $ID, |
|
195 | + ]; |
|
196 | + $url = esc_url_raw( |
|
197 | + EE_Admin_Page::add_query_args_and_nonce($details_query_args, EE_PAYMENTS_ADMIN_URL) |
|
198 | + ); |
|
199 | + return "<a href='$url'>{$ID}</a>"; |
|
200 | + } |
|
201 | 201 | |
202 | 202 | |
203 | - /** |
|
204 | - * column_LOG_time |
|
205 | - * |
|
206 | - * @param EE_Change_Log $item |
|
207 | - * @return string |
|
208 | - * @throws EE_Error |
|
209 | - * @throws ReflectionException |
|
210 | - */ |
|
211 | - public function column_LOG_time(EE_Change_Log $item) |
|
212 | - { |
|
213 | - return $item->get_datetime('LOG_time'); |
|
214 | - } |
|
203 | + /** |
|
204 | + * column_LOG_time |
|
205 | + * |
|
206 | + * @param EE_Change_Log $item |
|
207 | + * @return string |
|
208 | + * @throws EE_Error |
|
209 | + * @throws ReflectionException |
|
210 | + */ |
|
211 | + public function column_LOG_time(EE_Change_Log $item) |
|
212 | + { |
|
213 | + return $item->get_datetime('LOG_time'); |
|
214 | + } |
|
215 | 215 | |
216 | 216 | |
217 | - /** |
|
218 | - * column_PMD_ID |
|
219 | - * |
|
220 | - * @param EE_Change_Log $item |
|
221 | - * @return string |
|
222 | - * @throws EE_Error |
|
223 | - */ |
|
224 | - public function column_PMD_ID(EE_Change_Log $item) |
|
225 | - { |
|
226 | - if ($item->object() instanceof EE_Payment_Method) { |
|
227 | - return $item->object()->admin_name(); |
|
228 | - } |
|
229 | - if ( |
|
230 | - $item->object() instanceof EE_Payment |
|
231 | - && $item->object()->payment_method() instanceof EE_Payment_Method |
|
232 | - ) { |
|
233 | - return $item->object()->payment_method()->admin_name(); |
|
234 | - } |
|
235 | - if ($item->object() instanceof EE_Transaction) { |
|
236 | - return esc_html__('Unknown', 'event_espresso'); |
|
237 | - } |
|
238 | - return esc_html__('No longer exists', 'event_espresso'); |
|
239 | - } |
|
217 | + /** |
|
218 | + * column_PMD_ID |
|
219 | + * |
|
220 | + * @param EE_Change_Log $item |
|
221 | + * @return string |
|
222 | + * @throws EE_Error |
|
223 | + */ |
|
224 | + public function column_PMD_ID(EE_Change_Log $item) |
|
225 | + { |
|
226 | + if ($item->object() instanceof EE_Payment_Method) { |
|
227 | + return $item->object()->admin_name(); |
|
228 | + } |
|
229 | + if ( |
|
230 | + $item->object() instanceof EE_Payment |
|
231 | + && $item->object()->payment_method() instanceof EE_Payment_Method |
|
232 | + ) { |
|
233 | + return $item->object()->payment_method()->admin_name(); |
|
234 | + } |
|
235 | + if ($item->object() instanceof EE_Transaction) { |
|
236 | + return esc_html__('Unknown', 'event_espresso'); |
|
237 | + } |
|
238 | + return esc_html__('No longer exists', 'event_espresso'); |
|
239 | + } |
|
240 | 240 | |
241 | 241 | |
242 | - /** |
|
243 | - * column_TXN_ID |
|
244 | - * |
|
245 | - * @param EE_Change_Log $item |
|
246 | - * @return string |
|
247 | - * @throws EE_Error |
|
248 | - * @throws ReflectionException |
|
249 | - */ |
|
250 | - public function column_TXN_ID(EE_Change_Log $item) |
|
251 | - { |
|
252 | - if ($item->object() instanceof EE_Payment) { |
|
253 | - $transaction_id = $item->object()->TXN_ID(); |
|
254 | - } elseif ($item->object() instanceof EE_Transaction) { |
|
255 | - $transaction_id = $item->object()->ID(); |
|
256 | - } else { |
|
257 | - $transaction_id = null; |
|
258 | - } |
|
259 | - if ( |
|
260 | - $transaction_id |
|
261 | - && EE_Registry::instance()->CAP->current_user_can( |
|
262 | - 'ee_read_transaction', |
|
263 | - 'espresso_transactions_view_transaction', |
|
264 | - $transaction_id |
|
265 | - ) |
|
266 | - ) { |
|
267 | - $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
268 | - ['action' => 'view_transaction', 'TXN_ID' => $transaction_id], |
|
269 | - TXN_ADMIN_URL |
|
270 | - ); |
|
271 | - return '<a href="' . esc_url_raw($view_txn_lnk_url) . '" ' |
|
272 | - . 'title="' . sprintf( |
|
273 | - esc_attr__('click to view transaction #%s', 'event_espresso'), |
|
274 | - $transaction_id |
|
275 | - ) . '">' |
|
276 | - . sprintf(esc_html__('view txn %s', 'event_espresso'), $transaction_id) |
|
277 | - . '</a>'; |
|
278 | - } |
|
279 | - // No transaction id or use can not view the transaction. |
|
280 | - return esc_html__("Unable to find transaction", 'event_espresso'); |
|
281 | - } |
|
242 | + /** |
|
243 | + * column_TXN_ID |
|
244 | + * |
|
245 | + * @param EE_Change_Log $item |
|
246 | + * @return string |
|
247 | + * @throws EE_Error |
|
248 | + * @throws ReflectionException |
|
249 | + */ |
|
250 | + public function column_TXN_ID(EE_Change_Log $item) |
|
251 | + { |
|
252 | + if ($item->object() instanceof EE_Payment) { |
|
253 | + $transaction_id = $item->object()->TXN_ID(); |
|
254 | + } elseif ($item->object() instanceof EE_Transaction) { |
|
255 | + $transaction_id = $item->object()->ID(); |
|
256 | + } else { |
|
257 | + $transaction_id = null; |
|
258 | + } |
|
259 | + if ( |
|
260 | + $transaction_id |
|
261 | + && EE_Registry::instance()->CAP->current_user_can( |
|
262 | + 'ee_read_transaction', |
|
263 | + 'espresso_transactions_view_transaction', |
|
264 | + $transaction_id |
|
265 | + ) |
|
266 | + ) { |
|
267 | + $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( |
|
268 | + ['action' => 'view_transaction', 'TXN_ID' => $transaction_id], |
|
269 | + TXN_ADMIN_URL |
|
270 | + ); |
|
271 | + return '<a href="' . esc_url_raw($view_txn_lnk_url) . '" ' |
|
272 | + . 'title="' . sprintf( |
|
273 | + esc_attr__('click to view transaction #%s', 'event_espresso'), |
|
274 | + $transaction_id |
|
275 | + ) . '">' |
|
276 | + . sprintf(esc_html__('view txn %s', 'event_espresso'), $transaction_id) |
|
277 | + . '</a>'; |
|
278 | + } |
|
279 | + // No transaction id or use can not view the transaction. |
|
280 | + return esc_html__("Unable to find transaction", 'event_espresso'); |
|
281 | + } |
|
282 | 282 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | public function add_download_logs_checkbox() |
58 | 58 | { |
59 | 59 | echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='" |
60 | - . esc_html__('Download Results', 'event_espresso') . "'>"; |
|
60 | + . esc_html__('Download Results', 'event_espresso')."'>"; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function _set_properties() |
70 | 70 | { |
71 | - $this->_wp_list_args = [ |
|
71 | + $this->_wp_list_args = [ |
|
72 | 72 | 'singular' => esc_html__('payment log', 'event_espresso'), |
73 | 73 | 'plural' => esc_html__('payment logs', 'event_espresso'), |
74 | 74 | 'ajax' => true, // for now, |
75 | 75 | 'screen' => $this->_admin_page->get_current_screen()->id, |
76 | 76 | ]; |
77 | - $this->_columns = [ |
|
77 | + $this->_columns = [ |
|
78 | 78 | 'cb' => '<input type="checkbox" />', |
79 | 79 | 'id' => esc_html__('ID', 'event_espresso'), |
80 | 80 | 'LOG_time' => esc_html__('Time', 'event_espresso'), |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | foreach ($payment_methods as $payment_method) { |
109 | 109 | $payment_method_names[] = ['id' => $payment_method->ID(), 'text' => $payment_method->admin_name()]; |
110 | 110 | } |
111 | - $filters[] = EEH_Form_Fields::select_input( |
|
111 | + $filters[] = EEH_Form_Fields::select_input( |
|
112 | 112 | '_payment_method', |
113 | 113 | $payment_method_names, |
114 | 114 | isset($this->_req_data['_payment_method']) |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | 'action' => 'payment_log_details', |
194 | 194 | 'ID' => $ID, |
195 | 195 | ]; |
196 | - $url = esc_url_raw( |
|
196 | + $url = esc_url_raw( |
|
197 | 197 | EE_Admin_Page::add_query_args_and_nonce($details_query_args, EE_PAYMENTS_ADMIN_URL) |
198 | 198 | ); |
199 | 199 | return "<a href='$url'>{$ID}</a>"; |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | ['action' => 'view_transaction', 'TXN_ID' => $transaction_id], |
269 | 269 | TXN_ADMIN_URL |
270 | 270 | ); |
271 | - return '<a href="' . esc_url_raw($view_txn_lnk_url) . '" ' |
|
272 | - . 'title="' . sprintf( |
|
271 | + return '<a href="'.esc_url_raw($view_txn_lnk_url).'" ' |
|
272 | + . 'title="'.sprintf( |
|
273 | 273 | esc_attr__('click to view transaction #%s', 'event_espresso'), |
274 | 274 | $transaction_id |
275 | - ) . '">' |
|
275 | + ).'">' |
|
276 | 276 | . sprintf(esc_html__('view txn %s', 'event_espresso'), $transaction_id) |
277 | 277 | . '</a>'; |
278 | 278 | } |
@@ -15,1198 +15,1198 @@ |
||
15 | 15 | class Payments_Admin_Page extends EE_Admin_Page |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * Variables used for when we're re-sorting the logs results, |
|
20 | - * in case we needed to do two queries, and we need to resort |
|
21 | - * |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - private $_sort_logs_again_direction; |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * @Constructor |
|
29 | - * @access public |
|
30 | - * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
|
31 | - * @throws EE_Error |
|
32 | - * @throws InvalidArgumentException |
|
33 | - * @throws InvalidDataTypeException |
|
34 | - * @throws InvalidInterfaceException |
|
35 | - * @throws ReflectionException |
|
36 | - */ |
|
37 | - public function __construct($routing = true) |
|
38 | - { |
|
39 | - parent::__construct($routing); |
|
40 | - } |
|
41 | - |
|
42 | - |
|
43 | - protected function _init_page_props() |
|
44 | - { |
|
45 | - $this->page_slug = EE_PAYMENTS_PG_SLUG; |
|
46 | - $this->page_label = esc_html__('Payment Methods', 'event_espresso'); |
|
47 | - $this->_admin_base_url = EE_PAYMENTS_ADMIN_URL; |
|
48 | - $this->_admin_base_path = EE_PAYMENTS_ADMIN; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - protected function _ajax_hooks() |
|
53 | - { |
|
54 | - // todo: all hooks for ajax goes here. |
|
55 | - } |
|
56 | - |
|
57 | - |
|
58 | - protected function _define_page_props() |
|
59 | - { |
|
60 | - $this->_admin_page_title = $this->page_label; |
|
61 | - $this->_labels = array( |
|
62 | - 'publishbox' => esc_html__('Update Settings', 'event_espresso'), |
|
63 | - ); |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - protected function _set_page_routes() |
|
68 | - { |
|
69 | - /** |
|
70 | - * note that with payment method capabilities, although we've implemented |
|
71 | - * capability mapping which will be used for accessing payment methods owned by |
|
72 | - * other users. This is not fully implemented yet in the payment method ui. |
|
73 | - * Currently, only the "plural" caps are in active use. |
|
74 | - * When cap mapping is implemented, some routes will need to use the singular form of |
|
75 | - * capability method and also include the $id of the payment method for the route. |
|
76 | - **/ |
|
77 | - $this->_page_routes = array( |
|
78 | - 'default' => array( |
|
79 | - 'func' => '_payment_methods_list', |
|
80 | - 'capability' => 'ee_edit_payment_methods', |
|
81 | - ), |
|
82 | - 'payment_settings' => array( |
|
83 | - 'func' => '_payment_settings', |
|
84 | - 'capability' => 'ee_manage_gateways', |
|
85 | - ), |
|
86 | - 'activate_payment_method' => array( |
|
87 | - 'func' => '_activate_payment_method', |
|
88 | - 'noheader' => true, |
|
89 | - 'capability' => 'ee_edit_payment_methods', |
|
90 | - ), |
|
91 | - 'deactivate_payment_method' => array( |
|
92 | - 'func' => '_deactivate_payment_method', |
|
93 | - 'noheader' => true, |
|
94 | - 'capability' => 'ee_delete_payment_methods', |
|
95 | - ), |
|
96 | - 'update_payment_method' => array( |
|
97 | - 'func' => '_update_payment_method', |
|
98 | - 'noheader' => true, |
|
99 | - 'headers_sent_route' => 'default', |
|
100 | - 'capability' => 'ee_edit_payment_methods', |
|
101 | - ), |
|
102 | - 'update_payment_settings' => array( |
|
103 | - 'func' => '_update_payment_settings', |
|
104 | - 'noheader' => true, |
|
105 | - 'capability' => 'ee_manage_gateways', |
|
106 | - ), |
|
107 | - 'payment_log' => array( |
|
108 | - 'func' => '_payment_log_overview_list_table', |
|
109 | - 'capability' => 'ee_read_payment_methods', |
|
110 | - ), |
|
111 | - 'payment_log_details' => array( |
|
112 | - 'func' => '_payment_log_details', |
|
113 | - 'capability' => 'ee_read_payment_methods', |
|
114 | - ), |
|
115 | - ); |
|
116 | - } |
|
117 | - |
|
118 | - |
|
119 | - /** |
|
120 | - * @throws EE_Error |
|
121 | - * @throws ReflectionException |
|
122 | - */ |
|
123 | - protected function _set_page_config() |
|
124 | - { |
|
125 | - $payment_method_list_config = array( |
|
126 | - 'nav' => array( |
|
127 | - 'label' => esc_html__('Payment Methods', 'event_espresso'), |
|
128 | - 'order' => 10, |
|
129 | - ), |
|
130 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
131 | - 'help_tabs' => array_merge( |
|
132 | - array( |
|
133 | - 'payment_methods_overview_help_tab' => array( |
|
134 | - 'title' => esc_html__('Payment Methods Overview', 'event_espresso'), |
|
135 | - 'filename' => 'payment_methods_overview', |
|
136 | - ), |
|
137 | - ), |
|
138 | - $this->_add_payment_method_help_tabs() |
|
139 | - ), |
|
140 | - // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
141 | - // 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
142 | - 'require_nonce' => false, |
|
143 | - ); |
|
144 | - $this->_page_config = array( |
|
145 | - 'default' => $payment_method_list_config, |
|
146 | - 'payment_settings' => array( |
|
147 | - 'nav' => array( |
|
148 | - 'label' => esc_html__('Settings', 'event_espresso'), |
|
149 | - 'order' => 20, |
|
150 | - ), |
|
151 | - 'help_tabs' => array( |
|
152 | - 'payment_methods_settings_help_tab' => array( |
|
153 | - 'title' => esc_html__('Payment Method Settings', 'event_espresso'), |
|
154 | - 'filename' => 'payment_methods_settings', |
|
155 | - ), |
|
156 | - ), |
|
157 | - // 'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
|
158 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
159 | - 'require_nonce' => false, |
|
160 | - ), |
|
161 | - 'payment_log' => array( |
|
162 | - 'nav' => array( |
|
163 | - 'label' => esc_html__("Logs", 'event_espresso'), |
|
164 | - 'order' => 30, |
|
165 | - ), |
|
166 | - 'list_table' => 'Payment_Log_Admin_List_Table', |
|
167 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
168 | - 'require_nonce' => false, |
|
169 | - ), |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * @return array |
|
176 | - * @throws DomainException |
|
177 | - * @throws EE_Error |
|
178 | - * @throws InvalidArgumentException |
|
179 | - * @throws InvalidDataTypeException |
|
180 | - * @throws InvalidInterfaceException |
|
181 | - * @throws ReflectionException |
|
182 | - */ |
|
183 | - protected function _add_payment_method_help_tabs() |
|
184 | - { |
|
185 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
186 | - $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
|
187 | - $all_pmt_help_tabs_config = array(); |
|
188 | - foreach ($payment_method_types as $payment_method_type) { |
|
189 | - if ( |
|
190 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
191 | - $payment_method_type->cap_name(), |
|
192 | - 'specific_payment_method_type_access' |
|
193 | - ) |
|
194 | - ) { |
|
195 | - continue; |
|
196 | - } |
|
197 | - foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
198 | - $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
199 | - $template_args['admin_page_obj'] = $this; |
|
200 | - $all_pmt_help_tabs_config[ $help_tab_name ] = array( |
|
201 | - 'title' => $config['title'], |
|
202 | - 'content' => EEH_Template::display_template( |
|
203 | - $payment_method_type->file_folder() . 'help_tabs/' . $config['filename'] . '.help_tab.php', |
|
204 | - $template_args, |
|
205 | - true |
|
206 | - ), |
|
207 | - ); |
|
208 | - } |
|
209 | - } |
|
210 | - return $all_pmt_help_tabs_config; |
|
211 | - } |
|
212 | - |
|
213 | - |
|
214 | - // none of the below group are currently used for Gateway Settings |
|
215 | - protected function _add_screen_options() |
|
216 | - { |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - protected function _add_feature_pointers() |
|
221 | - { |
|
222 | - } |
|
223 | - |
|
224 | - |
|
225 | - public function admin_init() |
|
226 | - { |
|
227 | - } |
|
228 | - |
|
229 | - |
|
230 | - public function admin_notices() |
|
231 | - { |
|
232 | - } |
|
233 | - |
|
234 | - |
|
235 | - public function admin_footer_scripts() |
|
236 | - { |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - public function load_scripts_styles() |
|
241 | - { |
|
242 | - // styles |
|
243 | - wp_enqueue_style('espresso-ui-theme'); |
|
244 | - // scripts |
|
245 | - wp_enqueue_script('ee_admin_js'); |
|
246 | - wp_enqueue_script('ee-text-links'); |
|
247 | - wp_enqueue_script( |
|
248 | - 'espresso_payments', |
|
249 | - EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', |
|
250 | - array('ee-datepicker'), |
|
251 | - EVENT_ESPRESSO_VERSION, |
|
252 | - true |
|
253 | - ); |
|
254 | - } |
|
255 | - |
|
256 | - |
|
257 | - public function load_scripts_styles_default() |
|
258 | - { |
|
259 | - // styles |
|
260 | - wp_register_style( |
|
261 | - 'espresso_payments', |
|
262 | - EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', |
|
263 | - array(), |
|
264 | - EVENT_ESPRESSO_VERSION |
|
265 | - ); |
|
266 | - wp_enqueue_style('espresso_payments'); |
|
267 | - wp_enqueue_style('ee-text-links'); |
|
268 | - // scripts |
|
269 | - } |
|
270 | - |
|
271 | - |
|
272 | - /** |
|
273 | - * @throws EE_Error |
|
274 | - * @throws ReflectionException |
|
275 | - */ |
|
276 | - protected function _payment_methods_list() |
|
277 | - { |
|
278 | - /** |
|
279 | - * first let's ensure payment methods have been set up. |
|
280 | - * We do this here because when people activate a payment method for the first time (as an addon), |
|
281 | - * it may not set up its capabilities or get registered correctly due to the loading process. |
|
282 | - * However, people MUST set up the details for the payment method, |
|
283 | - * so it's safe to do a recheck here. |
|
284 | - */ |
|
285 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
286 | - EEM_Payment_Method::instance()->verify_button_urls(); |
|
287 | - // set up tabs, one for each payment method type |
|
288 | - $tabs = array(); |
|
289 | - $payment_methods = array(); |
|
290 | - foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
291 | - // we don't want to show admin-only PMTs for now |
|
292 | - if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
293 | - continue; |
|
294 | - } |
|
295 | - // check access |
|
296 | - if ( |
|
297 | - ! EE_Registry::instance()->CAP->current_user_can( |
|
298 | - $pmt_obj->cap_name(), |
|
299 | - 'specific_payment_method_type_access' |
|
300 | - ) |
|
301 | - ) { |
|
302 | - continue; |
|
303 | - } |
|
304 | - // check for any active pms of that type |
|
305 | - $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
306 | - if (! $payment_method instanceof EE_Payment_Method) { |
|
307 | - $payment_method = EE_Payment_Method::new_instance( |
|
308 | - array( |
|
309 | - 'PMD_slug' => sanitize_key($pmt_obj->system_name()), |
|
310 | - 'PMD_type' => $pmt_obj->system_name(), |
|
311 | - 'PMD_name' => $pmt_obj->pretty_name(), |
|
312 | - 'PMD_admin_name' => $pmt_obj->pretty_name(), |
|
313 | - ) |
|
314 | - ); |
|
315 | - } |
|
316 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
317 | - } |
|
318 | - $payment_methods = apply_filters( |
|
319 | - 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
|
320 | - $payment_methods |
|
321 | - ); |
|
322 | - foreach ($payment_methods as $payment_method) { |
|
323 | - if ($payment_method instanceof EE_Payment_Method) { |
|
324 | - add_meta_box( |
|
325 | - // html id |
|
326 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
327 | - // title |
|
328 | - sprintf(esc_html__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
329 | - // callback |
|
330 | - array($this, 'payment_method_settings_meta_box'), |
|
331 | - // post type |
|
332 | - null, |
|
333 | - // context |
|
334 | - 'normal', |
|
335 | - // priority |
|
336 | - 'default', |
|
337 | - // callback args |
|
338 | - array('payment_method' => $payment_method) |
|
339 | - ); |
|
340 | - // setup for tabbed content |
|
341 | - $tabs[ $payment_method->slug() ] = array( |
|
342 | - 'label' => $payment_method->admin_name(), |
|
343 | - 'class' => $payment_method->active() ? 'gateway-active' : '', |
|
344 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
345 | - 'title' => esc_html__('Modify this Payment Method', 'event_espresso'), |
|
346 | - 'slug' => $payment_method->slug(), |
|
347 | - ); |
|
348 | - } |
|
349 | - } |
|
350 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( |
|
351 | - $tabs, |
|
352 | - 'payment_method_links', |
|
353 | - '|', |
|
354 | - $this->_get_active_payment_method_slug() |
|
355 | - ); |
|
356 | - $this->display_admin_page_with_sidebar(); |
|
357 | - } |
|
358 | - |
|
359 | - |
|
360 | - /** |
|
361 | - * _get_active_payment_method_slug |
|
362 | - * |
|
363 | - * @return string |
|
364 | - * @throws EE_Error |
|
365 | - */ |
|
366 | - protected function _get_active_payment_method_slug() |
|
367 | - { |
|
368 | - $payment_method_slug = false; |
|
369 | - // decide which payment method tab to open first, as dictated by the request's 'payment_method' |
|
370 | - if (isset($this->_req_data['payment_method'])) { |
|
371 | - // if they provided the current payment method, use it |
|
372 | - $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
373 | - } |
|
374 | - /** @var EE_Payment_Method $payment_method */ |
|
375 | - $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
376 | - // if that didn't work or wasn't provided, find another way to select the current pm |
|
377 | - if (! $this->_verify_payment_method($payment_method)) { |
|
378 | - // like, looking for an active one |
|
379 | - $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
380 | - // test that one as well |
|
381 | - if ($this->_verify_payment_method($payment_method)) { |
|
382 | - $payment_method_slug = $payment_method->slug(); |
|
383 | - } else { |
|
384 | - $payment_method_slug = 'paypal_standard'; |
|
385 | - } |
|
386 | - } |
|
387 | - return $payment_method_slug; |
|
388 | - } |
|
389 | - |
|
390 | - |
|
391 | - /** |
|
392 | - * payment_method_settings_meta_box |
|
393 | - * returns TRUE if the passed payment method is properly constructed and the logged-in user has the correct |
|
394 | - * capabilities to access it |
|
395 | - * |
|
396 | - * @param EE_Payment_Method $payment_method |
|
397 | - * @return boolean |
|
398 | - * @throws EE_Error |
|
399 | - */ |
|
400 | - protected function _verify_payment_method($payment_method) |
|
401 | - { |
|
402 | - if ( |
|
403 | - $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base |
|
404 | - && EE_Registry::instance()->CAP->current_user_can( |
|
405 | - $payment_method->type_obj()->cap_name(), |
|
406 | - 'specific_payment_method_type_access' |
|
407 | - ) |
|
408 | - ) { |
|
409 | - return true; |
|
410 | - } |
|
411 | - return false; |
|
412 | - } |
|
413 | - |
|
414 | - |
|
415 | - /** |
|
416 | - * payment_method_settings_meta_box |
|
417 | - * |
|
418 | - * @param NULL $post_obj_which_is_null is an object containing the current post (as a $post object) |
|
419 | - * @param array $metabox is an array with metabox id, title, callback, and args elements. the value |
|
420 | - * at 'args' has key 'payment_method', as set within _payment_methods_list |
|
421 | - * @return void |
|
422 | - * @throws EE_Error |
|
423 | - * @throws ReflectionException |
|
424 | - */ |
|
425 | - public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) |
|
426 | - { |
|
427 | - $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) |
|
428 | - ? $metabox['args']['payment_method'] : null; |
|
429 | - if (! $payment_method instanceof EE_Payment_Method) { |
|
430 | - throw new EE_Error( |
|
431 | - esc_html__( |
|
432 | - 'Payment method metabox setup incorrectly. No Payment method object was supplied', |
|
433 | - 'event_espresso' |
|
434 | - ) |
|
435 | - ); |
|
436 | - } |
|
437 | - $payment_method_scopes = $payment_method->active(); |
|
438 | - // if the payment method really exists show its form, otherwise the activation template |
|
439 | - if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
440 | - $form = $this->_generate_payment_method_settings_form($payment_method); |
|
441 | - if ($form->form_data_present_in($this->_req_data)) { |
|
442 | - $form->receive_form_submission($this->_req_data); |
|
443 | - } |
|
444 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); // already escaped |
|
445 | - } else { |
|
446 | - echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); // already escaped |
|
447 | - } |
|
448 | - } |
|
449 | - |
|
450 | - |
|
451 | - /** |
|
452 | - * Gets the form for all the settings related to this payment method type |
|
453 | - * |
|
454 | - * @access protected |
|
455 | - * @param EE_Payment_Method $payment_method |
|
456 | - * @return EE_Form_Section_Proper |
|
457 | - * @throws EE_Error |
|
458 | - */ |
|
459 | - protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method = null) |
|
460 | - { |
|
461 | - if (! $payment_method instanceof EE_Payment_Method) { |
|
462 | - return new EE_Form_Section_Proper(); |
|
463 | - } |
|
464 | - return new EE_Form_Section_Proper( |
|
465 | - array( |
|
466 | - 'name' => $payment_method->slug() . '_settings_form', |
|
467 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
468 | - 'action' => EE_Admin_Page::add_query_args_and_nonce( |
|
469 | - array( |
|
470 | - 'action' => 'update_payment_method', |
|
471 | - 'payment_method' => $payment_method->slug(), |
|
472 | - ), |
|
473 | - EE_PAYMENTS_ADMIN_URL |
|
474 | - ), |
|
475 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
476 | - 'subsections' => apply_filters( |
|
477 | - 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
|
478 | - array( |
|
479 | - 'pci_dss_compliance' => $this->_pci_dss_compliance($payment_method), |
|
480 | - 'currency_support' => $this->_currency_support($payment_method), |
|
481 | - 'payment_method_settings' => $this->_payment_method_settings($payment_method), |
|
482 | - 'update' => $this->_update_payment_method_button($payment_method), |
|
483 | - 'deactivate' => $this->_deactivate_payment_method_button($payment_method), |
|
484 | - 'fine_print' => $this->_fine_print(), |
|
485 | - ), |
|
486 | - $payment_method |
|
487 | - ), |
|
488 | - ) |
|
489 | - ); |
|
490 | - } |
|
491 | - |
|
492 | - |
|
493 | - /** |
|
494 | - * _pci_dss_compliance |
|
495 | - * |
|
496 | - * @access protected |
|
497 | - * @param EE_Payment_Method $payment_method |
|
498 | - * @return EE_Form_Section_HTML |
|
499 | - * @throws EE_Error |
|
500 | - */ |
|
501 | - protected function _pci_dss_compliance(EE_Payment_Method $payment_method) |
|
502 | - { |
|
503 | - if ($payment_method->type_obj()->requires_https()) { |
|
504 | - return new EE_Form_Section_HTML( |
|
505 | - EEH_HTML::table( |
|
506 | - EEH_HTML::tr( |
|
507 | - EEH_HTML::th( |
|
508 | - EEH_HTML::label( |
|
509 | - EEH_HTML::strong( |
|
510 | - esc_html__('IMPORTANT', 'event_espresso'), |
|
511 | - '', |
|
512 | - 'important-notice' |
|
513 | - ) |
|
514 | - ) |
|
515 | - ) . |
|
516 | - EEH_HTML::td( |
|
517 | - EEH_HTML::strong( |
|
518 | - esc_html__( |
|
519 | - 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', |
|
520 | - 'event_espresso' |
|
521 | - ) |
|
522 | - ) |
|
523 | - . |
|
524 | - EEH_HTML::br() |
|
525 | - . |
|
526 | - esc_html__('Learn more about ', 'event_espresso') |
|
527 | - . EEH_HTML::link( |
|
528 | - 'https://www.pcisecuritystandards.org/merchants/index.php', |
|
529 | - esc_html__('PCI DSS compliance', 'event_espresso') |
|
530 | - ) |
|
531 | - ) |
|
532 | - ) |
|
533 | - ) |
|
534 | - ); |
|
535 | - } |
|
536 | - return new EE_Form_Section_HTML(''); |
|
537 | - } |
|
538 | - |
|
539 | - |
|
540 | - /** |
|
541 | - * _currency_support |
|
542 | - * |
|
543 | - * @access protected |
|
544 | - * @param EE_Payment_Method $payment_method |
|
545 | - * @return EE_Form_Section_HTML |
|
546 | - * @throws EE_Error |
|
547 | - */ |
|
548 | - protected function _currency_support(EE_Payment_Method $payment_method) |
|
549 | - { |
|
550 | - if (! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
551 | - return new EE_Form_Section_HTML( |
|
552 | - EEH_HTML::table( |
|
553 | - EEH_HTML::tr( |
|
554 | - EEH_HTML::th( |
|
555 | - EEH_HTML::label( |
|
556 | - EEH_HTML::strong( |
|
557 | - esc_html__('IMPORTANT', 'event_espresso'), |
|
558 | - '', |
|
559 | - 'important-notice' |
|
560 | - ) |
|
561 | - ) |
|
562 | - ) . |
|
563 | - EEH_HTML::td( |
|
564 | - EEH_HTML::strong( |
|
565 | - sprintf( |
|
566 | - esc_html__( |
|
567 | - 'This payment method does not support the currency set on your site (%1$s). Please activate a different payment method or change your site\'s country and associated currency.', |
|
568 | - 'event_espresso' |
|
569 | - ), |
|
570 | - EE_Config::instance()->currency->code |
|
571 | - ) |
|
572 | - ) |
|
573 | - ) |
|
574 | - ) |
|
575 | - ) |
|
576 | - ); |
|
577 | - } |
|
578 | - return new EE_Form_Section_HTML(''); |
|
579 | - } |
|
580 | - |
|
581 | - |
|
582 | - /** |
|
583 | - * _update_payment_method_button |
|
584 | - * |
|
585 | - * @access protected |
|
586 | - * @param EE_Payment_Method $payment_method |
|
587 | - * @return EE_Payment_Method_Form |
|
588 | - * @throws EE_Error |
|
589 | - */ |
|
590 | - protected function _payment_method_settings(EE_Payment_Method $payment_method) |
|
591 | - { |
|
592 | - // modify the form, so we only have/show fields that will be implemented for this version |
|
593 | - return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
594 | - } |
|
595 | - |
|
596 | - |
|
597 | - /** |
|
598 | - * Simplifies the form to merely reproduce 4.1's gateway settings functionality |
|
599 | - * |
|
600 | - * @param EE_Form_Section_Proper $form_section |
|
601 | - * @param string $payment_method_name |
|
602 | - * @return EE_Payment_Method_Form |
|
603 | - * @throws EE_Error |
|
604 | - */ |
|
605 | - protected function _simplify_form($form_section, $payment_method_name = '') |
|
606 | - { |
|
607 | - if ($form_section instanceof EE_Payment_Method_Form) { |
|
608 | - $form_section->exclude( |
|
609 | - array( |
|
610 | - 'PMD_type', // don't want them changing the type |
|
611 | - 'PMD_slug', // or the slug (probably never) |
|
612 | - 'PMD_wp_user', // or the user's ID |
|
613 | - 'Currency' // or the currency, until the rest of EE supports simultaneous currencies |
|
614 | - ) |
|
615 | - ); |
|
616 | - return $form_section; |
|
617 | - } else { |
|
618 | - throw new EE_Error( |
|
619 | - sprintf( |
|
620 | - esc_html__( |
|
621 | - 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', |
|
622 | - 'event_espresso' |
|
623 | - ), |
|
624 | - $payment_method_name |
|
625 | - ) |
|
626 | - ); |
|
627 | - } |
|
628 | - } |
|
629 | - |
|
630 | - |
|
631 | - /** |
|
632 | - * _update_payment_method_button |
|
633 | - * |
|
634 | - * @access protected |
|
635 | - * @param EE_Payment_Method $payment_method |
|
636 | - * @return EE_Form_Section_HTML |
|
637 | - * @throws EE_Error |
|
638 | - */ |
|
639 | - protected function _update_payment_method_button(EE_Payment_Method $payment_method) |
|
640 | - { |
|
641 | - $update_button = new EE_Submit_Input( |
|
642 | - array( |
|
643 | - 'name' => 'submit', |
|
644 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
645 | - 'default' => sprintf( |
|
646 | - esc_html__('Update %s Payment Settings', 'event_espresso'), |
|
647 | - $payment_method->admin_name() |
|
648 | - ), |
|
649 | - 'html_label' => EEH_HTML::nbsp(), |
|
650 | - ) |
|
651 | - ); |
|
652 | - return new EE_Form_Section_HTML( |
|
653 | - EEH_HTML::table( |
|
654 | - EEH_HTML::no_row(EEH_HTML::br(2)) . |
|
655 | - EEH_HTML::tr( |
|
656 | - EEH_HTML::th(esc_html__('Update Settings', 'event_espresso')) . |
|
657 | - EEH_HTML::td( |
|
658 | - $update_button->get_html_for_input() |
|
659 | - ) |
|
660 | - ) |
|
661 | - ) |
|
662 | - ); |
|
663 | - } |
|
664 | - |
|
665 | - |
|
666 | - /** |
|
667 | - * _deactivate_payment_method_button |
|
668 | - * |
|
669 | - * @access protected |
|
670 | - * @param EE_Payment_Method $payment_method |
|
671 | - * @return EE_Form_Section_HTML |
|
672 | - */ |
|
673 | - protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) |
|
674 | - { |
|
675 | - $link_text_and_title = sprintf( |
|
676 | - esc_html__('Deactivate %1$s Payments?', 'event_espresso'), |
|
677 | - $payment_method->admin_name() |
|
678 | - ); |
|
679 | - return new EE_Form_Section_HTML( |
|
680 | - EEH_HTML::table( |
|
681 | - EEH_HTML::tr( |
|
682 | - EEH_HTML::th(esc_html__('Deactivate Payment Method', 'event_espresso')) . |
|
683 | - EEH_HTML::td( |
|
684 | - EEH_HTML::link( |
|
685 | - EE_Admin_Page::add_query_args_and_nonce( |
|
686 | - array( |
|
687 | - 'action' => 'deactivate_payment_method', |
|
688 | - 'payment_method' => $payment_method->slug(), |
|
689 | - ), |
|
690 | - EE_PAYMENTS_ADMIN_URL |
|
691 | - ), |
|
692 | - $link_text_and_title, |
|
693 | - $link_text_and_title, |
|
694 | - 'deactivate_' . $payment_method->slug(), |
|
695 | - 'espresso-button button-secondary' |
|
696 | - ) |
|
697 | - ) |
|
698 | - ) |
|
699 | - ) |
|
700 | - ); |
|
701 | - } |
|
702 | - |
|
703 | - |
|
704 | - /** |
|
705 | - * _activate_payment_method_button |
|
706 | - * |
|
707 | - * @access protected |
|
708 | - * @param EE_Payment_Method $payment_method |
|
709 | - * @return EE_Form_Section_Proper |
|
710 | - * @throws EE_Error |
|
711 | - */ |
|
712 | - protected function _activate_payment_method_button(EE_Payment_Method $payment_method) |
|
713 | - { |
|
714 | - $link_text_and_title = sprintf( |
|
715 | - esc_html__('Activate %1$s Payment Method?', 'event_espresso'), |
|
716 | - $payment_method->admin_name() |
|
717 | - ); |
|
718 | - return new EE_Form_Section_Proper( |
|
719 | - array( |
|
720 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
721 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
722 | - 'action' => '#', |
|
723 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
724 | - 'subsections' => apply_filters( |
|
725 | - 'FHEE__Payments_Admin_Page___activate_payment_method_button__form_subsections', |
|
726 | - array( |
|
727 | - new EE_Form_Section_HTML( |
|
728 | - EEH_HTML::table( |
|
729 | - EEH_HTML::tr( |
|
730 | - EEH_HTML::td( |
|
731 | - $payment_method->type_obj()->introductory_html(), |
|
732 | - '', |
|
733 | - '', |
|
734 | - '', |
|
735 | - 'colspan="2"' |
|
736 | - ) |
|
737 | - ) . |
|
738 | - EEH_HTML::tr( |
|
739 | - EEH_HTML::th( |
|
740 | - EEH_HTML::label(esc_html__('Click to Activate ', 'event_espresso')) |
|
741 | - ) . |
|
742 | - EEH_HTML::td( |
|
743 | - EEH_HTML::link( |
|
744 | - EE_Admin_Page::add_query_args_and_nonce( |
|
745 | - array( |
|
746 | - 'action' => 'activate_payment_method', |
|
747 | - 'payment_method_type' => $payment_method->type(), |
|
748 | - ), |
|
749 | - EE_PAYMENTS_ADMIN_URL |
|
750 | - ), |
|
751 | - $link_text_and_title, |
|
752 | - $link_text_and_title, |
|
753 | - 'activate_' . $payment_method->slug(), |
|
754 | - 'espresso-button-green button-primary' |
|
755 | - ) |
|
756 | - ) |
|
757 | - ) |
|
758 | - ) |
|
759 | - ), |
|
760 | - ), |
|
761 | - $payment_method |
|
762 | - ), |
|
763 | - ) |
|
764 | - ); |
|
765 | - } |
|
766 | - |
|
767 | - |
|
768 | - /** |
|
769 | - * _fine_print |
|
770 | - * |
|
771 | - * @access protected |
|
772 | - * @return EE_Form_Section_HTML |
|
773 | - */ |
|
774 | - protected function _fine_print() |
|
775 | - { |
|
776 | - return new EE_Form_Section_HTML( |
|
777 | - EEH_HTML::table( |
|
778 | - EEH_HTML::tr( |
|
779 | - EEH_HTML::th() . |
|
780 | - EEH_HTML::td( |
|
781 | - EEH_HTML::p(esc_html__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
782 | - ) |
|
783 | - ) |
|
784 | - ) |
|
785 | - ); |
|
786 | - } |
|
787 | - |
|
788 | - |
|
789 | - /** |
|
790 | - * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
|
791 | - * |
|
792 | - * @throws EE_Error |
|
793 | - * @throws ReflectionException |
|
794 | - * @global WP_User $current_user |
|
795 | - */ |
|
796 | - protected function _activate_payment_method() |
|
797 | - { |
|
798 | - if (isset($this->_req_data['payment_method_type'])) { |
|
799 | - $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
|
800 | - // see if one exists |
|
801 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
802 | - $payment_method = EE_Payment_Method_Manager::instance() |
|
803 | - ->activate_a_payment_method_of_type($payment_method_type); |
|
804 | - $this->_redirect_after_action( |
|
805 | - 1, |
|
806 | - 'Payment Method', |
|
807 | - 'activated', |
|
808 | - array('action' => 'default', 'payment_method' => $payment_method->slug()) |
|
809 | - ); |
|
810 | - } else { |
|
811 | - $this->_redirect_after_action(false, 'Payment Method', 'activated', array('action' => 'default')); |
|
812 | - } |
|
813 | - } |
|
814 | - |
|
815 | - |
|
816 | - /** |
|
817 | - * @throws EE_Error |
|
818 | - * @throws ReflectionException |
|
819 | - */ |
|
820 | - protected function _deactivate_payment_method() |
|
821 | - { |
|
822 | - if (isset($this->_req_data['payment_method'])) { |
|
823 | - $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
824 | - // deactivate it |
|
825 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
826 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
827 | - $this->_redirect_after_action( |
|
828 | - $count_updated, |
|
829 | - 'Payment Method', |
|
830 | - 'deactivated', |
|
831 | - array('action' => 'default', 'payment_method' => $payment_method_slug) |
|
832 | - ); |
|
833 | - } else { |
|
834 | - $this->_redirect_after_action(false, 'Payment Method', 'deactivated', array('action' => 'default')); |
|
835 | - } |
|
836 | - } |
|
837 | - |
|
838 | - |
|
839 | - /** |
|
840 | - * Processes the payment method form that was submitted. This is slightly trickier than usual form |
|
841 | - * processing because we first need to identify WHICH form was processed and which payment method |
|
842 | - * it corresponds to. Once we have done that, we see if the form is valid. If it is, the |
|
843 | - * form's data is saved, and we redirect to the default payment methods page, setting the updated payment method |
|
844 | - * as the currently-selected one. If it DOESN'T validate, we render the page with the form's errors (in the |
|
845 | - * subsequently called 'headers_sent_func' which is _payment_methods_list) |
|
846 | - * |
|
847 | - * @return void |
|
848 | - * @throws EE_Error |
|
849 | - * @throws ReflectionException |
|
850 | - */ |
|
851 | - protected function _update_payment_method() |
|
852 | - { |
|
853 | - if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
854 | - // ok let's find which gateway form to use based on the form input |
|
855 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
856 | - /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
|
857 | - $correct_pmt_form_to_use = null; |
|
858 | - $payment_method = null; |
|
859 | - foreach (EEM_Payment_Method::instance()->get_all() as $payment_method) { |
|
860 | - if ($payment_method instanceof EE_Payment_Method) { |
|
861 | - // get the form and simplify it, like what we do when we display it |
|
862 | - $pmt_form = $this->_generate_payment_method_settings_form($payment_method); |
|
863 | - if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
864 | - $correct_pmt_form_to_use = $pmt_form; |
|
865 | - break; |
|
866 | - } |
|
867 | - } |
|
868 | - } |
|
869 | - // if we couldn't find the correct payment method type... |
|
870 | - if (! $correct_pmt_form_to_use) { |
|
871 | - EE_Error::add_error( |
|
872 | - esc_html__( |
|
873 | - "We could not find which payment method type your form submission related to. Please contact support", |
|
874 | - 'event_espresso' |
|
875 | - ), |
|
876 | - __FILE__, |
|
877 | - __FUNCTION__, |
|
878 | - __LINE__ |
|
879 | - ); |
|
880 | - $this->_redirect_after_action(false, 'Payment Method', 'activated', array('action' => 'default')); |
|
881 | - } |
|
882 | - $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
|
883 | - if ($correct_pmt_form_to_use->is_valid()) { |
|
884 | - $payment_settings_subform = $correct_pmt_form_to_use->get_subsection('payment_method_settings'); |
|
885 | - if (! $payment_settings_subform instanceof EE_Payment_Method_Form) { |
|
886 | - throw new EE_Error( |
|
887 | - sprintf( |
|
888 | - esc_html__( |
|
889 | - 'The payment method could not be saved because the form sections were misnamed. We expected to find %1$s, but did not.', |
|
890 | - 'event_espresso' |
|
891 | - ), |
|
892 | - 'payment_method_settings' |
|
893 | - ) |
|
894 | - ); |
|
895 | - } |
|
896 | - $payment_settings_subform->save(); |
|
897 | - /** @var $pm EE_Payment_Method */ |
|
898 | - $this->_redirect_after_action( |
|
899 | - true, |
|
900 | - 'Payment Method', |
|
901 | - 'updated', |
|
902 | - array('action' => 'default', 'payment_method' => $payment_method->slug()) |
|
903 | - ); |
|
904 | - } else { |
|
905 | - EE_Error::add_error( |
|
906 | - sprintf( |
|
907 | - esc_html__( |
|
908 | - 'Payment method of type %s was not saved because there were validation errors. They have been marked in the form', |
|
909 | - 'event_espresso' |
|
910 | - ), |
|
911 | - $payment_method instanceof EE_Payment_Method ? $payment_method->type_obj()->pretty_name() |
|
912 | - : esc_html__('"(unknown)"', 'event_espresso') |
|
913 | - ), |
|
914 | - __FILE__, |
|
915 | - __FUNCTION__, |
|
916 | - __LINE__ |
|
917 | - ); |
|
918 | - } |
|
919 | - } |
|
920 | - } |
|
921 | - |
|
922 | - |
|
923 | - /** |
|
924 | - * Displays payment settings (not payment METHOD settings, that's _payment_method_settings) |
|
925 | - * @throws DomainException |
|
926 | - * @throws EE_Error |
|
927 | - * @throws InvalidArgumentException |
|
928 | - * @throws InvalidDataTypeException |
|
929 | - * @throws InvalidInterfaceException |
|
930 | - */ |
|
931 | - protected function _payment_settings() |
|
932 | - { |
|
933 | - $form = $this->getPaymentSettingsForm(); |
|
934 | - $this->_set_add_edit_form_tags('update_payment_settings'); |
|
935 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
936 | - $this->_template_args['admin_page_content'] = $form->get_html_and_js(); |
|
937 | - $this->display_admin_page_with_sidebar(); |
|
938 | - } |
|
939 | - |
|
940 | - |
|
941 | - /** |
|
942 | - * _update_payment_settings |
|
943 | - * |
|
944 | - * @access protected |
|
945 | - * @return void |
|
946 | - * @throws EE_Error |
|
947 | - * @throws InvalidArgumentException |
|
948 | - * @throws InvalidDataTypeException |
|
949 | - * @throws InvalidInterfaceException |
|
950 | - */ |
|
951 | - protected function _update_payment_settings() |
|
952 | - { |
|
953 | - $form = $this->getPaymentSettingsForm(); |
|
954 | - if ($form->was_submitted($this->_req_data)) { |
|
955 | - $form->receive_form_submission($this->_req_data); |
|
956 | - if ($form->is_valid()) { |
|
957 | - /** |
|
958 | - * @var $reg_config EE_Registration_Config |
|
959 | - */ |
|
960 | - $loader = LoaderFactory::getLoader(); |
|
961 | - $reg_config = $loader->getShared('EE_Registration_Config'); |
|
962 | - $valid_data = $form->valid_data(); |
|
963 | - $reg_config->show_pending_payment_options = $valid_data['show_pending_payment_options']; |
|
964 | - $reg_config->gateway_log_lifespan = $valid_data['gateway_log_lifespan']; |
|
965 | - } |
|
966 | - } |
|
967 | - EE_Registry::instance()->CFG = apply_filters( |
|
968 | - 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', |
|
969 | - EE_Registry::instance()->CFG |
|
970 | - ); |
|
971 | - |
|
972 | - $what = esc_html__('Payment Settings', 'event_espresso'); |
|
973 | - $success = $this->_update_espresso_configuration( |
|
974 | - $what, |
|
975 | - EE_Registry::instance()->CFG, |
|
976 | - __FILE__, |
|
977 | - __FUNCTION__, |
|
978 | - __LINE__ |
|
979 | - ); |
|
980 | - $this->_redirect_after_action( |
|
981 | - $success, |
|
982 | - $what, |
|
983 | - esc_html__('updated', 'event_espresso'), |
|
984 | - array('action' => 'payment_settings') |
|
985 | - ); |
|
986 | - } |
|
987 | - |
|
988 | - |
|
989 | - /** |
|
990 | - * Gets the form used for updating payment settings |
|
991 | - * |
|
992 | - * @return EE_Form_Section_Proper |
|
993 | - * @throws EE_Error |
|
994 | - * @throws InvalidArgumentException |
|
995 | - * @throws InvalidDataTypeException |
|
996 | - * @throws InvalidInterfaceException |
|
997 | - */ |
|
998 | - protected function getPaymentSettingsForm() |
|
999 | - { |
|
1000 | - /** |
|
1001 | - * @var $reg_config EE_Registration_Config |
|
1002 | - */ |
|
1003 | - $reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config'); |
|
1004 | - return new EE_Form_Section_Proper( |
|
1005 | - array( |
|
1006 | - 'name' => 'payment-settings', |
|
1007 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1008 | - 'subsections' => array( |
|
1009 | - 'show_pending_payment_options' => new EE_Yes_No_Input( |
|
1010 | - array( |
|
1011 | - 'html_name' => 'show_pending_payment_options', |
|
1012 | - 'default' => $reg_config->show_pending_payment_options, |
|
1013 | - 'html_help_text' => esc_html__( |
|
1014 | - "If a payment is marked as 'Pending Payment', or if payment is deferred (ie, an offline gateway like Check, Bank, or Invoice is used), then give registrants the option to retry payment. ", |
|
1015 | - 'event_espresso' |
|
1016 | - ) |
|
1017 | - ) |
|
1018 | - ), |
|
1019 | - 'gateway_log_lifespan' => new EE_Select_Input( |
|
1020 | - $reg_config->gatewayLogLifespanOptions(), |
|
1021 | - array( |
|
1022 | - 'html_label_text' => esc_html__('Gateway Logs Lifespan', 'event_espresso'), |
|
1023 | - 'html_help_text' => esc_html__('If issues arise with payments being made through a payment gateway, it\'s helpful to log non-sensitive communications with the payment gateway. But it\'s a security responsibility, so it\'s a good idea to not keep them for any longer than necessary.', 'event_espresso'), |
|
1024 | - 'default' => $reg_config->gateway_log_lifespan, |
|
1025 | - ) |
|
1026 | - ) |
|
1027 | - ) |
|
1028 | - ) |
|
1029 | - ); |
|
1030 | - } |
|
1031 | - |
|
1032 | - |
|
1033 | - /** |
|
1034 | - * @throws EE_Error |
|
1035 | - */ |
|
1036 | - protected function _payment_log_overview_list_table() |
|
1037 | - { |
|
1038 | - $this->display_admin_list_table_page_with_sidebar(); |
|
1039 | - } |
|
1040 | - |
|
1041 | - |
|
1042 | - protected function _set_list_table_views_payment_log() |
|
1043 | - { |
|
1044 | - $this->_views = array( |
|
1045 | - 'all' => array( |
|
1046 | - 'slug' => 'all', |
|
1047 | - 'label' => esc_html__('View All Logs', 'event_espresso'), |
|
1048 | - 'count' => 0, |
|
1049 | - ), |
|
1050 | - ); |
|
1051 | - } |
|
1052 | - |
|
1053 | - |
|
1054 | - /** |
|
1055 | - * @param int $per_page |
|
1056 | - * @param int $current_page |
|
1057 | - * @param bool $count |
|
1058 | - * @return array|int |
|
1059 | - * @throws EE_Error |
|
1060 | - * @throws ReflectionException |
|
1061 | - */ |
|
1062 | - public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) |
|
1063 | - { |
|
1064 | - EE_Registry::instance()->load_model('Change_Log'); |
|
1065 | - // we may need to do multiple queries (joining differently), so we actually want an array of query params |
|
1066 | - $query_params = array(array('LOG_type' => EEM_Change_Log::type_gateway)); |
|
1067 | - // check if they've selected a specific payment method |
|
1068 | - if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
1069 | - $query_params[0]['OR*pm_or_pay_pm'] = array( |
|
1070 | - 'Payment.Payment_Method.PMD_ID' => $this->_req_data['_payment_method'], |
|
1071 | - 'Payment_Method.PMD_ID' => $this->_req_data['_payment_method'], |
|
1072 | - ); |
|
1073 | - } |
|
1074 | - // take into account search |
|
1075 | - if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
1076 | - $similarity_string = array('LIKE', '%' . str_replace("", "%", $this->_req_data['s']) . '%'); |
|
1077 | - $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
|
1078 | - $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
|
1079 | - $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
|
1080 | - $query_params[0]['OR*s']['Payment.Payment_Method.PMD_name'] = $similarity_string; |
|
1081 | - $query_params[0]['OR*s']['Payment.Payment_Method.PMD_admin_name'] = $similarity_string; |
|
1082 | - $query_params[0]['OR*s']['Payment.Payment_Method.PMD_type'] = $similarity_string; |
|
1083 | - $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
|
1084 | - $query_params[0]['OR*s']['Payment_Method.PMD_name'] = $similarity_string; |
|
1085 | - $query_params[0]['OR*s']['Payment_Method.PMD_admin_name'] = $similarity_string; |
|
1086 | - $query_params[0]['OR*s']['Payment_Method.PMD_type'] = $similarity_string; |
|
1087 | - $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
|
1088 | - } |
|
1089 | - if ( |
|
1090 | - isset($this->_req_data['payment-filter-start-date']) |
|
1091 | - && isset($this->_req_data['payment-filter-end-date']) |
|
1092 | - ) { |
|
1093 | - // add date |
|
1094 | - $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
1095 | - $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
1096 | - // make sure our timestamps start and end right at the boundaries for each day |
|
1097 | - $start_date = date('Y-m-d', strtotime($start_date)) . ' 00:00:00'; |
|
1098 | - $end_date = date('Y-m-d', strtotime($end_date)) . ' 23:59:59'; |
|
1099 | - // convert to timestamps |
|
1100 | - $start_date = strtotime($start_date); |
|
1101 | - $end_date = strtotime($end_date); |
|
1102 | - // makes sure start date is the lowest value and vice versa |
|
1103 | - $start_date = min($start_date, $end_date); |
|
1104 | - $end_date = max($start_date, $end_date); |
|
1105 | - // convert for query |
|
1106 | - $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( |
|
1107 | - 'LOG_time', |
|
1108 | - date('Y-m-d H:i:s', $start_date), |
|
1109 | - 'Y-m-d H:i:s' |
|
1110 | - ); |
|
1111 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( |
|
1112 | - 'LOG_time', |
|
1113 | - date('Y-m-d H:i:s', $end_date), |
|
1114 | - 'Y-m-d H:i:s' |
|
1115 | - ); |
|
1116 | - $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
1117 | - } |
|
1118 | - if ($count) { |
|
1119 | - return EEM_Change_Log::instance()->count($query_params); |
|
1120 | - } |
|
1121 | - if (isset($this->_req_data['order'])) { |
|
1122 | - $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) |
|
1123 | - ? $this->_req_data['order'] |
|
1124 | - : 'DESC'; |
|
1125 | - $query_params['order_by'] = array('LOG_time' => $sort); |
|
1126 | - } else { |
|
1127 | - $query_params['order_by'] = array('LOG_time' => 'DESC'); |
|
1128 | - } |
|
1129 | - $offset = ($current_page - 1) * $per_page; |
|
1130 | - if (! isset($this->_req_data['download_results'])) { |
|
1131 | - $query_params['limit'] = array($offset, $per_page); |
|
1132 | - } |
|
1133 | - // now they've requested to instead just download the file instead of viewing it. |
|
1134 | - if (isset($this->_req_data['download_results'])) { |
|
1135 | - $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
|
1136 | - header('Content-Disposition: attachment'); |
|
1137 | - header("Content-Disposition: attachment; filename=ee_payment_logs_for_" . sanitize_key(site_url())); |
|
1138 | - echo '<h1> ' |
|
1139 | - . sprintf( |
|
1140 | - esc_html__('Payment Logs for %1$s', 'event_espresso'), |
|
1141 | - esc_url_raw(site_url()) |
|
1142 | - ) |
|
1143 | - . '</h1 >'; |
|
1144 | - echo '<h3>' . esc_html__('Query:', 'event_espresso') . '</h3>'; |
|
1145 | - echo esc_html(var_export($query_params, true)); |
|
1146 | - echo '<h3>' . esc_html__('Results:', 'event_espresso') . '</h3>'; |
|
1147 | - echo esc_html(var_export($wpdb_results, true)); |
|
1148 | - die; |
|
1149 | - } |
|
1150 | - return EEM_Change_Log::instance()->get_all($query_params); |
|
1151 | - } |
|
1152 | - |
|
1153 | - |
|
1154 | - /** |
|
1155 | - * Used by usort to RE-sort log query results, because we lose the ordering |
|
1156 | - * because we're possibly combining the results from two queries |
|
1157 | - * |
|
1158 | - * @param EE_Change_Log $logA |
|
1159 | - * @param EE_Change_Log $logB |
|
1160 | - * @return int |
|
1161 | - * @throws EE_Error |
|
1162 | - * @throws ReflectionException |
|
1163 | - */ |
|
1164 | - protected function _sort_logs_again($logA, $logB) |
|
1165 | - { |
|
1166 | - $timeA = $logA->get_raw('LOG_time'); |
|
1167 | - $timeB = $logB->get_raw('LOG_time'); |
|
1168 | - if ($timeA == $timeB) { |
|
1169 | - return 0; |
|
1170 | - } |
|
1171 | - $comparison = $timeA < $timeB ? -1 : 1; |
|
1172 | - if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
1173 | - return $comparison * -1; |
|
1174 | - } |
|
1175 | - return $comparison; |
|
1176 | - } |
|
1177 | - |
|
1178 | - |
|
1179 | - /** |
|
1180 | - * @throws EE_Error |
|
1181 | - * @throws ReflectionException |
|
1182 | - */ |
|
1183 | - protected function _payment_log_details() |
|
1184 | - { |
|
1185 | - EE_Registry::instance()->load_model('Change_Log'); |
|
1186 | - /** @var $payment_log EE_Change_Log */ |
|
1187 | - $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
|
1188 | - $payment_method = null; |
|
1189 | - $transaction = null; |
|
1190 | - if ($payment_log instanceof EE_Change_Log) { |
|
1191 | - if ($payment_log->object() instanceof EE_Payment) { |
|
1192 | - $payment_method = $payment_log->object()->payment_method(); |
|
1193 | - $transaction = $payment_log->object()->transaction(); |
|
1194 | - } elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
1195 | - $payment_method = $payment_log->object(); |
|
1196 | - } elseif ($payment_log->object() instanceof EE_Transaction) { |
|
1197 | - $transaction = $payment_log->object(); |
|
1198 | - $payment_method = $transaction->payment_method(); |
|
1199 | - } |
|
1200 | - } |
|
1201 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
1202 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
1203 | - array( |
|
1204 | - 'payment_log' => $payment_log, |
|
1205 | - 'payment_method' => $payment_method, |
|
1206 | - 'transaction' => $transaction, |
|
1207 | - ), |
|
1208 | - true |
|
1209 | - ); |
|
1210 | - $this->display_admin_page_with_sidebar(); |
|
1211 | - } |
|
18 | + /** |
|
19 | + * Variables used for when we're re-sorting the logs results, |
|
20 | + * in case we needed to do two queries, and we need to resort |
|
21 | + * |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + private $_sort_logs_again_direction; |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * @Constructor |
|
29 | + * @access public |
|
30 | + * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
|
31 | + * @throws EE_Error |
|
32 | + * @throws InvalidArgumentException |
|
33 | + * @throws InvalidDataTypeException |
|
34 | + * @throws InvalidInterfaceException |
|
35 | + * @throws ReflectionException |
|
36 | + */ |
|
37 | + public function __construct($routing = true) |
|
38 | + { |
|
39 | + parent::__construct($routing); |
|
40 | + } |
|
41 | + |
|
42 | + |
|
43 | + protected function _init_page_props() |
|
44 | + { |
|
45 | + $this->page_slug = EE_PAYMENTS_PG_SLUG; |
|
46 | + $this->page_label = esc_html__('Payment Methods', 'event_espresso'); |
|
47 | + $this->_admin_base_url = EE_PAYMENTS_ADMIN_URL; |
|
48 | + $this->_admin_base_path = EE_PAYMENTS_ADMIN; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + protected function _ajax_hooks() |
|
53 | + { |
|
54 | + // todo: all hooks for ajax goes here. |
|
55 | + } |
|
56 | + |
|
57 | + |
|
58 | + protected function _define_page_props() |
|
59 | + { |
|
60 | + $this->_admin_page_title = $this->page_label; |
|
61 | + $this->_labels = array( |
|
62 | + 'publishbox' => esc_html__('Update Settings', 'event_espresso'), |
|
63 | + ); |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + protected function _set_page_routes() |
|
68 | + { |
|
69 | + /** |
|
70 | + * note that with payment method capabilities, although we've implemented |
|
71 | + * capability mapping which will be used for accessing payment methods owned by |
|
72 | + * other users. This is not fully implemented yet in the payment method ui. |
|
73 | + * Currently, only the "plural" caps are in active use. |
|
74 | + * When cap mapping is implemented, some routes will need to use the singular form of |
|
75 | + * capability method and also include the $id of the payment method for the route. |
|
76 | + **/ |
|
77 | + $this->_page_routes = array( |
|
78 | + 'default' => array( |
|
79 | + 'func' => '_payment_methods_list', |
|
80 | + 'capability' => 'ee_edit_payment_methods', |
|
81 | + ), |
|
82 | + 'payment_settings' => array( |
|
83 | + 'func' => '_payment_settings', |
|
84 | + 'capability' => 'ee_manage_gateways', |
|
85 | + ), |
|
86 | + 'activate_payment_method' => array( |
|
87 | + 'func' => '_activate_payment_method', |
|
88 | + 'noheader' => true, |
|
89 | + 'capability' => 'ee_edit_payment_methods', |
|
90 | + ), |
|
91 | + 'deactivate_payment_method' => array( |
|
92 | + 'func' => '_deactivate_payment_method', |
|
93 | + 'noheader' => true, |
|
94 | + 'capability' => 'ee_delete_payment_methods', |
|
95 | + ), |
|
96 | + 'update_payment_method' => array( |
|
97 | + 'func' => '_update_payment_method', |
|
98 | + 'noheader' => true, |
|
99 | + 'headers_sent_route' => 'default', |
|
100 | + 'capability' => 'ee_edit_payment_methods', |
|
101 | + ), |
|
102 | + 'update_payment_settings' => array( |
|
103 | + 'func' => '_update_payment_settings', |
|
104 | + 'noheader' => true, |
|
105 | + 'capability' => 'ee_manage_gateways', |
|
106 | + ), |
|
107 | + 'payment_log' => array( |
|
108 | + 'func' => '_payment_log_overview_list_table', |
|
109 | + 'capability' => 'ee_read_payment_methods', |
|
110 | + ), |
|
111 | + 'payment_log_details' => array( |
|
112 | + 'func' => '_payment_log_details', |
|
113 | + 'capability' => 'ee_read_payment_methods', |
|
114 | + ), |
|
115 | + ); |
|
116 | + } |
|
117 | + |
|
118 | + |
|
119 | + /** |
|
120 | + * @throws EE_Error |
|
121 | + * @throws ReflectionException |
|
122 | + */ |
|
123 | + protected function _set_page_config() |
|
124 | + { |
|
125 | + $payment_method_list_config = array( |
|
126 | + 'nav' => array( |
|
127 | + 'label' => esc_html__('Payment Methods', 'event_espresso'), |
|
128 | + 'order' => 10, |
|
129 | + ), |
|
130 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
131 | + 'help_tabs' => array_merge( |
|
132 | + array( |
|
133 | + 'payment_methods_overview_help_tab' => array( |
|
134 | + 'title' => esc_html__('Payment Methods Overview', 'event_espresso'), |
|
135 | + 'filename' => 'payment_methods_overview', |
|
136 | + ), |
|
137 | + ), |
|
138 | + $this->_add_payment_method_help_tabs() |
|
139 | + ), |
|
140 | + // disabled temporarily. see: https://github.com/eventespresso/eventsmart.com-website/issues/836 |
|
141 | + // 'help_tour' => array('Payment_Methods_Selection_Help_Tour'), |
|
142 | + 'require_nonce' => false, |
|
143 | + ); |
|
144 | + $this->_page_config = array( |
|
145 | + 'default' => $payment_method_list_config, |
|
146 | + 'payment_settings' => array( |
|
147 | + 'nav' => array( |
|
148 | + 'label' => esc_html__('Settings', 'event_espresso'), |
|
149 | + 'order' => 20, |
|
150 | + ), |
|
151 | + 'help_tabs' => array( |
|
152 | + 'payment_methods_settings_help_tab' => array( |
|
153 | + 'title' => esc_html__('Payment Method Settings', 'event_espresso'), |
|
154 | + 'filename' => 'payment_methods_settings', |
|
155 | + ), |
|
156 | + ), |
|
157 | + // 'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ), |
|
158 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
159 | + 'require_nonce' => false, |
|
160 | + ), |
|
161 | + 'payment_log' => array( |
|
162 | + 'nav' => array( |
|
163 | + 'label' => esc_html__("Logs", 'event_espresso'), |
|
164 | + 'order' => 30, |
|
165 | + ), |
|
166 | + 'list_table' => 'Payment_Log_Admin_List_Table', |
|
167 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
168 | + 'require_nonce' => false, |
|
169 | + ), |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * @return array |
|
176 | + * @throws DomainException |
|
177 | + * @throws EE_Error |
|
178 | + * @throws InvalidArgumentException |
|
179 | + * @throws InvalidDataTypeException |
|
180 | + * @throws InvalidInterfaceException |
|
181 | + * @throws ReflectionException |
|
182 | + */ |
|
183 | + protected function _add_payment_method_help_tabs() |
|
184 | + { |
|
185 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
186 | + $payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types(); |
|
187 | + $all_pmt_help_tabs_config = array(); |
|
188 | + foreach ($payment_method_types as $payment_method_type) { |
|
189 | + if ( |
|
190 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
191 | + $payment_method_type->cap_name(), |
|
192 | + 'specific_payment_method_type_access' |
|
193 | + ) |
|
194 | + ) { |
|
195 | + continue; |
|
196 | + } |
|
197 | + foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
|
198 | + $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
|
199 | + $template_args['admin_page_obj'] = $this; |
|
200 | + $all_pmt_help_tabs_config[ $help_tab_name ] = array( |
|
201 | + 'title' => $config['title'], |
|
202 | + 'content' => EEH_Template::display_template( |
|
203 | + $payment_method_type->file_folder() . 'help_tabs/' . $config['filename'] . '.help_tab.php', |
|
204 | + $template_args, |
|
205 | + true |
|
206 | + ), |
|
207 | + ); |
|
208 | + } |
|
209 | + } |
|
210 | + return $all_pmt_help_tabs_config; |
|
211 | + } |
|
212 | + |
|
213 | + |
|
214 | + // none of the below group are currently used for Gateway Settings |
|
215 | + protected function _add_screen_options() |
|
216 | + { |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + protected function _add_feature_pointers() |
|
221 | + { |
|
222 | + } |
|
223 | + |
|
224 | + |
|
225 | + public function admin_init() |
|
226 | + { |
|
227 | + } |
|
228 | + |
|
229 | + |
|
230 | + public function admin_notices() |
|
231 | + { |
|
232 | + } |
|
233 | + |
|
234 | + |
|
235 | + public function admin_footer_scripts() |
|
236 | + { |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + public function load_scripts_styles() |
|
241 | + { |
|
242 | + // styles |
|
243 | + wp_enqueue_style('espresso-ui-theme'); |
|
244 | + // scripts |
|
245 | + wp_enqueue_script('ee_admin_js'); |
|
246 | + wp_enqueue_script('ee-text-links'); |
|
247 | + wp_enqueue_script( |
|
248 | + 'espresso_payments', |
|
249 | + EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', |
|
250 | + array('ee-datepicker'), |
|
251 | + EVENT_ESPRESSO_VERSION, |
|
252 | + true |
|
253 | + ); |
|
254 | + } |
|
255 | + |
|
256 | + |
|
257 | + public function load_scripts_styles_default() |
|
258 | + { |
|
259 | + // styles |
|
260 | + wp_register_style( |
|
261 | + 'espresso_payments', |
|
262 | + EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', |
|
263 | + array(), |
|
264 | + EVENT_ESPRESSO_VERSION |
|
265 | + ); |
|
266 | + wp_enqueue_style('espresso_payments'); |
|
267 | + wp_enqueue_style('ee-text-links'); |
|
268 | + // scripts |
|
269 | + } |
|
270 | + |
|
271 | + |
|
272 | + /** |
|
273 | + * @throws EE_Error |
|
274 | + * @throws ReflectionException |
|
275 | + */ |
|
276 | + protected function _payment_methods_list() |
|
277 | + { |
|
278 | + /** |
|
279 | + * first let's ensure payment methods have been set up. |
|
280 | + * We do this here because when people activate a payment method for the first time (as an addon), |
|
281 | + * it may not set up its capabilities or get registered correctly due to the loading process. |
|
282 | + * However, people MUST set up the details for the payment method, |
|
283 | + * so it's safe to do a recheck here. |
|
284 | + */ |
|
285 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
286 | + EEM_Payment_Method::instance()->verify_button_urls(); |
|
287 | + // set up tabs, one for each payment method type |
|
288 | + $tabs = array(); |
|
289 | + $payment_methods = array(); |
|
290 | + foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) { |
|
291 | + // we don't want to show admin-only PMTs for now |
|
292 | + if ($pmt_obj instanceof EE_PMT_Admin_Only) { |
|
293 | + continue; |
|
294 | + } |
|
295 | + // check access |
|
296 | + if ( |
|
297 | + ! EE_Registry::instance()->CAP->current_user_can( |
|
298 | + $pmt_obj->cap_name(), |
|
299 | + 'specific_payment_method_type_access' |
|
300 | + ) |
|
301 | + ) { |
|
302 | + continue; |
|
303 | + } |
|
304 | + // check for any active pms of that type |
|
305 | + $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
|
306 | + if (! $payment_method instanceof EE_Payment_Method) { |
|
307 | + $payment_method = EE_Payment_Method::new_instance( |
|
308 | + array( |
|
309 | + 'PMD_slug' => sanitize_key($pmt_obj->system_name()), |
|
310 | + 'PMD_type' => $pmt_obj->system_name(), |
|
311 | + 'PMD_name' => $pmt_obj->pretty_name(), |
|
312 | + 'PMD_admin_name' => $pmt_obj->pretty_name(), |
|
313 | + ) |
|
314 | + ); |
|
315 | + } |
|
316 | + $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
317 | + } |
|
318 | + $payment_methods = apply_filters( |
|
319 | + 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
|
320 | + $payment_methods |
|
321 | + ); |
|
322 | + foreach ($payment_methods as $payment_method) { |
|
323 | + if ($payment_method instanceof EE_Payment_Method) { |
|
324 | + add_meta_box( |
|
325 | + // html id |
|
326 | + 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
327 | + // title |
|
328 | + sprintf(esc_html__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
|
329 | + // callback |
|
330 | + array($this, 'payment_method_settings_meta_box'), |
|
331 | + // post type |
|
332 | + null, |
|
333 | + // context |
|
334 | + 'normal', |
|
335 | + // priority |
|
336 | + 'default', |
|
337 | + // callback args |
|
338 | + array('payment_method' => $payment_method) |
|
339 | + ); |
|
340 | + // setup for tabbed content |
|
341 | + $tabs[ $payment_method->slug() ] = array( |
|
342 | + 'label' => $payment_method->admin_name(), |
|
343 | + 'class' => $payment_method->active() ? 'gateway-active' : '', |
|
344 | + 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
345 | + 'title' => esc_html__('Modify this Payment Method', 'event_espresso'), |
|
346 | + 'slug' => $payment_method->slug(), |
|
347 | + ); |
|
348 | + } |
|
349 | + } |
|
350 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( |
|
351 | + $tabs, |
|
352 | + 'payment_method_links', |
|
353 | + '|', |
|
354 | + $this->_get_active_payment_method_slug() |
|
355 | + ); |
|
356 | + $this->display_admin_page_with_sidebar(); |
|
357 | + } |
|
358 | + |
|
359 | + |
|
360 | + /** |
|
361 | + * _get_active_payment_method_slug |
|
362 | + * |
|
363 | + * @return string |
|
364 | + * @throws EE_Error |
|
365 | + */ |
|
366 | + protected function _get_active_payment_method_slug() |
|
367 | + { |
|
368 | + $payment_method_slug = false; |
|
369 | + // decide which payment method tab to open first, as dictated by the request's 'payment_method' |
|
370 | + if (isset($this->_req_data['payment_method'])) { |
|
371 | + // if they provided the current payment method, use it |
|
372 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
373 | + } |
|
374 | + /** @var EE_Payment_Method $payment_method */ |
|
375 | + $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
|
376 | + // if that didn't work or wasn't provided, find another way to select the current pm |
|
377 | + if (! $this->_verify_payment_method($payment_method)) { |
|
378 | + // like, looking for an active one |
|
379 | + $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
|
380 | + // test that one as well |
|
381 | + if ($this->_verify_payment_method($payment_method)) { |
|
382 | + $payment_method_slug = $payment_method->slug(); |
|
383 | + } else { |
|
384 | + $payment_method_slug = 'paypal_standard'; |
|
385 | + } |
|
386 | + } |
|
387 | + return $payment_method_slug; |
|
388 | + } |
|
389 | + |
|
390 | + |
|
391 | + /** |
|
392 | + * payment_method_settings_meta_box |
|
393 | + * returns TRUE if the passed payment method is properly constructed and the logged-in user has the correct |
|
394 | + * capabilities to access it |
|
395 | + * |
|
396 | + * @param EE_Payment_Method $payment_method |
|
397 | + * @return boolean |
|
398 | + * @throws EE_Error |
|
399 | + */ |
|
400 | + protected function _verify_payment_method($payment_method) |
|
401 | + { |
|
402 | + if ( |
|
403 | + $payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base |
|
404 | + && EE_Registry::instance()->CAP->current_user_can( |
|
405 | + $payment_method->type_obj()->cap_name(), |
|
406 | + 'specific_payment_method_type_access' |
|
407 | + ) |
|
408 | + ) { |
|
409 | + return true; |
|
410 | + } |
|
411 | + return false; |
|
412 | + } |
|
413 | + |
|
414 | + |
|
415 | + /** |
|
416 | + * payment_method_settings_meta_box |
|
417 | + * |
|
418 | + * @param NULL $post_obj_which_is_null is an object containing the current post (as a $post object) |
|
419 | + * @param array $metabox is an array with metabox id, title, callback, and args elements. the value |
|
420 | + * at 'args' has key 'payment_method', as set within _payment_methods_list |
|
421 | + * @return void |
|
422 | + * @throws EE_Error |
|
423 | + * @throws ReflectionException |
|
424 | + */ |
|
425 | + public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) |
|
426 | + { |
|
427 | + $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) |
|
428 | + ? $metabox['args']['payment_method'] : null; |
|
429 | + if (! $payment_method instanceof EE_Payment_Method) { |
|
430 | + throw new EE_Error( |
|
431 | + esc_html__( |
|
432 | + 'Payment method metabox setup incorrectly. No Payment method object was supplied', |
|
433 | + 'event_espresso' |
|
434 | + ) |
|
435 | + ); |
|
436 | + } |
|
437 | + $payment_method_scopes = $payment_method->active(); |
|
438 | + // if the payment method really exists show its form, otherwise the activation template |
|
439 | + if ($payment_method->ID() && ! empty($payment_method_scopes)) { |
|
440 | + $form = $this->_generate_payment_method_settings_form($payment_method); |
|
441 | + if ($form->form_data_present_in($this->_req_data)) { |
|
442 | + $form->receive_form_submission($this->_req_data); |
|
443 | + } |
|
444 | + echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); // already escaped |
|
445 | + } else { |
|
446 | + echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); // already escaped |
|
447 | + } |
|
448 | + } |
|
449 | + |
|
450 | + |
|
451 | + /** |
|
452 | + * Gets the form for all the settings related to this payment method type |
|
453 | + * |
|
454 | + * @access protected |
|
455 | + * @param EE_Payment_Method $payment_method |
|
456 | + * @return EE_Form_Section_Proper |
|
457 | + * @throws EE_Error |
|
458 | + */ |
|
459 | + protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method = null) |
|
460 | + { |
|
461 | + if (! $payment_method instanceof EE_Payment_Method) { |
|
462 | + return new EE_Form_Section_Proper(); |
|
463 | + } |
|
464 | + return new EE_Form_Section_Proper( |
|
465 | + array( |
|
466 | + 'name' => $payment_method->slug() . '_settings_form', |
|
467 | + 'html_id' => $payment_method->slug() . '_settings_form', |
|
468 | + 'action' => EE_Admin_Page::add_query_args_and_nonce( |
|
469 | + array( |
|
470 | + 'action' => 'update_payment_method', |
|
471 | + 'payment_method' => $payment_method->slug(), |
|
472 | + ), |
|
473 | + EE_PAYMENTS_ADMIN_URL |
|
474 | + ), |
|
475 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
476 | + 'subsections' => apply_filters( |
|
477 | + 'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections', |
|
478 | + array( |
|
479 | + 'pci_dss_compliance' => $this->_pci_dss_compliance($payment_method), |
|
480 | + 'currency_support' => $this->_currency_support($payment_method), |
|
481 | + 'payment_method_settings' => $this->_payment_method_settings($payment_method), |
|
482 | + 'update' => $this->_update_payment_method_button($payment_method), |
|
483 | + 'deactivate' => $this->_deactivate_payment_method_button($payment_method), |
|
484 | + 'fine_print' => $this->_fine_print(), |
|
485 | + ), |
|
486 | + $payment_method |
|
487 | + ), |
|
488 | + ) |
|
489 | + ); |
|
490 | + } |
|
491 | + |
|
492 | + |
|
493 | + /** |
|
494 | + * _pci_dss_compliance |
|
495 | + * |
|
496 | + * @access protected |
|
497 | + * @param EE_Payment_Method $payment_method |
|
498 | + * @return EE_Form_Section_HTML |
|
499 | + * @throws EE_Error |
|
500 | + */ |
|
501 | + protected function _pci_dss_compliance(EE_Payment_Method $payment_method) |
|
502 | + { |
|
503 | + if ($payment_method->type_obj()->requires_https()) { |
|
504 | + return new EE_Form_Section_HTML( |
|
505 | + EEH_HTML::table( |
|
506 | + EEH_HTML::tr( |
|
507 | + EEH_HTML::th( |
|
508 | + EEH_HTML::label( |
|
509 | + EEH_HTML::strong( |
|
510 | + esc_html__('IMPORTANT', 'event_espresso'), |
|
511 | + '', |
|
512 | + 'important-notice' |
|
513 | + ) |
|
514 | + ) |
|
515 | + ) . |
|
516 | + EEH_HTML::td( |
|
517 | + EEH_HTML::strong( |
|
518 | + esc_html__( |
|
519 | + 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', |
|
520 | + 'event_espresso' |
|
521 | + ) |
|
522 | + ) |
|
523 | + . |
|
524 | + EEH_HTML::br() |
|
525 | + . |
|
526 | + esc_html__('Learn more about ', 'event_espresso') |
|
527 | + . EEH_HTML::link( |
|
528 | + 'https://www.pcisecuritystandards.org/merchants/index.php', |
|
529 | + esc_html__('PCI DSS compliance', 'event_espresso') |
|
530 | + ) |
|
531 | + ) |
|
532 | + ) |
|
533 | + ) |
|
534 | + ); |
|
535 | + } |
|
536 | + return new EE_Form_Section_HTML(''); |
|
537 | + } |
|
538 | + |
|
539 | + |
|
540 | + /** |
|
541 | + * _currency_support |
|
542 | + * |
|
543 | + * @access protected |
|
544 | + * @param EE_Payment_Method $payment_method |
|
545 | + * @return EE_Form_Section_HTML |
|
546 | + * @throws EE_Error |
|
547 | + */ |
|
548 | + protected function _currency_support(EE_Payment_Method $payment_method) |
|
549 | + { |
|
550 | + if (! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
551 | + return new EE_Form_Section_HTML( |
|
552 | + EEH_HTML::table( |
|
553 | + EEH_HTML::tr( |
|
554 | + EEH_HTML::th( |
|
555 | + EEH_HTML::label( |
|
556 | + EEH_HTML::strong( |
|
557 | + esc_html__('IMPORTANT', 'event_espresso'), |
|
558 | + '', |
|
559 | + 'important-notice' |
|
560 | + ) |
|
561 | + ) |
|
562 | + ) . |
|
563 | + EEH_HTML::td( |
|
564 | + EEH_HTML::strong( |
|
565 | + sprintf( |
|
566 | + esc_html__( |
|
567 | + 'This payment method does not support the currency set on your site (%1$s). Please activate a different payment method or change your site\'s country and associated currency.', |
|
568 | + 'event_espresso' |
|
569 | + ), |
|
570 | + EE_Config::instance()->currency->code |
|
571 | + ) |
|
572 | + ) |
|
573 | + ) |
|
574 | + ) |
|
575 | + ) |
|
576 | + ); |
|
577 | + } |
|
578 | + return new EE_Form_Section_HTML(''); |
|
579 | + } |
|
580 | + |
|
581 | + |
|
582 | + /** |
|
583 | + * _update_payment_method_button |
|
584 | + * |
|
585 | + * @access protected |
|
586 | + * @param EE_Payment_Method $payment_method |
|
587 | + * @return EE_Payment_Method_Form |
|
588 | + * @throws EE_Error |
|
589 | + */ |
|
590 | + protected function _payment_method_settings(EE_Payment_Method $payment_method) |
|
591 | + { |
|
592 | + // modify the form, so we only have/show fields that will be implemented for this version |
|
593 | + return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name()); |
|
594 | + } |
|
595 | + |
|
596 | + |
|
597 | + /** |
|
598 | + * Simplifies the form to merely reproduce 4.1's gateway settings functionality |
|
599 | + * |
|
600 | + * @param EE_Form_Section_Proper $form_section |
|
601 | + * @param string $payment_method_name |
|
602 | + * @return EE_Payment_Method_Form |
|
603 | + * @throws EE_Error |
|
604 | + */ |
|
605 | + protected function _simplify_form($form_section, $payment_method_name = '') |
|
606 | + { |
|
607 | + if ($form_section instanceof EE_Payment_Method_Form) { |
|
608 | + $form_section->exclude( |
|
609 | + array( |
|
610 | + 'PMD_type', // don't want them changing the type |
|
611 | + 'PMD_slug', // or the slug (probably never) |
|
612 | + 'PMD_wp_user', // or the user's ID |
|
613 | + 'Currency' // or the currency, until the rest of EE supports simultaneous currencies |
|
614 | + ) |
|
615 | + ); |
|
616 | + return $form_section; |
|
617 | + } else { |
|
618 | + throw new EE_Error( |
|
619 | + sprintf( |
|
620 | + esc_html__( |
|
621 | + 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', |
|
622 | + 'event_espresso' |
|
623 | + ), |
|
624 | + $payment_method_name |
|
625 | + ) |
|
626 | + ); |
|
627 | + } |
|
628 | + } |
|
629 | + |
|
630 | + |
|
631 | + /** |
|
632 | + * _update_payment_method_button |
|
633 | + * |
|
634 | + * @access protected |
|
635 | + * @param EE_Payment_Method $payment_method |
|
636 | + * @return EE_Form_Section_HTML |
|
637 | + * @throws EE_Error |
|
638 | + */ |
|
639 | + protected function _update_payment_method_button(EE_Payment_Method $payment_method) |
|
640 | + { |
|
641 | + $update_button = new EE_Submit_Input( |
|
642 | + array( |
|
643 | + 'name' => 'submit', |
|
644 | + 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
645 | + 'default' => sprintf( |
|
646 | + esc_html__('Update %s Payment Settings', 'event_espresso'), |
|
647 | + $payment_method->admin_name() |
|
648 | + ), |
|
649 | + 'html_label' => EEH_HTML::nbsp(), |
|
650 | + ) |
|
651 | + ); |
|
652 | + return new EE_Form_Section_HTML( |
|
653 | + EEH_HTML::table( |
|
654 | + EEH_HTML::no_row(EEH_HTML::br(2)) . |
|
655 | + EEH_HTML::tr( |
|
656 | + EEH_HTML::th(esc_html__('Update Settings', 'event_espresso')) . |
|
657 | + EEH_HTML::td( |
|
658 | + $update_button->get_html_for_input() |
|
659 | + ) |
|
660 | + ) |
|
661 | + ) |
|
662 | + ); |
|
663 | + } |
|
664 | + |
|
665 | + |
|
666 | + /** |
|
667 | + * _deactivate_payment_method_button |
|
668 | + * |
|
669 | + * @access protected |
|
670 | + * @param EE_Payment_Method $payment_method |
|
671 | + * @return EE_Form_Section_HTML |
|
672 | + */ |
|
673 | + protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) |
|
674 | + { |
|
675 | + $link_text_and_title = sprintf( |
|
676 | + esc_html__('Deactivate %1$s Payments?', 'event_espresso'), |
|
677 | + $payment_method->admin_name() |
|
678 | + ); |
|
679 | + return new EE_Form_Section_HTML( |
|
680 | + EEH_HTML::table( |
|
681 | + EEH_HTML::tr( |
|
682 | + EEH_HTML::th(esc_html__('Deactivate Payment Method', 'event_espresso')) . |
|
683 | + EEH_HTML::td( |
|
684 | + EEH_HTML::link( |
|
685 | + EE_Admin_Page::add_query_args_and_nonce( |
|
686 | + array( |
|
687 | + 'action' => 'deactivate_payment_method', |
|
688 | + 'payment_method' => $payment_method->slug(), |
|
689 | + ), |
|
690 | + EE_PAYMENTS_ADMIN_URL |
|
691 | + ), |
|
692 | + $link_text_and_title, |
|
693 | + $link_text_and_title, |
|
694 | + 'deactivate_' . $payment_method->slug(), |
|
695 | + 'espresso-button button-secondary' |
|
696 | + ) |
|
697 | + ) |
|
698 | + ) |
|
699 | + ) |
|
700 | + ); |
|
701 | + } |
|
702 | + |
|
703 | + |
|
704 | + /** |
|
705 | + * _activate_payment_method_button |
|
706 | + * |
|
707 | + * @access protected |
|
708 | + * @param EE_Payment_Method $payment_method |
|
709 | + * @return EE_Form_Section_Proper |
|
710 | + * @throws EE_Error |
|
711 | + */ |
|
712 | + protected function _activate_payment_method_button(EE_Payment_Method $payment_method) |
|
713 | + { |
|
714 | + $link_text_and_title = sprintf( |
|
715 | + esc_html__('Activate %1$s Payment Method?', 'event_espresso'), |
|
716 | + $payment_method->admin_name() |
|
717 | + ); |
|
718 | + return new EE_Form_Section_Proper( |
|
719 | + array( |
|
720 | + 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
721 | + 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
722 | + 'action' => '#', |
|
723 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
724 | + 'subsections' => apply_filters( |
|
725 | + 'FHEE__Payments_Admin_Page___activate_payment_method_button__form_subsections', |
|
726 | + array( |
|
727 | + new EE_Form_Section_HTML( |
|
728 | + EEH_HTML::table( |
|
729 | + EEH_HTML::tr( |
|
730 | + EEH_HTML::td( |
|
731 | + $payment_method->type_obj()->introductory_html(), |
|
732 | + '', |
|
733 | + '', |
|
734 | + '', |
|
735 | + 'colspan="2"' |
|
736 | + ) |
|
737 | + ) . |
|
738 | + EEH_HTML::tr( |
|
739 | + EEH_HTML::th( |
|
740 | + EEH_HTML::label(esc_html__('Click to Activate ', 'event_espresso')) |
|
741 | + ) . |
|
742 | + EEH_HTML::td( |
|
743 | + EEH_HTML::link( |
|
744 | + EE_Admin_Page::add_query_args_and_nonce( |
|
745 | + array( |
|
746 | + 'action' => 'activate_payment_method', |
|
747 | + 'payment_method_type' => $payment_method->type(), |
|
748 | + ), |
|
749 | + EE_PAYMENTS_ADMIN_URL |
|
750 | + ), |
|
751 | + $link_text_and_title, |
|
752 | + $link_text_and_title, |
|
753 | + 'activate_' . $payment_method->slug(), |
|
754 | + 'espresso-button-green button-primary' |
|
755 | + ) |
|
756 | + ) |
|
757 | + ) |
|
758 | + ) |
|
759 | + ), |
|
760 | + ), |
|
761 | + $payment_method |
|
762 | + ), |
|
763 | + ) |
|
764 | + ); |
|
765 | + } |
|
766 | + |
|
767 | + |
|
768 | + /** |
|
769 | + * _fine_print |
|
770 | + * |
|
771 | + * @access protected |
|
772 | + * @return EE_Form_Section_HTML |
|
773 | + */ |
|
774 | + protected function _fine_print() |
|
775 | + { |
|
776 | + return new EE_Form_Section_HTML( |
|
777 | + EEH_HTML::table( |
|
778 | + EEH_HTML::tr( |
|
779 | + EEH_HTML::th() . |
|
780 | + EEH_HTML::td( |
|
781 | + EEH_HTML::p(esc_html__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
|
782 | + ) |
|
783 | + ) |
|
784 | + ) |
|
785 | + ); |
|
786 | + } |
|
787 | + |
|
788 | + |
|
789 | + /** |
|
790 | + * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far) |
|
791 | + * |
|
792 | + * @throws EE_Error |
|
793 | + * @throws ReflectionException |
|
794 | + * @global WP_User $current_user |
|
795 | + */ |
|
796 | + protected function _activate_payment_method() |
|
797 | + { |
|
798 | + if (isset($this->_req_data['payment_method_type'])) { |
|
799 | + $payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']); |
|
800 | + // see if one exists |
|
801 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
802 | + $payment_method = EE_Payment_Method_Manager::instance() |
|
803 | + ->activate_a_payment_method_of_type($payment_method_type); |
|
804 | + $this->_redirect_after_action( |
|
805 | + 1, |
|
806 | + 'Payment Method', |
|
807 | + 'activated', |
|
808 | + array('action' => 'default', 'payment_method' => $payment_method->slug()) |
|
809 | + ); |
|
810 | + } else { |
|
811 | + $this->_redirect_after_action(false, 'Payment Method', 'activated', array('action' => 'default')); |
|
812 | + } |
|
813 | + } |
|
814 | + |
|
815 | + |
|
816 | + /** |
|
817 | + * @throws EE_Error |
|
818 | + * @throws ReflectionException |
|
819 | + */ |
|
820 | + protected function _deactivate_payment_method() |
|
821 | + { |
|
822 | + if (isset($this->_req_data['payment_method'])) { |
|
823 | + $payment_method_slug = sanitize_key($this->_req_data['payment_method']); |
|
824 | + // deactivate it |
|
825 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
826 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug); |
|
827 | + $this->_redirect_after_action( |
|
828 | + $count_updated, |
|
829 | + 'Payment Method', |
|
830 | + 'deactivated', |
|
831 | + array('action' => 'default', 'payment_method' => $payment_method_slug) |
|
832 | + ); |
|
833 | + } else { |
|
834 | + $this->_redirect_after_action(false, 'Payment Method', 'deactivated', array('action' => 'default')); |
|
835 | + } |
|
836 | + } |
|
837 | + |
|
838 | + |
|
839 | + /** |
|
840 | + * Processes the payment method form that was submitted. This is slightly trickier than usual form |
|
841 | + * processing because we first need to identify WHICH form was processed and which payment method |
|
842 | + * it corresponds to. Once we have done that, we see if the form is valid. If it is, the |
|
843 | + * form's data is saved, and we redirect to the default payment methods page, setting the updated payment method |
|
844 | + * as the currently-selected one. If it DOESN'T validate, we render the page with the form's errors (in the |
|
845 | + * subsequently called 'headers_sent_func' which is _payment_methods_list) |
|
846 | + * |
|
847 | + * @return void |
|
848 | + * @throws EE_Error |
|
849 | + * @throws ReflectionException |
|
850 | + */ |
|
851 | + protected function _update_payment_method() |
|
852 | + { |
|
853 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
854 | + // ok let's find which gateway form to use based on the form input |
|
855 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
856 | + /** @var $correct_pmt_form_to_use EE_Payment_Method_Form */ |
|
857 | + $correct_pmt_form_to_use = null; |
|
858 | + $payment_method = null; |
|
859 | + foreach (EEM_Payment_Method::instance()->get_all() as $payment_method) { |
|
860 | + if ($payment_method instanceof EE_Payment_Method) { |
|
861 | + // get the form and simplify it, like what we do when we display it |
|
862 | + $pmt_form = $this->_generate_payment_method_settings_form($payment_method); |
|
863 | + if ($pmt_form->form_data_present_in($this->_req_data)) { |
|
864 | + $correct_pmt_form_to_use = $pmt_form; |
|
865 | + break; |
|
866 | + } |
|
867 | + } |
|
868 | + } |
|
869 | + // if we couldn't find the correct payment method type... |
|
870 | + if (! $correct_pmt_form_to_use) { |
|
871 | + EE_Error::add_error( |
|
872 | + esc_html__( |
|
873 | + "We could not find which payment method type your form submission related to. Please contact support", |
|
874 | + 'event_espresso' |
|
875 | + ), |
|
876 | + __FILE__, |
|
877 | + __FUNCTION__, |
|
878 | + __LINE__ |
|
879 | + ); |
|
880 | + $this->_redirect_after_action(false, 'Payment Method', 'activated', array('action' => 'default')); |
|
881 | + } |
|
882 | + $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
|
883 | + if ($correct_pmt_form_to_use->is_valid()) { |
|
884 | + $payment_settings_subform = $correct_pmt_form_to_use->get_subsection('payment_method_settings'); |
|
885 | + if (! $payment_settings_subform instanceof EE_Payment_Method_Form) { |
|
886 | + throw new EE_Error( |
|
887 | + sprintf( |
|
888 | + esc_html__( |
|
889 | + 'The payment method could not be saved because the form sections were misnamed. We expected to find %1$s, but did not.', |
|
890 | + 'event_espresso' |
|
891 | + ), |
|
892 | + 'payment_method_settings' |
|
893 | + ) |
|
894 | + ); |
|
895 | + } |
|
896 | + $payment_settings_subform->save(); |
|
897 | + /** @var $pm EE_Payment_Method */ |
|
898 | + $this->_redirect_after_action( |
|
899 | + true, |
|
900 | + 'Payment Method', |
|
901 | + 'updated', |
|
902 | + array('action' => 'default', 'payment_method' => $payment_method->slug()) |
|
903 | + ); |
|
904 | + } else { |
|
905 | + EE_Error::add_error( |
|
906 | + sprintf( |
|
907 | + esc_html__( |
|
908 | + 'Payment method of type %s was not saved because there were validation errors. They have been marked in the form', |
|
909 | + 'event_espresso' |
|
910 | + ), |
|
911 | + $payment_method instanceof EE_Payment_Method ? $payment_method->type_obj()->pretty_name() |
|
912 | + : esc_html__('"(unknown)"', 'event_espresso') |
|
913 | + ), |
|
914 | + __FILE__, |
|
915 | + __FUNCTION__, |
|
916 | + __LINE__ |
|
917 | + ); |
|
918 | + } |
|
919 | + } |
|
920 | + } |
|
921 | + |
|
922 | + |
|
923 | + /** |
|
924 | + * Displays payment settings (not payment METHOD settings, that's _payment_method_settings) |
|
925 | + * @throws DomainException |
|
926 | + * @throws EE_Error |
|
927 | + * @throws InvalidArgumentException |
|
928 | + * @throws InvalidDataTypeException |
|
929 | + * @throws InvalidInterfaceException |
|
930 | + */ |
|
931 | + protected function _payment_settings() |
|
932 | + { |
|
933 | + $form = $this->getPaymentSettingsForm(); |
|
934 | + $this->_set_add_edit_form_tags('update_payment_settings'); |
|
935 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
936 | + $this->_template_args['admin_page_content'] = $form->get_html_and_js(); |
|
937 | + $this->display_admin_page_with_sidebar(); |
|
938 | + } |
|
939 | + |
|
940 | + |
|
941 | + /** |
|
942 | + * _update_payment_settings |
|
943 | + * |
|
944 | + * @access protected |
|
945 | + * @return void |
|
946 | + * @throws EE_Error |
|
947 | + * @throws InvalidArgumentException |
|
948 | + * @throws InvalidDataTypeException |
|
949 | + * @throws InvalidInterfaceException |
|
950 | + */ |
|
951 | + protected function _update_payment_settings() |
|
952 | + { |
|
953 | + $form = $this->getPaymentSettingsForm(); |
|
954 | + if ($form->was_submitted($this->_req_data)) { |
|
955 | + $form->receive_form_submission($this->_req_data); |
|
956 | + if ($form->is_valid()) { |
|
957 | + /** |
|
958 | + * @var $reg_config EE_Registration_Config |
|
959 | + */ |
|
960 | + $loader = LoaderFactory::getLoader(); |
|
961 | + $reg_config = $loader->getShared('EE_Registration_Config'); |
|
962 | + $valid_data = $form->valid_data(); |
|
963 | + $reg_config->show_pending_payment_options = $valid_data['show_pending_payment_options']; |
|
964 | + $reg_config->gateway_log_lifespan = $valid_data['gateway_log_lifespan']; |
|
965 | + } |
|
966 | + } |
|
967 | + EE_Registry::instance()->CFG = apply_filters( |
|
968 | + 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', |
|
969 | + EE_Registry::instance()->CFG |
|
970 | + ); |
|
971 | + |
|
972 | + $what = esc_html__('Payment Settings', 'event_espresso'); |
|
973 | + $success = $this->_update_espresso_configuration( |
|
974 | + $what, |
|
975 | + EE_Registry::instance()->CFG, |
|
976 | + __FILE__, |
|
977 | + __FUNCTION__, |
|
978 | + __LINE__ |
|
979 | + ); |
|
980 | + $this->_redirect_after_action( |
|
981 | + $success, |
|
982 | + $what, |
|
983 | + esc_html__('updated', 'event_espresso'), |
|
984 | + array('action' => 'payment_settings') |
|
985 | + ); |
|
986 | + } |
|
987 | + |
|
988 | + |
|
989 | + /** |
|
990 | + * Gets the form used for updating payment settings |
|
991 | + * |
|
992 | + * @return EE_Form_Section_Proper |
|
993 | + * @throws EE_Error |
|
994 | + * @throws InvalidArgumentException |
|
995 | + * @throws InvalidDataTypeException |
|
996 | + * @throws InvalidInterfaceException |
|
997 | + */ |
|
998 | + protected function getPaymentSettingsForm() |
|
999 | + { |
|
1000 | + /** |
|
1001 | + * @var $reg_config EE_Registration_Config |
|
1002 | + */ |
|
1003 | + $reg_config = LoaderFactory::getLoader()->getShared('EE_Registration_Config'); |
|
1004 | + return new EE_Form_Section_Proper( |
|
1005 | + array( |
|
1006 | + 'name' => 'payment-settings', |
|
1007 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
1008 | + 'subsections' => array( |
|
1009 | + 'show_pending_payment_options' => new EE_Yes_No_Input( |
|
1010 | + array( |
|
1011 | + 'html_name' => 'show_pending_payment_options', |
|
1012 | + 'default' => $reg_config->show_pending_payment_options, |
|
1013 | + 'html_help_text' => esc_html__( |
|
1014 | + "If a payment is marked as 'Pending Payment', or if payment is deferred (ie, an offline gateway like Check, Bank, or Invoice is used), then give registrants the option to retry payment. ", |
|
1015 | + 'event_espresso' |
|
1016 | + ) |
|
1017 | + ) |
|
1018 | + ), |
|
1019 | + 'gateway_log_lifespan' => new EE_Select_Input( |
|
1020 | + $reg_config->gatewayLogLifespanOptions(), |
|
1021 | + array( |
|
1022 | + 'html_label_text' => esc_html__('Gateway Logs Lifespan', 'event_espresso'), |
|
1023 | + 'html_help_text' => esc_html__('If issues arise with payments being made through a payment gateway, it\'s helpful to log non-sensitive communications with the payment gateway. But it\'s a security responsibility, so it\'s a good idea to not keep them for any longer than necessary.', 'event_espresso'), |
|
1024 | + 'default' => $reg_config->gateway_log_lifespan, |
|
1025 | + ) |
|
1026 | + ) |
|
1027 | + ) |
|
1028 | + ) |
|
1029 | + ); |
|
1030 | + } |
|
1031 | + |
|
1032 | + |
|
1033 | + /** |
|
1034 | + * @throws EE_Error |
|
1035 | + */ |
|
1036 | + protected function _payment_log_overview_list_table() |
|
1037 | + { |
|
1038 | + $this->display_admin_list_table_page_with_sidebar(); |
|
1039 | + } |
|
1040 | + |
|
1041 | + |
|
1042 | + protected function _set_list_table_views_payment_log() |
|
1043 | + { |
|
1044 | + $this->_views = array( |
|
1045 | + 'all' => array( |
|
1046 | + 'slug' => 'all', |
|
1047 | + 'label' => esc_html__('View All Logs', 'event_espresso'), |
|
1048 | + 'count' => 0, |
|
1049 | + ), |
|
1050 | + ); |
|
1051 | + } |
|
1052 | + |
|
1053 | + |
|
1054 | + /** |
|
1055 | + * @param int $per_page |
|
1056 | + * @param int $current_page |
|
1057 | + * @param bool $count |
|
1058 | + * @return array|int |
|
1059 | + * @throws EE_Error |
|
1060 | + * @throws ReflectionException |
|
1061 | + */ |
|
1062 | + public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) |
|
1063 | + { |
|
1064 | + EE_Registry::instance()->load_model('Change_Log'); |
|
1065 | + // we may need to do multiple queries (joining differently), so we actually want an array of query params |
|
1066 | + $query_params = array(array('LOG_type' => EEM_Change_Log::type_gateway)); |
|
1067 | + // check if they've selected a specific payment method |
|
1068 | + if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') { |
|
1069 | + $query_params[0]['OR*pm_or_pay_pm'] = array( |
|
1070 | + 'Payment.Payment_Method.PMD_ID' => $this->_req_data['_payment_method'], |
|
1071 | + 'Payment_Method.PMD_ID' => $this->_req_data['_payment_method'], |
|
1072 | + ); |
|
1073 | + } |
|
1074 | + // take into account search |
|
1075 | + if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
|
1076 | + $similarity_string = array('LIKE', '%' . str_replace("", "%", $this->_req_data['s']) . '%'); |
|
1077 | + $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
|
1078 | + $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
|
1079 | + $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
|
1080 | + $query_params[0]['OR*s']['Payment.Payment_Method.PMD_name'] = $similarity_string; |
|
1081 | + $query_params[0]['OR*s']['Payment.Payment_Method.PMD_admin_name'] = $similarity_string; |
|
1082 | + $query_params[0]['OR*s']['Payment.Payment_Method.PMD_type'] = $similarity_string; |
|
1083 | + $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
|
1084 | + $query_params[0]['OR*s']['Payment_Method.PMD_name'] = $similarity_string; |
|
1085 | + $query_params[0]['OR*s']['Payment_Method.PMD_admin_name'] = $similarity_string; |
|
1086 | + $query_params[0]['OR*s']['Payment_Method.PMD_type'] = $similarity_string; |
|
1087 | + $query_params[0]['OR*s']['LOG_message'] = $similarity_string; |
|
1088 | + } |
|
1089 | + if ( |
|
1090 | + isset($this->_req_data['payment-filter-start-date']) |
|
1091 | + && isset($this->_req_data['payment-filter-end-date']) |
|
1092 | + ) { |
|
1093 | + // add date |
|
1094 | + $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
|
1095 | + $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
|
1096 | + // make sure our timestamps start and end right at the boundaries for each day |
|
1097 | + $start_date = date('Y-m-d', strtotime($start_date)) . ' 00:00:00'; |
|
1098 | + $end_date = date('Y-m-d', strtotime($end_date)) . ' 23:59:59'; |
|
1099 | + // convert to timestamps |
|
1100 | + $start_date = strtotime($start_date); |
|
1101 | + $end_date = strtotime($end_date); |
|
1102 | + // makes sure start date is the lowest value and vice versa |
|
1103 | + $start_date = min($start_date, $end_date); |
|
1104 | + $end_date = max($start_date, $end_date); |
|
1105 | + // convert for query |
|
1106 | + $start_date = EEM_Change_Log::instance()->convert_datetime_for_query( |
|
1107 | + 'LOG_time', |
|
1108 | + date('Y-m-d H:i:s', $start_date), |
|
1109 | + 'Y-m-d H:i:s' |
|
1110 | + ); |
|
1111 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( |
|
1112 | + 'LOG_time', |
|
1113 | + date('Y-m-d H:i:s', $end_date), |
|
1114 | + 'Y-m-d H:i:s' |
|
1115 | + ); |
|
1116 | + $query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date)); |
|
1117 | + } |
|
1118 | + if ($count) { |
|
1119 | + return EEM_Change_Log::instance()->count($query_params); |
|
1120 | + } |
|
1121 | + if (isset($this->_req_data['order'])) { |
|
1122 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) |
|
1123 | + ? $this->_req_data['order'] |
|
1124 | + : 'DESC'; |
|
1125 | + $query_params['order_by'] = array('LOG_time' => $sort); |
|
1126 | + } else { |
|
1127 | + $query_params['order_by'] = array('LOG_time' => 'DESC'); |
|
1128 | + } |
|
1129 | + $offset = ($current_page - 1) * $per_page; |
|
1130 | + if (! isset($this->_req_data['download_results'])) { |
|
1131 | + $query_params['limit'] = array($offset, $per_page); |
|
1132 | + } |
|
1133 | + // now they've requested to instead just download the file instead of viewing it. |
|
1134 | + if (isset($this->_req_data['download_results'])) { |
|
1135 | + $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
|
1136 | + header('Content-Disposition: attachment'); |
|
1137 | + header("Content-Disposition: attachment; filename=ee_payment_logs_for_" . sanitize_key(site_url())); |
|
1138 | + echo '<h1> ' |
|
1139 | + . sprintf( |
|
1140 | + esc_html__('Payment Logs for %1$s', 'event_espresso'), |
|
1141 | + esc_url_raw(site_url()) |
|
1142 | + ) |
|
1143 | + . '</h1 >'; |
|
1144 | + echo '<h3>' . esc_html__('Query:', 'event_espresso') . '</h3>'; |
|
1145 | + echo esc_html(var_export($query_params, true)); |
|
1146 | + echo '<h3>' . esc_html__('Results:', 'event_espresso') . '</h3>'; |
|
1147 | + echo esc_html(var_export($wpdb_results, true)); |
|
1148 | + die; |
|
1149 | + } |
|
1150 | + return EEM_Change_Log::instance()->get_all($query_params); |
|
1151 | + } |
|
1152 | + |
|
1153 | + |
|
1154 | + /** |
|
1155 | + * Used by usort to RE-sort log query results, because we lose the ordering |
|
1156 | + * because we're possibly combining the results from two queries |
|
1157 | + * |
|
1158 | + * @param EE_Change_Log $logA |
|
1159 | + * @param EE_Change_Log $logB |
|
1160 | + * @return int |
|
1161 | + * @throws EE_Error |
|
1162 | + * @throws ReflectionException |
|
1163 | + */ |
|
1164 | + protected function _sort_logs_again($logA, $logB) |
|
1165 | + { |
|
1166 | + $timeA = $logA->get_raw('LOG_time'); |
|
1167 | + $timeB = $logB->get_raw('LOG_time'); |
|
1168 | + if ($timeA == $timeB) { |
|
1169 | + return 0; |
|
1170 | + } |
|
1171 | + $comparison = $timeA < $timeB ? -1 : 1; |
|
1172 | + if (strtoupper($this->_sort_logs_again_direction) == 'DESC') { |
|
1173 | + return $comparison * -1; |
|
1174 | + } |
|
1175 | + return $comparison; |
|
1176 | + } |
|
1177 | + |
|
1178 | + |
|
1179 | + /** |
|
1180 | + * @throws EE_Error |
|
1181 | + * @throws ReflectionException |
|
1182 | + */ |
|
1183 | + protected function _payment_log_details() |
|
1184 | + { |
|
1185 | + EE_Registry::instance()->load_model('Change_Log'); |
|
1186 | + /** @var $payment_log EE_Change_Log */ |
|
1187 | + $payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']); |
|
1188 | + $payment_method = null; |
|
1189 | + $transaction = null; |
|
1190 | + if ($payment_log instanceof EE_Change_Log) { |
|
1191 | + if ($payment_log->object() instanceof EE_Payment) { |
|
1192 | + $payment_method = $payment_log->object()->payment_method(); |
|
1193 | + $transaction = $payment_log->object()->transaction(); |
|
1194 | + } elseif ($payment_log->object() instanceof EE_Payment_Method) { |
|
1195 | + $payment_method = $payment_log->object(); |
|
1196 | + } elseif ($payment_log->object() instanceof EE_Transaction) { |
|
1197 | + $transaction = $payment_log->object(); |
|
1198 | + $payment_method = $transaction->payment_method(); |
|
1199 | + } |
|
1200 | + } |
|
1201 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
1202 | + EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
1203 | + array( |
|
1204 | + 'payment_log' => $payment_log, |
|
1205 | + 'payment_method' => $payment_method, |
|
1206 | + 'transaction' => $transaction, |
|
1207 | + ), |
|
1208 | + true |
|
1209 | + ); |
|
1210 | + $this->display_admin_page_with_sidebar(); |
|
1211 | + } |
|
1212 | 1212 | } |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) { |
198 | 198 | $template_args = isset($config['template_args']) ? $config['template_args'] : array(); |
199 | 199 | $template_args['admin_page_obj'] = $this; |
200 | - $all_pmt_help_tabs_config[ $help_tab_name ] = array( |
|
200 | + $all_pmt_help_tabs_config[$help_tab_name] = array( |
|
201 | 201 | 'title' => $config['title'], |
202 | 202 | 'content' => EEH_Template::display_template( |
203 | - $payment_method_type->file_folder() . 'help_tabs/' . $config['filename'] . '.help_tab.php', |
|
203 | + $payment_method_type->file_folder().'help_tabs/'.$config['filename'].'.help_tab.php', |
|
204 | 204 | $template_args, |
205 | 205 | true |
206 | 206 | ), |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | wp_enqueue_script('ee-text-links'); |
247 | 247 | wp_enqueue_script( |
248 | 248 | 'espresso_payments', |
249 | - EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', |
|
249 | + EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', |
|
250 | 250 | array('ee-datepicker'), |
251 | 251 | EVENT_ESPRESSO_VERSION, |
252 | 252 | true |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // styles |
260 | 260 | wp_register_style( |
261 | 261 | 'espresso_payments', |
262 | - EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', |
|
262 | + EE_PAYMENTS_ASSETS_URL.'ee-payments.css', |
|
263 | 263 | array(), |
264 | 264 | EVENT_ESPRESSO_VERSION |
265 | 265 | ); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | // check for any active pms of that type |
305 | 305 | $payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name()); |
306 | - if (! $payment_method instanceof EE_Payment_Method) { |
|
306 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
307 | 307 | $payment_method = EE_Payment_Method::new_instance( |
308 | 308 | array( |
309 | 309 | 'PMD_slug' => sanitize_key($pmt_obj->system_name()), |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | ) |
314 | 314 | ); |
315 | 315 | } |
316 | - $payment_methods[ $payment_method->slug() ] = $payment_method; |
|
316 | + $payment_methods[$payment_method->slug()] = $payment_method; |
|
317 | 317 | } |
318 | 318 | $payment_methods = apply_filters( |
319 | 319 | 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | if ($payment_method instanceof EE_Payment_Method) { |
324 | 324 | add_meta_box( |
325 | 325 | // html id |
326 | - 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
326 | + 'espresso_'.$payment_method->slug().'_payment_settings', |
|
327 | 327 | // title |
328 | 328 | sprintf(esc_html__('%s Settings', 'event_espresso'), $payment_method->admin_name()), |
329 | 329 | // callback |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | array('payment_method' => $payment_method) |
339 | 339 | ); |
340 | 340 | // setup for tabbed content |
341 | - $tabs[ $payment_method->slug() ] = array( |
|
341 | + $tabs[$payment_method->slug()] = array( |
|
342 | 342 | 'label' => $payment_method->admin_name(), |
343 | 343 | 'class' => $payment_method->active() ? 'gateway-active' : '', |
344 | - 'href' => 'espresso_' . $payment_method->slug() . '_payment_settings', |
|
344 | + 'href' => 'espresso_'.$payment_method->slug().'_payment_settings', |
|
345 | 345 | 'title' => esc_html__('Modify this Payment Method', 'event_espresso'), |
346 | 346 | 'slug' => $payment_method->slug(), |
347 | 347 | ); |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | /** @var EE_Payment_Method $payment_method */ |
375 | 375 | $payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug))); |
376 | 376 | // if that didn't work or wasn't provided, find another way to select the current pm |
377 | - if (! $this->_verify_payment_method($payment_method)) { |
|
377 | + if ( ! $this->_verify_payment_method($payment_method)) { |
|
378 | 378 | // like, looking for an active one |
379 | 379 | $payment_method = EEM_Payment_Method::instance()->get_one_active('CART'); |
380 | 380 | // test that one as well |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | { |
427 | 427 | $payment_method = isset($metabox['args'], $metabox['args']['payment_method']) |
428 | 428 | ? $metabox['args']['payment_method'] : null; |
429 | - if (! $payment_method instanceof EE_Payment_Method) { |
|
429 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
430 | 430 | throw new EE_Error( |
431 | 431 | esc_html__( |
432 | 432 | 'Payment method metabox setup incorrectly. No Payment method object was supplied', |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | if ($form->form_data_present_in($this->_req_data)) { |
442 | 442 | $form->receive_form_submission($this->_req_data); |
443 | 443 | } |
444 | - echo $form->form_open() . $form->get_html_and_js() . $form->form_close(); // already escaped |
|
444 | + echo $form->form_open().$form->get_html_and_js().$form->form_close(); // already escaped |
|
445 | 445 | } else { |
446 | 446 | echo $this->_activate_payment_method_button($payment_method)->get_html_and_js(); // already escaped |
447 | 447 | } |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | */ |
459 | 459 | protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method = null) |
460 | 460 | { |
461 | - if (! $payment_method instanceof EE_Payment_Method) { |
|
461 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
462 | 462 | return new EE_Form_Section_Proper(); |
463 | 463 | } |
464 | 464 | return new EE_Form_Section_Proper( |
465 | 465 | array( |
466 | - 'name' => $payment_method->slug() . '_settings_form', |
|
467 | - 'html_id' => $payment_method->slug() . '_settings_form', |
|
466 | + 'name' => $payment_method->slug().'_settings_form', |
|
467 | + 'html_id' => $payment_method->slug().'_settings_form', |
|
468 | 468 | 'action' => EE_Admin_Page::add_query_args_and_nonce( |
469 | 469 | array( |
470 | 470 | 'action' => 'update_payment_method', |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | 'important-notice' |
513 | 513 | ) |
514 | 514 | ) |
515 | - ) . |
|
515 | + ). |
|
516 | 516 | EEH_HTML::td( |
517 | 517 | EEH_HTML::strong( |
518 | 518 | esc_html__( |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | */ |
548 | 548 | protected function _currency_support(EE_Payment_Method $payment_method) |
549 | 549 | { |
550 | - if (! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
550 | + if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) { |
|
551 | 551 | return new EE_Form_Section_HTML( |
552 | 552 | EEH_HTML::table( |
553 | 553 | EEH_HTML::tr( |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | 'important-notice' |
560 | 560 | ) |
561 | 561 | ) |
562 | - ) . |
|
562 | + ). |
|
563 | 563 | EEH_HTML::td( |
564 | 564 | EEH_HTML::strong( |
565 | 565 | sprintf( |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $update_button = new EE_Submit_Input( |
642 | 642 | array( |
643 | 643 | 'name' => 'submit', |
644 | - 'html_id' => 'save_' . $payment_method->slug() . '_settings', |
|
644 | + 'html_id' => 'save_'.$payment_method->slug().'_settings', |
|
645 | 645 | 'default' => sprintf( |
646 | 646 | esc_html__('Update %s Payment Settings', 'event_espresso'), |
647 | 647 | $payment_method->admin_name() |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | ); |
652 | 652 | return new EE_Form_Section_HTML( |
653 | 653 | EEH_HTML::table( |
654 | - EEH_HTML::no_row(EEH_HTML::br(2)) . |
|
654 | + EEH_HTML::no_row(EEH_HTML::br(2)). |
|
655 | 655 | EEH_HTML::tr( |
656 | - EEH_HTML::th(esc_html__('Update Settings', 'event_espresso')) . |
|
656 | + EEH_HTML::th(esc_html__('Update Settings', 'event_espresso')). |
|
657 | 657 | EEH_HTML::td( |
658 | 658 | $update_button->get_html_for_input() |
659 | 659 | ) |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | return new EE_Form_Section_HTML( |
680 | 680 | EEH_HTML::table( |
681 | 681 | EEH_HTML::tr( |
682 | - EEH_HTML::th(esc_html__('Deactivate Payment Method', 'event_espresso')) . |
|
682 | + EEH_HTML::th(esc_html__('Deactivate Payment Method', 'event_espresso')). |
|
683 | 683 | EEH_HTML::td( |
684 | 684 | EEH_HTML::link( |
685 | 685 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | ), |
692 | 692 | $link_text_and_title, |
693 | 693 | $link_text_and_title, |
694 | - 'deactivate_' . $payment_method->slug(), |
|
694 | + 'deactivate_'.$payment_method->slug(), |
|
695 | 695 | 'espresso-button button-secondary' |
696 | 696 | ) |
697 | 697 | ) |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | ); |
718 | 718 | return new EE_Form_Section_Proper( |
719 | 719 | array( |
720 | - 'name' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
721 | - 'html_id' => 'activate_' . $payment_method->slug() . '_settings_form', |
|
720 | + 'name' => 'activate_'.$payment_method->slug().'_settings_form', |
|
721 | + 'html_id' => 'activate_'.$payment_method->slug().'_settings_form', |
|
722 | 722 | 'action' => '#', |
723 | 723 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
724 | 724 | 'subsections' => apply_filters( |
@@ -734,11 +734,11 @@ discard block |
||
734 | 734 | '', |
735 | 735 | 'colspan="2"' |
736 | 736 | ) |
737 | - ) . |
|
737 | + ). |
|
738 | 738 | EEH_HTML::tr( |
739 | 739 | EEH_HTML::th( |
740 | 740 | EEH_HTML::label(esc_html__('Click to Activate ', 'event_espresso')) |
741 | - ) . |
|
741 | + ). |
|
742 | 742 | EEH_HTML::td( |
743 | 743 | EEH_HTML::link( |
744 | 744 | EE_Admin_Page::add_query_args_and_nonce( |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | ), |
751 | 751 | $link_text_and_title, |
752 | 752 | $link_text_and_title, |
753 | - 'activate_' . $payment_method->slug(), |
|
753 | + 'activate_'.$payment_method->slug(), |
|
754 | 754 | 'espresso-button-green button-primary' |
755 | 755 | ) |
756 | 756 | ) |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | return new EE_Form_Section_HTML( |
777 | 777 | EEH_HTML::table( |
778 | 778 | EEH_HTML::tr( |
779 | - EEH_HTML::th() . |
|
779 | + EEH_HTML::th(). |
|
780 | 780 | EEH_HTML::td( |
781 | 781 | EEH_HTML::p(esc_html__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text') |
782 | 782 | ) |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | } |
868 | 868 | } |
869 | 869 | // if we couldn't find the correct payment method type... |
870 | - if (! $correct_pmt_form_to_use) { |
|
870 | + if ( ! $correct_pmt_form_to_use) { |
|
871 | 871 | EE_Error::add_error( |
872 | 872 | esc_html__( |
873 | 873 | "We could not find which payment method type your form submission related to. Please contact support", |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $correct_pmt_form_to_use->receive_form_submission($this->_req_data); |
883 | 883 | if ($correct_pmt_form_to_use->is_valid()) { |
884 | 884 | $payment_settings_subform = $correct_pmt_form_to_use->get_subsection('payment_method_settings'); |
885 | - if (! $payment_settings_subform instanceof EE_Payment_Method_Form) { |
|
885 | + if ( ! $payment_settings_subform instanceof EE_Payment_Method_Form) { |
|
886 | 886 | throw new EE_Error( |
887 | 887 | sprintf( |
888 | 888 | esc_html__( |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | $form = $this->getPaymentSettingsForm(); |
934 | 934 | $this->_set_add_edit_form_tags('update_payment_settings'); |
935 | 935 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
936 | - $this->_template_args['admin_page_content'] = $form->get_html_and_js(); |
|
936 | + $this->_template_args['admin_page_content'] = $form->get_html_and_js(); |
|
937 | 937 | $this->display_admin_page_with_sidebar(); |
938 | 938 | } |
939 | 939 | |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | } |
1074 | 1074 | // take into account search |
1075 | 1075 | if (isset($this->_req_data['s']) && $this->_req_data['s']) { |
1076 | - $similarity_string = array('LIKE', '%' . str_replace("", "%", $this->_req_data['s']) . '%'); |
|
1076 | + $similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%'); |
|
1077 | 1077 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string; |
1078 | 1078 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string; |
1079 | 1079 | $query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string; |
@@ -1094,8 +1094,8 @@ discard block |
||
1094 | 1094 | $start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']); |
1095 | 1095 | $end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']); |
1096 | 1096 | // make sure our timestamps start and end right at the boundaries for each day |
1097 | - $start_date = date('Y-m-d', strtotime($start_date)) . ' 00:00:00'; |
|
1098 | - $end_date = date('Y-m-d', strtotime($end_date)) . ' 23:59:59'; |
|
1097 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1098 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1099 | 1099 | // convert to timestamps |
1100 | 1100 | $start_date = strtotime($start_date); |
1101 | 1101 | $end_date = strtotime($end_date); |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | date('Y-m-d H:i:s', $start_date), |
1109 | 1109 | 'Y-m-d H:i:s' |
1110 | 1110 | ); |
1111 | - $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( |
|
1111 | + $end_date = EEM_Change_Log::instance()->convert_datetime_for_query( |
|
1112 | 1112 | 'LOG_time', |
1113 | 1113 | date('Y-m-d H:i:s', $end_date), |
1114 | 1114 | 'Y-m-d H:i:s' |
@@ -1127,23 +1127,23 @@ discard block |
||
1127 | 1127 | $query_params['order_by'] = array('LOG_time' => 'DESC'); |
1128 | 1128 | } |
1129 | 1129 | $offset = ($current_page - 1) * $per_page; |
1130 | - if (! isset($this->_req_data['download_results'])) { |
|
1130 | + if ( ! isset($this->_req_data['download_results'])) { |
|
1131 | 1131 | $query_params['limit'] = array($offset, $per_page); |
1132 | 1132 | } |
1133 | 1133 | // now they've requested to instead just download the file instead of viewing it. |
1134 | 1134 | if (isset($this->_req_data['download_results'])) { |
1135 | 1135 | $wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params); |
1136 | 1136 | header('Content-Disposition: attachment'); |
1137 | - header("Content-Disposition: attachment; filename=ee_payment_logs_for_" . sanitize_key(site_url())); |
|
1137 | + header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url())); |
|
1138 | 1138 | echo '<h1> ' |
1139 | 1139 | . sprintf( |
1140 | 1140 | esc_html__('Payment Logs for %1$s', 'event_espresso'), |
1141 | 1141 | esc_url_raw(site_url()) |
1142 | 1142 | ) |
1143 | 1143 | . '</h1 >'; |
1144 | - echo '<h3>' . esc_html__('Query:', 'event_espresso') . '</h3>'; |
|
1144 | + echo '<h3>'.esc_html__('Query:', 'event_espresso').'</h3>'; |
|
1145 | 1145 | echo esc_html(var_export($query_params, true)); |
1146 | - echo '<h3>' . esc_html__('Results:', 'event_espresso') . '</h3>'; |
|
1146 | + echo '<h3>'.esc_html__('Results:', 'event_espresso').'</h3>'; |
|
1147 | 1147 | echo esc_html(var_export($wpdb_results, true)); |
1148 | 1148 | die; |
1149 | 1149 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | } |
1200 | 1200 | } |
1201 | 1201 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
1202 | - EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php', |
|
1202 | + EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php', |
|
1203 | 1203 | array( |
1204 | 1204 | 'payment_log' => $payment_log, |
1205 | 1205 | 'payment_method' => $payment_method, |
@@ -9,24 +9,24 @@ |
||
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <?php esc_html_e( |
12 | - 'Specify if registrants should be allowed to attempt additional payments if the original payment is delayed.', |
|
13 | - 'event_espresso' |
|
14 | - ); ?> |
|
12 | + 'Specify if registrants should be allowed to attempt additional payments if the original payment is delayed.', |
|
13 | + 'event_espresso' |
|
14 | + ); ?> |
|
15 | 15 | </p> |
16 | 16 | <p> |
17 | 17 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong><br /> |
18 | 18 | <?php printf( |
19 | - esc_html__( |
|
20 | - 'Want to see a tour of this screen? Click on the Payment Settings Overview Tour button which appears on the right side of the page. %1$sTo learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
21 | - 'event_espresso' |
|
22 | - ), |
|
23 | - '<br />' |
|
24 | - ); ?> |
|
19 | + esc_html__( |
|
20 | + 'Want to see a tour of this screen? Click on the Payment Settings Overview Tour button which appears on the right side of the page. %1$sTo learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
21 | + 'event_espresso' |
|
22 | + ), |
|
23 | + '<br />' |
|
24 | + ); ?> |
|
25 | 25 | </p> |
26 | 26 | <p> |
27 | 27 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong><br /> |
28 | 28 | <?php esc_html_e( |
29 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
30 | - 'event_espresso' |
|
31 | - ); ?> |
|
29 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
30 | + 'event_espresso' |
|
31 | + ); ?> |
|
32 | 32 | </p> |
33 | 33 | \ No newline at end of file |
@@ -16,21 +16,21 @@ discard block |
||
16 | 16 | </th> |
17 | 17 | <td> |
18 | 18 | <?php echo EEH_Form_Fields::select_input( |
19 | - 'use_google_maps', |
|
20 | - $values, |
|
21 | - $map_settings->use_google_maps, |
|
22 | - 'id="ee-display-map-no-shortcodes"' |
|
23 | - ); ?> |
|
19 | + 'use_google_maps', |
|
20 | + $values, |
|
21 | + $map_settings->use_google_maps, |
|
22 | + 'id="ee-display-map-no-shortcodes"' |
|
23 | + ); ?> |
|
24 | 24 | <p class="description"> |
25 | 25 | <?php esc_html_e( |
26 | - 'Turn Google maps on or off site wide for Event Espresso.', |
|
27 | - 'event_espresso' |
|
28 | - ); ?> |
|
26 | + 'Turn Google maps on or off site wide for Event Espresso.', |
|
27 | + 'event_espresso' |
|
28 | + ); ?> |
|
29 | 29 | </p> |
30 | 30 | </td> |
31 | 31 | </tr> |
32 | 32 | <?php |
33 | - if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
33 | + if (apply_filters('FHEE__google_map__show_api_key_input', true)) { ?> |
|
34 | 34 | <tr> |
35 | 35 | <th> |
36 | 36 | <label for="ee-google-map-api-key"> |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | /> |
47 | 47 | <p class="description"> |
48 | 48 | <?php printf( |
49 | - esc_html__( |
|
50 | - 'An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', |
|
51 | - 'event_espresso' |
|
52 | - ), |
|
53 | - '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank" rel="noopener noreferrer">', |
|
54 | - '</a>' |
|
55 | - ); |
|
56 | - ?> |
|
49 | + esc_html__( |
|
50 | + 'An API key is now required to use the Google Maps API: %1$sclick here to get an API key%2$s', |
|
51 | + 'event_espresso' |
|
52 | + ), |
|
53 | + '<a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend,geocoding_backend,directions_backend,distance_matrix_backend,elevation_backend,static_maps_backend&keyType=CLIENT_SIDE&reusekey=true" target="_blank" rel="noopener noreferrer">', |
|
54 | + '</a>' |
|
55 | + ); |
|
56 | + ?> |
|
57 | 57 | </p> |
58 | 58 | </td> |
59 | 59 | </tr> |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | </th> |
123 | 123 | <td> |
124 | 124 | <?php echo EEH_Form_Fields::select_input( |
125 | - 'event_details_display_nav', |
|
126 | - $values, |
|
127 | - $map_settings->event_details_display_nav, |
|
128 | - 'id="event_details_display_nav" ' |
|
129 | - ); ?> |
|
125 | + 'event_details_display_nav', |
|
126 | + $values, |
|
127 | + $map_settings->event_details_display_nav, |
|
128 | + 'id="event_details_display_nav" ' |
|
129 | + ); ?> |
|
130 | 130 | </td> |
131 | 131 | </tr> |
132 | 132 | |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | </th> |
139 | 139 | <td> |
140 | 140 | <?php echo EEH_Form_Fields::select_input( |
141 | - 'event_details_nav_size', |
|
142 | - $values, |
|
143 | - $map_settings->event_details_nav_size, |
|
144 | - 'id="event_details_nav_size"' |
|
145 | - ); ?> |
|
141 | + 'event_details_nav_size', |
|
142 | + $values, |
|
143 | + $map_settings->event_details_nav_size, |
|
144 | + 'id="event_details_nav_size"' |
|
145 | + ); ?> |
|
146 | 146 | </td> |
147 | 147 | </tr> |
148 | 148 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | <td> |
154 | 154 | <label for="event_details_control_type-default" class="ee-admin-radio-lbl"> |
155 | 155 | <?php $checked = $map_settings->event_details_control_type == 'default' |
156 | - ? 'checked="checked"' |
|
157 | - : ''; ?> |
|
156 | + ? 'checked="checked"' |
|
157 | + : ''; ?> |
|
158 | 158 | <input id="event_details_control_type-default" |
159 | 159 | type="radio" |
160 | 160 | name="event_details_control_type" |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | <label for="event_details_control_type-horizontal" class="ee-admin-radio-lbl"> |
168 | 168 | <?php $checked = $map_settings->event_details_control_type == 'horizontal' |
169 | - ? 'checked="checked"' |
|
170 | - : ''; ?> |
|
169 | + ? 'checked="checked"' |
|
170 | + : ''; ?> |
|
171 | 171 | <input id="event_details_control_type-horizontal" |
172 | 172 | type="radio" |
173 | 173 | name="event_details_control_type" |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | |
180 | 180 | <label for="event_details_control_type-dropdown" class="ee-admin-radio-lbl"> |
181 | 181 | <?php $checked = $map_settings->event_details_control_type == 'dropdown' |
182 | - ? 'checked="checked"' |
|
183 | - : ''; ?> |
|
182 | + ? 'checked="checked"' |
|
183 | + : ''; ?> |
|
184 | 184 | <input id="event_details_control_type-dropdown" |
185 | 185 | type="radio" |
186 | 186 | name="event_details_control_type" |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | <td> |
199 | 199 | <label for="event_details_map_align-none" class="ee-admin-radio-lbl"> |
200 | 200 | <?php $checked = $map_settings->event_details_map_align == 'none' |
201 | - ? 'checked="checked"' |
|
202 | - : ''; ?> |
|
201 | + ? 'checked="checked"' |
|
202 | + : ''; ?> |
|
203 | 203 | <input id="event_details_map_align-none" |
204 | 204 | type="radio" |
205 | 205 | name="event_details_map_align" |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | |
212 | 212 | <label for="event_details_map_align-left" class="ee-admin-radio-lbl"> |
213 | 213 | <?php $checked = $map_settings->event_details_map_align == 'left' |
214 | - ? 'checked="checked"' |
|
215 | - : ''; ?> |
|
214 | + ? 'checked="checked"' |
|
215 | + : ''; ?> |
|
216 | 216 | <input id="event_details_map_align-left" |
217 | 217 | type="radio" |
218 | 218 | name="event_details_map_align" |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | |
225 | 225 | <label for="event_details_map_align-center" class="ee-admin-radio-lbl"> |
226 | 226 | <?php $checked = $map_settings->event_details_map_align == 'center' |
227 | - ? 'checked="checked"' |
|
228 | - : ''; ?> |
|
227 | + ? 'checked="checked"' |
|
228 | + : ''; ?> |
|
229 | 229 | <input id="event_details_map_align-center" |
230 | 230 | type="radio" |
231 | 231 | name="event_details_map_align" |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | |
238 | 238 | <label for="event_details_map_align-right" class="ee-admin-radio-lbl"> |
239 | 239 | <?php $checked = $map_settings->event_details_map_align == 'right' |
240 | - ? 'checked="checked"' |
|
241 | - : ''; ?> |
|
240 | + ? 'checked="checked"' |
|
241 | + : ''; ?> |
|
242 | 242 | <input id="event_details_map_align-right" |
243 | 243 | type="radio" |
244 | 244 | name="event_details_map_align" |
@@ -311,11 +311,11 @@ discard block |
||
311 | 311 | </th> |
312 | 312 | <td> |
313 | 313 | <?php echo EEH_Form_Fields::select_input( |
314 | - 'event_list_display_nav', |
|
315 | - $values, |
|
316 | - $map_settings->event_list_display_nav, |
|
317 | - 'id="event_list_display_nav"' |
|
318 | - ); ?> |
|
314 | + 'event_list_display_nav', |
|
315 | + $values, |
|
316 | + $map_settings->event_list_display_nav, |
|
317 | + 'id="event_list_display_nav"' |
|
318 | + ); ?> |
|
319 | 319 | </td> |
320 | 320 | </tr> |
321 | 321 | |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | </th> |
328 | 328 | <td> |
329 | 329 | <?php echo EEH_Form_Fields::select_input( |
330 | - 'event_list_nav_size', |
|
331 | - $values, |
|
332 | - $map_settings->event_list_nav_size, |
|
333 | - 'id="event_list_nav_size"' |
|
334 | - ); ?> |
|
330 | + 'event_list_nav_size', |
|
331 | + $values, |
|
332 | + $map_settings->event_list_nav_size, |
|
333 | + 'id="event_list_nav_size"' |
|
334 | + ); ?> |
|
335 | 335 | </td> |
336 | 336 | </tr> |
337 | 337 | |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | <td> |
343 | 343 | <label for="event_list_control_type-default" class="ee-admin-radio-lbl"> |
344 | 344 | <?php $checked = $map_settings->event_list_control_type == 'default' |
345 | - ? 'checked="checked"' |
|
346 | - : ''; ?> |
|
345 | + ? 'checked="checked"' |
|
346 | + : ''; ?> |
|
347 | 347 | <input id="event_list_control_type-default" |
348 | 348 | type="radio" |
349 | 349 | name="event_list_control_type" |
@@ -355,8 +355,8 @@ discard block |
||
355 | 355 | |
356 | 356 | <label for="event_list_control_type-horizontal" class="ee-admin-radio-lbl"> |
357 | 357 | <?php $checked = $map_settings->event_list_control_type == 'horizontal' |
358 | - ? 'checked="checked"' |
|
359 | - : ''; ?> |
|
358 | + ? 'checked="checked"' |
|
359 | + : ''; ?> |
|
360 | 360 | <input id="event_list_control_type-horizontal" |
361 | 361 | type="radio" |
362 | 362 | name="event_list_control_type" |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | |
369 | 369 | <label for="event_list_control_type-dropdown" class="ee-admin-radio-lbl"> |
370 | 370 | <?php $checked = |
371 | - $map_settings->event_list_control_type == 'dropdown' |
|
372 | - ? 'checked="checked"' |
|
373 | - : ''; ?> |
|
371 | + $map_settings->event_list_control_type == 'dropdown' |
|
372 | + ? 'checked="checked"' |
|
373 | + : ''; ?> |
|
374 | 374 | <input id="event_list_control_type-dropdown" |
375 | 375 | type="radio" |
376 | 376 | name="event_list_control_type" |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | <td> |
391 | 391 | <label for="event_list_map_align-none" class="ee-admin-radio-lbl"> |
392 | 392 | <?php $checked = $map_settings->event_list_map_align == 'none' |
393 | - ? 'checked="checked"' |
|
394 | - : ''; ?> |
|
393 | + ? 'checked="checked"' |
|
394 | + : ''; ?> |
|
395 | 395 | <input id="event_list_map_align-none" |
396 | 396 | type="radio" |
397 | 397 | name="event_list_map_align" |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | |
404 | 404 | <label for="event_list_map_align-left" class="ee-admin-radio-lbl"> |
405 | 405 | <?php $checked = $map_settings->event_list_map_align == 'left' |
406 | - ? 'checked="checked"' |
|
407 | - : ''; ?> |
|
406 | + ? 'checked="checked"' |
|
407 | + : ''; ?> |
|
408 | 408 | <input id="event_list_map_align-left" |
409 | 409 | type="radio" |
410 | 410 | name="event_list_map_align" |
@@ -416,8 +416,8 @@ discard block |
||
416 | 416 | |
417 | 417 | <label for="event_list_map_align-center" class="ee-admin-radio-lbl"> |
418 | 418 | <?php $checked = $map_settings->event_list_map_align == 'center' |
419 | - ? 'checked="checked"' |
|
420 | - : ''; ?> |
|
419 | + ? 'checked="checked"' |
|
420 | + : ''; ?> |
|
421 | 421 | <input id="event_list_map_align-center" |
422 | 422 | type="radio" |
423 | 423 | name="event_list_map_align" |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | |
430 | 430 | <label for="event_list_map_align-right" class="ee-admin-radio-lbl"> |
431 | 431 | <?php $checked = $map_settings->event_list_map_align == 'right' |
432 | - ? 'checked="checked"' |
|
433 | - : ''; ?> |
|
432 | + ? 'checked="checked"' |
|
433 | + : ''; ?> |
|
434 | 434 | <input id="event_list_map_align-right" |
435 | 435 | type="radio" |
436 | 436 | name="event_list_map_align" |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | <td valign="top"> |
11 | 11 | <fieldset> |
12 | 12 | <?php |
13 | - if ( |
|
14 | - isset(EE_Registry::instance()->CFG->map_settings) |
|
15 | - && isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
16 | - && EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
17 | - ) { ?> |
|
13 | + if ( |
|
14 | + isset(EE_Registry::instance()->CFG->map_settings) |
|
15 | + && isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
16 | + && EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
17 | + ) { ?> |
|
18 | 18 | <p> |
19 | 19 | <label for="enable_for_gmap"> |
20 | 20 | <?php esc_html_e('Display Google Map for this venue? ', 'event_espresso') ?> |
@@ -27,25 +27,25 @@ discard block |
||
27 | 27 | class="all-options" /> |
28 | 28 | </p> --> |
29 | 29 | <?php |
30 | - } |
|
30 | + } |
|
31 | 31 | |
32 | - if ( |
|
33 | - ! isset(EE_Registry::instance()->CFG->map_settings) |
|
34 | - || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
35 | - || ! EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
36 | - ) { ?> |
|
32 | + if ( |
|
33 | + ! isset(EE_Registry::instance()->CFG->map_settings) |
|
34 | + || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
35 | + || ! EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
36 | + ) { ?> |
|
37 | 37 | <p class="ee-notice"> |
38 | 38 | <?php |
39 | - printf( |
|
40 | - esc_html__( |
|
41 | - 'To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"', |
|
42 | - 'event_espresso' |
|
43 | - ), |
|
44 | - '<b>', |
|
45 | - '</b> » <b>', |
|
46 | - '</b>' |
|
47 | - ); |
|
48 | - ?> |
|
39 | + printf( |
|
40 | + esc_html__( |
|
41 | + 'To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"', |
|
42 | + 'event_espresso' |
|
43 | + ), |
|
44 | + '<b>', |
|
45 | + '</b> » <b>', |
|
46 | + '</b>' |
|
47 | + ); |
|
48 | + ?> |
|
49 | 49 | </p> |
50 | 50 | <?php } ?> |
51 | 51 | </fieldset> |
@@ -19,7 +19,7 @@ |
||
19 | 19 | <label for="enable_for_gmap"> |
20 | 20 | <?php esc_html_e('Display Google Map for this venue? ', 'event_espresso') ?> |
21 | 21 | </label> |
22 | - <?php echo $vnu_enable_for_gmap;// already escaped ?> |
|
22 | + <?php echo $vnu_enable_for_gmap; // already escaped ?> |
|
23 | 23 | </p> |
24 | 24 | <!-- <p> |
25 | 25 | <?php // esc_html_e('Google Map Link (for email):', 'event_espresso'); ?> |
@@ -14,20 +14,20 @@ |
||
14 | 14 | <?php esc_html_e('Select from Venue Manager List', 'event_espresso'); ?> |
15 | 15 | </label> |
16 | 16 | <?php |
17 | - echo $venue_selector; // already escaped |
|
18 | - echo $new_venue_link; // already escaped |
|
19 | - foreach ($venues as $venue) : |
|
20 | - if (! $venue instanceof EE_Venue) { |
|
21 | - continue; |
|
22 | - } |
|
23 | - $selected = $evt_venue_id === $venue->ID() ? 'ee-venue-selected' : 'ee-venue-not-selected'; |
|
24 | - $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
25 | - ['action' => 'edit', 'post' => $venue->ID()], |
|
26 | - EE_VENUES_ADMIN_URL |
|
27 | - ); |
|
28 | - $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : null; |
|
29 | - $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : null; |
|
30 | - ?> |
|
17 | + echo $venue_selector; // already escaped |
|
18 | + echo $new_venue_link; // already escaped |
|
19 | + foreach ($venues as $venue) : |
|
20 | + if (! $venue instanceof EE_Venue) { |
|
21 | + continue; |
|
22 | + } |
|
23 | + $selected = $evt_venue_id === $venue->ID() ? 'ee-venue-selected' : 'ee-venue-not-selected'; |
|
24 | + $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
25 | + ['action' => 'edit', 'post' => $venue->ID()], |
|
26 | + EE_VENUES_ADMIN_URL |
|
27 | + ); |
|
28 | + $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : null; |
|
29 | + $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : null; |
|
30 | + ?> |
|
31 | 31 | <div class='eebox <?php echo $selected; ?>' id="eebox_<?php echo esc_attr($venue->ID()); ?>"> |
32 | 32 | <p class='address-view'> |
33 | 33 | <span><?php esc_html_e('Address:', 'event_espresso'); ?> </span> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | echo $venue_selector; // already escaped |
18 | 18 | echo $new_venue_link; // already escaped |
19 | 19 | foreach ($venues as $venue) : |
20 | - if (! $venue instanceof EE_Venue) { |
|
20 | + if ( ! $venue instanceof EE_Venue) { |
|
21 | 21 | continue; |
22 | 22 | } |
23 | 23 | $selected = $evt_venue_id === $venue->ID() ? 'ee-venue-selected' : 'ee-venue-not-selected'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <p class='address-view'> |
33 | 33 | <span><?php esc_html_e('Address:', 'event_espresso'); ?> </span> |
34 | 34 | <?php echo esc_html($venue->address()); ?> |
35 | - <?php echo $venue->address2() ? '<br />' . esc_html($venue->address2()) : ''; ?> |
|
35 | + <?php echo $venue->address2() ? '<br />'.esc_html($venue->address2()) : ''; ?> |
|
36 | 36 | <br /> |
37 | 37 | <span><?php esc_html_e('City:', 'event_espresso'); ?> </span> |
38 | 38 | <?php echo esc_html($venue->city()); ?> |