| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying content of setup wizard. |
| 4 |
* |
| 5 |
* @author ThimPres |
| 6 |
* @package LearnPress/Admin/Views |
| 7 |
* @version 3.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) or exit; |
| 11 |
$wizard = LP_Setup_Wizard::instance(); |
| 12 |
|
| 13 |
if ( ! isset( $steps ) ) { |
| 14 |
return; |
| 15 |
} |
| 16 |
?> |
| 17 |
|
| 18 |
<div id="main"> |
| 19 |
<div class="lp-setup-nav"> |
| 20 |
<ul class="lp-setup-steps"> |
| 21 |
<?php foreach ( $steps as $key => $step ) { ?> |
| 22 |
<li class="<?php echo esc_attr( $wizard->get_current_step() == $key ? 'active' : '' ); ?>"> |
| 23 |
<span><?php echo esc_html( $step['title'] ); ?></span> |
| 24 |
</li> |
| 25 |
<?php } ?> |
| 26 |
</ul> |
| 27 |
<div class="lp-setup-progress"> |
| 28 |
<div class="active" |
| 29 |
style="width: <?php echo intval( ( $wizard->get_step_position() + 1 ) / sizeof( $steps ) * 100 ); ?>%;"> |
| 30 |
</div> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
<form id="learn-press-setup-form" class="lp-setup-content" name="lp-setup" method="post"> |
| 34 |
<?php |
| 35 |
$step = $wizard->get_current_step( false ); |
| 36 |
?> |
| 37 |
<input type="hidden" name="lp-setup-nonce" |
| 38 |
value="<?php echo wp_create_nonce( 'lp-setup-step-' . $step['slug'] ); ?>"> |
| 39 |
<input type="hidden" name="lp-setup-step" |
| 40 |
value="<?php echo esc_attr( $step['slug'] ); ?>"> |
| 41 |
<?php call_user_func( $step['callback'] ); ?> |
| 42 |
<?php if ( ! $wizard->is_last_step() ) { ?> |
| 43 |
<div class="buttons"> |
| 44 |
<?php if ( ! $wizard->is_first_step() && ! ( array_key_exists( 'back_button', $step ) && $step['back_button'] === false ) ) { ?> |
| 45 |
<a class="button button-prev" href="<?php echo esc_url_raw( $wizard->get_prev_url() ); ?>"> |
| 46 |
<?php |
| 47 |
if ( ! empty( $step['next_button'] ) ) { |
| 48 |
echo wp_kses_post( $step['back_button'] ); |
| 49 |
} else { |
| 50 |
_e( 'Back', 'learnpress' ); |
| 51 |
} |
| 52 |
?> |
| 53 |
</a> |
| 54 |
<?php } ?> |
| 55 |
<?php if ( ! $wizard->is_last_step() && ! ( array_key_exists( 'next_button', $step ) && $step['next_button'] === false ) ) { ?> |
| 56 |
<a class="button button-next button-primary" href="<?php echo esc_url_raw( $wizard->get_next_url() ); ?>"> |
| 57 |
<?php |
| 58 |
if ( ! empty( $step['next_button'] ) ) { |
| 59 |
echo wp_kses_post( $step['next_button'] ); |
| 60 |
} else { |
| 61 |
_e( 'Continue', 'learnpress' ); |
| 62 |
} |
| 63 |
?> |
| 64 |
</a> |
| 65 |
<?php } else { ?> |
| 66 |
<a class="button button-finish"> |
| 67 |
<?php _e( 'Finish', 'learnpress' ); ?> |
| 68 |
</a> |
| 69 |
<?php } ?> |
| 70 |
</div> |
| 71 |
<?php } ?> |
| 72 |
</form> |
| 73 |
<span class="icon-loading"></span> |
| 74 |
</div> |
| 75 |
|