Completed
Branch ENH/prevent-img-src-check-fata... (8c70e2)
by
unknown
07:29 queued 03:32
created
admin_pages/maintenance/templates/migration_options_from_ee4.template.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
                 <tr>
27 27
                     <td>
28 28
                         <?php echo esc_html(
29
-                            apply_filters(
30
-                                'FHEE__ee_migration_page__option_1_main',
31
-                                esc_html__(
32
-                                    'Before updating your database, you should first create a database backup',
33
-                                    "event_espresso"
34
-                                ),
35
-                                $current_db_state,
36
-                                $next_db_state
37
-                            )
38
-                        );
29
+							apply_filters(
30
+								'FHEE__ee_migration_page__option_1_main',
31
+								esc_html__(
32
+									'Before updating your database, you should first create a database backup',
33
+									"event_espresso"
34
+								),
35
+								$current_db_state,
36
+								$next_db_state
37
+							)
38
+						);
39 39
 ?>
40 40
                         <a id="display-migration-details"
41 41
                            class="display-the-hidden lt-grey-text smaller-text hide-if-no-js"
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
                            class="toggle-migration-monitor button-primary"
51 51
                         >
52 52
                             <?php echo esc_html(
53
-                                apply_filters(
54
-                                    'FHEE__ee_migration_page__option_1_button_text',
55
-                                    sprintf(
56
-                                        esc_html__("My Database Is Backed Up, Continue", "event_espresso"),
57
-                                        $current_db_state,
58
-                                        $next_db_state
59
-                                    ),
60
-                                    $current_db_state,
61
-                                    $next_db_state
62
-                                )
63
-                            ); ?></a>
53
+								apply_filters(
54
+									'FHEE__ee_migration_page__option_1_button_text',
55
+									sprintf(
56
+										esc_html__("My Database Is Backed Up, Continue", "event_espresso"),
57
+										$current_db_state,
58
+										$next_db_state
59
+									),
60
+									$current_db_state,
61
+									$next_db_state
62
+								)
63
+							); ?></a>
64 64
                     </td>
65 65
                 </tr>
66 66
                 <tr>
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
                         <div id="migration-details-dv" style="display: none; padding: 1em;">
69 69
                             <p>
70 70
                                 <?php printf(
71
-                                    esc_html__(
72
-                                        '%1$sClick Here to Learn How To Backup your Database Yourself%2$s. Or have one of our dedicated support technicians help you by %3$spurchasing a Priority Support Token.%2$s',
73
-                                        "event_espresso"
74
-                                    ),
75
-                                    '<a target="_blank" href="https://eventespresso.com/wiki/how-to-back-up-your-site/">',
76
-                                    "</a>",
77
-                                    "<a target=\"_blank\" href='https://eventespresso.com/product/priority-support-tokens/'>"
78
-                                );
79
-                            ?>
71
+									esc_html__(
72
+										'%1$sClick Here to Learn How To Backup your Database Yourself%2$s. Or have one of our dedicated support technicians help you by %3$spurchasing a Priority Support Token.%2$s',
73
+										"event_espresso"
74
+									),
75
+									'<a target="_blank" href="https://eventespresso.com/wiki/how-to-back-up-your-site/">',
76
+									"</a>",
77
+									"<a target=\"_blank\" href='https://eventespresso.com/product/priority-support-tokens/'>"
78
+								);
79
+							?>
80 80
                             </p>
81 81
                             <?php do_action('AHEE__ee_migration_page__option_1_extra_details'); ?>
82 82
                         </div>
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     </div>
88 88
     <p>
89 89
         <?php esc_html_e(
90
-            'Don\'t want to keep your old Event Espresso data? Alternatively, you can delete it all and start fresh.',
91
-            'event_espresso'
92
-        ); ?>
90
+			'Don\'t want to keep your old Event Espresso data? Alternatively, you can delete it all and start fresh.',
91
+			'event_espresso'
92
+		); ?>
93 93
         <a
94 94
             href="<?php echo esc_url_raw($data_reset_page); ?>"
95 95
         >
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_migration_was_borked_page.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 <p>
98 98
     <?php printf(
99 99
         esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),
100
-        '<a href="mailto:' . EE_SUPPORT_EMAIL . '">',
100
+        '<a href="mailto:'.EE_SUPPORT_EMAIL.'">',
101 101
         EE_SUPPORT_EMAIL,
102 102
         "</a>"
103 103
     ); ?>
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 <h1><?php esc_html_e("Data Migration Error", "event_espresso"); ?></h1>
8 8
 <p class='error'>
9 9
     <?php printf(
10
-        esc_html__(
11
-            "Your last Database Update had a %s fatal error and was halted%s.",
12
-            "event_espresso"
13
-        ),
14
-        "<b>",
15
-        "</b>"
16
-    ); ?>
10
+		esc_html__(
11
+			"Your last Database Update had a %s fatal error and was halted%s.",
12
+			"event_espresso"
13
+		),
14
+		"<b>",
15
+		"</b>"
16
+	); ?>
17 17
 </p>
18 18
 <a id="show-hide-migration-warnings" class="display-the-hidden">
19 19
     <?php esc_html_e("Show Errors", 'event_espresso'); ?>
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 </ul>
26 26
 <h2>
27 27
     <?php esc_html_e(
28
-        "Fill out the below form to automatically Send Event Espresso a Crash Report",
29
-        "event_espresso"
30
-    ); ?>
28
+		"Fill out the below form to automatically Send Event Espresso a Crash Report",
29
+		"event_espresso"
30
+	); ?>
31 31
 </h2>
32 32
 <form action='<?php echo esc_url_raw(
33
-    EE_Admin_Page::add_query_args_and_nonce(
34
-        ['action' => 'send_migration_crash_report'],
35
-        EE_MAINTENANCE_ADMIN_URL
36
-    )
33
+	EE_Admin_Page::add_query_args_and_nonce(
34
+		['action' => 'send_migration_crash_report'],
35
+		EE_MAINTENANCE_ADMIN_URL
36
+	)
37 37
 );
38 38
 ?>' method='post'
39 39
 >
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
                        type='text'
60 60
                        style="width:200px"
61 61
                        value='<?php printf(
62
-                           esc_html__("Admin of %s", "event_espresso"),
63
-                           get_bloginfo('name', 'display')
64
-                       ); ?>'
62
+						   esc_html__("Admin of %s", "event_espresso"),
63
+						   get_bloginfo('name', 'display')
64
+					   ); ?>'
65 65
                 />
66 66
             </td>
67 67
         </tr>
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
             <td>
73 73
                 <textarea name="body" id="body" class='system_status_info'>
74 74
                     <?php esc_textarea(__(
75
-                        "Enter any comments about why you think the error may have occurred",
76
-                        "event_espresso"
77
-                    )); ?>
75
+						"Enter any comments about why you think the error may have occurred",
76
+						"event_espresso"
77
+					)); ?>
78 78
                 </textarea>
79 79
                 <p class='description'>
80 80
                     <?php esc_textarea(__(
81
-                        "Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.",
82
-                        "event_espresso"
83
-                    )); ?>
81
+						"Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.",
82
+						"event_espresso"
83
+					)); ?>
84 84
                 </p>
85 85
             </td>
86 86
         </tr>
@@ -96,26 +96,26 @@  discard block
 block discarded – undo
96 96
 <br>
97 97
 <p>
98 98
     <?php printf(
99
-        esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),
100
-        '<a href="mailto:' . EE_SUPPORT_EMAIL . '">',
101
-        EE_SUPPORT_EMAIL,
102
-        "</a>"
103
-    ); ?>
99
+		esc_html__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),
100
+		'<a href="mailto:' . EE_SUPPORT_EMAIL . '">',
101
+		EE_SUPPORT_EMAIL,
102
+		"</a>"
103
+	); ?>
104 104
 </p>
105 105
 <textarea class="system_status_info">
106 106
     <?php print_r(EEM_System_Status::instance()->get_system_stati()) ?>
107 107
 </textarea>
108 108
 <p>
109 109
     <?php printf(
110
-        esc_html__('%1$sNext Step%2$s', 'event_espresso'),
111
-        "<a href='$next_url'>",
112
-        "</a>"
113
-    ); ?>
110
+		esc_html__('%1$sNext Step%2$s', 'event_espresso'),
111
+		"<a href='$next_url'>",
112
+		"</a>"
113
+	); ?>
114 114
 </p>
115 115
 <p>
116 116
     <?php printf(
117
-        esc_html__('...or %1$sDON\'T send crash report%2$s.', 'event_espresso'),
118
-        "<a href='$next_url'>",
119
-        "</a>"
120
-    ); ?>
117
+		esc_html__('...or %1$sDON\'T send crash report%2$s.', 'event_espresso'),
118
+		"<a href='$next_url'>",
119
+		"</a>"
120
+	); ?>
121 121
 </p>
Please login to merge, or discard this patch.
maintenance/templates/ee_confirm_migration_crash_report_sent.template.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -11,27 +11,27 @@  discard block
 block discarded – undo
11 11
     <h1><?php esc_html_e("Database Update Crash Report Sent", "event_espresso"); ?></h1>
12 12
     <p>
13 13
         <?php esc_html_e(
14
-            "A crash report email was sent to Event Espresso. You should hear back from us soon.",
15
-            "event_espresso"
16
-        ); ?></p>
14
+			"A crash report email was sent to Event Espresso. You should hear back from us soon.",
15
+			"event_espresso"
16
+		); ?></p>
17 17
 <?php } else {// didn't send email properly ?>
18 18
     <h1><?php esc_html_e("Migration Report not sent", "event_espresso"); ?></h1>
19 19
     <p>
20 20
         <?php esc_html_e(
21
-            "An error occurred and we were not able to automatically send a report to Event Espresso support.",
22
-            "event_espresso"
23
-        ); ?></p>
21
+			"An error occurred and we were not able to automatically send a report to Event Espresso support.",
22
+			"event_espresso"
23
+		); ?></p>
24 24
     <p>
25 25
         <?php printf(
26
-            esc_html__("Please copy-and-paste the system information below to %s", "event_espresso"),
27
-            '<a href="mailto:' . EE_SUPPORT_EMAIL . '">' . EE_SUPPORT_EMAIL . "</a>"
28
-        ); ?></p>
26
+			esc_html__("Please copy-and-paste the system information below to %s", "event_espresso"),
27
+			'<a href="mailto:' . EE_SUPPORT_EMAIL . '">' . EE_SUPPORT_EMAIL . "</a>"
28
+		); ?></p>
29 29
     <label>
30 30
         <?php esc_html_e("system status info", "event_espresso"); ?>
31 31
         <textarea name="system_status_info" class="system_status_info">
32 32
             <?php print_r(
33
-                EEM_System_Status::instance()->get_system_stati()
34
-            ); ?></textarea>
33
+				EEM_System_Status::instance()->get_system_stati()
34
+			); ?></textarea>
35 35
     </label>
36 36
 <?php } ?>
37 37
 
@@ -52,32 +52,32 @@  discard block
 block discarded – undo
52 52
             <td>
53 53
                 <p>
54 54
                     <?php
55
-                    printf(
56
-                        esc_html__(
57
-                            'First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.',
58
-                            'event_espresso'
59
-                        ),
60
-                        "<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>",
61
-                        '</a>',
62
-                        '<pre lang="php">define( \'EE_MIGRATION_STEP_SIZE\', 10 );</pre>',
63
-                        '<b>',
64
-                        '</b>'
65
-                    );
66
-                    ?>
55
+					printf(
56
+						esc_html__(
57
+							'First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.',
58
+							'event_espresso'
59
+						),
60
+						"<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>",
61
+						'</a>',
62
+						'<pre lang="php">define( \'EE_MIGRATION_STEP_SIZE\', 10 );</pre>',
63
+						'<b>',
64
+						'</b>'
65
+					);
66
+					?>
67 67
                 </p>
68 68
 
69 69
                 <p>
70 70
                     <?php
71
-                    printf(
72
-                        esc_html__(
73
-                            'To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.',
74
-                            'event_espresso'
75
-                        ),
76
-                        "<a href='$reset_db_page_url'>",
77
-                        "</a>",
78
-                        "<a class='button-primary' href='$reattempt_action_url'>"
79
-                    );
80
-                    ?>
71
+					printf(
72
+						esc_html__(
73
+							'To retry updating your data: restore to the backup you made before the update and reactivate EE (and any addons you are using) and re-run the Database Update. If you did not make a database backup and are migrating from EE3: delete your EE4 data (use the %1$s Reset/Delete Data tab above%2$s), and then reactivate EE4, and then re-run the migration and updates. If you did not make a database backup, are only updating from a previous install of EE4, have found a solution to the fatal error you received, and are willing to possibly have some data lost, %3$sattempt to continue migrating%2$s.',
74
+							'event_espresso'
75
+						),
76
+						"<a href='$reset_db_page_url'>",
77
+						"</a>",
78
+						"<a class='button-primary' href='$reattempt_action_url'>"
79
+					);
80
+					?>
81 81
                 </p>
82 82
             </td>
83 83
         </tr>
@@ -87,66 +87,66 @@  discard block
 block discarded – undo
87 87
             </td>
88 88
             <td>
89 89
                 <?php
90
-                printf(
91
-                    esc_html__(
92
-                        'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible',
93
-                        'event_espresso'
94
-                    ),
95
-                    "<a href='" . EE_SUPPORT_EMAIL . "'>",
96
-                    "</a>"
97
-                );
98
-                ?>
90
+				printf(
91
+					esc_html__(
92
+						'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible',
93
+						'event_espresso'
94
+					),
95
+					"<a href='" . EE_SUPPORT_EMAIL . "'>",
96
+					"</a>"
97
+				);
98
+				?>
99 99
             </td>
100 100
         </tr>
101 101
         <tr>
102 102
             <td>
103 103
                 <p class='big-text'>
104 104
                     <?php printf(
105
-                        esc_html__('I don\'t need my old EE %s data', 'event_espresso'),
106
-                        $most_recent_migration->slug()
107
-                    ); ?></p>
105
+						esc_html__('I don\'t need my old EE %s data', 'event_espresso'),
106
+						$most_recent_migration->slug()
107
+					); ?></p>
108 108
             </td>
109 109
             <td>
110 110
                 <?php
111
-                printf(
112
-                    esc_html__(
113
-                        'If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s',
114
-                        'event_espresso'
115
-                    ),
116
-                    $most_recent_migration->slug(),
117
-                    "<a id='do-not-migrate' class='do-not-migrate button-primary' href='$reset_db_action_url'>",
118
-                    "</a>"
119
-                );
120
-                ?>
111
+				printf(
112
+					esc_html__(
113
+						'If you are ok with losing all the EE %1$s data, you can skip the Database Updates and %2$s use EE4 with only default Data%3$s',
114
+						'event_espresso'
115
+					),
116
+					$most_recent_migration->slug(),
117
+					"<a id='do-not-migrate' class='do-not-migrate button-primary' href='$reset_db_action_url'>",
118
+					"</a>"
119
+				);
120
+				?>
121 121
             </td>
122 122
         </tr>
123 123
         <tr>
124 124
             <td>
125 125
                 <p class='big-text'>
126 126
                     <?php printf(
127
-                        esc_html__('I want to go back to my old version of EE %1$s', 'event_espresso'),
128
-                        $most_recent_migration->slug()
129
-                    ); ?>
127
+						esc_html__('I want to go back to my old version of EE %1$s', 'event_espresso'),
128
+						$most_recent_migration->slug()
129
+					); ?>
130 130
             </td>
131 131
             <td>
132 132
                 <p>
133 133
                     <?php
