示例#1
0
/**
 * Display an ordered list of steps
 */
function wpem_template_list_steps()
{
    $steps = \WPEM\wpem()->admin->get_steps();
    $count = count($steps);
    $current_step = wpem_get_current_step();
    $before_current_step = true;
    echo '<ol class="wpem-steps-list">';
    foreach ($steps as $i => $step) {
        $classes = ['wpem-steps-list-item', sprintf('wpem-steps-list-item-%d', $step->position), sprintf('wpem-steps-list-item-%s', $step->name)];
        if (0 === $i) {
            $classes[] = 'first-step';
        }
        if ($count === $i + 1) {
            $classes[] = 'last-step';
        }
        if ($step->name === $current_step->name) {
            $before_current_step = false;
            $classes[] = 'active-step';
        }
        if ($current_step->position > $i + 1) {
            $classes[] = 'done-step';
        }
        $classes = array_map('trim', $classes);
        // Last iteration step
        $last_i_step = 0 === $i ? $step : $steps[$i - 1];
        $content = esc_html($step->title);
        // We add a link if last step is the current step and we can skip it
        if ($last_i_step->name === $current_step->name && $last_i_step->can_skip || $before_current_step) {
            $content = sprintf('<a href="%s">%s</a>', esc_url($step->url), $content);
        }
        printf('<li class="%s">%s</li>', implode(' ', array_map('esc_attr', $classes)), $content);
    }
    echo '</ol>';
}
示例#2
0
?>
">

	<title><?php 
wpem_template_title();
?>
</title>

	<?php 
wpem_template_head();
?>

	<style type="text/css">
	.wpem-steps-list li {
		width: <?php 
echo wpem_round(100 / count(\WPEM\wpem()->admin->get_steps()), 2);
?>
%;
	}
	</style>

	<?php 
wp_print_scripts('jquery');
?>

	<!--[if lte IE 9]>
		<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
		<script src="//cdnjs.cloudflare.com/ajax/libs/webshim/1.15.10/dev/polyfiller.js"></script>
		<script type="text/javascript">
			jQuery.webshim.setOptions( 'extendNative', true );
			jQuery.webshim.polyfill( 'forms' );
示例#3
0
/**
 * Mark the wizard as done
 */
function wpem_mark_as_done()
{
    delete_option('wpem_last_viewed');
    update_option('wpem_done', 1);
    \WPEM\wpem()->self_destruct();
    \WPEM\wpem()->deactivate();
}