| 1 |
<?php |
| 2 |
|
| 3 |
// Exit if accessed directly. |
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
/** |
| 9 |
* Display the upgrades page. |
| 10 |
* |
| 11 |
* @author WP Charitable LLC |
| 12 |
* @package Charitable/Admin View/Upgrades |
| 13 |
* @since 1.0.0 |
| 14 |
* @version 1.8.1 |
| 15 |
* @version 1.8.8.6 |
| 16 |
*/ |
| 17 |
|
| 18 |
$page = $view_args['page']; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 19 |
$action = $page->get_action(); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited |
| 20 |
$charitable_step = $page->get_step(); |
| 21 |
$charitable_total = $page->get_total(); |
| 22 |
$charitable_number = $page->get_number(); |
| 23 |
$charitable_nonce = $page->get_nonce(); |
| 24 |
$charitable_steps = $page->get_steps( $charitable_total, $charitable_number ); |
| 25 |
$charitable_args = array( |
| 26 |
'charitable-upgrade' => $action, |
| 27 |
'page' => 'charitable-upgrades', |
| 28 |
'step' => $charitable_step, |
| 29 |
'total' => $charitable_total, |
| 30 |
'steps' => $charitable_steps, |
| 31 |
'nonce' => $charitable_nonce, |
| 32 |
); |
| 33 |
|
| 34 |
$charitable_timeout_url = 'index.php?charitable_action=' . $action; |
| 35 |
$charitable_timeout_url .= '&step=' . $charitable_step; |
| 36 |
|
| 37 |
if ( $charitable_total ) { |
| 38 |
$charitable_timeout_url .= '&total=' . $charitable_total; |
| 39 |
} |
| 40 |
|
| 41 |
if ( $charitable_nonce ) { |
| 42 |
$charitable_timeout_url .= '&nonce=' . $charitable_nonce; |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
update_option( 'charitable_doing_upgrade', $charitable_args ); |
| 47 |
|
| 48 |
if ( $charitable_step > $charitable_steps ) { |
| 49 |
// Prevent a weird case where the estimate was off. Usually only a couple. |
| 50 |
$charitable_steps = $charitable_step; |
| 51 |
} |
| 52 |
?> |
| 53 |
<div class="wrap"> |
| 54 |
<h2><?php esc_html_e( 'Charitable - Upgrades', 'charitable' ); ?></h2> |
| 55 |
|
| 56 |
<div id="charitable-upgrade-status"> |
| 57 |
<p><?php esc_html_e( 'The upgrade process has started, please be patient. This could take several minutes. You will be automatically redirected when the upgrade is finished.', 'charitable' ); ?></p> |
| 58 |
<?php if ( ! empty( $charitable_total ) ) : ?> |
| 59 |
<?php // Translators: %1$s is the current step, %2$s is the total number of steps. ?> |
| 60 |
<p><strong><?php printf( esc_html__( 'Step %1$d of approximately %2$d running', 'charitable' ), esc_html( $charitable_step ), esc_html( $charitable_steps ) ); ?></strong></p> |
| 61 |
<?php endif; ?> |
| 62 |
</div> |
| 63 |
<script type="text/javascript"> |
| 64 |
setTimeout(function() { document.location.href = "<?php echo esc_url_raw( $charitable_timeout_url ); ?>"; }, 250); |
| 65 |
</script> |
| 66 |
</div> |
| 67 |
|