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