|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Class responsible for creating the welcome walkthrough on the editor |
|
4
|
|
|
* |
|
5
|
|
|
* @since 0.6 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace lasso_public_facing; |
|
9
|
|
|
|
|
10
|
|
|
class tour { |
|
11
|
|
|
|
|
12
|
|
|
public function __construct() { |
|
13
|
|
|
|
|
14
|
|
|
add_action( 'wp_footer', array( $this, 'draw_tour' ) ); |
|
15
|
|
|
|
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Draw the modal used to house the walk through |
|
20
|
|
|
* @since 0.6 |
|
21
|
|
|
*/ |
|
22
|
|
|
public function draw_tour() { |
|
23
|
|
|
|
|
24
|
|
|
$tour_hidden = get_user_meta( get_current_user_ID(), 'lasso_hide_tour', true ); |
|
25
|
|
|
|
|
26
|
|
|
if ( lasso_user_can() && !$tour_hidden ) { |
|
27
|
|
|
|
|
28
|
|
|
global $post; |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
$nonce = wp_create_nonce( 'lasso-editor-tour' ); |
|
31
|
|
|
|
|
32
|
|
|
// let users add custom css classes |
|
33
|
|
|
$custom_classes = apply_filters( 'lasso_modal_tour_classes', '' ); |
|
34
|
|
|
|
|
35
|
|
|
?> |
|
36
|
|
|
<div id="lasso--tour__modal" class="lasso--modal lasso--tour__modal lasso--modal__checkbox <?php echo sanitize_html_class( $custom_classes );?>"> |
|
37
|
|
|
<div class="lasso--modal__inner"> |
|
38
|
|
|
|
|
39
|
|
|
<?php echo self::tour_slides();?> |
|
40
|
|
|
|
|
41
|
|
|
<div class="lasso--postsettings__footer"> |
|
42
|
|
|
|
|
43
|
|
|
<div class="lasso--postsettings__option"> |
|
44
|
|
|
<label for="hide_tour" class="checkbox-control checkbox"> |
|
45
|
|
|
<input type="checkbox" id="hide_tour" name="hide_tour" <?php checked( $tour_hidden, 1 ); ?>> |
|
46
|
|
|
<span class="control-indicator"></span> |
|
47
|
|
|
<?php _e('Don\'t show this again','lasso');?> |
|
48
|
|
|
</label> |
|
49
|
|
|
</div> |
|
50
|
|
|
|
|
51
|
|
|
<input type="submit" value="<?php _e( 'Okay, got it!', 'lasso' );?>" data-nonce="<?php echo $nonce;?>" > |
|
52
|
|
|
</div> |
|
53
|
|
|
|
|
54
|
|
|
</div> |
|
55
|
|
|
|
|
56
|
|
|
</div> |
|
57
|
|
|
<div id="lasso--modal__overlay"></div> |
|
58
|
|
|
<?php |
|
59
|
|
|
|
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Draw the inner slides for the welcome walkthrough |
|
65
|
|
|
* @since 0.6 |
|
66
|
|
|
*/ |
|
67
|
|
|
public function tour_slides() { ?> |
|
68
|
|
|
|
|
69
|
|
|
<div id="lasso--loading" class="lasso--loading"><div class="lasso--loader"></div></div> |
|
70
|
|
|
<div id="lasso--tour__slides"> |
|
71
|
|
|
|
|
72
|
|
|
<?php |
|
73
|
|
|
|
|
74
|
|
|
$out = '<ul><li>'; |
|
75
|
|
|
$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-1.jpg' ); |
|
76
|
|
|
$out .= '<p>'.__('Access posts by clicking the list icon. Create a new post by clicking the new post icon.','lasso').'</p>'; |
|
77
|
|
|
$out .= '</li><li>'; |
|
78
|
|
|
$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-2.jpg' ); |
|
79
|
|
|
$out .= '<p>'.__('While on a single post, edit by clicking the Pen icon. Access post settings with the settings icon. Press escape to exit any modal.','lasso').'</p>'; |
|
80
|
|
|
$out .= '</li><li>'; |
|
81
|
|
|
$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-3.jpg' ); |
|
82
|
|
|
$out .= '<p>'.__('Highlight a piece of text, and click on a formatting option to style it. Click the Disk icon or CMD-S to save. Click the orange "X" button to exit the editor.','lasso').'</p>'; |
|
83
|
|
|
$out .= '</li><li>'; |
|
84
|
|
|
$out .= sprintf( '<img src="%s">', LASSO_URL.'/public/assets/img/s-4.jpg' ); |
|
85
|
|
|
$out .= '<p>'.__('Story components can be added by clicking the plus icon, and dragging any component from the component tray into the story.','lasso').'</p>'; |
|
86
|
|
|
$out .= '</li></ul>'; |
|
87
|
|
|
|
|
88
|
|
|
echo apply_filters( 'lasso_tour_slides', $out ); |
|
89
|
|
|
|
|
90
|
|
|
?></div><?php |
|
91
|
|
|
|
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
} |
|
95
|
|
|
|
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state