@@ -1,6 +1,6 @@ |
||
1 | 1 | <h1><span class="small-text not-bold"> |
2 | 2 | <?php _e( |
3 | - 'Adding Registration For: ', |
|
4 | - 'event_espresso' |
|
5 | - ); ?></span><?php echo $event_name; ?></h1> |
|
3 | + 'Adding Registration For: ', |
|
4 | + 'event_espresso' |
|
5 | + ); ?></span><?php echo $event_name; ?></h1> |
|
6 | 6 | <?php echo $step_content; |
@@ -1,23 +1,23 @@ |
||
1 | 1 | <div style="float:right"> |
2 | 2 | <?php printf( |
3 | - __('View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), |
|
4 | - '<a href="' . $filtered_registrations_link . '">', |
|
5 | - '<a href="' . $filtered_transactions_link . '">', |
|
6 | - '<a href="' . $event_link . '">', |
|
7 | - '</a>' |
|
8 | - ); ?> |
|
3 | + __('View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), |
|
4 | + '<a href="' . $filtered_registrations_link . '">', |
|
5 | + '<a href="' . $filtered_transactions_link . '">', |
|
6 | + '<a href="' . $event_link . '">', |
|
7 | + '</a>' |
|
8 | + ); ?> |
|
9 | 9 | </div> |
10 | 10 | <h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration . ' '; |
11 | - echo __('Registration # ', 'event_espresso') . $reg_nmbr['value']; |
|
12 | - echo ' ' . $next_registration; ?></h3> |
|
11 | + echo __('Registration # ', 'event_espresso') . $reg_nmbr['value']; |
|
12 | + echo ' ' . $next_registration; ?></h3> |
|
13 | 13 | <h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value']; ?></h2> |
14 | 14 | |
15 | 15 | <?php if ($registration->group_size() > 1) : ?> |
16 | 16 | <a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"> |
17 | 17 | <?php echo __( |
18 | - 'Scroll to Other Registrations in the Same Transaction', |
|
19 | - 'event_espresso' |
|
20 | - ); ?></a> |
|
18 | + 'Scroll to Other Registrations in the Same Transaction', |
|
19 | + 'event_espresso' |
|
20 | + ); ?></a> |
|
21 | 21 | <?php endif; ?> |
22 | 22 | |
23 | 23 | <?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?> |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <div style="float:right"> |
2 | 2 | <?php printf( |
3 | 3 | __('View %1$sRegistrations%4$s / %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), |
4 | - '<a href="' . $filtered_registrations_link . '">', |
|
5 | - '<a href="' . $filtered_transactions_link . '">', |
|
6 | - '<a href="' . $event_link . '">', |
|
4 | + '<a href="'.$filtered_registrations_link.'">', |
|
5 | + '<a href="'.$filtered_transactions_link.'">', |
|
6 | + '<a href="'.$event_link.'">', |
|
7 | 7 | '</a>' |
8 | 8 | ); ?> |
9 | 9 | </div> |
10 | -<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration . ' '; |
|
11 | - echo __('Registration # ', 'event_espresso') . $reg_nmbr['value']; |
|
12 | - echo ' ' . $next_registration; ?></h3> |
|
10 | +<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration.' '; |
|
11 | + echo __('Registration # ', 'event_espresso').$reg_nmbr['value']; |
|
12 | + echo ' '.$next_registration; ?></h3> |
|
13 | 13 | <h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value']; ?></h2> |
14 | 14 | |
15 | 15 | <?php if ($registration->group_size() > 1) : ?> |
@@ -17,62 +17,62 @@ |
||
17 | 17 | <tr> |
18 | 18 | <td class="jst-left"> |
19 | 19 | <?php |
20 | - $event_url = add_query_arg( |
|
21 | - array('action' => 'edit', 'post' => $registration->event_ID()), |
|
22 | - admin_url('admin.php?page=espresso_events') |
|
23 | - ); |
|
24 | - echo EE_Registry::instance()->CAP->current_user_can( |
|
25 | - 'ee_edit_event', |
|
26 | - 'espresso_events_edit', |
|
27 | - $registration->event_ID() |
|
28 | - ) ? '<a href="' . $event_url . '" title="' |
|
29 | - . esc_attr__( |
|
30 | - 'Edit Event', |
|
31 | - 'event_espresso' |
|
32 | - ) . '">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
33 | - ?> |
|
20 | + $event_url = add_query_arg( |
|
21 | + array('action' => 'edit', 'post' => $registration->event_ID()), |
|
22 | + admin_url('admin.php?page=espresso_events') |
|
23 | + ); |
|
24 | + echo EE_Registry::instance()->CAP->current_user_can( |
|
25 | + 'ee_edit_event', |
|
26 | + 'espresso_events_edit', |
|
27 | + $registration->event_ID() |
|
28 | + ) ? '<a href="' . $event_url . '" title="' |
|
29 | + . esc_attr__( |
|
30 | + 'Edit Event', |
|
31 | + 'event_espresso' |
|
32 | + ) . '">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
33 | + ?> |
|
34 | 34 | </td> |
35 | 35 | <td class="jst-left"> |
36 | 36 | <?php |
37 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( |
|
38 | - array('action' => 'view_registration', '_REG_ID' => $registration->ID()), |
|
39 | - REG_ADMIN_URL |
|
40 | - ); |
|
41 | - echo EE_Registry::instance()->CAP->current_user_can( |
|
42 | - 'ee_read_registration', |
|
43 | - 'espresso_registrations_view_registration', |
|
44 | - $registration->ID() |
|
45 | - ) ? ' |
|
37 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce( |
|
38 | + array('action' => 'view_registration', '_REG_ID' => $registration->ID()), |
|
39 | + REG_ADMIN_URL |
|
40 | + ); |
|
41 | + echo EE_Registry::instance()->CAP->current_user_can( |
|
42 | + 'ee_read_registration', |
|
43 | + 'espresso_registrations_view_registration', |
|
44 | + $registration->ID() |
|
45 | + ) ? ' |
|
46 | 46 | <a href="' . $reg_url . '" title="' |
47 | - . esc_attr__( |
|
48 | - 'View Registration Details', |
|
49 | - 'event_espresso' |
|
50 | - ) . '">' . |
|
51 | - esc_html__('View Registration', 'event_espresso') . |
|
52 | - '</a>' : $registration->ID(); |
|
53 | - ?> |
|
47 | + . esc_attr__( |
|
48 | + 'View Registration Details', |
|
49 | + 'event_espresso' |
|
50 | + ) . '">' . |
|
51 | + esc_html__('View Registration', 'event_espresso') . |
|
52 | + '</a>' : $registration->ID(); |
|
53 | + ?> |
|
54 | 54 | </td> |
55 | 55 | <td class="jst-left"> |
56 | 56 | <?php |
57 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( |
|
58 | - array('action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()), |
|
59 | - TXN_ADMIN_URL |
|
60 | - ); |
|
61 | - echo EE_Registry::instance()->CAP->current_user_can( |
|
62 | - 'ee_read_transaction', |
|
63 | - 'espresso_transactions_view_transaction' |
|
64 | - ) ? ' |
|
57 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce( |
|
58 | + array('action' => 'view_transaction', 'TXN_ID' => $registration->transaction_ID()), |
|
59 | + TXN_ADMIN_URL |
|
60 | + ); |
|
61 | + echo EE_Registry::instance()->CAP->current_user_can( |
|
62 | + 'ee_read_transaction', |
|
63 | + 'espresso_transactions_view_transaction' |
|
64 | + ) ? ' |
|
65 | 65 | <a href="' . $txn_url . '" title="' |
66 | - . esc_attr__( |
|
67 | - 'View Transaction Details', |
|
68 | - 'event_espresso' |
|
69 | - ) . '">' . |
|
70 | - sprintf( |
|
71 | - esc_html__('View Transaction %d', 'event_espresso'), |
|
72 | - $registration->transaction_ID() |
|
73 | - ) . |
|
74 | - '</a>' : $registration->transaction_ID(); |
|
75 | - ?> |
|
66 | + . esc_attr__( |
|
67 | + 'View Transaction Details', |
|
68 | + 'event_espresso' |
|
69 | + ) . '">' . |
|
70 | + sprintf( |
|
71 | + esc_html__('View Transaction %d', 'event_espresso'), |
|
72 | + $registration->transaction_ID() |
|
73 | + ) . |
|
74 | + '</a>' : $registration->transaction_ID(); |
|
75 | + ?> |
|
76 | 76 | </td> |
77 | 77 | <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
78 | 78 | <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | 'ee_edit_event', |
26 | 26 | 'espresso_events_edit', |
27 | 27 | $registration->event_ID() |
28 | - ) ? '<a href="' . $event_url . '" title="' |
|
28 | + ) ? '<a href="'.$event_url.'" title="' |
|
29 | 29 | . esc_attr__( |
30 | 30 | 'Edit Event', |
31 | 31 | 'event_espresso' |
32 | - ) . '">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
32 | + ).'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
33 | 33 | ?> |
34 | 34 | </td> |
35 | 35 | <td class="jst-left"> |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | 'espresso_registrations_view_registration', |
44 | 44 | $registration->ID() |
45 | 45 | ) ? ' |
46 | - <a href="' . $reg_url . '" title="' |
|
46 | + <a href="' . $reg_url.'" title="' |
|
47 | 47 | . esc_attr__( |
48 | 48 | 'View Registration Details', |
49 | 49 | 'event_espresso' |
50 | - ) . '">' . |
|
51 | - esc_html__('View Registration', 'event_espresso') . |
|
50 | + ).'">'. |
|
51 | + esc_html__('View Registration', 'event_espresso'). |
|
52 | 52 | '</a>' : $registration->ID(); |
53 | 53 | ?> |
54 | 54 | </td> |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | 'ee_read_transaction', |
63 | 63 | 'espresso_transactions_view_transaction' |
64 | 64 | ) ? ' |
65 | - <a href="' . $txn_url . '" title="' |
|
65 | + <a href="' . $txn_url.'" title="' |
|
66 | 66 | . esc_attr__( |
67 | 67 | 'View Transaction Details', |
68 | 68 | 'event_espresso' |
69 | - ) . '">' . |
|
69 | + ).'">'. |
|
70 | 70 | sprintf( |
71 | 71 | esc_html__('View Transaction %d', 'event_espresso'), |
72 | 72 | $registration->transaction_ID() |
73 | - ) . |
|
73 | + ). |
|
74 | 74 | '</a>' : $registration->transaction_ID(); |
75 | 75 | ?> |
76 | 76 | </td> |
@@ -15,144 +15,144 @@ |
||
15 | 15 | class Payments_Admin_Page_Init extends EE_Admin_Page_Init |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis |
|
20 | - */ |
|
21 | - protected $_table_analysis; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * Payments_Admin_Page_Init constructor. |
|
26 | - */ |
|
27 | - public function __construct() |
|
28 | - { |
|
29 | - // define some page related constants |
|
30 | - define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
31 | - define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG)); |
|
32 | - define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS); |
|
33 | - define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS); |
|
34 | - define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/'); |
|
35 | - $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
36 | - // check that there are active gateways on all admin page loads. but dont do it just yet |
|
37 | - add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
|
38 | - |
|
39 | - // Show/hide PP Standard along side PP Express. |
|
40 | - add_filter( |
|
41 | - 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
|
42 | - array($this, 'unset_pp_standard') |
|
43 | - ); |
|
44 | - |
|
45 | - parent::__construct(); |
|
46 | - } |
|
47 | - |
|
48 | - protected function _set_init_properties() |
|
49 | - { |
|
50 | - $this->label = __('Payment Methods', 'event_espresso'); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * _set_menu_map |
|
56 | - * |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - protected function _set_menu_map() |
|
60 | - { |
|
61 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
62 | - array( |
|
63 | - 'menu_group' => 'settings', |
|
64 | - 'menu_order' => 30, |
|
65 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
66 | - 'parent_slug' => 'espresso_events', |
|
67 | - 'menu_slug' => EE_PAYMENTS_PG_SLUG, |
|
68 | - 'menu_label' => __('Payment Methods', 'event_espresso'), |
|
69 | - 'capability' => 'ee_manage_gateways', |
|
70 | - 'admin_init_page' => $this, |
|
71 | - ) |
|
72 | - ); |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * Checks that there is at least one active gateway. If not, add a notice |
|
78 | - * |
|
79 | - * @throws \EE_Error |
|
80 | - */ |
|
81 | - public function check_payment_gateway_setup() |
|
82 | - { |
|
83 | - // ONLY do this check if models can query |
|
84 | - // and avoid a bug where when we nuke EE4's data that this causes a fatal error |
|
85 | - // because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
|
86 | - if (! EE_Maintenance_Mode::instance()->models_can_query() |
|
87 | - || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
|
88 | - ) { |
|
89 | - return; |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - // ensure Payment_Method model is loaded |
|
94 | - EE_Registry::instance()->load_model('Payment_Method'); |
|
95 | - $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
96 | - if ($actives < 1) { |
|
97 | - $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL); |
|
98 | - echo '<div class="error"> |
|
18 | + /** |
|
19 | + * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis |
|
20 | + */ |
|
21 | + protected $_table_analysis; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * Payments_Admin_Page_Init constructor. |
|
26 | + */ |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | + // define some page related constants |
|
30 | + define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
31 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG)); |
|
32 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS); |
|
33 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS); |
|
34 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/'); |
|
35 | + $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
36 | + // check that there are active gateways on all admin page loads. but dont do it just yet |
|
37 | + add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
|
38 | + |
|
39 | + // Show/hide PP Standard along side PP Express. |
|
40 | + add_filter( |
|
41 | + 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', |
|
42 | + array($this, 'unset_pp_standard') |
|
43 | + ); |
|
44 | + |
|
45 | + parent::__construct(); |
|
46 | + } |
|
47 | + |
|
48 | + protected function _set_init_properties() |
|
49 | + { |
|
50 | + $this->label = __('Payment Methods', 'event_espresso'); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * _set_menu_map |
|
56 | + * |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + protected function _set_menu_map() |
|
60 | + { |
|
61 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
62 | + array( |
|
63 | + 'menu_group' => 'settings', |
|
64 | + 'menu_order' => 30, |
|
65 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
66 | + 'parent_slug' => 'espresso_events', |
|
67 | + 'menu_slug' => EE_PAYMENTS_PG_SLUG, |
|
68 | + 'menu_label' => __('Payment Methods', 'event_espresso'), |
|
69 | + 'capability' => 'ee_manage_gateways', |
|
70 | + 'admin_init_page' => $this, |
|
71 | + ) |
|
72 | + ); |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * Checks that there is at least one active gateway. If not, add a notice |
|
78 | + * |
|
79 | + * @throws \EE_Error |
|
80 | + */ |
|
81 | + public function check_payment_gateway_setup() |
|
82 | + { |
|
83 | + // ONLY do this check if models can query |
|
84 | + // and avoid a bug where when we nuke EE4's data that this causes a fatal error |
|
85 | + // because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
|
86 | + if (! EE_Maintenance_Mode::instance()->models_can_query() |
|
87 | + || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
|
88 | + ) { |
|
89 | + return; |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + // ensure Payment_Method model is loaded |
|
94 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
95 | + $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
96 | + if ($actives < 1) { |
|
97 | + $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL); |
|
98 | + echo '<div class="error"> |
|
99 | 99 | <p>' |
100 | - . sprintf( |
|
101 | - __( |
|
102 | - "There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", |
|
103 | - "event_espresso" |
|
104 | - ), |
|
105 | - "<a href='$url'>", |
|
106 | - "</a>" |
|
107 | - ) . '</p> |
|
100 | + . sprintf( |
|
101 | + __( |
|
102 | + "There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", |
|
103 | + "event_espresso" |
|
104 | + ), |
|
105 | + "<a href='$url'>", |
|
106 | + "</a>" |
|
107 | + ) . '</p> |
|
108 | 108 | </div>'; |
109 | - } |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Gets the injected table analyzer, or throws an exception |
|
114 | - * |
|
115 | - * @return TableAnalysis |
|
116 | - * @throws \EE_Error |
|
117 | - */ |
|
118 | - protected function _get_table_analysis() |
|
119 | - { |
|
120 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
121 | - return $this->_table_analysis; |
|
122 | - } else { |
|
123 | - throw new \EE_Error( |
|
124 | - sprintf( |
|
125 | - __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
126 | - get_class($this) |
|
127 | - ) |
|
128 | - ); |
|
129 | - } |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * Hide PayPal Standard for "new" users. |
|
135 | - */ |
|
136 | - public static function unset_pp_standard($payment_method_types) |
|
137 | - { |
|
138 | - $pps = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard'); |
|
139 | - $ppstandard_active = (! empty($pps)) ? $pps->active() : false; |
|
140 | - $ppstandard_active_before = false; |
|
141 | - if ($pps) { |
|
142 | - // PP Standard used before ? |
|
143 | - $paypal_id = $pps->get_extra_meta('paypal_id', true); |
|
144 | - if ($paypal_id && ! empty($paypal_id)) { |
|
145 | - $ppstandard_active_before = true; |
|
146 | - } |
|
147 | - } |
|
148 | - |
|
149 | - // Not using PP Standard? Then display only PayPal Express, do not show PayPal Standard. |
|
150 | - if (apply_filters( |
|
151 | - 'FHEE__EE_PMT_Paypal_Express__register_payment_methods__hide_paypal_standard', |
|
152 | - ! $ppstandard_active && ! $ppstandard_active_before |
|
153 | - )) { |
|
154 | - unset($payment_method_types['paypal_standard']); |
|
155 | - } |
|
156 | - return $payment_method_types; |
|
157 | - } |
|
109 | + } |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Gets the injected table analyzer, or throws an exception |
|
114 | + * |
|
115 | + * @return TableAnalysis |
|
116 | + * @throws \EE_Error |
|
117 | + */ |
|
118 | + protected function _get_table_analysis() |
|
119 | + { |
|
120 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
121 | + return $this->_table_analysis; |
|
122 | + } else { |
|
123 | + throw new \EE_Error( |
|
124 | + sprintf( |
|
125 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
126 | + get_class($this) |
|
127 | + ) |
|
128 | + ); |
|
129 | + } |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * Hide PayPal Standard for "new" users. |
|
135 | + */ |
|
136 | + public static function unset_pp_standard($payment_method_types) |
|
137 | + { |
|
138 | + $pps = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard'); |
|
139 | + $ppstandard_active = (! empty($pps)) ? $pps->active() : false; |
|
140 | + $ppstandard_active_before = false; |
|
141 | + if ($pps) { |
|
142 | + // PP Standard used before ? |
|
143 | + $paypal_id = $pps->get_extra_meta('paypal_id', true); |
|
144 | + if ($paypal_id && ! empty($paypal_id)) { |
|
145 | + $ppstandard_active_before = true; |
|
146 | + } |
|
147 | + } |
|
148 | + |
|
149 | + // Not using PP Standard? Then display only PayPal Express, do not show PayPal Standard. |
|
150 | + if (apply_filters( |
|
151 | + 'FHEE__EE_PMT_Paypal_Express__register_payment_methods__hide_paypal_standard', |
|
152 | + ! $ppstandard_active && ! $ppstandard_active_before |
|
153 | + )) { |
|
154 | + unset($payment_method_types['paypal_standard']); |
|
155 | + } |
|
156 | + return $payment_method_types; |
|
157 | + } |
|
158 | 158 | } |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | { |
29 | 29 | // define some page related constants |
30 | 30 | define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
31 | - define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG)); |
|
32 | - define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS); |
|
33 | - define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS); |
|
34 | - define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/'); |
|
31 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG)); |
|
32 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments'.DS); |
|
33 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates'.DS); |
|
34 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/'); |
|
35 | 35 | $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
36 | 36 | // check that there are active gateways on all admin page loads. but dont do it just yet |
37 | 37 | add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | // ONLY do this check if models can query |
84 | 84 | // and avoid a bug where when we nuke EE4's data that this causes a fatal error |
85 | 85 | // because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
86 | - if (! EE_Maintenance_Mode::instance()->models_can_query() |
|
86 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query() |
|
87 | 87 | || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
88 | 88 | ) { |
89 | 89 | return; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ), |
105 | 105 | "<a href='$url'>", |
106 | 106 | "</a>" |
107 | - ) . '</p> |
|
107 | + ).'</p> |
|
108 | 108 | </div>'; |
109 | 109 | } |
110 | 110 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | public static function unset_pp_standard($payment_method_types) |
137 | 137 | { |
138 | 138 | $pps = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard'); |
139 | - $ppstandard_active = (! empty($pps)) ? $pps->active() : false; |
|
139 | + $ppstandard_active = ( ! empty($pps)) ? $pps->active() : false; |
|
140 | 140 | $ppstandard_active_before = false; |
141 | 141 | if ($pps) { |
142 | 142 | // PP Standard used before ? |
@@ -7,80 +7,80 @@ |
||
7 | 7 | <li> |
8 | 8 | <strong><?php _e('Name', 'event_espresso'); ?></strong><br> |
9 | 9 | <?php _e( |
10 | - 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', |
|
11 | - 'event_espresso' |
|
12 | - ); ?> |
|
10 | + 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', |
|
11 | + 'event_espresso' |
|
12 | + ); ?> |
|
13 | 13 | </li> |
14 | 14 | <li> |
15 | 15 | <strong><?php _e('Description', 'event_espresso'); ?></strong><br/> |
16 | 16 | <?php _e( |
17 | - 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', |
|
18 | - 'event_espresso' |
|
19 | - ); ?> |
|
17 | + 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', |
|
18 | + 'event_espresso' |
|
19 | + ); ?> |
|
20 | 20 | </li> |
21 | 21 | <li><strong><?php _e('Admin-Only Name', 'event_espresso'); ?></strong><br/> |
22 | 22 | <?php _e( |
23 | - 'The name of the payment method as seen internally by site administrators and staff.', |
|
24 | - 'event_espresso' |
|
25 | - ); ?> |
|
23 | + 'The name of the payment method as seen internally by site administrators and staff.', |
|
24 | + 'event_espresso' |
|
25 | + ); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php _e('Admin-Only Description', 'event_espresso'); ?></strong><br/> |
29 | 29 | <?php _e( |
30 | - 'The description of the payment method as seen internally by site administrators and staff.', |
|
31 | - 'event_espresso' |
|
32 | - ); ?> |
|
30 | + 'The description of the payment method as seen internally by site administrators and staff.', |
|
31 | + 'event_espresso' |
|
32 | + ); ?> |
|
33 | 33 | </li> |
34 | 34 | <li> |
35 | 35 | <strong><?php _e('Debug (sandbox) Mode', 'event_espresso'); ?></strong><br/> |
36 | 36 | <?php _e( |
37 | - 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', |
|
38 | - 'event_espresso' |
|
39 | - ); ?> |
|
37 | + 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', |
|
38 | + 'event_espresso' |
|
39 | + ); ?> |
|
40 | 40 | </li> |
41 | 41 | <li> |
42 | 42 | <strong><?php _e('Open by Default', 'event_espresso'); ?></strong><br/> |
43 | 43 | <?php _e( |
44 | - 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', |
|
45 | - 'event_espresso' |
|
46 | - ); ?> |
|
44 | + 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', |
|
45 | + 'event_espresso' |
|
46 | + ); ?> |
|
47 | 47 | </li> |
48 | 48 | <li> |
49 | 49 | <strong><?php _e('Button URL', 'event_espresso'); ?></strong><br/> |
50 | 50 | <?php printf( |
51 | - __( |
|
52 | - 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
|
53 | - 'event_espresso' |
|
54 | - ), |
|
55 | - '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
56 | - ); ?> |
|
51 | + __( |
|
52 | + 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
|
53 | + 'event_espresso' |
|
54 | + ), |
|
55 | + '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
56 | + ); ?> |
|
57 | 57 | </li> |
58 | 58 | <li><strong><?php _e('Usable From', 'event_espresso'); ?></strong><br/> |
59 | 59 | <?php _e('Where this payment method can be used from.', 'event_espresso'); ?> |
60 | 60 | <ul> |
61 | 61 | <li> |
62 | 62 | <?php _e( |
63 | - 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', |
|
64 | - 'event_espresso' |
|
65 | - ); ?></li> |
|
63 | + 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', |
|
64 | + 'event_espresso' |
|
65 | + ); ?></li> |
|
66 | 66 | <li> |
67 | 67 | <?php _e( |
68 | - 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', |
|
69 | - 'event_espresso' |
|
70 | - ); ?></li> |
|
68 | + 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', |
|
69 | + 'event_espresso' |
|
70 | + ); ?></li> |
|
71 | 71 | </ul> |
72 | 72 | </li> |
73 | 73 | </ul> |
74 | 74 | <strong><?php _e('Recommendations', 'event_espresso'); ?></strong><br/> |
75 | 75 | <?php _e( |
76 | - 'Want to see a tour of this screen? Click on the Payment Methods Overview Tour button which appears on the right side of the page. <br />To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
77 | - 'event_espresso' |
|
76 | + 'Want to see a tour of this screen? Click on the Payment Methods Overview Tour button which appears on the right side of the page. <br />To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
77 | + 'event_espresso' |
|
78 | 78 | ); ?> |
79 | 79 | </p> |
80 | 80 | <p> |
81 | 81 | <strong><?php _e('Screen Options', 'event_espresso'); ?></strong><br/> |
82 | 82 | <?php _e( |
83 | - '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.', |
|
84 | - 'event_espresso' |
|
85 | - ); ?> |
|
83 | + '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.', |
|
84 | + 'event_espresso' |
|
85 | + ); ?> |
|
86 | 86 | </p> |
87 | 87 | \ No newline at end of file |
@@ -52,7 +52,7 @@ |
||
52 | 52 | 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
53 | 53 | 'event_espresso' |
54 | 54 | ), |
55 | - '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
55 | + '<img src="'.admin_url('images/media-button-image.gif').'">' |
|
56 | 56 | ); ?> |
57 | 57 | </li> |
58 | 58 | <li><strong><?php _e('Usable From', 'event_espresso'); ?></strong><br/> |
@@ -65,7 +65,7 @@ |
||
65 | 65 | <?php echo $payment_log->e( |
66 | 66 | 'LOG_message', |
67 | 67 | 'as_table' |
68 | - );// EEH_Template::layout_array_as_table($payment_log->content())?> |
|
68 | + ); // EEH_Template::layout_array_as_table($payment_log->content())?> |
|
69 | 69 | </td> |
70 | 70 | </tr> |
71 | 71 | </tbody> |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | </th> |
37 | 37 | <td> |
38 | 38 | <?php |
39 | - if ($payment_log->object() instanceof EE_Transaction) { |
|
40 | - esc_html_e('Unknown', 'event_espresso'); |
|
41 | - } else { |
|
42 | - echo $payment_method |
|
43 | - ? $payment_method->admin_name() |
|
44 | - : esc_html__( |
|
45 | - "No Longer Exists", |
|
46 | - 'event_espresso' |
|
47 | - ); |
|
48 | - } |
|
49 | - ?> |
|
39 | + if ($payment_log->object() instanceof EE_Transaction) { |
|
40 | + esc_html_e('Unknown', 'event_espresso'); |
|
41 | + } else { |
|
42 | + echo $payment_method |
|
43 | + ? $payment_method->admin_name() |
|
44 | + : esc_html__( |
|
45 | + "No Longer Exists", |
|
46 | + 'event_espresso' |
|
47 | + ); |
|
48 | + } |
|
49 | + ?> |
|
50 | 50 | |
51 | 51 | </td> |
52 | 52 | </tr> |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | </th> |
70 | 70 | <td> |
71 | 71 | <?php echo $payment_log->e( |
72 | - 'LOG_message', |
|
73 | - 'as_table' |
|
74 | - );// EEH_Template::layout_array_as_table($payment_log->content())?> |
|
72 | + 'LOG_message', |
|
73 | + 'as_table' |
|
74 | + );// EEH_Template::layout_array_as_table($payment_log->content())?> |
|
75 | 75 | </td> |
76 | 76 | </tr> |
77 | 77 | </tbody> |
@@ -24,102 +24,102 @@ |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - public function __construct() |
|
28 | - { |
|
29 | - // define some page related constants |
|
30 | - define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
|
31 | - define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings'); |
|
32 | - define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG)); |
|
33 | - define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS); |
|
34 | - define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS); |
|
35 | - define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/'); |
|
36 | - // check that if we're in maintenance mode that we tell the admin that |
|
37 | - add_action('admin_notices', array($this, 'check_maintenance_mode')); |
|
38 | - parent::__construct(); |
|
39 | - } |
|
27 | + public function __construct() |
|
28 | + { |
|
29 | + // define some page related constants |
|
30 | + define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
|
31 | + define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings'); |
|
32 | + define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG)); |
|
33 | + define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS); |
|
34 | + define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS); |
|
35 | + define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/'); |
|
36 | + // check that if we're in maintenance mode that we tell the admin that |
|
37 | + add_action('admin_notices', array($this, 'check_maintenance_mode')); |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | - protected function _set_init_properties() |
|
43 | - { |
|
44 | - $this->label = EE_MAINTENANCE_LABEL; |
|
45 | - } |
|
42 | + protected function _set_init_properties() |
|
43 | + { |
|
44 | + $this->label = EE_MAINTENANCE_LABEL; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - protected function _set_menu_map() |
|
49 | - { |
|
50 | - $menu_map = $this->_menu_map(); |
|
51 | - $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance |
|
52 | - ? new EE_Admin_Page_Main_Menu($menu_map) : new EE_Admin_Page_Sub_Menu($menu_map); |
|
53 | - } |
|
48 | + protected function _set_menu_map() |
|
49 | + { |
|
50 | + $menu_map = $this->_menu_map(); |
|
51 | + $this->_menu_map = EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance |
|
52 | + ? new EE_Admin_Page_Main_Menu($menu_map) : new EE_Admin_Page_Sub_Menu($menu_map); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - protected function _menu_map() |
|
57 | - { |
|
58 | - $map = array( |
|
59 | - 'menu_group' => 'extras', |
|
60 | - 'menu_order' => 30, |
|
61 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
62 | - 'parent_slug' => 'espresso_events', |
|
63 | - 'menu_slug' => EE_MAINTENANCE_PG_SLUG, |
|
64 | - 'menu_label' => EE_MAINTENANCE_LABEL, |
|
65 | - 'capability' => 'manage_options', |
|
66 | - 'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG, |
|
67 | - 'admin_init_page' => $this, |
|
68 | - ); |
|
69 | - if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
70 | - $map['menu_group'] = 'main'; |
|
71 | - $map['subtitle'] = EE_MAINTENANCE_LABEL; |
|
72 | - $map['menu_label'] = __('Event Espresso', 'event_espresso'); |
|
73 | - } |
|
74 | - return $map; |
|
75 | - } |
|
56 | + protected function _menu_map() |
|
57 | + { |
|
58 | + $map = array( |
|
59 | + 'menu_group' => 'extras', |
|
60 | + 'menu_order' => 30, |
|
61 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
62 | + 'parent_slug' => 'espresso_events', |
|
63 | + 'menu_slug' => EE_MAINTENANCE_PG_SLUG, |
|
64 | + 'menu_label' => EE_MAINTENANCE_LABEL, |
|
65 | + 'capability' => 'manage_options', |
|
66 | + 'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG, |
|
67 | + 'admin_init_page' => $this, |
|
68 | + ); |
|
69 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
70 | + $map['menu_group'] = 'main'; |
|
71 | + $map['subtitle'] = EE_MAINTENANCE_LABEL; |
|
72 | + $map['menu_label'] = __('Event Espresso', 'event_espresso'); |
|
73 | + } |
|
74 | + return $map; |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of |
|
80 | - * maintenance mode |
|
81 | - */ |
|
82 | - public function check_maintenance_mode() |
|
83 | - { |
|
84 | - $notice = ''; |
|
85 | - $maintenance_page_url = ''; |
|
86 | - if (EE_Maintenance_Mode::instance()->level()) { |
|
87 | - $maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL); |
|
88 | - switch (EE_Maintenance_Mode::instance()->level()) { |
|
89 | - case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
|
90 | - $notice = '<div class="update-nag"> |
|
78 | + /** |
|
79 | + * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of |
|
80 | + * maintenance mode |
|
81 | + */ |
|
82 | + public function check_maintenance_mode() |
|
83 | + { |
|
84 | + $notice = ''; |
|
85 | + $maintenance_page_url = ''; |
|
86 | + if (EE_Maintenance_Mode::instance()->level()) { |
|
87 | + $maintenance_page_url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_MAINTENANCE_ADMIN_URL); |
|
88 | + switch (EE_Maintenance_Mode::instance()->level()) { |
|
89 | + case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
|
90 | + $notice = '<div class="update-nag"> |
|
91 | 91 | ' |
92 | - . sprintf( |
|
93 | - __( |
|
94 | - "Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", |
|
95 | - "event_espresso" |
|
96 | - ), |
|
97 | - "<a href='$maintenance_page_url'>", |
|
98 | - "</a>" |
|
99 | - ) |
|
100 | - . |
|
101 | - '</div>'; |
|
102 | - break; |
|
103 | - case EE_Maintenance_Mode::level_2_complete_maintenance: |
|
104 | - $notice = '<div class="error"> |
|
92 | + . sprintf( |
|
93 | + __( |
|
94 | + "Event Espresso is in Frontend-Only MAINTENANCE MODE. This means the front-end (ie, non-wp-admin pages) is disabled for ALL users except site admins. Visit the %s Maintenance Page %s to disable maintenance mode.", |
|
95 | + "event_espresso" |
|
96 | + ), |
|
97 | + "<a href='$maintenance_page_url'>", |
|
98 | + "</a>" |
|
99 | + ) |
|
100 | + . |
|
101 | + '</div>'; |
|
102 | + break; |
|
103 | + case EE_Maintenance_Mode::level_2_complete_maintenance: |
|
104 | + $notice = '<div class="error"> |
|
105 | 105 | <p>' |
106 | - . sprintf( |
|
107 | - __( |
|
108 | - "As part of the process for updating Event Espresso, your database also |
|
106 | + . sprintf( |
|
107 | + __( |
|
108 | + "As part of the process for updating Event Espresso, your database also |
|
109 | 109 | needs to be updated. Event Espresso is in COMPLETE MAINTENANCE MODE (both WordPress admin pages and front-end event registration pages are disabled) until you run the database update script. %s Visit the Maintenance Page to get started,%s it only takes a moment.", |
110 | - "event_espresso" |
|
111 | - ), |
|
112 | - "<a href='$maintenance_page_url'>", |
|
113 | - "</a>" |
|
114 | - ) . |
|
115 | - '</div>'; |
|
116 | - break; |
|
117 | - } |
|
118 | - } |
|
119 | - echo apply_filters( |
|
120 | - 'FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', |
|
121 | - $notice, |
|
122 | - $maintenance_page_url |
|
123 | - ); |
|
124 | - } |
|
110 | + "event_espresso" |
|
111 | + ), |
|
112 | + "<a href='$maintenance_page_url'>", |
|
113 | + "</a>" |
|
114 | + ) . |
|
115 | + '</div>'; |
|
116 | + break; |
|
117 | + } |
|
118 | + } |
|
119 | + echo apply_filters( |
|
120 | + 'FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice', |
|
121 | + $notice, |
|
122 | + $maintenance_page_url |
|
123 | + ); |
|
124 | + } |
|
125 | 125 | } |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | // define some page related constants |
30 | 30 | define('EE_MAINTENANCE_LABEL', __('Maintenance', 'event_espresso')); |
31 | 31 | define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings'); |
32 | - define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG)); |
|
33 | - define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance' . DS); |
|
34 | - define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates' . DS); |
|
35 | - define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/'); |
|
32 | + define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page='.EE_MAINTENANCE_PG_SLUG)); |
|
33 | + define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES.'maintenance'.DS); |
|
34 | + define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN.'templates'.DS); |
|
35 | + define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL.'maintenance/assets/'); |
|
36 | 36 | // check that if we're in maintenance mode that we tell the admin that |
37 | 37 | add_action('admin_notices', array($this, 'check_maintenance_mode')); |
38 | 38 | parent::__construct(); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | ), |
112 | 112 | "<a href='$maintenance_page_url'>", |
113 | 113 | "</a>" |
114 | - ) . |
|
114 | + ). |
|
115 | 115 | '</div>'; |
116 | 116 | break; |
117 | 117 | } |
@@ -17,880 +17,880 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * @var EE_Form_Section_Proper |
|
22 | - */ |
|
23 | - protected $datetime_fix_offset_form; |
|
24 | - |
|
25 | - |
|
26 | - protected function _init_page_props() |
|
27 | - { |
|
28 | - $this->page_slug = EE_MAINTENANCE_PG_SLUG; |
|
29 | - $this->page_label = EE_MAINTENANCE_LABEL; |
|
30 | - $this->_admin_base_url = EE_MAINTENANCE_ADMIN_URL; |
|
31 | - $this->_admin_base_path = EE_MAINTENANCE_ADMIN; |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - protected function _ajax_hooks() |
|
36 | - { |
|
37 | - add_action('wp_ajax_migration_step', array($this, 'migration_step')); |
|
38 | - add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran')); |
|
39 | - } |
|
40 | - |
|
41 | - |
|
42 | - protected function _define_page_props() |
|
43 | - { |
|
44 | - $this->_admin_page_title = EE_MAINTENANCE_LABEL; |
|
45 | - $this->_labels = array( |
|
46 | - 'buttons' => array( |
|
47 | - 'reset_reservations' => esc_html__('Reset Ticket and Datetime Reserved Counts', 'event_espresso'), |
|
48 | - 'reset_capabilities' => esc_html__('Reset Event Espresso Capabilities', 'event_espresso'), |
|
49 | - ), |
|
50 | - ); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - protected function _set_page_routes() |
|
55 | - { |
|
56 | - $this->_page_routes = array( |
|
57 | - 'default' => array( |
|
58 | - 'func' => '_maintenance', |
|
59 | - 'capability' => 'manage_options', |
|
60 | - ), |
|
61 | - 'change_maintenance_level' => array( |
|
62 | - 'func' => '_change_maintenance_level', |
|
63 | - 'capability' => 'manage_options', |
|
64 | - 'noheader' => true, |
|
65 | - ), |
|
66 | - 'system_status' => array( |
|
67 | - 'func' => '_system_status', |
|
68 | - 'capability' => 'manage_options', |
|
69 | - ), |
|
70 | - 'download_system_status' => array( |
|
71 | - 'func' => '_download_system_status', |
|
72 | - 'capability' => 'manage_options', |
|
73 | - 'noheader' => true, |
|
74 | - ), |
|
75 | - 'send_migration_crash_report' => array( |
|
76 | - 'func' => '_send_migration_crash_report', |
|
77 | - 'capability' => 'manage_options', |
|
78 | - 'noheader' => true, |
|
79 | - ), |
|
80 | - 'confirm_migration_crash_report_sent' => array( |
|
81 | - 'func' => '_confirm_migration_crash_report_sent', |
|
82 | - 'capability' => 'manage_options', |
|
83 | - ), |
|
84 | - 'data_reset' => array( |
|
85 | - 'func' => '_data_reset_and_delete', |
|
86 | - 'capability' => 'manage_options', |
|
87 | - ), |
|
88 | - 'reset_db' => array( |
|
89 | - 'func' => '_reset_db', |
|
90 | - 'capability' => 'manage_options', |
|
91 | - 'noheader' => true, |
|
92 | - 'args' => array('nuke_old_ee4_data' => true), |
|
93 | - ), |
|
94 | - 'start_with_fresh_ee4_db' => array( |
|
95 | - 'func' => '_reset_db', |
|
96 | - 'capability' => 'manage_options', |
|
97 | - 'noheader' => true, |
|
98 | - 'args' => array('nuke_old_ee4_data' => false), |
|
99 | - ), |
|
100 | - 'delete_db' => array( |
|
101 | - 'func' => '_delete_db', |
|
102 | - 'capability' => 'manage_options', |
|
103 | - 'noheader' => true, |
|
104 | - ), |
|
105 | - 'rerun_migration_from_ee3' => array( |
|
106 | - 'func' => '_rerun_migration_from_ee3', |
|
107 | - 'capability' => 'manage_options', |
|
108 | - 'noheader' => true, |
|
109 | - ), |
|
110 | - 'reset_reservations' => array( |
|
111 | - 'func' => '_reset_reservations', |
|
112 | - 'capability' => 'manage_options', |
|
113 | - 'noheader' => true, |
|
114 | - ), |
|
115 | - 'reset_capabilities' => array( |
|
116 | - 'func' => '_reset_capabilities', |
|
117 | - 'capability' => 'manage_options', |
|
118 | - 'noheader' => true, |
|
119 | - ), |
|
120 | - 'reattempt_migration' => array( |
|
121 | - 'func' => '_reattempt_migration', |
|
122 | - 'capability' => 'manage_options', |
|
123 | - 'noheader' => true, |
|
124 | - ), |
|
125 | - 'datetime_tools' => array( |
|
126 | - 'func' => '_datetime_tools', |
|
127 | - 'capability' => 'manage_options', |
|
128 | - ), |
|
129 | - 'run_datetime_offset_fix' => array( |
|
130 | - 'func' => '_apply_datetime_offset', |
|
131 | - 'noheader' => true, |
|
132 | - 'headers_sent_route' => 'datetime_tools', |
|
133 | - 'capability' => 'manage_options', |
|
134 | - ), |
|
135 | - ); |
|
136 | - } |
|
137 | - |
|
138 | - |
|
139 | - protected function _set_page_config() |
|
140 | - { |
|
141 | - $this->_page_config = array( |
|
142 | - 'default' => array( |
|
143 | - 'nav' => array( |
|
144 | - 'label' => esc_html__('Maintenance', 'event_espresso'), |
|
145 | - 'order' => 10, |
|
146 | - ), |
|
147 | - 'require_nonce' => false, |
|
148 | - ), |
|
149 | - 'data_reset' => array( |
|
150 | - 'nav' => array( |
|
151 | - 'label' => esc_html__('Reset/Delete Data', 'event_espresso'), |
|
152 | - 'order' => 20, |
|
153 | - ), |
|
154 | - 'require_nonce' => false, |
|
155 | - ), |
|
156 | - 'datetime_tools' => array( |
|
157 | - 'nav' => array( |
|
158 | - 'label' => esc_html__('Datetime Utilities', 'event_espresso'), |
|
159 | - 'order' => 25, |
|
160 | - ), |
|
161 | - 'require_nonce' => false, |
|
162 | - ), |
|
163 | - 'system_status' => array( |
|
164 | - 'nav' => array( |
|
165 | - 'label' => esc_html__("System Information", "event_espresso"), |
|
166 | - 'order' => 30, |
|
167 | - ), |
|
168 | - 'require_nonce' => false, |
|
169 | - ), |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * default maintenance page. If we're in maintenance mode level 2, then we need to show |
|
176 | - * the migration scripts and all that UI. |
|
177 | - */ |
|
178 | - public function _maintenance() |
|
179 | - { |
|
180 | - // it all depends if we're in maintenance model level 1 (frontend-only) or |
|
181 | - // level 2 (everything except maintenance page) |
|
182 | - try { |
|
183 | - // get the current maintenance level and check if |
|
184 | - // we are removed |
|
185 | - $mm = EE_Maintenance_Mode::instance()->level(); |
|
186 | - $placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
|
187 | - if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) { |
|
188 | - // we just took the site out of maintenance mode, so notify the user. |
|
189 | - // unfortunately this message appears to be echoed on the NEXT page load... |
|
190 | - // oh well, we should really be checking for this on addon deactivation anyways |
|
191 | - EE_Error::add_attention( |
|
192 | - __( |
|
193 | - 'Site taken out of maintenance mode because no data migration scripts are required', |
|
194 | - 'event_espresso' |
|
195 | - ) |
|
196 | - ); |
|
197 | - $this->_process_notices(array('page' => 'espresso_maintenance_settings'), false); |
|
198 | - } |
|
199 | - // in case an exception is thrown while trying to handle migrations |
|
200 | - switch (EE_Maintenance_Mode::instance()->level()) { |
|
201 | - case EE_Maintenance_Mode::level_0_not_in_maintenance: |
|
202 | - case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
|
203 | - $show_maintenance_switch = true; |
|
204 | - $show_backup_db_text = false; |
|
205 | - $show_migration_progress = false; |
|
206 | - $script_names = array(); |
|
207 | - $addons_should_be_upgraded_first = false; |
|
208 | - break; |
|
209 | - case EE_Maintenance_Mode::level_2_complete_maintenance: |
|
210 | - $show_maintenance_switch = false; |
|
211 | - $show_migration_progress = true; |
|
212 | - if (isset($this->_req_data['continue_migration'])) { |
|
213 | - $show_backup_db_text = false; |
|
214 | - } else { |
|
215 | - $show_backup_db_text = true; |
|
216 | - } |
|
217 | - $scripts_needing_to_run = EE_Data_Migration_Manager::instance() |
|
218 | - ->check_for_applicable_data_migration_scripts(); |
|
219 | - $addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating(); |
|
220 | - $script_names = array(); |
|
221 | - $current_script = null; |
|
222 | - foreach ($scripts_needing_to_run as $script) { |
|
223 | - if ($script instanceof EE_Data_Migration_Script_Base) { |
|
224 | - if (! $current_script) { |
|
225 | - $current_script = $script; |
|
226 | - $current_script->migration_page_hooks(); |
|
227 | - } |
|
228 | - $script_names[] = $script->pretty_name(); |
|
229 | - } |
|
230 | - } |
|
231 | - break; |
|
232 | - } |
|
233 | - $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
|
234 | - $exception_thrown = false; |
|
235 | - } catch (EE_Error $e) { |
|
236 | - EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
|
237 | - // now, just so we can display the page correctly, make a error migration script stage object |
|
238 | - // and also put the error on it. It only persists for the duration of this request |
|
239 | - $most_recent_migration = new EE_DMS_Unknown_1_0_0(); |
|
240 | - $most_recent_migration->add_error($e->getMessage()); |
|
241 | - $exception_thrown = true; |
|
242 | - } |
|
243 | - $current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set(); |
|
244 | - $current_db_state = str_replace('.decaf', '', $current_db_state); |
|
245 | - if ($exception_thrown |
|
246 | - || ($most_recent_migration |
|
247 | - && $most_recent_migration instanceof EE_Data_Migration_Script_Base |
|
248 | - && $most_recent_migration->is_broken() |
|
249 | - ) |
|
250 | - ) { |
|
251 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php'; |
|
252 | - $this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/'; |
|
253 | - $this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce( |
|
254 | - array( |
|
255 | - 'action' => 'confirm_migration_crash_report_sent', |
|
256 | - 'success' => '0', |
|
257 | - ), |
|
258 | - EE_MAINTENANCE_ADMIN_URL |
|
259 | - ); |
|
260 | - } elseif ($addons_should_be_upgraded_first) { |
|
261 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php'; |
|
262 | - } else { |
|
263 | - if ($most_recent_migration |
|
264 | - && $most_recent_migration instanceof EE_Data_Migration_Script_Base |
|
265 | - && $most_recent_migration->can_continue() |
|
266 | - ) { |
|
267 | - $show_backup_db_text = false; |
|
268 | - $show_continue_current_migration_script = true; |
|
269 | - $show_most_recent_migration = true; |
|
270 | - } elseif (isset($this->_req_data['continue_migration'])) { |
|
271 | - $show_most_recent_migration = true; |
|
272 | - $show_continue_current_migration_script = false; |
|
273 | - } else { |
|
274 | - $show_most_recent_migration = false; |
|
275 | - $show_continue_current_migration_script = false; |
|
276 | - } |
|
277 | - if (isset($current_script)) { |
|
278 | - $migrates_to = $current_script->migrates_to_version(); |
|
279 | - $plugin_slug = $migrates_to['slug']; |
|
280 | - $new_version = $migrates_to['version']; |
|
281 | - $this->_template_args = array_merge( |
|
282 | - $this->_template_args, |
|
283 | - array( |
|
284 | - 'current_db_state' => sprintf( |
|
285 | - __("EE%s (%s)", "event_espresso"), |
|
286 | - isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3, |
|
287 | - $plugin_slug |
|
288 | - ), |
|
289 | - 'next_db_state' => isset($current_script) ? sprintf( |
|
290 | - __("EE%s (%s)", 'event_espresso'), |
|
291 | - $new_version, |
|
292 | - $plugin_slug |
|
293 | - ) : null, |
|
294 | - ) |
|
295 | - ); |
|
296 | - } else { |
|
297 | - $this->_template_args['current_db_state'] = null; |
|
298 | - $this->_template_args['next_db_state'] = null; |
|
299 | - } |
|
300 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php'; |
|
301 | - $this->_template_args = array_merge( |
|
302 | - $this->_template_args, |
|
303 | - array( |
|
304 | - 'show_most_recent_migration' => $show_most_recent_migration, |
|
305 | - // flag for showing the most recent migration's status and/or errors |
|
306 | - 'show_migration_progress' => $show_migration_progress, |
|
307 | - // flag for showing the option to run migrations and see their progress |
|
308 | - 'show_backup_db_text' => $show_backup_db_text, |
|
309 | - // flag for showing text telling the user to backup their DB |
|
310 | - 'show_maintenance_switch' => $show_maintenance_switch, |
|
311 | - // flag for showing the option to change maintenance mode between levels 0 and 1 |
|
312 | - 'script_names' => $script_names, |
|
313 | - // array of names of scripts that have run |
|
314 | - 'show_continue_current_migration_script' => $show_continue_current_migration_script, |
|
315 | - // flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0 |
|
316 | - 'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce( |
|
317 | - array('action' => 'reset_db'), |
|
318 | - EE_MAINTENANCE_ADMIN_URL |
|
319 | - ), |
|
320 | - 'data_reset_page' => EE_Admin_Page::add_query_args_and_nonce( |
|
321 | - array('action' => 'data_reset'), |
|
322 | - EE_MAINTENANCE_ADMIN_URL |
|
323 | - ), |
|
324 | - 'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce( |
|
325 | - array('action' => 'change_maintenance_level'), |
|
326 | - EE_MAINTENANCE_ADMIN_URL |
|
327 | - ), |
|
328 | - 'ultimate_db_state' => sprintf( |
|
329 | - __("EE%s", 'event_espresso'), |
|
330 | - espresso_version() |
|
331 | - ), |
|
332 | - ) |
|
333 | - ); |
|
334 | - // make sure we have the form fields helper available. It usually is, but sometimes it isn't |
|
335 | - } |
|
336 | - $this->_template_args['most_recent_migration'] = $most_recent_migration;// the actual most recently ran migration |
|
337 | - // now render the migration options part, and put it in a variable |
|
338 | - $migration_options_template_file = apply_filters( |
|
339 | - 'FHEE__ee_migration_page__migration_options_template', |
|
340 | - EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee4.template.php' |
|
341 | - ); |
|
342 | - $migration_options_html = EEH_Template::display_template( |
|
343 | - $migration_options_template_file, |
|
344 | - $this->_template_args, |
|
345 | - true |
|
346 | - ); |
|
347 | - $this->_template_args['migration_options_html'] = $migration_options_html; |
|
348 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
349 | - $this->_template_path, |
|
350 | - $this->_template_args, |
|
351 | - true |
|
352 | - ); |
|
353 | - $this->display_admin_page_with_sidebar(); |
|
354 | - } |
|
355 | - |
|
356 | - |
|
357 | - /** |
|
358 | - * returns JSON and executes another step of the currently-executing data migration (called via ajax) |
|
359 | - */ |
|
360 | - public function migration_step() |
|
361 | - { |
|
362 | - $this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request(); |
|
363 | - $this->_return_json(); |
|
364 | - } |
|
365 | - |
|
366 | - |
|
367 | - /** |
|
368 | - * Can be used by js when it notices a response with HTML in it in order |
|
369 | - * to log the malformed response |
|
370 | - */ |
|
371 | - public function add_error_to_migrations_ran() |
|
372 | - { |
|
373 | - EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']); |
|
374 | - $this->_template_args['data'] = array('ok' => true); |
|
375 | - $this->_return_json(); |
|
376 | - } |
|
377 | - |
|
378 | - |
|
379 | - /** |
|
380 | - * changes the maintenance level, provided there are still no migration scripts that should run |
|
381 | - */ |
|
382 | - public function _change_maintenance_level() |
|
383 | - { |
|
384 | - $new_level = absint($this->_req_data['maintenance_mode_level']); |
|
385 | - if (! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
386 | - EE_Maintenance_Mode::instance()->set_maintenance_level($new_level); |
|
387 | - $success = true; |
|
388 | - } else { |
|
389 | - EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
|
390 | - $success = false; |
|
391 | - } |
|
392 | - $this->_redirect_after_action($success, 'Maintenance Mode', esc_html__("Updated", "event_espresso")); |
|
393 | - } |
|
394 | - |
|
395 | - |
|
396 | - /** |
|
397 | - * a tab with options for resetting and/or deleting EE data |
|
398 | - * |
|
399 | - * @throws \EE_Error |
|
400 | - * @throws \DomainException |
|
401 | - */ |
|
402 | - public function _data_reset_and_delete() |
|
403 | - { |
|
404 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php'; |
|
405 | - $this->_template_args['reset_reservations_button'] = $this->get_action_link_or_button( |
|
406 | - 'reset_reservations', |
|
407 | - 'reset_reservations', |
|
408 | - array(), |
|
409 | - 'button button-primary ee-confirm', |
|
410 | - '', |
|
411 | - false |
|
412 | - ); |
|
413 | - $this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button( |
|
414 | - 'reset_capabilities', |
|
415 | - 'reset_capabilities', |
|
416 | - array(), |
|
417 | - 'button button-primary ee-confirm', |
|
418 | - '', |
|
419 | - false |
|
420 | - ); |
|
421 | - $this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
422 | - array('action' => 'delete_db'), |
|
423 | - EE_MAINTENANCE_ADMIN_URL |
|
424 | - ); |
|
425 | - $this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
426 | - array('action' => 'reset_db'), |
|
427 | - EE_MAINTENANCE_ADMIN_URL |
|
428 | - ); |
|
429 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
430 | - $this->_template_path, |
|
431 | - $this->_template_args, |
|
432 | - true |
|
433 | - ); |
|
434 | - $this->display_admin_page_with_sidebar(); |
|
435 | - } |
|
436 | - |
|
437 | - |
|
438 | - protected function _reset_reservations() |
|
439 | - { |
|
440 | - if (\EED_Ticket_Sales_Monitor::reset_reservation_counts()) { |
|
441 | - EE_Error::add_success( |
|
442 | - __( |
|
443 | - 'Ticket and datetime reserved counts have been successfully reset.', |
|
444 | - 'event_espresso' |
|
445 | - ) |
|
446 | - ); |
|
447 | - } else { |
|
448 | - EE_Error::add_success( |
|
449 | - __( |
|
450 | - 'Ticket and datetime reserved counts were correct and did not need resetting.', |
|
451 | - 'event_espresso' |
|
452 | - ) |
|
453 | - ); |
|
454 | - } |
|
455 | - $this->_redirect_after_action(true, '', '', array('action' => 'data_reset'), true); |
|
456 | - } |
|
457 | - |
|
458 | - |
|
459 | - protected function _reset_capabilities() |
|
460 | - { |
|
461 | - EE_Registry::instance()->CAP->init_caps(true); |
|
462 | - EE_Error::add_success( |
|
463 | - __( |
|
464 | - 'Default Event Espresso capabilities have been restored for all current roles.', |
|
465 | - 'event_espresso' |
|
466 | - ) |
|
467 | - ); |
|
468 | - $this->_redirect_after_action(false, '', '', array('action' => 'data_reset'), true); |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - /** |
|
473 | - * resets the DMSs so we can attempt to continue migrating after a fatal error |
|
474 | - * (only a good idea when someone has somehow tried ot fix whatever caused |
|
475 | - * the fatal error in teh first place) |
|
476 | - */ |
|
477 | - protected function _reattempt_migration() |
|
478 | - { |
|
479 | - EE_Data_Migration_Manager::instance()->reattempt(); |
|
480 | - $this->_redirect_after_action(false, '', '', array('action' => 'default'), true); |
|
481 | - } |
|
482 | - |
|
483 | - |
|
484 | - /** |
|
485 | - * shows the big ol' System Information page |
|
486 | - */ |
|
487 | - public function _system_status() |
|
488 | - { |
|
489 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php'; |
|
490 | - $this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati(); |
|
491 | - $this->_template_args['download_system_status_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
492 | - array( |
|
493 | - 'action' => 'download_system_status', |
|
494 | - ), |
|
495 | - EE_MAINTENANCE_ADMIN_URL |
|
496 | - ); |
|
497 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
498 | - $this->_template_path, |
|
499 | - $this->_template_args, |
|
500 | - true |
|
501 | - ); |
|
502 | - $this->display_admin_page_with_sidebar(); |
|
503 | - } |
|
504 | - |
|
505 | - /** |
|
506 | - * Downloads an HTML file of the system status that can be easily stored or emailed |
|
507 | - */ |
|
508 | - public function _download_system_status() |
|
509 | - { |
|
510 | - $status_info = EEM_System_Status::instance()->get_system_stati(); |
|
511 | - header('Content-Disposition: attachment'); |
|
512 | - header("Content-Disposition: attachment; filename=system_status_" . sanitize_key(site_url()) . ".html"); |
|
513 | - echo "<style>table{border:1px solid darkgrey;}td{vertical-align:top}</style>"; |
|
514 | - echo "<h1>System Information for " . site_url() . "</h1>"; |
|
515 | - echo EEH_Template::layout_array_as_table($status_info); |
|
516 | - die; |
|
517 | - } |
|
518 | - |
|
519 | - |
|
520 | - public function _send_migration_crash_report() |
|
521 | - { |
|
522 | - $from = $this->_req_data['from']; |
|
523 | - $from_name = $this->_req_data['from_name']; |
|
524 | - $body = $this->_req_data['body']; |
|
525 | - try { |
|
526 | - $success = wp_mail( |
|
527 | - EE_SUPPORT_EMAIL, |
|
528 | - 'Migration Crash Report', |
|
529 | - $body . "/r/n<br>" . print_r(EEM_System_Status::instance()->get_system_stati(), true), |
|
530 | - array( |
|
531 | - "from:$from_name<$from>", |
|
532 | - ) |
|
533 | - ); |
|
534 | - } catch (Exception $e) { |
|
535 | - $success = false; |
|
536 | - } |
|
537 | - $this->_redirect_after_action( |
|
538 | - $success, |
|
539 | - esc_html__("Migration Crash Report", "event_espresso"), |
|
540 | - esc_html__("sent", "event_espresso"), |
|
541 | - array('success' => $success, 'action' => 'confirm_migration_crash_report_sent') |
|
542 | - ); |
|
543 | - } |
|
544 | - |
|
545 | - |
|
546 | - public function _confirm_migration_crash_report_sent() |
|
547 | - { |
|
548 | - try { |
|
549 | - $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
|
550 | - } catch (EE_Error $e) { |
|
551 | - EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
|
552 | - // now, just so we can display the page correctly, make a error migration script stage object |
|
553 | - // and also put the error on it. It only persists for the duration of this request |
|
554 | - $most_recent_migration = new EE_DMS_Unknown_1_0_0(); |
|
555 | - $most_recent_migration->add_error($e->getMessage()); |
|
556 | - } |
|
557 | - $success = $this->_req_data['success'] == '1' ? true : false; |
|
558 | - $this->_template_args['success'] = $success; |
|
559 | - $this->_template_args['most_recent_migration'] = $most_recent_migration; |
|
560 | - $this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
561 | - array('action' => 'reset_db'), |
|
562 | - EE_MAINTENANCE_ADMIN_URL |
|
563 | - ); |
|
564 | - $this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
565 | - array('action' => 'data_reset'), |
|
566 | - EE_MAINTENANCE_ADMIN_URL |
|
567 | - ); |
|
568 | - $this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
569 | - array('action' => 'reattempt_migration'), |
|
570 | - EE_MAINTENANCE_ADMIN_URL |
|
571 | - ); |
|
572 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php'; |
|
573 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
574 | - $this->_template_path, |
|
575 | - $this->_template_args, |
|
576 | - true |
|
577 | - ); |
|
578 | - $this->display_admin_page_with_sidebar(); |
|
579 | - } |
|
580 | - |
|
581 | - |
|
582 | - /** |
|
583 | - * Resets the entire EE4 database. |
|
584 | - * Currently basically only sets up ee4 database for a fresh install- doesn't |
|
585 | - * actually clean out the old wp options, or cpts (although does erase old ee table data) |
|
586 | - * |
|
587 | - * @param boolean $nuke_old_ee4_data controls whether or not we |
|
588 | - * destroy the old ee4 data, or just try initializing ee4 default data |
|
589 | - */ |
|
590 | - public function _reset_db($nuke_old_ee4_data = true) |
|
591 | - { |
|
592 | - EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
593 | - if ($nuke_old_ee4_data) { |
|
594 | - EEH_Activation::delete_all_espresso_cpt_data(); |
|
595 | - EEH_Activation::delete_all_espresso_tables_and_data(false); |
|
596 | - EEH_Activation::remove_cron_tasks(); |
|
597 | - } |
|
598 | - // make sure when we reset the registry's config that it |
|
599 | - // switches to using the new singleton |
|
600 | - EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(true); |
|
601 | - EE_System::instance()->initialize_db_if_no_migrations_required(true); |
|
602 | - EE_System::instance()->redirect_to_about_ee(); |
|
603 | - } |
|
604 | - |
|
605 | - |
|
606 | - /** |
|
607 | - * Deletes ALL EE tables, Records, and Options from the database. |
|
608 | - */ |
|
609 | - public function _delete_db() |
|
610 | - { |
|
611 | - EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
612 | - EEH_Activation::delete_all_espresso_cpt_data(); |
|
613 | - EEH_Activation::delete_all_espresso_tables_and_data(); |
|
614 | - EEH_Activation::remove_cron_tasks(); |
|
615 | - EEH_Activation::deactivate_event_espresso(); |
|
616 | - wp_safe_redirect(admin_url('plugins.php')); |
|
617 | - exit; |
|
618 | - } |
|
619 | - |
|
620 | - |
|
621 | - /** |
|
622 | - * sets up EE4 to rerun the migrations from ee3 to ee4 |
|
623 | - */ |
|
624 | - public function _rerun_migration_from_ee3() |
|
625 | - { |
|
626 | - EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
627 | - EEH_Activation::delete_all_espresso_cpt_data(); |
|
628 | - EEH_Activation::delete_all_espresso_tables_and_data(false); |
|
629 | - // set the db state to something that will require migrations |
|
630 | - update_option(EE_Data_Migration_Manager::current_database_state, '3.1.36.0'); |
|
631 | - EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_2_complete_maintenance); |
|
632 | - $this->_redirect_after_action( |
|
633 | - true, |
|
634 | - esc_html__("Database", 'event_espresso'), |
|
635 | - esc_html__("reset", 'event_espresso') |
|
636 | - ); |
|
637 | - } |
|
638 | - |
|
639 | - |
|
640 | - // none of the below group are currently used for Gateway Settings |
|
641 | - protected function _add_screen_options() |
|
642 | - { |
|
643 | - } |
|
644 | - |
|
645 | - |
|
646 | - protected function _add_feature_pointers() |
|
647 | - { |
|
648 | - } |
|
649 | - |
|
650 | - |
|
651 | - public function admin_init() |
|
652 | - { |
|
653 | - } |
|
654 | - |
|
655 | - |
|
656 | - public function admin_notices() |
|
657 | - { |
|
658 | - } |
|
659 | - |
|
660 | - |
|
661 | - public function admin_footer_scripts() |
|
662 | - { |
|
663 | - } |
|
664 | - |
|
665 | - |
|
666 | - public function load_scripts_styles() |
|
667 | - { |
|
668 | - wp_enqueue_script('ee_admin_js'); |
|
669 | - wp_enqueue_script( |
|
670 | - 'ee-maintenance', |
|
671 | - EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.js', |
|
672 | - array('jquery'), |
|
673 | - EVENT_ESPRESSO_VERSION, |
|
674 | - true |
|
675 | - ); |
|
676 | - wp_register_style( |
|
677 | - 'espresso_maintenance', |
|
678 | - EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', |
|
679 | - array(), |
|
680 | - EVENT_ESPRESSO_VERSION |
|
681 | - ); |
|
682 | - wp_enqueue_style('espresso_maintenance'); |
|
683 | - // localize script stuff |
|
684 | - wp_localize_script( |
|
685 | - 'ee-maintenance', |
|
686 | - 'ee_maintenance', |
|
687 | - array( |
|
688 | - 'migrating' => esc_html__("Updating Database...", "event_espresso"), |
|
689 | - 'next' => esc_html__("Next", "event_espresso"), |
|
690 | - 'fatal_error' => esc_html__("A Fatal Error Has Occurred", "event_espresso"), |
|
691 | - 'click_next_when_ready' => esc_html__( |
|
692 | - "The current Database Update has ended. Click 'next' when ready to proceed", |
|
693 | - "event_espresso" |
|
694 | - ), |
|
695 | - 'status_no_more_migration_scripts' => EE_Data_Migration_Manager::status_no_more_migration_scripts, |
|
696 | - 'status_fatal_error' => EE_Data_Migration_Manager::status_fatal_error, |
|
697 | - 'status_completed' => EE_Data_Migration_Manager::status_completed, |
|
698 | - 'confirm' => esc_html__( |
|
699 | - 'Are you sure you want to do this? It CANNOT be undone!', |
|
700 | - 'event_espresso' |
|
701 | - ), |
|
702 | - 'confirm_skip_migration' => esc_html__( |
|
703 | - 'You have chosen to NOT migrate your existing data. Are you sure you want to continue?', |
|
704 | - 'event_espresso' |
|
705 | - ), |
|
706 | - ) |
|
707 | - ); |
|
708 | - } |
|
709 | - |
|
710 | - |
|
711 | - public function load_scripts_styles_default() |
|
712 | - { |
|
713 | - } |
|
714 | - |
|
715 | - |
|
716 | - /** |
|
717 | - * Enqueue scripts and styles for the datetime tools page. |
|
718 | - */ |
|
719 | - public function load_scripts_styles_datetime_tools() |
|
720 | - { |
|
721 | - EE_Datepicker_Input::enqueue_styles_and_scripts(); |
|
722 | - } |
|
723 | - |
|
724 | - |
|
725 | - protected function _datetime_tools() |
|
726 | - { |
|
727 | - $form_action = EE_Admin_Page::add_query_args_and_nonce( |
|
728 | - array( |
|
729 | - 'action' => 'run_datetime_offset_fix', |
|
730 | - 'return_action' => $this->_req_action, |
|
731 | - ), |
|
732 | - EE_MAINTENANCE_ADMIN_URL |
|
733 | - ); |
|
734 | - $form = $this->_get_datetime_offset_fix_form(); |
|
735 | - $this->_admin_page_title = esc_html__('Datetime Utilities', 'event_espresso'); |
|
736 | - $this->_template_args['admin_page_content'] = $form->form_open($form_action, 'post') |
|
737 | - . $form->get_html_and_js() |
|
738 | - . $form->form_close(); |
|
739 | - $this->display_admin_page_with_no_sidebar(); |
|
740 | - } |
|
741 | - |
|
742 | - |
|
743 | - protected function _get_datetime_offset_fix_form() |
|
744 | - { |
|
745 | - if (! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) { |
|
746 | - $this->datetime_fix_offset_form = new EE_Form_Section_Proper( |
|
747 | - array( |
|
748 | - 'name' => 'datetime_offset_fix_option', |
|
749 | - 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
750 | - 'subsections' => array( |
|
751 | - 'title' => new EE_Form_Section_HTML( |
|
752 | - EEH_HTML::h2( |
|
753 | - esc_html__('Datetime Offset Tool', 'event_espresso') |
|
754 | - ) |
|
755 | - ), |
|
756 | - 'explanation' => new EE_Form_Section_HTML( |
|
757 | - EEH_HTML::p( |
|
758 | - esc_html__( |
|
759 | - 'Use this tool to automatically apply the provided offset to all Event Espresso records in your database that involve dates and times.', |
|
760 | - 'event_espresso' |
|
761 | - ) |
|
762 | - ) |
|
763 | - . EEH_HTML::p( |
|
764 | - esc_html__( |
|
765 | - 'Note: If you enter 1.25, that will result in the offset of 1 hour 15 minutes being applied. Decimals represent the fraction of hours, not minutes.', |
|
766 | - 'event_espresso' |
|
767 | - ) |
|
768 | - ) |
|
769 | - ), |
|
770 | - 'offset_input' => new EE_Float_Input( |
|
771 | - array( |
|
772 | - 'html_name' => 'offset_for_datetimes', |
|
773 | - 'html_label_text' => esc_html__( |
|
774 | - 'Offset to apply (in hours):', |
|
775 | - 'event_espresso' |
|
776 | - ), |
|
777 | - 'min_value' => '-12', |
|
778 | - 'max_value' => '14', |
|
779 | - 'step_value' => '.25', |
|
780 | - 'default' => DatetimeOffsetFix::getOffset(), |
|
781 | - ) |
|
782 | - ), |
|
783 | - 'date_range_explanation' => new EE_Form_Section_HTML( |
|
784 | - EEH_HTML::p( |
|
785 | - esc_html__( |
|
786 | - 'Leave the following fields blank if you want the offset to be applied to all dates. If however, you want to just apply the offset to a specific range of dates you can restrict the offset application using these fields.', |
|
787 | - 'event_espresso' |
|
788 | - ) |
|
789 | - ) |
|
790 | - . EEH_HTML::p( |
|
791 | - EEH_HTML::strong( |
|
792 | - sprintf( |
|
793 | - esc_html__( |
|
794 | - 'Note: please enter the dates in UTC (You can use %1$sthis online tool%2$s to assist with conversions).', |
|
795 | - 'event_espresso' |
|
796 | - ), |
|
797 | - '<a href="https://www.timeanddate.com/worldclock/converter.html">', |
|
798 | - '</a>' |
|
799 | - ) |
|
800 | - ) |
|
801 | - ) |
|
802 | - ), |
|
803 | - 'date_range_start_date' => new EE_Datepicker_Input( |
|
804 | - array( |
|
805 | - 'html_name' => 'offset_date_start_range', |
|
806 | - 'html_label_text' => esc_html__( |
|
807 | - 'Start Date for dates the offset applied to:', |
|
808 | - 'event_espresso' |
|
809 | - ), |
|
810 | - ) |
|
811 | - ), |
|
812 | - 'date_range_end_date' => new EE_Datepicker_Input( |
|
813 | - array( |
|
814 | - 'html_name' => 'offset_date_end_range', |
|
815 | - 'html_label_text' => esc_html( |
|
816 | - 'End Date for dates the offset is applied to:', |
|
817 | - 'event_espresso' |
|
818 | - ), |
|
819 | - ) |
|
820 | - ), |
|
821 | - 'submit' => new EE_Submit_Input( |
|
822 | - array( |
|
823 | - 'html_label_text' => '', |
|
824 | - 'default' => esc_html__('Apply Offset', 'event_espresso'), |
|
825 | - ) |
|
826 | - ), |
|
827 | - ), |
|
828 | - ) |
|
829 | - ); |
|
830 | - } |
|
831 | - return $this->datetime_fix_offset_form; |
|
832 | - } |
|
833 | - |
|
834 | - |
|
835 | - /** |
|
836 | - * Callback for the run_datetime_offset_fix route. |
|
837 | - * |
|
838 | - * @throws EE_Error |
|
839 | - */ |
|
840 | - protected function _apply_datetime_offset() |
|
841 | - { |
|
842 | - if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
843 | - $form = $this->_get_datetime_offset_fix_form(); |
|
844 | - $form->receive_form_submission($this->_req_data); |
|
845 | - if ($form->is_valid()) { |
|
846 | - // save offset data so batch processor can get it. |
|
847 | - DatetimeOffsetFix::updateOffset($form->get_input_value('offset_input')); |
|
848 | - $utc_timezone = new DateTimeZone('UTC'); |
|
849 | - $date_range_start_date = DateTime::createFromFormat( |
|
850 | - 'm/d/Y H:i:s', |
|
851 | - $form->get_input_value('date_range_start_date') . ' 00:00:00', |
|
852 | - $utc_timezone |
|
853 | - ); |
|
854 | - $date_range_end_date = DateTime::createFromFormat( |
|
855 | - 'm/d/Y H:i:s', |
|
856 | - $form->get_input_value('date_range_end_date') . ' 23:59:59', |
|
857 | - $utc_timezone |
|
858 | - ); |
|
859 | - if ($date_range_start_date instanceof DateTime) { |
|
860 | - DatetimeOffsetFix::updateStartDateRange(DbSafeDateTime::createFromDateTime($date_range_start_date)); |
|
861 | - } |
|
862 | - if ($date_range_end_date instanceof DateTime) { |
|
863 | - DatetimeOffsetFix::updateEndDateRange(DbSafeDateTime::createFromDateTime($date_range_end_date)); |
|
864 | - } |
|
865 | - // redirect to batch tool |
|
866 | - wp_redirect( |
|
867 | - EE_Admin_Page::add_query_args_and_nonce( |
|
868 | - array( |
|
869 | - 'page' => 'espresso_batch', |
|
870 | - 'batch' => 'job', |
|
871 | - 'label' => esc_html__('Applying Offset', 'event_espresso'), |
|
872 | - 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\DatetimeOffsetFix'), |
|
873 | - 'return_url' => urlencode( |
|
874 | - add_query_arg( |
|
875 | - array( |
|
876 | - 'action' => 'datetime_tools', |
|
877 | - ), |
|
878 | - EEH_URL::current_url_without_query_paramaters( |
|
879 | - array( |
|
880 | - 'return_action', |
|
881 | - 'run_datetime_offset_fix_nonce', |
|
882 | - 'return', |
|
883 | - 'datetime_tools_nonce', |
|
884 | - ) |
|
885 | - ) |
|
886 | - ) |
|
887 | - ), |
|
888 | - ), |
|
889 | - admin_url() |
|
890 | - ) |
|
891 | - ); |
|
892 | - exit; |
|
893 | - } |
|
894 | - } |
|
895 | - } |
|
20 | + /** |
|
21 | + * @var EE_Form_Section_Proper |
|
22 | + */ |
|
23 | + protected $datetime_fix_offset_form; |
|
24 | + |
|
25 | + |
|
26 | + protected function _init_page_props() |
|
27 | + { |
|
28 | + $this->page_slug = EE_MAINTENANCE_PG_SLUG; |
|
29 | + $this->page_label = EE_MAINTENANCE_LABEL; |
|
30 | + $this->_admin_base_url = EE_MAINTENANCE_ADMIN_URL; |
|
31 | + $this->_admin_base_path = EE_MAINTENANCE_ADMIN; |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + protected function _ajax_hooks() |
|
36 | + { |
|
37 | + add_action('wp_ajax_migration_step', array($this, 'migration_step')); |
|
38 | + add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran')); |
|
39 | + } |
|
40 | + |
|
41 | + |
|
42 | + protected function _define_page_props() |
|
43 | + { |
|
44 | + $this->_admin_page_title = EE_MAINTENANCE_LABEL; |
|
45 | + $this->_labels = array( |
|
46 | + 'buttons' => array( |
|
47 | + 'reset_reservations' => esc_html__('Reset Ticket and Datetime Reserved Counts', 'event_espresso'), |
|
48 | + 'reset_capabilities' => esc_html__('Reset Event Espresso Capabilities', 'event_espresso'), |
|
49 | + ), |
|
50 | + ); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + protected function _set_page_routes() |
|
55 | + { |
|
56 | + $this->_page_routes = array( |
|
57 | + 'default' => array( |
|
58 | + 'func' => '_maintenance', |
|
59 | + 'capability' => 'manage_options', |
|
60 | + ), |
|
61 | + 'change_maintenance_level' => array( |
|
62 | + 'func' => '_change_maintenance_level', |
|
63 | + 'capability' => 'manage_options', |
|
64 | + 'noheader' => true, |
|
65 | + ), |
|
66 | + 'system_status' => array( |
|
67 | + 'func' => '_system_status', |
|
68 | + 'capability' => 'manage_options', |
|
69 | + ), |
|
70 | + 'download_system_status' => array( |
|
71 | + 'func' => '_download_system_status', |
|
72 | + 'capability' => 'manage_options', |
|
73 | + 'noheader' => true, |
|
74 | + ), |
|
75 | + 'send_migration_crash_report' => array( |
|
76 | + 'func' => '_send_migration_crash_report', |
|
77 | + 'capability' => 'manage_options', |
|
78 | + 'noheader' => true, |
|
79 | + ), |
|
80 | + 'confirm_migration_crash_report_sent' => array( |
|
81 | + 'func' => '_confirm_migration_crash_report_sent', |
|
82 | + 'capability' => 'manage_options', |
|
83 | + ), |
|
84 | + 'data_reset' => array( |
|
85 | + 'func' => '_data_reset_and_delete', |
|
86 | + 'capability' => 'manage_options', |
|
87 | + ), |
|
88 | + 'reset_db' => array( |
|
89 | + 'func' => '_reset_db', |
|
90 | + 'capability' => 'manage_options', |
|
91 | + 'noheader' => true, |
|
92 | + 'args' => array('nuke_old_ee4_data' => true), |
|
93 | + ), |
|
94 | + 'start_with_fresh_ee4_db' => array( |
|
95 | + 'func' => '_reset_db', |
|
96 | + 'capability' => 'manage_options', |
|
97 | + 'noheader' => true, |
|
98 | + 'args' => array('nuke_old_ee4_data' => false), |
|
99 | + ), |
|
100 | + 'delete_db' => array( |
|
101 | + 'func' => '_delete_db', |
|
102 | + 'capability' => 'manage_options', |
|
103 | + 'noheader' => true, |
|
104 | + ), |
|
105 | + 'rerun_migration_from_ee3' => array( |
|
106 | + 'func' => '_rerun_migration_from_ee3', |
|
107 | + 'capability' => 'manage_options', |
|
108 | + 'noheader' => true, |
|
109 | + ), |
|
110 | + 'reset_reservations' => array( |
|
111 | + 'func' => '_reset_reservations', |
|
112 | + 'capability' => 'manage_options', |
|
113 | + 'noheader' => true, |
|
114 | + ), |
|
115 | + 'reset_capabilities' => array( |
|
116 | + 'func' => '_reset_capabilities', |
|
117 | + 'capability' => 'manage_options', |
|
118 | + 'noheader' => true, |
|
119 | + ), |
|
120 | + 'reattempt_migration' => array( |
|
121 | + 'func' => '_reattempt_migration', |
|
122 | + 'capability' => 'manage_options', |
|
123 | + 'noheader' => true, |
|
124 | + ), |
|
125 | + 'datetime_tools' => array( |
|
126 | + 'func' => '_datetime_tools', |
|
127 | + 'capability' => 'manage_options', |
|
128 | + ), |
|
129 | + 'run_datetime_offset_fix' => array( |
|
130 | + 'func' => '_apply_datetime_offset', |
|
131 | + 'noheader' => true, |
|
132 | + 'headers_sent_route' => 'datetime_tools', |
|
133 | + 'capability' => 'manage_options', |
|
134 | + ), |
|
135 | + ); |
|
136 | + } |
|
137 | + |
|
138 | + |
|
139 | + protected function _set_page_config() |
|
140 | + { |
|
141 | + $this->_page_config = array( |
|
142 | + 'default' => array( |
|
143 | + 'nav' => array( |
|
144 | + 'label' => esc_html__('Maintenance', 'event_espresso'), |
|
145 | + 'order' => 10, |
|
146 | + ), |
|
147 | + 'require_nonce' => false, |
|
148 | + ), |
|
149 | + 'data_reset' => array( |
|
150 | + 'nav' => array( |
|
151 | + 'label' => esc_html__('Reset/Delete Data', 'event_espresso'), |
|
152 | + 'order' => 20, |
|
153 | + ), |
|
154 | + 'require_nonce' => false, |
|
155 | + ), |
|
156 | + 'datetime_tools' => array( |
|
157 | + 'nav' => array( |
|
158 | + 'label' => esc_html__('Datetime Utilities', 'event_espresso'), |
|
159 | + 'order' => 25, |
|
160 | + ), |
|
161 | + 'require_nonce' => false, |
|
162 | + ), |
|
163 | + 'system_status' => array( |
|
164 | + 'nav' => array( |
|
165 | + 'label' => esc_html__("System Information", "event_espresso"), |
|
166 | + 'order' => 30, |
|
167 | + ), |
|
168 | + 'require_nonce' => false, |
|
169 | + ), |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * default maintenance page. If we're in maintenance mode level 2, then we need to show |
|
176 | + * the migration scripts and all that UI. |
|
177 | + */ |
|
178 | + public function _maintenance() |
|
179 | + { |
|
180 | + // it all depends if we're in maintenance model level 1 (frontend-only) or |
|
181 | + // level 2 (everything except maintenance page) |
|
182 | + try { |
|
183 | + // get the current maintenance level and check if |
|
184 | + // we are removed |
|
185 | + $mm = EE_Maintenance_Mode::instance()->level(); |
|
186 | + $placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
|
187 | + if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) { |
|
188 | + // we just took the site out of maintenance mode, so notify the user. |
|
189 | + // unfortunately this message appears to be echoed on the NEXT page load... |
|
190 | + // oh well, we should really be checking for this on addon deactivation anyways |
|
191 | + EE_Error::add_attention( |
|
192 | + __( |
|
193 | + 'Site taken out of maintenance mode because no data migration scripts are required', |
|
194 | + 'event_espresso' |
|
195 | + ) |
|
196 | + ); |
|
197 | + $this->_process_notices(array('page' => 'espresso_maintenance_settings'), false); |
|
198 | + } |
|
199 | + // in case an exception is thrown while trying to handle migrations |
|
200 | + switch (EE_Maintenance_Mode::instance()->level()) { |
|
201 | + case EE_Maintenance_Mode::level_0_not_in_maintenance: |
|
202 | + case EE_Maintenance_Mode::level_1_frontend_only_maintenance: |
|
203 | + $show_maintenance_switch = true; |
|
204 | + $show_backup_db_text = false; |
|
205 | + $show_migration_progress = false; |
|
206 | + $script_names = array(); |
|
207 | + $addons_should_be_upgraded_first = false; |
|
208 | + break; |
|
209 | + case EE_Maintenance_Mode::level_2_complete_maintenance: |
|
210 | + $show_maintenance_switch = false; |
|
211 | + $show_migration_progress = true; |
|
212 | + if (isset($this->_req_data['continue_migration'])) { |
|
213 | + $show_backup_db_text = false; |
|
214 | + } else { |
|
215 | + $show_backup_db_text = true; |
|
216 | + } |
|
217 | + $scripts_needing_to_run = EE_Data_Migration_Manager::instance() |
|
218 | + ->check_for_applicable_data_migration_scripts(); |
|
219 | + $addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating(); |
|
220 | + $script_names = array(); |
|
221 | + $current_script = null; |
|
222 | + foreach ($scripts_needing_to_run as $script) { |
|
223 | + if ($script instanceof EE_Data_Migration_Script_Base) { |
|
224 | + if (! $current_script) { |
|
225 | + $current_script = $script; |
|
226 | + $current_script->migration_page_hooks(); |
|
227 | + } |
|
228 | + $script_names[] = $script->pretty_name(); |
|
229 | + } |
|
230 | + } |
|
231 | + break; |
|
232 | + } |
|
233 | + $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
|
234 | + $exception_thrown = false; |
|
235 | + } catch (EE_Error $e) { |
|
236 | + EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
|
237 | + // now, just so we can display the page correctly, make a error migration script stage object |
|
238 | + // and also put the error on it. It only persists for the duration of this request |
|
239 | + $most_recent_migration = new EE_DMS_Unknown_1_0_0(); |
|
240 | + $most_recent_migration->add_error($e->getMessage()); |
|
241 | + $exception_thrown = true; |
|
242 | + } |
|
243 | + $current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set(); |
|
244 | + $current_db_state = str_replace('.decaf', '', $current_db_state); |
|
245 | + if ($exception_thrown |
|
246 | + || ($most_recent_migration |
|
247 | + && $most_recent_migration instanceof EE_Data_Migration_Script_Base |
|
248 | + && $most_recent_migration->is_broken() |
|
249 | + ) |
|
250 | + ) { |
|
251 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php'; |
|
252 | + $this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/'; |
|
253 | + $this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce( |
|
254 | + array( |
|
255 | + 'action' => 'confirm_migration_crash_report_sent', |
|
256 | + 'success' => '0', |
|
257 | + ), |
|
258 | + EE_MAINTENANCE_ADMIN_URL |
|
259 | + ); |
|
260 | + } elseif ($addons_should_be_upgraded_first) { |
|
261 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php'; |
|
262 | + } else { |
|
263 | + if ($most_recent_migration |
|
264 | + && $most_recent_migration instanceof EE_Data_Migration_Script_Base |
|
265 | + && $most_recent_migration->can_continue() |
|
266 | + ) { |
|
267 | + $show_backup_db_text = false; |
|
268 | + $show_continue_current_migration_script = true; |
|
269 | + $show_most_recent_migration = true; |
|
270 | + } elseif (isset($this->_req_data['continue_migration'])) { |
|
271 | + $show_most_recent_migration = true; |
|
272 | + $show_continue_current_migration_script = false; |
|
273 | + } else { |
|
274 | + $show_most_recent_migration = false; |
|
275 | + $show_continue_current_migration_script = false; |
|
276 | + } |
|
277 | + if (isset($current_script)) { |
|
278 | + $migrates_to = $current_script->migrates_to_version(); |
|
279 | + $plugin_slug = $migrates_to['slug']; |
|
280 | + $new_version = $migrates_to['version']; |
|
281 | + $this->_template_args = array_merge( |
|
282 | + $this->_template_args, |
|
283 | + array( |
|
284 | + 'current_db_state' => sprintf( |
|
285 | + __("EE%s (%s)", "event_espresso"), |
|
286 | + isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3, |
|
287 | + $plugin_slug |
|
288 | + ), |
|
289 | + 'next_db_state' => isset($current_script) ? sprintf( |
|
290 | + __("EE%s (%s)", 'event_espresso'), |
|
291 | + $new_version, |
|
292 | + $plugin_slug |
|
293 | + ) : null, |
|
294 | + ) |
|
295 | + ); |
|
296 | + } else { |
|
297 | + $this->_template_args['current_db_state'] = null; |
|
298 | + $this->_template_args['next_db_state'] = null; |
|
299 | + } |
|
300 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php'; |
|
301 | + $this->_template_args = array_merge( |
|
302 | + $this->_template_args, |
|
303 | + array( |
|
304 | + 'show_most_recent_migration' => $show_most_recent_migration, |
|
305 | + // flag for showing the most recent migration's status and/or errors |
|
306 | + 'show_migration_progress' => $show_migration_progress, |
|
307 | + // flag for showing the option to run migrations and see their progress |
|
308 | + 'show_backup_db_text' => $show_backup_db_text, |
|
309 | + // flag for showing text telling the user to backup their DB |
|
310 | + 'show_maintenance_switch' => $show_maintenance_switch, |
|
311 | + // flag for showing the option to change maintenance mode between levels 0 and 1 |
|
312 | + 'script_names' => $script_names, |
|
313 | + // array of names of scripts that have run |
|
314 | + 'show_continue_current_migration_script' => $show_continue_current_migration_script, |
|
315 | + // flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0 |
|
316 | + 'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce( |
|
317 | + array('action' => 'reset_db'), |
|
318 | + EE_MAINTENANCE_ADMIN_URL |
|
319 | + ), |
|
320 | + 'data_reset_page' => EE_Admin_Page::add_query_args_and_nonce( |
|
321 | + array('action' => 'data_reset'), |
|
322 | + EE_MAINTENANCE_ADMIN_URL |
|
323 | + ), |
|
324 | + 'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce( |
|
325 | + array('action' => 'change_maintenance_level'), |
|
326 | + EE_MAINTENANCE_ADMIN_URL |
|
327 | + ), |
|
328 | + 'ultimate_db_state' => sprintf( |
|
329 | + __("EE%s", 'event_espresso'), |
|
330 | + espresso_version() |
|
331 | + ), |
|
332 | + ) |
|
333 | + ); |
|
334 | + // make sure we have the form fields helper available. It usually is, but sometimes it isn't |
|
335 | + } |
|
336 | + $this->_template_args['most_recent_migration'] = $most_recent_migration;// the actual most recently ran migration |
|
337 | + // now render the migration options part, and put it in a variable |
|
338 | + $migration_options_template_file = apply_filters( |
|
339 | + 'FHEE__ee_migration_page__migration_options_template', |
|
340 | + EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee4.template.php' |
|
341 | + ); |
|
342 | + $migration_options_html = EEH_Template::display_template( |
|
343 | + $migration_options_template_file, |
|
344 | + $this->_template_args, |
|
345 | + true |
|
346 | + ); |
|
347 | + $this->_template_args['migration_options_html'] = $migration_options_html; |
|
348 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
349 | + $this->_template_path, |
|
350 | + $this->_template_args, |
|
351 | + true |
|
352 | + ); |
|
353 | + $this->display_admin_page_with_sidebar(); |
|
354 | + } |
|
355 | + |
|
356 | + |
|
357 | + /** |
|
358 | + * returns JSON and executes another step of the currently-executing data migration (called via ajax) |
|
359 | + */ |
|
360 | + public function migration_step() |
|
361 | + { |
|
362 | + $this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request(); |
|
363 | + $this->_return_json(); |
|
364 | + } |
|
365 | + |
|
366 | + |
|
367 | + /** |
|
368 | + * Can be used by js when it notices a response with HTML in it in order |
|
369 | + * to log the malformed response |
|
370 | + */ |
|
371 | + public function add_error_to_migrations_ran() |
|
372 | + { |
|
373 | + EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']); |
|
374 | + $this->_template_args['data'] = array('ok' => true); |
|
375 | + $this->_return_json(); |
|
376 | + } |
|
377 | + |
|
378 | + |
|
379 | + /** |
|
380 | + * changes the maintenance level, provided there are still no migration scripts that should run |
|
381 | + */ |
|
382 | + public function _change_maintenance_level() |
|
383 | + { |
|
384 | + $new_level = absint($this->_req_data['maintenance_mode_level']); |
|
385 | + if (! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
386 | + EE_Maintenance_Mode::instance()->set_maintenance_level($new_level); |
|
387 | + $success = true; |
|
388 | + } else { |
|
389 | + EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
|
390 | + $success = false; |
|
391 | + } |
|
392 | + $this->_redirect_after_action($success, 'Maintenance Mode', esc_html__("Updated", "event_espresso")); |
|
393 | + } |
|
394 | + |
|
395 | + |
|
396 | + /** |
|
397 | + * a tab with options for resetting and/or deleting EE data |
|
398 | + * |
|
399 | + * @throws \EE_Error |
|
400 | + * @throws \DomainException |
|
401 | + */ |
|
402 | + public function _data_reset_and_delete() |
|
403 | + { |
|
404 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php'; |
|
405 | + $this->_template_args['reset_reservations_button'] = $this->get_action_link_or_button( |
|
406 | + 'reset_reservations', |
|
407 | + 'reset_reservations', |
|
408 | + array(), |
|
409 | + 'button button-primary ee-confirm', |
|
410 | + '', |
|
411 | + false |
|
412 | + ); |
|
413 | + $this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button( |
|
414 | + 'reset_capabilities', |
|
415 | + 'reset_capabilities', |
|
416 | + array(), |
|
417 | + 'button button-primary ee-confirm', |
|
418 | + '', |
|
419 | + false |
|
420 | + ); |
|
421 | + $this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
422 | + array('action' => 'delete_db'), |
|
423 | + EE_MAINTENANCE_ADMIN_URL |
|
424 | + ); |
|
425 | + $this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
426 | + array('action' => 'reset_db'), |
|
427 | + EE_MAINTENANCE_ADMIN_URL |
|
428 | + ); |
|
429 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
430 | + $this->_template_path, |
|
431 | + $this->_template_args, |
|
432 | + true |
|
433 | + ); |
|
434 | + $this->display_admin_page_with_sidebar(); |
|
435 | + } |
|
436 | + |
|
437 | + |
|
438 | + protected function _reset_reservations() |
|
439 | + { |
|
440 | + if (\EED_Ticket_Sales_Monitor::reset_reservation_counts()) { |
|
441 | + EE_Error::add_success( |
|
442 | + __( |
|
443 | + 'Ticket and datetime reserved counts have been successfully reset.', |
|
444 | + 'event_espresso' |
|
445 | + ) |
|
446 | + ); |
|
447 | + } else { |
|
448 | + EE_Error::add_success( |
|
449 | + __( |
|
450 | + 'Ticket and datetime reserved counts were correct and did not need resetting.', |
|
451 | + 'event_espresso' |
|
452 | + ) |
|
453 | + ); |
|
454 | + } |
|
455 | + $this->_redirect_after_action(true, '', '', array('action' => 'data_reset'), true); |
|
456 | + } |
|
457 | + |
|
458 | + |
|
459 | + protected function _reset_capabilities() |
|
460 | + { |
|
461 | + EE_Registry::instance()->CAP->init_caps(true); |
|
462 | + EE_Error::add_success( |
|
463 | + __( |
|
464 | + 'Default Event Espresso capabilities have been restored for all current roles.', |
|
465 | + 'event_espresso' |
|
466 | + ) |
|
467 | + ); |
|
468 | + $this->_redirect_after_action(false, '', '', array('action' => 'data_reset'), true); |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + /** |
|
473 | + * resets the DMSs so we can attempt to continue migrating after a fatal error |
|
474 | + * (only a good idea when someone has somehow tried ot fix whatever caused |
|
475 | + * the fatal error in teh first place) |
|
476 | + */ |
|
477 | + protected function _reattempt_migration() |
|
478 | + { |
|
479 | + EE_Data_Migration_Manager::instance()->reattempt(); |
|
480 | + $this->_redirect_after_action(false, '', '', array('action' => 'default'), true); |
|
481 | + } |
|
482 | + |
|
483 | + |
|
484 | + /** |
|
485 | + * shows the big ol' System Information page |
|
486 | + */ |
|
487 | + public function _system_status() |
|
488 | + { |
|
489 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php'; |
|
490 | + $this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati(); |
|
491 | + $this->_template_args['download_system_status_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
492 | + array( |
|
493 | + 'action' => 'download_system_status', |
|
494 | + ), |
|
495 | + EE_MAINTENANCE_ADMIN_URL |
|
496 | + ); |
|
497 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
498 | + $this->_template_path, |
|
499 | + $this->_template_args, |
|
500 | + true |
|
501 | + ); |
|
502 | + $this->display_admin_page_with_sidebar(); |
|
503 | + } |
|
504 | + |
|
505 | + /** |
|
506 | + * Downloads an HTML file of the system status that can be easily stored or emailed |
|
507 | + */ |
|
508 | + public function _download_system_status() |
|
509 | + { |
|
510 | + $status_info = EEM_System_Status::instance()->get_system_stati(); |
|
511 | + header('Content-Disposition: attachment'); |
|
512 | + header("Content-Disposition: attachment; filename=system_status_" . sanitize_key(site_url()) . ".html"); |
|
513 | + echo "<style>table{border:1px solid darkgrey;}td{vertical-align:top}</style>"; |
|
514 | + echo "<h1>System Information for " . site_url() . "</h1>"; |
|
515 | + echo EEH_Template::layout_array_as_table($status_info); |
|
516 | + die; |
|
517 | + } |
|
518 | + |
|
519 | + |
|
520 | + public function _send_migration_crash_report() |
|
521 | + { |
|
522 | + $from = $this->_req_data['from']; |
|
523 | + $from_name = $this->_req_data['from_name']; |
|
524 | + $body = $this->_req_data['body']; |
|
525 | + try { |
|
526 | + $success = wp_mail( |
|
527 | + EE_SUPPORT_EMAIL, |
|
528 | + 'Migration Crash Report', |
|
529 | + $body . "/r/n<br>" . print_r(EEM_System_Status::instance()->get_system_stati(), true), |
|
530 | + array( |
|
531 | + "from:$from_name<$from>", |
|
532 | + ) |
|
533 | + ); |
|
534 | + } catch (Exception $e) { |
|
535 | + $success = false; |
|
536 | + } |
|
537 | + $this->_redirect_after_action( |
|
538 | + $success, |
|
539 | + esc_html__("Migration Crash Report", "event_espresso"), |
|
540 | + esc_html__("sent", "event_espresso"), |
|
541 | + array('success' => $success, 'action' => 'confirm_migration_crash_report_sent') |
|
542 | + ); |
|
543 | + } |
|
544 | + |
|
545 | + |
|
546 | + public function _confirm_migration_crash_report_sent() |
|
547 | + { |
|
548 | + try { |
|
549 | + $most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true); |
|
550 | + } catch (EE_Error $e) { |
|
551 | + EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage()); |
|
552 | + // now, just so we can display the page correctly, make a error migration script stage object |
|
553 | + // and also put the error on it. It only persists for the duration of this request |
|
554 | + $most_recent_migration = new EE_DMS_Unknown_1_0_0(); |
|
555 | + $most_recent_migration->add_error($e->getMessage()); |
|
556 | + } |
|
557 | + $success = $this->_req_data['success'] == '1' ? true : false; |
|
558 | + $this->_template_args['success'] = $success; |
|
559 | + $this->_template_args['most_recent_migration'] = $most_recent_migration; |
|
560 | + $this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
561 | + array('action' => 'reset_db'), |
|
562 | + EE_MAINTENANCE_ADMIN_URL |
|
563 | + ); |
|
564 | + $this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
565 | + array('action' => 'data_reset'), |
|
566 | + EE_MAINTENANCE_ADMIN_URL |
|
567 | + ); |
|
568 | + $this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce( |
|
569 | + array('action' => 'reattempt_migration'), |
|
570 | + EE_MAINTENANCE_ADMIN_URL |
|
571 | + ); |
|
572 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php'; |
|
573 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
574 | + $this->_template_path, |
|
575 | + $this->_template_args, |
|
576 | + true |
|
577 | + ); |
|
578 | + $this->display_admin_page_with_sidebar(); |
|
579 | + } |
|
580 | + |
|
581 | + |
|
582 | + /** |
|
583 | + * Resets the entire EE4 database. |
|
584 | + * Currently basically only sets up ee4 database for a fresh install- doesn't |
|
585 | + * actually clean out the old wp options, or cpts (although does erase old ee table data) |
|
586 | + * |
|
587 | + * @param boolean $nuke_old_ee4_data controls whether or not we |
|
588 | + * destroy the old ee4 data, or just try initializing ee4 default data |
|
589 | + */ |
|
590 | + public function _reset_db($nuke_old_ee4_data = true) |
|
591 | + { |
|
592 | + EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
593 | + if ($nuke_old_ee4_data) { |
|
594 | + EEH_Activation::delete_all_espresso_cpt_data(); |
|
595 | + EEH_Activation::delete_all_espresso_tables_and_data(false); |
|
596 | + EEH_Activation::remove_cron_tasks(); |
|
597 | + } |
|
598 | + // make sure when we reset the registry's config that it |
|
599 | + // switches to using the new singleton |
|
600 | + EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(true); |
|
601 | + EE_System::instance()->initialize_db_if_no_migrations_required(true); |
|
602 | + EE_System::instance()->redirect_to_about_ee(); |
|
603 | + } |
|
604 | + |
|
605 | + |
|
606 | + /** |
|
607 | + * Deletes ALL EE tables, Records, and Options from the database. |
|
608 | + */ |
|
609 | + public function _delete_db() |
|
610 | + { |
|
611 | + EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
612 | + EEH_Activation::delete_all_espresso_cpt_data(); |
|
613 | + EEH_Activation::delete_all_espresso_tables_and_data(); |
|
614 | + EEH_Activation::remove_cron_tasks(); |
|
615 | + EEH_Activation::deactivate_event_espresso(); |
|
616 | + wp_safe_redirect(admin_url('plugins.php')); |
|
617 | + exit; |
|
618 | + } |
|
619 | + |
|
620 | + |
|
621 | + /** |
|
622 | + * sets up EE4 to rerun the migrations from ee3 to ee4 |
|
623 | + */ |
|
624 | + public function _rerun_migration_from_ee3() |
|
625 | + { |
|
626 | + EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance); |
|
627 | + EEH_Activation::delete_all_espresso_cpt_data(); |
|
628 | + EEH_Activation::delete_all_espresso_tables_and_data(false); |
|
629 | + // set the db state to something that will require migrations |
|
630 | + update_option(EE_Data_Migration_Manager::current_database_state, '3.1.36.0'); |
|
631 | + EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_2_complete_maintenance); |
|
632 | + $this->_redirect_after_action( |
|
633 | + true, |
|
634 | + esc_html__("Database", 'event_espresso'), |
|
635 | + esc_html__("reset", 'event_espresso') |
|
636 | + ); |
|
637 | + } |
|
638 | + |
|
639 | + |
|
640 | + // none of the below group are currently used for Gateway Settings |
|
641 | + protected function _add_screen_options() |
|
642 | + { |
|
643 | + } |
|
644 | + |
|
645 | + |
|
646 | + protected function _add_feature_pointers() |
|
647 | + { |
|
648 | + } |
|
649 | + |
|
650 | + |
|
651 | + public function admin_init() |
|
652 | + { |
|
653 | + } |
|
654 | + |
|
655 | + |
|
656 | + public function admin_notices() |
|
657 | + { |
|
658 | + } |
|
659 | + |
|
660 | + |
|
661 | + public function admin_footer_scripts() |
|
662 | + { |
|
663 | + } |
|
664 | + |
|
665 | + |
|
666 | + public function load_scripts_styles() |
|
667 | + { |
|
668 | + wp_enqueue_script('ee_admin_js'); |
|
669 | + wp_enqueue_script( |
|
670 | + 'ee-maintenance', |
|
671 | + EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.js', |
|
672 | + array('jquery'), |
|
673 | + EVENT_ESPRESSO_VERSION, |
|
674 | + true |
|
675 | + ); |
|
676 | + wp_register_style( |
|
677 | + 'espresso_maintenance', |
|
678 | + EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', |
|
679 | + array(), |
|
680 | + EVENT_ESPRESSO_VERSION |
|
681 | + ); |
|
682 | + wp_enqueue_style('espresso_maintenance'); |
|
683 | + // localize script stuff |
|
684 | + wp_localize_script( |
|
685 | + 'ee-maintenance', |
|
686 | + 'ee_maintenance', |
|
687 | + array( |
|
688 | + 'migrating' => esc_html__("Updating Database...", "event_espresso"), |
|
689 | + 'next' => esc_html__("Next", "event_espresso"), |
|
690 | + 'fatal_error' => esc_html__("A Fatal Error Has Occurred", "event_espresso"), |
|
691 | + 'click_next_when_ready' => esc_html__( |
|
692 | + "The current Database Update has ended. Click 'next' when ready to proceed", |
|
693 | + "event_espresso" |
|
694 | + ), |
|
695 | + 'status_no_more_migration_scripts' => EE_Data_Migration_Manager::status_no_more_migration_scripts, |
|
696 | + 'status_fatal_error' => EE_Data_Migration_Manager::status_fatal_error, |
|
697 | + 'status_completed' => EE_Data_Migration_Manager::status_completed, |
|
698 | + 'confirm' => esc_html__( |
|
699 | + 'Are you sure you want to do this? It CANNOT be undone!', |
|
700 | + 'event_espresso' |
|
701 | + ), |
|
702 | + 'confirm_skip_migration' => esc_html__( |
|
703 | + 'You have chosen to NOT migrate your existing data. Are you sure you want to continue?', |
|
704 | + 'event_espresso' |
|
705 | + ), |
|
706 | + ) |
|
707 | + ); |
|
708 | + } |
|
709 | + |
|
710 | + |
|
711 | + public function load_scripts_styles_default() |
|
712 | + { |
|
713 | + } |
|
714 | + |
|
715 | + |
|
716 | + /** |
|
717 | + * Enqueue scripts and styles for the datetime tools page. |
|
718 | + */ |
|
719 | + public function load_scripts_styles_datetime_tools() |
|
720 | + { |
|
721 | + EE_Datepicker_Input::enqueue_styles_and_scripts(); |
|
722 | + } |
|
723 | + |
|
724 | + |
|
725 | + protected function _datetime_tools() |
|
726 | + { |
|
727 | + $form_action = EE_Admin_Page::add_query_args_and_nonce( |
|
728 | + array( |
|
729 | + 'action' => 'run_datetime_offset_fix', |
|
730 | + 'return_action' => $this->_req_action, |
|
731 | + ), |
|
732 | + EE_MAINTENANCE_ADMIN_URL |
|
733 | + ); |
|
734 | + $form = $this->_get_datetime_offset_fix_form(); |
|
735 | + $this->_admin_page_title = esc_html__('Datetime Utilities', 'event_espresso'); |
|
736 | + $this->_template_args['admin_page_content'] = $form->form_open($form_action, 'post') |
|
737 | + . $form->get_html_and_js() |
|
738 | + . $form->form_close(); |
|
739 | + $this->display_admin_page_with_no_sidebar(); |
|
740 | + } |
|
741 | + |
|
742 | + |
|
743 | + protected function _get_datetime_offset_fix_form() |
|
744 | + { |
|
745 | + if (! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) { |
|
746 | + $this->datetime_fix_offset_form = new EE_Form_Section_Proper( |
|
747 | + array( |
|
748 | + 'name' => 'datetime_offset_fix_option', |
|
749 | + 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
|
750 | + 'subsections' => array( |
|
751 | + 'title' => new EE_Form_Section_HTML( |
|
752 | + EEH_HTML::h2( |
|
753 | + esc_html__('Datetime Offset Tool', 'event_espresso') |
|
754 | + ) |
|
755 | + ), |
|
756 | + 'explanation' => new EE_Form_Section_HTML( |
|
757 | + EEH_HTML::p( |
|
758 | + esc_html__( |
|
759 | + 'Use this tool to automatically apply the provided offset to all Event Espresso records in your database that involve dates and times.', |
|
760 | + 'event_espresso' |
|
761 | + ) |
|
762 | + ) |
|
763 | + . EEH_HTML::p( |
|
764 | + esc_html__( |
|
765 | + 'Note: If you enter 1.25, that will result in the offset of 1 hour 15 minutes being applied. Decimals represent the fraction of hours, not minutes.', |
|
766 | + 'event_espresso' |
|
767 | + ) |
|
768 | + ) |
|
769 | + ), |
|
770 | + 'offset_input' => new EE_Float_Input( |
|
771 | + array( |
|
772 | + 'html_name' => 'offset_for_datetimes', |
|
773 | + 'html_label_text' => esc_html__( |
|
774 | + 'Offset to apply (in hours):', |
|
775 | + 'event_espresso' |
|
776 | + ), |
|
777 | + 'min_value' => '-12', |
|
778 | + 'max_value' => '14', |
|
779 | + 'step_value' => '.25', |
|
780 | + 'default' => DatetimeOffsetFix::getOffset(), |
|
781 | + ) |
|
782 | + ), |
|
783 | + 'date_range_explanation' => new EE_Form_Section_HTML( |
|
784 | + EEH_HTML::p( |
|
785 | + esc_html__( |
|
786 | + 'Leave the following fields blank if you want the offset to be applied to all dates. If however, you want to just apply the offset to a specific range of dates you can restrict the offset application using these fields.', |
|
787 | + 'event_espresso' |
|
788 | + ) |
|
789 | + ) |
|
790 | + . EEH_HTML::p( |
|
791 | + EEH_HTML::strong( |
|
792 | + sprintf( |
|
793 | + esc_html__( |
|
794 | + 'Note: please enter the dates in UTC (You can use %1$sthis online tool%2$s to assist with conversions).', |
|
795 | + 'event_espresso' |
|
796 | + ), |
|
797 | + '<a href="https://www.timeanddate.com/worldclock/converter.html">', |
|
798 | + '</a>' |
|
799 | + ) |
|
800 | + ) |
|
801 | + ) |
|
802 | + ), |
|
803 | + 'date_range_start_date' => new EE_Datepicker_Input( |
|
804 | + array( |
|
805 | + 'html_name' => 'offset_date_start_range', |
|
806 | + 'html_label_text' => esc_html__( |
|
807 | + 'Start Date for dates the offset applied to:', |
|
808 | + 'event_espresso' |
|
809 | + ), |
|
810 | + ) |
|
811 | + ), |
|
812 | + 'date_range_end_date' => new EE_Datepicker_Input( |
|
813 | + array( |
|
814 | + 'html_name' => 'offset_date_end_range', |
|
815 | + 'html_label_text' => esc_html( |
|
816 | + 'End Date for dates the offset is applied to:', |
|
817 | + 'event_espresso' |
|
818 | + ), |
|
819 | + ) |
|
820 | + ), |
|
821 | + 'submit' => new EE_Submit_Input( |
|
822 | + array( |
|
823 | + 'html_label_text' => '', |
|
824 | + 'default' => esc_html__('Apply Offset', 'event_espresso'), |
|
825 | + ) |
|
826 | + ), |
|
827 | + ), |
|
828 | + ) |
|
829 | + ); |
|
830 | + } |
|
831 | + return $this->datetime_fix_offset_form; |
|
832 | + } |
|
833 | + |
|
834 | + |
|
835 | + /** |
|
836 | + * Callback for the run_datetime_offset_fix route. |
|
837 | + * |
|
838 | + * @throws EE_Error |
|
839 | + */ |
|
840 | + protected function _apply_datetime_offset() |
|
841 | + { |
|
842 | + if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
843 | + $form = $this->_get_datetime_offset_fix_form(); |
|
844 | + $form->receive_form_submission($this->_req_data); |
|
845 | + if ($form->is_valid()) { |
|
846 | + // save offset data so batch processor can get it. |
|
847 | + DatetimeOffsetFix::updateOffset($form->get_input_value('offset_input')); |
|
848 | + $utc_timezone = new DateTimeZone('UTC'); |
|
849 | + $date_range_start_date = DateTime::createFromFormat( |
|
850 | + 'm/d/Y H:i:s', |
|
851 | + $form->get_input_value('date_range_start_date') . ' 00:00:00', |
|
852 | + $utc_timezone |
|
853 | + ); |
|
854 | + $date_range_end_date = DateTime::createFromFormat( |
|
855 | + 'm/d/Y H:i:s', |
|
856 | + $form->get_input_value('date_range_end_date') . ' 23:59:59', |
|
857 | + $utc_timezone |
|
858 | + ); |
|
859 | + if ($date_range_start_date instanceof DateTime) { |
|
860 | + DatetimeOffsetFix::updateStartDateRange(DbSafeDateTime::createFromDateTime($date_range_start_date)); |
|
861 | + } |
|
862 | + if ($date_range_end_date instanceof DateTime) { |
|
863 | + DatetimeOffsetFix::updateEndDateRange(DbSafeDateTime::createFromDateTime($date_range_end_date)); |
|
864 | + } |
|
865 | + // redirect to batch tool |
|
866 | + wp_redirect( |
|
867 | + EE_Admin_Page::add_query_args_and_nonce( |
|
868 | + array( |
|
869 | + 'page' => 'espresso_batch', |
|
870 | + 'batch' => 'job', |
|
871 | + 'label' => esc_html__('Applying Offset', 'event_espresso'), |
|
872 | + 'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\DatetimeOffsetFix'), |
|
873 | + 'return_url' => urlencode( |
|
874 | + add_query_arg( |
|
875 | + array( |
|
876 | + 'action' => 'datetime_tools', |
|
877 | + ), |
|
878 | + EEH_URL::current_url_without_query_paramaters( |
|
879 | + array( |
|
880 | + 'return_action', |
|
881 | + 'run_datetime_offset_fix_nonce', |
|
882 | + 'return', |
|
883 | + 'datetime_tools_nonce', |
|
884 | + ) |
|
885 | + ) |
|
886 | + ) |
|
887 | + ), |
|
888 | + ), |
|
889 | + admin_url() |
|
890 | + ) |
|
891 | + ); |
|
892 | + exit; |
|
893 | + } |
|
894 | + } |
|
895 | + } |
|
896 | 896 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $current_script = null; |
222 | 222 | foreach ($scripts_needing_to_run as $script) { |
223 | 223 | if ($script instanceof EE_Data_Migration_Script_Base) { |
224 | - if (! $current_script) { |
|
224 | + if ( ! $current_script) { |
|
225 | 225 | $current_script = $script; |
226 | 226 | $current_script->migration_page_hooks(); |
227 | 227 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | && $most_recent_migration->is_broken() |
249 | 249 | ) |
250 | 250 | ) { |
251 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php'; |
|
251 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php'; |
|
252 | 252 | $this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/'; |
253 | 253 | $this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce( |
254 | 254 | array( |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | EE_MAINTENANCE_ADMIN_URL |
259 | 259 | ); |
260 | 260 | } elseif ($addons_should_be_upgraded_first) { |
261 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php'; |
|
261 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php'; |
|
262 | 262 | } else { |
263 | 263 | if ($most_recent_migration |
264 | 264 | && $most_recent_migration instanceof EE_Data_Migration_Script_Base |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | array( |
284 | 284 | 'current_db_state' => sprintf( |
285 | 285 | __("EE%s (%s)", "event_espresso"), |
286 | - isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3, |
|
286 | + isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3, |
|
287 | 287 | $plugin_slug |
288 | 288 | ), |
289 | 289 | 'next_db_state' => isset($current_script) ? sprintf( |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $this->_template_args['current_db_state'] = null; |
298 | 298 | $this->_template_args['next_db_state'] = null; |
299 | 299 | } |
300 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php'; |
|
300 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php'; |
|
301 | 301 | $this->_template_args = array_merge( |
302 | 302 | $this->_template_args, |
303 | 303 | array( |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | ); |
334 | 334 | // make sure we have the form fields helper available. It usually is, but sometimes it isn't |
335 | 335 | } |
336 | - $this->_template_args['most_recent_migration'] = $most_recent_migration;// the actual most recently ran migration |
|
336 | + $this->_template_args['most_recent_migration'] = $most_recent_migration; // the actual most recently ran migration |
|
337 | 337 | // now render the migration options part, and put it in a variable |
338 | 338 | $migration_options_template_file = apply_filters( |
339 | 339 | 'FHEE__ee_migration_page__migration_options_template', |
340 | - EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee4.template.php' |
|
340 | + EE_MAINTENANCE_TEMPLATE_PATH.'migration_options_from_ee4.template.php' |
|
341 | 341 | ); |
342 | 342 | $migration_options_html = EEH_Template::display_template( |
343 | 343 | $migration_options_template_file, |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | public function _change_maintenance_level() |
383 | 383 | { |
384 | 384 | $new_level = absint($this->_req_data['maintenance_mode_level']); |
385 | - if (! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
385 | + if ( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) { |
|
386 | 386 | EE_Maintenance_Mode::instance()->set_maintenance_level($new_level); |
387 | 387 | $success = true; |
388 | 388 | } else { |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | public function _data_reset_and_delete() |
403 | 403 | { |
404 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php'; |
|
404 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php'; |
|
405 | 405 | $this->_template_args['reset_reservations_button'] = $this->get_action_link_or_button( |
406 | 406 | 'reset_reservations', |
407 | 407 | 'reset_reservations', |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | */ |
487 | 487 | public function _system_status() |
488 | 488 | { |
489 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php'; |
|
489 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php'; |
|
490 | 490 | $this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati(); |
491 | 491 | $this->_template_args['download_system_status_url'] = EE_Admin_Page::add_query_args_and_nonce( |
492 | 492 | array( |
@@ -509,9 +509,9 @@ discard block |
||
509 | 509 | { |
510 | 510 | $status_info = EEM_System_Status::instance()->get_system_stati(); |
511 | 511 | header('Content-Disposition: attachment'); |
512 | - header("Content-Disposition: attachment; filename=system_status_" . sanitize_key(site_url()) . ".html"); |
|
512 | + header("Content-Disposition: attachment; filename=system_status_".sanitize_key(site_url()).".html"); |
|
513 | 513 | echo "<style>table{border:1px solid darkgrey;}td{vertical-align:top}</style>"; |
514 | - echo "<h1>System Information for " . site_url() . "</h1>"; |
|
514 | + echo "<h1>System Information for ".site_url()."</h1>"; |
|
515 | 515 | echo EEH_Template::layout_array_as_table($status_info); |
516 | 516 | die; |
517 | 517 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $success = wp_mail( |
527 | 527 | EE_SUPPORT_EMAIL, |
528 | 528 | 'Migration Crash Report', |
529 | - $body . "/r/n<br>" . print_r(EEM_System_Status::instance()->get_system_stati(), true), |
|
529 | + $body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true), |
|
530 | 530 | array( |
531 | 531 | "from:$from_name<$from>", |
532 | 532 | ) |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | array('action' => 'reattempt_migration'), |
570 | 570 | EE_MAINTENANCE_ADMIN_URL |
571 | 571 | ); |
572 | - $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php'; |
|
572 | + $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php'; |
|
573 | 573 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
574 | 574 | $this->_template_path, |
575 | 575 | $this->_template_args, |
@@ -668,14 +668,14 @@ discard block |
||
668 | 668 | wp_enqueue_script('ee_admin_js'); |
669 | 669 | wp_enqueue_script( |
670 | 670 | 'ee-maintenance', |
671 | - EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.js', |
|
671 | + EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.js', |
|
672 | 672 | array('jquery'), |
673 | 673 | EVENT_ESPRESSO_VERSION, |
674 | 674 | true |
675 | 675 | ); |
676 | 676 | wp_register_style( |
677 | 677 | 'espresso_maintenance', |
678 | - EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', |
|
678 | + EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css', |
|
679 | 679 | array(), |
680 | 680 | EVENT_ESPRESSO_VERSION |
681 | 681 | ); |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | protected function _get_datetime_offset_fix_form() |
744 | 744 | { |
745 | - if (! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) { |
|
745 | + if ( ! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) { |
|
746 | 746 | $this->datetime_fix_offset_form = new EE_Form_Section_Proper( |
747 | 747 | array( |
748 | 748 | 'name' => 'datetime_offset_fix_option', |
@@ -848,12 +848,12 @@ discard block |
||
848 | 848 | $utc_timezone = new DateTimeZone('UTC'); |
849 | 849 | $date_range_start_date = DateTime::createFromFormat( |
850 | 850 | 'm/d/Y H:i:s', |
851 | - $form->get_input_value('date_range_start_date') . ' 00:00:00', |
|
851 | + $form->get_input_value('date_range_start_date').' 00:00:00', |
|
852 | 852 | $utc_timezone |
853 | 853 | ); |
854 | 854 | $date_range_end_date = DateTime::createFromFormat( |
855 | 855 | 'm/d/Y H:i:s', |
856 | - $form->get_input_value('date_range_end_date') . ' 23:59:59', |
|
856 | + $form->get_input_value('date_range_end_date').' 23:59:59', |
|
857 | 857 | $utc_timezone |
858 | 858 | ); |
859 | 859 | if ($date_range_start_date instanceof DateTime) { |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | <div class="padding"> |
15 | 15 | <h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span> |
16 | 16 | <?php esc_html_e( |
17 | - 'Reset Ticket and Datetime Reserved Counts', |
|
18 | - 'event_espresso' |
|
19 | - ); ?></h4> |
|
17 | + 'Reset Ticket and Datetime Reserved Counts', |
|
18 | + 'event_espresso' |
|
19 | + ); ?></h4> |
|
20 | 20 | <p><?php esc_html_e('Use this to reset the counts for ticket and datetime reservations.', 'event_espresso'); ?></p> |
21 | 21 | <div class="float-right"><?php echo $reset_reservations_button; ?></div> |
22 | 22 | <div class="clear"></div> |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | <div class="padding"> |
29 | 29 | <h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span> |
30 | 30 | <?php esc_html_e( |
31 | - 'Reset Event Espresso Capabilities', |
|
32 | - 'event_espresso' |
|
33 | - ); ?></h4> |
|
31 | + 'Reset Event Espresso Capabilities', |
|
32 | + 'event_espresso' |
|
33 | + ); ?></h4> |
|
34 | 34 | <p> |
35 | 35 | <?php esc_html_e( |
36 | - 'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities. Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', |
|
37 | - 'event_espresso' |
|
38 | - ); ?></p> |
|
36 | + 'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities. Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', |
|
37 | + 'event_espresso' |
|
38 | + ); ?></p> |
|
39 | 39 | <div class="float-right"><?php echo $reset_capabilities_button; ?></div> |
40 | 40 | <div class="clear"></div> |
41 | 41 | </div> |
@@ -45,25 +45,25 @@ discard block |
||
45 | 45 | <div class="padding"> |
46 | 46 | <h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span> |
47 | 47 | <?php esc_html_e( |
48 | - 'Reset Event Espresso Data', |
|
49 | - 'event_espresso' |
|
50 | - ); ?></h4> |
|
48 | + 'Reset Event Espresso Data', |
|
49 | + 'event_espresso' |
|
50 | + ); ?></h4> |
|
51 | 51 | <p> |
52 | 52 | <?php esc_html_e( |
53 | - ' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?></p> |
|
53 | + ' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?></p> |
|
56 | 56 | <p> |
57 | 57 | <?php esc_html_e( |
58 | - 'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.', |
|
59 | - 'event_espresso' |
|
60 | - ); ?></p> |
|
58 | + 'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.', |
|
59 | + 'event_espresso' |
|
60 | + ); ?></p> |
|
61 | 61 | <div class="float-right"><a class="button button-primary ee-confirm" |
62 | 62 | href="<?php echo $reset_db_url; ?>"> |
63 | 63 | <?php esc_html_e( |
64 | - 'Reset Event Espresso Tables', |
|
65 | - 'event_espresso' |
|
66 | - ); ?></a></div> |
|
64 | + 'Reset Event Espresso Tables', |
|
65 | + 'event_espresso' |
|
66 | + ); ?></a></div> |
|
67 | 67 | <div class="clear"></div> |
68 | 68 | </div> |
69 | 69 | <br/> |
@@ -72,71 +72,71 @@ discard block |
||
72 | 72 | <div class="padding"> |
73 | 73 | <h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span> |
74 | 74 | <?php esc_html_e( |
75 | - 'Permanently Delete ALL Event Espresso Data', |
|
76 | - 'event_espresso' |
|
77 | - ); ?></h4> |
|
75 | + 'Permanently Delete ALL Event Espresso Data', |
|
76 | + 'event_espresso' |
|
77 | + ); ?></h4> |
|
78 | 78 | <p> |
79 | 79 | <?php esc_html_e( |
80 | - ' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.', |
|
81 | - 'event_espresso' |
|
82 | - ); ?></p> |
|
80 | + ' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.', |
|
81 | + 'event_espresso' |
|
82 | + ); ?></p> |
|
83 | 83 | <p> |
84 | 84 | <?php esc_html_e( |
85 | - 'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', |
|
86 | - 'event_espresso' |
|
87 | - ); ?></p> |
|
85 | + 'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', |
|
86 | + 'event_espresso' |
|
87 | + ); ?></p> |
|
88 | 88 | <p class="important-notice"> |
89 | 89 | <?php printf( |
90 | - esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), |
|
91 | - '<em>', |
|
92 | - '</em>' |
|
93 | - ); ?><br/></p> |
|
90 | + esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), |
|
91 | + '<em>', |
|
92 | + '</em>' |
|
93 | + ); ?><br/></p> |
|
94 | 94 | <ol> |
95 | 95 | <li> |
96 | 96 | <?php printf( |
97 | - esc_html__( |
|
98 | - 'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.', |
|
99 | - 'event_espresso' |
|
100 | - ), |
|
101 | - '<strong>', |
|
102 | - '</strong>' |
|
103 | - ); ?></li> |
|
97 | + esc_html__( |
|
98 | + 'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.', |
|
99 | + 'event_espresso' |
|
100 | + ), |
|
101 | + '<strong>', |
|
102 | + '</strong>' |
|
103 | + ); ?></li> |
|
104 | 104 | <li> |
105 | 105 | <?php printf( |
106 | - esc_html__( |
|
107 | - 'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', |
|
108 | - 'event_espresso' |
|
109 | - ), |
|
110 | - '<strong>', |
|
111 | - '</strong>' |
|
112 | - ); ?></li> |
|
106 | + esc_html__( |
|
107 | + 'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', |
|
108 | + 'event_espresso' |
|
109 | + ), |
|
110 | + '<strong>', |
|
111 | + '</strong>' |
|
112 | + ); ?></li> |
|
113 | 113 | <li> |
114 | 114 | <?php printf( |
115 | - esc_html__( |
|
116 | - 'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', |
|
117 | - 'event_espresso' |
|
118 | - ), |
|
119 | - '<strong>', |
|
120 | - '</strong>' |
|
121 | - ); ?></li> |
|
115 | + esc_html__( |
|
116 | + 'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', |
|
117 | + 'event_espresso' |
|
118 | + ), |
|
119 | + '<strong>', |
|
120 | + '</strong>' |
|
121 | + ); ?></li> |
|
122 | 122 | <li> |
123 | 123 | <?php printf( |
124 | - esc_html__('Note: Event Espresso 4 categories are %snot%s deleted by this script', 'event_espresso'), |
|
125 | - '<strong>', |
|
126 | - '</strong>' |
|
127 | - ); ?> |
|
124 | + esc_html__('Note: Event Espresso 4 categories are %snot%s deleted by this script', 'event_espresso'), |
|
125 | + '<strong>', |
|
126 | + '</strong>' |
|
127 | + ); ?> |
|
128 | 128 | <br><a href="<?php echo admin_url('edit-tags.php?taxonomy=espresso_event_categories'); ?>"> |
129 | 129 | <?php esc_html_e( |
130 | - 'You can go here to delete Event Espresso categories', |
|
131 | - 'event_espresso' |
|
132 | - ); ?></a></li> |
|
130 | + 'You can go here to delete Event Espresso categories', |
|
131 | + 'event_espresso' |
|
132 | + ); ?></a></li> |
|
133 | 133 | </ol> |
134 | 134 | <div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" |
135 | 135 | class="button-primary ee-confirm"> |
136 | 136 | <?php esc_html_e( |
137 | - 'Permanently Delete All Event Espresso Data', |
|
138 | - 'event_espresso' |
|
139 | - ); ?></a></div> |
|
137 | + 'Permanently Delete All Event Espresso Data', |
|
138 | + 'event_espresso' |
|
139 | + ); ?></a></div> |
|
140 | 140 | <div class="clear"></div> |
141 | 141 | </div> |
142 | 142 | <br/> |