upgrades.php
111 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Upgrade Screen |
| 4 | * |
| 5 | * @package Give |
| 6 | * @subpackage Admin/Upgrades |
| 7 | * @copyright Copyright (c) 2017, WordImpress |
| 8 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 | * @since 1.8.12 |
| 10 | */ |
| 11 | |
| 12 | // Exit if accessed directly. |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | $give_updates = Give_Updates::get_instance(); |
| 18 | ?> |
| 19 | <div class="wrap" id="poststuff"> |
| 20 | <div id="give-updates"> |
| 21 | <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
| 22 | <hr class="wp-header-end"> |
| 23 | |
| 24 | <div class="give-update-panel-content"> |
| 25 | <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
| 26 | </div> |
| 27 | |
| 28 | <?php $db_updates = $give_updates->get_pending_db_update_count(); ?> |
| 29 | <?php if ( ! empty( $db_updates ) ) : ?> |
| 30 | <?php |
| 31 | $is_doing_updates = $give_updates->is_doing_updates(); |
| 32 | $db_update_url = add_query_arg( array( 'type' => 'database', ) ); |
| 33 | $resume_updates = get_option( 'give_doing_upgrade' ); |
| 34 | $width = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0; |
| 35 | ?> |
| 36 | <div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>"> |
| 37 | <div class="postbox-container"> |
| 38 | <div class="postbox"> |
| 39 | <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
| 40 | <div class="inside"> |
| 41 | <div class="panel-content"> |
| 42 | <p class="give-update-button"> |
| 43 | <?php echo sprintf( |
| 44 | __( '%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give' ), |
| 45 | $is_doing_updates ? |
| 46 | __( 'Give is currently updating the database in the background.', 'give' ) : |
| 47 | __( 'Give needs to update the database.', 'give' ), |
| 48 | $db_update_url, |
| 49 | ( $is_doing_updates ? 'give-hidden' : '' ), |
| 50 | __( 'Update now', 'give' ) |
| 51 | ); |
| 52 | ?> |
| 53 | </p> |
| 54 | </div> |
| 55 | <div class="progress-container<?php echo $is_doing_updates ? '' : ' give-hidden'; ?>"> |
| 56 | <p class="update-message"> |
| 57 | <strong> |
| 58 | <?php |
| 59 | echo sprintf( |
| 60 | __( 'Update %s of %s', 'give' ), |
| 61 | $give_updates->get_running_db_update(), |
| 62 | $give_updates->get_total_new_db_update_count() |
| 63 | ); |
| 64 | ?> |
| 65 | </strong> |
| 66 | </p> |
| 67 | <div class="progress-content"> |
| 68 | <?php if ( $is_doing_updates ) : ?> |
| 69 | <div class="notice-wrap give-clearfix"> |
| 70 | <span class="spinner is-active"></span> |
| 71 | <div class="give-progress"> |
| 72 | <div style="width: <?php echo $width ?>%;"></div> |
| 73 | </div> |
| 74 | </div> |
| 75 | <?php endif; ?> |
| 76 | </div> |
| 77 | </div> |
| 78 | |
| 79 | <?php if( ! $is_doing_updates ) : ?> |
| 80 | <div class="give-run-database-update"></div> |
| 81 | <?php endif; ?> |
| 82 | </div> |
| 83 | <!-- .inside --> |
| 84 | </div><!-- .postbox --> |
| 85 | </div> |
| 86 | </div> |
| 87 | <?php endif; ?> |
| 88 | |
| 89 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
| 90 | <?php if ( ! empty( $plugin_updates ) ) : ?> |
| 91 | <?php $plugin_update_url = add_query_arg( array( |
| 92 | 's' => 'Give', |
| 93 | ), admin_url( '/plugins.php' ) ); ?> |
| 94 | <div id="give-plugin-updates"> |
| 95 | <div class="postbox-container"> |
| 96 | <div class="postbox"> |
| 97 | <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
| 98 | <div class="inside"> |
| 99 | <div class="panel-content"> |
| 100 | <p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p> |
| 101 | <?php include_once 'plugins-update-section.php'; ?> |
| 102 | </div> |
| 103 | </div> |
| 104 | <!-- .inside --> |
| 105 | </div><!-- .postbox --> |
| 106 | </div> |
| 107 | </div> |
| 108 | <?php endif; ?> |
| 109 | |
| 110 | </div> |
| 111 | </div> |