| 1 |
<?php |
| 2 |
/** |
| 3 |
* Displays the wizard |
| 4 |
* |
| 5 |
* @package Polylang |
| 6 |
* |
| 7 |
* @since 2.7 |
| 8 |
* |
| 9 |
* @var array[] $steps { |
| 10 |
* List of steps. |
| 11 |
* |
| 12 |
* @type array { |
| 13 |
* List of step properties. |
| 14 |
* |
| 15 |
* @type string $name I18n string which names the step. |
| 16 |
* @type callable $view The callback function use to display the step content. |
| 17 |
* @type callable $handler The callback function use to process the step after it is submitted. |
| 18 |
* @type array $scripts List of script handles needed by the step. |
| 19 |
* @type array $styles The list of style handles needed by the step. |
| 20 |
* } |
| 21 |
* } |
| 22 |
* @var string $current_step Current step. |
| 23 |
* @var string[] $styles List of wizard page styles. |
| 24 |
*/ |
| 25 |
|
| 26 |
defined( 'ABSPATH' ) || exit; |
| 27 |
|
| 28 |
$admin_body_class = array( 'pll-wizard', 'wp-core-ui' ); |
| 29 |
if ( is_rtl() ) { |
| 30 |
$admin_body_class[] = 'rtl'; |
| 31 |
} |
| 32 |
?> |
| 33 |
<!DOCTYPE html> |
| 34 |
<html <?php language_attributes(); ?>> |
| 35 |
<head> |
| 36 |
<meta name="viewport" content="width=device-width" /> |
| 37 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 38 |
<title> |
| 39 |
<?php |
| 40 |
printf( |
| 41 |
/* translators: %s is the plugin name */ |
| 42 |
esc_html__( '%s › Setup', 'polylang' ), |
| 43 |
esc_html( POLYLANG ) |
| 44 |
); |
| 45 |
?> |
| 46 |
</title> |
| 47 |
<script> |
| 48 |
var ajaxurl = '<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ); ?>'; |
| 49 |
</script> |
| 50 |
<?php wp_print_scripts( $steps[ $current_step ]['scripts'] ); ?> |
| 51 |
<?php wp_print_styles( array_merge( $styles, $steps[ $current_step ]['styles'] ) ); ?> |
| 52 |
<?php do_action( 'admin_head' ); ?> |
| 53 |
</head> |
| 54 |
<body class="<?php echo join( ' ', array_map( 'sanitize_key', $admin_body_class ) ); ?>"> |
| 55 |
<h1 id="pll-logo"> |
| 56 |
<a href="https://polylang.pro/" class="title"> |
| 57 |
<span><img src="<?php echo esc_url( plugins_url( '/src/modules/wizard/images/polylang-logo.png', POLYLANG_FILE ) ); ?>" /></span> |
| 58 |
<?php echo esc_html( POLYLANG ); ?> |
| 59 |
</a> |
| 60 |
</h1> |
| 61 |
<ol class="pll-wizard-steps"> |
| 62 |
<?php |
| 63 |
foreach ( $steps as $step_key => $step ) { |
| 64 |
$is_completed = array_search( $current_step, array_keys( $steps ), true ) > array_search( $step_key, array_keys( $steps ), true ); |
| 65 |
|
| 66 |
if ( $step_key === $current_step ) { |
| 67 |
?> |
| 68 |
<li class="active"><?php echo esc_html( $step['name'] ); ?></li> |
| 69 |
<?php |
| 70 |
} elseif ( $is_completed ) { |
| 71 |
?> |
| 72 |
<li class="done"> |
| 73 |
<a |
| 74 |
href="<?php echo esc_url( add_query_arg( 'step', $step_key, remove_query_arg( 'activate_error' ) ) ); ?>" |
| 75 |
> |
| 76 |
<?php echo esc_html( $step['name'] ); ?> |
| 77 |
</a> |
| 78 |
</li> |
| 79 |
<?php |
| 80 |
} else { |
| 81 |
?> |
| 82 |
<li><?php echo esc_html( $step['name'] ); ?></li> |
| 83 |
<?php |
| 84 |
} |
| 85 |
} |
| 86 |
?> |
| 87 |
</ol> |
| 88 |
<div class="pll-wizard-content"> |
| 89 |
<form method="post" class="<?php echo esc_attr( "{$current_step}-step" ); ?>"> |
| 90 |
<?php |
| 91 |
wp_nonce_field( 'pll-wizard', '_pll_nonce' ); |
| 92 |
|
| 93 |
if ( ! empty( $steps[ $current_step ]['view'] ) ) { |
| 94 |
call_user_func( $steps[ $current_step ]['view'] ); |
| 95 |
} |
| 96 |
?> |
| 97 |
<?php if ( 'last' !== $current_step ) : ?> |
| 98 |
<p class="pll-wizard-actions step"> |
| 99 |
<button |
| 100 |
type="submit" |
| 101 |
class="button-primary button button-large button-next" |
| 102 |
value="continue" |
| 103 |
name="save_step" |
| 104 |
> |
| 105 |
<?php esc_html_e( 'Continue', 'polylang' ); ?><span class="dashicons dashicons-arrow-right-alt2"></span> |
| 106 |
</button> |
| 107 |
</p> |
| 108 |
<?php endif; ?> |
| 109 |
</form> |
| 110 |
</div> |
| 111 |
<div class="pll-wizard-footer"> |
| 112 |
<?php if ( 'last' !== $current_step ) : ?> |
| 113 |
<a |
| 114 |
class="pll-wizard-footer-links" |
| 115 |
href="<?php echo esc_url( admin_url() ); ?>" |
| 116 |
> |
| 117 |
<?php esc_html_e( 'Not right now', 'polylang' ); ?> |
| 118 |
</a> |
| 119 |
<?php endif; ?> |
| 120 |
</div> |
| 121 |
</body> |
| 122 |
</html> |
| 123 |
|