/var/www/(Del)hsihk.com/wp-content/plugins/ninja-forms/includes/admin/upgrades/upgrades.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/**
 * Upgrade Screen
 *
 * @package     Ninja Forms
 * @subpackage  Admin/Upgrades
 * @copyright   Copyright (c) 2014, WP Ninjas
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       2.7
 */

// Exit if accessed directly
if ( !defined'ABSPATH' ) ) exit;

/**
 * Render Upgrades Screen
 *
 * @since 2.7
 * @return void
*/
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 );
    }

    
?> 
    <div class="wrap">
        <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 ); ?></strong>
                    <span class="spinner" id="nf-upgrade-loader"/></span></p>
                <?php endif; ?>
            </div>
            <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?>";
            </script>

        <?php else : ?>

            <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.''edd' ); ?>
                    <span class="spinner" id="nf-upgrade-loader"/></span>
                </p>
            </div>
            <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
                        }
                    });
                });
            </script>

        <?php endif; ?>

    </div>
    <?php
}