<?php if ( ! defined( 'ABSPATH' ) ) exit;
* @subpackage Admin/Upgrades
* @copyright Copyright (c) 2014, WP Ninjas
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
function nf_upgrades_screen() {
$action = isset( $_GET['nf-upgrade'] ) ? sanitize_text_field( $_GET['nf-upgrade'] ) : '';
$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
$total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false;
$custom = isset( $_GET['custom'] ) ? $_GET['custom'] : 0;
$form_id = isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0;
if ( is_string( $custom ) ) {
$custom = urlencode( $custom );
<h2><?php _e( 'Ninja Forms - Processing', 'ninja-forms' ); ?></h2>
<?php if( ! empty( $action ) ) : ?>
<div id="nf-upgrade-status">
<p><?php _e( 'The process has started, please be patient. This could take several minutes. You will be automatically redirected when the process is finished.', 'ninja-forms' ); ?></p>
<?php if( ! empty( $total ) ) : ?>
<p><strong><?php printf( __( 'Step %d of approximately %d running', 'ninja-forms' ), $step, $total + 1 ); ?></strong>
<span class="spinner" id="nf-upgrade-loader"/></span></p>
<script type="text/javascript">
document.location.href = "index.php?nf_action=<?php echo $action; ?>&step=<?php echo $step; ?>&total=<?php echo $total; ?>&custom=<?php echo $custom; ?>&form_id=<?php echo $form_id; ?>";
<div id="nf-upgrade-status">
<?php _e( 'The process has started, please be patient. This could take several minutes. You will be automatically redirected when the process is finished.', 'edd' ); ?>
<span class="spinner" id="nf-upgrade-loader"/></span>
<script type="text/javascript">
jQuery( document ).ready( function() {
// Trigger upgrades on page load
var data = { action: 'edd_trigger_upgrades' };
jQuery.post( ajaxurl, data, function (response) {
if( response == 'complete' ) {
jQuery('#nf-upgrade-loader').hide();
//document.location.href = 'index.php?page=edd-about'; // Redirect to the welcome page