134
-                    printf(
135
-                        esc_html__(
136
-                            'Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.',
137
-                            'event_espresso'
138
-                        ),
139
-                        "<a href='$reset_db_page_url'>",
140
-                        "</a>",
141
-                        $most_recent_migration->slug()
142
-                    );
143
-                    ?>
134
+					printf(
135
+						esc_html__(
136
+							'Then we suggest you re-activate the old version of EE %3$s and restore your database to the backup you made just before the Database Update . If you didn\'t backup your database and are migrating from EE3, you can also delete your EE4 data (use on the %1$s"Reset/Delete Data" tab above%2$s), and then reactivate EE3 from the plugins page. Note: some of your EE3 shortcodes may have been changed to their EE4 equivalents, so you will need to change them back.',
137
+							'event_espresso'
138
+						),
139
+						"<a href='$reset_db_page_url'>",
140
+						"</a>",
141
+						$most_recent_migration->slug()
142
+					);
143
+					?>
144 144
                 </p>
145 145
                 <p>
146 146
                     <?php esc_html_e(
147
-                        "If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.",
148
-                        'event_espresso'
149
-                    ); ?></p>
147
+						"If you ever decide to re-attempt using EE4, you will again be given the option to migrate your EE3 data or not.",
148
+						'event_espresso'
149
+					); ?></p>
150 150
             </td>
151 151
         </tr>
152 152
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     <p>
25 25
         <?php printf(
26 26
             esc_html__("Please copy-and-paste the system information below to %s", "event_espresso"),
27
-            '<a href="mailto:' . EE_SUPPORT_EMAIL . '">' . EE_SUPPORT_EMAIL . "</a>"
27
+            '<a href="mailto:'.EE_SUPPORT_EMAIL.'">'.EE_SUPPORT_EMAIL."</a>"
28 28
         ); ?></p>
29 29
     <label>
30 30
         <?php esc_html_e("system status info", "event_espresso"); ?>
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                             'First, %1$s check the forums %2$s to see if there is a solution before re-attempting the Database Update. Often it helps to deactivate other plugins which may have conflicts; or it may help to add %3$s to your %4$s wp-config.php%5$s (which will make the update run slower, but may resolve any memory exhaustion errors.',
58 58
                             'event_espresso'
59 59
                         ),
60
-                        "<a href='" . EE_SUPPORT_EMAIL . "' target='_blank'>",
60
+                        "<a href='".EE_SUPPORT_EMAIL."' target='_blank'>",
61 61
                         '</a>',
62 62
                         '<pre lang="php">define( \'EE_MIGRATION_STEP_SIZE\', 10 );</pre>',
63 63
                         '<b>',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                         'Just make sure you\'ve %1$s checked for a solution in the forums,%2$s and properly contacted Support. We will get back to you as soon as possible',
93 93
                         'event_espresso'
94 94
                     ),
95
-                    "<a href='" . EE_SUPPORT_EMAIL . "'>",
95
+                    "<a href='".EE_SUPPORT_EMAIL."'>",
96 96
                     "</a>"
97 97
                 );
98 98
                 ?>
Please login to merge, or discard this patch.
admin_pages/maintenance/Maintenance_Admin_Page_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
         // define some page related constants
29 29
         define('EE_MAINTENANCE_LABEL', esc_html__('Maintenance', 'event_espresso'));
30 30
         define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings');
31
-        define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG));
32
-        define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance/');
33
-        define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates/');
34
-        define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/');
31
+        define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page='.EE_MAINTENANCE_PG_SLUG));
32
+        define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES.'maintenance/');
33
+        define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN.'templates/');
34
+        define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL.'maintenance/assets/');
35 35
         // check that if we're in maintenance mode that we tell the admin that
36 36
         add_action('admin_notices', [$this, 'check_maintenance_mode']);
37 37
         parent::__construct();
Please login to merge, or discard this patch.
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -15,112 +15,112 @@
 block discarded – undo
15 15
  */
16 16
 class Maintenance_Admin_Page_Init extends EE_Admin_Page_Init
17 17
 {
18
-    /**
19
-     * @var int
20
-     */
21
-    protected $maintenance_mode_level;
18
+	/**
19
+	 * @var int
20
+	 */
21
+	protected $maintenance_mode_level;
22 22
 
23 23
 
24
-    public function __construct()
25
-    {
26
-        $this->maintenance_mode_level = EE_Maintenance_Mode::instance()->level();
27
-        // define some page related constants
28
-        define('EE_MAINTENANCE_LABEL', esc_html__('Maintenance', 'event_espresso'));
29
-        define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings');
30
-        define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG));
31
-        define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance/');
32
-        define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates/');
33
-        define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/');
34
-        // check that if we're in maintenance mode that we tell the admin that
35
-        add_action('admin_notices', [$this, 'check_maintenance_mode']);
36
-        parent::__construct();
37
-    }
24
+	public function __construct()
25
+	{
26
+		$this->maintenance_mode_level = EE_Maintenance_Mode::instance()->level();
27
+		// define some page related constants
28
+		define('EE_MAINTENANCE_LABEL', esc_html__('Maintenance', 'event_espresso'));
29
+		define('EE_MAINTENANCE_PG_SLUG', 'espresso_maintenance_settings');
30
+		define('EE_MAINTENANCE_ADMIN_URL', admin_url('admin.php?page=' . EE_MAINTENANCE_PG_SLUG));
31
+		define('EE_MAINTENANCE_ADMIN', EE_ADMIN_PAGES . 'maintenance/');
32
+		define('EE_MAINTENANCE_TEMPLATE_PATH', EE_MAINTENANCE_ADMIN . 'templates/');
33
+		define('EE_MAINTENANCE_ASSETS_URL', EE_ADMIN_PAGES_URL . 'maintenance/assets/');
34
+		// check that if we're in maintenance mode that we tell the admin that
35
+		add_action('admin_notices', [$this, 'check_maintenance_mode']);
36
+		parent::__construct();
37
+	}
38 38
 
39 39
 
40
-    protected function _set_init_properties()
41
-    {
42
-        $this->label = EE_MAINTENANCE_LABEL;
43
-    }
40
+	protected function _set_init_properties()
41
+	{
42
+		$this->label = EE_MAINTENANCE_LABEL;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * @throws EE_Error
48
-     */
49
-    protected function _set_menu_map()
50
-    {
51
-        $menu_map        = $this->_menu_map();
52
-        $this->_menu_map = $this->maintenance_mode_level === EE_Maintenance_Mode::level_2_complete_maintenance
53
-            ? new EE_Admin_Page_Main_Menu($menu_map)
54
-            : new EE_Admin_Page_Sub_Menu($menu_map);
55
-    }
46
+	/**
47
+	 * @throws EE_Error
48
+	 */
49
+	protected function _set_menu_map()
50
+	{
51
+		$menu_map        = $this->_menu_map();
52
+		$this->_menu_map = $this->maintenance_mode_level === EE_Maintenance_Mode::level_2_complete_maintenance
53
+			? new EE_Admin_Page_Main_Menu($menu_map)
54
+			: new EE_Admin_Page_Sub_Menu($menu_map);
55
+	}
56 56
 
57 57
 
58
-    protected function _menu_map()
59
-    {
60
-        $map = [
61
-            'menu_group'              => 'extras',
62
-            'menu_order'              => 30,
63
-            'show_on_menu'            => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
64
-            'parent_slug'             => 'espresso_events',
65
-            'menu_slug'               => EE_MAINTENANCE_PG_SLUG,
66
-            'menu_label'              => EE_MAINTENANCE_LABEL,
67
-            'capability'              => 'manage_options',
68
-            'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG,
69
-            'admin_init_page'         => $this,
70
-        ];
71
-        if ($this->maintenance_mode_level == EE_Maintenance_Mode::level_2_complete_maintenance) {
72
-            $map['menu_group'] = 'main';
73
-            $map['subtitle']   = EE_MAINTENANCE_LABEL;
74
-            $map['menu_label'] = esc_html__('Event Espresso', 'event_espresso');
75
-        }
76
-        return $map;
77
-    }
58
+	protected function _menu_map()
59
+	{
60
+		$map = [
61
+			'menu_group'              => 'extras',
62
+			'menu_order'              => 30,
63
+			'show_on_menu'            => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
64
+			'parent_slug'             => 'espresso_events',
65
+			'menu_slug'               => EE_MAINTENANCE_PG_SLUG,
66
+			'menu_label'              => EE_MAINTENANCE_LABEL,
67
+			'capability'              => 'manage_options',
68
+			'maintenance_mode_parent' => EE_MAINTENANCE_PG_SLUG,
69
+			'admin_init_page'         => $this,
70
+		];
71
+		if ($this->maintenance_mode_level == EE_Maintenance_Mode::level_2_complete_maintenance) {
72
+			$map['menu_group'] = 'main';
73
+			$map['subtitle']   = EE_MAINTENANCE_LABEL;
74
+			$map['menu_label'] = esc_html__('Event Espresso', 'event_espresso');
75
+		}
76
+		return $map;
77
+	}
78 78
 
79 79
 
80
-    /**
81
-     * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of
82
-     * maintenance mode
83
-     */
84
-    public function check_maintenance_mode()
85
-    {
86
-        $notice               = '';
87
-        $maintenance_page_url = '';
88
-        if ($this->maintenance_mode_level) {
89
-            $maintenance_page_url = esc_url_raw(
90
-                EE_Admin_Page::add_query_args_and_nonce([], EE_MAINTENANCE_ADMIN_URL)
91
-            );
92
-            switch ($this->maintenance_mode_level) {
93
-                case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
94
-                    $notice = '<div class="update-nag ee-update-nag">';
95
-                    $notice .= sprintf(
96
-                        esc_html__(
97
-                            "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.",
98
-                            "event_espresso"
99
-                        ),
100
-                        "<a href='$maintenance_page_url'>",
101
-                        "</a>"
102
-                    );
103
-                    $notice .= '</div>';
104
-                    break;
105
-                case EE_Maintenance_Mode::level_2_complete_maintenance:
106
-                    $notice = '<div class="error"><p>';
107
-                    $notice .= sprintf(
108
-                        esc_html__(
109
-                            "As part of the process for updating Event Espresso, your database also
80
+	/**
81
+	 * Checks if we're in maintenance mode, and if so we notify the admin adn tell them how to take the site OUT of
82
+	 * maintenance mode
83
+	 */
84
+	public function check_maintenance_mode()
85
+	{
86
+		$notice               = '';
87
+		$maintenance_page_url = '';
88
+		if ($this->maintenance_mode_level) {
89
+			$maintenance_page_url = esc_url_raw(
90
+				EE_Admin_Page::add_query_args_and_nonce([], EE_MAINTENANCE_ADMIN_URL)
91
+			);
92
+			switch ($this->maintenance_mode_level) {
93
+				case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
94
+					$notice = '<div class="update-nag ee-update-nag">';
95
+					$notice .= sprintf(
96
+						esc_html__(
97
+							"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.",
98
+							"event_espresso"
99
+						),
100
+						"<a href='$maintenance_page_url'>",
101
+						"</a>"
102
+					);
103
+					$notice .= '</div>';
104
+					break;
105
+				case EE_Maintenance_Mode::level_2_complete_maintenance:
106
+					$notice = '<div class="error"><p>';
107
+					$notice .= sprintf(
108
+						esc_html__(
109
+							"As part of the process for updating Event Espresso, your database also
110 110
 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.",
111
-                            "event_espresso"
112
-                        ),
113
-                        "<a href='$maintenance_page_url'>",
114
-                        "</a>"
115
-                    );
116
-                    $notice .= '</p></div>';
117
-                    break;
118
-            }
119
-        }
120
-        echo apply_filters(
121
-            'FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice',
122
-            $notice, // already escaped
123
-            $maintenance_page_url // already escaped
124
-        );
125
-    }
111
+							"event_espresso"
112
+						),
113
+						"<a href='$maintenance_page_url'>",
114
+						"</a>"
115
+					);
116
+					$notice .= '</p></div>';
117
+					break;
118
+			}
119
+		}
120
+		echo apply_filters(
121
+			'FHEE__Maintenance_Admin_Page_Init__check_maintenance_mode__notice',
122
+			$notice, // already escaped
123
+			$maintenance_page_url // already escaped
124
+		);
125
+	}
126 126
 }
Please login to merge, or discard this patch.
admin_pages/maintenance/Maintenance_Admin_Page.core.php 2 patches
Indentation   +948 added lines, -948 removed lines patch added patch discarded remove patch
@@ -14,952 +14,952 @@
 block discarded – undo
14 14
  */
15 15
 class Maintenance_Admin_Page extends EE_Admin_Page
