PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | inc/admin/views/setup/content.php +104 -74 4.3.94.4.8 View file →
@@ -1,74 +1,104 @@
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>
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 +$current_step = $wizard->get_current_step();
18 +$is_welcome_step = 'welcome' === $current_step;
19 +$is_finish_step = 'finish' === $current_step;
20 +$next_url = $is_finish_step ? admin_url( 'index.php' ) : $wizard->get_next_url();
21 +$main_class = $is_welcome_step ? 'lp-setup-main--welcome' : 'lp-setup-main--wizard';
22 +$wizard_steps = array();
23 +
24 +foreach ( $steps as $step_key => $step_data ) {
25 + if ( 'welcome' !== $step_key ) {
26 + $wizard_steps[ $step_key ] = $step_data;
27 + }
28 +}
29 +
30 +$wizard_step_keys = array_keys( $wizard_steps );
31 +?>
32 +
33 +<div id="main" class="<?php echo esc_attr( $main_class ); ?>">
34 + <form id="learn-press-setup-form" class="lp-setup-content lp-setup-wizard-form" name="lp-setup" method="post">
35 + <?php
36 + $step = $wizard->get_current_step( false );
37 + ?>
38 + <input type="hidden" name="lp-setup-step"
39 + value="<?php echo esc_attr( $step['slug'] ); ?>">
40 + <?php call_user_func( $step['callback'] ); ?>
41 + <?php if ( ! $wizard->is_last_step() || $is_finish_step ) { ?>
42 + <?php if ( $is_welcome_step ) { ?>
43 + <div class="buttons">
44 + <button type="button" class="lp-button button button-next button-primary" data-next-url="<?php echo esc_url( $next_url ); ?>">
45 + <span class="lp-setup-button__label"><?php echo wp_kses_post( $step['next_button'] ); ?></span>
46 + </button>
47 + <a class="button-dismiss-setup" href="<?php echo esc_url( admin_url( 'index.php' ) ); ?>">
48 + <?php esc_html_e( 'Dismiss Setup Wizard', 'learnpress' ); ?>
49 + </a>
50 + </div>
51 + <?php } else { ?>
52 + <div class="lp-setup-footer-bar">
53 + <div class="lp-setup-footer-bar__back">
54 + <?php if ( ! $is_finish_step && ! ( array_key_exists( 'back_button', $step ) && false === $step['back_button'] ) ) { ?>
55 + <a class="lp-button button button-prev" href="<?php echo esc_url( $wizard->get_prev_url() ); ?>">
56 + <?php echo ! empty( $step['back_button'] ) ? wp_kses_post( $step['back_button'] ) : esc_html__( 'Back', 'learnpress' ); ?>
57 + </a>
58 + <?php } ?>
59 + </div>
60 +
61 + <ol class="lp-setup-stepper" aria-label="<?php esc_attr_e( 'Setup progress', 'learnpress' ); ?>">
62 + <?php
63 + $current_position = array_search( $current_step, $wizard_step_keys, true );
64 + foreach ( $wizard_steps as $step_key => $step_data ) {
65 + $step_position = array_search( $step_key, $wizard_step_keys, true );
66 + $item_class = 'lp-setup-stepper__item';
67 + if ( $step_key === $current_step ) {
68 + $item_class .= ' is-active';
69 + } elseif ( false !== $current_position && $step_position < $current_position ) {
70 + $item_class .= ' is-complete';
71 + }
72 + ?>
73 + <li class="<?php echo esc_attr( $item_class ); ?>">
74 + <span class="lp-setup-stepper__number">
75 + <?php if ( false !== strpos( $item_class, 'is-complete' ) ) { ?>
76 + <span class="lp-icon-check" aria-hidden="true"></span>
77 + <?php } else { ?>
78 + <?php echo esc_html( $step_position + 1 ); ?>
79 + <?php } ?>
80 + </span>
81 + <span class="lp-setup-stepper__label"><?php echo esc_html( $step_data['title'] ); ?></span>
82 + </li>
83 + <?php } ?>
84 + </ol>
85 +
86 + <div class="lp-setup-footer-bar__controls">
87 + <?php if ( $is_finish_step ) { ?>
88 + <button type="button" class="lp-button button button-next button-primary" data-next-url="<?php echo esc_url( $next_url ); ?>">
89 + <span class="lp-setup-button__label"><?php esc_html_e( 'Go to Dashboard', 'learnpress' ); ?></span>
90 + </button>
91 + <?php } else { ?>
92 + <a class="lp-button button-link button-skip-next" href="<?php echo esc_url( $next_url ); ?>">
93 + <?php esc_html_e( 'Skip this step', 'learnpress' ); ?>
94 + </a>
95 + <button type="button" class="lp-button button button-next button-primary" data-next-url="<?php echo esc_url( $next_url ); ?>">
96 + <span class="lp-setup-button__label"><?php echo ! empty( $step['next_button'] ) ? wp_kses_post( $step['next_button'] ) : esc_html__( 'Next', 'learnpress' ); ?></span>
97 + </button>
98 + <?php } ?>
99 + </div>
100 + </div>
101 + <?php } ?>
102 + <?php } ?>
103 + </form>
104 +</div>