1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* These functions are then localized and then appended with JS in enter-editor.js |
5
|
|
|
* |
6
|
|
|
* @since 1.0 |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Add the editor controls to any singular post object |
11
|
|
|
* |
12
|
|
|
* @since 1.0 |
13
|
|
|
*/ |
14
|
|
|
add_action( 'wp_footer', 'lasso_editor_controls' ); |
15
|
|
|
function lasso_editor_controls() { |
16
|
|
|
|
17
|
|
|
global $post; |
18
|
|
|
|
19
|
|
|
if ( lasso_user_can('edit_posts') ) { |
20
|
|
|
|
21
|
|
|
$status = get_post_status( get_the_ID() ); |
22
|
|
|
$button_color1 = lasso_editor_get_option('button-color1', 'lasso_editor','#0000ff'); |
23
|
|
|
$button_color2 = lasso_editor_get_option('button-color2', 'lasso_editor','#0000'); |
24
|
|
|
$dialog_color = lasso_editor_get_option('dialog-color', 'lasso_editor','#000055'); |
25
|
|
|
$text_color = lasso_editor_get_option('text-color', 'lasso_editor','#ffffff'); |
26
|
|
|
$hover_color1 = lasso_editor_adjustBrightness($button_color1, 50); |
27
|
|
|
$hover_color2 = lasso_editor_adjustBrightness($button_color2, 50); |
28
|
|
|
|
29
|
|
|
// let users add custom css classes |
30
|
|
|
$custom_classes = apply_filters( 'lasso_control_classes', '' ); |
31
|
|
|
|
32
|
|
|
$post_access_class = ''; |
33
|
|
|
$post_new_disabled = lasso_editor_get_option( 'post_adding_disabled', 'lasso_editor' ); |
34
|
|
|
$post_settings_disabled = lasso_editor_get_option( 'post_settings_disabled', 'lasso_editor' ); |
35
|
|
|
$shortcodify_disabled = lasso_editor_get_option( 'shortcodify_disabled', 'lasso_editor' ); |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
// CSS class if adding new post objects is disabled |
39
|
|
|
if ( 'on' == $post_new_disabled ) { $post_access_class = 'lasso--post-new-disabled'; } |
40
|
|
|
|
41
|
|
|
// CSS class if adjust settings is disabled |
42
|
|
|
if ( 'on' == $post_settings_disabled ) { $post_access_class = 'lasso--post-settings-disabled'; } |
43
|
|
|
|
44
|
|
|
// CSS class if adding new post objects AND settings are disabled |
45
|
|
|
if ( 'on' == $post_new_disabled && 'on' == $post_settings_disabled ) { $post_access_class = 'lasso--post-all-disabled'; } |
46
|
|
|
|
47
|
|
|
// CSS class if shortcodify or (Aesop Shortcode Conversion) is disabled |
48
|
|
|
$sc_saving_class = 'on' == $shortcodify_disabled ? 'shortcodify-disabled' : 'shortcodify-enabled'; |
49
|
|
|
|
50
|
|
|
// user is capable |
51
|
|
|
$is_capable = is_singular() && lasso_user_can('edit_post'); |
52
|
|
|
$is_mobile = wp_is_mobile(); |
53
|
|
|
|
54
|
|
|
$mobile_style = $is_mobile ? 'style="bottom:0px;"' : null; |
55
|
|
|
$can_publish = lasso_user_can('publish_posts') || lasso_user_can('publish_pages'); |
56
|
|
|
|
57
|
|
|
|
58
|
|
|
?> |
59
|
|
|
<style> |
60
|
|
|
.lasso-editor-controls--wrap, #lasso--post-settings2,#lasso--save,#lasso--exit,#lasso--publish { |
61
|
|
|
background-image: -webkit-linear-gradient(top,<?php echo $button_color1;?> 0,<?php echo $button_color2;?> 100%); |
62
|
|
|
background-image: -o-linear-gradient(top,<?php echo $button_color1;?> 0,<?php echo $button_color2;?> 100%); |
63
|
|
|
background-image: linear-gradient(to bottom,<?php echo $button_color1;?> 0,<?php echo $button_color2;?> 100%); |
64
|
|
|
color: <?php echo $text_color;?>; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
.lasso--controls__right a:before, #lasso-toolbar--html__footer_desc { |
68
|
|
|
color: <?php echo $text_color;?> !important; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
ul.lasso-editor-controls li:hover, #lasso--exit:hover,#lasso--post-settings2:hover,#lasso--publish:hover,#lasso--save:hover { |
72
|
|
|
background-image: -webkit-linear-gradient(top,<?php echo $hover_color1;?> 0,<?php echo $hover_color2;?> 100%); |
73
|
|
|
background-image: -o-linear-gradient(top,<?php echo $hover_color1;?> 0,<?php echo $hover_color2;?> 100%); |
74
|
|
|
background-image: linear-gradient(to bottom,<?php echo $hover_color1;?> 0,<?php echo $hover_color2;?> 100%); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
.lasso--modal__inner,.sweet-alert,#lasso-toolbar--components.toolbar--drop-up ul,#lasso-toolbar--components__list,#lasso-toolbar--html.html--drop-up #lasso-toolbar--html__wrap, |
78
|
|
|
#lasso-toolbar--link.link--drop-up #lasso-toolbar--link__wrap { |
79
|
|
|
background: <?php echo $dialog_color;?>; |
80
|
|
|
color: <?php echo $text_color;?>; |
81
|
|
|
} |
82
|
|
|
.sweet-alert p,.lasso--modal__inner label,.lasso--toolbar__inner label { |
83
|
|
|
color: <?php echo $text_color;?> !important; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
<?php if (!$is_mobile)?> |
87
|
|
|
.lasso-editor-controls--wrap { |
88
|
|
|
display:table; |
89
|
|
|
} |
90
|
|
|
ul.lasso-editor-controls { |
91
|
|
|
height:42px; |
92
|
|
|
font-size: 22px; |
93
|
|
|
} |
94
|
|
|
.lasso-editor-controls--wrap { |
95
|
|
|
height:42px; |
96
|
|
|
} |
97
|
|
|
#lasso--post-all:before { |
98
|
|
|
font-size: 22px; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
ul.lasso-editor-controls li { |
102
|
|
|
height: 42px; |
103
|
|
|
} |
104
|
|
|
<?php}?> |
|
|
|
|
105
|
|
|
</style> |
106
|
|
|
<div id="lasso--controls" class="lasso-post-status--<?php echo sanitize_html_class( $status );?> <?php echo sanitize_html_class( $custom_classes );?>" data-post-id="<?php echo get_the_ID();?>" > |
107
|
|
|
|
108
|
|
|
<ul class="lasso--controls__center lasso-editor-controls lasso-editor-controls--wrap <?php echo $post_access_class;?> " <?php echo $mobile_style ?> > |
109
|
|
|
|
110
|
|
|
<?php do_action( 'lasso_editor_controls_before' ); |
111
|
|
|
|
112
|
|
|
if ( $is_capable ) { ?> |
113
|
|
|
|
114
|
|
|
<li id="lasso--edit" title="<?php esc_attr_e( 'Edit Post', 'lasso' );?>"><a href="#" class="lasso--button__primary"></a></li> |
115
|
|
|
|
116
|
|
|
<?php if ( 'off' == $post_settings_disabled || empty( $post_settings_disabled ) ) { ?> |
117
|
|
|
<li id="lasso--post-settings" title="<?php esc_attr_e( 'Post Settings', 'lasso' );?>"><a href="#" class="lasso--button__primary"></a></li> |
118
|
|
|
<?php } |
119
|
|
|
|
120
|
|
|
} ?> |
121
|
|
|
|
122
|
|
|
<li id="lasso--post-all" title="<?php esc_attr_e( 'All Posts', 'lasso' );?>"><a href="#" class="lasso--button__primary"></a></li> |
123
|
|
|
|
124
|
|
|
<?php if ( $is_capable && wp_revisions_enabled( $post ) ) { ?> |
125
|
|
|
<li id="lasso--post-revisions" title="<?php esc_attr_e( 'Revisions', 'lasso' );?>"><a href="#" class="lasso--button__primary"></a></li> |
126
|
|
|
<?php } ?> |
127
|
|
|
|
128
|
|
|
<?php if ( ( 'off' == $post_new_disabled || empty( $post_new_disabled ) && lasso_user_can('edit_posts') ) ) { ?> |
129
|
|
|
<li id="lasso--post-new" title="<?php esc_attr_e( 'Add Post', 'lasso' );?>"><a href="#" class="lasso--button__primary"></a></li> |
130
|
|
|
<?php } ?> |
131
|
|
|
|
132
|
|
|
<?php do_action( 'lasso_editor_controls_after' );?> |
133
|
|
|
|
134
|
|
|
</ul> |
135
|
|
|
|
136
|
|
|
<?php if ( is_singular() && !$is_mobile ) { ?> |
137
|
|
|
|
138
|
|
|
<div class="lasso--controls__right" data-posttype="<?php echo get_post_type( get_the_ID() );?>" data-status="<?php echo $status;?>"> |
139
|
|
|
|
140
|
|
|
<a href="#" title="<?php esc_attr_e( 'Post Settings', 'lasso' );?>" id="lasso--post-settings2" class="lasso-save-post lasso--button <?php echo $sc_saving_class;?>"></a> |
141
|
|
|
|
142
|
|
|
|
143
|
|
|
<a href="#" title="<?php esc_attr_e( 'Save Post', 'lasso' );?>" id="lasso--save" class="lasso-save-post lasso--button <?php echo $sc_saving_class;?>"></a> |
144
|
|
|
|
145
|
|
|
<?php if ( ('draft' == $status ) || ('pending' == $status && $can_publish) ) { ?> |
146
|
|
|
<a href="#" title="<?php $can_publish ? esc_attr_e( 'Publish Post', 'lasso' ) : esc_attr_e( 'Submit For Review', 'lasso' );?>" id="lasso--publish" class="lasso-publish-post lasso--button <?php echo $sc_saving_class;?>"></a> |
147
|
|
|
<?php } ?> |
148
|
|
|
|
149
|
|
|
</div> |
150
|
|
|
|
151
|
|
|
<?php } ?> |
152
|
|
|
|
153
|
|
|
</div> |
154
|
|
|
|
155
|
|
|
<?php } |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Draw the side panel that houses the component settings |
160
|
|
|
* This is opened when the settings icon is clicked on a single component |
161
|
|
|
* JS detects the type and will fill in the necessary options for the shortcode based on lasso_editor_options_blob() at the end of this file |
162
|
|
|
* |
163
|
|
|
* @since 1.0 |
164
|
|
|
*/ |
165
|
|
|
function lasso_editor_component_sidebar() { |
166
|
|
|
|
167
|
|
|
ob_start(); |
168
|
|
|
|
169
|
|
|
|
170
|
|
|
// let users add custom css classes |
171
|
|
|
$custom_classes = apply_filters( 'lasso_sidebar_classes', '' ); |
172
|
|
|
?> |
173
|
|
|
<div id="lasso--sidebar" class="<?php echo sanitize_html_class( $custom_classes );?>" > |
174
|
|
|
<div class="lasso--sidebar__inner"> |
175
|
|
|
<div id="lasso--component__settings"></div> |
176
|
|
|
</div> |
177
|
|
|
</div> |
178
|
|
|
|
179
|
|
|
<?php return ob_get_clean(); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Draw the main toolbar used to edit the text |
184
|
|
|
* |
185
|
|
|
* @since 1.0 |
186
|
|
|
*/ |
187
|
|
|
function lasso_editor_text_toolbar() { |
188
|
|
|
|
189
|
|
|
ob_start(); |
190
|
|
|
|
191
|
|
|
|
192
|
|
|
$is_mobile = wp_is_mobile(); |
193
|
|
|
|
194
|
|
|
// check for lasso story engine and add a class doniting this |
195
|
|
|
$ase_status = class_exists( 'Aesop_Core' ) || defined( 'LASSO_CUSTOM' ) ? 'ase-active' : 'ase-not-active'; |
196
|
|
|
|
197
|
|
|
// let users add custom css classes |
198
|
|
|
$custom_classes = apply_filters( 'lasso_toolbar_classes', '' ); |
199
|
|
|
|
200
|
|
|
// are toolbar headings enabled |
201
|
|
|
$toolbar_headings = lasso_editor_get_option( 'toolbar_headings', 'lasso_editor' ); |
202
|
|
|
$toolbar_headings_h4 = lasso_editor_get_option( 'toolbar_headings_h4', 'lasso_editor' ); |
203
|
|
|
|
204
|
|
|
$toolbar_class = $toolbar_headings ? 'toolbar-extended' : false; |
205
|
|
|
|
206
|
|
|
// mobile styles |
207
|
|
|
$mobile_class = $is_mobile ? 'lasso-mobile' : false; |
208
|
|
|
$mobile_style =$is_mobile ? 'style="bottom:0px;"' : null; |
209
|
|
|
|
210
|
|
|
//show color |
211
|
|
|
$show_color = lasso_editor_get_option('toolbar_show_color', 'lasso_editor'); |
212
|
|
|
|
213
|
|
|
//show alignment |
214
|
|
|
$show_align = lasso_editor_get_option('toolbar_show_alignment', 'lasso_editor'); |
215
|
|
|
|
216
|
|
|
$status = get_post_status( get_the_ID() ); |
217
|
|
|
|
218
|
|
|
|
219
|
|
|
?> |
220
|
|
|
<div class="lasso--toolbar_wrap lasso-editor-controls--wrap <?php echo $toolbar_class.' '.$mobile_class.' '.$ase_status.' '.sanitize_html_class( $custom_classes );?>" <?php echo $mobile_style ?>> |
221
|
|
|
<ul class="lasso--toolbar__inner lasso-editor-controls" <?php if ($is_mobile) {echo 'style="float:left;"';}?>> |
222
|
|
|
<?php do_action( 'lasso_toolbar_components_before' );?> |
223
|
|
|
<li id="lasso-toolbar--bold" title="<?php esc_attr_e( 'Bold', 'lasso' );?>"></li> |
224
|
|
|
<li id="lasso-toolbar--underline" title="<?php esc_attr_e( 'Underline', 'lasso' );?>"></li> |
225
|
|
|
<li id="lasso-toolbar--italic" title="<?php esc_attr_e( 'Italicize', 'lasso' );?>"></li> |
226
|
|
|
<li id="lasso-toolbar--strike" title="<?php esc_attr_e( 'Strikethrough', 'lasso' );?>"></li> |
227
|
|
|
<li id="lasso-toolbar--components" title="<?php esc_attr_e( 'Insert Component', 'lasso' );?>" style="color:#ffffa0;"> |
228
|
|
|
<ul id="lasso-toolbar--components__list" style="display:none;color:white;"> |
229
|
|
|
<?php if ( 'ase-active' == $ase_status ): ?> |
230
|
|
|
<li data-type="image" title="<?php esc_attr_e( 'Image', 'lasso' );?>" class="lasso-toolbar--component__image"></li> |
231
|
|
|
<li data-type="character" title="<?php esc_attr_e( 'Character', 'lasso' );?>" class="lasso-toolbar--component__character"></li> |
232
|
|
|
<li data-type="quote" title="<?php esc_attr_e( 'Quote', 'lasso' );?>" class="lasso-toolbar--component__quote"></li> |
233
|
|
|
<li data-type="content" title="<?php esc_attr_e( 'Content', 'lasso' );?>" class="lasso-toolbar--component__content"></li> |
234
|
|
|
<li data-type="chapter" title="<?php esc_attr_e( 'Chapter', 'lasso' );?>" class="lasso-toolbar--component__chapter"></li> |
235
|
|
|
<li data-type="parallax" title="<?php esc_attr_e( 'Parallax', 'lasso' );?>" class="lasso-toolbar--component__parallax"></li> |
236
|
|
|
<li data-type="audio" title="<?php esc_attr_e( 'Audio', 'lasso' );?>" class="lasso-toolbar--component__audio"></li> |
237
|
|
|
<li data-type="video" title="<?php esc_attr_e( 'Video', 'lasso' );?>" class="lasso-toolbar--component__video"></li> |
238
|
|
|
<li data-type="map" title="<?php esc_attr_e( 'Map', 'lasso' );?>" class="lasso-toolbar--component__map"></li> |
239
|
|
|
<li data-type="timeline_stop" title="<?php esc_attr_e( 'Timeline', 'lasso' );?>" class="lasso-toolbar--component__timeline"></li> |
240
|
|
|
<li data-type="document" title="<?php esc_attr_e( 'Document', 'lasso' );?>" class="lasso-toolbar--component__document"></li> |
241
|
|
|
<li data-type="collection" title="<?php esc_attr_e( 'Collection', 'lasso' );?>" class="lasso-toolbar--component__collection"></li> |
242
|
|
|
<li data-type="gallery" title="<?php esc_attr_e( 'Gallery', 'lasso' );?>" class="lasso-toolbar--component__gallery"></li> |
243
|
|
|
<?php if ( class_exists ('Aesop_GalleryPop') ) { ?> |
244
|
|
|
<li data-type="gallery" title="<?php esc_attr_e( 'Gallery Pop', 'lasso' );?>" class="lasso-toolbar--component__gallerypop"></li> |
245
|
|
|
<?php }?> |
246
|
|
|
<?php if ( class_exists ('Aesop_Events') ) { ?> |
247
|
|
|
<li data-type="events" title="<?php esc_attr_e( 'Event', 'lasso' );?>" class="lasso-toolbar--component__event"></li> |
248
|
|
|
<?php }?> |
249
|
|
|
<?php else: ?> |
250
|
|
|
<li data-type="wpimg" title="<?php esc_attr_e( 'WordPress Image', 'lasso' );?>" class="image lasso-toolbar--component__image"></li> |
251
|
|
|
<li data-type="wpquote" title="<?php esc_attr_e( 'WordPress Quote', 'lasso' );?>" class="quote lasso-toolbar--component__quote"></li> |
252
|
|
|
<!--li data-type="wpvideo" title="<?php esc_attr_e( 'WordPress Video', 'lasso' );?>" class="video lasso-toolbar--component__video"></li--> |
253
|
|
|
<?php endif; ?> |
254
|
|
|
<?php do_action( 'lasso_toolbar_components' );?> |
255
|
|
|
</ul> |
256
|
|
|
</li> |
257
|
|
|
<?php if ( $toolbar_headings ): ?> |
258
|
|
|
<li id="lasso-toolbar--h2" title="<?php esc_attr_e( 'H2 Heading', 'lasso' );?>"></li> |
259
|
|
|
<li id="lasso-toolbar--h3" title="<?php esc_attr_e( 'H3 Heading', 'lasso' );?>"></li> |
260
|
|
|
<?php endif; ?> |
261
|
|
|
<?php if ( $toolbar_headings_h4 ): ?> |
262
|
|
|
<li id="lasso-toolbar--h4" title="<?php esc_attr_e( 'H4 Heading', 'lasso' );?>"></li> |
263
|
|
|
<li id="lasso-toolbar--h5" title="<?php esc_attr_e( 'H5 Heading', 'lasso' );?>"></li> |
264
|
|
|
<li id="lasso-toolbar--h6" title="<?php esc_attr_e( 'H6 Heading', 'lasso' );?>"></li> |
265
|
|
|
<?php endif; ?> |
266
|
|
|
|
267
|
|
|
<?php if ( $show_color ): ?> |
268
|
|
|
<li id="lasso-toolbar--color-set" title="<?php esc_attr_e( 'Set Color for Selected Text', 'lasso' );?>"></li> |
269
|
|
|
<li id="lasso-toolbar--color-pick" title="<?php esc_attr_e( 'Choose Color', 'lasso' );?>"></li> |
270
|
|
|
<?php endif; ?> |
271
|
|
|
|
272
|
|
|
|
273
|
|
|
<li id="lasso-toolbar--link" title="<?php esc_attr_e( 'Anchor Link', 'lasso' );?>"> |
274
|
|
|
<div id="lasso-toolbar--link__wrap" <?php echo $mobile_style ?> > |
275
|
|
|
<div id="lasso-toolbar--link__inner" contenteditable="true" placeholder="<?php esc_attr_e( 'http://url.com', 'lasso' );?>"></div> |
276
|
|
|
<a href="#" title="<?php esc_attr_e( 'Create Link', 'lasso' );?>" class="lasso-toolbar--link__control" id="lasso-toolbar--link__create" ></a> |
277
|
|
|
<input class="styled-checkbox" type="checkbox" id="aesop-toolbar--link_newtab" checked/> |
278
|
|
|
<label for="aesop-toolbar--link_newtab"><?php esc_attr_e( 'Open in a New Tab', 'lasso' );?></label> |
279
|
|
|
</div> |
280
|
|
|
</li> |
281
|
|
|
<?php do_action( 'lasso_toolbar_components_after' );?> |
282
|
|
|
<li id="lasso-toolbar--html" title="<?php esc_attr_e( 'Insert HTML or Code', 'lasso' );?>"> |
283
|
|
|
<div id="lasso-toolbar--html__wrap" <?php echo $mobile_style ?>> |
284
|
|
|
<div id="lasso-toolbar--html__inner" contenteditable="true" placeholder="<?php esc_attr_e( 'Enter HTML to insert', 'lasso' );?>"></div> |
285
|
|
|
<div id="lasso-toolbar--html__footer"> |
286
|
|
|
<div id="lasso-toolbar--html__footer_desc" > |
287
|
|
|
<?php esc_attr_e( 'Enter HTML to insert', 'lasso' );?><br> |
288
|
|
|
<?php esc_attr_e( 'You can also use Shortcodes', 'lasso' );?><br> |
289
|
|
|
<?php esc_attr_e( 'You can also enter a URL to embed, such as Youtube, Vimeo and Twitter URLs.', 'lasso' );?> |
290
|
|
|
</div> |
291
|
|
|
<ul class="lasso-toolbar--html-snips"> |
292
|
|
|
|
293
|
|
|
<?php if ( !$toolbar_headings ): ?> |
294
|
|
|
<li id="lasso-html--h2" title="<?php esc_attr_e( 'H2 Heading', 'lasso' );?>"> |
295
|
|
|
<li id="lasso-html--h3" title="<?php esc_attr_e( 'H3 Heading', 'lasso' );?>"> |
296
|
|
|
<?php endif; ?> |
297
|
|
|
<li id="lasso-html--ul" title="<?php esc_attr_e( 'Unordered List', 'lasso' );?>"> |
298
|
|
|
<li id="lasso-html--ol" title="<?php esc_attr_e( 'Ordered List', 'lasso' );?>"> |
299
|
|
|
</ul> |
300
|
|
|
<a class="lasso-toolbar--html__control lasso-toolbar--html__cancel" href="#"><?php _e( 'Cancel', 'lasso' );?></a> |
301
|
|
|
<a href="#" title="<?php esc_attr_e( 'Insert HTML or Code', 'lasso' );?>" class="lasso-toolbar--html__control" id="lasso-toolbar--html__insert" ><?php _e( 'Insert', 'lasso' );?></a> |
302
|
|
|
</div> |
303
|
|
|
</div> |
304
|
|
|
</li> |
305
|
|
|
<?php if ( $show_align ): ?> |
306
|
|
|
<li id="lasso-toolbar--left-align" title="<?php esc_attr_e( 'Text Left Align', 'lasso' );?>"></li> |
307
|
|
|
<li id="lasso-toolbar--center-align" title="<?php esc_attr_e( 'Text Center Align', 'lasso' );?>"></li> |
308
|
|
|
<li id="lasso-toolbar--right-align" title="<?php esc_attr_e( 'Text Right Align', 'lasso' );?>"></li> |
309
|
|
|
<?php endif; ?> |
310
|
|
|
</ul> |
311
|
|
|
<?php if ( is_singular() && $is_mobile ) { ?> |
312
|
|
|
|
313
|
|
|
<div class="lasso--controls__right" data-posttype="<?php echo get_post_type( get_the_ID() );?>" data-status="<?php echo $status;?>" style="position:static;bottom:0px;right;0px;left:auto;"> |
314
|
|
|
|
315
|
|
|
<a href="#" title="<?php esc_attr_e( 'Save Post', 'lasso' );?>" id="lasso--save" class="lasso-save-post lasso--button <?php echo $sc_saving_class;?>"></a> |
316
|
|
|
|
317
|
|
|
<?php if ( 'draft' == $status && ( lasso_user_can('publish_posts') || lasso_user_can('publish_pages') ) ) { ?> |
318
|
|
|
<a href="#" title="<?php esc_attr_e( 'Publish Post', 'lasso' );?>" id="lasso--publish" class="lasso-publish-post lasso--button <?php echo $sc_saving_class;?>"></a> |
319
|
|
|
<?php } ?> |
320
|
|
|
|
321
|
|
|
</div> |
322
|
|
|
|
323
|
|
|
<?php } ?> |
324
|
|
|
</div> |
325
|
|
|
|
326
|
|
|
<?php return ob_get_clean(); |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Draw the controls used for teh component settings within each component |
331
|
|
|
* |
332
|
|
|
* @since 1.0 |
333
|
|
|
*/ |
334
|
|
|
function lasso_editor_settings_toolbar() { |
335
|
|
|
|
336
|
|
|
$delete_nonce = wp_create_nonce( 'lasso-delete-nonce' ); |
337
|
|
|
|
338
|
|
|
ob_start(); |
339
|
|
|
|
340
|
|
|
|
341
|
|
|
// let users add custom css classes |
342
|
|
|
$custom_classes = apply_filters( 'lasso_component_classes', '' ); |
343
|
|
|
|
344
|
|
|
?> |
345
|
|
|
<ul class="lasso-component--controls <?php echo sanitize_html_class( $custom_classes );?>" contenteditable="false"> |
346
|
|
|
<li class="lasso-drag" title="<?php esc_attr_e( 'Move', 'lasso' );?>"></li> |
347
|
|
|
<li id="lasso-component--settings__trigger" class="lasso-settings" title="<?php esc_attr_e( 'Settings', 'lasso' );?>"></li> |
348
|
|
|
<li class="lasso-clone" title="<?php esc_attr_e( 'Clone', 'lasso' );?>"></li> |
349
|
|
|
<li class="lasso-delete" data-postid="<?php echo get_the_ID();?>" data-nonce="<?php echo $delete_nonce;?>" title="<?php esc_attr_e( 'Delete', 'lasso' );?>"></li> |
350
|
|
|
</ul> |
351
|
|
|
|
352
|
|
|
<?php return ob_get_clean(); |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* Draws the controls used for changing the featured image |
357
|
|
|
* These controls are appended based on the class set in the define |
358
|
|
|
* |
359
|
|
|
* @since 1.0 |
360
|
|
|
*/ |
361
|
|
|
function lasso_editor_image_controls() { |
362
|
|
|
|
363
|
|
|
ob_start(); |
364
|
|
|
|
365
|
|
|
|
366
|
|
|
// has post thumbnail |
367
|
|
|
$has_thumbnail = has_post_thumbnail( get_the_ID() ) ? 'class="lasso--featImg--has-thumb"' : false; |
368
|
|
|
|
369
|
|
|
?> |
370
|
|
|
<ul id="lasso--featImgControls" <?php echo $has_thumbnail;?>> |
371
|
|
|
<li id="lasso--featImgUpload"><a title="<?php esc_attr_e( 'Replace Image', 'lasso' );?>" href="#"><i class="lasso-icon-image"></i></a></li> |
372
|
|
|
<li id="lasso--featImgDelete"><a title="<?php esc_attr_e( 'Delete Image', 'lasso' );?>" href="#"><i class="lasso-icon-bin2"></i></a></li> |
373
|
|
|
<li id="lasso--featImgSave"><a href="#"><?php esc_attr_e( 'save', 'lasso' );?></a></li> |
374
|
|
|
</ul> |
375
|
|
|
|
376
|
|
|
<?php return ob_get_clean(); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Used to house post settings like scheduling, slugs and draft status |
382
|
|
|
* Note: the "add new" will use the same object as the currently shown. For example, if the user |
383
|
|
|
* is currently on a post, and clicks add new, then it'll add a new post. If the user is on a |
384
|
|
|
* post type like "dog", then it will create a new post type called "dog" |
385
|
|
|
* |
386
|
|
|
* @since 1.0 |
387
|
|
|
*/ |
388
|
|
|
function lasso_editor_component_modal() { |
389
|
|
|
|
390
|
|
|
ob_start(); |
391
|
|
|
|
392
|
|
|
|
393
|
|
|
global $post; |
394
|
|
|
|
395
|
|
|
$postid = get_the_ID(); |
396
|
|
|
|
397
|
|
|
$status = get_post_status( $postid ); |
398
|
|
|
$nonce = wp_create_nonce( 'lasso-update-post-settings' ); |
399
|
|
|
|
400
|
|
|
// let users add custom css classes |
401
|
|
|
$custom_classes = apply_filters( 'lasso_modal_settings_classes', '' ); |
402
|
|
|
|
403
|
|
|
// objects categories |
404
|
|
|
$categories = lasso_get_post_objects( $postid, 'category' ); |
405
|
|
|
$tags = lasso_get_post_objects( $postid, 'tag' ); |
406
|
|
|
|
407
|
|
|
// modal tabs |
408
|
|
|
$tabs = lasso_modal_addons('tab'); |
409
|
|
|
$content = lasso_modal_addons('content'); |
410
|
|
|
|
411
|
|
|
//editor options |
412
|
|
|
$allow_change_date = lasso_editor_get_option('allow_change_date', 'lasso_editor'); |
413
|
|
|
|
414
|
|
|
// are we singular |
415
|
|
|
$is_singular = is_singular(); |
416
|
|
|
$is_singular_class = $is_singular ? 'lasso--postsettings__2col' : 'lasso--postsettings__1col'; |
417
|
|
|
$has_thumb_class = has_post_thumbnail() ? 'has-thumbnail' : 'no-thumbnail'; |
418
|
|
|
$theme_supports = current_theme_supports('post-thumbnails'); |
419
|
|
|
$default_image = LASSO_URL.'/admin/assets/img/empty-img.png'; |
420
|
|
|
|
421
|
|
|
?> |
422
|
|
|
<div id="lasso--post-settings__modal" class="lasso--modal lassoShowAnimate <?php echo sanitize_html_class( $custom_classes );?>"> |
423
|
|
|
<div class="lasso--modal__inner"> |
424
|
|
|
|
425
|
|
|
<?php if( $tabs ) { echo $tabs; } ?> |
426
|
|
|
|
427
|
|
|
<div class="lasso--modal__content modal__content--core visible" data-addon-content="core"> |
428
|
|
|
<form id="lasso--postsettings__form" enctype="multipart/form-data" class="lasso--post-form <?php echo $is_singular_class.' '.$has_thumb_class;?>" > |
429
|
|
|
|
430
|
|
|
<?php if ( $is_singular && $theme_supports ) : ?> |
431
|
|
|
<div class="lasso--postsettings__left"> |
432
|
|
|
<label><?php _e( 'Featured Image', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Change the featured image for this post.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
433
|
|
|
<div class="lasso--post-thumb" data-default-thumb="<?php echo esc_url( $default_image );?>"> |
434
|
|
|
|
435
|
|
|
<div id="lasso--post-thumb__controls" class="lasso--post-thumb__controls"> |
436
|
|
|
<i id="lasso--post-thumb__add" title="<?php _e('Change Featured Image','lasso');?>" class="dashicons dashicons-edit"></i> |
437
|
|
|
<i id="lasso--post-thumb__delete" title="<?php _e('Delete Featured Image','lasso');?>" class="dashicons dashicons-no-alt"></i> |
438
|
|
|
<i id="lasso--save-status" class="lasso-icon lasso-icon-spinner6 not-visible"></i> |
439
|
|
|
</div> |
440
|
|
|
|
441
|
|
|
<?php echo has_post_thumbnail() ? get_the_post_thumbnail( $post->ID, 'medium' ) : '<img src="'.$default_image.'">'; ?> |
442
|
|
|
|
443
|
|
|
</div> |
444
|
|
|
<div id="lasso--featImgSave"><a href="#" class="not-visible">Save</a></div> |
445
|
|
|
|
446
|
|
|
</div> |
447
|
|
|
<?php endif; ?> |
448
|
|
|
|
449
|
|
|
<div class="lasso--postsettings__right"> |
450
|
|
|
|
451
|
|
|
<?php if( lasso_user_can('publish_posts') || lasso_user_can('publish_pages') ): ?> |
452
|
|
|
<div class="lasso--postsettings__option story-status-option"> |
453
|
|
|
<label><?php _e( 'Status', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Change the status of the post to draft or publish.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
454
|
|
|
<ul class="story-status story-status-<?php echo sanitize_html_class( $status );?>"> |
455
|
|
|
<li id="lasso--status-draft"><?php _e( 'Draft', 'lasso' );?></li> |
456
|
|
|
<li id="lasso--status-pending"><?php _e( 'Pending', 'lasso' );?></li> |
457
|
|
|
<li id="lasso--status-publish"><?php _e( 'Publish', 'lasso' );?></li> |
458
|
|
|
</ul> |
459
|
|
|
<div class="lasso--slider_wrap"> |
460
|
|
|
<div id="lasso--slider"></div> |
461
|
|
|
</div> |
462
|
|
|
</div> |
463
|
|
|
<?php endif; ?> |
464
|
|
|
|
465
|
|
|
<?php if ( 'publish' == $status ): ?> |
466
|
|
|
<div class="lasso--postsettings__option story-slug-option"> |
467
|
|
|
<label><?php _e( 'Post URL', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Change the URL (slug) of this post.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
468
|
|
|
<input class="lasso--modal__trigger-footer" type="text" name="story_slug" value="<?php echo isset( $post ) ? esc_attr( $post->post_name ) : false;?>"> |
469
|
|
|
</div> |
470
|
|
|
<?php endif; ?> |
471
|
|
|
|
472
|
|
|
</div> |
473
|
|
|
|
474
|
|
|
<div class="lasso--postsettings__middle"> |
475
|
|
|
|
476
|
|
|
<div class="lasso--postsettings__option story-categories-option"> |
477
|
|
|
<label style="width:120px;"><?php _e( 'Categories', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Type a category name and press enter.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
478
|
|
|
<input id="lasso--cat-select" class="lasso--modal__trigger-footer" type="hidden" name="story_cats" value="<?php echo $categories;?>"> |
479
|
|
|
</div> |
480
|
|
|
|
481
|
|
|
<div class="lasso--postsettings__option story-tags-option"> |
482
|
|
|
<label><?php _e( 'Tags', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Type a tag name and press enter.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
483
|
|
|
<input id="lasso--tag-select" class="lasso--modal__trigger-footer" type="hidden" name="story_tags" value="<?php echo $tags;?>"> |
484
|
|
|
</div> |
485
|
|
|
<?php |
486
|
|
|
if ($allow_change_date) { |
487
|
|
|
$dateformat = get_option( 'date_format' ); |
488
|
|
|
?> |
489
|
|
|
<label><?php _e( 'Post Date', 'lasso' ); ?></label> |
490
|
|
|
<input type="text" class="editus_custom_date" name="post_date" value="<?php echo get_the_time($dateformat, $postid);?>"/> |
491
|
|
|
<?php |
492
|
|
|
}?> |
493
|
|
|
|
494
|
|
|
</div> |
495
|
|
|
<!-- alternate way to display categories disabled now --> |
496
|
|
|
<!--div style="max-height:300px;overflow-y: scroll;"--> |
497
|
|
|
<?php |
498
|
|
|
/*$allcats = explode(",",lasso_get_objects('category')); |
499
|
|
|
$currcats = explode(",",$categories); |
500
|
|
|
foreach ( $allcats as $category ) { |
501
|
|
|
if (empty($category)) continue; |
502
|
|
|
$checked =""; |
503
|
|
|
if ( in_array( $category, $currcats ) ) { |
504
|
|
|
$checked = 'checked="checked"'; |
505
|
|
|
|
506
|
|
|
} |
507
|
|
|
echo '<label><input type="checkbox" '.$checked.' name="categories" id="'.$category.'" >'.$category.'</label>'; |
508
|
|
|
}*/ |
509
|
|
|
?> |
510
|
|
|
<!--/div--> |
511
|
|
|
|
512
|
|
|
<?php do_action( 'lasso_modal_post_form' ); // action ?> |
513
|
|
|
|
514
|
|
|
<div class="lasso--postsettings__footer" > |
515
|
|
|
<a href="#" class="lasso--postsettings-cancel"><?php _e( 'Cancel', 'lasso' );?></a> |
516
|
|
|
<input type="hidden" name="status" value=""> |
517
|
|
|
<input type="hidden" name="categories" value=""> |
518
|
|
|
<input type="hidden" name="postid" value="<?php echo get_the_ID();?>"> |
519
|
|
|
<input type="hidden" name="action" value="process_update-object_post"> |
520
|
|
|
<input type="hidden" name="nonce" value="<?php echo $nonce;?>"> |
521
|
|
|
<?php do_action( 'lasso_modal_post_form_footer' ); // action ?> |
522
|
|
|
<input type="submit" id="lasso--postsettings-submit" value="<?php esc_attr_e( 'Save', 'lasso' );?>"> |
523
|
|
|
</div> |
524
|
|
|
|
525
|
|
|
</form> |
526
|
|
|
</div> |
527
|
|
|
|
528
|
|
|
<?php if( $tabs ) { echo $content; } ?> |
529
|
|
|
|
530
|
|
|
</div> |
531
|
|
|
|
532
|
|
|
</div> |
533
|
|
|
<div id="lasso--modal__overlay"></div> |
534
|
|
|
|
535
|
|
|
<?php return ob_get_clean(); |
536
|
|
|
} |
537
|
|
|
|
538
|
|
|
/** |
539
|
|
|
* Used to house the form for creating a new post within amodal |
540
|
|
|
* |
541
|
|
|
* @since 1.0 |
542
|
|
|
*/ |
543
|
|
|
function lasso_editor_newpost_modal() { |
544
|
|
|
|
545
|
|
|
global $post; |
546
|
|
|
|
547
|
|
|
ob_start(); |
548
|
|
|
|
549
|
|
|
|
550
|
|
|
$status = get_post_status( get_the_ID() ); |
551
|
|
|
|
552
|
|
|
$nonce = wp_create_nonce( 'lasso-editor-new-post' ); |
553
|
|
|
|
554
|
|
|
// let users add custom css classes |
555
|
|
|
$custom_classes = apply_filters( 'lasso_modal_post_classes', '' ); |
556
|
|
|
|
557
|
|
|
// return the post type |
558
|
|
|
$type = get_post_type( get_the_ID() ); |
559
|
|
|
|
560
|
|
|
$mobile_style = ""; |
561
|
|
|
if (wp_is_mobile()) { |
562
|
|
|
$mobile_style = 'style="top:140px !important;"'; |
563
|
|
|
} |
564
|
|
|
?> |
565
|
|
|
<div id="lasso--post-new__modal" class="lasso--modal lasso--modal__med lassoShowAnimate <?php echo sanitize_html_class( $custom_classes );?>" <?php echo $mobile_style;?>"> |
566
|
|
|
<div class="lasso--modal__inner lasso--hasnewform"> |
567
|
|
|
|
568
|
|
|
<form id="lasso--postnew__form" enctype="multipart/form-data" class="lasso--post-form"> |
569
|
|
|
|
570
|
|
|
<div class="lasso--postsettings__option story-slug-option lasso--last-option"> |
571
|
|
|
<label><?php esc_attr_e( 'New <span>post</span> title', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Specify title for new post, then save to edit.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
572
|
|
|
<input class="lasso--modal__trigger-footer" type="text" required name="story_title" value="" placeholder="<?php esc_attr_e( 'Grump Wizards Make Toxic Brew', 'lasso' );?>"> |
573
|
|
|
<div class="lasso--select-wrap" style="width:90px"> |
574
|
|
|
<select id="lasso--select-type" name="story_type"> |
575
|
|
|
|
576
|
|
|
<?php |
577
|
|
|
$types = lasso_post_types_names(); |
578
|
|
|
if ( !empty( $types ) ) { |
579
|
|
|
foreach( $types as $name => $label ) { |
580
|
|
|
$type = preg_replace( '/s\b/','', $name ); |
581
|
|
|
if ($type == 'page' && !current_user_can('edit_pages')) { |
582
|
|
|
continue; |
583
|
|
|
} |
584
|
|
|
printf( '<option value="%s">%s</option>', lcfirst( esc_attr( $type ) ) , ucfirst( esc_attr( $label ) ) ); |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
} |
588
|
|
|
?> |
589
|
|
|
|
590
|
|
|
</select> |
591
|
|
|
</div> |
592
|
|
|
</div> |
593
|
|
|
|
594
|
|
|
<div class="lasso--postsettings__footer"> |
595
|
|
|
<a href="#" class="lasso--postsettings-cancel"><?php _e( 'Cancel', 'lasso' );?></a> |
596
|
|
|
<input type="hidden" name="action" value="process_new-object_post"> |
597
|
|
|
<?php |
598
|
|
|
if ( !empty( $types ) ) { |
599
|
|
|
// get the first element |
600
|
|
|
$type = key($types); |
601
|
|
|
$type = preg_replace( '/s\b/','', $type ); |
602
|
|
|
printf( '<input type="hidden" name="object" value="%s">', lcfirst( esc_attr( $type ) ) ); |
603
|
|
|
} |
604
|
|
|
?> |
605
|
|
|
<input type="hidden" name="nonce" value="<?php echo $nonce;?>"> |
606
|
|
|
<input type="submit" value="<?php esc_attr_e( 'Create', 'lasso' );?>"> |
607
|
|
|
</div> |
608
|
|
|
|
609
|
|
|
</form> |
610
|
|
|
|
611
|
|
|
</div> |
612
|
|
|
</div> |
613
|
|
|
<div id="lasso--modal__overlay"></div> |
614
|
|
|
|
615
|
|
|
<?php return ob_get_clean(); |
616
|
|
|
} |
617
|
|
|
|
618
|
|
|
/** |
619
|
|
|
* Used to house the all posts pop-up |
620
|
|
|
* |
621
|
|
|
* @since 0.9.3 |
622
|
|
|
*/ |
623
|
|
|
function lasso_editor_allpost_modal() { |
624
|
|
|
|
625
|
|
|
global $post; |
626
|
|
|
|
627
|
|
|
global $wp_post_types; |
628
|
|
|
$labels = &$wp_post_types['post']->labels; |
629
|
|
|
$labels->name = 'Articles'; |
630
|
|
|
|
631
|
|
|
ob_start(); |
632
|
|
|
|
633
|
|
|
// post status |
634
|
|
|
$status = get_post_status( get_the_ID() ); |
635
|
|
|
|
636
|
|
|
// let users add custom css classes |
637
|
|
|
$custom_classes = apply_filters( 'lasso_modal_all_post_classes', '' ); |
638
|
|
|
|
639
|
|
|
?> |
640
|
|
|
<div id="lasso--all-posts__modal" class="lasso--modal lasso--modal__full lassoShowAnimate <?php echo sanitize_html_class( $custom_classes );?>" style="max-height:100%"> |
641
|
|
|
<div class="lasso--modal__inner"> |
642
|
|
|
|
643
|
|
|
<div class="lasso--post-filtering not-visible"> |
644
|
|
|
<div class="lasso--search__results"> |
645
|
|
|
<span id="lasso--results-found"></span><?php _e('results found','lasso');?> |
646
|
|
|
</div> |
647
|
|
|
<div class="lasso--search"> |
648
|
|
|
<i id="lasso--search__toggle" class="dashicons dashicons-search"></i> |
649
|
|
|
<input id="lasso--search-field" type="text" placeholder="search..."> |
650
|
|
|
</div> |
651
|
|
|
</div> |
652
|
|
|
|
653
|
|
|
<ul class="lasso--post-object-list"> |
654
|
|
|
<?php |
655
|
|
|
|
656
|
|
|
$post_types = lasso_post_types_names(); |
657
|
|
|
$rest_bases = lasso_post_types_rest_base(); |
658
|
|
|
|
659
|
|
|
if ( ! empty( $post_types ) ) { |
660
|
|
|
$first = 'active'; |
661
|
|
|
foreach( $post_types as $name => $label ) { |
662
|
|
|
if (array_key_exists($name, $rest_bases)) { |
663
|
|
|
printf( '<li class="%1s lasso--show-objects" data-post-type="%2s">%3s</li>', esc_attr( $first), esc_attr( $rest_bases[$name] ), esc_attr( $label ) ); |
664
|
|
|
} |
665
|
|
|
$first = ''; |
666
|
|
|
} |
667
|
|
|
|
668
|
|
|
} |
669
|
|
|
|
670
|
|
|
do_action('lasso_modal_post_objects');?> |
671
|
|
|
|
672
|
|
|
</ul> |
673
|
|
|
<div id="lasso--loading" class="lasso--loading"><div class="lasso--loader"></div></div> |
674
|
|
|
|
675
|
|
|
<ul id="lasso--post-list" class="lasso--post-list"></ul> |
676
|
|
|
|
677
|
|
|
</div> |
678
|
|
|
</div> |
679
|
|
|
<div id="lasso--modal__overlay"></div> |
680
|
|
|
|
681
|
|
|
<?php return ob_get_clean(); |
682
|
|
|
} |
683
|
|
|
|
684
|
|
|
function lasso_editor_wpimg_edit() { |
685
|
|
|
|
686
|
|
|
ob_start(); |
687
|
|
|
|
688
|
|
|
|
689
|
|
|
// let users add custom css classes |
690
|
|
|
$custom_classes = apply_filters( 'lasso_wpimg_classes', '' ); |
691
|
|
|
|
692
|
|
|
?> |
693
|
|
|
<ul class="lasso-component--controls <?php echo sanitize_html_class( $custom_classes );?>" contenteditable="false"> |
694
|
|
|
<li class="lasso-drag" title="<?php esc_attr_e( 'Move', 'lasso' );?>"></li> |
695
|
|
|
<li id="lasso--wpimg-edit" class="lasso-settings" title="<?php esc_attr_e( 'Settings', 'lasso' );?>"></li> |
696
|
|
|
<li class="lasso-clone" title="<?php esc_attr_e( 'Clone', 'lasso' );?>"></li> |
697
|
|
|
<li class="lasso-delete" title="<?php esc_attr_e( 'Delete', 'lasso' );?>"></li> |
698
|
|
|
</ul> |
699
|
|
|
|
700
|
|
|
<?php return ob_get_clean(); |
701
|
|
|
} |
702
|
|
|
|
703
|
|
|
function lasso_editor_wpvideo_edit() { |
704
|
|
|
|
705
|
|
|
ob_start(); |
706
|
|
|
|
707
|
|
|
|
708
|
|
|
// let users add custom css classes |
709
|
|
|
$custom_classes = apply_filters( 'lasso_wpimg_classes', '' ); |
710
|
|
|
|
711
|
|
|
?> |
712
|
|
|
<ul class="lasso-component--controls <?php echo sanitize_html_class( $custom_classes );?>" contenteditable="false"> |
713
|
|
|
<li class="lasso-drag" title="<?php esc_attr_e( 'Move', 'lasso' );?>"></li> |
714
|
|
|
<li id="lasso--wpvideo-edit" class="lasso-settings" title="<?php esc_attr_e( 'Settings', 'lasso' );?>"></li> |
715
|
|
|
<li class="lasso-clone" title="<?php esc_attr_e( 'Clone', 'lasso' );?>"></li> |
716
|
|
|
<li class="lasso-delete" title="<?php esc_attr_e( 'Delete', 'lasso' );?>"></li> |
717
|
|
|
</ul> |
718
|
|
|
|
719
|
|
|
<?php return ob_get_clean(); |
720
|
|
|
} |
721
|
|
|
|
722
|
|
|
/** |
723
|
|
|
* Used to house the hidden input fields for actions and process saving for the map component |
724
|
|
|
* |
725
|
|
|
* @since 1.0 |
726
|
|
|
*/ |
727
|
|
|
function lasso_map_form_footer() { |
728
|
|
|
|
729
|
|
|
$nonce = wp_create_nonce( 'lasso-process-map' ); |
730
|
|
|
|
731
|
|
|
ob_start(); |
732
|
|
|
|
733
|
|
|
?> |
734
|
|
|
<div class="lasso--map-form__footer"> |
735
|
|
|
<input type="hidden" name="postid" value="<?php echo get_the_ID();?>"> |
736
|
|
|
<input type="hidden" name="nonce" value="<?php echo $nonce;?>"> |
737
|
|
|
<input type="hidden" name="action" value="process_map_save"> |
738
|
|
|
<input type="submit" class="lasso--map-form__submit" value="<?php esc_attr_e( 'Save Locations', 'lasso' );?>"> |
739
|
|
|
</div> |
740
|
|
|
|
741
|
|
|
<?php return ob_get_clean(); |
742
|
|
|
|
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
/** |
746
|
|
|
* Some things aren't real-time updatable so we need to append a message in certain areas on certain actions |
747
|
|
|
* |
748
|
|
|
* @since 1.0 |
749
|
|
|
*/ |
750
|
|
|
function lasso_editor_refresh_message() { |
751
|
|
|
|
752
|
|
|
ob_start(); |
753
|
|
|
|
754
|
|
|
?> |
755
|
|
|
<div id="lasso--pagerefresh" class="visible"> |
756
|
|
|
<?php _e( 'Save this post and refesh the page to see these changes.', 'lasso' );?> |
757
|
|
|
</div> |
758
|
|
|
|
759
|
|
|
<?php return ob_get_clean(); |
760
|
|
|
} |
761
|
|
|
|
762
|
|
|
/** |
763
|
|
|
* Draw out the settings field based on the shortcodes array with options foudn in Lasso Story Engine |
764
|
|
|
* This was mostly backported from lasso story engine and modified to allow for non lasso shortcodes and components |
765
|
|
|
* |
766
|
|
|
* @since 1.0 |
767
|
|
|
*/ |
768
|
|
|
function lasso_editor_options_blob() { |
769
|
|
|
|
770
|
|
|
$codes = function_exists( 'aesop_shortcodes' ) ? aesop_shortcodes() : apply_filters( 'lasso_custom_options', '' ); |
771
|
|
|
$galleries = function_exists( 'lasso_editor_galleries_exist' ) && lasso_editor_galleries_exist() ? 'has-galleries' : 'creating-gallery'; |
772
|
|
|
|
773
|
|
|
$nonce = wp_create_nonce( 'lasso_gallery' ); |
774
|
|
|
|
775
|
|
|
$blob = array(); |
776
|
|
|
|
777
|
|
|
if ( empty( $codes ) ) |
778
|
|
|
return; |
779
|
|
|
|
780
|
|
|
foreach ( $codes as $slug => $shortcode ) { |
781
|
|
|
$return = ''; |
782
|
|
|
// Shortcode has atts |
783
|
|
|
|
784
|
|
|
if ( count( $shortcode['atts'] ) && $shortcode['atts'] ) { |
785
|
|
|
|
786
|
|
|
foreach ( $shortcode['atts'] as $attr_name => $attr_info ) { |
787
|
|
|
|
788
|
|
|
|
789
|
|
|
$prefix = isset( $attr_info['prefix'] ) ? sprintf( '<span class="lasso-option-prefix">%s</span>', $attr_info['prefix'] ) : null; |
790
|
|
|
|
791
|
|
|
$return .= '<form id="lasso--component-settings-form" class="'.$galleries.'" method="post">'; |
792
|
|
|
$return .= '<p data-option="'.$attr_name.'" class="lasso-option aesop-'.$slug.'-'.$attr_name.'">'; |
793
|
|
|
$return .= '<label for="aesop-generator-attr-' . $attr_name . '">' . $attr_info['desc'] . '</label>'; |
794
|
|
|
$return .= '<small class="lasso-option-desc">'.$attr_info['tip'].'</small>'; |
795
|
|
|
// Select |
796
|
|
|
|
797
|
|
|
if ( isset( $attr_info['values'] ) ) { |
798
|
|
|
|
799
|
|
|
$return .= '<select name="' . $attr_name . '" id="aesop-generator-attr-' . $attr_name . '" class="lasso-generator-attr">'; |
800
|
|
|
|
801
|
|
|
$i=0; |
802
|
|
|
|
803
|
|
|
foreach ( $attr_info['values'] as $attr_value ) { |
804
|
|
|
$attr_value_selected = $attr_info['default'] == $attr_value ? ' selected="selected"' : ''; |
805
|
|
|
|
806
|
|
|
$return .= '<option value="'.$attr_info['values'][$i]['value'].'" ' . $attr_value_selected . '>'.$attr_info['values'][$i]['name'].'</option>'; |
807
|
|
|
|
808
|
|
|
$i++; |
809
|
|
|
} |
810
|
|
|
|
811
|
|
|
$return .= '</select>'; |
812
|
|
|
|
813
|
|
|
} else { |
814
|
|
|
|
815
|
|
|
$attr_field_type = isset( $attr_info['type'] ) ? $attr_info['type'] : 'text'; |
816
|
|
|
|
817
|
|
|
// image upload |
818
|
|
|
if ( 'media_upload' == $attr_info['type'] ) { |
819
|
|
|
|
820
|
|
|
$return .= '<input type="' . $attr_field_type . '" name="' . $attr_name . '" value="'.$attr_info['default'].'" id="aesop-generator-attr-' . $attr_name . '" class="lasso-generator-attr aesop-generator-attr-'.$attr_field_type.'" />'; |
821
|
|
|
$return .= '<a href="#" id="lasso-upload-img" class="lasso-option-button" /></a>'; |
822
|
|
|
|
823
|
|
|
} elseif ( 'color' == $attr_info['type'] ) { |
824
|
|
|
|
825
|
|
|
$return .= '<input type="color" name="' . $attr_name . '" value="'.$attr_info['default'].'" id="aesop-generator-attr-' . $attr_name . '" class="lasso-generator-attr aesop-generator-attr-'.$attr_field_type.'" />'; |
826
|
|
|
|
827
|
|
|
} elseif ( 'text_area' == $attr_info['type'] ) { |
828
|
|
|
|
829
|
|
|
$return .= '<textarea name="' . $attr_name . '" id="aesop-generator-attr-' . $attr_name . '" class="lasso-generator-attr aesop-generator-attr-'.$attr_field_type.'" placeholder="'.$attr_info['default'].'" /></textarea>'.$prefix.''; |
830
|
|
|
|
831
|
|
|
} else { |
832
|
|
|
$return .= '<input type="' . $attr_field_type . '" name="' . $attr_name . '" value="'.$attr_info['default'].'" id="aesop-generator-attr-' . $attr_name . '" class="lasso-generator-attr aesop-generator-attr-'.$attr_field_type.'" />'.$prefix.''; |
833
|
|
|
} |
834
|
|
|
} |
835
|
|
|
$return .= '</p>'; |
836
|
|
|
|
837
|
|
|
} |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
/////////////////////////// |
841
|
|
|
// START GALLERY AND MAP FRONT END STUFFS |
842
|
|
|
/////////////////////////// |
843
|
|
|
if ( isset( $shortcode['front'] ) && true == $shortcode['front'] ) { |
844
|
|
|
|
845
|
|
|
if ( 'gallery' == $shortcode['front_type'] ) { |
846
|
|
|
|
847
|
|
|
$return .= lasso_gallery_editor_module(); |
848
|
|
|
|
849
|
|
|
} |
850
|
|
|
} |
851
|
|
|
/////////////////////////// |
852
|
|
|
// END GALLERY AND MAP FRONT END STUFFS |
853
|
|
|
/////////////////////////// |
854
|
|
|
|
855
|
|
|
// Single shortcode (not closed) |
856
|
|
|
if ( 'single' == $shortcode['type'] ) { |
857
|
|
|
|
858
|
|
|
$return .= '<input type="hidden" name="lasso-generator-content" id="lasso-generator-content" value="false" />'; |
859
|
|
|
|
860
|
|
|
} else { |
861
|
|
|
|
862
|
|
|
$return .= '<p data-option="content" class="lasso-option lasso-c-comp-text"><label>' . __( 'Content', 'lasso' ) . '</label><textarea type="text" name="lasso-generator-content" id="lasso-generator-content" value="' . $shortcode['content'] . '" /></textarea></p>'; |
863
|
|
|
} |
864
|
|
|
|
865
|
|
|
$return .= '<p class="lasso-buttoninsert-wrap"><a href="#" class="lasso-generator-cancel" id="lasso--sidebar__close">Cancel</a><input type="submit" id="lasso-generator-insert" value="Save Settings"></p>'; |
866
|
|
|
$return .= '<input class="component_type" type="hidden" name="component_type" value="">'; |
867
|
|
|
$return .= '<input type="hidden" name="unique" value="">'; |
868
|
|
|
$return .= '<input type="hidden" name="nonce" id="lasso-generator-nonce" value="'.$nonce.'" />'; |
869
|
|
|
$return .= '</form>'; |
870
|
|
|
|
871
|
|
|
// extra JS codes |
872
|
|
|
if (isset($shortcode['codes'])) { |
873
|
|
|
$return .= $shortcode['codes']; |
874
|
|
|
} |
875
|
|
|
$blob[$slug] = $return; |
876
|
|
|
} |
877
|
|
|
|
878
|
|
|
return $blob; |
879
|
|
|
} |
880
|
|
|
|
881
|
|
|
/** |
882
|
|
|
* Revisions modal |
883
|
|
|
* |
884
|
|
|
* @since 0.9.8 |
885
|
|
|
* |
886
|
|
|
* @return string |
887
|
|
|
*/ |
888
|
|
|
function lasso_editor_revision_modal() { |
889
|
|
|
|
890
|
|
|
ob_start(); |
891
|
|
|
?> |
892
|
|
|
<div id="lasso--revision__modal" class="lasso--modal lassoShowAnimate "> |
893
|
|
|
|
894
|
|
|
<div class="lasso--modal__inner"> |
895
|
|
|
<div id="lasso--loading" class="lasso--loading"><div class="lasso--loader"></div></div> |
896
|
|
|
<div id="lasso--hide" style="display:none;" class="lasso--post-form"> |
897
|
|
|
<i class="lasso-icon lasso-icon-move"></i> |
898
|
|
|
<label><?php _e( 'Revisions', 'lasso' );?><span class="lasso-util--help lasso-util--help-top" data-tooltip="<?php esc_attr_e( 'Use the slider to view the revision live on the page.', 'lasso' );?>"><i class="lasso-icon-help"></i></span></label> |
899
|
|
|
<div class="lasso--slider_wrap"> |
900
|
|
|
<div id="lasso--slider"></div> |
901
|
|
|
</div> |
902
|
|
|
<ul id="lasso--revision-list"></ul> |
903
|
|
|
<div class="lasso--btn-group lasso--btn-group-small"> |
904
|
|
|
<a href="#" class="lasso--btn-secondary" id="lasso--close-modal"><?php _e( 'Cancel', 'lasso' );?></a> |
905
|
|
|
<a href="#" class="lasso--btn-primary" id="lasso--select-revision"><?php _e( 'Select', 'lasso' );?></a> |
906
|
|
|
</div> |
907
|
|
|
</div> |
908
|
|
|
|
909
|
|
|
</div> |
910
|
|
|
</div> |
911
|
|
|
<?php |
912
|
|
|
return ob_get_clean(); |
913
|
|
|
} |
914
|
|
|
|
915
|
|
|
/** |
916
|
|
|
* |
917
|
|
|
* Takes a color code and returns an adjusted value |
918
|
|
|
* @since 1.0.0 |
919
|
|
|
* Steps should be between -255 and 255. Negative = darker, positive = lighter |
920
|
|
|
* @return string |
921
|
|
|
*/ |
922
|
|
|
function lasso_editor_adjustBrightness($hex, $steps) { |
923
|
|
|
$steps = max(-255, min(255, $steps)); |
924
|
|
|
|
925
|
|
|
// Normalize into a six character long hex string |
926
|
|
|
$hex = str_replace('#', '', $hex); |
927
|
|
|
if (strlen($hex) == 3) { |
928
|
|
|
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2); |
929
|
|
|
} |
930
|
|
|
|
931
|
|
|
// Split into three parts: R, G and B |
932
|
|
|
$color_parts = str_split($hex, 2); |
933
|
|
|
$return = '#'; |
934
|
|
|
|
935
|
|
|
foreach ($color_parts as $color) { |
936
|
|
|
$color = hexdec($color); // Convert to decimal |
937
|
|
|
$color = max(0,min(255,$color + $steps)); // Adjust color |
938
|
|
|
$return .= str_pad(dechex($color), 2, '0', STR_PAD_LEFT); // Make two char hex code |
939
|
|
|
} |
940
|
|
|
|
941
|
|
|
return $return; |
942
|
|
|
} |
943
|
|
|
|