16 16
 {
17
-    /**
18
-     * @var EE_Data_Migration_Manager
19
-     */
20
-    protected $migration_manager;
21
-
22
-    /**
23
-     * @var EE_Maintenance_Mode
24
-     */
25
-    protected $maintenance_mode;
26
-
27
-    /**
28
-     * @var EE_Form_Section_Proper
29
-     */
30
-    protected $datetime_fix_offset_form;
31
-
32
-
33
-    /**
34
-     * @param bool $routing
35
-     * @throws EE_Error
36
-     * @throws ReflectionException
37
-     */
38
-    public function __construct($routing = true)
39
-    {
40
-        $this->migration_manager = EE_Data_Migration_Manager::instance();
41
-        $this->maintenance_mode  = EE_Maintenance_Mode::instance();
42
-        parent::__construct($routing);
43
-    }
44
-
45
-
46
-    protected function _init_page_props()
47
-    {
48
-        $this->page_slug        = EE_MAINTENANCE_PG_SLUG;
49
-        $this->page_label       = EE_MAINTENANCE_LABEL;
50
-        $this->_admin_base_url  = EE_MAINTENANCE_ADMIN_URL;
51
-        $this->_admin_base_path = EE_MAINTENANCE_ADMIN;
52
-    }
53
-
54
-
55
-    protected function _ajax_hooks()
56
-    {
57
-        add_action('wp_ajax_migration_step', [$this, 'migration_step']);
58
-        add_action('wp_ajax_add_error_to_migrations_ran', [$this, 'add_error_to_migrations_ran']);
59
-    }
60
-
61
-
62
-    protected function _define_page_props()
63
-    {
64
-        $this->_admin_page_title = EE_MAINTENANCE_LABEL;
65
-        $this->_labels           = [
66
-            'buttons' => [
67
-                'reset_reservations' => esc_html__('Reset Ticket and Datetime Reserved Counts', 'event_espresso'),
68
-                'reset_capabilities' => esc_html__('Reset Event Espresso Capabilities', 'event_espresso'),
69
-            ],
70
-        ];
71
-    }
72
-
73
-
74
-    protected function _set_page_routes()
75
-    {
76
-        $this->_page_routes = [
77
-            'default'                             => [
78
-                'func'       => '_maintenance',
79
-                'capability' => 'manage_options',
80
-            ],
81
-            'change_maintenance_level'            => [
82
-                'func'       => '_change_maintenance_level',
83
-                'capability' => 'manage_options',
84
-                'noheader'   => true,
85
-            ],
86
-            'system_status'                       => [
87
-                'func'       => '_system_status',
88
-                'capability' => 'manage_options',
89
-            ],
90
-            'download_system_status'              => [
91
-                'func'       => '_download_system_status',
92
-                'capability' => 'manage_options',
93
-                'noheader'   => true,
94
-            ],
95
-            'send_migration_crash_report'         => [
96
-                'func'       => '_send_migration_crash_report',
97
-                'capability' => 'manage_options',
98
-                'noheader'   => true,
99
-            ],
100
-            'confirm_migration_crash_report_sent' => [
101
-                'func'       => '_confirm_migration_crash_report_sent',
102
-                'capability' => 'manage_options',
103
-            ],
104
-            'data_reset'                          => [
105
-                'func'       => '_data_reset_and_delete',
106
-                'capability' => 'manage_options',
107
-            ],
108
-            'reset_db'                            => [
109
-                'func'       => '_reset_db',
110
-                'capability' => 'manage_options',
111
-                'noheader'   => true,
112
-                'args'       => ['nuke_old_ee4_data' => true],
113
-            ],
114
-            'start_with_fresh_ee4_db'             => [
115
-                'func'       => '_reset_db',
116
-                'capability' => 'manage_options',
117
-                'noheader'   => true,
118
-                'args'       => ['nuke_old_ee4_data' => false],
119
-            ],
120
-            'delete_db'                           => [
121
-                'func'       => '_delete_db',
122
-                'capability' => 'manage_options',
123
-                'noheader'   => true,
124
-            ],
125
-            'rerun_migration_from_ee3'            => [
126
-                'func'       => '_rerun_migration_from_ee3',
127
-                'capability' => 'manage_options',
128
-                'noheader'   => true,
129
-            ],
130
-            'reset_reservations'                  => [
131
-                'func'       => '_reset_reservations',
132
-                'capability' => 'manage_options',
133
-                'noheader'   => true,
134
-            ],
135
-            'reset_capabilities'                  => [
136
-                'func'       => '_reset_capabilities',
137
-                'capability' => 'manage_options',
138
-                'noheader'   => true,
139
-            ],
140
-            'reattempt_migration'                 => [
141
-                'func'       => '_reattempt_migration',
142
-                'capability' => 'manage_options',
143
-                'noheader'   => true,
144
-            ],
145
-            'datetime_tools'                      => [
146
-                'func'       => '_datetime_tools',
147
-                'capability' => 'manage_options',
148
-            ],
149
-            'run_datetime_offset_fix'             => [
150
-                'func'               => '_apply_datetime_offset',
151
-                'noheader'           => true,
152
-                'headers_sent_route' => 'datetime_tools',
153
-                'capability'         => 'manage_options',
154
-            ],
155
-        ];
156
-    }
157
-
158
-
159
-    protected function _set_page_config()
160
-    {
161
-        $this->_page_config = [
162
-            'default'        => [
163
-                'nav'           => [
164
-                    'label' => esc_html__('Maintenance', 'event_espresso'),
165
-                    'order' => 10,
166
-                ],
167
-                'require_nonce' => false,
168
-            ],
169
-            'data_reset'     => [
170
-                'nav'           => [
171
-                    'label' => esc_html__('Reset/Delete Data', 'event_espresso'),
172
-                    'order' => 20,
173
-                ],
174
-                'require_nonce' => false,
175
-            ],
176
-            'datetime_tools' => [
177
-                'nav'           => [
178
-                    'label' => esc_html__('Datetime Utilities', 'event_espresso'),
179
-                    'order' => 25,
180
-                ],
181
-                'require_nonce' => false,
182
-            ],
183
-            'system_status'  => [
184
-                'nav'           => [
185
-                    'label' => esc_html__("System Information", "event_espresso"),
186
-                    'order' => 30,
187
-                ],
188
-                'require_nonce' => false,
189
-            ],
190
-        ];
191
-    }
192
-
193
-
194
-    /**
195
-     * default maintenance page.
196
-     * If we're in maintenance mode level 2, then we need to show the migration scripts and all that UI.
197
-     *
198
-     * @throws EE_Error
199
-     */
200
-    public function _maintenance()
201
-    {
202
-        $show_maintenance_switch         = true;
203
-        $show_backup_db_text             = false;
204
-        $show_migration_progress         = false;
205
-        $script_names                    = [];
206
-        $addons_should_be_upgraded_first = false;
207
-        // it all depends on if we're in maintenance model level 1 (frontend-only) or
208
-        // level 2 (everything except maintenance page)
209
-        try {
210
-            // get the current maintenance level and check if
211
-            // we are removed
212
-            $mMode_level  = $this->maintenance_mode->level();
213
-            $placed_in_mm = $this->maintenance_mode->set_maintenance_mode_if_db_old();
214
-            if ($mMode_level == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) {
215
-                // we just took the site out of maintenance mode, so notify the user.
216
-                // unfortunately this message appears to be echoed on the NEXT page load...
217
-                // oh well, we should really be checking for this on addon deactivation anyways
218
-                EE_Error::add_attention(
219
-                    esc_html__(
220
-                        'Site taken out of maintenance mode because no data migration scripts are required',
221
-                        'event_espresso'
222
-                    )
223
-                );
224
-                $this->_process_notices(['page' => 'espresso_maintenance_settings']);
225
-            }
226
-            // in case an exception is thrown while trying to handle migrations
227
-            if ($mMode_level === EE_Maintenance_Mode::level_2_complete_maintenance) {
228
-                $show_maintenance_switch = false;
229
-                $show_migration_progress = true;
230
-                if (isset($this->_req_data['continue_migration'])) {
231
-                    $show_backup_db_text = false;
232
-                } else {
233
-                    $show_backup_db_text = true;
234
-                }
235
-                $scripts_needing_to_run          =
236
-                    $this->migration_manager->check_for_applicable_data_migration_scripts();
237
-                $addons_should_be_upgraded_first = $this->migration_manager->addons_need_updating();
238
-                $script_names                    = [];
239
-                $current_script                  = null;
240
-                foreach ($scripts_needing_to_run as $script) {
241
-                    if ($script instanceof EE_Data_Migration_Script_Base) {
242
-                        if (! $current_script) {
243
-                            $current_script = $script;
244
-                            $current_script->migration_page_hooks();
245
-                        }
246
-                        $script_names[] = $script->pretty_name();
247
-                    }
248
-                }
249
-            }
250
-            $most_recent_migration = $this->migration_manager->get_last_ran_script(true);
251
-            $exception_thrown      = false;
252
-        } catch (EE_Error $e) {
253
-            $this->migration_manager->add_error_to_migrations_ran($e->getMessage());
254
-            // now, just so we can display the page correctly, make an error migration script stage object
255
-            // and also put the error on it. It only persists for the duration of this request
256
-            $most_recent_migration = new EE_DMS_Unknown_1_0_0();
257
-            $most_recent_migration->add_error($e->getMessage());
258
-            $exception_thrown = true;
259
-        }
260
-        $current_db_state = $this->migration_manager->ensure_current_database_state_is_set();
261
-        $current_db_state = str_replace('.decaf', '', $current_db_state);
262
-        if (
263
-            $exception_thrown
264
-            || (
265
-                $most_recent_migration instanceof EE_Data_Migration_Script_Base
266
-                && $most_recent_migration->is_broken()
267
-            )
268
-        ) {
269
-            $this->_template_path                =
270
-                EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
271
-            $this->_template_args['support_url'] = 'https://eventespresso.com/support/forums/';
272
-            $this->_template_args['next_url']    = EEH_URL::add_query_args_and_nonce(
273
-                [
274
-                    'action'  => 'confirm_migration_crash_report_sent',
275
-                    'success' => '0',
276
-                ],
277
-                EE_MAINTENANCE_ADMIN_URL
278
-            );
279
-        } elseif ($addons_should_be_upgraded_first) {
280
-            $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php';
281
-        } else {
282
-            if (
283
-                $most_recent_migration instanceof EE_Data_Migration_Script_Base
284
-                && $most_recent_migration->can_continue()
285
-            ) {
286
-                $show_backup_db_text                    = false;
287
-                $show_continue_current_migration_script = true;
288
-                $show_most_recent_migration             = true;
289
-            } elseif (isset($this->_req_data['continue_migration'])) {
290
-                $show_most_recent_migration             = true;
291
-                $show_continue_current_migration_script = false;
292
-            } else {
293
-                $show_most_recent_migration             = false;
294
-                $show_continue_current_migration_script = false;
295
-            }
296
-            if (isset($current_script)) {
297
-                $migrates_to          = $current_script->migrates_to_version();
298
-                $plugin_slug          = $migrates_to['slug'];
299
-                $new_version          = $migrates_to['version'];
300
-                $this->_template_args = array_merge(
301
-                    $this->_template_args,
302
-                    [
303
-                        'current_db_state' => sprintf(
304
-                            esc_html__("EE%s (%s)", "event_espresso"),
305
-                            isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3,
306
-                            $plugin_slug
307
-                        ),
308
-                        'next_db_state'    => sprintf(
309
-                            esc_html__("EE%s (%s)", 'event_espresso'),
310
-                            $new_version,
311
-                            $plugin_slug
312
-                        ),
313
-                    ]
314
-                );
315
-            } else {
316
-                $this->_template_args['current_db_state'] = null;
317
-                $this->_template_args['next_db_state']    = null;
318
-            }
319
-            $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
320
-            $this->_template_args = array_merge(
321
-                $this->_template_args,
322
-                [
323
-                    'show_most_recent_migration'             => $show_most_recent_migration,
324
-                    // flag for showing the most recent migration's status and/or errors
325
-                    'show_migration_progress'                => $show_migration_progress,
326
-                    // flag for showing the option to run migrations and see their progress
327
-                    'show_backup_db_text'                    => $show_backup_db_text,
328
-                    // flag for showing text telling the user to back up their DB
329
-                    'show_maintenance_switch'                => $show_maintenance_switch,
330
-                    // flag for showing the option to change maintenance mode between levels 0 and 1
331
-                    'script_names'                           => $script_names,
332
-                    // array of names of scripts that have run
333
-                    'show_continue_current_migration_script' => $show_continue_current_migration_script,
334
-                    // flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
335
-                    'reset_db_page_link'                     => EE_Admin_Page::add_query_args_and_nonce(
336
-                        ['action' => 'reset_db'],
337
-                        EE_MAINTENANCE_ADMIN_URL
338
-                    ),
339
-                    'data_reset_page'                        => EE_Admin_Page::add_query_args_and_nonce(
340
-                        ['action' => 'data_reset'],
341
-                        EE_MAINTENANCE_ADMIN_URL
342
-                    ),
343
-                    'update_migration_script_page_link'      => EE_Admin_Page::add_query_args_and_nonce(
344
-                        ['action' => 'change_maintenance_level'],
345
-                        EE_MAINTENANCE_ADMIN_URL
346
-                    ),
347
-                    'ultimate_db_state'                      => sprintf(
348
-                        esc_html__("EE%s", 'event_espresso'),
349
-                        espresso_version()
350
-                    ),
351
-                ]
352
-            );
353
-        }
354
-        $this->_template_args['most_recent_migration'] =
355
-            $most_recent_migration;// the actual most recently ran migration
356
-        // now render the migration options part, and put it in a variable
357
-        $migration_options_template_file                = apply_filters(
358
-            'FHEE__ee_migration_page__migration_options_template',
359
-            EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee4.template.php'
360
-        );
361
-        $migration_options_html                         = EEH_Template::display_template(
362
-            $migration_options_template_file,
363
-            $this->_template_args,
364
-            true
365
-        );
366
-        $this->_template_args['migration_options_html'] = $migration_options_html;
367
-        $this->_template_args['admin_page_content']     = EEH_Template::display_template(
368
-            $this->_template_path,
369
-            $this->_template_args,
370
-            true
371
-        );
372
-        $this->display_admin_page_with_sidebar();
373
-    }
374
-
375
-
376
-    /**
377
-     * returns JSON and executes another step of the currently-executing data migration (called via ajax)
378
-     *
379
-     * @throws EE_Error
380
-     */
381
-    public function migration_step()
382
-    {
383
-        $this->_template_args['data'] = $this->migration_manager->response_to_migration_ajax_request();
384
-        $this->_return_json();
385
-    }
386
-
387
-
388
-    /**
389
-     * Can be used by js when it notices a response with HTML in it in order
390
-     * to log the malformed response
391
-     *
392
-     * @throws EE_Error
393
-     */
394
-    public function add_error_to_migrations_ran()
395
-    {
396
-        $this->migration_manager->add_error_to_migrations_ran($this->_req_data['message']);
397
-        $this->_template_args['data'] = ['ok' => true];
398
-        $this->_return_json();
399
-    }
400
-
401
-
402
-    /**
403
-     * changes the maintenance level, provided there are still no migration scripts that should run
404
-     *
405
-     * @throws EE_Error
406
-     */
407
-    public function _change_maintenance_level()
408
-    {
409
-        $new_level = absint($this->_req_data['maintenance_mode_level']);
410
-        if (! $this->migration_manager->check_for_applicable_data_migration_scripts()) {
411
-            $this->maintenance_mode->set_maintenance_level($new_level);
412
-            $success = true;
413
-        } else {
414
-            $this->maintenance_mode->set_maintenance_mode_if_db_old();
415
-            $success = false;
416
-        }
417
-        $this->_redirect_after_action($success, 'Maintenance Mode', esc_html__("Updated", "event_espresso"));
418
-    }
419
-
420
-
421
-    /**
422
-     * a tab with options for resetting and/or deleting EE data
423
-     *
424
-     * @throws EE_Error
425
-     * @throws DomainException
426
-     */
427
-    public function _data_reset_and_delete()
428
-    {
429
-        $this->_template_path                              =
430
-            EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php';
431
-        $this->_template_args['reset_reservations_button'] = $this->get_action_link_or_button(
432
-            'reset_reservations',
433
-            'reset_reservations',
434
-            [],
435
-            'button button-primary ee-confirm'
436
-        );
437
-        $this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button(
438
-            'reset_capabilities',
439
-            'reset_capabilities',
440
-            [],
441
-            'button button-primary ee-confirm'
442
-        );
443
-        $this->_template_args['delete_db_url']             = EE_Admin_Page::add_query_args_and_nonce(
444
-            ['action' => 'delete_db'],
445
-            EE_MAINTENANCE_ADMIN_URL
446
-        );
447
-        $this->_template_args['reset_db_url']              = EE_Admin_Page::add_query_args_and_nonce(
448
-            ['action' => 'reset_db'],
449
-            EE_MAINTENANCE_ADMIN_URL
450
-        );
451
-        $this->_template_args['admin_page_content']        = EEH_Template::display_template(
452
-            $this->_template_path,
453
-            $this->_template_args,
454
-            true
455
-        );
456
-        $this->display_admin_page_with_sidebar();
457
-    }
458
-
459
-
460
-    /**
461
-     * @throws EE_Error
462
-     * @throws ReflectionException
463
-     */
464
-    protected function _reset_reservations()
465
-    {
466
-        if (EED_Ticket_Sales_Monitor::reset_reservation_counts()) {
467
-            EE_Error::add_success(
468
-                esc_html__(
469
-                    'Ticket and datetime reserved counts have been successfully reset.',
470
-                    'event_espresso'
471
-                )
472
-            );
473
-        } else {
474
-            EE_Error::add_success(
475
-                esc_html__(
476
-                    'Ticket and datetime reserved counts were correct and did not need resetting.',
477
-                    'event_espresso'
478
-                )
479
-            );
480
-        }
481
-        $this->_redirect_after_action(true, '', '', ['action' => 'data_reset'], true);
482
-    }
483
-
484
-
485
-    /**
486
-     * @throws EE_Error
487
-     */
488
-    protected function _reset_capabilities()
489
-    {
490
-        EE_Registry::instance()->CAP->init_caps(true);
491
-        EE_Error::add_success(
492
-            esc_html__(
493
-                'Default Event Espresso capabilities have been restored for all current roles.',
494
-                'event_espresso'
495
-            )
496
-        );
497
-        $this->_redirect_after_action(false, '', '', ['action' => 'data_reset'], true);
498
-    }
499
-
500
-
501
-    /**
502
-     * resets the DMSs, so we can attempt to continue migrating after a fatal error
503
-     * (only a good idea when someone has somehow tried ot fix whatever caused
504
-     * the fatal error in teh first place)
505
-     *
506
-     * @throws EE_Error
507
-     */
508
-    protected function _reattempt_migration()
509
-    {
510
-        $this->migration_manager->reattempt();
511
-        $this->_redirect_after_action(false, '', '', ['action' => 'default'], true);
512
-    }
513
-
514
-
515
-    /**
516
-     * shows the big ol' System Information page
517
-     *
518
-     * @throws EE_Error
519
-     */
520
-    public function _system_status()
521
-    {
522
-        $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php';
523
-        $this->_template_args['system_stati']               = EEM_System_Status::instance()->get_system_stati();
524
-        $this->_template_args['download_system_status_url'] = EE_Admin_Page::add_query_args_and_nonce(
525
-            [
526
-                'action' => 'download_system_status',
527
-            ],
528
-            EE_MAINTENANCE_ADMIN_URL
529
-        );
530
-        $this->_template_args['admin_page_content']         = EEH_Template::display_template(
531
-            $this->_template_path,
532
-            $this->_template_args,
533
-            true
534
-        );
535
-        $this->display_admin_page_with_sidebar();
536
-    }
537
-
538
-
539
-    /**
540
-     * Downloads an HTML file of the system status that can be easily stored or emailed
541
-     */
542
-    public function _download_system_status()
543
-    {
544
-        $status_info = EEM_System_Status::instance()->get_system_stati();
545
-        header('Content-Disposition: attachment');
546
-        header("Content-Disposition: attachment; filename=system_status_" . sanitize_key(site_url()) . ".html");
547
-        $output = '<style>table{border:1px solid darkgrey;}td{vertical-align:top}</style>';
548
-        $output .= '<h1>' . sprintf(
549
-            __('System Information for %1$s', 'event_espresso'),
550
-            esc_url_raw(site_url())
551
-        ) . '</h1>';
552
-        $output .= EEH_Template::layout_array_as_table($status_info);
553
-        echo esc_html($output);
554
-        die;
555
-    }
556
-
557
-
558
-    /**
559
-     * @throws EE_Error
560
-     */
561
-    public function _send_migration_crash_report()
562
-    {
563
-        $from      = $this->_req_data['from'];
564
-        $from_name = $this->_req_data['from_name'];
565
-        $body      = $this->_req_data['body'];
566
-        try {
567
-            $success = wp_mail(
568
-                EE_SUPPORT_EMAIL,
569
-                'Migration Crash Report',
570
-                $body . "/r/n<br>" . print_r(EEM_System_Status::instance()->get_system_stati(), true),
571
-                [
572
-                    "from:$from_name<$from>",
573
-                ]
574
-            );
575
-        } catch (Exception $e) {
576
-            $success = false;
577
-        }
578
-        $this->_redirect_after_action(
579
-            $success,
580
-            esc_html__("Migration Crash Report", "event_espresso"),
581
-            esc_html__("sent", "event_espresso"),
582
-            ['success' => $success, 'action' => 'confirm_migration_crash_report_sent']
583
-        );
584
-    }
585
-
586
-
587
-    /**
588
-     * @throws EE_Error
589
-     */
590
-    public function _confirm_migration_crash_report_sent()
591
-    {
592
-        try {
593
-            $most_recent_migration = $this->migration_manager->get_last_ran_script(true);
594
-        } catch (EE_Error $e) {
595
-            $this->migration_manager->add_error_to_migrations_ran($e->getMessage());
596
-            // now, just so we can display the page correctly, make an error migration script stage object
597
-            // and also put the error on it. It only persists for the duration of this request
598
-            $most_recent_migration = new EE_DMS_Unknown_1_0_0();
599
-            $most_recent_migration->add_error($e->getMessage());
600
-        }
601
-        $success                                       = $this->_req_data['success'] === '1';
602
-        $this->_template_args['success']               = $success;
603
-        $this->_template_args['most_recent_migration'] = $most_recent_migration;
604
-        $this->_template_args['reset_db_action_url']   = EE_Admin_Page::add_query_args_and_nonce(
605
-            ['action' => 'reset_db'],
606
-            EE_MAINTENANCE_ADMIN_URL
607
-        );
608
-        $this->_template_args['reset_db_page_url']     = EE_Admin_Page::add_query_args_and_nonce(
609
-            ['action' => 'data_reset'],
610
-            EE_MAINTENANCE_ADMIN_URL
611
-        );
612
-        $this->_template_args['reattempt_action_url']  = EE_Admin_Page::add_query_args_and_nonce(
613
-            ['action' => 'reattempt_migration'],
614
-            EE_MAINTENANCE_ADMIN_URL
615
-        );
616
-        $this->_template_path                          =
617
-            EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php';
618
-        $this->_template_args['admin_page_content']    = EEH_Template::display_template(
619
-            $this->_template_path,
620
-            $this->_template_args,
621
-            true
622
-        );
623
-        $this->display_admin_page_with_sidebar();
624
-    }
625
-
626
-
627
-    /**
628
-     * Resets the entire EE4 database.
629
-     * only sets up ee4 database for a fresh install-
630
-     * doesn't actually clean out the old wp options, or cpts
631
-     * (although it does erase old ee table data)
632
-     *
633
-     * @param boolean $nuke_old_ee4_data controls whether we destroy the old ee4 data,
634
-     *                                   or just try initializing ee4 default data
635
-     * @throws EE_Error
636
-     * @throws ReflectionException
637
-     */
638
-    public function _reset_db($nuke_old_ee4_data = true)
639
-    {
640
-        $this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
641
-        if ($nuke_old_ee4_data) {
642
-            EEH_Activation::delete_all_espresso_cpt_data();
643
-            EEH_Activation::delete_all_espresso_tables_and_data(false);
644
-            EEH_Activation::remove_cron_tasks();
645
-        }
646
-        // make sure when we reset the registry's config that it
647
-        // switches to using the new singleton
648
-        EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(true);
649
-        EE_System::instance()->initialize_db_if_no_migrations_required(true);
650
-        EE_System::instance()->redirect_to_about_ee();
651
-    }
652
-
653
-
654
-    /**
655
-     * Deletes ALL EE tables, Records, and Options from the database.
656
-     *
657
-     * @throws EE_Error
658
-     * @throws ReflectionException
659
-     */
660
-    public function _delete_db()
661
-    {
662
-        $this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
663
-        EEH_Activation::delete_all_espresso_cpt_data();
664
-        EEH_Activation::delete_all_espresso_tables_and_data();
665
-        EEH_Activation::remove_cron_tasks();
666
-        EEH_Activation::deactivate_event_espresso();
667
-        wp_safe_redirect(admin_url('plugins.php'));
668
-        exit;
669
-    }
670
-
671
-
672
-    /**
673
-     * sets up EE4 to rerun the migrations from ee3 to ee4
674
-     *
675
-     * @throws EE_Error
676
-     * @throws ReflectionException
677
-     */
678
-    public function _rerun_migration_from_ee3()
679
-    {
680
-        $this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
681
-        EEH_Activation::delete_all_espresso_cpt_data();
682
-        EEH_Activation::delete_all_espresso_tables_and_data(false);
683
-        // set the db state to something that will require migrations
684
-        update_option(EE_Data_Migration_Manager::current_database_state, '3.1.36.0');
685
-        $this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_2_complete_maintenance);
686
-        $this->_redirect_after_action(
687
-            true,
688
-            esc_html__("Database", 'event_espresso'),
689
-            esc_html__("reset", 'event_espresso')
690
-        );
691
-    }
692
-
693
-
694
-    // none of the below group are currently used for Gateway Settings
695
-    protected function _add_screen_options()
696
-    {
697
-    }
698
-
699
-
700
-    protected function _add_feature_pointers()
701
-    {
702
-    }
703
-
704
-
705
-    public function admin_init()
706
-    {
707
-    }
708
-
709
-
710
-    public function admin_notices()
711
-    {
712
-    }
713
-
714
-
715
-    public function admin_footer_scripts()
716
-    {
717
-    }
718
-
719
-
720
-    public function load_scripts_styles()
721
-    {
722
-        wp_enqueue_script('ee_admin_js');
723
-        wp_enqueue_script(
724
-            'ee-maintenance',
725
-            EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.js',
726
-            ['jquery'],
727
-            EVENT_ESPRESSO_VERSION,
728
-            true
729
-        );
730
-        wp_register_style(
731
-            'espresso_maintenance',
732
-            EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css',
733
-            [],
734
-            EVENT_ESPRESSO_VERSION
735
-        );
736
-        wp_enqueue_style('espresso_maintenance');
737
-        // localize script stuff
738
-        wp_localize_script(
739
-            'ee-maintenance',
740
-            'ee_maintenance',
741
-            [
742
-                'migrating'                        => wp_strip_all_tags(__("Updating Database...", "event_espresso")),
743
-                'next'                             => wp_strip_all_tags(__("Next", "event_espresso")),
744
-                'fatal_error'                      => wp_strip_all_tags(__(
745
-                    "A Fatal Error Has Occurred",
746
-                    "event_espresso"
747
-                )),
748
-                'click_next_when_ready'            => wp_strip_all_tags(
749
-                    __(
750
-                        "The current Database Update has ended. Click 'next' when ready to proceed",
751
-                        "event_espresso"
752
-                    )
753
-                ),
754
-                'status_no_more_migration_scripts' => EE_Data_Migration_Manager::status_no_more_migration_scripts,
755
-                'status_fatal_error'               => EE_Data_Migration_Manager::status_fatal_error,
756
-                'status_completed'                 => EE_Data_Migration_Manager::status_completed,
757
-                'confirm'                          => wp_strip_all_tags(
758
-                    __(
759
-                        'Are you sure you want to do this? It CANNOT be undone!',
760
-                        'event_espresso'
761
-                    )
762
-                ),
763
-                'confirm_skip_migration'           => wp_strip_all_tags(
764
-                    __(
765
-                        'You have chosen to NOT migrate your existing data. Are you sure you want to continue?',
766
-                        'event_espresso'
767
-                    )
768
-                ),
769
-            ]
770
-        );
771
-    }
772
-
773
-
774
-    public function load_scripts_styles_default()
775
-    {
776
-    }
777
-
778
-
779
-    /**
780
-     * Enqueue scripts and styles for the datetime tools page.
781
-     */
782
-    public function load_scripts_styles_datetime_tools()
783
-    {
784
-        EE_Datepicker_Input::enqueue_styles_and_scripts();
785
-    }
786
-
787
-
788
-    /**
789
-     * @throws EE_Error
790
-     */
791
-    protected function _datetime_tools()
792
-    {
793
-        $form_action                                = EE_Admin_Page::add_query_args_and_nonce(
794
-            [
795
-                'action'        => 'run_datetime_offset_fix',
796
-                'return_action' => $this->_req_action,
797
-            ],
798
-            EE_MAINTENANCE_ADMIN_URL
799
-        );
800
-        $form                                       = $this->_get_datetime_offset_fix_form();
801
-        $this->_admin_page_title                    = esc_html__('Datetime Utilities', 'event_espresso');
802
-        $this->_template_args['admin_page_content'] = $form->form_open($form_action, 'post')
803
-                                                      . $form->get_html_and_js()
804
-                                                      . $form->form_close();
805
-        $this->display_admin_page_with_no_sidebar();
806
-    }
807
-
808
-
809
-    /**
810
-     * @throws EE_Error
811
-     */
812
-    protected function _get_datetime_offset_fix_form()
813
-    {
814
-        if (! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) {
815
-            $this->datetime_fix_offset_form = new EE_Form_Section_Proper(
816
-                [
817
-                    'name'            => 'datetime_offset_fix_option',
818
-                    'layout_strategy' => new EE_Admin_Two_Column_Layout(),
819
-                    'subsections'     => [
820
-                        'title'                  => new EE_Form_Section_HTML(
821
-                            EEH_HTML::h2(
822
-                                esc_html__('Datetime Offset Tool', 'event_espresso')
823
-                            )
824
-                        ),
825
-                        'explanation'            => new EE_Form_Section_HTML(
826
-                            EEH_HTML::p(
827
-                                esc_html__(
828
-                                    'Use this tool to automatically apply the provided offset to all Event Espresso records in your database that involve dates and times.',
829
-                                    'event_espresso'
830
-                                )
831
-                            )
832
-                            . EEH_HTML::p(
833
-                                esc_html__(
834
-                                    '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.',
835
-                                    'event_espresso'
836
-                                )
837
-                            )
838
-                        ),
839
-                        'offset_input'           => new EE_Float_Input(
840
-                            [
841
-                                'html_name'       => 'offset_for_datetimes',
842
-                                'html_label_text' => esc_html__(
843
-                                    'Offset to apply (in hours):',
844
-                                    'event_espresso'
845
-                                ),
846
-                                'min_value'       => '-12',
847
-                                'max_value'       => '14',
848
-                                'step_value'      => '.25',
849
-                                'default'         => DatetimeOffsetFix::getOffset(),
850
-                            ]
851
-                        ),
852
-                        'date_range_explanation' => new EE_Form_Section_HTML(
853
-                            EEH_HTML::p(
854
-                                esc_html__(
855
-                                    '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.',
856
-                                    'event_espresso'
857
-                                )
858
-                            )
859
-                            . EEH_HTML::p(
860
-                                EEH_HTML::strong(
861
-                                    sprintf(
862
-                                        esc_html__(
863
-                                            'Note: please enter the dates in UTC (You can use %1$sthis online tool%2$s to assist with conversions).',
864
-                                            'event_espresso'
865
-                                        ),
866
-                                        '<a href="https://www.timeanddate.com/worldclock/converter.html">',
867
-                                        '</a>'
868
-                                    )
869
-                                )
870
-                            )
871
-                        ),
872
-                        'date_range_start_date'  => new EE_Datepicker_Input(
873
-                            [
874
-                                'html_name'       => 'offset_date_start_range',
875
-                                'html_label_text' => esc_html__(
876
-                                    'Start Date for dates the offset applied to:',
877
-                                    'event_espresso'
878
-                                ),
879
-                            ]
880
-                        ),
881
-                        'date_range_end_date'    => new EE_Datepicker_Input(
882
-                            [
883
-                                'html_name'       => 'offset_date_end_range',
884
-                                'html_label_text' => esc_html__(
885
-                                    'End Date for dates the offset is applied to:',
886
-                                    'event_espresso'
887
-                                ),
888
-                            ]
889
-                        ),
890
-                        'submit'                 => new EE_Submit_Input(
891
-                            [
892
-                                'html_label_text' => '',
893
-                                'default'         => esc_html__('Apply Offset', 'event_espresso'),
894
-                            ]
895
-                        ),
896
-                    ],
897
-                ]
898
-            );
899
-        }
900
-        return $this->datetime_fix_offset_form;
901
-    }
902
-
903
-
904
-    /**
905
-     * Callback for the run_datetime_offset_fix route.
906
-     *
907
-     * @throws EE_Error
908
-     */
909
-    protected function _apply_datetime_offset()
910
-    {
911
-        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
912
-            $form = $this->_get_datetime_offset_fix_form();
913
-            $form->receive_form_submission($this->_req_data);
914
-            if ($form->is_valid()) {
915
-                // save offset data so batch processor can get it.
916
-                DatetimeOffsetFix::updateOffset($form->get_input_value('offset_input'));
917
-                $utc_timezone          = new DateTimeZone('UTC');
918
-                $date_range_start_date = DateTime::createFromFormat(
919
-                    'm/d/Y H:i:s',
920
-                    $form->get_input_value('date_range_start_date') . ' 00:00:00',
921
-                    $utc_timezone
922
-                );
923
-                $date_range_end_date   = DateTime::createFromFormat(
924
-                    'm/d/Y H:i:s',
925
-                    $form->get_input_value('date_range_end_date') . ' 23:59:59',
926
-                    $utc_timezone
927
-                );
928
-                if ($date_range_start_date instanceof DateTime) {
929
-                    DatetimeOffsetFix::updateStartDateRange(DbSafeDateTime::createFromDateTime($date_range_start_date));
930
-                }
931
-                if ($date_range_end_date instanceof DateTime) {
932
-                    DatetimeOffsetFix::updateEndDateRange(DbSafeDateTime::createFromDateTime($date_range_end_date));
933
-                }
934
-                // redirect to batch tool
935
-                wp_redirect(
936
-                    EE_Admin_Page::add_query_args_and_nonce(
937
-                        [
938
-                            'page'        => 'espresso_batch',
939
-                            'batch'       => 'job',
940
-                            'label'       => esc_html__('Applying Offset', 'event_espresso'),
941
-                            'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\DatetimeOffsetFix'),
942
-                            'return_url'  => urlencode(
943
-                                add_query_arg(
944
-                                    [
945
-                                        'action' => 'datetime_tools',
946
-                                    ],
947
-                                    EEH_URL::current_url_without_query_paramaters(
948
-                                        [
949
-                                            'return_action',
950
-                                            'run_datetime_offset_fix_nonce',
951
-                                            'return',
952
-                                            'datetime_tools_nonce',
953
-                                        ]
954
-                                    )
955
-                                )
956
-                            ),
957
-                        ],
958
-                        admin_url()
959
-                    )
960
-                );
961
-                exit;
962
-            }
963
-        }
964
-    }
17
+	/**
18
+	 * @var EE_Data_Migration_Manager
19
+	 */
20
+	protected $migration_manager;
21
+
22
+	/**
23
+	 * @var EE_Maintenance_Mode
24
+	 */
25
+	protected $maintenance_mode;
26
+
27
+	/**
28
+	 * @var EE_Form_Section_Proper
29
+	 */
30
+	protected $datetime_fix_offset_form;
31
+
32
+
33
+	/**
34
+	 * @param bool $routing
35
+	 * @throws EE_Error
36
+	 * @throws ReflectionException
37
+	 */
38
+	public function __construct($routing = true)
39
+	{
40
+		$this->migration_manager = EE_Data_Migration_Manager::instance();
41
+		$this->maintenance_mode  = EE_Maintenance_Mode::instance();
42
+		parent::__construct($routing);
43
+	}
44
+
45
+
46
+	protected function _init_page_props()
47
+	{
48
+		$this->page_slug        = EE_MAINTENANCE_PG_SLUG;
49
+		$this->page_label       = EE_MAINTENANCE_LABEL;
50
+		$this->_admin_base_url  = EE_MAINTENANCE_ADMIN_URL;
51
+		$this->_admin_base_path = EE_MAINTENANCE_ADMIN;
52
+	}
53
+
54
+
55
+	protected function _ajax_hooks()
56
+	{
57
+		add_action('wp_ajax_migration_step', [$this, 'migration_step']);
58
+		add_action('wp_ajax_add_error_to_migrations_ran', [$this, 'add_error_to_migrations_ran']);
59
+	}
60
+
61
+
62
+	protected function _define_page_props()
63
+	{
64
+		$this->_admin_page_title = EE_MAINTENANCE_LABEL;
65
+		$this->_labels           = [
66
+			'buttons' => [
67
+				'reset_reservations' => esc_html__('Reset Ticket and Datetime Reserved Counts', 'event_espresso'),
68
+				'reset_capabilities' => esc_html__('Reset Event Espresso Capabilities', 'event_espresso'),
69
+			],
70
+		];
71
+	}
72
+
73
+
74
+	protected function _set_page_routes()
75
+	{
76
+		$this->_page_routes = [
77
+			'default'                             => [
78
+				'func'       => '_maintenance',
79
+				'capability' => 'manage_options',
80
+			],
81
+			'change_maintenance_level'            => [
82
+				'func'       => '_change_maintenance_level',
83
+				'capability' => 'manage_options',
84
+				'noheader'   => true,
85
+			],
86
+			'system_status'                       => [
87
+				'func'       => '_system_status',
88
+				'capability' => 'manage_options',
89
+			],
90
+			'download_system_status'              => [
91
+				'func'       => '_download_system_status',
92
+				'capability' => 'manage_options',
93
+				'noheader'   => true,
94
+			],
95
+			'send_migration_crash_report'         => [
96
+				'func'       => '_send_migration_crash_report',
97
+				'capability' => 'manage_options',
98
+				'noheader'   => true,
99
+			],
100
+			'confirm_migration_crash_report_sent' => [
101
+				'func'       => '_confirm_migration_crash_report_sent',
102
+				'capability' => 'manage_options',
103
+			],
104
+			'data_reset'                          => [
105
+				'func'       => '_data_reset_and_delete',
106
+				'capability' => 'manage_options',
107
+			],
108
+			'reset_db'                            => [
109
+				'func'       => '_reset_db',
110
+				'capability' => 'manage_options',
111
+				'noheader'   => true,
112
+				'args'       => ['nuke_old_ee4_data' => true],
113
+			],
114
+			'start_with_fresh_ee4_db'             => [
115
+				'func'       => '_reset_db',
116
+				'capability' => 'manage_options',
117
+				'noheader'   => true,
118
+				'args'       => ['nuke_old_ee4_data' => false],
119
+			],
120
+			'delete_db'                           => [
121
+				'func'       => '_delete_db',
122
+				'capability' => 'manage_options',
123
+				'noheader'   => true,
124
+			],
125
+			'rerun_migration_from_ee3'            => [
126
+				'func'       => '_rerun_migration_from_ee3',
127
+				'capability' => 'manage_options',
128
+				'noheader'   => true,
129
+			],
130
+			'reset_reservations'                  => [
131
+				'func'       => '_reset_reservations',
132
+				'capability' => 'manage_options',
133
+				'noheader'   => true,
134
+			],
135
+			'reset_capabilities'                  => [
136
+				'func'       => '_reset_capabilities',
137
+				'capability' => 'manage_options',
138
+				'noheader'   => true,
139
+			],
140
+			'reattempt_migration'                 => [
141
+				'func'       => '_reattempt_migration',
142
+				'capability' => 'manage_options',
143
+				'noheader'   => true,
144
+			],
145
+			'datetime_tools'                      => [
146
+				'func'       => '_datetime_tools',
147
+				'capability' => 'manage_options',
148
+			],
149
+			'run_datetime_offset_fix'             => [
150
+				'func'               => '_apply_datetime_offset',
151
+				'noheader'           => true,
152
+				'headers_sent_route' => 'datetime_tools',
153
+				'capability'         => 'manage_options',
154
+			],
155
+		];
156
+	}
157
+
158
+
159
+	protected function _set_page_config()
160
+	{
161
+		$this->_page_config = [
162
+			'default'        => [
163
+				'nav'           => [
164
+					'label' => esc_html__('Maintenance', 'event_espresso'),
165
+					'order' => 10,
166
+				],
167
+				'require_nonce' => false,
168
+			],
169
+			'data_reset'     => [
170
+				'nav'           => [
171
+					'label' => esc_html__('Reset/Delete Data', 'event_espresso'),
172
+					'order' => 20,
173
+				],
174
+				'require_nonce' => false,
175
+			],
176
+			'datetime_tools' => [
177
+				'nav'           => [
178
+					'label' => esc_html__('Datetime Utilities', 'event_espresso'),
179
+					'order' => 25,
180
+				],
181
+				'require_nonce' => false,
182
+			],
183
+			'system_status'  => [
184
+				'nav'           => [
185
+					'label' => esc_html__("System Information", "event_espresso"),
186
+					'order' => 30,
187
+				],
188
+				'require_nonce' => false,
189
+			],
190
+		];
191
+	}
192
+
193
+
194
+	/**
195
+	 * default maintenance page.
196
+	 * If we're in maintenance mode level 2, then we need to show the migration scripts and all that UI.
197
+	 *
198
+	 * @throws EE_Error
199
+	 */
200
+	public function _maintenance()
201
+	{
202
+		$show_maintenance_switch         = true;
203
+		$show_backup_db_text             = false;
204
+		$show_migration_progress         = false;
205
+		$script_names                    = [];
206
+		$addons_should_be_upgraded_first = false;
207
+		// it all depends on if we're in maintenance model level 1 (frontend-only) or
208
+		// level 2 (everything except maintenance page)
209
+		try {
210
+			// get the current maintenance level and check if
211
+			// we are removed
212
+			$mMode_level  = $this->maintenance_mode->level();
213
+			$placed_in_mm = $this->maintenance_mode->set_maintenance_mode_if_db_old();
214
+			if ($mMode_level == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) {
215
+				// we just took the site out of maintenance mode, so notify the user.
216
+				// unfortunately this message appears to be echoed on the NEXT page load...
217
+				// oh well, we should really be checking for this on addon deactivation anyways
218
+				EE_Error::add_attention(
219
+					esc_html__(
220
+						'Site taken out of maintenance mode because no data migration scripts are required',
221
+						'event_espresso'
222
+					)
223
+				);
224
+				$this->_process_notices(['page' => 'espresso_maintenance_settings']);
225
+			}
226
+			// in case an exception is thrown while trying to handle migrations
227
+			if ($mMode_level === EE_Maintenance_Mode::level_2_complete_maintenance) {
228
+				$show_maintenance_switch = false;
229
+				$show_migration_progress = true;
230
+				if (isset($this->_req_data['continue_migration'])) {
231
+					$show_backup_db_text = false;
232
+				} else {
233
+					$show_backup_db_text = true;
234
+				}
235
+				$scripts_needing_to_run          =
236
+					$this->migration_manager->check_for_applicable_data_migration_scripts();
237
+				$addons_should_be_upgraded_first = $this->migration_manager->addons_need_updating();
238
+				$script_names                    = [];
239
+				$current_script                  = null;
240
+				foreach ($scripts_needing_to_run as $script) {
241
+					if ($script instanceof EE_Data_Migration_Script_Base) {
242
+						if (! $current_script) {
243
+							$current_script = $script;
244
+							$current_script->migration_page_hooks();
245
+						}
246
+						$script_names[] = $script->pretty_name();
247
+					}
248
+				}
249
+			}
250
+			$most_recent_migration = $this->migration_manager->get_last_ran_script(true);
251
+			$exception_thrown      = false;
252
+		} catch (EE_Error $e) {
253
+			$this->migration_manager->add_error_to_migrations_ran($e->getMessage());
254
+			// now, just so we can display the page correctly, make an error migration script stage object
255
+			// and also put the error on it. It only persists for the duration of this request
256
+			$most_recent_migration = new EE_DMS_Unknown_1_0_0();
257
+			$most_recent_migration->add_error($e->getMessage());
258
+			$exception_thrown = true;
259
+		}
260
+		$current_db_state = $this->migration_manager->ensure_current_database_state_is_set();
261
+		$current_db_state = str_replace('.decaf', '', $current_db_state);
262
+		if (
263
+			$exception_thrown
264
+			|| (
265
+				$most_recent_migration instanceof EE_Data_Migration_Script_Base
266
+				&& $most_recent_migration->is_broken()
267
+			)
268
+		) {
269
+			$this->_template_path                =
270
+				EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
271
+			$this->_template_args['support_url'] = 'https://eventespresso.com/support/forums/';
272
+			$this->_template_args['next_url']    = EEH_URL::add_query_args_and_nonce(
273
+				[
274
+					'action'  => 'confirm_migration_crash_report_sent',
275
+					'success' => '0',
276
+				],
277
+				EE_MAINTENANCE_ADMIN_URL
278
+			);
279
+		} elseif ($addons_should_be_upgraded_first) {
280
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php';
281
+		} else {
282
+			if (
283
+				$most_recent_migration instanceof EE_Data_Migration_Script_Base
284
+				&& $most_recent_migration->can_continue()
285
+			) {
286
+				$show_backup_db_text                    = false;
287
+				$show_continue_current_migration_script = true;
288
+				$show_most_recent_migration             = true;
289
+			} elseif (isset($this->_req_data['continue_migration'])) {
290
+				$show_most_recent_migration             = true;
291
+				$show_continue_current_migration_script = false;
292
+			} else {
293
+				$show_most_recent_migration             = false;
294
+				$show_continue_current_migration_script = false;
295
+			}
296
+			if (isset($current_script)) {
297
+				$migrates_to          = $current_script->migrates_to_version();
298
+				$plugin_slug          = $migrates_to['slug'];
299
+				$new_version          = $migrates_to['version'];
300
+				$this->_template_args = array_merge(
301
+					$this->_template_args,
302
+					[
303
+						'current_db_state' => sprintf(
304
+							esc_html__("EE%s (%s)", "event_espresso"),
305
+							isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3,
306
+							$plugin_slug
307
+						),
308
+						'next_db_state'    => sprintf(
309
+							esc_html__("EE%s (%s)", 'event_espresso'),
310
+							$new_version,
311
+							$plugin_slug
312
+						),
313
+					]
314
+				);
315
+			} else {
316
+				$this->_template_args['current_db_state'] = null;
317
+				$this->_template_args['next_db_state']    = null;
318
+			}
319
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
320
+			$this->_template_args = array_merge(
321
+				$this->_template_args,
322
+				[
323
+					'show_most_recent_migration'             => $show_most_recent_migration,
324
+					// flag for showing the most recent migration's status and/or errors
325
+					'show_migration_progress'                => $show_migration_progress,
326
+					// flag for showing the option to run migrations and see their progress
327
+					'show_backup_db_text'                    => $show_backup_db_text,
328
+					// flag for showing text telling the user to back up their DB
329
+					'show_maintenance_switch'                => $show_maintenance_switch,
330
+					// flag for showing the option to change maintenance mode between levels 0 and 1
331
+					'script_names'                           => $script_names,
332
+					// array of names of scripts that have run
333
+					'show_continue_current_migration_script' => $show_continue_current_migration_script,
334
+					// flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
335
+					'reset_db_page_link'                     => EE_Admin_Page::add_query_args_and_nonce(
336
+						['action' => 'reset_db'],
337
+						EE_MAINTENANCE_ADMIN_URL
338
+					),
339
+					'data_reset_page'                        => EE_Admin_Page::add_query_args_and_nonce(
340
+						['action' => 'data_reset'],
341
+						EE_MAINTENANCE_ADMIN_URL
342
+					),
343
+					'update_migration_script_page_link'      => EE_Admin_Page::add_query_args_and_nonce(
344
+						['action' => 'change_maintenance_level'],
345
+						EE_MAINTENANCE_ADMIN_URL
346
+					),
347
+					'ultimate_db_state'                      => sprintf(
348
+						esc_html__("EE%s", 'event_espresso'),
349
+						espresso_version()
350
+					),
351
+				]
352
+			);
353
+		}
354
+		$this->_template_args['most_recent_migration'] =
355
+			$most_recent_migration;// the actual most recently ran migration
356
+		// now render the migration options part, and put it in a variable
357
+		$migration_options_template_file                = apply_filters(
358
+			'FHEE__ee_migration_page__migration_options_template',
359
+			EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee4.template.php'
360
+		);
361
+		$migration_options_html                         = EEH_Template::display_template(
362
+			$migration_options_template_file,
363
+			$this->_template_args,
364
+			true
365
+		);
366
+		$this->_template_args['migration_options_html'] = $migration_options_html;
367
+		$this->_template_args['admin_page_content']     = EEH_Template::display_template(
368
+			$this->_template_path,
369
+			$this->_template_args,
370
+			true
371
+		);
372
+		$this->display_admin_page_with_sidebar();
373
+	}
374
+
375
+
376
+	/**
377
+	 * returns JSON and executes another step of the currently-executing data migration (called via ajax)
378
+	 *
379
+	 * @throws EE_Error
380
+	 */
381
+	public function migration_step()
382
+	{
383
+		$this->_template_args['data'] = $this->migration_manager->response_to_migration_ajax_request();
384
+		$this->_return_json();
385
+	}
386
+
387
+
388
+	/**
389
+	 * Can be used by js when it notices a response with HTML in it in order
390
+	 * to log the malformed response
391
+	 *
392
+	 * @throws EE_Error
393
+	 */
394
+	public function add_error_to_migrations_ran()
395
+	{
396
+		$this->migration_manager->add_error_to_migrations_ran($this->_req_data['message']);
397
+		$this->_template_args['data'] = ['ok' => true];
398
+		$this->_return_json();
399
+	}
400
+
401
+
402
+	/**
403
+	 * changes the maintenance level, provided there are still no migration scripts that should run
404
+	 *
405
+	 * @throws EE_Error
406
+	 */
407
+	public function _change_maintenance_level()
408
+	{
409
+		$new_level = absint($this->_req_data['maintenance_mode_level']);
410
+		if (! $this->migration_manager->check_for_applicable_data_migration_scripts()) {
411
+			$this->maintenance_mode->set_maintenance_level($new_level);
412
+			$success = true;
413
+		} else {
414
+			$this->maintenance_mode->set_maintenance_mode_if_db_old();
415
+			$success = false;
416
+		}
417
+		$this->_redirect_after_action($success, 'Maintenance Mode', esc_html__("Updated", "event_espresso"));
418
+	}
419
+
420
+
421
+	/**
422
+	 * a tab with options for resetting and/or deleting EE data
423
+	 *
424
+	 * @throws EE_Error
425
+	 * @throws DomainException
426
+	 */
427
+	public function _data_reset_and_delete()
428
+	{
429
+		$this->_template_path                              =
430
+			EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php';
431
+		$this->_template_args['reset_reservations_button'] = $this->get_action_link_or_button(
432
+			'reset_reservations',
433
+			'reset_reservations',
434
+			[],
435
+			'button button-primary ee-confirm'
436
+		);
437
+		$this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button(
438
+			'reset_capabilities',
439
+			'reset_capabilities',
440
+			[],
441
+			'button button-primary ee-confirm'
442
+		);
443
+		$this->_template_args['delete_db_url']             = EE_Admin_Page::add_query_args_and_nonce(
444
+			['action' => 'delete_db'],
445
+			EE_MAINTENANCE_ADMIN_URL
446
+		);
447
+		$this->_template_args['reset_db_url']              = EE_Admin_Page::add_query_args_and_nonce(
448
+			['action' => 'reset_db'],
449
+			EE_MAINTENANCE_ADMIN_URL
450
+		);
451
+		$this->_template_args['admin_page_content']        = EEH_Template::display_template(
452
+			$this->_template_path,
453
+			$this->_template_args,
454
+			true
455
+		);
456
+		$this->display_admin_page_with_sidebar();
457
+	}
458
+
459
+
460
+	/**
461
+	 * @throws EE_Error
462
+	 * @throws ReflectionException
463
+	 */
464
+	protected function _reset_reservations()
465
+	{
466
+		if (EED_Ticket_Sales_Monitor::reset_reservation_counts()) {
467
+			EE_Error::add_success(
468
+				esc_html__(
469
+					'Ticket and datetime reserved counts have been successfully reset.',
470
+					'event_espresso'
471
+				)
472
+			);
473
+		} else {
474
+			EE_Error::add_success(
475
+				esc_html__(
476
+					'Ticket and datetime reserved counts were correct and did not need resetting.',
477
+					'event_espresso'
478
+				)
479
+			);
480
+		}
481
+		$this->_redirect_after_action(true, '', '', ['action' => 'data_reset'], true);
482
+	}
483
+
484
+
485
+	/**
486
+	 * @throws EE_Error
487
+	 */
488
+	protected function _reset_capabilities()
489
+	{
490
+		EE_Registry::instance()->CAP->init_caps(true);
491
+		EE_Error::add_success(
492
+			esc_html__(
493
+				'Default Event Espresso capabilities have been restored for all current roles.',
494
+				'event_espresso'
495
+			)
496
+		);
497
+		$this->_redirect_after_action(false, '', '', ['action' => 'data_reset'], true);
498
+	}
499
+
500
+
501
+	/**
502
+	 * resets the DMSs, so we can attempt to continue migrating after a fatal error
503
+	 * (only a good idea when someone has somehow tried ot fix whatever caused
504
+	 * the fatal error in teh first place)
505
+	 *
506
+	 * @throws EE_Error
507
+	 */
508
+	protected function _reattempt_migration()
509
+	{
510
+		$this->migration_manager->reattempt();
511
+		$this->_redirect_after_action(false, '', '', ['action' => 'default'], true);
512
+	}
513
+
514
+
515
+	/**
516
+	 * shows the big ol' System Information page
517
+	 *
518
+	 * @throws EE_Error
519
+	 */
520
+	public function _system_status()
521
+	{
522
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php';
523
+		$this->_template_args['system_stati']               = EEM_System_Status::instance()->get_system_stati();
524
+		$this->_template_args['download_system_status_url'] = EE_Admin_Page::add_query_args_and_nonce(
525
+			[
526
+				'action' => 'download_system_status',
527
+			],
528
+			EE_MAINTENANCE_ADMIN_URL
529
+		);
530
+		$this->_template_args['admin_page_content']         = EEH_Template::display_template(
531
+			$this->_template_path,
532
+			$this->_template_args,
533
+			true
534
+		);
535
+		$this->display_admin_page_with_sidebar();
536
+	}
537
+
538
+
539
+	/**
540
+	 * Downloads an HTML file of the system status that can be easily stored or emailed
541
+	 */
542
+	public function _download_system_status()
543
+	{
544
+		$status_info = EEM_System_Status::instance()->get_system_stati();
545
+		header('Content-Disposition: attachment');
546
+		header("Content-Disposition: attachment; filename=system_status_" . sanitize_key(site_url()) . ".html");
547
+		$output = '<style>table{border:1px solid darkgrey;}td{vertical-align:top}</style>';
548
+		$output .= '<h1>' . sprintf(
549
+			__('System Information for %1$s', 'event_espresso'),
550
+			esc_url_raw(site_url())
551
+		) . '</h1>';
552
+		$output .= EEH_Template::layout_array_as_table($status_info);
553
+		echo esc_html($output);
554
+		die;
555
+	}
556
+
557
+
558
+	/**
559
+	 * @throws EE_Error
560
+	 */
561
+	public function _send_migration_crash_report()
562
+	{
563
+		$from      = $this->_req_data['from'];
564
+		$from_name = $this->_req_data['from_name'];
565
+		$body      = $this->_req_data['body'];
566
+		try {
567
+			$success = wp_mail(
568
+				EE_SUPPORT_EMAIL,
569
+				'Migration Crash Report',
570
+				$body . "/r/n<br>" . print_r(EEM_System_Status::instance()->get_system_stati(), true),
571
+				[
572
+					"from:$from_name<$from>",
573
+				]
574
+			);
575
+		} catch (Exception $e) {
576
+			$success = false;
577
+		}
578
+		$this->_redirect_after_action(
579
+			$success,
580
+			esc_html__("Migration Crash Report", "event_espresso"),
581
+			esc_html__("sent", "event_espresso"),
582
+			['success' => $success, 'action' => 'confirm_migration_crash_report_sent']
583
+		);
584
+	}
585
+
586
+
587
+	/**
588
+	 * @throws EE_Error
589
+	 */
590
+	public function _confirm_migration_crash_report_sent()
591
+	{
592
+		try {
593
+			$most_recent_migration = $this->migration_manager->get_last_ran_script(true);
594
+		} catch (EE_Error $e) {
595
+			$this->migration_manager->add_error_to_migrations_ran($e->getMessage());
596
+			// now, just so we can display the page correctly, make an error migration script stage object
597
+			// and also put the error on it. It only persists for the duration of this request
598
+			$most_recent_migration = new EE_DMS_Unknown_1_0_0();
599
+			$most_recent_migration->add_error($e->getMessage());
600
+		}
601
+		$success                                       = $this->_req_data['success'] === '1';
602
+		$this->_template_args['success']               = $success;
603
+		$this->_template_args['most_recent_migration'] = $most_recent_migration;
604
+		$this->_template_args['reset_db_action_url']   = EE_Admin_Page::add_query_args_and_nonce(
605
+			['action' => 'reset_db'],
606
+			EE_MAINTENANCE_ADMIN_URL
607
+		);
608
+		$this->_template_args['reset_db_page_url']     = EE_Admin_Page::add_query_args_and_nonce(
609
+			['action' => 'data_reset'],
610
+			EE_MAINTENANCE_ADMIN_URL
611
+		);
612
+		$this->_template_args['reattempt_action_url']  = EE_Admin_Page::add_query_args_and_nonce(
613
+			['action' => 'reattempt_migration'],
614
+			EE_MAINTENANCE_ADMIN_URL
615
+		);
616
+		$this->_template_path                          =
617
+			EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php';
618
+		$this->_template_args['admin_page_content']    = EEH_Template::display_template(
619
+			$this->_template_path,
620
+			$this->_template_args,
621
+			true
622
+		);
623
+		$this->display_admin_page_with_sidebar();
624
+	}
625
+
626
+
627
+	/**
628
+	 * Resets the entire EE4 database.
629
+	 * only sets up ee4 database for a fresh install-
630
+	 * doesn't actually clean out the old wp options, or cpts
631
+	 * (although it does erase old ee table data)
632
+	 *
633
+	 * @param boolean $nuke_old_ee4_data controls whether we destroy the old ee4 data,
634
+	 *                                   or just try initializing ee4 default data
635
+	 * @throws EE_Error
636
+	 * @throws ReflectionException
637
+	 */
638
+	public function _reset_db($nuke_old_ee4_data = true)
639
+	{
640
+		$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
641
+		if ($nuke_old_ee4_data) {
642
+			EEH_Activation::delete_all_espresso_cpt_data();
643
+			EEH_Activation::delete_all_espresso_tables_and_data(false);
644
+			EEH_Activation::remove_cron_tasks();
645
+		}
646
+		// make sure when we reset the registry's config that it
647
+		// switches to using the new singleton
648
+		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(true);
649
+		EE_System::instance()->initialize_db_if_no_migrations_required(true);
650
+		EE_System::instance()->redirect_to_about_ee();
651
+	}
652
+
653
+
654
+	/**
655
+	 * Deletes ALL EE tables, Records, and Options from the database.
656
+	 *
657
+	 * @throws EE_Error
658
+	 * @throws ReflectionException
659
+	 */
660
+	public function _delete_db()
661
+	{
662
+		$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
663
+		EEH_Activation::delete_all_espresso_cpt_data();
664
+		EEH_Activation::delete_all_espresso_tables_and_data();
665
+		EEH_Activation::remove_cron_tasks();
666
+		EEH_Activation::deactivate_event_espresso();
667
+		wp_safe_redirect(admin_url('plugins.php'));
668
+		exit;
669
+	}
670
+
671
+
672
+	/**
673
+	 * sets up EE4 to rerun the migrations from ee3 to ee4
674
+	 *
675
+	 * @throws EE_Error
676
+	 * @throws ReflectionException
677
+	 */
678
+	public function _rerun_migration_from_ee3()
679
+	{
680
+		$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
681
+		EEH_Activation::delete_all_espresso_cpt_data();
682
+		EEH_Activation::delete_all_espresso_tables_and_data(false);
683
+		// set the db state to something that will require migrations
684
+		update_option(EE_Data_Migration_Manager::current_database_state, '3.1.36.0');
685
+		$this->maintenance_mode->set_maintenance_level(EE_Maintenance_Mode::level_2_complete_maintenance);
686
+		$this->_redirect_after_action(
687
+			true,
688
+			esc_html__("Database", 'event_espresso'),
689
+			esc_html__("reset", 'event_espresso')
690
+		);
691
+	}
692
+
693
+
694
+	// none of the below group are currently used for Gateway Settings
695
+	protected function _add_screen_options()
696
+	{
697
+	}
698
+
699
+
700
+	protected function _add_feature_pointers()
701
+	{
702
+	}
703
+
704
+
705
+	public function admin_init()
706
+	{
707
+	}
708
+
709
+
710
+	public function admin_notices()
711
+	{
712
+	}
713
+
714
+
715
+	public function admin_footer_scripts()
716
+	{
717
+	}
718
+
719
+
720
+	public function load_scripts_styles()
721
+	{
722
+		wp_enqueue_script('ee_admin_js');
723
+		wp_enqueue_script(
724
+			'ee-maintenance',
725
+			EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.js',
726
+			['jquery'],
727
+			EVENT_ESPRESSO_VERSION,
728
+			true
729
+		);
730
+		wp_register_style(
731
+			'espresso_maintenance',
732
+			EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css',
733
+			[],
734
+			EVENT_ESPRESSO_VERSION
735
+		);
736
+		wp_enqueue_style('espresso_maintenance');
737
+		// localize script stuff
738
+		wp_localize_script(
739
+			'ee-maintenance',
740
+			'ee_maintenance',
741
+			[
742
+				'migrating'                        => wp_strip_all_tags(__("Updating Database...", "event_espresso")),
743
+				'next'                             => wp_strip_all_tags(__("Next", "event_espresso")),
744
+				'fatal_error'                      => wp_strip_all_tags(__(
745
+					"A Fatal Error Has Occurred",
746
+					"event_espresso"
747
+				)),
748
+				'click_next_when_ready'            => wp_strip_all_tags(
749
+					__(
750
+						"The current Database Update has ended. Click 'next' when ready to proceed",
751
+						"event_espresso"
752
+					)
753
+				),
754
+				'status_no_more_migration_scripts' => EE_Data_Migration_Manager::status_no_more_migration_scripts,
755
+				'status_fatal_error'               => EE_Data_Migration_Manager::status_fatal_error,
756
+				'status_completed'                 => EE_Data_Migration_Manager::status_completed,
757
+				'confirm'                          => wp_strip_all_tags(
758
+					__(
759
+						'Are you sure you want to do this? It CANNOT be undone!',
760
+						'event_espresso'
761
+					)
762
+				),
763
+				'confirm_skip_migration'           => wp_strip_all_tags(
764
+					__(
765
+						'You have chosen to NOT migrate your existing data. Are you sure you want to continue?',
766
+						'event_espresso'
767
+					)
768
+				),
769
+			]
770
+		);
771
+	}
772
+
773
+
774
+	public function load_scripts_styles_default()
775
+	{
776
+	}
777
+
778
+
779
+	/**
780
+	 * Enqueue scripts and styles for the datetime tools page.
781
+	 */
782
+	public function load_scripts_styles_datetime_tools()
783
+	{
784
+		EE_Datepicker_Input::enqueue_styles_and_scripts();
785
+	}
786
+
787
+
788
+	/**
789
+	 * @throws EE_Error
790
+	 */
791
+	protected function _datetime_tools()
792
+	{
793
+		$form_action                                = EE_Admin_Page::add_query_args_and_nonce(
794
+			[
795
+				'action'        => 'run_datetime_offset_fix',
796
+				'return_action' => $this->_req_action,
797
+			],
798
+			EE_MAINTENANCE_ADMIN_URL
799
+		);
800
+		$form                                       = $this->_get_datetime_offset_fix_form();
801
+		$this->_admin_page_title                    = esc_html__('Datetime Utilities', 'event_espresso');
802
+		$this->_template_args['admin_page_content'] = $form->form_open($form_action, 'post')
803
+													  . $form->get_html_and_js()
804
+													  . $form->form_close();
805
+		$this->display_admin_page_with_no_sidebar();
806
+	}
807
+
808
+
809
+	/**
810
+	 * @throws EE_Error
811
+	 */
812
+	protected function _get_datetime_offset_fix_form()
813
+	{
814
+		if (! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) {
815
+			$this->datetime_fix_offset_form = new EE_Form_Section_Proper(
816
+				[
817
+					'name'            => 'datetime_offset_fix_option',
818
+					'layout_strategy' => new EE_Admin_Two_Column_Layout(),
819
+					'subsections'     => [
820
+						'title'                  => new EE_Form_Section_HTML(
821
+							EEH_HTML::h2(
822
+								esc_html__('Datetime Offset Tool', 'event_espresso')
823
+							)
824
+						),
825
+						'explanation'            => new EE_Form_Section_HTML(
826
+							EEH_HTML::p(
827
+								esc_html__(
828
+									'Use this tool to automatically apply the provided offset to all Event Espresso records in your database that involve dates and times.',
829
+									'event_espresso'
830
+								)
831
+							)
832
+							. EEH_HTML::p(
833
+								esc_html__(
834
+									'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.',
835
+									'event_espresso'
836
+								)
837
+							)
838
+						),
839
+						'offset_input'           => new EE_Float_Input(
840
+							[
841
+								'html_name'       => 'offset_for_datetimes',
842
+								'html_label_text' => esc_html__(
843
+									'Offset to apply (in hours):',
844
+									'event_espresso'
845
+								),
846
+								'min_value'       => '-12',
847
+								'max_value'       => '14',
848
+								'step_value'      => '.25',
849
+								'default'         => DatetimeOffsetFix::getOffset(),
850
+							]
851
+						),
852
+						'date_range_explanation' => new EE_Form_Section_HTML(
853
+							EEH_HTML::p(
854
+								esc_html__(
855
+									'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.',
856
+									'event_espresso'
857
+								)
858
+							)
859
+							. EEH_HTML::p(
860
+								EEH_HTML::strong(
861
+									sprintf(
862
+										esc_html__(
863
+											'Note: please enter the dates in UTC (You can use %1$sthis online tool%2$s to assist with conversions).',
864
+											'event_espresso'
865
+										),
866
+										'<a href="https://www.timeanddate.com/worldclock/converter.html">',
867
+										'</a>'
868
+									)
869
+								)
870
+							)
871
+						),
872
+						'date_range_start_date'  => new EE_Datepicker_Input(
873
+							[
874
+								'html_name'       => 'offset_date_start_range',
875
+								'html_label_text' => esc_html__(
876
+									'Start Date for dates the offset applied to:',
877
+									'event_espresso'
878
+								),
879
+							]
880
+						),
881
+						'date_range_end_date'    => new EE_Datepicker_Input(
882
+							[
883
+								'html_name'       => 'offset_date_end_range',
884
+								'html_label_text' => esc_html__(
885
+									'End Date for dates the offset is applied to:',
886
+									'event_espresso'
887
+								),
888
+							]
889
+						),
890
+						'submit'                 => new EE_Submit_Input(
891
+							[
892
+								'html_label_text' => '',
893
+								'default'         => esc_html__('Apply Offset', 'event_espresso'),
894
+							]
895
+						),
896
+					],
897
+				]
898
+			);
899
+		}
900
+		return $this->datetime_fix_offset_form;
901
+	}
902
+
903
+
904
+	/**
905
+	 * Callback for the run_datetime_offset_fix route.
906
+	 *
907
+	 * @throws EE_Error
908
+	 */
909
+	protected function _apply_datetime_offset()
910
+	{
911
+		if ($_SERVER['REQUEST_METHOD'] === 'POST') {
912
+			$form = $this->_get_datetime_offset_fix_form();
913
+			$form->receive_form_submission($this->_req_data);
914
+			if ($form->is_valid()) {
915
+				// save offset data so batch processor can get it.
916
+				DatetimeOffsetFix::updateOffset($form->get_input_value('offset_input'));
917
+				$utc_timezone          = new DateTimeZone('UTC');
918
+				$date_range_start_date = DateTime::createFromFormat(
919
+					'm/d/Y H:i:s',
920
+					$form->get_input_value('date_range_start_date') . ' 00:00:00',
921
+					$utc_timezone
922
+				);
923
+				$date_range_end_date   = DateTime::createFromFormat(
924
+					'm/d/Y H:i:s',
925
+					$form->get_input_value('date_range_end_date') . ' 23:59:59',
926
+					$utc_timezone
927
+				);
928
+				if ($date_range_start_date instanceof DateTime) {
929
+					DatetimeOffsetFix::updateStartDateRange(DbSafeDateTime::createFromDateTime($date_range_start_date));
930
+				}
931
+				if ($date_range_end_date instanceof DateTime) {
932
+					DatetimeOffsetFix::updateEndDateRange(DbSafeDateTime::createFromDateTime($date_range_end_date));
933
+				}
934
+				// redirect to batch tool
935
+				wp_redirect(
936
+					EE_Admin_Page::add_query_args_and_nonce(
937
+						[
938
+							'page'        => 'espresso_batch',
939
+							'batch'       => 'job',
940
+							'label'       => esc_html__('Applying Offset', 'event_espresso'),
941
+							'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\DatetimeOffsetFix'),
942
+							'return_url'  => urlencode(
943
+								add_query_arg(
944
+									[
945
+										'action' => 'datetime_tools',
946
+									],
947
+									EEH_URL::current_url_without_query_paramaters(
948
+										[
949
+											'return_action',
950
+											'run_datetime_offset_fix_nonce',
951
+											'return',
952
+											'datetime_tools_nonce',
953
+										]
954
+									)
955
+								)
956
+							),
957
+						],
958
+						admin_url()
959
+					)
960
+				);
961
+				exit;
962
+			}
963
+		}
964
+	}
965 965
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                 $current_script                  = null;
240 240
                 foreach ($scripts_needing_to_run as $script) {
241 241
                     if ($script instanceof EE_Data_Migration_Script_Base) {
242
-                        if (! $current_script) {
242
+                        if ( ! $current_script) {
243 243
                             $current_script = $script;
244 244
                             $current_script->migration_page_hooks();
245 245
                         }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
             )
268 268
         ) {
269 269
             $this->_template_path                =
270
-                EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
270
+                EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php';
271 271
             $this->_template_args['support_url'] = 'https://eventespresso.com/support/forums/';
272 272
             $this->_template_args['next_url']    = EEH_URL::add_query_args_and_nonce(
273 273
                 [
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 EE_MAINTENANCE_ADMIN_URL
278 278
             );
279 279
         } elseif ($addons_should_be_upgraded_first) {
280
-            $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php';
280
+            $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php';
281 281
         } else {
282 282
             if (
283 283
                 $most_recent_migration instanceof EE_Data_Migration_Script_Base
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                     [
303 303
                         'current_db_state' => sprintf(
304 304
                             esc_html__("EE%s (%s)", "event_espresso"),
305
-                            isset($current_db_state[ $plugin_slug ]) ? $current_db_state[ $plugin_slug ] : 3,
305
+                            isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3,
306 306
                             $plugin_slug
307 307
                         ),
308 308
                         'next_db_state'    => sprintf(
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
                 $this->_template_args['current_db_state'] = null;
317 317
                 $this->_template_args['next_db_state']    = null;
318 318
             }
319
-            $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
319
+            $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php';
320 320
             $this->_template_args = array_merge(
321 321
                 $this->_template_args,
322 322
                 [
@@ -352,13 +352,13 @@  discard block
 block discarded – undo
352 352
             );
353 353
         }
354 354
         $this->_template_args['most_recent_migration'] =
355
-            $most_recent_migration;// the actual most recently ran migration
355
+            $most_recent_migration; // the actual most recently ran migration
356 356
         // now render the migration options part, and put it in a variable
357
-        $migration_options_template_file                = apply_filters(
357
+        $migration_options_template_file = apply_filters(
358 358
             'FHEE__ee_migration_page__migration_options_template',
359
-            EE_MAINTENANCE_TEMPLATE_PATH . 'migration_options_from_ee4.template.php'
359
+            EE_MAINTENANCE_TEMPLATE_PATH.'migration_options_from_ee4.template.php'
360 360
         );
361
-        $migration_options_html                         = EEH_Template::display_template(
361
+        $migration_options_html = EEH_Template::display_template(
362 362
             $migration_options_template_file,
363 363
             $this->_template_args,
364 364
             true
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     public function _change_maintenance_level()
408 408
     {
409 409
         $new_level = absint($this->_req_data['maintenance_mode_level']);
410
-        if (! $this->migration_manager->check_for_applicable_data_migration_scripts()) {
410
+        if ( ! $this->migration_manager->check_for_applicable_data_migration_scripts()) {
411 411
             $this->maintenance_mode->set_maintenance_level($new_level);
412 412
             $success = true;
413 413
         } else {
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
     public function _data_reset_and_delete()
428 428
     {
429 429
         $this->_template_path                              =
430
-            EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php';
430
+            EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php';
431 431
         $this->_template_args['reset_reservations_button'] = $this->get_action_link_or_button(
432 432
             'reset_reservations',
433 433
             'reset_reservations',
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
             [],
441 441
             'button button-primary ee-confirm'
442 442
         );
443
-        $this->_template_args['delete_db_url']             = EE_Admin_Page::add_query_args_and_nonce(
443
+        $this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce(
444 444
             ['action' => 'delete_db'],
445 445
             EE_MAINTENANCE_ADMIN_URL
446 446
         );
447
-        $this->_template_args['reset_db_url']              = EE_Admin_Page::add_query_args_and_nonce(
447
+        $this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce(
448 448
             ['action' => 'reset_db'],
449 449
             EE_MAINTENANCE_ADMIN_URL
450 450
         );
451
-        $this->_template_args['admin_page_content']        = EEH_Template::display_template(
451
+        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
452 452
             $this->_template_path,
453 453
             $this->_template_args,
454 454
             true
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
      */
520 520
     public function _system_status()
521 521
     {
522
-        $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php';
522
+        $this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php';
523 523
         $this->_template_args['system_stati']               = EEM_System_Status::instance()->get_system_stati();
524 524
         $this->_template_args['download_system_status_url'] = EE_Admin_Page::add_query_args_and_nonce(
525 525
             [
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
             ],
528 528
             EE_MAINTENANCE_ADMIN_URL
529 529
         );
530
-        $this->_template_args['admin_page_content']         = EEH_Template::display_template(
530
+        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
531 531
             $this->_template_path,
532 532
             $this->_template_args,
533 533
             true
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
     {
544 544
         $status_info = EEM_System_Status::instance()->get_system_stati();
545 545
         header('Content-Disposition: attachment');
546
-        header("Content-Disposition: attachment; filename=system_status_" . sanitize_key(site_url()) . ".html");
546
+        header("Content-Disposition: attachment; filename=system_status_".sanitize_key(site_url()).".html");
547 547
         $output = '<style>table{border:1px solid darkgrey;}td{vertical-align:top}</style>';
548
-        $output .= '<h1>' . sprintf(
548
+        $output .= '<h1>'.sprintf(
549 549
             __('System Information for %1$s', 'event_espresso'),
550 550
             esc_url_raw(site_url())
551
-        ) . '</h1>';
551
+        ).'</h1>';
552 552
         $output .= EEH_Template::layout_array_as_table($status_info);
553 553
         echo esc_html($output);
554 554
         die;
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
             $success = wp_mail(
568 568
                 EE_SUPPORT_EMAIL,
569 569
                 'Migration Crash Report',
570
-                $body . "/r/n<br>" . print_r(EEM_System_Status::instance()->get_system_stati(), true),
570
+                $body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true),
571 571
                 [
572 572
                     "from:$from_name<$from>",
573 573
                 ]
@@ -605,16 +605,16 @@  discard block
 block discarded – undo
605 605
             ['action' => 'reset_db'],
606 606
             EE_MAINTENANCE_ADMIN_URL
607 607
         );
608
-        $this->_template_args['reset_db_page_url']     = EE_Admin_Page::add_query_args_and_nonce(
608
+        $this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce(
609 609
             ['action' => 'data_reset'],
610 610
             EE_MAINTENANCE_ADMIN_URL
611 611
         );
612
-        $this->_template_args['reattempt_action_url']  = EE_Admin_Page::add_query_args_and_nonce(
612
+        $this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce(
613 613
             ['action' => 'reattempt_migration'],
614 614
             EE_MAINTENANCE_ADMIN_URL
615 615
         );
616 616
         $this->_template_path                          =
617
-            EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php';
617
+            EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php';
618 618
         $this->_template_args['admin_page_content']    = EEH_Template::display_template(
619 619
             $this->_template_path,
620 620
             $this->_template_args,
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
         wp_enqueue_script('ee_admin_js');
723 723
         wp_enqueue_script(
724 724
             'ee-maintenance',
725
-            EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.js',
725
+            EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.js',
726 726
             ['jquery'],
727 727
             EVENT_ESPRESSO_VERSION,
728 728
             true
729 729
         );
730 730
         wp_register_style(
731 731
             'espresso_maintenance',
732
-            EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css',
732
+            EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css',
733 733
             [],
734 734
             EVENT_ESPRESSO_VERSION
735 735
         );
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
      */
791 791
     protected function _datetime_tools()
792 792
     {
793
-        $form_action                                = EE_Admin_Page::add_query_args_and_nonce(
793
+        $form_action = EE_Admin_Page::add_query_args_and_nonce(
794 794
             [
795 795
                 'action'        => 'run_datetime_offset_fix',
796 796
                 'return_action' => $this->_req_action,
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
      */
812 812
     protected function _get_datetime_offset_fix_form()
813 813
     {
814
-        if (! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) {
814
+        if ( ! $this->datetime_fix_offset_form instanceof EE_Form_Section_Proper) {
815 815
             $this->datetime_fix_offset_form = new EE_Form_Section_Proper(
816 816
                 [
817 817
                     'name'            => 'datetime_offset_fix_option',
@@ -917,12 +917,12 @@  discard block
 block discarded – undo
917 917
                 $utc_timezone          = new DateTimeZone('UTC');
918 918
                 $date_range_start_date = DateTime::createFromFormat(
919 919
                     'm/d/Y H:i:s',
920
-                    $form->get_input_value('date_range_start_date') . ' 00:00:00',
920
+                    $form->get_input_value('date_range_start_date').' 00:00:00',
921 921
                     $utc_timezone
922 922
                 );
923
-                $date_range_end_date   = DateTime::createFromFormat(
923
+                $date_range_end_date = DateTime::createFromFormat(
924 924
                     'm/d/Y H:i:s',
925
-                    $form->get_input_value('date_range_end_date') . ' 23:59:59',
925
+                    $form->get_input_value('date_range_end_date').' 23:59:59',
926 926
                     $utc_timezone
927 927
                 );
928 928
                 if ($date_range_start_date instanceof DateTime) {
Please login to merge, or discard this patch.
admin_pages/payments/templates/payment_method_activate.template.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@
 block discarded – undo
17 17
                        id="activate_<?php echo esc_attr($payment_method->slug()) ?>"
18 18
                     >
19 19
                         <?php printf(
20
-                            esc_html__("Activate %s Payment Method?", "event_espresso"),
21
-                            $payment_method->admin_name()
22
-                        ); ?>
20
+							esc_html__("Activate %s Payment Method?", "event_espresso"),
21
+							$payment_method->admin_name()
22
+						); ?>
23 23
                     </a>
24 24
                 </td>
25 25
             </tr>
Please login to merge, or discard this patch.
admin_pages/payments/Payments_Admin_Page_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
     {
30 30
         // define some page related constants
31 31
         define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings');
32
-        define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page=' . EE_PAYMENTS_PG_SLUG));
33
-        define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments/');
34
-        define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates/');
35
-        define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/');
32
+        define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG));
33
+        define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments/');
34
+        define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates/');
35
+        define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/');
36 36
         $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true);
37 37
         // check that there are active gateways on all admin page loads. but don't do it just yet
38 38
         add_action('admin_notices', [$this, 'check_payment_gateway_setup']);
Please login to merge, or discard this patch.
Indentation   +147 added lines, -147 removed lines patch added patch discarded remove patch
@@ -14,153 +14,153 @@
 block discarded – undo
14 14
  */
15 15
 class Payments_Admin_Page_Init extends EE_Admin_Page_Init
16 16
 {
17
-    /**
18
-     * @var TableAnalysis $table_analysis
19
-     */
20
-    protected $_table_analysis;
21
-
22
-
23
-    /**
24
-     * @throws EE_Error
25
-     * @throws ReflectionException
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/');
33
-        define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates/');
34
-        define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/');
35
-        $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true);
36
-        // check that there are active gateways on all admin page loads. but don't do it just yet
37
-        add_action('admin_notices', [$this, 'check_payment_gateway_setup']);
38
-
39
-        // Show/hide PP Standard alongside PP Express.
40
-        add_filter(
41
-            'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods',
42
-            [$this, 'unset_pp_standard']
43
-        );
44
-
45
-        parent::__construct();
46
-    }
47
-
48
-
49
-    protected function _set_init_properties()
50
-    {
51
-        $this->label = esc_html__('Payment Methods', 'event_espresso');
52
-    }
53
-
54
-
55
-    /**
56
-     * _set_menu_map
57
-     *
58
-     * @return void
59
-     * @throws EE_Error
60
-     */
61
-    protected function _set_menu_map()
62
-    {
63
-        $this->_menu_map = new EE_Admin_Page_Sub_Menu(
64
-            [
65
-                'menu_group'      => 'settings',
66
-                'menu_order'      => 30,
67
-                'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
68
-                'parent_slug'     => 'espresso_events',
69
-                'menu_slug'       => EE_PAYMENTS_PG_SLUG,
70
-                'menu_label'      => esc_html__('Payment Methods', 'event_espresso'),
71
-                'capability'      => 'ee_manage_gateways',
72
-                'admin_init_page' => $this,
73
-            ]
74
-        );
75
-    }
76
-
77
-
78
-    /**
79
-     * Checks that there is at least one active gateway. If not, add a notice
80
-     *
81
-     * @throws EE_Error
82
-     */
83
-    public function check_payment_gateway_setup()
84
-    {
85
-        // ONLY do this check if models can query
86
-        // and avoid a bug where when we nuke EE4's data that this causes a fatal error
87
-        // because the tables are deleted just before this request runs.
88
-        // see https://events.codebasehq.com/projects/event-espresso/tickets/7539
89
-        if (
90
-            ! EE_Maintenance_Mode::instance()->models_can_query()
91
-            || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table())
92
-        ) {
93
-            return;
94
-        }
95
-
96
-        $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart);
97
-        if ($actives < 1) {
98
-            $url = EE_Admin_Page::add_query_args_and_nonce([], EE_PAYMENTS_ADMIN_URL);
99
-            echo '<div class="error">
17
+	/**
18
+	 * @var TableAnalysis $table_analysis
19
+	 */
20
+	protected $_table_analysis;
21
+
22
+
23
+	/**
24
+	 * @throws EE_Error
25
+	 * @throws ReflectionException
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/');
33
+		define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates/');
34
+		define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/');
35
+		$this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', [], true);
36
+		// check that there are active gateways on all admin page loads. but don't do it just yet
37
+		add_action('admin_notices', [$this, 'check_payment_gateway_setup']);
38
+
39
+		// Show/hide PP Standard alongside PP Express.
40
+		add_filter(
41
+			'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods',
42
+			[$this, 'unset_pp_standard']
43
+		);
44
+
45
+		parent::__construct();
46
+	}
47
+
48
+
49
+	protected function _set_init_properties()
50
+	{
51
+		$this->label = esc_html__('Payment Methods', 'event_espresso');
52
+	}
53
+
54
+
55
+	/**
56
+	 * _set_menu_map
57
+	 *
58
+	 * @return void
59
+	 * @throws EE_Error
60
+	 */
61
+	protected function _set_menu_map()
62
+	{
63
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(
64
+			[
65
+				'menu_group'      => 'settings',
66
+				'menu_order'      => 30,
67
+				'show_on_menu'    => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
68
+				'parent_slug'     => 'espresso_events',
69
+				'menu_slug'       => EE_PAYMENTS_PG_SLUG,
70
+				'menu_label'      => esc_html__('Payment Methods', 'event_espresso'),
71
+				'capability'      => 'ee_manage_gateways',
72
+				'admin_init_page' => $this,
73
+			]
74
+		);
75
+	}
76
+
77
+
78
+	/**
79
+	 * Checks that there is at least one active gateway. If not, add a notice
80
+	 *
81
+	 * @throws EE_Error
82
+	 */
83
+	public function check_payment_gateway_setup()
84
+	{
85
+		// ONLY do this check if models can query
86
+		// and avoid a bug where when we nuke EE4's data that this causes a fatal error
87
+		// because the tables are deleted just before this request runs.
88
+		// see https://events.codebasehq.com/projects/event-espresso/tickets/7539
89
+		if (
90
+			! EE_Maintenance_Mode::instance()->models_can_query()
91
+			|| ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table())
92
+		) {
93
+			return;
94
+		}
95
+
96
+		$actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart);
97
+		if ($actives < 1) {
98
+			$url = EE_Admin_Page::add_query_args_and_nonce([], EE_PAYMENTS_ADMIN_URL);
99
+			echo '<div class="error">
100 100
 				 <p>'
101
-                 . sprintf(
102
-                     esc_html__(
103
-                         "There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s",
104
-                         "event_espresso"
105
-                     ),
106
-                     "<a href='$url'>",
107
-                     "</a>"
108
-                 )
109
-                 . '</p>
101
+				 . sprintf(
102
+					 esc_html__(
103
+						 "There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s",
104
+						 "event_espresso"
105
+					 ),
106
+					 "<a href='$url'>",
107
+					 "</a>"
108
+				 )
109
+				 . '</p>
110 110
 			 </div>';
111
-        }
112
-    }
113
-
114
-
115
-    /**
116
-     * Gets the injected table analyzer, or throws an exception
117
-     *
118
-     * @return TableAnalysis
119
-     * @throws EE_Error
120
-     */
121
-    protected function _get_table_analysis()
122
-    {
123
-        if ($this->_table_analysis instanceof TableAnalysis) {
124
-            return $this->_table_analysis;
125
-        } else {
126
-            throw new EE_Error(
127
-                sprintf(
128
-                    esc_html__('Table analysis class on class %1$s is not set properly.', 'event_espresso'),
129
-                    get_class($this)
130
-                )
131
-            );
132
-        }
133
-    }
134
-
135
-
136
-    /**
137
-     * Hide PayPal Standard for "new" users.
138
-     *
139
-     * @throws EE_Error
140
-     * @throws ReflectionException
141
-     */
142
-    public static function unset_pp_standard($payment_method_types)
143
-    {
144
-        $pps                           = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard');
145
-        $paypal_standard_active        = ! empty($pps) && $pps->active();
146
-        $paypal_standard_active_before = false;
147
-        if ($pps) {
148
-            // PP Standard used before ?
149
-            $paypal_id = $pps->get_extra_meta('paypal_id', true);
150
-            if ($paypal_id && ! empty($paypal_id)) {
151
-                $paypal_standard_active_before = true;
152
-            }
153
-        }
154
-
155
-        // Not using PP Standard? Then display only PayPal Express, do not show PayPal Standard.
156
-        if (
157
-            apply_filters(
158
-                'FHEE__EE_PMT_Paypal_Express__register_payment_methods__hide_paypal_standard',
159
-                ! $paypal_standard_active && ! $paypal_standard_active_before
160
-            )
161
-        ) {
162
-            unset($payment_method_types['paypal_standard']);
163
-        }
164
-        return $payment_method_types;
165
-    }
111
+		}
112
+	}
113
+
114
+
115
+	/**
116
+	 * Gets the injected table analyzer, or throws an exception
117
+	 *
118
+	 * @return TableAnalysis
119
+	 * @throws EE_Error
120
+	 */
121
+	protected function _get_table_analysis()
122
+	{
123
+		if ($this->_table_analysis instanceof TableAnalysis) {
124
+			return $this->_table_analysis;
125
+		} else {
126
+			throw new EE_Error(
127
+				sprintf(
128
+					esc_html__('Table analysis class on class %1$s is not set properly.', 'event_espresso'),
129
+					get_class($this)
130
+				)
131
+			);
132
+		}
133
+	}
134
+
135
+
136
+	/**
137
+	 * Hide PayPal Standard for "new" users.
138
+	 *
139
+	 * @throws EE_Error
140
+	 * @throws ReflectionException
141
+	 */
142
+	public static function unset_pp_standard($payment_method_types)
143
+	{
144
+		$pps                           = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard');
145
+		$paypal_standard_active        = ! empty($pps) && $pps->active();
146
+		$paypal_standard_active_before = false;
147
+		if ($pps) {
148
+			// PP Standard used before ?
149
+			$paypal_id = $pps->get_extra_meta('paypal_id', true);
150
+			if ($paypal_id && ! empty($paypal_id)) {
151
+				$paypal_standard_active_before = true;
152
+			}
153
+		}
154
+
155
+		// Not using PP Standard? Then display only PayPal Express, do not show PayPal Standard.
156
+		if (
157
+			apply_filters(
158
+				'FHEE__EE_PMT_Paypal_Express__register_payment_methods__hide_paypal_standard',
159
+				! $paypal_standard_active && ! $paypal_standard_active_before
160
+			)
161
+		) {
162
+			unset($payment_method_types['paypal_standard']);
163
+		}
164
+		return $payment_method_types;
165
+	}
166 166
 }
Please login to merge, or discard this patch.
admin_pages/venues/templates/venue_gmap_metabox_content.template.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
         <td valign="top">
11 11
             <fieldset>
12 12
                 <?php
13
-                if (
14
-                    isset(EE_Registry::instance()->CFG->map_settings)
15
-                    && isset(EE_Registry::instance()->CFG->map_settings->use_google_maps)
16
-                    && EE_Registry::instance()->CFG->map_settings->use_google_maps
17
-                ) { ?>
13
+				if (
14
+					isset(EE_Registry::instance()->CFG->map_settings)
15
+					&& isset(EE_Registry::instance()->CFG->map_settings->use_google_maps)
16
+					&& EE_Registry::instance()->CFG->map_settings->use_google_maps
17
+				) { ?>
18 18
                     <p>
19 19
                         <label for="enable_for_gmap">
20 20
                             <?php esc_html_e('Display Google Map for this venue? ', 'event_espresso') ?>
@@ -27,25 +27,25 @@  discard block
 block discarded – undo
27 27
                     class="all-options" />
28 28
                     </p> -->
29 29
                     <?php
30
-                }
30
+				}
31 31
 
32
-                if (
33
-                    ! isset(EE_Registry::instance()->CFG->map_settings)
34
-                    || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps)
35
-                    || ! EE_Registry::instance()->CFG->map_settings->use_google_maps
36
-                ) { ?>
32
+				if (
33
+					! isset(EE_Registry::instance()->CFG->map_settings)
34
+					|| ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps)
35
+					|| ! EE_Registry::instance()->CFG->map_settings->use_google_maps
36
+				) { ?>
37 37
                     <p class="ee-notice">
38 38
                         <?php
39
-                        printf(
40
-                            esc_html__(
41
-                                'To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"',
42
-                                'event_espresso'
43
-                            ),
44
-                            '<b>',
45
-                            '</b> &raquo; <b>',
46
-                            '</b>'
47
-                        );
48
-                        ?>
39
+						printf(
40
+							esc_html__(
41
+								'To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"',
42
+								'event_espresso'
43
+							),
44
+							'<b>',
45
+							'</b> &raquo; <b>',
46
+							'</b>'
47
+						);
48
+						?>
49 49
                     </p>
50 50
                 <?php } ?>
51 51
             </fieldset>
Please login to merge, or discard this patch.
venues/help_tabs/venues_overview_views_bulk_actions_search.help_tab.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 </p>
4 4
 <p>
5 5
     <?php esc_html_e(
6
-        'Bulk actions allow you to perform an action to multiple venues at once. The following bulk actions are supported: Delete. To use the bulk action feature, place a checkmark next to the venues that you want to include. Then select a bulk action from the menu and click on the Apply button.',
7
-        'event_espresso'
8
-    ); ?>
6
+		'Bulk actions allow you to perform an action to multiple venues at once. The following bulk actions are supported: Delete. To use the bulk action feature, place a checkmark next to the venues that you want to include. Then select a bulk action from the menu and click on the Apply button.',
7
+		'event_espresso'
8
+	); ?>
9 9
     <br />
10 10
 </p>
11 11
 <p>
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 </p>
14 14
 <p>
15 15
     <?php esc_html_e(
16
-        'Views allow you to restrict what you see in the Venues Overview table. The following views are available: All. The number in parentheses next to each view represents the number of venues that will be displayed with that view.',
17
-        'event_espresso'
18
-    ); ?>
16
+		'Views allow you to restrict what you see in the Venues Overview table. The following views are available: All. The number in parentheses next to each view represents the number of venues that will be displayed with that view.',
17
+		'event_espresso'
18
+	); ?>
19 19
     <br />
20 20
 </p>
21 21
 <ul>
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 </p>
36 36
 <p>
37 37
     <?php esc_html_e(
38
-        'You can perform a search to find certain venues. The following sources will be searched: Venue Name (title), Venue Description, Venue Short Description (excerpt), Venue Address, Venue City, Venue Zip / Postal Code, Venue Phone, Venue URL, Venue Virtual Phone, Venue Google Map Link, Event Name (title), Event Description, Event Phone, and Event External URL. To use the search feature, enter a value into the search box and click on the Search Venues button.',
39
-        'event_espresso'
40
-    ); ?>
38
+		'You can perform a search to find certain venues. The following sources will be searched: Venue Name (title), Venue Description, Venue Short Description (excerpt), Venue Address, Venue City, Venue Zip / Postal Code, Venue Phone, Venue URL, Venue Virtual Phone, Venue Google Map Link, Event Name (title), Event Description, Event Phone, and Event External URL. To use the search feature, enter a value into the search box and click on the Search Venues button.',
39
+		'event_espresso'
40
+	); ?>
41 41
 </p>
42 42
\ No newline at end of file
Please login to merge, or discard this patch.