Version Description
Download this release
Release Info
Developer | wpdevteam |
Plugin | EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor |
Version | 2.7.5 |
Comparing to | |
See all releases |
Code changes from version 2.7.4 to 2.7.5
- EmbedPress/Includes/Classes/EmbedPress_Plugin_Usage_Tracker.php +901 -989
- EmbedPress/Includes/Traits/Shared.php +13 -16
- EmbedPress/Plugins/Html/Field.php +39 -12
- EmbedPress/Shortcode.php +1 -0
- Gutenberg/{src/embedpress/index.php → block-backend/block-embedpress.php} +0 -0
- Gutenberg/{src/wistia/index.php → block-backend/block-wistia.php} +0 -0
- Gutenberg/{src/youtube/index.php → block-backend/block-youtube.php} +0 -0
- Gutenberg/dist/blocks.build.js +1 -1
- Gutenberg/plugin.php +120 -3
- Gutenberg/src/blocks.js +0 -44
- Gutenberg/src/common.scss +0 -13
- Gutenberg/src/common/Iframe.js +0 -31
- Gutenberg/src/common/core-embeds.js +0 -25
- Gutenberg/src/common/embed-controls.js +0 -33
- Gutenberg/src/common/embed-loading.js +0 -14
- Gutenberg/src/common/embed-placeholder.js +0 -49
- Gutenberg/src/common/embed-wrap.js +0 -28
- Gutenberg/src/common/icons.js +0 -211
- Gutenberg/src/document/edit.js +0 -235
- Gutenberg/src/document/editor.scss +0 -11
- Gutenberg/src/document/index.js +0 -109
- Gutenberg/src/document/style.scss +0 -29
- Gutenberg/src/embedpress/edit.js +0 -120
- Gutenberg/src/embedpress/editor.scss +0 -13
- Gutenberg/src/embedpress/index.js +0 -100
- Gutenberg/src/embedpress/style.scss +0 -19
- Gutenberg/src/google-docs/edit.js +0 -161
- Gutenberg/src/google-docs/editor.scss +0 -6
- Gutenberg/src/google-docs/index.js +0 -110
- Gutenberg/src/google-docs/style.scss +0 -5
- Gutenberg/src/google-drawings/edit.js +0 -116
- Gutenberg/src/google-drawings/editor.scss +0 -6
- Gutenberg/src/google-drawings/index.js +0 -78
- Gutenberg/src/google-drawings/style.scss +0 -5
- Gutenberg/src/google-forms/edit.js +0 -142
- Gutenberg/src/google-forms/editor.scss +0 -6
- Gutenberg/src/google-forms/index.js +0 -79
- Gutenberg/src/google-forms/style.scss +0 -5
- Gutenberg/src/google-maps/edit.js +0 -144
- Gutenberg/src/google-maps/editor.scss +0 -6
- Gutenberg/src/google-maps/index.js +0 -78
- Gutenberg/src/google-maps/style.scss +0 -5
- Gutenberg/src/google-sheets/edit.js +0 -165
- Gutenberg/src/google-sheets/editor.scss +0 -6
- Gutenberg/src/google-sheets/index.js +0 -102
- Gutenberg/src/google-sheets/style.scss +0 -5
- Gutenberg/src/google-slides/edit.js +0 -142
- Gutenberg/src/google-slides/editor.scss +0 -6
- Gutenberg/src/google-slides/index.js +0 -77
- Gutenberg/src/google-slides/style.scss +0 -6
- Gutenberg/src/init.php +0 -130
- Gutenberg/src/twitch/edit.js +0 -187
- Gutenberg/src/twitch/editor.scss +0 -6
- Gutenberg/src/twitch/index.js +0 -82
- Gutenberg/src/twitch/style.scss +0 -5
- Gutenberg/src/wistia/edit.js +0 -168
- Gutenberg/src/wistia/editor.scss +0 -7
- Gutenberg/src/wistia/index.js +0 -77
- Gutenberg/src/wistia/style.scss +0 -6
- Gutenberg/src/youtube/edit.js +0 -155
- Gutenberg/src/youtube/editor.scss +0 -0
- Gutenberg/src/youtube/index.js +0 -60
- Gutenberg/src/youtube/style.scss +0 -0
- assets/css/el-icon.css +1 -2
- assets/js/preview.js +2 -2
- embedpress.php +8 -1
- includes.php +2 -2
- readme.txt +24 -16
EmbedPress/Includes/Classes/EmbedPress_Plugin_Usage_Tracker.php
CHANGED
@@ -1,996 +1,908 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @version
|
6 |
*/
|
7 |
-
|
8 |
namespace EmbedPress\Includes\Classes;
|
9 |
-
|
|
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
exit;
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
* @since 1.0.0
|
661 |
-
*/
|
662 |
-
public function marketing_notice() {
|
663 |
-
// Check if user has opted in to marketing
|
664 |
-
if( isset( $_GET['marketing_optin'] ) ) {
|
665 |
-
// Set marketing optin
|
666 |
-
$this->set_can_collect_email( sanitize_text_field( $_GET['marketing_optin'] ), $this->plugin_name );
|
667 |
-
// Do tracking
|
668 |
-
$this->do_tracking( true );
|
669 |
-
} else if( isset( $_GET['marketing'] ) && $_GET['marketing']=='yes' ) {
|
670 |
-
// Display the notice requesting permission to collect email address
|
671 |
-
// Retrieve current plugin information
|
672 |
-
$plugin = $this->plugin_data();
|
673 |
-
$plugin_name = $plugin['Name'];
|
674 |
-
|
675 |
-
$url_yes = add_query_arg( array(
|
676 |
-
'plugin' => $this->plugin_name,
|
677 |
-
'marketing_optin' => 'yes'
|
678 |
-
) );
|
679 |
-
$url_no = add_query_arg( array(
|
680 |
-
'plugin' => $this->plugin_name,
|
681 |
-
'marketing_optin' => 'no'
|
682 |
-
) );
|
683 |
-
|
684 |
-
$marketing_text = __( 'Thank you for opting in to tracking. Would you like to receive occasional news about this plugin, including details of new features and special offers?', 'notificationx' );
|
685 |
-
$marketing_text = apply_filters( 'wpins_marketing_text_' . esc_attr( $this->plugin_name ), $marketing_text ); ?>
|
686 |
-
|
687 |
-
<div class="notice notice-info updated put-dismiss-notice">
|
688 |
-
<p><?php echo '<strong>' . esc_html( $plugin_name ) . '</strong>'; ?></p>
|
689 |
-
<p><?php echo esc_html( $marketing_text ); ?></p>
|
690 |
-
<p>
|
691 |
-
<a href="<?php echo esc_url( $url_yes ); ?>" data-putnotice="yes" class="button-secondary"><?php _e( 'Yes Please', 'notificationx' ); ?></a>
|
692 |
-
<a href="<?php echo esc_url( $url_no ); ?>" data-putnotice="no" class="button-secondary"><?php _e( 'No Thank You', 'notificationx' ); ?></a>
|
693 |
-
</p>
|
694 |
-
</div>
|
695 |
-
<?php }
|
696 |
-
}
|
697 |
-
|
698 |
-
/**
|
699 |
-
* Filter the deactivation link to allow us to present a form when the user deactivates the plugin
|
700 |
-
* @since 1.0.0
|
701 |
-
*/
|
702 |
-
public function filter_action_links( $links ) {
|
703 |
-
// Check to see if the user has opted in to tracking
|
704 |
-
if( ! $this->get_is_tracking_allowed() ) {
|
705 |
-
return $links;
|
706 |
-
}
|
707 |
-
if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
|
708 |
-
$deactivation_link = $links['deactivate'];
|
709 |
-
|
710 |
-
|
711 |
-
// Insert an onClick action to allow form before deactivating
|
712 |
-
$deactivation_link = str_replace( '<a ', '<div class="wpdev-put-goodbye-form-wrapper-'. esc_attr( $this->plugin_name ) .'"><div class="wpdev-put-goodbye-form-bg-'. esc_attr( $this->plugin_name ) .'"></div><span class="wpdev-put-goodbye-form" id="wpdev-put-goodbye-form-' . esc_attr( $this->plugin_name ) . '"></span></div><a onclick="javascript:event.preventDefault();" id="wpdev-put-goodbye-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
713 |
-
$links['deactivate'] = $deactivation_link;
|
714 |
-
}
|
715 |
-
return $links;
|
716 |
-
}
|
717 |
-
|
718 |
-
/*
|
719 |
-
* Form text strings
|
720 |
-
* These are non-filterable and used as fallback in case filtered strings aren't set correctly
|
721 |
-
* @since 1.0.0
|
722 |
-
*/
|
723 |
-
public function form_default_text() {
|
724 |
-
$form = array();
|
725 |
-
$form['heading'] = __( 'Sorry to see you go', 'notificationx' );
|
726 |
-
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'notificationx' );
|
727 |
-
|
728 |
-
$form['options'] = array(
|
729 |
-
__( 'I no longer need the plugin', 'notificationx' ),
|
730 |
-
[
|
731 |
-
'label' => __( 'I found a better plugin', 'notificationx' ),
|
732 |
-
'extra_field' => __( 'Please share which plugin', 'notificationx' )
|
733 |
-
],
|
734 |
-
__( "I couldn't get the plugin to work", 'notificationx' ),
|
735 |
-
__( 'It\'s a temporary deactivation', 'notificationx' ),
|
736 |
-
[
|
737 |
-
'label' => __( 'Other', 'notificationx' ),
|
738 |
-
'extra_field' => __( 'Please share the reason', 'notificationx' ),
|
739 |
-
'type' => 'textarea'
|
740 |
-
]
|
741 |
-
);
|
742 |
-
|
743 |
-
return $form;
|
744 |
-
}
|
745 |
-
|
746 |
-
/**
|
747 |
-
* Form text strings
|
748 |
-
* These can be filtered
|
749 |
-
* The filter hook must be unique to the plugin
|
750 |
-
* @since 1.0.0
|
751 |
-
*/
|
752 |
-
public function form_filterable_text() {
|
753 |
-
$form = $this->form_default_text();
|
754 |
-
return apply_filters( 'wpins_form_text_' . esc_attr( $this->plugin_name ), $form );
|
755 |
-
}
|
756 |
-
|
757 |
-
/**
|
758 |
-
* Form text strings
|
759 |
-
* These can be filtered
|
760 |
-
* @since 1.0.0
|
761 |
-
*/
|
762 |
-
public function goodbye_ajax() {
|
763 |
-
// Get our strings for the form
|
764 |
-
$form = $this->form_filterable_text();
|
765 |
-
if( ! isset( $form['heading'] ) || ! isset( $form['body'] ) || ! isset( $form['options'] ) || ! is_array( $form['options'] ) || ! isset( $form['details'] ) ) {
|
766 |
-
// If the form hasn't been filtered correctly, we revert to the default form
|
767 |
-
$form = $this->form_default_text();
|
768 |
-
}
|
769 |
-
// Build the HTML to go in the form
|
770 |
-
$html = '<div class="wpdev-put-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
771 |
-
$html .= '<div class="wpdev-put-goodbye-form-body"><p class="wpdev-put-goodbye-form-caption">' . esc_html( $form['body'] ) . '</p>';
|
772 |
-
if( is_array( $form['options'] ) ) {
|
773 |
-
$html .= '<div id="wpdev-'. esc_attr( $this->plugin_name ) .'-goodbye-options" class="wpdev-'. esc_attr( $this->plugin_name ) .'-goodbye-options"><ul>';
|
774 |
-
foreach( $form['options'] as $option ) {
|
775 |
-
if( is_array( $option ) ) {
|
776 |
-
$id = strtolower( str_replace( " ", "_", esc_attr( $option['label'] ) ) );
|
777 |
-
$id = $id . '_' . esc_attr( $this->plugin_name );
|
778 |
-
$html .= '<li class="has-goodbye-extra">';
|
779 |
-
$html .= '<input type="radio" name="wpdev-'. esc_attr( $this->plugin_name ) .'-goodbye-options" id="' . $id . '" value="' . esc_attr( $option['label'] ) . '">';
|
780 |
-
$html .= '<div><label for="' . $id . '">' . esc_attr( $option['label'] ) . '</label>';
|
781 |
-
if( isset( $option[ 'extra_field' ] ) && ! isset( $option['type'] )) {
|
782 |
-
$html .= '<input type="text" style="display: none" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '">';
|
783 |
-
}
|
784 |
-
if( isset( $option[ 'extra_field' ] ) && isset( $option['type'] )) {
|
785 |
-
$html .= '<'. $option['type'] .' style="display: none" type="text" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '"></' . $option['type'] . '>';
|
786 |
-
}
|
787 |
-
$html .= '</div></li>';
|
788 |
-
} else {
|
789 |
-
$id = strtolower( str_replace( " ", "_", esc_attr( $option ) ) );
|
790 |
-
$id = $id . '_' . esc_attr( $this->plugin_name );
|
791 |
-
$html .= '<li><input type="radio" name="wpdev-'. esc_attr( $this->plugin_name ) .'-goodbye-options" id="' . $id . '" value="' . esc_attr( $option ) . '"> <label for="' . $id . '">' . esc_attr( $option ) . '</label></li>';
|
792 |
}
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
835 |
-
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
|
980 |
-
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* EmbedPress_Plugin_Usage_Tracker
|
4 |
+
* This class is responsible for data sending to insights.
|
5 |
+
* @version 3.0.0
|
6 |
*/
|
|
|
7 |
namespace EmbedPress\Includes\Classes;
|
8 |
+
/**
|
9 |
+
* Exit if accessed directly
|
10 |
+
*/
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
exit;
|
13 |
+
}
|
14 |
+
/**
|
15 |
+
* Main SDK for EmbedPress_Plugin_Usage_Tracker.
|
16 |
+
*/
|
17 |
+
if( ! class_exists('EmbedPress_Plugin_Usage_Tracker') ) :
|
18 |
+
class EmbedPress_Plugin_Usage_Tracker {
|
19 |
+
/**
|
20 |
+
* WP Insights Version
|
21 |
+
*/
|
22 |
+
const WPINS_VERSION = '3.0.2';
|
23 |
+
/**
|
24 |
+
* API URL
|
25 |
+
*/
|
26 |
+
const API_URL = 'https://send.wpinsight.com/process-plugin-data';
|
27 |
+
/**
|
28 |
+
* Installed Plugin File
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
private $plugin_file = null;
|
33 |
+
/**
|
34 |
+
* Installed Plugin Name
|
35 |
+
*
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
private $plugin_name = null;
|
39 |
+
/**
|
40 |
+
* How often the event should subsequently
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
public $recurrence = 'daily';
|
44 |
+
private $event_hook = null;
|
45 |
+
/**
|
46 |
+
* Instace of EmbedPress_Plugin_Usage_Tracker
|
47 |
+
* @var EmbedPress_Plugin_Usage_Tracker
|
48 |
+
*/
|
49 |
+
private static $_instance = null;
|
50 |
+
/**
|
51 |
+
* Get Instance of EmbedPress_Plugin_Usage_Tracker
|
52 |
+
* @return EmbedPress_Plugin_Usage_Tracker
|
53 |
+
*/
|
54 |
+
public static function get_instance( $plugin_file, $args = [] ){
|
55 |
+
if( is_null( static::$_instance ) ) {
|
56 |
+
static::$_instance = new static( $plugin_file, $args );
|
57 |
+
}
|
58 |
+
return static::$_instance;
|
59 |
+
}
|
60 |
+
/**
|
61 |
+
* Automatically Invoked when initialized.
|
62 |
+
*
|
63 |
+
* @param array $args
|
64 |
+
*/
|
65 |
+
public function __construct( $plugin_file, $args = [] ){
|
66 |
+
$this->plugin_file = $plugin_file;
|
67 |
+
$this->plugin_name = basename( $this->plugin_file, '.php' );
|
68 |
+
$this->disabled_wp_cron = defined('DISABLE_WP_CRON') && DISABLE_WP_CRON == true;
|
69 |
+
$this->enable_self_cron = $this->disabled_wp_cron == true ? true : false;
|
70 |
+
|
71 |
+
$this->event_hook = 'put_do_weekly_action';
|
72 |
+
|
73 |
+
$this->require_optin = isset( $args['opt_in'] ) ? $args['opt_in'] : true;
|
74 |
+
$this->include_goodbye_form = isset( $args['goodbye_form'] ) ? $args['goodbye_form'] : true;
|
75 |
+
$this->marketing = isset( $args['email_marketing'] ) ? $args['email_marketing'] : true;
|
76 |
+
$this->options = isset( $args['options'] ) ? $args['options'] : [];
|
77 |
+
$this->item_id = isset( $args['item_id'] ) ? $args['item_id'] : false;
|
78 |
+
/**
|
79 |
+
* Activation Hook
|
80 |
+
*/
|
81 |
+
register_activation_hook( $this->plugin_file, array( $this, 'activate_this_plugin' ) );
|
82 |
+
/**
|
83 |
+
* Deactivation Hook
|
84 |
+
*/
|
85 |
+
register_deactivation_hook( $this->plugin_file, array( $this, 'deactivate_this_plugin' ) );
|
86 |
+
}
|
87 |
+
/**
|
88 |
+
* When user agreed to opt-in tracking schedule is enabled.
|
89 |
+
* @since 3.0.0
|
90 |
+
*/
|
91 |
+
public function schedule_tracking() {
|
92 |
+
if( $this->disabled_wp_cron ) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
if ( ! wp_next_scheduled( $this->event_hook ) ) {
|
96 |
+
wp_schedule_event( time(), $this->recurrence, $this->event_hook );
|
97 |
+
}
|
98 |
+
}
|
99 |
+
/**
|
100 |
+
* Add the schedule event if the plugin is tracked.
|
101 |
+
*
|
102 |
+
* @return void
|
103 |
+
*/
|
104 |
+
public function activate_this_plugin(){
|
105 |
+
$allow_tracking = $this->is_tracking_allowed();
|
106 |
+
if( ! $allow_tracking ) {
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
$this->schedule_tracking();
|
110 |
+
}
|
111 |
+
/**
|
112 |
+
* Remove the schedule event when plugin is deactivated and send the deactivated reason to inishghts if user submitted.
|
113 |
+
* @since 3.0.0
|
114 |
+
*/
|
115 |
+
public function deactivate_this_plugin() {
|
116 |
+
/**
|
117 |
+
* Check tracking is allowed or not.
|
118 |
+
*/
|
119 |
+
$allow_tracking = $this->is_tracking_allowed();
|
120 |
+
if( ! $allow_tracking ) {
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
$body = $this->get_data();
|
124 |
+
$body['status'] = 'Deactivated';
|
125 |
+
$body['deactivated_date'] = time();
|
126 |
+
|
127 |
+
// Check deactivation reason and add for insights data.
|
128 |
+
if( false !== get_option( 'wpins_deactivation_reason_' . $this->plugin_name ) ) {
|
129 |
+
$body['deactivation_reason'] = get_option( 'wpins_deactivation_reason_' . $this->plugin_name );
|
130 |
+
}
|
131 |
+
if( false !== get_option( 'wpins_deactivation_details_' . $this->plugin_name ) ) {
|
132 |
+
$body['deactivation_details'] = get_option( 'wpins_deactivation_details_' . $this->plugin_name );
|
133 |
+
}
|
134 |
+
|
135 |
+
$this->send_data( $body );
|
136 |
+
delete_option( 'wpins_deactivation_reason_' . $this->plugin_name );
|
137 |
+
delete_option( 'wpins_deactivation_details_' . $this->plugin_name );
|
138 |
+
/**
|
139 |
+
* Clear the event schedule.
|
140 |
+
*/
|
141 |
+
if( ! $this->disabled_wp_cron ) {
|
142 |
+
wp_clear_scheduled_hook( $this->event_hook );
|
143 |
+
}
|
144 |
+
}
|
145 |
+
/**
|
146 |
+
* Initial Method to Hook Everything.
|
147 |
+
* @return void
|
148 |
+
*/
|
149 |
+
public function init(){
|
150 |
+
add_action( 'wpdeveloper_notice_clicked_for_' . $this->plugin_name, array( $this, 'clicked' ) );
|
151 |
+
add_action( $this->event_hook, array( $this, 'do_tracking' ) );
|
152 |
+
// For Test
|
153 |
+
// add_action( 'admin_init', array( $this, 'force_tracking' ) );
|
154 |
+
add_action( 'wpdeveloper_optin_notice_for_' . $this->plugin_name, array( $this, 'notice' ) );
|
155 |
+
/**
|
156 |
+
* Deactivation Reason Form and Submit Data to Insights.
|
157 |
+
*/
|
158 |
+
add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'deactivate_action_links' ) );
|
159 |
+
add_action( 'admin_footer-plugins.php', array( $this, 'deactivate_reasons_form' ) );
|
160 |
+
add_action( 'wp_ajax_deactivation_form_' . esc_attr( $this->plugin_name ), array( $this, 'deactivate_reasons_form_submit' ) );
|
161 |
+
}
|
162 |
+
/**
|
163 |
+
* For Redirecting Current Page without Arguments!
|
164 |
+
*
|
165 |
+
* @return void
|
166 |
+
*/
|
167 |
+
private function redirect_to(){
|
168 |
+
$request_uri = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
|
169 |
+
$query_string = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY );
|
170 |
+
parse_str( $query_string, $current_url );
|
171 |
+
|
172 |
+
$unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later', 'plugin_action', 'marketing_optin' );
|
173 |
+
|
174 |
+
foreach( $unset_array as $value ) {
|
175 |
+
if( isset( $current_url[ $value ] ) ) {
|
176 |
+
unset( $current_url[ $value ] );
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
$current_url = http_build_query($current_url);
|
181 |
+
$redirect_url = $request_uri . '?' . $current_url;
|
182 |
+
return $redirect_url;
|
183 |
+
}
|
184 |
+
/**
|
185 |
+
* This method forcing the do_tracking method to execute instant.
|
186 |
+
* @return void
|
187 |
+
*/
|
188 |
+
public function force_tracking(){
|
189 |
+
$this->do_tracking( true );
|
190 |
+
}
|
191 |
+
/**
|
192 |
+
* This method is responsible for all the magic from the front of the plugin.
|
193 |
+
* @since 3.0.0
|
194 |
+
* @param $force Force tracking if it's not the correct time to track/
|
195 |
+
*/
|
196 |
+
public function do_tracking( $force = false ) {
|
197 |
+
/**
|
198 |
+
* Check URL is set or not.
|
199 |
+
*/
|
200 |
+
if ( empty( self::API_URL ) ) {
|
201 |
+
return;
|
202 |
+
}
|
203 |
+
/**
|
204 |
+
* Check is tracking allowed or not.
|
205 |
+
*/
|
206 |
+
if( ! $this->is_tracking_allowed() ) {
|
207 |
+
return;
|
208 |
+
}
|
209 |
+
/**
|
210 |
+
* Check is this the correct time to track or not.
|
211 |
+
* or Force to track.
|
212 |
+
*/
|
213 |
+
if( ! $this->is_time_to_track() && ! $force ) {
|
214 |
+
return;
|
215 |
+
}
|
216 |
+
/**
|
217 |
+
* Get All Data.
|
218 |
+
*/
|
219 |
+
$body = $this->get_data();
|
220 |
+
/**
|
221 |
+
* Send all data.
|
222 |
+
*/
|
223 |
+
return $this->send_data( $body );
|
224 |
+
}
|
225 |
+
/**
|
226 |
+
* Is tracking allowed?
|
227 |
+
* @since 1.0.0
|
228 |
+
*/
|
229 |
+
private function is_tracking_allowed() {
|
230 |
+
// First, check if the user has changed their mind and opted out of tracking
|
231 |
+
if( $this->has_user_opted_out() ) {
|
232 |
+
$this->set_is_tracking_allowed( false, $this->plugin_name );
|
233 |
+
return false;
|
234 |
+
}
|
235 |
+
// The wpins_allow_tracking option is an array of plugins that are being tracked
|
236 |
+
$allow_tracking = get_option( 'wpins_allow_tracking' );
|
237 |
+
// If this plugin is in the array, then tracking is allowed
|
238 |
+
if( isset( $allow_tracking[$this->plugin_name] ) ) {
|
239 |
+
return true;
|
240 |
+
}
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
/**
|
244 |
+
* Set a flag in DB If tracking is allowed.
|
245 |
+
*
|
246 |
+
* @since 3.0.0
|
247 |
+
* @param $is_allowed Boolean true if is allowed.
|
248 |
+
*/
|
249 |
+
protected function set_is_tracking_allowed( $is_allowed, $plugin = null ) {
|
250 |
+
if( empty( $plugin ) ) {
|
251 |
+
$plugin = $this->plugin_name;
|
252 |
+
}
|
253 |
+
/**
|
254 |
+
* Get All Tracked Plugin List using this Tracker.
|
255 |
+
*/
|
256 |
+
$allow_tracking = get_option( 'wpins_allow_tracking' );
|
257 |
+
/**
|
258 |
+
* Check user is opted out for tracking or not.
|
259 |
+
*/
|
260 |
+
if( $this->has_user_opted_out() ) {
|
261 |
+
if( isset( $allow_tracking[$plugin] ) ) {
|
262 |
+
unset( $allow_tracking[$plugin] );
|
263 |
+
}
|
264 |
+
} else if( $is_allowed || ! $this->require_optin ) {
|
265 |
+
/**
|
266 |
+
* If user has agreed to allow tracking
|
267 |
+
*/
|
268 |
+
if( empty( $allow_tracking ) || ! is_array( $allow_tracking ) ) {
|
269 |
+
$allow_tracking = array( $plugin => $plugin );
|
270 |
+
} else {
|
271 |
+
$allow_tracking[$plugin] = $plugin;
|
272 |
+
}
|
273 |
+
} else {
|
274 |
+
if( isset( $allow_tracking[$plugin] ) ) {
|
275 |
+
unset( $allow_tracking[$plugin] );
|
276 |
+
}
|
277 |
+
}
|
278 |
+
update_option( 'wpins_allow_tracking', $allow_tracking );
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* Check the user has opted out or not.
|
283 |
+
*
|
284 |
+
* @since 3.0.0
|
285 |
+
* @return Boolean
|
286 |
+
*/
|
287 |
+
protected function has_user_opted_out() {
|
288 |
+
if( ! empty( $this->options ) ) {
|
289 |
+
foreach( $this->options as $option_name ) {
|
290 |
+
$options = get_option( $option_name );
|
291 |
+
if( ! empty( $options['wpins_opt_out'] ) ) {
|
292 |
+
return true;
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
+
return false;
|
297 |
+
}
|
298 |
+
/**
|
299 |
+
* Check if it's time to track
|
300 |
+
*
|
301 |
+
* @since 3.0.0
|
302 |
+
*/
|
303 |
+
public function is_time_to_track() {
|
304 |
+
$track_times = get_option( 'wpins_last_track_time', array() );
|
305 |
+
return ! isset( $track_times[$this->plugin_name] ) ? true :
|
306 |
+
( ( isset( $track_times[$this->plugin_name] ) && $track_times[$this->plugin_name] ) < strtotime( '-1 day' ) ? true : false );
|
307 |
+
}
|
308 |
+
/**
|
309 |
+
* Set tracking time.
|
310 |
+
*
|
311 |
+
* @since 3.0.0
|
312 |
+
*/
|
313 |
+
public function set_track_time() {
|
314 |
+
$track_times = get_option( 'wpins_last_track_time', array() );
|
315 |
+
$track_times[ $this->plugin_name ] = time();
|
316 |
+
update_option( 'wpins_last_track_time', $track_times );
|
317 |
+
}
|
318 |
+
/**
|
319 |
+
* This method is responsible for collecting all data.
|
320 |
+
*
|
321 |
+
* @since 3.0.0
|
322 |
+
*/
|
323 |
+
public function get_data() {
|
324 |
+
$body = array(
|
325 |
+
'plugin_slug' => sanitize_text_field( $this->plugin_name ),
|
326 |
+
'url' => get_bloginfo( 'url' ),
|
327 |
+
'site_name' => get_bloginfo( 'name' ),
|
328 |
+
'site_version' => get_bloginfo( 'version' ),
|
329 |
+
'site_language' => get_bloginfo( 'language' ),
|
330 |
+
'charset' => get_bloginfo( 'charset' ),
|
331 |
+
'wpins_version' => self::WPINS_VERSION,
|
332 |
+
'php_version' => phpversion(),
|
333 |
+
'multisite' => is_multisite(),
|
334 |
+
'file_location' => __FILE__
|
335 |
+
);
|
336 |
+
|
337 |
+
// Collect the email if the correct option has been set
|
338 |
+
if( $this->marketing ) {
|
339 |
+
if( ! function_exists( 'wp_get_current_user' ) ) {
|
340 |
+
include ABSPATH . 'wp-includes/pluggable.php';
|
341 |
+
}
|
342 |
+
$current_user = wp_get_current_user();
|
343 |
+
$email = $current_user->user_email;
|
344 |
+
if( is_email( $email ) ) {
|
345 |
+
$body['email'] = $email;
|
346 |
+
}
|
347 |
+
}
|
348 |
+
$body['marketing_method'] = $this->marketing;
|
349 |
+
$body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Collect all active and inactive plugins
|
353 |
+
*/
|
354 |
+
if( ! function_exists( 'get_plugins' ) ) {
|
355 |
+
include ABSPATH . '/wp-admin/includes/plugin.php';
|
356 |
+
}
|
357 |
+
$plugins = array_keys( get_plugins() );
|
358 |
+
$active_plugins = is_network_admin() ? array_keys( get_site_option( 'active_sitewide_plugins', array() ) ) : get_option( 'active_plugins', array() );
|
359 |
+
foreach ( $plugins as $key => $plugin ) {
|
360 |
+
if ( in_array( $plugin, $active_plugins ) ) {
|
361 |
+
unset( $plugins[$key] );
|
362 |
+
}
|
363 |
+
}
|
364 |
+
$body['active_plugins'] = $active_plugins;
|
365 |
+
$body['inactive_plugins'] = $plugins;
|
366 |
+
|
367 |
+
/**
|
368 |
+
* Text Direction.
|
369 |
+
*/
|
370 |
+
$body['text_direction'] = ( function_exists( 'is_rtl' ) ? ( is_rtl() ? 'RTL' : 'LTR' ) : 'NOT SET' );
|
371 |
+
/**
|
372 |
+
* Get Our Plugin Data.
|
373 |
+
* @since 3.0.0
|
374 |
+
*/
|
375 |
+
$plugin = $this->plugin_data();
|
376 |
+
if( empty( $plugin ) ) {
|
377 |
+
$body['message'] .= __( 'We can\'t detect any plugin information. This is most probably because you have not included the code in the plugin main file.', 'disable-comments' );
|
378 |
+
$body['status'] = 'NOT FOUND';
|
379 |
+
} else {
|
380 |
+
if( isset( $plugin['Name'] ) ) {
|
381 |
+
$body['plugin'] = sanitize_text_field( $plugin['Name'] );
|
382 |
+
}
|
383 |
+
if( isset( $plugin['Version'] ) ) {
|
384 |
+
$body['version'] = sanitize_text_field( $plugin['Version'] );
|
385 |
+
}
|
386 |
+
$body['status'] = 'Active';
|
387 |
+
}
|
388 |
+
|
389 |
+
/**
|
390 |
+
* Get our plugin options
|
391 |
+
* @since 1.0.0
|
392 |
+
*/
|
393 |
+
// $options = $this->options;
|
394 |
+
// $plugin_options = array();
|
395 |
+
// if( ! empty( $options ) && is_array( $options ) ) {
|
396 |
+
// foreach( $options as $option ) {
|
397 |
+
// $fields = get_option( $option );
|
398 |
+
// // Check for permission to send this option
|
399 |
+
// if( isset( $fields['wpins_registered_setting'] ) ) {
|
400 |
+
// foreach( $fields as $key=>$value ) {
|
401 |
+
// $plugin_options[$key] = $value;
|
402 |
+
// }
|
403 |
+
// }
|
404 |
+
// }
|
405 |
+
// }
|
406 |
+
// $body['plugin_options'] = $this->options; // Returns array
|
407 |
+
// $body['plugin_options_fields'] = $plugin_options; // Returns object
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Get active theme name and version
|
411 |
+
* @since 3.0.0
|
412 |
+
*/
|
413 |
+
$theme = wp_get_theme();
|
414 |
+
if( $theme->Name ) {
|
415 |
+
$body['theme'] = sanitize_text_field( $theme->Name );
|
416 |
+
}
|
417 |
+
if( $theme->Version ) {
|
418 |
+
$body['theme_version'] = sanitize_text_field( $theme->Version );
|
419 |
+
}
|
420 |
+
return $body;
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Collect plugin data,
|
425 |
+
* Retrieve current plugin information
|
426 |
+
*
|
427 |
+
* @since 3.0.0
|
428 |
+
*/
|
429 |
+
public function plugin_data() {
|
430 |
+
if( ! function_exists( 'get_plugin_data' ) ) {
|
431 |
+
include ABSPATH . '/wp-admin/includes/plugin.php';
|
432 |
+
}
|
433 |
+
$plugin = get_plugin_data( $this->plugin_file );
|
434 |
+
return $plugin;
|
435 |
+
}
|
436 |
+
/**
|
437 |
+
* Send the data to insights.
|
438 |
+
* @since 3.0.0
|
439 |
+
*/
|
440 |
+
public function send_data( $body ) {
|
441 |
+
/**
|
442 |
+
* Get SITE ID
|
443 |
+
*/
|
444 |
+
$site_id_key = "wpins_{$this->plugin_name}_site_id";
|
445 |
+
$site_id = get_option( $site_id_key, false );
|
446 |
+
$failed_data = [];
|
447 |
+
$site_url = get_bloginfo( 'url' );
|
448 |
+
$original_site_url = get_option( "wpins_{$this->plugin_name}_original_url", false );
|
449 |
+
|
450 |
+
if( ( $original_site_url === false || $original_site_url != $site_url ) && version_compare( $body['wpins_version'], '3.0.1', '>=' ) ) {
|
451 |
+
$site_id = false;
|
452 |
+
}
|
453 |
+
/**
|
454 |
+
* Send Initial Data to API
|
455 |
+
*/
|
456 |
+
if( $site_id == false && $this->item_id !== false ) {
|
457 |
+
if( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' ) ) {
|
458 |
+
$country_request = wp_remote_get( 'http://ip-api.com/json/'. $_SERVER['REMOTE_ADDR'] .'?fields=country');
|
459 |
+
if( ! is_wp_error( $country_request ) && $country_request['response']['code'] == 200 ) {
|
460 |
+
$ip_data = json_decode( $country_request["body"] );
|
461 |
+
$body['country'] = isset( $ip_data->country ) ? $ip_data->country : 'NOT SET';
|
462 |
+
}
|
463 |
+
}
|
464 |
+
|
465 |
+
$body['plugin_slug'] = $this->plugin_name;
|
466 |
+
$body['url'] = $site_url;
|
467 |
+
$body['item_id'] = $this->item_id;
|
468 |
+
|
469 |
+
$request = $this->remote_post( $body );
|
470 |
+
if( ! is_wp_error( $request ) && $request['response']['code'] == 200 ) {
|
471 |
+
$retrieved_body = json_decode( wp_remote_retrieve_body( $request ), true );
|
472 |
+
if( is_array( $retrieved_body ) && isset( $retrieved_body['siteId'] ) ) {
|
473 |
+
update_option( $site_id_key, $retrieved_body['siteId'] );
|
474 |
+
update_option( "wpins_{$this->plugin_name}_original_url", $site_url );
|
475 |
+
update_option( "wpins_{$this->plugin_name}_{$retrieved_body['siteId']}", $body );
|
476 |
+
}
|
477 |
+
} else {
|
478 |
+
$failed_data = $body;
|
479 |
+
}
|
480 |
+
}
|
481 |
+
|
482 |
+
$site_id_data_key = "wpins_{$this->plugin_name}_{$site_id}";
|
483 |
+
$site_id_data_failed_key = "wpins_{$this->plugin_name}_{$site_id}_send_failed";
|
484 |
+
|
485 |
+
if( $site_id != false ) {
|
486 |
+
$old_sent_data = get_option( $site_id_data_key, [] );
|
487 |
+
$diff_data = $this->diff( $body, $old_sent_data );
|
488 |
+
$failed_data = get_option( $site_id_data_failed_key, [] );
|
489 |
+
if( ! empty( $failed_data ) && $diff_data != $failed_data ) {
|
490 |
+
$failed_data = array_merge( $failed_data, $diff_data );
|
491 |
+
}
|
492 |
+
}
|
493 |
+
|
494 |
+
if( ! empty( $failed_data ) && $site_id != false ) {
|
495 |
+
$failed_data['plugin_slug'] = $this->plugin_name;
|
496 |
+
$failed_data['url'] = $site_url;
|
497 |
+
$failed_data['site_id'] = $site_id;
|
498 |
+
if( $original_site_url != false ) {
|
499 |
+
$failed_data['original_url'] = $original_site_url;
|
500 |
+
}
|
501 |
+
|
502 |
+
$request = $this->remote_post( $failed_data );
|
503 |
+
if( ! is_wp_error( $request ) ) {
|
504 |
+
delete_option( $site_id_data_failed_key );
|
505 |
+
$replaced_data = array_merge( $old_sent_data, $failed_data );
|
506 |
+
update_option( $site_id_data_key, $replaced_data );
|
507 |
+
}
|
508 |
+
}
|
509 |
+
|
510 |
+
if( ! empty( $diff_data ) && $site_id != false && empty( $failed_data ) ) {
|
511 |
+
$diff_data['plugin_slug'] = $this->plugin_name;
|
512 |
+
$diff_data['url'] = $site_url;
|
513 |
+
$diff_data['site_id'] = $site_id;
|
514 |
+
if( $original_site_url != false ) {
|
515 |
+
$diff_data['original_url'] = $original_site_url;
|
516 |
+
}
|
517 |
+
|
518 |
+
$request = $this->remote_post( $diff_data );
|
519 |
+
if( is_wp_error( $request ) ) {
|
520 |
+
update_option( $site_id_data_failed_key, $diff_data );
|
521 |
+
} else {
|
522 |
+
$replaced_data = array_merge( $old_sent_data, $diff_data );
|
523 |
+
update_option( $site_id_data_key, $replaced_data );
|
524 |
+
}
|
525 |
+
}
|
526 |
+
|
527 |
+
$this->set_track_time();
|
528 |
+
|
529 |
+
if( isset( $request ) && is_wp_error( $request ) ) {
|
530 |
+
return $request;
|
531 |
+
}
|
532 |
+
|
533 |
+
if( isset( $request ) ) {
|
534 |
+
return true;
|
535 |
+
}
|
536 |
+
return false;
|
537 |
+
}
|
538 |
+
/**
|
539 |
+
* WP_REMOTE_POST method responsible for send data to the API_URL
|
540 |
+
*
|
541 |
+
* @param array $data
|
542 |
+
* @param array $args
|
543 |
+
* @return void
|
544 |
+
*/
|
545 |
+
protected function remote_post( $data = array(), $args = array() ){
|
546 |
+
if( empty( $data ) ) {
|
547 |
+
return;
|
548 |
+
}
|
549 |
+
|
550 |
+
$args = wp_parse_args( $args, array(
|
551 |
+
'method' => 'POST',
|
552 |
+
'timeout' => 30,
|
553 |
+
'redirection' => 5,
|
554 |
+
'httpversion' => '1.1',
|
555 |
+
'blocking' => true,
|
556 |
+
'body' => $data,
|
557 |
+
'user-agent' => 'PUT/1.0.0; ' . get_bloginfo( 'url' )
|
558 |
+
));
|
559 |
+
$request = wp_remote_post( esc_url( self::API_URL ), $args );
|
560 |
+
if( is_wp_error( $request ) || ( isset( $request['response'], $request['response']['code'] ) && $request['response']['code'] != 200 ) ) {
|
561 |
+
return new WP_Error( 500, 'Something went wrong.' );
|
562 |
+
}
|
563 |
+
return $request;
|
564 |
+
}
|
565 |
+
/**
|
566 |
+
* Difference between old and new data
|
567 |
+
*
|
568 |
+
* @param array $new_data
|
569 |
+
* @param array $old_data
|
570 |
+
* @return void
|
571 |
+
*/
|
572 |
+
protected function diff( $new_data, $old_data ){
|
573 |
+
$data = [];
|
574 |
+
if( ! empty( $new_data ) ) {
|
575 |
+
foreach( $new_data as $key => $value ) {
|
576 |
+
if( isset( $old_data[ $key ] ) ) {
|
577 |
+
if( $old_data[ $key ] == $value ) {
|
578 |
+
continue;
|
579 |
+
}
|
580 |
+
}
|
581 |
+
$data[ $key ] = $value;
|
582 |
+
}
|
583 |
+
}
|
584 |
+
return $data;
|
585 |
+
}
|
586 |
+
/**
|
587 |
+
* Display the admin notice to users to allow them to opt in
|
588 |
+
*
|
589 |
+
* @since 3.0.0
|
590 |
+
*/
|
591 |
+
public function notice() {
|
592 |
+
/**
|
593 |
+
* Return if notice is not set.
|
594 |
+
*/
|
595 |
+
if( ! isset( $this->notice_options['notice'] ) ) {
|
596 |
+
return;
|
597 |
+
}
|
598 |
+
/**
|
599 |
+
* Check is allowed or blocked for notice.
|
600 |
+
*/
|
601 |
+
$block_notice = get_option( 'wpins_block_notice' );
|
602 |
+
if( isset( $block_notice[$this->plugin_name] ) ) {
|
603 |
+
return;
|
604 |
+
}
|
605 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
606 |
+
return;
|
607 |
+
}
|
608 |
+
|
609 |
+
$url_yes = add_query_arg( [
|
610 |
+
'plugin' => $this->plugin_name,
|
611 |
+
'plugin_action' => 'yes',
|
612 |
+
] );
|
613 |
+
$url_no = add_query_arg( array(
|
614 |
+
'plugin' => $this->plugin_name,
|
615 |
+
'plugin_action' => 'no'
|
616 |
+
) );
|
617 |
+
|
618 |
+
// Decide on notice text
|
619 |
+
$notice_text = $this->notice_options['notice'] . ' <a href="#" class="wpinsights-'. $this->plugin_name .'-collect">'. $this->notice_options['consent_button_text'] .'</a>';
|
620 |
+
$extra_notice_text = $this->notice_options['extra_notice'];
|
621 |
+
|
622 |
+
$output = '';
|
623 |
+
$output .= '<div class="notice notice-info updated put-dismiss-notice">';
|
624 |
+
$output .= '<p>'. $notice_text .'</p>';
|
625 |
+
$output .= '<div class="wpinsights-data" style="display: none;">';
|
626 |
+
$output .= '<p>'. $extra_notice_text .'</p>';
|
627 |
+
$output .= '</div>';
|
628 |
+
$output .= '<p>';
|
629 |
+
$output .= '<a href="'. esc_url( $url_yes ) .'" class="button-primary">'. $this->notice_options['yes'] .'</a> ';
|
630 |
+
$output .= '<a href="'. esc_url( $url_no ) .'" class="button-secondary">'. $this->notice_options['no'] .'</a>';
|
631 |
+
$output .= '</p>';
|
632 |
+
$output .= "<script type='text/javascript'>jQuery('.wpinsights-". $this->plugin_name ."-collect').on('click', function(e) {e.preventDefault();jQuery('.wpinsights-data').slideToggle('fast');});</script>";
|
633 |
+
$output .= '</div>';
|
634 |
+
|
635 |
+
echo $output;
|
636 |
+
}
|
637 |
+
/**
|
638 |
+
* Set all notice options to customized notice.
|
639 |
+
*
|
640 |
+
* @since 3.0.0
|
641 |
+
* @param array $options
|
642 |
+
* @return void
|
643 |
+
*/
|
644 |
+
public function set_notice_options( $options = [] ){
|
645 |
+
$default_options = [
|
646 |
+
'consent_button_text' => __( 'What we collect.', 'disable-comments' ),
|
647 |
+
'yes' => __( 'Sure, I\'d like to help', 'disable-comments' ),
|
648 |
+
'no' => __( 'No Thanks.', 'disable-comments' ),
|
649 |
+
];
|
650 |
+
$options = wp_parse_args( $options, $default_options );
|
651 |
+
$this->notice_options = $options;
|
652 |
+
}
|
653 |
+
/**
|
654 |
+
* Responsible for track the click from Notice.
|
655 |
+
* @return void
|
656 |
+
*/
|
657 |
+
public function clicked(){
|
658 |
+
if( isset( $_GET['plugin'] ) && trim($_GET['plugin']) === $this->plugin_name && isset( $_GET['plugin_action'] ) ) {
|
659 |
+
if( isset( $_GET['tab'] ) && $_GET['tab'] === 'plugin-information' ) {
|
660 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
}
|
662 |
+
$plugin = sanitize_text_field( $_GET['plugin'] );
|
663 |
+
$action = sanitize_text_field( $_GET['plugin_action'] );
|
664 |
+
if( $action == 'yes' ) {
|
665 |
+
$this->schedule_tracking();
|
666 |
+
$this->set_is_tracking_allowed( true, $plugin );
|
667 |
+
if( $this->do_tracking( true ) ) {
|
668 |
+
$this->update_block_notice( $plugin );
|
669 |
+
}
|
670 |
+
/**
|
671 |
+
* Redirect User To the Current URL, but without set query arguments.
|
672 |
+
*/
|
673 |
+
wp_safe_redirect( $this->redirect_to() );
|
674 |
+
} else {
|
675 |
+
$this->set_is_tracking_allowed( false, $plugin );
|
676 |
+
$this->update_block_notice( $plugin );
|
677 |
+
}
|
678 |
+
}
|
679 |
+
}
|
680 |
+
/**
|
681 |
+
* Set if we should block the opt-in notice for this plugin
|
682 |
+
*
|
683 |
+
* @since 3.0.0
|
684 |
+
*/
|
685 |
+
public function update_block_notice( $plugin = null ) {
|
686 |
+
if( empty( $plugin ) ) {
|
687 |
+
$plugin = $this->plugin_name;
|
688 |
+
}
|
689 |
+
$block_notice = get_option( 'wpins_block_notice' );
|
690 |
+
if( empty( $block_notice ) || ! is_array( $block_notice ) ) {
|
691 |
+
$block_notice = array( $plugin => $plugin );
|
692 |
+
} else {
|
693 |
+
$block_notice[$plugin] = $plugin;
|
694 |
+
}
|
695 |
+
update_option( 'wpins_block_notice', $block_notice );
|
696 |
+
}
|
697 |
+
/**
|
698 |
+
* AJAX callback when the deactivated form is submitted.
|
699 |
+
* @since 3.0.0
|
700 |
+
*/
|
701 |
+
public function deactivate_reasons_form_submit() {
|
702 |
+
check_ajax_referer( 'wpins_deactivation_nonce', 'security' );
|
703 |
+
if( isset( $_POST['values'] ) ) {
|
704 |
+
$values = $_POST['values'];
|
705 |
+
update_option( 'wpins_deactivation_reason_' . $this->plugin_name, $values );
|
706 |
+
}
|
707 |
+
if( isset( $_POST['details'] ) ) {
|
708 |
+
$details = sanitize_text_field( $_POST['details'] );
|
709 |
+
update_option( 'wpins_deactivation_details_' . $this->plugin_name, $details );
|
710 |
+
}
|
711 |
+
echo 'success';
|
712 |
+
wp_die();
|
713 |
+
}
|
714 |
+
/**
|
715 |
+
* Filter the deactivation link to allow us to present a form when the user deactivates the plugin
|
716 |
+
* @since 3.0.0
|
717 |
+
*/
|
718 |
+
public function deactivate_action_links( $links ) {
|
719 |
+
/**
|
720 |
+
* Check is tracking allowed or not.
|
721 |
+
*/
|
722 |
+
if( ! $this->is_tracking_allowed() ) {
|
723 |
+
return $links;
|
724 |
+
}
|
725 |
+
if( isset( $links['deactivate'] ) && $this->include_goodbye_form ) {
|
726 |
+
$deactivation_link = $links['deactivate'];
|
727 |
+
/**
|
728 |
+
* Change the default deactivate button link.
|
729 |
+
*/
|
730 |
+
$deactivation_link = str_replace( '<a ', '<div class="wpinsights-goodbye-form-wrapper-'. esc_attr( $this->plugin_name ) .'"><div class="wpinsights-goodbye-form-bg"></div><span class="wpinsights-goodbye-form" id="wpinsights-goodbye-form"></span></div><a onclick="javascript:event.preventDefault();" id="wpinsights-goodbye-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
731 |
+
$links['deactivate'] = $deactivation_link;
|
732 |
+
}
|
733 |
+
return $links;
|
734 |
+
}
|
735 |
+
/**
|
736 |
+
* ALL Deactivate Reasons.
|
737 |
+
* @since 3.0.0
|
738 |
+
*/
|
739 |
+
public function deactivation_reasons() {
|
740 |
+
$form = array();
|
741 |
+
$form['heading'] = __( 'Sorry to see you go', 'disable-comments' );
|
742 |
+
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'disable-comments' );
|
743 |
+
|
744 |
+
$form['options'] = array(
|
745 |
+
__( 'I no longer need the plugin', 'disable-comments' ),
|
746 |
+
[
|
747 |
+
'label' => __( 'I found a better plugin', 'disable-comments' ),
|
748 |
+
'extra_field' => __( 'Please share which plugin', 'disable-comments' )
|
749 |
+
],
|
750 |
+
__( "I couldn't get the plugin to work", 'disable-comments' ),
|
751 |
+
__( 'It\'s a temporary deactivation', 'disable-comments' ),
|
752 |
+
[
|
753 |
+
'label' => __( 'Other', 'disable-comments' ),
|
754 |
+
'extra_field' => __( 'Please share the reason', 'disable-comments' ),
|
755 |
+
'type' => 'textarea'
|
756 |
+
]
|
757 |
+
);
|
758 |
+
return apply_filters( 'wpins_form_text_' . $this->plugin_name, $form );
|
759 |
+
}
|
760 |
+
/**
|
761 |
+
* Deactivate Reasons Form.
|
762 |
+
* This form will appears when user wants to deactivate the plugin to send you deactivated reasons.
|
763 |
+
*
|
764 |
+
* @since 3.0.0
|
765 |
+
*/
|
766 |
+
public function deactivate_reasons_form() {
|
767 |
+
$form = $this->deactivation_reasons();
|
768 |
+
$class_plugin_name = esc_attr( $this->plugin_name );
|
769 |
+
$html = '<div class="wpinsights-goodbye-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
770 |
+
$html .= '<div class="wpinsights-goodbye-form-body"><p class="wpinsights-goodbye-form-caption">' . esc_html( $form['body'] ) . '</p>';
|
771 |
+
if( is_array( $form['options'] ) ) {
|
772 |
+
$html .= '<div id="wpinsights-goodbye-options" class="wpinsights-goodbye-options"><ul>';
|
773 |
+
foreach( $form['options'] as $option ) {
|
774 |
+
if( is_array( $option ) ) {
|
775 |
+
$id = strtolower( str_replace( " ", "_", esc_attr( $option['label'] ) ) );
|
776 |
+
$id = $id . '_' . $class_plugin_name;
|
777 |
+
$html .= '<li class="has-goodbye-extra">';
|
778 |
+
$html .= '<input type="radio" name="wpinsights-'. $class_plugin_name .'-goodbye-options" id="' . $id . '" value="' . esc_attr( $option['label'] ) . '">';
|
779 |
+
$html .= '<div><label for="' . $id . '">' . esc_attr( $option['label'] ) . '</label>';
|
780 |
+
if( isset( $option[ 'extra_field' ] ) && ! isset( $option['type'] )) {
|
781 |
+
$html .= '<input type="text" style="display: none" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '">';
|
782 |
+
}
|
783 |
+
if( isset( $option[ 'extra_field' ] ) && isset( $option['type'] )) {
|
784 |
+
$html .= '<'. $option['type'] .' style="display: none" type="text" name="'. $id .'" id="' . str_replace( " ", "", esc_attr( $option['extra_field'] ) ) . '" placeholder="' . esc_attr( $option['extra_field'] ) . '"></' . $option['type'] . '>';
|
785 |
+
}
|
786 |
+
$html .= '</div></li>';
|
787 |
+
} else {
|
788 |
+
$id = strtolower( str_replace( " ", "_", esc_attr( $option ) ) );
|
789 |
+
$id = $id . '_' . $class_plugin_name;
|
790 |
+
$html .= '<li><input type="radio" name="wpinsights-'. $class_plugin_name .'-goodbye-options" id="' . $id . '" value="' . esc_attr( $option ) . '"> <label for="' . $id . '">' . esc_attr( $option ) . '</label></li>';
|
791 |
+
}
|
792 |
+
}
|
793 |
+
$html .= '</ul></div><!-- .wpinsights-'. $class_plugin_name .'-goodbye-options -->';
|
794 |
+
}
|
795 |
+
$html .= '</div><!-- .wpinsights-goodbye-form-body -->';
|
796 |
+
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'disable-comments' ) . '</p>';
|
797 |
+
|
798 |
+
$wrapper_class = '.wpinsights-goodbye-form-wrapper-'. $class_plugin_name;
|
799 |
+
|
800 |
+
$styles = '';
|
801 |
+
$styles .= '<style type="text/css">';
|
802 |
+
$styles .= '.wpinsights-form-active-' . $class_plugin_name . ' .wpinsights-goodbye-form-bg {';
|
803 |
+
$styles .= 'background: rgba( 0, 0, 0, .8 );position: fixed;top: 0;left: 0;width: 100%;height: 100%;z-index: 9;';
|
804 |
+
$styles .= '}';
|
805 |
+
$styles .= $wrapper_class . '{';
|
806 |
+
$styles .= 'position: relative; display: none;';
|
807 |
+
$styles .= '}';
|
808 |
+
$styles .= '.wpinsights-form-active-' . $class_plugin_name . ' ' . $wrapper_class . '{';
|
809 |
+
$styles .= 'display: flex !important; position: fixed;top: 0;left: 0;width: 100%;height: 100%; justify-content: center; align-items: center;';
|
810 |
+
$styles .= '}';
|
811 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form { display: none; }';
|
812 |
+
$styles .= '.wpinsights-form-active-' . $class_plugin_name . ' .wpinsights-goodbye-form {';
|
813 |
+
$styles .= 'position: relative !important; width: 550px; max-width: 80%; background: #fff; box-shadow: 2px 8px 23px 3px rgba(0,0,0,.2); border-radius: 3px; white-space: normal; overflow: hidden; display: block; z-index: 999999;';
|
814 |
+
$styles .= '}';
|
815 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-head {';
|
816 |
+
$styles .= 'background: #fff; color: #495157; padding: 18px; box-shadow: 0 0 8px rgba(0,0,0,.1); font-size: 15px;';
|
817 |
+
$styles .= '}';
|
818 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form .wpinsights-goodbye-form-head strong { font-size: 15px; }';
|
819 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body { padding: 8px 18px; color: #333; }';
|
820 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body label { padding-left: 5px; color: #6d7882; }';
|
821 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body .wpinsights-goodbye-form-caption {';
|
822 |
+
$styles .= 'font-weight: 500; font-size: 15px; color: #495157; line-height: 1.4;';
|
823 |
+
$styles .= '}';
|
824 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options { padding-top: 5px; }';
|
825 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li { margin-bottom: 15px; }';
|
826 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li > div { display: inline; padding-left: 3px; }';
|
827 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li > div > input, '. $wrapper_class .' .wpinsights-goodbye-form-body #wpinsights-goodbye-options ul > li > div > textarea {';
|
828 |
+
$styles .= 'margin: 10px 18px; padding: 8px; width: 80%;';
|
829 |
+
$styles .= '}';
|
830 |
+
$styles .= $wrapper_class . ' .deactivating-spinner { display: none; padding-bottom: 20px !important; }';
|
831 |
+
$styles .= $wrapper_class . ' .deactivating-spinner .spinner { float: none; margin: 4px 4px 0 18px; vertical-align: bottom; visibility: visible; }';
|
832 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer { padding: 8px 18px; margin-bottom: 15px; }';
|
833 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer > .wpinsights-goodbye-form-buttons { display: flex; align-items: center; justify-content: space-between; }';
|
834 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer .wpinsights-submit-btn {';
|
835 |
+
$styles .= 'background-color: #d30c5c; -webkit-border-radius: 3px; border-radius: 3px; color: #fff; line-height: 1; padding: 15px 20px; font-size: 13px;';
|
836 |
+
$styles .= '}';
|
837 |
+
$styles .= $wrapper_class . ' .wpinsights-goodbye-form-footer .wpinsights-deactivate-btn {';
|
838 |
+
$styles .= 'font-size: 13px; color: #a4afb7; background: none; float: right; padding-right: 10px; width: auto; text-decoration: underline;';
|
839 |
+
$styles .= '}';
|
840 |
+
$styles .= $wrapper_class . ' .test {';
|
841 |
+
$styles .= '}';
|
842 |
+
$styles .= '</style>';
|
843 |
+
$styles .= '';
|
844 |
+
|
845 |
+
echo $styles;
|
846 |
+
?>
|
847 |
+
<script type="text/javascript">
|
848 |
+
jQuery(document).ready(function($){
|
849 |
+
$("#wpinsights-goodbye-link-<?php echo $class_plugin_name; ?>").on("click",function(){
|
850 |
+
// We'll send the user to this deactivation link when they've completed or dismissed the form
|
851 |
+
var url = document.getElementById("wpinsights-goodbye-link-<?php echo $class_plugin_name; ?>");
|
852 |
+
$('body').toggleClass('wpinsights-form-active-<?php echo $class_plugin_name; ?>');
|
853 |
+
$(".wpinsights-goodbye-form-wrapper-<?php echo $class_plugin_name; ?> #wpinsights-goodbye-form").fadeIn();
|
854 |
+
$(".wpinsights-goodbye-form-wrapper-<?php echo $class_plugin_name; ?> #wpinsights-goodbye-form").html( '<?php echo $html; ?>' + '<div class="wpinsights-goodbye-form-footer"><div class="wpinsights-goodbye-form-buttons"><a id="wpinsights-submit-form-<?php echo $class_plugin_name; ?>" class="wpinsights-submit-btn" href="#"><?php _e( 'Submit and Deactivate', 'disable-comments' ); ?></a> <a class="wpsp-put-deactivate-btn" href="'+url+'"><?php _e( 'Just Deactivate', 'disable-comments' ); ?></a></div></div>');
|
855 |
+
$('#wpinsights-submit-form-<?php echo $class_plugin_name; ?>').on('click', function(e){
|
856 |
+
// As soon as we click, the body of the form should disappear
|
857 |
+
$("#wpinsights-goodbye-form-<?php echo $class_plugin_name; ?> .wpinsights-goodbye-form-body").fadeOut();
|
858 |
+
$("#wpinsights-goodbye-form-<?php echo $class_plugin_name; ?> .wpinsights-goodbye-form-footer").fadeOut();
|
859 |
+
// Fade in spinner
|
860 |
+
$("#wpinsights-goodbye-form-<?php echo $class_plugin_name; ?> .deactivating-spinner").fadeIn();
|
861 |
+
e.preventDefault();
|
862 |
+
var checkedInput = $("input[name='wpinsights-<?php echo $class_plugin_name; ?>-goodbye-options']:checked"),
|
863 |
+
checkedInputVal, details;
|
864 |
+
if( checkedInput.length > 0 ) {
|
865 |
+
checkedInputVal = checkedInput.val();
|
866 |
+
details = $('input[name="'+ checkedInput[0].id +'"], textarea[name="'+ checkedInput[0].id +'"]').val();
|
867 |
+
}
|
868 |
+
|
869 |
+
if( typeof details === 'undefined' ) {
|
870 |
+
details = '';
|
871 |
+
}
|
872 |
+
if( typeof checkedInputVal === 'undefined' ) {
|
873 |
+
checkedInputVal = 'No Reason';
|
874 |
+
}
|
875 |
+
|
876 |
+
var data = {
|
877 |
+
'action': 'deactivation_form_<?php echo $class_plugin_name; ?>',
|
878 |
+
'values': checkedInputVal,
|
879 |
+
'details': details,
|
880 |
+
'security': "<?php echo wp_create_nonce ( 'wpins_deactivation_nonce' ); ?>",
|
881 |
+
'dataType': "json"
|
882 |
+
}
|
883 |
+
|
884 |
+
$.post(
|
885 |
+
ajaxurl,
|
886 |
+
data,
|
887 |
+
function(response){
|
888 |
+
// Redirect to original deactivation URL
|
889 |
+
window.location.href = url;
|
890 |
+
}
|
891 |
+
);
|
892 |
+
});
|
893 |
+
$('#wpinsights-goodbye-options > ul ').on('click', 'li label, li > input', function( e ){
|
894 |
+
var parent = $(this).parents('li');
|
895 |
+
parent.siblings().find('label').next('input, textarea').css('display', 'none');
|
896 |
+
parent.find('label').next('input, textarea').css('display', 'block');
|
897 |
+
});
|
898 |
+
// If we click outside the form, the form will close
|
899 |
+
$('.wpinsights-goodbye-form-bg').on('click',function(){
|
900 |
+
$("#wpinsights-goodbye-form").fadeOut();
|
901 |
+
$('body').removeClass('wpinsights-form-active-<?php echo $class_plugin_name; ?>');
|
902 |
+
});
|
903 |
+
});
|
904 |
+
});
|
905 |
+
</script>
|
906 |
+
<?php }
|
907 |
+
}
|
908 |
+
endif;
|
EmbedPress/Includes/Traits/Shared.php
CHANGED
@@ -17,14 +17,19 @@ trait Shared {
|
|
17 |
* @since v1.0.0
|
18 |
*/
|
19 |
public function start_plugin_tracking() {
|
20 |
-
|
21 |
-
|
22 |
-
'
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
public function admin_notice() {
|
@@ -143,14 +148,6 @@ trait Shared {
|
|
143 |
*/
|
144 |
public function embedpress_admin_notice() {
|
145 |
|
146 |
-
if ( get_option( 'embedpress_social_dismiss_notice' ) == true ) {
|
147 |
-
return;
|
148 |
-
}
|
149 |
-
|
150 |
-
$msg = '<strong>Due to recent Facebook API changes, if you have embeded Facebook or Instagram link before, that won’t work. EmbedPress could help, configure <a href="'.admin_url( 'admin.php?page=embedpress' ).'">here</a>. [<a href="'.esc_url('https://embedpress.com/docs/how-to-connect-facebook-instagram-embedpress/').'">Read Details</a>] </strong>';
|
151 |
-
echo '<div class="notice notice-info embedpress-plugin-notice-dismissible is-dismissible">
|
152 |
-
<p>' . $msg . '</p>
|
153 |
-
</div>';
|
154 |
}
|
155 |
|
156 |
}
|
17 |
* @since v1.0.0
|
18 |
*/
|
19 |
public function start_plugin_tracking() {
|
20 |
+
$tracker = EmbedPress_Plugin_Usage_Tracker::get_instance( EMBEDPRESS_FILE, [
|
21 |
+
'opt_in' => true,
|
22 |
+
'goodbye_form' => true,
|
23 |
+
'item_id' => '98ba0ac16a4f7b3b940d'
|
24 |
+
] );
|
25 |
+
$tracker->set_notice_options(array(
|
26 |
+
'notice' => __( 'Want to help make <strong>EmbedPress</strong> even more awesome? You can get a <strong>10% discount coupon</strong> for Premium extensions if you allow us to track the usage.', 'embedpress' ),
|
27 |
+
'extra_notice' => __( 'We collect non-sensitive diagnostic data and plugin usage information.
|
28 |
+
Your site URL, WordPress & PHP version, plugins & themes and email address to send you the
|
29 |
+
discount coupon. This data lets us make sure this plugin always stays compatible with the most
|
30 |
+
popular plugins and themes. No spam, I promise.', 'embedpress' ),
|
31 |
+
));
|
32 |
+
$tracker->init();
|
33 |
}
|
34 |
|
35 |
public function admin_notice() {
|
148 |
*/
|
149 |
public function embedpress_admin_notice() {
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
}
|
152 |
|
153 |
}
|
EmbedPress/Plugins/Html/Field.php
CHANGED
@@ -15,6 +15,37 @@ namespace EmbedPress\Plugins\Html;
|
|
15 |
*/
|
16 |
class Field
|
17 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Generates a text type input.
|
20 |
*
|
@@ -26,9 +57,7 @@ class Field
|
|
26 |
*/
|
27 |
protected static function text($value)
|
28 |
{
|
29 |
-
|
30 |
-
|
31 |
-
return $html;
|
32 |
}
|
33 |
|
34 |
/**
|
@@ -42,9 +71,7 @@ class Field
|
|
42 |
*/
|
43 |
protected static function textarea($value)
|
44 |
{
|
45 |
-
|
46 |
-
|
47 |
-
return $html;
|
48 |
}
|
49 |
|
50 |
/**
|
@@ -67,9 +94,7 @@ class Field
|
|
67 |
$html[] = '</label> ';
|
68 |
}
|
69 |
|
70 |
-
|
71 |
-
|
72 |
-
return $html;
|
73 |
}
|
74 |
|
75 |
/**
|
@@ -91,9 +116,7 @@ class Field
|
|
91 |
|
92 |
$html[] = '</select>';
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
return $html;
|
97 |
}
|
98 |
|
99 |
/**
|
@@ -132,6 +155,10 @@ class Field
|
|
132 |
$html = self::select((array)$field->options, (string)$value);
|
133 |
} elseif (in_array($field->type, ['textarea'])) {
|
134 |
$html = self::textarea((string)$value);
|
|
|
|
|
|
|
|
|
135 |
} else {
|
136 |
$html = self::text((string)$value);
|
137 |
}
|
15 |
*/
|
16 |
class Field
|
17 |
{
|
18 |
+
/**
|
19 |
+
* Generates a number type input.
|
20 |
+
*
|
21 |
+
* @param $value
|
22 |
+
*
|
23 |
+
* @return string
|
24 |
+
* @since 2.7.5
|
25 |
+
* @access protected
|
26 |
+
* @static
|
27 |
+
*/
|
28 |
+
protected static function number($value)
|
29 |
+
{
|
30 |
+
return '<input type="number" name="embedpress:{{slug}}[{{name}}]" class="{{classes}}" placeholder="{{placeholder}}" value="' . (int)$value . '">';
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Generates a url type input.
|
36 |
+
*
|
37 |
+
* @param $value
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
* @since 2.7.5
|
41 |
+
* @access protected
|
42 |
+
* @static
|
43 |
+
*/
|
44 |
+
protected static function url($value)
|
45 |
+
{
|
46 |
+
return '<input type="url" name="embedpress:{{slug}}[{{name}}]" class="{{classes}}" placeholder="{{placeholder}}" value="' . (string)$value . '">';
|
47 |
+
|
48 |
+
}
|
49 |
/**
|
50 |
* Generates a text type input.
|
51 |
*
|
57 |
*/
|
58 |
protected static function text($value)
|
59 |
{
|
60 |
+
return '<input type="text" name="embedpress:{{slug}}[{{name}}]" class="{{classes}}" placeholder="{{placeholder}}" value="' . (string)$value . '">';
|
|
|
|
|
61 |
}
|
62 |
|
63 |
/**
|
71 |
*/
|
72 |
protected static function textarea($value)
|
73 |
{
|
74 |
+
return '<textarea name="embedpress:{{slug}}[{{name}}]" class="{{classes}}" placeholder="{{placeholder}}">' . (string)$value . '</textarea>';
|
|
|
|
|
75 |
}
|
76 |
|
77 |
/**
|
94 |
$html[] = '</label> ';
|
95 |
}
|
96 |
|
97 |
+
return implode('', $html);
|
|
|
|
|
98 |
}
|
99 |
|
100 |
/**
|
116 |
|
117 |
$html[] = '</select>';
|
118 |
|
119 |
+
return implode('', $html);
|
|
|
|
|
120 |
}
|
121 |
|
122 |
/**
|
155 |
$html = self::select((array)$field->options, (string)$value);
|
156 |
} elseif (in_array($field->type, ['textarea'])) {
|
157 |
$html = self::textarea((string)$value);
|
158 |
+
} elseif (in_array($field->type, ['number', 'NUMBER'])) {
|
159 |
+
$html = self::number((int)$value);
|
160 |
+
} elseif (in_array($field->type, ['url', 'link'])) {
|
161 |
+
$html = self::url($value);
|
162 |
} else {
|
163 |
$html = self::text((string)$value);
|
164 |
}
|
EmbedPress/Shortcode.php
CHANGED
@@ -121,6 +121,7 @@ class Shortcode {
|
|
121 |
|
122 |
// Identify what service provider the shortcode's link belongs to
|
123 |
$serviceProvider = self::get_oembed()->get_provider( $url );
|
|
|
124 |
$urlData = self::get_url_data( $url, self::$ombed_attributes, $serviceProvider);
|
125 |
|
126 |
// Sanitize the data
|
121 |
|
122 |
// Identify what service provider the shortcode's link belongs to
|
123 |
$serviceProvider = self::get_oembed()->get_provider( $url );
|
124 |
+
|
125 |
$urlData = self::get_url_data( $url, self::$ombed_attributes, $serviceProvider);
|
126 |
|
127 |
// Sanitize the data
|
Gutenberg/{src/embedpress/index.php → block-backend/block-embedpress.php}
RENAMED
File without changes
|
Gutenberg/{src/wistia/index.php → block-backend/block-wistia.php}
RENAMED
File without changes
|
Gutenberg/{src/youtube/index.php → block-backend/block-youtube.php}
RENAMED
File without changes
|
Gutenberg/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,n){"use strict";n.d(t,"c",function(){return l}),n.d(t,"h",function(){return c}),n.d(t,"g",function(){return s}),n.d(t,"e",function(){return u}),n.d(t,"d",function(){return p}),n.d(t,"f",function(){return m}),n.d(t,"i",function(){return f}),n.d(t,"j",function(){return d}),n.d(t,"k",function(){return h}),n.d(t,"a",function(){return w}),n.d(t,"b",function(){return b});var r=wp.components,i=r.G,o=r.Path,a=(r.Polygon,r.SVG),l=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#2196F3"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#BBDEFB"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#1565C0"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 23 L 33 23 L 33 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 27 L 33 27 L 33 29 L 15 29 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 31 L 33 31 L 33 33 L 15 33 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 35 L 25 35 L 25 37 L 15 37 Z "}))),c=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",enableBackground:"new 0 0 24 24",id:"Layer_2",version:"1.1",viewBox:"0 0 24 24"},wp.element.createElement(i,null,wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z",style:{fill:"#FFC720"}}),wp.element.createElement(o,{d:"M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z",style:{fill:"url(#SVGID_1_)"}}),wp.element.createElement(o,{d:"M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z",style:{fill:"#FFE083"}}),wp.element.createElement(o,{d:"M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10",style:{fill:"#FFFFFF",opacity:"0.2"}}),wp.element.createElement(o,{d:"M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z",style:{fill:"#FFFFFF"}}),wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z",style:{fill:"url(#SVGID_2_)"}}))),s=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#43A047"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C8E6C9"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "}))),u=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#7850C1"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C2ABE1"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 23 L 33 23 L 33 25 L 19 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 28 L 33 28 L 33 30 L 19 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 33 L 33 33 L 33 35 L 19 35 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 23 L 17 23 L 17 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 28 L 17 28 L 17 30 L 15 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 33 L 17 33 L 17 35 L 15 35 Z "}))),p=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#DE5245"},d:"M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"}),wp.element.createElement(o,{style:{fill:"#EEA6A0"},d:"M40,13H30V3L40,13z"}),wp.element.createElement(o,{style:{fill:"#B3433A"},d:"M30,13l10,10V13H30z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"}))),m=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#1C9957"},d:"M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#3E7BF1"},d:"M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "}),wp.element.createElement(o,{style:{fill:"#CBCCC9"},d:"M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#EFEFEF"},d:"M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "}),wp.element.createElement(o,{style:{fill:"#FFD73D"},d:"M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "}),wp.element.createElement(o,{style:{fill:"#D73F35"},d:"M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "}),wp.element.createElement(o,{style:{fill:"#752622"},d:"M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "}))),f=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 32 25 L 27 25 L 27 15 L 32 15 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 24 25 L 19 25 L 19 15 L 24 15 Z "}))),d=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 769 598",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#148ee0"},d:"M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z"}),wp.element.createElement(o,{style:{fill:"#54bbff"},d:"M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z"}))),h=wp.element.createElement(a,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",role:"img","aria-hidden":"true",focusable:"false"},wp.element.createElement(o,{d:"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z"})),w=(wp.element.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 56 23"},wp.element.createElement("g",null,wp.element.createElement("g",null,wp.element.createElement("path",{style:{fill:"#DA2B28"},className:"st0",d:"M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4 c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8 c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1 c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8 c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2 c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2 c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1 c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"}),wp.element.createElement("path",{className:"st0",d:"M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7 C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"}),wp.element.createElement("path",{className:"st0",d:"M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"})),wp.element.createElement("g",null,wp.element.createElement("path",{d:"M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8"}),wp.element.createElement("path",{d:"M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1 c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11 c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"}),wp.element.createElement("path",{d:"M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2 v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"})))),wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 276 340"},wp.element.createElement("path",{d:"M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z",fill:"#e94848"}),wp.element.createElement("path",{d:"M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z",fill:"#f19191"}),wp.element.createElement("linearGradient",{id:"A",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"77.111",x2:"116.568",y2:"77.111"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z",fill:"url(#A)"}),wp.element.createElement("linearGradient",{id:"B",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.016",x2:"233.927",y2:"136.016"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",opacity:".8",fill:"url(#B)"}),wp.element.createElement("linearGradient",{id:"C",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.993",x2:"233.927",y2:"135.993"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"33.6",opacity:".7",fill:"url(#C)"}),wp.element.createElement("linearGradient",{id:"D",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.969",x2:"233.927",y2:"135.969"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"67.2",opacity:".6",fill:"url(#D)"}),wp.element.createElement("linearGradient",{id:"E",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.045",x2:"233.927",y2:"136.045"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"100.7",opacity:".4",fill:"url(#E)"}),wp.element.createElement("linearGradient",{id:"F",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"270.322",x2:"174.778",y2:"270.322"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z",opacity:".3",fill:"url(#F)"}),wp.element.createElement("defs",null,wp.element.createElement("path",{id:"H",d:"M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"})))),b=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270",role:"img",focusable:"false"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})))},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.components.Spinner,i=function(){return wp.element.createElement("div",{className:"wp-block-embed is-loading"},wp.element.createElement(r,null),wp.element.createElement("p",null,__("Embedding\u2026")))};t.a=i},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.element.Fragment,i=wp.components,o=i.IconButton,a=i.Toolbar,l=wp.editor.BlockControls,c=function(e){var t=e.showEditButton,n=e.switchBackToURLInput;return wp.element.createElement(r,null,wp.element.createElement(l,null,wp.element.createElement(a,null,t&&wp.element.createElement(o,{className:"components-toolbar__control",label:__("Edit URL"),icon:"edit",onClick:n}))))};t.a=c},function(e,t,n){"use strict";var r=n(11),i=n.n(r),o=wp.i18n,__=o.__,_x=o._x,a=wp.components,l=a.Button,c=a.Placeholder,s=a.ExternalLink,u=wp.blockEditor.BlockIcon,p=function(e){var t=e.icon,n=e.label,r=e.value,o=e.onSubmit,a=e.onChange,p=e.cannotEmbed,m=e.docLink,f=e.DocTitle,d=i()("wp-block-embed",{});return wp.element.createElement("div",null,wp.element.createElement(c,{icon:wp.element.createElement(u,{icon:t,showColors:!0}),label:n,className:d},wp.element.createElement("form",{onSubmit:o},wp.element.createElement("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":n,placeholder:__("Enter URL to embed here\u2026"),onChange:a}),wp.element.createElement(l,{isSmall:!0,type:"submit"},_x("Embed","button label")),p&&wp.element.createElement("p",{className:"components-placeholder__error"},__("Sorry, we could not embed that content."),wp.element.createElement("br",null))),m&&wp.element.createElement("div",{className:"components-placeholder__learn-more"},wp.element.createElement(s,{href:m},f))))};t.a=p},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("iframe",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(7),n(12),n(16),n(20),n(24),n(28),n(32),n(36),n(40),n(44),n(48);!function(){var e=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})));wp.blocks.updateCategory("embedpress",{icon:e})}()},function(e,t,n){"use strict";var r=n(8),i=(n.n(r),n(9)),o=(n.n(i),n(10)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-docs-block",{title:__("Google Docs"),icon:a.c,category:"embedpress",keywords:[__("embedpress"),__("google"),__("docs")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("figure",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element.Component,f=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.updateAlignment=e.updateAlignment.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"updateAlignment",value:function(e){var t=this.props.setAttributes,n=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};t(Object.assign({},n,{align:e}))}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"document"===a?(r.match(/([?&])embedded=true/i)||(r.indexOf("?")>-1?r+="&embedded=true":r+="?embedded=true"),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Docs URL");return!m||r?wp.element.createElement("div",null,wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.c,DocTitle:__("Learn more about Google doc embed"),docLink:"https://embedpress.com/docs/embed-google-docs-wordpress/"})):wp.element.createElement("div",null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onMouseUp:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameBorder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(m);t.a=f},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=n.apply(null,r);a&&e.push(a)}else if("object"===i)for(var l in r)o.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!==typeof e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(i=function(){return n}.apply(t,r))&&(e.exports=i))}()},function(e,t,n){"use strict";var r=n(13),i=(n.n(r),n(14)),o=(n.n(i),n(15)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-slides-block",{title:__("Google Slides"),icon:a.h,category:"embedpress",keywords:[__("embedpress"),__("google"),__("slides")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-presentation"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"presentation"==a?(r.match(/pub\?/i)&&(r=r.replace("/pub?","/embed?")),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Slides URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.h,DocTitle:__("Learn more about Google slides embed"),docLink:"https://embedpress.com/docs/embed-google-slides-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(17),i=(n.n(r),n(18)),o=(n.n(i),n(19)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-sheets-block",{title:__("Google Sheets"),icon:a.g,category:"embedpress",keywords:[__("embedpress"),__("google"),__("sheets")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];if(a&&"spreadsheets"==a){if(r.indexOf("?")>-1){var l=r.split("?");if(l=l[1],l=l.split("&"),console.log(l),l.length>0){var c=!1,s=!1;l.map(function(e){e.indexOf("widget=")?s=!0:e.indexOf("headers=")&&(c=!0)}),s||(r+="&widget=true"),c||(r+="&headers=false")}}else r+="?widget=true&headers=false";this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Sheets URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.g,DocTitle:__("Learn more about Google sheet embed"),docLink:"https://embedpress.com/docs/embed-google-sheets-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(21),i=(n.n(r),n(22)),o=(n.n(i),n(23)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-forms-block",{title:__("Google Forms"),icon:a.e,category:"embedpress",keywords:[__("embedpress"),__("google"),__("forms")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-forms"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=(wp.components.Disabled,function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"forms"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Forms URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.e,DocTitle:__("Learn more about Google forms embed"),docLink:"https://embedpress.com/docs/embed-google-forms-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f));t.a=h},function(e,t,n){"use strict";var r=n(25),i=(n.n(r),n(26)),o=(n.n(i),n(27)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-drawings-block",{title:__("Google Drawings"),icon:a.d,category:"embedpress",keywords:[__("embedpress"),__("google"),__("drawings")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-drawings"},wp.element.createElement("img",{src:t,width:"960",height:"720"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(0),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.element,m=p.Component,f=p.Fragment,d=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1},e}return o(t,e),u(t,[{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"drawings"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,u=this.props.attributes.iframeSrc,p=__("Google Drawings URL (Get your link from File -> Publish to the web -> Link)");return!u||r?wp.element.createElement(c.a,{label:p,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:s.d,DocTitle:__("Learn more about Google drawing embed"),docLink:"https://embedpress.com/docs/embed-google-drawings-wordpress/"}):wp.element.createElement(f,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("img",{src:u,onLoad:this.onLoad,style:{display:i?"none":""},width:"960",height:"720"}),wp.element.createElement(a.a,{showEditButton:u&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}]),t}(m);t.a=d},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(29),o=(n.n(i),n(30)),a=(n.n(o),n(31)),l=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-maps-block",{title:__("Google Maps"),icon:l.f,category:"embedpress",keywords:[__("embedpress"),__("google"),__("maps")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:a.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-maps"},wp.element.createElement("iframe",r({src:t,frameborder:"0",width:"600",height:"450"},"frameborder","0")))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com?))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?(?:place\/)?(?:[a-z0-9\/%+\-_]*)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)/i)){var r=this.decodeHTMLEntities(t);if(t.match("~(maps/embed|output=embed)~i"));else{var i=/@(-?[0-9\.]+,-?[0-9\.]+).+,([0-9\.]+[a-z])/i,o=i.exec(r);o&&o.length>1&&o[1]&&o[2]?r="https://maps.google.com/maps?hl=en&ie=UTF8&ll="+o[1]+"&spn="+o[1]+"&t=m&z="+Math.round(parseInt(o[2]))+"&output=embed":this.setState({cannotEmbed:!0,editingURL:!0})}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Maps URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.f,DocTitle:__("Learn more about Google map embed"),docLink:"https://embedpress.com/docs/embed-google-maps-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(33),i=(n.n(r),n(34)),o=(n.n(i),n(35)),a=n(0),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/twitch-block",{title:__("Twitch"),icon:a.i,category:"embedpress",keywords:[__("embedpress"),__("twitch")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""},attrs:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes,n=t.iframeSrc,r=t.attrs,i=n+"&parent="+embedpressObj.twitch_host;return wp.element.createElement("figure",{className:"ose-twitch-presentation"},wp.element.createElement("iframe",l({src:i},r,{frameborder:"0",width:"600",height:"450"})))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=/http[s]?:\/\/(?:www\.|clips\.)twitch\.tv\/([0-9a-zA-Z\-\_]+)\/?(chat\/?$|[0-9a-z\-\_]*)?/;if(t&&t.match(r)){var i=this.decodeHTMLEntities(t),o=r.exec(i),a=o[1];console.log(a);var l,c="channel";switch(t.indexOf("clips.twitch.tv")>-1?c="clip":t.indexOf("/videos/")>-1?c="video":t.indexOf("#/chat$#")>-1&&(c="chat"),console.log(c),c){case"channel":i="https://player.twitch.tv/?channel="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"clip":i="https://clips.twitch.tv/embed?clip="+a+"&autoplay=false",l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"video":a=o[2],i="https://player.twitch.tv/?video="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"chat":i="http://www.twitch.tv/embed/"+a+"/chat",l={scrolling:"yes",frameborder:"0",allowfullscreen:"true",id:"'"+a+"'"}}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:i,attrs:l})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Twitch URL");if(!d||r)return wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.i,DocTitle:__("Learn more about twitch embed"),docLink:"https://embedpress.com/docs/embed-twitch-streams-chat/"});var y=d+"&parent="+embedpressObj.twitch_host;return wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:y},w,{onLoad:this.onLoad,style:{display:i?"none":""},onFocus:this.hideOverlay,width:"600",height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(37),i=(n.n(r),n(38)),o=(n.n(i),n(39)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/wistia-block",{title:__("Wistia"),icon:a.j,category:"embedpress",keywords:[__("embedpress"),__("wistia")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(e){return null},deprecated:[{attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("div",{class:"ose-wistia"},wp.element.createElement("iframe",{src:t,allowtransparency:"true",frameborder:"0",class:"wistia_embed",name:"wistia_embed",width:"600",height:"330"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1,mediaId:null},e.setUrl(),e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentDidMount",value:function(){if(this.props.attributes.url){var e=this.props.attributes.url.match(/medias\/(.*)/),t=e[1];this.setState(Object.assign({},this.state,{mediaId:t}))}}},{key:"onLoad",value:function(){if(this.setState({fetching:!1}),embedpressObj.wisita_options){var e=Object.assign({},this.state);setTimeout(function(){var e=document.createElement("script");e.src="https://fast.wistia.com/assets/external/E-v1.js",e.charset="ISO-8859-1",document.body.appendChild(e)},100),setTimeout(function(){var t=document.createElement("script");t.type="text/javascript",t.innerHTML="window.pp_embed_wistia_labels = "+embedpressObj.wistia_labels,document.body.appendChild(t),t=document.createElement("script"),t.type="text/javascript",t.innerHTML='wistiaEmbed = Wistia.embed( "'+e.mediaId+'", '+embedpressObj.wisita_options+" );",document.body.appendChild(t)},400)}}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&(t.match(/^http[s]?:\/\/(?:www\.)?wistia\.com\/medias/i)||t.match(/^http[s]?:\/\/(?:www\.)?fast\/.wistia\.com\/embed\/medias/i.jsonp))){var r=t.match(/medias\/(.*)/),i=r[1],o="//fast.wistia.net/embed/iframe/"+i;this.setState({editingURL:!1,cannotEmbed:!1,mediaId:i}),n({iframeSrc:o})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Wistia URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.j,DocTitle:__("Learn more about Wistia embed"),docLink:"https://embedpress.com/docs/embed-wistia-videos-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("div",{className:"ose-wistia",id:"wistia_"+this.state.mediaId},wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"330"})),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(41),i=(n.n(r),n(42)),o=(n.n(i),n(43)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/youtube-block",{title:__("Youtube"),icon:a.k,category:"embedpress",keywords:[__("embedpress"),__("youtube")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentWillMount",value:function(){this.state.url&&this.setUrl()}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=t.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);if(t&&r){var i=r[1],o="https://www.youtube.com/embed/"+i,a=new URL(o);if("undefined"!==typeof embedpressProObj)for(var l in embedpressProObj.youtubeParams)a.searchParams.set(l,embedpressProObj.youtubeParams[l]);this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:a.href,mediaId:i})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Youtube URL");return!d||r?wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.k,DocTitle:__("Learn More About Youtube Embed"),docLink:"https://embedpress.com/docs/embed-youtube-wordpress/"}):wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:d},w,{onLoad:this.onLoad,style:{display:i?"none":""},width:"640",onFocus:this.hideOverlay,height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(45),i=(n.n(r),n(46)),o=(n.n(i),n(47)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/document",{title:__("Document"),icon:a.a,category:"embedpress",keywords:[__("embedpress"),__("pdf"),__("doc"),__("ppt")],supports:{align:["wide","full","right","left"],default:""},attributes:{id:{type:"string"},href:{type:"string"},powered_by:{type:"boolean",default:!0},width:{type:"number",default:600},height:{type:"number",default:600},fileName:{type:"string"},mime:{type:"string"}},edit:o.a,save:function(e){var t=e.attributes,n=t.href,r=t.mime,i=t.id,o=t.width,a=t.height,l=t.powered_by,c="//view.officeapps.live.com/op/embed.aspx?src="+n;return wp.element.createElement("figure",{className:"embedpress-embed-document"},"application/pdf"===r&&wp.element.createElement("div",{style:{height:a,width:o},className:"embedpress-embed-document-pdf "+i,"data-emid":i,"data-emsrc":n}),"application/pdf"!==r&&wp.element.createElement("iframe",{style:{height:a,width:o},src:c,mozallowfullscreen:"true",webkitallowfullscreen:"true"}),l&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),l=n(1),c=n(0),s=function(){function e(e,t){var n=[],_n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(_n=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,i=e}finally{try{!_n&&a.return&&a.return()}finally{if(r)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.blob,m=p.getBlobByURL,f=p.isBlobURL,d=p.revokeBlobURL,h=wp.editor,w=h.BlockIcon,b=h.MediaPlaceholder,y=h.InspectorControls,v=wp.element,g=v.Component,E=v.Fragment,L=wp.components,k=L.RangeControl,_=L.PanelBody,O=L.ExternalLink,S=L.ToggleControl,U=["application/pdf","application/msword","application/vnd.ms-powerpoint","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"],R=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.onSelectFile=e.onSelectFile.bind(e),e.onUploadError=e.onUploadError.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={hasError:!1,fetching:!1,interactive:!1,loadPdf:!0},e}return o(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,r=t.mediaUpload,i=t.noticeOperations,o=n.href;if(f(o)){r({filesList:[m(o)],onFileChange:function(t){var n=s(t,1),r=n[0];return e.onSelectFile(r)},onError:function(t){e.setState({hasError:!0}),i.createErrorNotice(t)}}),d(o)}this.props.attributes.href&&"application/pdf"===this.props.attributes.mime&&this.state.loadPdf&&(this.setState({loadPdf:!1}),PDFObject.embed(this.props.attributes.href,"."+this.props.attributes.id))}},{key:"componentDidUpdate",value:function(e){e.isSelected&&!this.props.isSelected&&this.setState({showCopyConfirmation:!1})}},{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"onSelectFile",value:function(e){e&&e.url&&(this.setState({hasError:!1}),this.props.setAttributes({href:e.url,fileName:e.title,id:"embedpress-pdf-"+Date.now(),mime:e.mime}),embedpressObj.embedpress_pro&&this.props.setAttributes({powered_by:!1}),"application/pdf"===e.mime&&(this.setState({loadPdf:!1}),PDFObject.embed(e.url,"."+this.props.attributes.id)))}},{key:"onUploadError",value:function(e){var t=this.props.noticeOperations;t.removeAllNotices(),t.createErrorNotice(e)}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.noticeUI,r=e.setAttributes,i=t.href,o=t.mime,s=t.id,u=t.width,p=t.height,m=t.powered_by,f=this.state,d=f.hasError,h=f.interactive,v=f.fetching,g=f.loadPdf;if(!i||d)return wp.element.createElement("div",{className:"embedpress-document-editmode"},wp.element.createElement(b,{icon:wp.element.createElement(w,{icon:c.a}),labels:{title:__("Document"),instructions:__("Upload a file or pick one from your media library for embed.")},onSelect:this.onSelectFile,notices:n,allowedTypes:U,onError:this.onUploadError},wp.element.createElement("div",{style:{width:"100%"},className:"components-placeholder__learn-more embedpress-doc-link"},wp.element.createElement(O,{href:"https://embedpress.com/docs/embed-docuemnt/"},"Learn more about Embedded document "))));var L="//view.officeapps.live.com/op/embed.aspx?src="+i;return wp.element.createElement(E,null,v&&"application/pdf"!==o?wp.element.createElement(l.a,null):null,"application/pdf"===o&&wp.element.createElement("div",{style:{height:p,width:u},className:"embedpress-embed-document-pdf "+s,"data-emid":s,"data-emsrc":i}),"application/pdf"!==o&&wp.element.createElement(a.a,{onMouseUponMouseUp:this.hideOverlay,style:{height:p,width:u,display:v||!g?"none":""},onLoad:this.onLoad,src:L}),!h&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),m&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"),wp.element.createElement(y,{key:"inspector"},wp.element.createElement(_,{title:__("Embed Size","embedpress")},wp.element.createElement(k,{label:__("Width","embedpress"),value:u,onChange:function(e){return r({width:e})},max:1e3,min:1}),wp.element.createElement(k,{label:__("Height","embedpress"),value:p,onChange:function(e){return r({height:e})},max:1e3,min:1}),wp.element.createElement(S,{label:__("Powered By"),onChange:function(e){return r({powered_by:e})},checked:m}))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(g);t.a=R},function(e,t,n){"use strict";var r=n(49),i=(n.n(r),n(50)),o=(n.n(i),n(51)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/embedpress",{title:__("EmbedPress"),icon:a.b,category:"embedpress",keywords:["embedpress","embed","google","youtube","docs"],supports:{align:["right","left","center"],default:"center",lightBlockWrapper:!0},attributes:{url:{type:"string",default:""},embedHTML:{type:"string",default:""},height:{type:"string",default:"450"},width:{type:"string",default:"600"},editingURL:{type:"boolean",default:!1},fetching:{type:"boolean",default:!1},cannotEmbed:{type:"boolean",default:!1},interactive:{type:"boolean",default:!1},align:{type:"string",default:"center"}},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(i,o){try{var a=t[i](o),l=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}function i(e){function t(){f({editingURL:!0})}function n(e){var t=this;if(e&&e.preventDefault(),b){f({fetching:!0}),console.log("test");(function(){var e=r(a.a.mark(function e(n){return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(embedpressObj.site_url+"/wp-json/embedpress/v1/oembed/embedpress?url="+n+"&width="+k+"&height="+L).then(function(e){return e.json()});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,t)}));return function(_x){return e.apply(this,arguments)}})()(b).then(function(e){f({fetching:!1}),f(e.data&&404===e.data.status||!e.embed?{cannotEmbed:!0,editingURL:!0}:{embedHTML:e.embed,cannotEmbed:!1,editingURL:!1})})}else f({cannotEmbed:!0,fetching:!1,editingURL:!0})}var i=e.attributes,o=e.className,f=e.setAttributes,b=i.url,y=i.editingURL,v=i.fetching,g=i.cannotEmbed,E=(i.interactive,i.embedHTML),L=i.height,k=i.width;return wp.element.createElement(w,null,wp.element.createElement(m.InspectorControls,null,wp.element.createElement(h,{title:__("Customize Embedded Link")},wp.element.createElement("p",null,__("You can adjust the width and height of embedded content.")),wp.element.createElement(d,{label:__("Width"),value:k,onChange:function(e){return f({width:e})}}),wp.element.createElement(d,{label:__("Height"),value:L,onChange:function(e){return f({height:e})}}),E&&!y&&wp.element.createElement("button",{onClick:n},__("Apply")))),(!E||y)&&!v&&wp.element.createElement(s.a,{label:__("EmbedPress - Embed anything from 100+ sites"),onSubmit:n,value:b,cannotEmbed:g,onChange:function(e){return f({url:e.target.value})},icon:p.b,DocTitle:__("Learn more about EmbedPress"),docLink:"https://embedpress.com/docs/"}),v?wp.element.createElement("div",{className:o},wp.element.createElement(c.a,null)," "):null,E&&!y&&!v&&wp.element.createElement("figure",Object(m.useBlockProps)(),wp.element.createElement(u.a,{style:{display:v?"none":""},dangerouslySetInnerHTML:{__html:E}}),wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:f({interactive:!0})}),wp.element.createElement(l.a,{showEditButton:E&&!g,switchBackToURLInput:t})))}t.a=i;var o=n(52),a=n.n(o),l=n(2),c=n(1),s=n(3),u=n(55),p=n(0),m=n(56),__=(n.n(m),wp.i18n.__),f=wp.components,d=f.TextControl,h=f.PanelBody,w=wp.element.Fragment},function(e,t,n){e.exports=n(53)},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(54),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),l=new f(r||[]);return a._invoke=s(e,n,l),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,i,o,a){var l=r(e[n],e,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&y.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(s).then(function(e){c.value=e,o(c)},a)}a(l.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function s(e,t,n){var i=O;return function(o,a){if(i===U)throw new Error("Generator is already running");if(i===R){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===C)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===O)throw i=R,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=U;var s=r(e,t,n);if("normal"===s.type){if(i=n.done?R:S,s.arg===C)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=R,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===w){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=w,u(e,t),"throw"===t.method))return C;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,C;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=w),t.delegate=null,C):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,C)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[g];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=w,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:w,done:!0}}var w,b=Object.prototype,y=b.hasOwnProperty,v="function"===typeof Symbol?Symbol:{},g=v.iterator||"@@iterator",E=v.asyncIterator||"@@asyncIterator",L=v.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var O="suspendedStart",S="suspendedYield",U="executing",R="completed",C={},x={};x[g]=function(){return this};var M=Object.getPrototypeOf,T=M&&M(M(d([])));T&&T!==b&&y.call(T,g)&&(x=T);var j=a.prototype=i.prototype=Object.create(x);o.prototype=j.constructor=a,a.constructor=o,a[L]=o.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,L in e||(e[L]="GeneratorFunction")),e.prototype=Object.create(j),e},_.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,i){var o=new c(n(e,t,r,i));return _.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(j),j[L]="Generator",j[g]=function(){return this},j.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=w,this.done=!1,this.delegate=null,this.method="next",this.arg=w,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=w)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=w),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),l=y.call(i,"finallyLoc");if(a&&l){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,C):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),C},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),C}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=w),C}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("div",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=wp.blockEditor}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,n){"use strict";n.d(t,"c",function(){return l}),n.d(t,"h",function(){return c}),n.d(t,"g",function(){return s}),n.d(t,"e",function(){return u}),n.d(t,"d",function(){return p}),n.d(t,"f",function(){return m}),n.d(t,"i",function(){return f}),n.d(t,"j",function(){return d}),n.d(t,"k",function(){return h}),n.d(t,"a",function(){return w}),n.d(t,"b",function(){return b});var r=wp.components,i=r.G,o=r.Path,a=(r.Polygon,r.SVG),l=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#2196F3"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#BBDEFB"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#1565C0"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 23 L 33 23 L 33 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 27 L 33 27 L 33 29 L 15 29 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 31 L 33 31 L 33 33 L 15 33 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 35 L 25 35 L 25 37 L 15 37 Z "}))),c=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",enableBackground:"new 0 0 24 24",id:"Layer_2",version:"1.1",viewBox:"0 0 24 24"},wp.element.createElement(i,null,wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z",style:{fill:"#FFC720"}}),wp.element.createElement(o,{d:"M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z",style:{fill:"url(#SVGID_1_)"}}),wp.element.createElement(o,{d:"M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z",style:{fill:"#FFE083"}}),wp.element.createElement(o,{d:"M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10",style:{fill:"#FFFFFF",opacity:"0.2"}}),wp.element.createElement(o,{d:"M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z",style:{fill:"#FFFFFF"}}),wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z",style:{fill:"url(#SVGID_2_)"}}))),s=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#43A047"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C8E6C9"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "}))),u=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#7850C1"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C2ABE1"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 23 L 33 23 L 33 25 L 19 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 28 L 33 28 L 33 30 L 19 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 33 L 33 33 L 33 35 L 19 35 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 23 L 17 23 L 17 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 28 L 17 28 L 17 30 L 15 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 33 L 17 33 L 17 35 L 15 35 Z "}))),p=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#DE5245"},d:"M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"}),wp.element.createElement(o,{style:{fill:"#EEA6A0"},d:"M40,13H30V3L40,13z"}),wp.element.createElement(o,{style:{fill:"#B3433A"},d:"M30,13l10,10V13H30z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"}))),m=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#1C9957"},d:"M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#3E7BF1"},d:"M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "}),wp.element.createElement(o,{style:{fill:"#CBCCC9"},d:"M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#EFEFEF"},d:"M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "}),wp.element.createElement(o,{style:{fill:"#FFD73D"},d:"M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "}),wp.element.createElement(o,{style:{fill:"#D73F35"},d:"M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "}),wp.element.createElement(o,{style:{fill:"#752622"},d:"M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "}))),f=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 32 25 L 27 25 L 27 15 L 32 15 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 24 25 L 19 25 L 19 15 L 24 15 Z "}))),d=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 769 598",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#148ee0"},d:"M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z"}),wp.element.createElement(o,{style:{fill:"#54bbff"},d:"M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z"}))),h=wp.element.createElement(a,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",role:"img","aria-hidden":"true",focusable:"false"},wp.element.createElement(o,{d:"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z"})),w=(wp.element.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 56 23"},wp.element.createElement("g",null,wp.element.createElement("g",null,wp.element.createElement("path",{style:{fill:"#DA2B28"},className:"st0",d:"M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4 c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8 c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1 c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8 c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2 c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2 c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1 c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"}),wp.element.createElement("path",{className:"st0",d:"M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7 C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"}),wp.element.createElement("path",{className:"st0",d:"M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"})),wp.element.createElement("g",null,wp.element.createElement("path",{d:"M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8"}),wp.element.createElement("path",{d:"M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1 c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11 c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"}),wp.element.createElement("path",{d:"M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2 v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"})))),wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 276 340"},wp.element.createElement("path",{d:"M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z",fill:"#e94848"}),wp.element.createElement("path",{d:"M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z",fill:"#f19191"}),wp.element.createElement("linearGradient",{id:"A",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"77.111",x2:"116.568",y2:"77.111"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z",fill:"url(#A)"}),wp.element.createElement("linearGradient",{id:"B",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.016",x2:"233.927",y2:"136.016"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",opacity:".8",fill:"url(#B)"}),wp.element.createElement("linearGradient",{id:"C",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.993",x2:"233.927",y2:"135.993"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"33.6",opacity:".7",fill:"url(#C)"}),wp.element.createElement("linearGradient",{id:"D",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.969",x2:"233.927",y2:"135.969"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"67.2",opacity:".6",fill:"url(#D)"}),wp.element.createElement("linearGradient",{id:"E",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.045",x2:"233.927",y2:"136.045"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"100.7",opacity:".4",fill:"url(#E)"}),wp.element.createElement("linearGradient",{id:"F",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"270.322",x2:"174.778",y2:"270.322"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z",opacity:".3",fill:"url(#F)"}),wp.element.createElement("defs",null,wp.element.createElement("path",{id:"H",d:"M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"})))),b=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270",role:"img",focusable:"false"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})))},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.components.Spinner,i=function(){return wp.element.createElement("div",{className:"wp-block-embed is-loading"},wp.element.createElement(r,null),wp.element.createElement("p",null,__("Embedding\u2026")))};t.a=i},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.element.Fragment,i=wp.components,o=i.IconButton,a=i.Toolbar,l=wp.editor.BlockControls,c=function(e){var t=e.showEditButton,n=e.switchBackToURLInput;return wp.element.createElement(r,null,wp.element.createElement(l,null,wp.element.createElement(a,null,t&&wp.element.createElement(o,{className:"components-toolbar__control",label:__("Edit URL"),icon:"edit",onClick:n}))))};t.a=c},function(e,t,n){"use strict";var r=n(11),i=n.n(r),o=wp.i18n,__=o.__,_x=o._x,a=wp.components,l=a.Button,c=a.Placeholder,s=a.ExternalLink,u=wp.blockEditor.BlockIcon,p=function(e){var t=e.icon,n=e.label,r=e.value,o=e.onSubmit,a=e.onChange,p=e.cannotEmbed,m=e.docLink,f=e.DocTitle,d=i()("wp-block-embed",{});return wp.element.createElement("div",null,wp.element.createElement(c,{icon:wp.element.createElement(u,{icon:t,showColors:!0}),label:n,className:d},wp.element.createElement("form",{onSubmit:o},wp.element.createElement("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":n,placeholder:__("Enter URL to embed here\u2026"),onChange:a}),wp.element.createElement(l,{isSmall:!0,type:"submit"},_x("Embed","button label")),p&&wp.element.createElement("p",{className:"components-placeholder__error"},__("Sorry, we could not embed that content."),wp.element.createElement("br",null))),m&&wp.element.createElement("div",{className:"components-placeholder__learn-more"},wp.element.createElement(s,{href:m},f))))};t.a=p},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("iframe",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(7),n(12),n(16),n(20),n(24),n(28),n(32),n(36),n(40),n(44),n(48);!function(){var e=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})));wp.blocks.updateCategory("embedpress",{icon:e})}()},function(e,t,n){"use strict";var r=n(8),i=(n.n(r),n(9)),o=(n.n(i),n(10)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-docs-block",{title:__("Google Docs"),icon:a.c,category:"embedpress",keywords:[__("embedpress"),__("google"),__("docs")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("figure",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element.Component,f=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.updateAlignment=e.updateAlignment.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"updateAlignment",value:function(e){var t=this.props.setAttributes,n=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};t(Object.assign({},n,{align:e}))}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"document"===a?(r.match(/([?&])embedded=true/i)||(r.indexOf("?")>-1?r+="&embedded=true":r+="?embedded=true"),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Docs URL");return!m||r?wp.element.createElement("div",null,wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.c,DocTitle:__("Learn more about Google doc embed"),docLink:"https://embedpress.com/docs/embed-google-docs-wordpress/"})):wp.element.createElement("div",null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onMouseUp:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameBorder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(m);t.a=f},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var a=n.apply(null,r);a&&e.push(a)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var l in r)o.call(r,l)&&r[l]&&e.push(l);else e.push(r.toString())}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!==typeof e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(i=function(){return n}.apply(t,r))&&(e.exports=i))}()},function(e,t,n){"use strict";var r=n(13),i=(n.n(r),n(14)),o=(n.n(i),n(15)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-slides-block",{title:__("Google Slides"),icon:a.h,category:"embedpress",keywords:[__("embedpress"),__("google"),__("slides")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-presentation"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"presentation"==a?(r.match(/pub\?/i)&&(r=r.replace("/pub?","/embed?")),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Slides URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.h,DocTitle:__("Learn more about Google slides embed"),docLink:"https://embedpress.com/docs/embed-google-slides-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(17),i=(n.n(r),n(18)),o=(n.n(i),n(19)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-sheets-block",{title:__("Google Sheets"),icon:a.g,category:"embedpress",keywords:[__("embedpress"),__("google"),__("sheets")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];if(a&&"spreadsheets"==a){if(r.indexOf("?")>-1){var l=r.split("?");if(l=l[1],l=l.split("&"),console.log(l),l.length>0){var c=!1,s=!1;l.map(function(e){e.indexOf("widget=")?s=!0:e.indexOf("headers=")&&(c=!0)}),s||(r+="&widget=true"),c||(r+="&headers=false")}}else r+="?widget=true&headers=false";this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Sheets URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.g,DocTitle:__("Learn more about Google sheet embed"),docLink:"https://embedpress.com/docs/embed-google-sheets-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(21),i=(n.n(r),n(22)),o=(n.n(i),n(23)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-forms-block",{title:__("Google Forms"),icon:a.e,category:"embedpress",keywords:[__("embedpress"),__("google"),__("forms")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-forms"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=(wp.components.Disabled,function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"forms"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Forms URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.e,DocTitle:__("Learn more about Google forms embed"),docLink:"https://embedpress.com/docs/embed-google-forms-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f));t.a=h},function(e,t,n){"use strict";var r=n(25),i=(n.n(r),n(26)),o=(n.n(i),n(27)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-drawings-block",{title:__("Google Drawings"),icon:a.d,category:"embedpress",keywords:[__("embedpress"),__("google"),__("drawings")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-drawings"},wp.element.createElement("img",{src:t,width:"960",height:"720"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(0),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.element,m=p.Component,f=p.Fragment,d=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1},e}return o(t,e),u(t,[{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"drawings"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,u=this.props.attributes.iframeSrc,p=__("Google Drawings URL (Get your link from File -> Publish to the web -> Link)");return!u||r?wp.element.createElement(c.a,{label:p,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:s.d,DocTitle:__("Learn more about Google drawing embed"),docLink:"https://embedpress.com/docs/embed-google-drawings-wordpress/"}):wp.element.createElement(f,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("img",{src:u,onLoad:this.onLoad,style:{display:i?"none":""},width:"960",height:"720"}),wp.element.createElement(a.a,{showEditButton:u&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}]),t}(m);t.a=d},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(29),o=(n.n(i),n(30)),a=(n.n(o),n(31)),l=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-maps-block",{title:__("Google Maps"),icon:l.f,category:"embedpress",keywords:[__("embedpress"),__("google"),__("maps")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:a.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-maps"},wp.element.createElement("iframe",r({src:t,frameborder:"0",width:"600",height:"450"},"frameborder","0")))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com?))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?(?:place\/)?(?:[a-z0-9\/%+\-_]*)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)/i)){var r=this.decodeHTMLEntities(t);if(t.match("~(maps/embed|output=embed)~i"));else{var i=/@(-?[0-9\.]+,-?[0-9\.]+).+,([0-9\.]+[a-z])/i,o=i.exec(r);o&&o.length>1&&o[1]&&o[2]?r="https://maps.google.com/maps?hl=en&ie=UTF8&ll="+o[1]+"&spn="+o[1]+"&t=m&z="+Math.round(parseInt(o[2]))+"&output=embed":this.setState({cannotEmbed:!0,editingURL:!0})}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Maps URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.f,DocTitle:__("Learn more about Google map embed"),docLink:"https://embedpress.com/docs/embed-google-maps-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(33),i=(n.n(r),n(34)),o=(n.n(i),n(35)),a=n(0),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/twitch-block",{title:__("Twitch"),icon:a.i,category:"embedpress",keywords:[__("embedpress"),__("twitch")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""},attrs:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes,n=t.iframeSrc,r=t.attrs,i=n+"&parent="+embedpressObj.twitch_host;return wp.element.createElement("figure",{className:"ose-twitch-presentation"},wp.element.createElement("iframe",l({src:i},r,{frameborder:"0",width:"600",height:"450"})))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=/http[s]?:\/\/(?:www\.|clips\.)twitch\.tv\/([0-9a-zA-Z\-\_]+)\/?(chat\/?$|[0-9a-z\-\_]*)?/;if(t&&t.match(r)){var i=this.decodeHTMLEntities(t),o=r.exec(i),a=o[1];console.log(a);var l,c="channel";switch(t.indexOf("clips.twitch.tv")>-1?c="clip":t.indexOf("/videos/")>-1?c="video":t.indexOf("#/chat$#")>-1&&(c="chat"),console.log(c),c){case"channel":i="https://player.twitch.tv/?channel="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"clip":i="https://clips.twitch.tv/embed?clip="+a+"&autoplay=false",l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"video":a=o[2],i="https://player.twitch.tv/?video="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"chat":i="http://www.twitch.tv/embed/"+a+"/chat",l={scrolling:"yes",frameborder:"0",allowfullscreen:"true",id:"'"+a+"'"}}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:i,attrs:l})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Twitch URL");if(!d||r)return wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.i,DocTitle:__("Learn more about twitch embed"),docLink:"https://embedpress.com/docs/embed-twitch-streams-chat/"});var y=d+"&parent="+embedpressObj.twitch_host;return wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:y},w,{onLoad:this.onLoad,style:{display:i?"none":""},onFocus:this.hideOverlay,width:"600",height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(37),i=(n.n(r),n(38)),o=(n.n(i),n(39)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/wistia-block",{title:__("Wistia"),icon:a.j,category:"embedpress",keywords:[__("embedpress"),__("wistia")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(e){return null},deprecated:[{attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("div",{class:"ose-wistia"},wp.element.createElement("iframe",{src:t,allowtransparency:"true",frameborder:"0",class:"wistia_embed",name:"wistia_embed",width:"600",height:"330"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1,mediaId:null},e.setUrl(),e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentDidMount",value:function(){if(this.props.attributes.url){var e=this.props.attributes.url.match(/medias\/(.*)/),t=e[1];this.setState(Object.assign({},this.state,{mediaId:t}))}}},{key:"onLoad",value:function(){if(this.setState({fetching:!1}),embedpressObj.wisita_options){var e=Object.assign({},this.state);setTimeout(function(){var e=document.createElement("script");e.src="https://fast.wistia.com/assets/external/E-v1.js",e.charset="ISO-8859-1",document.body.appendChild(e)},100),setTimeout(function(){var t=document.createElement("script");t.type="text/javascript",t.innerHTML="window.pp_embed_wistia_labels = "+embedpressObj.wistia_labels,document.body.appendChild(t),t=document.createElement("script"),t.type="text/javascript",t.innerHTML='wistiaEmbed = Wistia.embed( "'+e.mediaId+'", '+embedpressObj.wisita_options+" );",document.body.appendChild(t)},400)}}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&(t.match(/^http[s]?:\/\/(?:www\.)?wistia\.com\/medias/i)||t.match(/^http[s]?:\/\/(?:www\.)?fast\/.wistia\.com\/embed\/medias/i.jsonp))){var r=t.match(/medias\/(.*)/),i=r[1],o="//fast.wistia.net/embed/iframe/"+i;this.setState({editingURL:!1,cannotEmbed:!1,mediaId:i}),n({iframeSrc:o})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Wistia URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.j,DocTitle:__("Learn more about Wistia embed"),docLink:"https://embedpress.com/docs/embed-wistia-videos-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("div",{className:"ose-wistia",id:"wistia_"+this.state.mediaId},wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"330"})),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(41),i=(n.n(r),n(42)),o=(n.n(i),n(43)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/youtube-block",{title:__("Youtube"),icon:a.k,category:"embedpress",keywords:[__("embedpress"),__("youtube")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentWillMount",value:function(){this.state.url&&this.setUrl()}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=t.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);if(t&&r){var i=r[1],o="https://www.youtube.com/embed/"+i,a=new URL(o);if("undefined"!==typeof embedpressProObj)for(var l in embedpressProObj.youtubeParams)a.searchParams.set(l,embedpressProObj.youtubeParams[l]);this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:a.href,mediaId:i})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Youtube URL");return!d||r?wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.k,DocTitle:__("Learn More About Youtube Embed"),docLink:"https://embedpress.com/docs/embed-youtube-wordpress/"}):wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:d},w,{onLoad:this.onLoad,style:{display:i?"none":""},width:"640",onFocus:this.hideOverlay,height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(45),i=(n.n(r),n(46)),o=(n.n(i),n(47)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/document",{title:__("Document"),icon:a.a,category:"embedpress",keywords:[__("embedpress"),__("pdf"),__("doc"),__("ppt")],supports:{align:["wide","full","right","left"],default:""},attributes:{id:{type:"string"},href:{type:"string"},powered_by:{type:"boolean",default:!0},width:{type:"number",default:600},height:{type:"number",default:600},fileName:{type:"string"},mime:{type:"string"}},edit:o.a,save:function(e){var t=e.attributes,n=t.href,r=t.mime,i=t.id,o=t.width,a=t.height,l=t.powered_by,c="//view.officeapps.live.com/op/embed.aspx?src="+n;return wp.element.createElement("figure",{className:"embedpress-embed-document"},"application/pdf"===r&&wp.element.createElement("div",{style:{height:a,width:o},className:"embedpress-embed-document-pdf "+i,"data-emid":i,"data-emsrc":n}),"application/pdf"!==r&&wp.element.createElement("iframe",{style:{height:a,width:o},src:c,mozallowfullscreen:"true",webkitallowfullscreen:"true"}),l&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),l=n(1),c=n(0),s=function(){function e(e,t){var n=[],_n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(_n=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,i=e}finally{try{!_n&&a.return&&a.return()}finally{if(r)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.blob,m=p.getBlobByURL,f=p.isBlobURL,d=p.revokeBlobURL,h=wp.editor,w=h.BlockIcon,b=h.MediaPlaceholder,y=h.InspectorControls,v=wp.element,g=v.Component,E=v.Fragment,L=wp.components,k=L.RangeControl,_=L.PanelBody,O=L.ExternalLink,S=L.ToggleControl,U=["application/pdf","application/msword","application/vnd.ms-powerpoint","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"],R=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.onSelectFile=e.onSelectFile.bind(e),e.onUploadError=e.onUploadError.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={hasError:!1,fetching:!1,interactive:!1,loadPdf:!0},e}return o(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,r=t.mediaUpload,i=t.noticeOperations,o=n.href;if(f(o)){r({filesList:[m(o)],onFileChange:function(t){var n=s(t,1),r=n[0];return e.onSelectFile(r)},onError:function(t){e.setState({hasError:!0}),i.createErrorNotice(t)}}),d(o)}this.props.attributes.href&&"application/pdf"===this.props.attributes.mime&&this.state.loadPdf&&(this.setState({loadPdf:!1}),PDFObject.embed(this.props.attributes.href,"."+this.props.attributes.id))}},{key:"componentDidUpdate",value:function(e){e.isSelected&&!this.props.isSelected&&this.setState({showCopyConfirmation:!1})}},{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"onSelectFile",value:function(e){e&&e.url&&(this.setState({hasError:!1}),this.props.setAttributes({href:e.url,fileName:e.title,id:"embedpress-pdf-"+Date.now(),mime:e.mime}),embedpressObj.embedpress_pro&&this.props.setAttributes({powered_by:!1}),"application/pdf"===e.mime&&(this.setState({loadPdf:!1}),PDFObject.embed(e.url,"."+this.props.attributes.id)))}},{key:"onUploadError",value:function(e){var t=this.props.noticeOperations;t.removeAllNotices(),t.createErrorNotice(e)}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.noticeUI,r=e.setAttributes,i=t.href,o=t.mime,s=t.id,u=t.width,p=t.height,m=t.powered_by,f=this.state,d=f.hasError,h=f.interactive,v=f.fetching,g=f.loadPdf;if(!i||d)return wp.element.createElement("div",{className:"embedpress-document-editmode"},wp.element.createElement(b,{icon:wp.element.createElement(w,{icon:c.a}),labels:{title:__("Document"),instructions:__("Upload a file or pick one from your media library for embed.")},onSelect:this.onSelectFile,notices:n,allowedTypes:U,onError:this.onUploadError},wp.element.createElement("div",{style:{width:"100%"},className:"components-placeholder__learn-more embedpress-doc-link"},wp.element.createElement(O,{href:"https://embedpress.com/docs/embed-docuemnt/"},"Learn more about Embedded document "))));var L="//view.officeapps.live.com/op/embed.aspx?src="+i;return wp.element.createElement(E,null,v&&"application/pdf"!==o?wp.element.createElement(l.a,null):null,"application/pdf"===o&&wp.element.createElement("div",{style:{height:p,width:u},className:"embedpress-embed-document-pdf "+s,"data-emid":s,"data-emsrc":i}),"application/pdf"!==o&&wp.element.createElement(a.a,{onMouseUponMouseUp:this.hideOverlay,style:{height:p,width:u,display:v||!g?"none":""},onLoad:this.onLoad,src:L}),!h&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),m&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"),wp.element.createElement(y,{key:"inspector"},wp.element.createElement(_,{title:__("Embed Size","embedpress")},wp.element.createElement(k,{label:__("Width","embedpress"),value:u,onChange:function(e){return r({width:e})},max:1e3,min:1}),wp.element.createElement(k,{label:__("Height","embedpress"),value:p,onChange:function(e){return r({height:e})},max:1e3,min:1}),wp.element.createElement(S,{label:__("Powered By"),onChange:function(e){return r({powered_by:e})},checked:m}))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(g);t.a=R},function(e,t,n){"use strict";var r=n(49),i=(n.n(r),n(50)),o=(n.n(i),n(51)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/embedpress",{title:__("EmbedPress"),icon:a.b,category:"embedpress",keywords:["embedpress","embed","google","youtube","docs"],supports:{align:["right","left","center"],default:"center",lightBlockWrapper:!0},attributes:{url:{type:"string",default:""},embedHTML:{type:"string",default:""},height:{type:"string",default:"450"},width:{type:"string",default:"600"},editingURL:{type:"boolean",default:!1},fetching:{type:"boolean",default:!1},cannotEmbed:{type:"boolean",default:!1},interactive:{type:"boolean",default:!1},align:{type:"string",default:"center"}},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(i,o){try{var a=t[i](o),l=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}function i(e){function t(){f({editingURL:!0})}function n(e){var t=this;if(e&&e.preventDefault(),b){f({fetching:!0}),console.log("test");(function(){var e=r(a.a.mark(function e(n){return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(embedpressObj.site_url+"/wp-json/embedpress/v1/oembed/embedpress?url="+n+"&width="+k+"&height="+L).then(function(e){return e.json()});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,t)}));return function(_x){return e.apply(this,arguments)}})()(b).then(function(e){f({fetching:!1}),f(e.data&&404===e.data.status||!e.embed?{cannotEmbed:!0,editingURL:!0}:{embedHTML:e.embed,cannotEmbed:!1,editingURL:!1})})}else f({cannotEmbed:!0,fetching:!1,editingURL:!0})}var i=e.attributes,o=e.className,f=e.setAttributes,b=i.url,y=i.editingURL,v=i.fetching,g=i.cannotEmbed,E=(i.interactive,i.embedHTML),L=i.height,k=i.width;return wp.element.createElement(w,null,wp.element.createElement(m.InspectorControls,null,wp.element.createElement(h,{title:__("Customize Embedded Link")},wp.element.createElement("p",null,__("You can adjust the width and height of embedded content.")),wp.element.createElement(d,{label:__("Width"),value:k,onChange:function(e){return f({width:e})}}),wp.element.createElement(d,{label:__("Height"),value:L,onChange:function(e){return f({height:e})}}),E&&!y&&wp.element.createElement("button",{onClick:n},__("Apply")))),(!E||y)&&!v&&wp.element.createElement(s.a,{label:__("EmbedPress - Embed anything from 100+ sites"),onSubmit:n,value:b,cannotEmbed:g,onChange:function(e){return f({url:e.target.value})},icon:p.b,DocTitle:__("Learn more about EmbedPress"),docLink:"https://embedpress.com/docs/"}),v?wp.element.createElement("div",{className:o},wp.element.createElement(c.a,null)," "):null,E&&!y&&!v&&wp.element.createElement("figure",Object(m.useBlockProps)(),wp.element.createElement(u.a,{style:{display:v?"none":""},dangerouslySetInnerHTML:{__html:E}}),wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:f({interactive:!0})}),wp.element.createElement(l.a,{showEditButton:E&&!g,switchBackToURLInput:t})))}t.a=i;var o=n(52),a=n.n(o),l=n(2),c=n(1),s=n(3),u=n(55),p=n(0),m=n(56),__=(n.n(m),wp.i18n.__),f=wp.components,d=f.TextControl,h=f.PanelBody,w=wp.element.Fragment},function(e,t,n){e.exports=n(53)},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(54),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),l=new f(r||[]);return a._invoke=s(e,n,l),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,i,o,a){var l=r(e[n],e,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&y.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(s).then(function(e){c.value=e,o(c)},a)}a(l.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function s(e,t,n){var i=O;return function(o,a){if(i===U)throw new Error("Generator is already running");if(i===R){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===C)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===O)throw i=R,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=U;var s=r(e,t,n);if("normal"===s.type){if(i=n.done?R:S,s.arg===C)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=R,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===w){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=w,u(e,t),"throw"===t.method))return C;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,C;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=w),t.delegate=null,C):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,C)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[g];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=w,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:w,done:!0}}var w,b=Object.prototype,y=b.hasOwnProperty,v="function"===typeof Symbol?Symbol:{},g=v.iterator||"@@iterator",E=v.asyncIterator||"@@asyncIterator",L=v.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var O="suspendedStart",S="suspendedYield",U="executing",R="completed",C={},x={};x[g]=function(){return this};var M=Object.getPrototypeOf,T=M&&M(M(d([])));T&&T!==b&&y.call(T,g)&&(x=T);var j=a.prototype=i.prototype=Object.create(x);o.prototype=j.constructor=a,a.constructor=o,a[L]=o.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,L in e||(e[L]="GeneratorFunction")),e.prototype=Object.create(j),e},_.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,i){var o=new c(n(e,t,r,i));return _.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(j),j[L]="Generator",j[g]=function(){return this},j.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=w,this.done=!1,this.delegate=null,this.method="next",this.arg=w,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=w)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=w),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),l=y.call(i,"finallyLoc");if(a&&l){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,C):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),C},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),C}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=w),C}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("div",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=wp.blockEditor}]);
|
Gutenberg/plugin.php
CHANGED
@@ -1,11 +1,128 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
// Exit if accessed directly.
|
4 |
-
if ( !
|
5 |
exit;
|
6 |
}
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
/**
|
9 |
-
*
|
10 |
*/
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Blocks Initializer
|
4 |
+
*
|
5 |
+
* Enqueue CSS/JS of all the blocks.
|
6 |
+
*
|
7 |
+
* @since 1.0.0
|
8 |
+
* @package CGB
|
9 |
+
*/
|
10 |
|
11 |
// Exit if accessed directly.
|
12 |
+
if ( !defined( 'ABSPATH' ) ) {
|
13 |
exit;
|
14 |
}
|
15 |
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enqueue Gutenberg block assets for both frontend + backend.
|
19 |
+
*
|
20 |
+
* @uses {wp-editor} for WP editor styles.
|
21 |
+
* @since 1.0.0
|
22 |
+
*/
|
23 |
+
function embedpress_blocks_cgb_block_assets() { // phpcs:ignore
|
24 |
+
// Styles.
|
25 |
+
wp_enqueue_style(
|
26 |
+
'embedpress_blocks-cgb-style-css', // Handle.
|
27 |
+
EMBEDPRESS_GUTENBERG_DIR_URL.'dist/blocks.style.build.css', // Block style CSS.
|
28 |
+
is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
|
29 |
+
filemtime( EMBEDPRESS_GUTENBERG_DIR_PATH.'dist/blocks.style.build.css' ) // Version: File modification time.
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
// Hook: Frontend assets.
|
34 |
+
add_action( 'enqueue_block_assets', 'embedpress_blocks_cgb_block_assets' );
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Enqueue Gutenberg block assets for backend editor.
|
38 |
+
*
|
39 |
+
* @uses {wp-blocks} for block type registration & related functions.
|
40 |
+
* @uses {wp-element} for WP Element abstraction — structure of blocks.
|
41 |
+
* @uses {wp-i18n} to internationalize the block's text.
|
42 |
+
* @uses {wp-editor} for WP editor styles.
|
43 |
+
* @since 1.0.0
|
44 |
+
*/
|
45 |
+
function embedpress_blocks_cgb_editor_assets() { // phpcs:ignore
|
46 |
+
// Scripts.
|
47 |
+
wp_enqueue_script(
|
48 |
+
'embedpress_blocks-cgb-block-js', // Handle.
|
49 |
+
EMBEDPRESS_GUTENBERG_DIR_URL.'/dist/blocks.build.js', // Block.build.js: We register the block here. Built with Webpack.
|
50 |
+
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor','wp-components', 'embedpress-pdfobject' ), // Dependencies, defined above.
|
51 |
+
filemtime( EMBEDPRESS_GUTENBERG_DIR_PATH . 'dist/blocks.build.js' ), // Version: File modification time.
|
52 |
+
true // Enqueue the script in the footer.
|
53 |
+
);
|
54 |
+
$wistia_labels = array(
|
55 |
+
'watch_from_beginning' => __( 'Watch from the beginning', 'embedpress' ),
|
56 |
+
'skip_to_where_you_left_off' => __( 'Skip to where you left off', 'embedpress' ),
|
57 |
+
'you_have_watched_it_before' => __( 'It looks like you\'ve watched<br />part of this video before!', 'embedpress' ),
|
58 |
+
);
|
59 |
+
$wistia_labels = json_encode( $wistia_labels );
|
60 |
+
$wistia_options = null;
|
61 |
+
if ( function_exists( 'embedpress_wisita_pro_get_options' ) ):
|
62 |
+
$wistia_options = embedpress_wisita_pro_get_options();
|
63 |
+
endif;
|
64 |
+
$pars_url = wp_parse_url(get_site_url());
|
65 |
+
wp_localize_script( 'embedpress_blocks-cgb-block-js', 'embedpressObj', array(
|
66 |
+
'wistia_labels' => $wistia_labels,
|
67 |
+
'wisita_options' => $wistia_options,
|
68 |
+
'embedpress_powered_by' => apply_filters('embedpress_document_block_powered_by',true),
|
69 |
+
'embedpress_pro' => defined('EMBEDPRESS_PRO_PLUGIN_FILE'),
|
70 |
+
'twitch_host' => !empty($pars_url['host'])?$pars_url['host']:'',
|
71 |
+
'site_url' => site_url(),
|
72 |
+
) );
|
73 |
+
|
74 |
+
// Styles.
|
75 |
+
wp_enqueue_style(
|
76 |
+
'embedpress_blocks-cgb-block-editor-css', // Handle.
|
77 |
+
EMBEDPRESS_GUTENBERG_DIR_URL . 'dist/blocks.editor.build.css', // Block editor CSS.
|
78 |
+
array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
|
79 |
+
filemtime( EMBEDPRESS_GUTENBERG_DIR_PATH . 'dist/blocks.editor.build.css' ) // Version: File modification time.
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
// Hook: Editor assets.
|
84 |
+
add_action( 'enqueue_block_editor_assets', 'embedpress_blocks_cgb_editor_assets' );
|
85 |
+
|
86 |
+
|
87 |
+
function embedpress_block_category( $categories, $post ) {
|
88 |
+
return array_merge(
|
89 |
+
$categories,
|
90 |
+
array(
|
91 |
+
array(
|
92 |
+
'slug' => 'embedpress',
|
93 |
+
'title' => 'EmbedPress',
|
94 |
+
'icon' => '',
|
95 |
+
),
|
96 |
+
)
|
97 |
+
);
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
add_filter( 'block_categories', 'embedpress_block_category', 10, 2 );
|
102 |
+
|
103 |
+
|
104 |
+
foreach ( glob( EMBEDPRESS_GUTENBERG_DIR_PATH . 'block-backend/*.php' ) as $block_logic ) {
|
105 |
+
require_once $block_logic;
|
106 |
+
}
|
107 |
+
|
108 |
/**
|
109 |
+
* Registers the embedpress gutneberg block on server.
|
110 |
*/
|
111 |
+
|
112 |
+
function embedpress_gutenberg_register_all_block() {
|
113 |
+
if ( function_exists( 'register_block_type' ) ) :
|
114 |
+
register_block_type( 'embedpress/twitch-block' );
|
115 |
+
register_block_type( 'embedpress/google-slides-block' );
|
116 |
+
register_block_type( 'embedpress/google-sheets-block' );
|
117 |
+
register_block_type( 'embedpress/google-maps-block' );
|
118 |
+
register_block_type( 'embedpress/google-forms-block' );
|
119 |
+
register_block_type( 'embedpress/google-drawings-block' );
|
120 |
+
register_block_type( 'embedpress/google-docs-block' );
|
121 |
+
register_block_type( 'embedpress/embedpress', [
|
122 |
+
'render_callback' => 'embedpress_render_block',
|
123 |
+
]);
|
124 |
+
|
125 |
+
endif;
|
126 |
+
}
|
127 |
+
|
128 |
+
add_action( 'init', 'embedpress_gutenberg_register_all_block' );
|
Gutenberg/src/blocks.js
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Gutenberg Blocks
|
3 |
-
*
|
4 |
-
* All blocks related JavaScript files should be imported here.
|
5 |
-
* You can create a new block folder in this dir and include code
|
6 |
-
* for that block here as well.
|
7 |
-
*
|
8 |
-
* All blocks should be included here since this is the file that
|
9 |
-
* Webpack is compiling as the input file.
|
10 |
-
*/
|
11 |
-
|
12 |
-
import './google-docs/index.js';
|
13 |
-
import './google-slides/index.js';
|
14 |
-
import './google-sheets/index.js';
|
15 |
-
import './google-forms/index.js';
|
16 |
-
import './google-drawings/index.js';
|
17 |
-
import './google-maps/index.js';
|
18 |
-
import './twitch/index.js';
|
19 |
-
import './wistia/index.js';
|
20 |
-
import './youtube/index.js';
|
21 |
-
import './document/index.js';
|
22 |
-
import './embedpress/index.js';
|
23 |
-
|
24 |
-
( function() {
|
25 |
-
let a = <svg width="33" height="20" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
26 |
-
viewBox="0 0 270 270">
|
27 |
-
<g>
|
28 |
-
<polygon className="st0" fill="#9595C1" points="0,0 0,52 15,52 15,15 52,15 52,0 "/>
|
29 |
-
<polygon className="st0" fill="#9595C1" points="255,218 255,255 218,255 218,270 270,270 270,218 "/>
|
30 |
-
<path fill="#5B4E96" d="M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2
|
31 |
-
C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2
|
32 |
-
c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1
|
33 |
-
c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4
|
34 |
-
c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3
|
35 |
-
c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5
|
36 |
-
c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91
|
37 |
-
l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1
|
38 |
-
c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4
|
39 |
-
c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0
|
40 |
-
c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"/>
|
41 |
-
</g>
|
42 |
-
</svg>
|
43 |
-
wp.blocks.updateCategory( 'embedpress', { icon: a } );
|
44 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common.scss
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Common SCSS
|
3 |
-
*
|
4 |
-
* Can include things like variables and mixins
|
5 |
-
* that are used across the project.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Colors.
|
9 |
-
$black: rgb(41, 41, 41);
|
10 |
-
$white: #f4f4f4;
|
11 |
-
$gray: #dedede;
|
12 |
-
$green: #bada55;
|
13 |
-
$red: orangered;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/Iframe.js
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties
|
3 |
-
JSX USAGE: <Iframe src='http://web.site' onLoad={myOnloadFunction}/>
|
4 |
-
*/
|
5 |
-
import ReactDOM from 'react-dom'
|
6 |
-
const { Component } = wp.element;
|
7 |
-
|
8 |
-
class Iframe extends Component {
|
9 |
-
constructor(props) {
|
10 |
-
super(props);
|
11 |
-
this.myRef = React.createRef();
|
12 |
-
}
|
13 |
-
componentDidMount () {
|
14 |
-
let iframe = ReactDOM.findDOMNode(this.myRef.current)
|
15 |
-
iframe.addEventListener('load', this.props.onLoad);
|
16 |
-
}
|
17 |
-
|
18 |
-
render () {
|
19 |
-
|
20 |
-
return (
|
21 |
-
<iframe
|
22 |
-
ref={this.myRef}
|
23 |
-
{...this.props}
|
24 |
-
|
25 |
-
/>
|
26 |
-
)
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
export default Iframe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/core-embeds.js
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import { googleDocsIcon } from './icons';
|
5 |
-
/**
|
6 |
-
* WordPress dependencies
|
7 |
-
*/
|
8 |
-
const { __ } = wp.i18n;
|
9 |
-
|
10 |
-
export const common = [
|
11 |
-
{
|
12 |
-
name: 'embedpress-blocks/google',
|
13 |
-
settings: {
|
14 |
-
title: 'Google Docs',
|
15 |
-
icon: googleDocsIcon,
|
16 |
-
keywords: [ 'google' , 'docs' ],
|
17 |
-
description: __( 'Embed a google document.' ),
|
18 |
-
},
|
19 |
-
patterns: [ /^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)\/. +/i ]
|
20 |
-
},
|
21 |
-
];
|
22 |
-
|
23 |
-
export const others = [
|
24 |
-
|
25 |
-
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-controls.js
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const { __ } = wp.i18n;
|
5 |
-
const { Fragment } = wp.element;
|
6 |
-
const { IconButton, Toolbar } = wp.components;
|
7 |
-
const { BlockControls } = wp.editor;
|
8 |
-
|
9 |
-
const EmbedControls = ( props ) => {
|
10 |
-
const {
|
11 |
-
showEditButton,
|
12 |
-
switchBackToURLInput
|
13 |
-
} = props;
|
14 |
-
return (
|
15 |
-
<Fragment>
|
16 |
-
<BlockControls>
|
17 |
-
<Toolbar>
|
18 |
-
{ showEditButton && (
|
19 |
-
<IconButton
|
20 |
-
className="components-toolbar__control"
|
21 |
-
label={ __( 'Edit URL' ) }
|
22 |
-
icon="edit"
|
23 |
-
onClick={ switchBackToURLInput }
|
24 |
-
/>
|
25 |
-
) }
|
26 |
-
</Toolbar>
|
27 |
-
</BlockControls>
|
28 |
-
|
29 |
-
</Fragment>
|
30 |
-
);
|
31 |
-
};
|
32 |
-
|
33 |
-
export default EmbedControls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-loading.js
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const { __ } = wp.i18n;
|
5 |
-
const { Spinner } = wp.components;
|
6 |
-
|
7 |
-
const EmbedLoading = () => (
|
8 |
-
<div className="wp-block-embed is-loading">
|
9 |
-
<Spinner />
|
10 |
-
<p>{ __( 'Embedding…' ) }</p>
|
11 |
-
</div>
|
12 |
-
);
|
13 |
-
|
14 |
-
export default EmbedLoading;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-placeholder.js
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const {__, _x} = wp.i18n;
|
5 |
-
import classnames from 'classnames';
|
6 |
-
const {Button, Placeholder, ExternalLink} = wp.components;
|
7 |
-
const {BlockIcon} = wp.blockEditor;
|
8 |
-
|
9 |
-
const EmbedPlaceholder = (props) => {
|
10 |
-
const {icon, label, value, onSubmit, onChange, cannotEmbed, docLink, DocTitle} = props;
|
11 |
-
const classes = classnames( 'wp-block-embed', {} );
|
12 |
-
return (
|
13 |
-
<div>
|
14 |
-
<Placeholder icon={<BlockIcon icon={icon} showColors/>} label={label} className={classes}>
|
15 |
-
|
16 |
-
<form onSubmit={onSubmit}>
|
17 |
-
<input
|
18 |
-
type="url"
|
19 |
-
value={value || ''}
|
20 |
-
className="components-placeholder__input"
|
21 |
-
aria-label={label}
|
22 |
-
placeholder={__('Enter URL to embed here…')}
|
23 |
-
onChange={onChange}/>
|
24 |
-
<Button
|
25 |
-
isSmall
|
26 |
-
type="submit">
|
27 |
-
{_x('Embed', 'button label')}
|
28 |
-
</Button>
|
29 |
-
|
30 |
-
{cannotEmbed &&
|
31 |
-
<p className="components-placeholder__error">
|
32 |
-
{__('Sorry, we could not embed that content.')}<br/>
|
33 |
-
</p>
|
34 |
-
}
|
35 |
-
|
36 |
-
</form>
|
37 |
-
{docLink &&
|
38 |
-
<div className="components-placeholder__learn-more">
|
39 |
-
<ExternalLink href={docLink}>{DocTitle}</ExternalLink>
|
40 |
-
</div>
|
41 |
-
}
|
42 |
-
|
43 |
-
</Placeholder>
|
44 |
-
</div>
|
45 |
-
|
46 |
-
);
|
47 |
-
};
|
48 |
-
|
49 |
-
export default EmbedPlaceholder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-wrap.js
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties
|
3 |
-
JSX USAGE: <Epwrap src='http://web.site' onLoad={myOnloadFunction}/>
|
4 |
-
*/
|
5 |
-
import ReactDOM from 'react-dom'
|
6 |
-
const { Component } = wp.element;
|
7 |
-
|
8 |
-
export default class EmbedWrap extends Component {
|
9 |
-
constructor(props) {
|
10 |
-
super(props);
|
11 |
-
this.myRef = React.createRef();
|
12 |
-
}
|
13 |
-
componentDidMount () {
|
14 |
-
let wrap = ReactDOM.findDOMNode(this.myRef.current)
|
15 |
-
wrap.addEventListener('load', this.props.onLoad);
|
16 |
-
}
|
17 |
-
|
18 |
-
render () {
|
19 |
-
|
20 |
-
return (
|
21 |
-
<div
|
22 |
-
ref={this.myRef}
|
23 |
-
{...this.props}
|
24 |
-
></div>
|
25 |
-
)
|
26 |
-
}
|
27 |
-
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/icons.js
DELETED
@@ -1,211 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const {
|
5 |
-
G,
|
6 |
-
Path,
|
7 |
-
Polygon,
|
8 |
-
SVG,
|
9 |
-
} = wp.components;
|
10 |
-
export const googleDocsIcon =
|
11 |
-
<SVG xmlns="http://www.w3.org/1999/xlink"
|
12 |
-
viewBox="0 0 48 48"
|
13 |
-
>
|
14 |
-
<G>
|
15 |
-
<Path style= {{ fill: '#2196F3' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/>
|
16 |
-
<Path style= {{ fill: '#BBDEFB' }} d="M 40 13 L 30 13 L 30 3 Z "/>
|
17 |
-
<Path style= {{ fill: '#1565C0' }} d="M 30 13 L 40 23 L 40 13 Z "/>
|
18 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 23 L 33 23 L 33 25 L 15 25 Z "/>
|
19 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 27 L 33 27 L 33 29 L 15 29 Z "/>
|
20 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 31 L 33 31 L 33 33 L 15 33 Z "/>
|
21 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 35 L 25 35 L 25 37 L 15 37 Z "/>
|
22 |
-
</G>
|
23 |
-
</SVG>
|
24 |
-
export const googleSlidesIcon =
|
25 |
-
<SVG
|
26 |
-
xmlns="http://www.w3.org/1999/xlink"
|
27 |
-
enableBackground="new 0 0 24 24" id="Layer_2"
|
28 |
-
version="1.1"
|
29 |
-
viewBox="0 0 24 24">
|
30 |
-
<G>
|
31 |
-
<Path d="M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z"
|
32 |
-
style={{ fill: "#FFC720" }}/>
|
33 |
-
|
34 |
-
<Path d="M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z"
|
35 |
-
style={{ fill: "url(#SVGID_1_)" }} />
|
36 |
-
<Path d="M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z"
|
37 |
-
style={{ opacity: "0.1" }} />
|
38 |
-
<Path d="M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z" style= {{ fill: "#FFE083" }} />
|
39 |
-
<Path d="M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z" style={{ opacity:"0.1" }} />
|
40 |
-
<Path d="M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10" style={{ fill: "#FFFFFF", opacity: "0.2" }} />
|
41 |
-
<Path d="M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z"
|
42 |
-
style={{ fill: "#FFFFFF" }} />
|
43 |
-
|
44 |
-
<Path d="M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z" style={{ fill: "url(#SVGID_2_)" }} />
|
45 |
-
</G>
|
46 |
-
</SVG>
|
47 |
-
|
48 |
-
export const googleSheetsIcon =
|
49 |
-
<SVG
|
50 |
-
xmlns="http://www.w3.org/1999/xlink"
|
51 |
-
viewBox="0 0 48 48"
|
52 |
-
version="1.1">
|
53 |
-
<G>
|
54 |
-
<Path style={{ fill: '#43A047' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/>
|
55 |
-
<Path style={{ fill: '#C8E6C9' }} d="M 40 13 L 30 13 L 30 3 Z "/>
|
56 |
-
<Path style={{ fill: '#2E7D32' }} d="M 30 13 L 40 23 L 40 13 Z "/>
|
57 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "/>
|
58 |
-
</G>
|
59 |
-
</SVG>
|
60 |
-
|
61 |
-
export const googleFormsIcon =
|
62 |
-
<SVG
|
63 |
-
xmlns="http://www.w3.org/1999/xlink"
|
64 |
-
viewBox="0 0 48 48"
|
65 |
-
version="1.1"
|
66 |
-
>
|
67 |
-
<G>
|
68 |
-
<Path style={{ fill: '#7850C1' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/>
|
69 |
-
<Path style={{ fill: '#C2ABE1' }} d="M 40 13 L 30 13 L 30 3 Z "/>
|
70 |
-
<Path style={{ fill: '#2E7D32' }} d="M 30 13 L 40 23 L 40 13 Z "/>
|
71 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 19 23 L 33 23 L 33 25 L 19 25 Z "/>
|
72 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 19 28 L 33 28 L 33 30 L 19 30 Z "/>
|
73 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 19 33 L 33 33 L 33 35 L 19 35 Z "/>
|
74 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 15 23 L 17 23 L 17 25 L 15 25 Z "/>
|
75 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 15 28 L 17 28 L 17 30 L 15 30 Z "/>
|
76 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 15 33 L 17 33 L 17 35 L 15 35 Z "/>
|
77 |
-
</G>
|
78 |
-
</SVG>
|
79 |
-
|
80 |
-
export const googleDrawingsIcon=
|
81 |
-
<SVG
|
82 |
-
xmlns="http://www.w3.org/1999/xlink"
|
83 |
-
viewBox="0 0 48 48"
|
84 |
-
version="1.1"
|
85 |
-
>
|
86 |
-
<G>
|
87 |
-
<Path style={{ fill: '#DE5245' }} d="M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"/>
|
88 |
-
<Path style={{ fill: '#EEA6A0' }} d="M40,13H30V3L40,13z"/>
|
89 |
-
<Path style={{ fill: '#B3433A' }} d="M30,13l10,10V13H30z"/>
|
90 |
-
<Path style={{ fill: '#FFFFFF' }} d="M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"/>
|
91 |
-
<Path style={{ fill: '#FFFFFF' }} d="M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"/>
|
92 |
-
</G>
|
93 |
-
</SVG>
|
94 |
-
|
95 |
-
export const googleMapsIcon=
|
96 |
-
<SVG
|
97 |
-
xmlns="http://www.w3.org/1999/xlink"
|
98 |
-
viewBox="0 0 48 48"
|
99 |
-
version="1.1"
|
100 |
-
>
|
101 |
-
<G>
|
102 |
-
<Path style={{ fill: '#1C9957' }} d="M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "/>
|
103 |
-
<Path style={{ fill: '#3E7BF1' }} d="M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "/>
|
104 |
-
<Path style={{ fill: '#CBCCC9' }} d="M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "/>
|
105 |
-
<Path style={{ fill: '#EFEFEF' }} d="M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "/>
|
106 |
-
<Path style={{ fill: '#FFD73D' }} d="M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "/>
|
107 |
-
<Path style={{ fill: '#D73F35' }} d="M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "/>
|
108 |
-
<Path style={{ fill: '#752622' }} d="M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "/>
|
109 |
-
<Path style={{ fill: '#FFFFFF' }} d="M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "/>
|
110 |
-
</G>
|
111 |
-
</SVG>
|
112 |
-
|
113 |
-
export const twitchIcon =
|
114 |
-
<SVG
|
115 |
-
xmlns="http://www.w3.org/1999/xlink"
|
116 |
-
viewBox="0 0 48 48"
|
117 |
-
version="1.1"
|
118 |
-
>
|
119 |
-
<G>
|
120 |
-
<Path style={{ fill: '#FFFFFF' }} d="M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "/>
|
121 |
-
<Path style={{ fill: '#8E24AA' }} d="M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "/>
|
122 |
-
<Path style={{ fill: '#8E24AA' }} d="M 32 25 L 27 25 L 27 15 L 32 15 Z "/>
|
123 |
-
<Path style={{ fill: '#8E24AA' }} d="M 24 25 L 19 25 L 19 15 L 24 15 Z "/>
|
124 |
-
</G>
|
125 |
-
</SVG>
|
126 |
-
|
127 |
-
export const wistiaIcon =
|
128 |
-
<SVG
|
129 |
-
xmlns="http://www.w3.org/1999/xlink"
|
130 |
-
viewBox="0 0 769 598"
|
131 |
-
version="1.1"
|
132 |
-
>
|
133 |
-
<G>
|
134 |
-
<Path style={{ fill: '#148ee0' }} d="M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z" />
|
135 |
-
<Path style={{ fill: '#54bbff' }} d="M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z" />
|
136 |
-
</G>
|
137 |
-
</SVG>
|
138 |
-
|
139 |
-
export const youtubeIcon =
|
140 |
-
<SVG
|
141 |
-
xmlns="http://www.w3.org/2000/svg"
|
142 |
-
width="24"
|
143 |
-
height="24"
|
144 |
-
viewBox="0 0 24 24"
|
145 |
-
role="img"
|
146 |
-
aria-hidden="true"
|
147 |
-
focusable="false"
|
148 |
-
>
|
149 |
-
<Path d="M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z" />
|
150 |
-
</SVG>
|
151 |
-
|
152 |
-
export const youtubeNewIcon =
|
153 |
-
<svg version="1.1"
|
154 |
-
xmlns="http://www.w3.org/2000/svg"
|
155 |
-
viewBox="0 0 56 23"
|
156 |
-
>
|
157 |
-
<g>
|
158 |
-
<g>
|
159 |
-
<path style={{ fill: '#DA2B28' }} className="st0" d="M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4
|
160 |
-
c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8
|
161 |
-
c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1
|
162 |
-
c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z
|
163 |
-
M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8
|
164 |
-
c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2
|
165 |
-
c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z
|
166 |
-
M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2
|
167 |
-
c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1
|
168 |
-
c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"/>
|
169 |
-
<path className="st0" d="M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7
|
170 |
-
C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"/>
|
171 |
-
<path className="st0" d="M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"/>
|
172 |
-
</g>
|
173 |
-
<g>
|
174 |
-
<path
|
175 |
-
d="M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8"
|
176 |
-
/>
|
177 |
-
<path d="M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1
|
178 |
-
c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11
|
179 |
-
c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"/>
|
180 |
-
<path d="M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2
|
181 |
-
v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"/>
|
182 |
-
</g>
|
183 |
-
</g>
|
184 |
-
</svg>;
|
185 |
-
|
186 |
-
export const DocumentIcon = <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 276 340" ><path d="M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z" fill="#e94848"/><path d="M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z" fill="#f19191"/><linearGradient id="A" gradientUnits="userSpaceOnUse" x1="44.744" y1="77.111" x2="116.568" y2="77.111"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><path d="M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z" fill="url(#A)"/><linearGradient id="B" gradientUnits="userSpaceOnUse" x1="44.744" y1="136.016" x2="233.927" y2="136.016"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" opacity=".8" fill="url(#B)"/><linearGradient id="C" gradientUnits="userSpaceOnUse" x1="44.744" y1="135.993" x2="233.927" y2="135.993"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" y="33.6" opacity=".7" fill="url(#C)"/><linearGradient id="D" gradientUnits="userSpaceOnUse" x1="44.744" y1="135.969" x2="233.927" y2="135.969"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" y="67.2" opacity=".6" fill="url(#D)"/><linearGradient id="E" gradientUnits="userSpaceOnUse" x1="44.744" y1="136.045" x2="233.927" y2="136.045"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" y="100.7" opacity=".4" fill="url(#E)"/><linearGradient id="F" gradientUnits="userSpaceOnUse" x1="44.744" y1="270.322" x2="174.778" y2="270.322"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><path d="M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z" opacity=".3" fill="url(#F)"/><defs ><path id="H" d="M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"/></defs></svg>;
|
187 |
-
export const embedPressIcon =<svg
|
188 |
-
width="33"
|
189 |
-
height="20"
|
190 |
-
version="1.1"
|
191 |
-
id="Layer_1"
|
192 |
-
xmlns="http://www.w3.org/2000/svg"
|
193 |
-
x="0px"
|
194 |
-
y="0px"
|
195 |
-
viewBox="0 0 270 270"
|
196 |
-
role="img"
|
197 |
-
focusable="false">
|
198 |
-
<g>
|
199 |
-
<polygon
|
200 |
-
className="st0"
|
201 |
-
fill="#9595C1"
|
202 |
-
points="0,0 0,52 15,52 15,15 52,15 52,0 "></polygon>
|
203 |
-
<polygon
|
204 |
-
className="st0"
|
205 |
-
fill="#9595C1"
|
206 |
-
points="255,218 255,255 218,255 218,270 270,270 270,218 "></polygon>
|
207 |
-
<path
|
208 |
-
fill="#5B4E96"
|
209 |
-
d="M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"></path>
|
210 |
-
</g>
|
211 |
-
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/edit.js
DELETED
@@ -1,235 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
|
5 |
-
import Iframe from '../common/Iframe';
|
6 |
-
import EmbedLoading from '../common/embed-loading';
|
7 |
-
/**
|
8 |
-
* WordPress dependencies
|
9 |
-
*/
|
10 |
-
|
11 |
-
const {__} = wp.i18n;
|
12 |
-
const {getBlobByURL, isBlobURL, revokeBlobURL} = wp.blob;
|
13 |
-
const {BlockIcon, MediaPlaceholder ,InspectorControls} = wp.editor;
|
14 |
-
const {Component, Fragment} = wp.element;
|
15 |
-
const { RangeControl,PanelBody, ExternalLink,ToggleControl } = wp.components;
|
16 |
-
import {DocumentIcon} from '../common/icons'
|
17 |
-
|
18 |
-
const ALLOWED_MEDIA_TYPES = [
|
19 |
-
'application/pdf',
|
20 |
-
'application/msword',
|
21 |
-
'application/vnd.ms-powerpoint',
|
22 |
-
'application/vnd.ms-excel',
|
23 |
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
24 |
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
25 |
-
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
26 |
-
];
|
27 |
-
|
28 |
-
class DocumentEdit extends Component {
|
29 |
-
constructor() {
|
30 |
-
super(...arguments);
|
31 |
-
this.onSelectFile = this.onSelectFile.bind(this);
|
32 |
-
|
33 |
-
this.onUploadError = this.onUploadError.bind(this);
|
34 |
-
this.onLoad = this.onLoad.bind(this);
|
35 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
36 |
-
this.state = {
|
37 |
-
hasError: false,
|
38 |
-
fetching:false,
|
39 |
-
interactive: false,
|
40 |
-
loadPdf: true,
|
41 |
-
};
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
componentDidMount() {
|
46 |
-
const {
|
47 |
-
attributes,
|
48 |
-
mediaUpload,
|
49 |
-
noticeOperations
|
50 |
-
} = this.props;
|
51 |
-
const {href} = attributes;
|
52 |
-
|
53 |
-
// Upload a file drag-and-dropped into the editor
|
54 |
-
if (isBlobURL(href)) {
|
55 |
-
const file = getBlobByURL(href);
|
56 |
-
|
57 |
-
mediaUpload({
|
58 |
-
filesList: [file],
|
59 |
-
onFileChange: ([media]) => this.onSelectFile(media),
|
60 |
-
onError: (message) => {
|
61 |
-
this.setState({hasError: true});
|
62 |
-
noticeOperations.createErrorNotice(message);
|
63 |
-
},
|
64 |
-
});
|
65 |
-
|
66 |
-
revokeBlobURL(href);
|
67 |
-
}
|
68 |
-
|
69 |
-
if(this.props.attributes.href && this.props.attributes.mime === 'application/pdf' && this.state.loadPdf){
|
70 |
-
this.setState({loadPdf: false});
|
71 |
-
PDFObject.embed(this.props.attributes.href, "."+this.props.attributes.id);
|
72 |
-
}
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
componentDidUpdate(prevProps) {
|
77 |
-
|
78 |
-
// Reset copy confirmation state when block is deselected
|
79 |
-
if (prevProps.isSelected && !this.props.isSelected) {
|
80 |
-
this.setState({showCopyConfirmation: false});
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
static getDerivedStateFromProps(nextProps, state) {
|
86 |
-
if (!nextProps.isSelected && state.interactive) {
|
87 |
-
return {interactive: false};
|
88 |
-
}
|
89 |
-
|
90 |
-
return null;
|
91 |
-
}
|
92 |
-
|
93 |
-
hideOverlay() {
|
94 |
-
this.setState({interactive: true});
|
95 |
-
}
|
96 |
-
|
97 |
-
onLoad() {
|
98 |
-
this.setState({
|
99 |
-
fetching:false
|
100 |
-
})
|
101 |
-
}
|
102 |
-
|
103 |
-
onSelectFile(media) {
|
104 |
-
if (media && media.url) {
|
105 |
-
this.setState({hasError: false});
|
106 |
-
this.props.setAttributes({
|
107 |
-
href: media.url,
|
108 |
-
fileName: media.title,
|
109 |
-
id: 'embedpress-pdf-'+Date.now(),
|
110 |
-
mime: media.mime,
|
111 |
-
});
|
112 |
-
|
113 |
-
if(embedpressObj.embedpress_pro){
|
114 |
-
this.props.setAttributes({
|
115 |
-
powered_by: false
|
116 |
-
});
|
117 |
-
}
|
118 |
-
if(media.mime === 'application/pdf'){
|
119 |
-
this.setState({loadPdf: false});
|
120 |
-
PDFObject.embed(media.url, "."+this.props.attributes.id);
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
onUploadError(message) {
|
127 |
-
const {noticeOperations} = this.props;
|
128 |
-
noticeOperations.removeAllNotices();
|
129 |
-
noticeOperations.createErrorNotice(message);
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
render() {
|
136 |
-
const {attributes, noticeUI,setAttributes} = this.props;
|
137 |
-
const {href,mime,id,width,height,powered_by} = attributes;
|
138 |
-
const {hasError,interactive,fetching,loadPdf} = this.state;
|
139 |
-
const min = 1;
|
140 |
-
const max = 1000;
|
141 |
-
const docLink = 'https://embedpress.com/docs/embed-docuemnt/'
|
142 |
-
if (!href || hasError) {
|
143 |
-
|
144 |
-
return (
|
145 |
-
<div className={"embedpress-document-editmode"}>
|
146 |
-
<MediaPlaceholder
|
147 |
-
icon={<BlockIcon icon={DocumentIcon}/>}
|
148 |
-
labels={{
|
149 |
-
title: __('Document'),
|
150 |
-
instructions: __(
|
151 |
-
'Upload a file or pick one from your media library for embed.'
|
152 |
-
),
|
153 |
-
}}
|
154 |
-
onSelect={this.onSelectFile}
|
155 |
-
notices={noticeUI}
|
156 |
-
allowedTypes={ALLOWED_MEDIA_TYPES}
|
157 |
-
onError={this.onUploadError}
|
158 |
-
|
159 |
-
>
|
160 |
-
|
161 |
-
<div style={{width:'100%'}} className="components-placeholder__learn-more embedpress-doc-link">
|
162 |
-
<ExternalLink href={docLink}>Learn more about Embedded document </ExternalLink>
|
163 |
-
</div>
|
164 |
-
</MediaPlaceholder>
|
165 |
-
|
166 |
-
</div>
|
167 |
-
|
168 |
-
);
|
169 |
-
} else {
|
170 |
-
const url = '//view.officeapps.live.com/op/embed.aspx?src='+href;
|
171 |
-
return (
|
172 |
-
<Fragment>
|
173 |
-
{(fetching && mime !== 'application/pdf') ? <EmbedLoading/> : null}
|
174 |
-
{ mime === 'application/pdf' && (
|
175 |
-
<div style={{height:height,width:width}} className={'embedpress-embed-document-pdf'+' '+id} data-emid={id} data-emsrc={href}></div>
|
176 |
-
|
177 |
-
) }
|
178 |
-
{ mime !== 'application/pdf' && (
|
179 |
-
<Iframe onMouseUponMouseUp={ this.hideOverlay } style={{height:height,width:width,display: fetching || !loadPdf ? 'none' : ''}} onLoad={this.onLoad} src={url}/>
|
180 |
-
) }
|
181 |
-
{ ! interactive && (
|
182 |
-
<div
|
183 |
-
className="block-library-embed__interactive-overlay"
|
184 |
-
onMouseUp={ this.hideOverlay }
|
185 |
-
/>
|
186 |
-
) }
|
187 |
-
{ powered_by && (
|
188 |
-
<p className="embedpress-el-powered">Powered By EmbedPress</p>
|
189 |
-
)}
|
190 |
-
|
191 |
-
<InspectorControls key="inspector">
|
192 |
-
<PanelBody
|
193 |
-
title={ __( 'Embed Size', 'embedpress' ) }
|
194 |
-
>
|
195 |
-
<RangeControl
|
196 |
-
label={ __(
|
197 |
-
'Width',
|
198 |
-
'embedpress'
|
199 |
-
) }
|
200 |
-
value={ width }
|
201 |
-
onChange={ ( width ) =>
|
202 |
-
setAttributes( { width } )
|
203 |
-
}
|
204 |
-
max={ max }
|
205 |
-
min={ min }
|
206 |
-
/>
|
207 |
-
<RangeControl
|
208 |
-
label={ __(
|
209 |
-
'Height',
|
210 |
-
'embedpress'
|
211 |
-
) }
|
212 |
-
value={height }
|
213 |
-
onChange={ ( height ) =>
|
214 |
-
setAttributes( { height } )
|
215 |
-
}
|
216 |
-
max={ max }
|
217 |
-
min={ min }
|
218 |
-
/>
|
219 |
-
<ToggleControl
|
220 |
-
label={ __( 'Powered By' ) }
|
221 |
-
onChange={ ( powered_by ) =>
|
222 |
-
setAttributes( { powered_by } )
|
223 |
-
}
|
224 |
-
checked={ powered_by }
|
225 |
-
/>
|
226 |
-
</PanelBody>
|
227 |
-
</InspectorControls>
|
228 |
-
</Fragment>
|
229 |
-
);
|
230 |
-
}
|
231 |
-
|
232 |
-
}
|
233 |
-
|
234 |
-
};
|
235 |
-
export default DocumentEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/editor.scss
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
7 |
-
|
8 |
-
.embedpress-document-editmode .components-placeholder__instructions:after {
|
9 |
-
content:"\ASupported File Type: PDF, DOC, PPT, XLS etc ";
|
10 |
-
white-space: pre;
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/index.js
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {DocumentIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Register: aa Gutenberg Block.
|
20 |
-
*
|
21 |
-
* Registers a new block provided a unique name and an object defining its
|
22 |
-
* behavior. Once registered, the block is made editor as an option to any
|
23 |
-
* editor interface where blocks are implemented.
|
24 |
-
*
|
25 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
26 |
-
* @param {string} name Block name.
|
27 |
-
* @param {Object} settings Block settings.
|
28 |
-
* @return {?WPBlock} The block, if it has been successfully
|
29 |
-
* registered; otherwise `undefined`.
|
30 |
-
*/
|
31 |
-
registerBlockType('embedpress/document', {
|
32 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
33 |
-
title: __('Document'), // Block title.
|
34 |
-
icon: DocumentIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
35 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
36 |
-
keywords: [
|
37 |
-
__('embedpress'),
|
38 |
-
__('pdf'),
|
39 |
-
__('doc'),
|
40 |
-
__('ppt'),
|
41 |
-
],
|
42 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
43 |
-
attributes: {
|
44 |
-
id: {
|
45 |
-
type: "string"
|
46 |
-
},
|
47 |
-
href: {
|
48 |
-
type: "string"
|
49 |
-
},
|
50 |
-
powered_by: {
|
51 |
-
type: "boolean",
|
52 |
-
default: true,
|
53 |
-
},
|
54 |
-
width: {
|
55 |
-
type: 'number',
|
56 |
-
default: 600,
|
57 |
-
},
|
58 |
-
height: {
|
59 |
-
type: 'number',
|
60 |
-
default: 600,
|
61 |
-
},
|
62 |
-
fileName: {
|
63 |
-
type: "string",
|
64 |
-
},
|
65 |
-
mime: {
|
66 |
-
type: "string",
|
67 |
-
}
|
68 |
-
},
|
69 |
-
/**
|
70 |
-
* The edit function describes the structure of your block in the context of the editor.
|
71 |
-
* This represents what the editor will render when the block is used.
|
72 |
-
*
|
73 |
-
* The "edit" property must be a valid function.
|
74 |
-
*
|
75 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
76 |
-
*/
|
77 |
-
edit,
|
78 |
-
|
79 |
-
/**
|
80 |
-
* The save function defines the way in which the different attributes should be combined
|
81 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
82 |
-
*
|
83 |
-
* The "save" property must be specified and must be a valid function.
|
84 |
-
*
|
85 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
86 |
-
*/
|
87 |
-
//save
|
88 |
-
save: function (props) {
|
89 |
-
const {href, mime, id, width, height, powered_by} = props.attributes
|
90 |
-
const iframeSrc = '//view.officeapps.live.com/op/embed.aspx?src='+href;
|
91 |
-
const defaultClass = "embedpress-embed-document"
|
92 |
-
return (
|
93 |
-
<figure className={defaultClass}>
|
94 |
-
{mime === 'application/pdf' && (
|
95 |
-
<div style={{height: height, width: width}} className={'embedpress-embed-document-pdf' + ' ' + id}
|
96 |
-
data-emid={id} data-emsrc={href}></div>
|
97 |
-
)}
|
98 |
-
{mime !== 'application/pdf' && (
|
99 |
-
<iframe style={{height: height, width: width}} src={iframeSrc} mozallowfullscreen="true"
|
100 |
-
webkitallowfullscreen="true"/>
|
101 |
-
)}
|
102 |
-
{powered_by && (
|
103 |
-
<p className="embedpress-el-powered">Powered By EmbedPress</p>
|
104 |
-
)}
|
105 |
-
</figure>
|
106 |
-
);
|
107 |
-
},
|
108 |
-
|
109 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/style.scss
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
|
7 |
-
|
8 |
-
.pdfobject-container {
|
9 |
-
height: 600px;
|
10 |
-
width:600px;
|
11 |
-
margin: 0 auto;
|
12 |
-
}
|
13 |
-
|
14 |
-
.embedpress-el-powered {
|
15 |
-
text-align: center;
|
16 |
-
margin-top: 0 !important;
|
17 |
-
font-size: 16px !important;
|
18 |
-
font-weight: 700;
|
19 |
-
}
|
20 |
-
.embedpress-embed-document iframe ,
|
21 |
-
[data-type="embedpress/document"] iframe{
|
22 |
-
margin: 0 auto;
|
23 |
-
display: block;
|
24 |
-
}
|
25 |
-
.embedpress-document-editmode .components-form-file-upload {
|
26 |
-
display: none !important;
|
27 |
-
}
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/edit.js
DELETED
@@ -1,120 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import EmbedWrap from '../common/embed-wrap';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
import {embedPressIcon} from '../common/icons';
|
14 |
-
const {TextControl, PanelBody} = wp.components;
|
15 |
-
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
16 |
-
const { Fragment } = wp.element;
|
17 |
-
|
18 |
-
export default function EmbedPress({attributes, className, setAttributes}){
|
19 |
-
const {url, editingURL, fetching, cannotEmbed, interactive, embedHTML, height, width} = attributes;
|
20 |
-
///const blockProps = useBlockProps();
|
21 |
-
function switchBackToURLInput() {
|
22 |
-
setAttributes( {editingURL: true});
|
23 |
-
}
|
24 |
-
function onLoad() {
|
25 |
-
setAttributes( {fetching: false});
|
26 |
-
}
|
27 |
-
|
28 |
-
function embed(event) {
|
29 |
-
if (event) event.preventDefault();
|
30 |
-
|
31 |
-
if (url) {
|
32 |
-
setAttributes({
|
33 |
-
fetching: true
|
34 |
-
});
|
35 |
-
console.log("test");
|
36 |
-
// send api request to get iframe url
|
37 |
-
let fetchData = async (url) => {
|
38 |
-
return await fetch(`${embedpressObj.site_url}/wp-json/embedpress/v1/oembed/embedpress?url=${url}&width=${width}&height=${height}`).then(response => response.json());
|
39 |
-
}
|
40 |
-
fetchData(url).then(data => {
|
41 |
-
setAttributes({
|
42 |
-
fetching: false
|
43 |
-
});
|
44 |
-
if ((data.data && data.data.status === 404) || !data.embed){
|
45 |
-
setAttributes({
|
46 |
-
cannotEmbed: true,
|
47 |
-
editingURL: true,
|
48 |
-
})
|
49 |
-
}else{
|
50 |
-
setAttributes({
|
51 |
-
embedHTML: data.embed,
|
52 |
-
cannotEmbed: false,
|
53 |
-
editingURL: false,
|
54 |
-
});
|
55 |
-
}
|
56 |
-
});
|
57 |
-
|
58 |
-
|
59 |
-
} else {
|
60 |
-
setAttributes({
|
61 |
-
cannotEmbed: true,
|
62 |
-
fetching: false,
|
63 |
-
editingURL: true
|
64 |
-
})
|
65 |
-
}
|
66 |
-
}
|
67 |
-
return (
|
68 |
-
<Fragment>
|
69 |
-
<InspectorControls>
|
70 |
-
<PanelBody title={__("Customize Embedded Link")}>
|
71 |
-
<p>{__("You can adjust the width and height of embedded content.")}</p>
|
72 |
-
<TextControl
|
73 |
-
label={__("Width")}
|
74 |
-
value={ width }
|
75 |
-
onChange={ ( width ) => setAttributes( { width } ) }
|
76 |
-
/>
|
77 |
-
<TextControl
|
78 |
-
label={__("Height")}
|
79 |
-
value={ height }
|
80 |
-
onChange={ ( height ) => setAttributes( { height } ) }
|
81 |
-
/>
|
82 |
-
{(embedHTML && !editingURL) && <button onClick={embed}>{__('Apply')}</button>}
|
83 |
-
</PanelBody>
|
84 |
-
</InspectorControls>
|
85 |
-
{ ((!embedHTML || editingURL) && !fetching) && <EmbedPlaceholder
|
86 |
-
label={__('EmbedPress - Embed anything from 100+ sites')}
|
87 |
-
onSubmit={embed}
|
88 |
-
value={url}
|
89 |
-
cannotEmbed={cannotEmbed}
|
90 |
-
onChange={(event) => setAttributes({url: event.target.value})}
|
91 |
-
icon={embedPressIcon}
|
92 |
-
DocTitle={__('Learn more about EmbedPress')}
|
93 |
-
docLink={'https://embedpress.com/docs/'}
|
94 |
-
/> }
|
95 |
-
|
96 |
-
{ fetching ? <div className={className}><EmbedLoading/> </div> : null}
|
97 |
-
|
98 |
-
{(embedHTML && !editingURL && !fetching) && <figure {...useBlockProps()}>
|
99 |
-
<EmbedWrap style={{display: fetching ? 'none' : ''}} dangerouslySetInnerHTML={{
|
100 |
-
__html: embedHTML
|
101 |
-
}}></EmbedWrap>
|
102 |
-
|
103 |
-
<div
|
104 |
-
className="block-library-embed__interactive-overlay"
|
105 |
-
onMouseUp={ setAttributes({interactive: true}) }
|
106 |
-
/>
|
107 |
-
|
108 |
-
<EmbedControls
|
109 |
-
showEditButton={embedHTML && !cannotEmbed}
|
110 |
-
switchBackToURLInput={switchBackToURLInput}
|
111 |
-
/>
|
112 |
-
</figure>}
|
113 |
-
|
114 |
-
</Fragment>
|
115 |
-
|
116 |
-
);
|
117 |
-
|
118 |
-
}
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/editor.scss
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
7 |
-
.wp-block-embedpress-embedpress iframe{
|
8 |
-
max-width: 100%;
|
9 |
-
}
|
10 |
-
.ose-the-new-york-times iframe{
|
11 |
-
min-height: 500px;
|
12 |
-
max-height: 100%;
|
13 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/index.js
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {embedPressIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/embedpress', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('EmbedPress'), // Block title.
|
33 |
-
icon: embedPressIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
'embedpress',
|
37 |
-
'embed',
|
38 |
-
'google',
|
39 |
-
'youtube',
|
40 |
-
'docs',
|
41 |
-
],
|
42 |
-
supports: {align: ["right","left","center"], default: 'center',lightBlockWrapper: true},
|
43 |
-
attributes: {
|
44 |
-
url: {
|
45 |
-
type: 'string',
|
46 |
-
default: ''
|
47 |
-
},
|
48 |
-
embedHTML: {
|
49 |
-
type: 'string',
|
50 |
-
default: ''
|
51 |
-
},
|
52 |
-
height: {
|
53 |
-
type: 'string',
|
54 |
-
default: '450'
|
55 |
-
},
|
56 |
-
width: {
|
57 |
-
type: 'string',
|
58 |
-
default: '600'
|
59 |
-
},
|
60 |
-
editingURL: {
|
61 |
-
type: 'boolean',
|
62 |
-
default: false
|
63 |
-
},
|
64 |
-
fetching: {
|
65 |
-
type: 'boolean',
|
66 |
-
default: false
|
67 |
-
},
|
68 |
-
cannotEmbed: {
|
69 |
-
type: 'boolean',
|
70 |
-
default: false
|
71 |
-
},
|
72 |
-
interactive: {
|
73 |
-
type: 'boolean',
|
74 |
-
default: false
|
75 |
-
},
|
76 |
-
align: {
|
77 |
-
type: 'string',
|
78 |
-
default: 'center'
|
79 |
-
},
|
80 |
-
},
|
81 |
-
/**
|
82 |
-
* The edit function describes the structure of your block in the context of the editor.
|
83 |
-
* This represents what the editor will render when the block is used.
|
84 |
-
*
|
85 |
-
* The "edit" property must be a valid function.
|
86 |
-
*
|
87 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
88 |
-
*/
|
89 |
-
edit,
|
90 |
-
|
91 |
-
/**
|
92 |
-
* The save function defines the way in which the different attributes should be combined
|
93 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
94 |
-
*
|
95 |
-
* The "save" property must be specified and must be a valid function.
|
96 |
-
*
|
97 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
98 |
-
*/
|
99 |
-
save: () => null,
|
100 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/style.scss
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
//.embedpress-gutenberg-wrapper iframe{
|
7 |
-
// width: 100%;
|
8 |
-
// height: 100%;
|
9 |
-
//}
|
10 |
-
.embedpress-gutenberg-wrapper {
|
11 |
-
margin: 30px auto;
|
12 |
-
iframe {
|
13 |
-
max-width: 100%;
|
14 |
-
}
|
15 |
-
}
|
16 |
-
.ose-the-new-york-times iframe{
|
17 |
-
min-height: 500px;
|
18 |
-
max-height: 100%;
|
19 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/edit.js
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component} = wp.element;
|
14 |
-
import {googleDocsIcon} from '../common/icons';
|
15 |
-
|
16 |
-
class GoogleDocsEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.updateAlignment = this.updateAlignment.bind(this);
|
22 |
-
this.onLoad = this.onLoad.bind(this);
|
23 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
24 |
-
this.state = {
|
25 |
-
editingURL: false,
|
26 |
-
url: this.props.attributes.url,
|
27 |
-
fetching: true,
|
28 |
-
cannotEmbed: false,
|
29 |
-
interactive: false
|
30 |
-
};
|
31 |
-
}
|
32 |
-
|
33 |
-
static getDerivedStateFromProps(nextProps, state) {
|
34 |
-
if (!nextProps.isSelected && state.interactive) {
|
35 |
-
return {interactive: false};
|
36 |
-
}
|
37 |
-
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
|
41 |
-
hideOverlay() {
|
42 |
-
this.setState({interactive: true});
|
43 |
-
}
|
44 |
-
|
45 |
-
onLoad() {
|
46 |
-
this.setState({
|
47 |
-
fetching: false
|
48 |
-
})
|
49 |
-
}
|
50 |
-
|
51 |
-
decodeHTMLEntities(str) {
|
52 |
-
if (str && typeof str === 'string') {
|
53 |
-
// strip script/html tags
|
54 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
55 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
56 |
-
|
57 |
-
}
|
58 |
-
return str;
|
59 |
-
}
|
60 |
-
|
61 |
-
updateAlignment(nextAlign) {
|
62 |
-
const {setAttributes} = this.props;
|
63 |
-
const extraUpdatedAttributes =
|
64 |
-
['wide', 'full'].indexOf(nextAlign) !== -1
|
65 |
-
? {width: undefined, height: undefined}
|
66 |
-
: {};
|
67 |
-
setAttributes({
|
68 |
-
...extraUpdatedAttributes,
|
69 |
-
align: nextAlign,
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
setUrl(event) {
|
75 |
-
if (event) {
|
76 |
-
event.preventDefault();
|
77 |
-
}
|
78 |
-
const {url} = this.state;
|
79 |
-
const {setAttributes} = this.props;
|
80 |
-
setAttributes({url});
|
81 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
82 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
83 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
84 |
-
var match = regEx.exec(iframeSrc);
|
85 |
-
var type = match[1];
|
86 |
-
if (type && type === 'document') {
|
87 |
-
if (!iframeSrc.match(/([?&])embedded=true/i)) {
|
88 |
-
if (iframeSrc.indexOf('?') > -1) {
|
89 |
-
iframeSrc += '&embedded=true';
|
90 |
-
} else {
|
91 |
-
iframeSrc += '?embedded=true'
|
92 |
-
}
|
93 |
-
}
|
94 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
95 |
-
setAttributes({iframeSrc: iframeSrc})
|
96 |
-
} else {
|
97 |
-
this.setState({
|
98 |
-
cannotEmbed: true,
|
99 |
-
editingURL: true
|
100 |
-
})
|
101 |
-
}
|
102 |
-
} else {
|
103 |
-
this.setState({
|
104 |
-
cannotEmbed: true,
|
105 |
-
editingURL: true
|
106 |
-
})
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
switchBackToURLInput() {
|
111 |
-
this.setState({editingURL: true});
|
112 |
-
}
|
113 |
-
|
114 |
-
render() {
|
115 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
116 |
-
const {iframeSrc} = this.props.attributes;
|
117 |
-
const label = __('Google Docs URL');
|
118 |
-
|
119 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
120 |
-
if (!iframeSrc || editingURL) {
|
121 |
-
return (
|
122 |
-
<div>
|
123 |
-
<EmbedPlaceholder
|
124 |
-
label={label}
|
125 |
-
onSubmit={this.setUrl}
|
126 |
-
value={url}
|
127 |
-
cannotEmbed={cannotEmbed}
|
128 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
129 |
-
icon={googleDocsIcon}
|
130 |
-
DocTitle={__('Learn more about Google doc embed')}
|
131 |
-
docLink={'https://embedpress.com/docs/embed-google-docs-wordpress/'}
|
132 |
-
/>
|
133 |
-
</div>
|
134 |
-
|
135 |
-
);
|
136 |
-
} else {
|
137 |
-
return (
|
138 |
-
<div>
|
139 |
-
{fetching ? <EmbedLoading/> : null}
|
140 |
-
|
141 |
-
<Iframe src={iframeSrc} onMouseUp={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
142 |
-
frameBorder="0" width="600" height="450"/>
|
143 |
-
|
144 |
-
{ ! interactive && (
|
145 |
-
<div
|
146 |
-
className="block-library-embed__interactive-overlay"
|
147 |
-
onMouseUp={ this.hideOverlay }
|
148 |
-
/>
|
149 |
-
) }
|
150 |
-
|
151 |
-
<EmbedControls
|
152 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
153 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
154 |
-
/>
|
155 |
-
</div>
|
156 |
-
)
|
157 |
-
}
|
158 |
-
|
159 |
-
}
|
160 |
-
};
|
161 |
-
export default GoogleDocsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/index.js
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleDocsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-docs-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Docs'), // Block title.
|
33 |
-
icon: googleDocsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('docs'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-docs-document'
|
72 |
-
if (iframeSrc) {
|
73 |
-
return (
|
74 |
-
<figure className={defaultClass}>
|
75 |
-
|
76 |
-
<iframe src={iframeSrc} frameBorder="0" width="600" height="450" allowFullScreen="true"
|
77 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
78 |
-
|
79 |
-
</figure>
|
80 |
-
|
81 |
-
);
|
82 |
-
}
|
83 |
-
},
|
84 |
-
deprecated: [
|
85 |
-
{
|
86 |
-
attributes: {
|
87 |
-
align: {
|
88 |
-
type: "string",
|
89 |
-
enum: ["left", "center", "right", "wide", "full"]
|
90 |
-
},
|
91 |
-
},
|
92 |
-
|
93 |
-
save: function (props) {
|
94 |
-
const {iframeSrc} = props.attributes
|
95 |
-
if (iframeSrc) {
|
96 |
-
return (
|
97 |
-
<div className="ose-google-docs-document">
|
98 |
-
|
99 |
-
<iframe src={iframeSrc} frameBorder="0" width="600" height="450" allowFullScreen="true"
|
100 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
101 |
-
|
102 |
-
</div>
|
103 |
-
|
104 |
-
);
|
105 |
-
}
|
106 |
-
},
|
107 |
-
}
|
108 |
-
]
|
109 |
-
|
110 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/edit.js
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
|
8 |
-
/**
|
9 |
-
* WordPress dependencies
|
10 |
-
*/
|
11 |
-
const {__} = wp.i18n;
|
12 |
-
const {Component, Fragment} = wp.element;
|
13 |
-
import {googleDrawingsIcon} from '../common/icons';
|
14 |
-
|
15 |
-
class GoogleDrawingEdit extends Component {
|
16 |
-
constructor() {
|
17 |
-
super(...arguments);
|
18 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
19 |
-
this.setUrl = this.setUrl.bind(this);
|
20 |
-
this.onLoad = this.onLoad.bind(this);
|
21 |
-
this.state = {
|
22 |
-
editingURL: false,
|
23 |
-
url: this.props.attributes.url,
|
24 |
-
fetching: true,
|
25 |
-
cannotEmbed: false
|
26 |
-
};
|
27 |
-
}
|
28 |
-
|
29 |
-
onLoad() {
|
30 |
-
this.setState({
|
31 |
-
fetching: false
|
32 |
-
})
|
33 |
-
}
|
34 |
-
|
35 |
-
decodeHTMLEntities(str) {
|
36 |
-
if (str && typeof str === 'string') {
|
37 |
-
// strip script/html tags
|
38 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
39 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
40 |
-
|
41 |
-
}
|
42 |
-
return str;
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
setUrl(event) {
|
47 |
-
if (event) {
|
48 |
-
event.preventDefault();
|
49 |
-
}
|
50 |
-
const {url} = this.state;
|
51 |
-
const {setAttributes} = this.props;
|
52 |
-
setAttributes({url});
|
53 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
54 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
55 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
56 |
-
var match = regEx.exec(iframeSrc);
|
57 |
-
var type = match[1];
|
58 |
-
if (type && type == 'drawings') {
|
59 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
60 |
-
setAttributes({iframeSrc: iframeSrc})
|
61 |
-
} else {
|
62 |
-
this.setState({
|
63 |
-
cannotEmbed: true,
|
64 |
-
editingURL: true
|
65 |
-
})
|
66 |
-
}
|
67 |
-
} else {
|
68 |
-
this.setState({
|
69 |
-
cannotEmbed: true,
|
70 |
-
editingURL: true
|
71 |
-
})
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
switchBackToURLInput() {
|
76 |
-
this.setState({editingURL: true});
|
77 |
-
}
|
78 |
-
|
79 |
-
render() {
|
80 |
-
const {url, editingURL, fetching, cannotEmbed} = this.state;
|
81 |
-
const {iframeSrc} = this.props.attributes;
|
82 |
-
|
83 |
-
const label = __('Google Drawings URL (Get your link from File -> Publish to the web -> Link)');
|
84 |
-
|
85 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
86 |
-
if (!iframeSrc || editingURL) {
|
87 |
-
return (
|
88 |
-
<EmbedPlaceholder
|
89 |
-
label={label}
|
90 |
-
onSubmit={this.setUrl}
|
91 |
-
value={url}
|
92 |
-
cannotEmbed={cannotEmbed}
|
93 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
94 |
-
icon={googleDrawingsIcon}
|
95 |
-
DocTitle={__('Learn more about Google drawing embed')}
|
96 |
-
docLink={'https://embedpress.com/docs/embed-google-drawings-wordpress/'}
|
97 |
-
/>
|
98 |
-
);
|
99 |
-
} else {
|
100 |
-
|
101 |
-
return (
|
102 |
-
<Fragment>
|
103 |
-
{fetching ? <EmbedLoading/> : null}
|
104 |
-
<img src={iframeSrc} onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}} width="960"
|
105 |
-
height="720"/>
|
106 |
-
<EmbedControls
|
107 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
108 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
109 |
-
/>
|
110 |
-
</Fragment>
|
111 |
-
|
112 |
-
)
|
113 |
-
}
|
114 |
-
}
|
115 |
-
};
|
116 |
-
export default GoogleDrawingEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/index.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleDrawingsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-drawings-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Drawings'), // Block title.
|
33 |
-
icon: googleDrawingsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('drawings'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-docs-drawings'
|
72 |
-
return (
|
73 |
-
<figure className={defaultClass}>
|
74 |
-
<img src={iframeSrc} width="960" height="720"/>
|
75 |
-
</figure>
|
76 |
-
);
|
77 |
-
},
|
78 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/edit.js
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
import {googleDrawingsIcon} from "../common/icons";
|
9 |
-
|
10 |
-
/**
|
11 |
-
* WordPress dependencies
|
12 |
-
*/
|
13 |
-
const {__} = wp.i18n;
|
14 |
-
const {Component, Fragment} = wp.element;
|
15 |
-
import {googleFormsIcon} from '../common/icons';
|
16 |
-
|
17 |
-
const {Disabled} = wp.components;
|
18 |
-
|
19 |
-
class GoogleFormsEdit extends Component {
|
20 |
-
constructor() {
|
21 |
-
super(...arguments);
|
22 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
23 |
-
this.setUrl = this.setUrl.bind(this);
|
24 |
-
this.onLoad = this.onLoad.bind(this);
|
25 |
-
this.state = {
|
26 |
-
editingURL: false,
|
27 |
-
url: this.props.attributes.url,
|
28 |
-
fetching: true,
|
29 |
-
cannotEmbed: false,
|
30 |
-
interactive: false
|
31 |
-
};
|
32 |
-
}
|
33 |
-
|
34 |
-
static getDerivedStateFromProps(nextProps, state) {
|
35 |
-
if (!nextProps.isSelected && state.interactive) {
|
36 |
-
return {interactive: false};
|
37 |
-
}
|
38 |
-
|
39 |
-
return null;
|
40 |
-
}
|
41 |
-
|
42 |
-
hideOverlay() {
|
43 |
-
this.setState({interactive: true});
|
44 |
-
}
|
45 |
-
|
46 |
-
onLoad() {
|
47 |
-
this.setState({
|
48 |
-
fetching: false
|
49 |
-
})
|
50 |
-
}
|
51 |
-
|
52 |
-
decodeHTMLEntities(str) {
|
53 |
-
if (str && typeof str === 'string') {
|
54 |
-
// strip script/html tags
|
55 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
56 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
57 |
-
|
58 |
-
}
|
59 |
-
return str;
|
60 |
-
}
|
61 |
-
|
62 |
-
|
63 |
-
setUrl(event) {
|
64 |
-
if (event) {
|
65 |
-
event.preventDefault();
|
66 |
-
}
|
67 |
-
const {url} = this.state;
|
68 |
-
const {setAttributes} = this.props;
|
69 |
-
setAttributes({url});
|
70 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
71 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
72 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
73 |
-
var match = regEx.exec(iframeSrc);
|
74 |
-
var type = match[1];
|
75 |
-
if (type && type == 'forms') {
|
76 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
77 |
-
setAttributes({iframeSrc: iframeSrc})
|
78 |
-
} else {
|
79 |
-
this.setState({
|
80 |
-
cannotEmbed: true,
|
81 |
-
editingURL: true
|
82 |
-
})
|
83 |
-
}
|
84 |
-
} else {
|
85 |
-
this.setState({
|
86 |
-
cannotEmbed: true,
|
87 |
-
editingURL: true
|
88 |
-
})
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
switchBackToURLInput() {
|
93 |
-
this.setState({editingURL: true});
|
94 |
-
}
|
95 |
-
|
96 |
-
render() {
|
97 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
98 |
-
const {iframeSrc} = this.props.attributes;
|
99 |
-
|
100 |
-
const label = __('Google Forms URL');
|
101 |
-
|
102 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
103 |
-
if (!iframeSrc || editingURL) {
|
104 |
-
return (
|
105 |
-
<EmbedPlaceholder
|
106 |
-
label={label}
|
107 |
-
onSubmit={this.setUrl}
|
108 |
-
value={url}
|
109 |
-
cannotEmbed={cannotEmbed}
|
110 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
111 |
-
icon={googleFormsIcon}
|
112 |
-
DocTitle={__('Learn more about Google forms embed')}
|
113 |
-
docLink={'https://embedpress.com/docs/embed-google-forms-wordpress/'}
|
114 |
-
/>
|
115 |
-
);
|
116 |
-
} else {
|
117 |
-
|
118 |
-
return (
|
119 |
-
<Fragment>
|
120 |
-
{fetching ? <EmbedLoading/> : null}
|
121 |
-
|
122 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
123 |
-
frameborder="0" width="600" height="450"/>
|
124 |
-
|
125 |
-
{ ! interactive && (
|
126 |
-
<div
|
127 |
-
className="block-library-embed__interactive-overlay"
|
128 |
-
onMouseUp={ this.hideOverlay }
|
129 |
-
/>
|
130 |
-
) }
|
131 |
-
|
132 |
-
<EmbedControls
|
133 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
134 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
135 |
-
/>
|
136 |
-
</Fragment>
|
137 |
-
|
138 |
-
)
|
139 |
-
}
|
140 |
-
}
|
141 |
-
};
|
142 |
-
export default GoogleFormsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/index.js
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleFormsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-forms-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Forms'), // Block title.
|
33 |
-
icon: googleFormsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('forms'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-docs-forms'
|
72 |
-
return (
|
73 |
-
<figure className={defaultClass}>
|
74 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" allowfullscreen="true"
|
75 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
76 |
-
</figure>
|
77 |
-
);
|
78 |
-
},
|
79 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/edit.js
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {googleMapsIcon} from '../common/icons'
|
15 |
-
|
16 |
-
class GoogleMapsEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.onLoad = this.onLoad.bind(this);
|
22 |
-
this.state = {
|
23 |
-
editingURL: false,
|
24 |
-
url: this.props.attributes.url,
|
25 |
-
fetching: true,
|
26 |
-
cannotEmbed: false,
|
27 |
-
interactive: false
|
28 |
-
};
|
29 |
-
}
|
30 |
-
|
31 |
-
static getDerivedStateFromProps(nextProps, state) {
|
32 |
-
if (!nextProps.isSelected && state.interactive) {
|
33 |
-
return {interactive: false};
|
34 |
-
}
|
35 |
-
|
36 |
-
return null;
|
37 |
-
}
|
38 |
-
|
39 |
-
hideOverlay() {
|
40 |
-
this.setState({interactive: true});
|
41 |
-
}
|
42 |
-
|
43 |
-
onLoad() {
|
44 |
-
this.setState({
|
45 |
-
fetching: false
|
46 |
-
})
|
47 |
-
}
|
48 |
-
|
49 |
-
decodeHTMLEntities(str) {
|
50 |
-
if (str && typeof str === 'string') {
|
51 |
-
// strip script/html tags
|
52 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
53 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
54 |
-
|
55 |
-
}
|
56 |
-
return str;
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
setUrl(event) {
|
61 |
-
if (event) {
|
62 |
-
event.preventDefault();
|
63 |
-
}
|
64 |
-
const {url} = this.state;
|
65 |
-
const {setAttributes} = this.props;
|
66 |
-
setAttributes({url});
|
67 |
-
if (url && url.match(/^http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com?))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?(?:place\/)?(?:[a-z0-9\/%+\-_]*)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)/i)) {
|
68 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
69 |
-
/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
70 |
-
if (url.match('~(maps/embed|output=embed)~i')) {
|
71 |
-
//do something
|
72 |
-
} else {
|
73 |
-
var regEx = /@(-?[0-9\.]+,-?[0-9\.]+).+,([0-9\.]+[a-z])/i;
|
74 |
-
var match = regEx.exec(iframeSrc);
|
75 |
-
if (match && match.length > 1 && match[1] && match[2]) {
|
76 |
-
iframeSrc = 'https://maps.google.com/maps?hl=en&ie=UTF8&ll=' + match[1] + '&spn=' + match[1] + '&t=m&z=' + Math.round(parseInt(match[2])) + '&output=embed';
|
77 |
-
} else {
|
78 |
-
this.setState({
|
79 |
-
cannotEmbed: true,
|
80 |
-
editingURL: true
|
81 |
-
})
|
82 |
-
}
|
83 |
-
|
84 |
-
}
|
85 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
86 |
-
setAttributes({iframeSrc: iframeSrc})
|
87 |
-
} else {
|
88 |
-
this.setState({
|
89 |
-
cannotEmbed: true,
|
90 |
-
editingURL: true
|
91 |
-
})
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
switchBackToURLInput() {
|
96 |
-
this.setState({editingURL: true});
|
97 |
-
}
|
98 |
-
|
99 |
-
render() {
|
100 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
101 |
-
const {iframeSrc} = this.props.attributes;
|
102 |
-
|
103 |
-
const label = __('Google Maps URL');
|
104 |
-
|
105 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
106 |
-
if (!iframeSrc || editingURL) {
|
107 |
-
return (
|
108 |
-
<EmbedPlaceholder
|
109 |
-
label={label}
|
110 |
-
onSubmit={this.setUrl}
|
111 |
-
value={url}
|
112 |
-
cannotEmbed={cannotEmbed}
|
113 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
114 |
-
icon={googleMapsIcon}
|
115 |
-
DocTitle={__('Learn more about Google map embed')}
|
116 |
-
docLink={'https://embedpress.com/docs/embed-google-maps-wordpress/'}
|
117 |
-
/>
|
118 |
-
);
|
119 |
-
} else {
|
120 |
-
|
121 |
-
return (
|
122 |
-
<Fragment>
|
123 |
-
{fetching ? <EmbedLoading/> : null}
|
124 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
125 |
-
frameborder="0" width="600" height="450"/>
|
126 |
-
|
127 |
-
{ ! interactive && (
|
128 |
-
<div
|
129 |
-
className="block-library-embed__interactive-overlay"
|
130 |
-
onMouseUp={ this.hideOverlay }
|
131 |
-
/>
|
132 |
-
) }
|
133 |
-
|
134 |
-
<EmbedControls
|
135 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
136 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
137 |
-
/>
|
138 |
-
</Fragment>
|
139 |
-
|
140 |
-
)
|
141 |
-
}
|
142 |
-
}
|
143 |
-
};
|
144 |
-
export default GoogleMapsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/index.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleMapsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-maps-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Maps'), // Block title.
|
33 |
-
icon: googleMapsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('maps'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-maps'
|
72 |
-
return (
|
73 |
-
<figure className={defaultClass}>
|
74 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" frameborder="0"></iframe>
|
75 |
-
</figure>
|
76 |
-
);
|
77 |
-
},
|
78 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/edit.js
DELETED
@@ -1,165 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {googleSheetsIcon} from '../common/icons'
|
15 |
-
|
16 |
-
class GoogleSheetsEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.onLoad = this.onLoad.bind(this);
|
22 |
-
this.hideOverlay = this.hideOverlay.bind(this)
|
23 |
-
this.state = {
|
24 |
-
editingURL: false,
|
25 |
-
url: this.props.attributes.url,
|
26 |
-
fetching: true,
|
27 |
-
cannotEmbed: false,
|
28 |
-
interactive:false
|
29 |
-
};
|
30 |
-
}
|
31 |
-
|
32 |
-
static getDerivedStateFromProps(nextProps, state) {
|
33 |
-
if (!nextProps.isSelected && state.interactive) {
|
34 |
-
return {interactive: false};
|
35 |
-
}
|
36 |
-
|
37 |
-
return null;
|
38 |
-
}
|
39 |
-
|
40 |
-
hideOverlay() {
|
41 |
-
this.setState({interactive: true});
|
42 |
-
}
|
43 |
-
|
44 |
-
onLoad() {
|
45 |
-
this.setState({
|
46 |
-
fetching: false
|
47 |
-
})
|
48 |
-
}
|
49 |
-
|
50 |
-
decodeHTMLEntities(str) {
|
51 |
-
if (str && typeof str === 'string') {
|
52 |
-
// strip script/html tags
|
53 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
54 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
55 |
-
|
56 |
-
}
|
57 |
-
return str;
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
setUrl(event) {
|
62 |
-
if (event) {
|
63 |
-
event.preventDefault();
|
64 |
-
}
|
65 |
-
const {url} = this.state;
|
66 |
-
const {setAttributes} = this.props;
|
67 |
-
setAttributes({url});
|
68 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
69 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
70 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
71 |
-
var match = regEx.exec(iframeSrc);
|
72 |
-
var type = match[1];
|
73 |
-
if (type && type == 'spreadsheets') {
|
74 |
-
if (iframeSrc.indexOf('?') > -1) {
|
75 |
-
var query = iframeSrc.split('?');
|
76 |
-
query = query[1];
|
77 |
-
query = query.split('&');
|
78 |
-
console.log(query)
|
79 |
-
if (query.length > 0) {
|
80 |
-
var hasHeadersParam = false;
|
81 |
-
var hasWidgetParam = false;
|
82 |
-
query.map(param => {
|
83 |
-
if (param.indexOf('widget=')) {
|
84 |
-
hasWidgetParam = true;
|
85 |
-
} else if (param.indexOf('headers=')) {
|
86 |
-
hasHeadersParam = true;
|
87 |
-
}
|
88 |
-
})
|
89 |
-
if (!hasWidgetParam) {
|
90 |
-
iframeSrc += '&widget=true';
|
91 |
-
}
|
92 |
-
|
93 |
-
if (!hasHeadersParam) {
|
94 |
-
iframeSrc += '&headers=false';
|
95 |
-
}
|
96 |
-
}
|
97 |
-
} else {
|
98 |
-
iframeSrc += '?widget=true&headers=false';
|
99 |
-
}
|
100 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
101 |
-
setAttributes({iframeSrc: iframeSrc})
|
102 |
-
} else {
|
103 |
-
this.setState({
|
104 |
-
cannotEmbed: true,
|
105 |
-
editingURL: true
|
106 |
-
})
|
107 |
-
}
|
108 |
-
} else {
|
109 |
-
this.setState({
|
110 |
-
cannotEmbed: true,
|
111 |
-
editingURL: true
|
112 |
-
})
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
switchBackToURLInput() {
|
117 |
-
this.setState({editingURL: true});
|
118 |
-
}
|
119 |
-
|
120 |
-
render() {
|
121 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
122 |
-
const {iframeSrc} = this.props.attributes;
|
123 |
-
|
124 |
-
const label = __('Google Sheets URL');
|
125 |
-
|
126 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
127 |
-
if (!iframeSrc || editingURL) {
|
128 |
-
return (
|
129 |
-
<EmbedPlaceholder
|
130 |
-
label={label}
|
131 |
-
onSubmit={this.setUrl}
|
132 |
-
value={url}
|
133 |
-
cannotEmbed={cannotEmbed}
|
134 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
135 |
-
icon={googleSheetsIcon}
|
136 |
-
DocTitle={__('Learn more about Google sheet embed')}
|
137 |
-
docLink={'https://embedpress.com/docs/embed-google-sheets-wordpress/'}
|
138 |
-
/>
|
139 |
-
);
|
140 |
-
} else {
|
141 |
-
|
142 |
-
return (
|
143 |
-
<Fragment>
|
144 |
-
{fetching ? <EmbedLoading/> : null}
|
145 |
-
|
146 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
147 |
-
frameborder="0" width="600" height="450"/>
|
148 |
-
{ ! interactive && (
|
149 |
-
<div
|
150 |
-
className="block-library-embed__interactive-overlay"
|
151 |
-
onMouseUp={ this.hideOverlay }
|
152 |
-
/>
|
153 |
-
) }
|
154 |
-
|
155 |
-
<EmbedControls
|
156 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
157 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
158 |
-
/>
|
159 |
-
</Fragment>
|
160 |
-
|
161 |
-
)
|
162 |
-
}
|
163 |
-
}
|
164 |
-
};
|
165 |
-
export default GoogleSheetsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/index.js
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { googleSheetsIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType( 'embedpress/google-sheets-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __( 'Google Sheets' ), // Block title.
|
32 |
-
icon: googleSheetsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__( 'embedpress' ),
|
36 |
-
__( 'google' ),
|
37 |
-
__( 'sheets' ),
|
38 |
-
],
|
39 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
40 |
-
attributes: {
|
41 |
-
url: {
|
42 |
-
type: 'string',
|
43 |
-
default: ''
|
44 |
-
},
|
45 |
-
iframeSrc: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
}
|
49 |
-
},
|
50 |
-
/**
|
51 |
-
* The edit function describes the structure of your block in the context of the editor.
|
52 |
-
* This represents what the editor will render when the block is used.
|
53 |
-
*
|
54 |
-
* The "edit" property must be a valid function.
|
55 |
-
*
|
56 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
57 |
-
*/
|
58 |
-
edit,
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The save function defines the way in which the different attributes should be combined
|
62 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
63 |
-
*
|
64 |
-
* The "save" property must be specified and must be a valid function.
|
65 |
-
*
|
66 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
67 |
-
*/
|
68 |
-
save: function( props ) {
|
69 |
-
const { iframeSrc } = props.attributes
|
70 |
-
const defaultClass = 'ose-google-docs-spreadsheets'
|
71 |
-
return (
|
72 |
-
<figure className={defaultClass}>
|
73 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
74 |
-
</figure>
|
75 |
-
);
|
76 |
-
},
|
77 |
-
deprecated: [
|
78 |
-
{
|
79 |
-
attributes: {
|
80 |
-
align: {
|
81 |
-
type: "string",
|
82 |
-
enum: ["left", "center", "right", "wide", "full"]
|
83 |
-
},
|
84 |
-
},
|
85 |
-
|
86 |
-
save: function (props) {
|
87 |
-
const {iframeSrc} = props.attributes
|
88 |
-
if (iframeSrc) {
|
89 |
-
return (
|
90 |
-
<div className="ose-google-docs-spreadsheets">
|
91 |
-
|
92 |
-
<iframe src={iframeSrc} frameBorder="0" width="600" height="450" allowFullScreen="true"
|
93 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
94 |
-
|
95 |
-
</div>
|
96 |
-
|
97 |
-
);
|
98 |
-
}
|
99 |
-
},
|
100 |
-
}
|
101 |
-
]
|
102 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/edit.js
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const { __ } = wp.i18n;
|
13 |
-
const { Component, Fragment } = wp.element;
|
14 |
-
import { googleSlidesIcon} from '../common/icons'
|
15 |
-
class GoogleSlidesEdit extends Component {
|
16 |
-
constructor() {
|
17 |
-
super( ...arguments );
|
18 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind( this );
|
19 |
-
this.setUrl = this.setUrl.bind( this );
|
20 |
-
this.onLoad = this.onLoad.bind( this );
|
21 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
22 |
-
this.state = {
|
23 |
-
editingURL: false,
|
24 |
-
url: this.props.attributes.url,
|
25 |
-
fetching: true,
|
26 |
-
cannotEmbed: false,
|
27 |
-
interactive: false
|
28 |
-
};
|
29 |
-
}
|
30 |
-
|
31 |
-
static getDerivedStateFromProps(nextProps, state) {
|
32 |
-
if (!nextProps.isSelected && state.interactive) {
|
33 |
-
return {interactive: false};
|
34 |
-
}
|
35 |
-
|
36 |
-
return null;
|
37 |
-
}
|
38 |
-
|
39 |
-
hideOverlay() {
|
40 |
-
this.setState({interactive: true});
|
41 |
-
}
|
42 |
-
|
43 |
-
onLoad() {
|
44 |
-
this.setState({
|
45 |
-
fetching: false
|
46 |
-
})
|
47 |
-
}
|
48 |
-
decodeHTMLEntities (str) {
|
49 |
-
if(str && typeof str === 'string') {
|
50 |
-
// strip script/html tags
|
51 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
52 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
53 |
-
|
54 |
-
}
|
55 |
-
return str;
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
setUrl( event ) {
|
60 |
-
if ( event ) {
|
61 |
-
event.preventDefault();
|
62 |
-
}
|
63 |
-
const { url } = this.state;
|
64 |
-
const { setAttributes } = this.props;
|
65 |
-
setAttributes( { url } );
|
66 |
-
if(url && url.match( /^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){
|
67 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
68 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
69 |
-
var match = regEx.exec(iframeSrc);
|
70 |
-
var type = match[1];
|
71 |
-
if(type && type == 'presentation') {
|
72 |
-
if(iframeSrc.match( /pub\?/i )) {
|
73 |
-
iframeSrc = iframeSrc.replace('/pub?', '/embed?');
|
74 |
-
}
|
75 |
-
this.setState( { editingURL: false, cannotEmbed: false } );
|
76 |
-
setAttributes( {iframeSrc: iframeSrc })
|
77 |
-
}
|
78 |
-
else {
|
79 |
-
this.setState({
|
80 |
-
cannotEmbed: true,
|
81 |
-
editingURL: true
|
82 |
-
})
|
83 |
-
}
|
84 |
-
}
|
85 |
-
else {
|
86 |
-
this.setState({
|
87 |
-
cannotEmbed: true,
|
88 |
-
editingURL: true
|
89 |
-
})
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
switchBackToURLInput() {
|
94 |
-
this.setState( { editingURL: true } );
|
95 |
-
}
|
96 |
-
|
97 |
-
render() {
|
98 |
-
const { url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
99 |
-
const { iframeSrc } = this.props.attributes;
|
100 |
-
|
101 |
-
const label = __( 'Google Slides URL');
|
102 |
-
|
103 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
104 |
-
if ( !iframeSrc || editingURL ) {
|
105 |
-
return (
|
106 |
-
<EmbedPlaceholder
|
107 |
-
label={ label }
|
108 |
-
onSubmit={ this.setUrl }
|
109 |
-
value={ url }
|
110 |
-
cannotEmbed={ cannotEmbed }
|
111 |
-
onChange={ ( event ) => this.setState( { url: event.target.value } ) }
|
112 |
-
icon={googleSlidesIcon}
|
113 |
-
DocTitle={__('Learn more about Google slides embed')}
|
114 |
-
docLink={'https://embedpress.com/docs/embed-google-slides-wordpress/'}
|
115 |
-
/>
|
116 |
-
);
|
117 |
-
}
|
118 |
-
else {
|
119 |
-
|
120 |
-
return (
|
121 |
-
<Fragment>
|
122 |
-
{fetching ? <EmbedLoading /> : null}
|
123 |
-
|
124 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{ display: fetching ? 'none' : '' }} frameborder="0" width="600" height="450" />
|
125 |
-
{ ! interactive && (
|
126 |
-
<div
|
127 |
-
className="block-library-embed__interactive-overlay"
|
128 |
-
onMouseUp={ this.hideOverlay }
|
129 |
-
/>
|
130 |
-
) }
|
131 |
-
|
132 |
-
<EmbedControls
|
133 |
-
showEditButton={ iframeSrc && ! cannotEmbed }
|
134 |
-
switchBackToURLInput={ this.switchBackToURLInput }
|
135 |
-
/>
|
136 |
-
</Fragment>
|
137 |
-
|
138 |
-
)
|
139 |
-
}
|
140 |
-
}
|
141 |
-
};
|
142 |
-
export default GoogleSlidesEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/index.js
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { googleSlidesIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType( 'embedpress/google-slides-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __( 'Google Slides' ), // Block title.
|
32 |
-
icon: googleSlidesIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__( 'embedpress' ),
|
36 |
-
__( 'google' ),
|
37 |
-
__( 'slides' ),
|
38 |
-
],
|
39 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
40 |
-
attributes: {
|
41 |
-
url: {
|
42 |
-
type: 'string',
|
43 |
-
default: ''
|
44 |
-
},
|
45 |
-
iframeSrc: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
}
|
49 |
-
},
|
50 |
-
/**
|
51 |
-
* The edit function describes the structure of your block in the context of the editor.
|
52 |
-
* This represents what the editor will render when the block is used.
|
53 |
-
*
|
54 |
-
* The "edit" property must be a valid function.
|
55 |
-
*
|
56 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
57 |
-
*/
|
58 |
-
edit,
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The save function defines the way in which the different attributes should be combined
|
62 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
63 |
-
*
|
64 |
-
* The "save" property must be specified and must be a valid function.
|
65 |
-
*
|
66 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
67 |
-
*/
|
68 |
-
save: function( props ) {
|
69 |
-
const { iframeSrc } = props.attributes
|
70 |
-
const defaultClass = "ose-google-docs-presentation"
|
71 |
-
return (
|
72 |
-
<figure className={defaultClass}>
|
73 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
74 |
-
</figure>
|
75 |
-
);
|
76 |
-
},
|
77 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/style.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/init.php
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Blocks Initializer
|
4 |
-
*
|
5 |
-
* Enqueue CSS/JS of all the blocks.
|
6 |
-
*
|
7 |
-
* @since 1.0.0
|
8 |
-
* @package CGB
|
9 |
-
*/
|
10 |
-
|
11 |
-
// Exit if accessed directly.
|
12 |
-
if ( !defined( 'ABSPATH' ) ) {
|
13 |
-
exit;
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Enqueue Gutenberg block assets for both frontend + backend.
|
18 |
-
*
|
19 |
-
* @uses {wp-editor} for WP editor styles.
|
20 |
-
* @since 1.0.0
|
21 |
-
*/
|
22 |
-
function embedpress_blocks_cgb_block_assets() { // phpcs:ignore
|
23 |
-
// Styles.
|
24 |
-
wp_enqueue_style(
|
25 |
-
'embedpress_blocks-cgb-style-css', // Handle.
|
26 |
-
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
|
27 |
-
is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
|
28 |
-
filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
|
29 |
-
);
|
30 |
-
}
|
31 |
-
|
32 |
-
// Hook: Frontend assets.
|
33 |
-
add_action( 'enqueue_block_assets', 'embedpress_blocks_cgb_block_assets' );
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Enqueue Gutenberg block assets for backend editor.
|
37 |
-
*
|
38 |
-
* @uses {wp-blocks} for block type registration & related functions.
|
39 |
-
* @uses {wp-element} for WP Element abstraction — structure of blocks.
|
40 |
-
* @uses {wp-i18n} to internationalize the block's text.
|
41 |
-
* @uses {wp-editor} for WP editor styles.
|
42 |
-
* @since 1.0.0
|
43 |
-
*/
|
44 |
-
function embedpress_blocks_cgb_editor_assets() { // phpcs:ignore
|
45 |
-
// Scripts.
|
46 |
-
wp_enqueue_script(
|
47 |
-
'embedpress_blocks-cgb-block-js', // Handle.
|
48 |
-
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
|
49 |
-
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor','wp-components', 'embedpress-pdfobject' ), // Dependencies, defined above.
|
50 |
-
filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: File modification time.
|
51 |
-
true // Enqueue the script in the footer.
|
52 |
-
);
|
53 |
-
$wistia_labels = array(
|
54 |
-
'watch_from_beginning' => __( 'Watch from the beginning', 'embedpress-wistia' ),
|
55 |
-
'skip_to_where_you_left_off' => __( 'Skip to where you left off', 'embedpress-wistia' ),
|
56 |
-
'you_have_watched_it_before' => __( 'It looks like you\'ve watched<br />part of this video before!', 'embedpress-wistia' ),
|
57 |
-
);
|
58 |
-
$wistia_labels = json_encode( $wistia_labels );
|
59 |
-
$wistia_options = null;
|
60 |
-
if ( function_exists( 'embedpress_wisita_pro_get_options' ) ):
|
61 |
-
$wistia_options = embedpress_wisita_pro_get_options();
|
62 |
-
endif;
|
63 |
-
$pars_url = wp_parse_url(get_site_url());
|
64 |
-
wp_localize_script( 'embedpress_blocks-cgb-block-js', 'embedpressObj', array(
|
65 |
-
'wistia_labels' => $wistia_labels,
|
66 |
-
'wisita_options' => $wistia_options,
|
67 |
-
'embedpress_powered_by' => apply_filters('embedpress_document_block_powered_by',true),
|
68 |
-
'embedpress_pro' => defined('EMBEDPRESS_PRO_PLUGIN_FILE'),
|
69 |
-
'twitch_host' => !empty($pars_url['host'])?$pars_url['host']:'',
|
70 |
-
'site_url' => site_url(),
|
71 |
-
) );
|
72 |
-
|
73 |
-
// Styles.
|
74 |
-
wp_enqueue_style(
|
75 |
-
'embedpress_blocks-cgb-block-editor-css', // Handle.
|
76 |
-
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
|
77 |
-
array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
|
78 |
-
filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
|
79 |
-
);
|
80 |
-
}
|
81 |
-
|
82 |
-
// Hook: Editor assets.
|
83 |
-
add_action( 'enqueue_block_editor_assets', 'embedpress_blocks_cgb_editor_assets' );
|
84 |
-
|
85 |
-
|
86 |
-
function embedpress_block_category( $categories, $post ) {
|
87 |
-
return array_merge(
|
88 |
-
$categories,
|
89 |
-
array(
|
90 |
-
array(
|
91 |
-
'slug' => 'embedpress',
|
92 |
-
'title' => 'EmbedPress',
|
93 |
-
'icon' => '',
|
94 |
-
),
|
95 |
-
)
|
96 |
-
);
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
add_filter( 'block_categories', 'embedpress_block_category', 10, 2 );
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Registers the embedpress gutneberg block on server.
|
104 |
-
*/
|
105 |
-
|
106 |
-
function embedpress_gutenberg_register_all_block() {
|
107 |
-
if ( function_exists( 'register_block_type' ) ) :
|
108 |
-
require_once plugin_dir_path( __FILE__ ) . 'embedpress/index.php';
|
109 |
-
register_block_type( 'embedpress/twitch-block' );
|
110 |
-
register_block_type( 'embedpress/google-slides-block' );
|
111 |
-
register_block_type( 'embedpress/google-sheets-block' );
|
112 |
-
register_block_type( 'embedpress/google-maps-block' );
|
113 |
-
register_block_type( 'embedpress/google-forms-block' );
|
114 |
-
register_block_type( 'embedpress/google-drawings-block' );
|
115 |
-
register_block_type( 'embedpress/google-docs-block' );
|
116 |
-
register_block_type( 'embedpress/embedpress', [
|
117 |
-
'render_callback' => 'embedpress_render_block',
|
118 |
-
]);
|
119 |
-
|
120 |
-
endif;
|
121 |
-
}
|
122 |
-
|
123 |
-
add_action( 'init', 'embedpress_gutenberg_register_all_block' );
|
124 |
-
|
125 |
-
|
126 |
-
foreach ( glob( plugin_dir_path( __FILE__ ) . '*/index.php' ) as $block_logic ) {
|
127 |
-
require $block_logic;
|
128 |
-
}
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/edit.js
DELETED
@@ -1,187 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {twitchIcon} from '../common/icons'
|
15 |
-
|
16 |
-
class TwitchEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.onLoad = this.onLoad.bind(this);
|
22 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
23 |
-
this.state = {
|
24 |
-
editingURL: false,
|
25 |
-
url: this.props.attributes.url,
|
26 |
-
fetching: true,
|
27 |
-
cannotEmbed: false,
|
28 |
-
interactive: false
|
29 |
-
};
|
30 |
-
}
|
31 |
-
|
32 |
-
static getDerivedStateFromProps(nextProps, state) {
|
33 |
-
if (!nextProps.isSelected && state.interactive) {
|
34 |
-
return {interactive: false};
|
35 |
-
}
|
36 |
-
|
37 |
-
return null;
|
38 |
-
}
|
39 |
-
|
40 |
-
hideOverlay() {
|
41 |
-
this.setState({interactive: true});
|
42 |
-
}
|
43 |
-
|
44 |
-
onLoad() {
|
45 |
-
this.setState({
|
46 |
-
fetching: false
|
47 |
-
})
|
48 |
-
}
|
49 |
-
|
50 |
-
decodeHTMLEntities(str) {
|
51 |
-
if (str && typeof str === 'string') {
|
52 |
-
// strip script/html tags
|
53 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
54 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
55 |
-
|
56 |
-
}
|
57 |
-
return str;
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
setUrl(event) {
|
62 |
-
if (event) {
|
63 |
-
event.preventDefault();
|
64 |
-
}
|
65 |
-
const {url} = this.state;
|
66 |
-
const {setAttributes} = this.props;
|
67 |
-
setAttributes({url});
|
68 |
-
var regEx = /http[s]?:\/\/(?:www\.|clips\.)twitch\.tv\/([0-9a-zA-Z\-\_]+)\/?(chat\/?$|[0-9a-z\-\_]*)?/
|
69 |
-
if (url && url.match(regEx)) {
|
70 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
71 |
-
var match = regEx.exec(iframeSrc);
|
72 |
-
var channelName = match[1];
|
73 |
-
console.log(channelName);
|
74 |
-
var type = "channel";
|
75 |
-
var attrs;
|
76 |
-
if (url.indexOf('clips.twitch.tv') > -1) {
|
77 |
-
type = 'clip';
|
78 |
-
} else if (url.indexOf('/videos/') > -1) {
|
79 |
-
type = 'video';
|
80 |
-
} else if (url.indexOf('#/chat$#') > -1) {
|
81 |
-
type = 'chat';
|
82 |
-
}
|
83 |
-
console.log(type)
|
84 |
-
switch (type) {
|
85 |
-
case 'channel':
|
86 |
-
iframeSrc = 'https://player.twitch.tv/?channel=' + channelName;
|
87 |
-
attrs = {
|
88 |
-
scrolling: "no",
|
89 |
-
frameborder: "0",
|
90 |
-
allowfullscreen: "true"
|
91 |
-
};
|
92 |
-
break;
|
93 |
-
|
94 |
-
case 'clip':
|
95 |
-
iframeSrc = 'https://clips.twitch.tv/embed?clip=' + channelName + '&autoplay=false';
|
96 |
-
attrs = {
|
97 |
-
scrolling: "no",
|
98 |
-
frameborder: "0",
|
99 |
-
allowfullscreen: "true"
|
100 |
-
};
|
101 |
-
break;
|
102 |
-
|
103 |
-
case 'video':
|
104 |
-
channelName = match[2];
|
105 |
-
iframeSrc = 'https://player.twitch.tv/?video=' + channelName;
|
106 |
-
attrs = {
|
107 |
-
scrolling: "no",
|
108 |
-
frameborder: "0",
|
109 |
-
allowfullscreen: "true"
|
110 |
-
};
|
111 |
-
break;
|
112 |
-
|
113 |
-
case 'chat':
|
114 |
-
iframeSrc = 'http://www.twitch.tv/embed/' + channelName + '/chat';
|
115 |
-
attrs = {
|
116 |
-
scrolling: "yes",
|
117 |
-
frameborder: "0",
|
118 |
-
allowfullscreen: "true",
|
119 |
-
id: "'" + channelName + "'"
|
120 |
-
|
121 |
-
}
|
122 |
-
break;
|
123 |
-
}
|
124 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
125 |
-
setAttributes({iframeSrc, attrs})
|
126 |
-
} else {
|
127 |
-
this.setState({
|
128 |
-
cannotEmbed: true,
|
129 |
-
editingURL: true
|
130 |
-
})
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
switchBackToURLInput() {
|
135 |
-
this.setState({editingURL: true});
|
136 |
-
}
|
137 |
-
|
138 |
-
render() {
|
139 |
-
const {url, editingURL, fetching, cannotEmbed,interactive} = this.state;
|
140 |
-
const {iframeSrc, attrs} = this.props.attributes;
|
141 |
-
|
142 |
-
const label = __('Twitch URL');
|
143 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
144 |
-
if (!iframeSrc || editingURL) {
|
145 |
-
return (
|
146 |
-
<EmbedPlaceholder
|
147 |
-
label={label}
|
148 |
-
onSubmit={this.setUrl}
|
149 |
-
value={url}
|
150 |
-
cannotEmbed={cannotEmbed}
|
151 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
152 |
-
icon={twitchIcon}
|
153 |
-
DocTitle={__('Learn more about twitch embed')}
|
154 |
-
docLink={'https://embedpress.com/docs/embed-twitch-streams-chat/'}
|
155 |
-
/>
|
156 |
-
);
|
157 |
-
} else {
|
158 |
-
const IframeUrl = iframeSrc+'&parent='+embedpressObj.twitch_host;
|
159 |
-
return (
|
160 |
-
<Fragment>
|
161 |
-
{fetching ? <EmbedLoading/> : null}
|
162 |
-
|
163 |
-
<Iframe src={IframeUrl} {...attrs}
|
164 |
-
onLoad={this.onLoad}
|
165 |
-
style={{display: fetching ? 'none' : ''}}
|
166 |
-
onFocus={this.hideOverlay}
|
167 |
-
width="600"
|
168 |
-
height="450"/>
|
169 |
-
|
170 |
-
{ ! interactive && (
|
171 |
-
<div
|
172 |
-
className="block-library-embed__interactive-overlay"
|
173 |
-
onMouseUp={ this.hideOverlay }
|
174 |
-
/>
|
175 |
-
) }
|
176 |
-
|
177 |
-
<EmbedControls
|
178 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
179 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
180 |
-
/>
|
181 |
-
</Fragment>
|
182 |
-
|
183 |
-
)
|
184 |
-
}
|
185 |
-
}
|
186 |
-
};
|
187 |
-
export default TwitchEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/index.js
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {twitchIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/twitch-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Twitch'), // Block title.
|
33 |
-
icon: twitchIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('twitch'),
|
38 |
-
],
|
39 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
40 |
-
attributes: {
|
41 |
-
url: {
|
42 |
-
type: 'string',
|
43 |
-
default: ''
|
44 |
-
},
|
45 |
-
iframeSrc: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
},
|
49 |
-
attrs: {
|
50 |
-
type: 'string',
|
51 |
-
default: ''
|
52 |
-
}
|
53 |
-
},
|
54 |
-
/**
|
55 |
-
* The edit function describes the structure of your block in the context of the editor.
|
56 |
-
* This represents what the editor will render when the block is used.
|
57 |
-
*
|
58 |
-
* The "edit" property must be a valid function.
|
59 |
-
*
|
60 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
61 |
-
*/
|
62 |
-
edit,
|
63 |
-
|
64 |
-
/**
|
65 |
-
* The save function defines the way in which the different attributes should be combined
|
66 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
67 |
-
*
|
68 |
-
* The "save" property must be specified and must be a valid function.
|
69 |
-
*
|
70 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
71 |
-
*/
|
72 |
-
save: function (props) {
|
73 |
-
const {iframeSrc, attrs} = props.attributes
|
74 |
-
const defaultClass = "ose-twitch-presentation"
|
75 |
-
const IframeUrl = iframeSrc+'&parent='+embedpressObj.twitch_host;
|
76 |
-
return (
|
77 |
-
<figure className={ defaultClass }>
|
78 |
-
<iframe src={IframeUrl} {...attrs} frameborder="0" width="600" height="450"></iframe>
|
79 |
-
</figure>
|
80 |
-
);
|
81 |
-
},
|
82 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/edit.js
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {wistiaIcon} from '../common/icons'
|
15 |
-
class WistiaEdit extends Component {
|
16 |
-
constructor() {
|
17 |
-
super(...arguments);
|
18 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
19 |
-
this.setUrl = this.setUrl.bind(this);
|
20 |
-
this.onLoad = this.onLoad.bind(this);
|
21 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
22 |
-
this.state = {
|
23 |
-
editingURL: false,
|
24 |
-
url: this.props.attributes.url,
|
25 |
-
fetching: true,
|
26 |
-
cannotEmbed: false,
|
27 |
-
interactive: false,
|
28 |
-
mediaId: null
|
29 |
-
};
|
30 |
-
this.setUrl();
|
31 |
-
}
|
32 |
-
|
33 |
-
static getDerivedStateFromProps(nextProps, state) {
|
34 |
-
if (!nextProps.isSelected && state.interactive) {
|
35 |
-
return {interactive: false};
|
36 |
-
}
|
37 |
-
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
|
41 |
-
hideOverlay() {
|
42 |
-
this.setState({interactive: true});
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
componentDidMount() {
|
47 |
-
if (this.props.attributes.url) {
|
48 |
-
let mediaIdMatches = this.props.attributes.url.match(/medias\/(.*)/);
|
49 |
-
let mediaId = mediaIdMatches[1];
|
50 |
-
this.setState({
|
51 |
-
...this.state,
|
52 |
-
mediaId
|
53 |
-
});
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
onLoad() {
|
58 |
-
this.setState({
|
59 |
-
fetching: false
|
60 |
-
});
|
61 |
-
if (embedpressObj['wisita_options']) {
|
62 |
-
let $state = {...this.state}
|
63 |
-
setTimeout(function () {
|
64 |
-
let script = document.createElement("script");
|
65 |
-
script.src = "https://fast.wistia.com/assets/external/E-v1.js";
|
66 |
-
script.charset = "ISO-8859-1"
|
67 |
-
document.body.appendChild(script);
|
68 |
-
}, 100);
|
69 |
-
|
70 |
-
setTimeout(function () {
|
71 |
-
let script = document.createElement("script");
|
72 |
-
script.type = 'text/javascript';
|
73 |
-
script.innerHTML = 'window.pp_embed_wistia_labels = ' + embedpressObj['wistia_labels'];
|
74 |
-
document.body.appendChild(script);
|
75 |
-
|
76 |
-
script = document.createElement("script");
|
77 |
-
script.type = 'text/javascript';
|
78 |
-
script.innerHTML = 'wistiaEmbed = Wistia.embed( \"' + $state.mediaId + '\", ' + embedpressObj.wisita_options + ' );';
|
79 |
-
document.body.appendChild(script);
|
80 |
-
}, 400);
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
decodeHTMLEntities(str) {
|
86 |
-
if (str && typeof str === 'string') {
|
87 |
-
// strip script/html tags
|
88 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
89 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
90 |
-
|
91 |
-
}
|
92 |
-
return str;
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
setUrl(event) {
|
97 |
-
if (event) {
|
98 |
-
event.preventDefault();
|
99 |
-
}
|
100 |
-
const {url} = this.state;
|
101 |
-
const {setAttributes} = this.props;
|
102 |
-
setAttributes({url});
|
103 |
-
if (url && (url.match(/^http[s]?:\/\/(?:www\.)?wistia\.com\/medias/i) || url.match(/^http[s]?:\/\/(?:www\.)?fast\/.wistia\.com\/embed\/medias/i.jsonp))) {
|
104 |
-
let mediaIdMatches = url.match(/medias\/(.*)/);
|
105 |
-
let mediaId = mediaIdMatches[1];
|
106 |
-
let iframeSrc = '//fast.wistia.net/embed/iframe/' + mediaId;
|
107 |
-
|
108 |
-
this.setState({editingURL: false, cannotEmbed: false, mediaId});
|
109 |
-
setAttributes({iframeSrc});
|
110 |
-
} else {
|
111 |
-
this.setState({
|
112 |
-
cannotEmbed: true,
|
113 |
-
editingURL: true
|
114 |
-
})
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
switchBackToURLInput() {
|
119 |
-
this.setState({editingURL: true});
|
120 |
-
}
|
121 |
-
|
122 |
-
render() {
|
123 |
-
const {url, editingURL, fetching, cannotEmbed,interactive} = this.state;
|
124 |
-
const {iframeSrc} = this.props.attributes;
|
125 |
-
|
126 |
-
const label = __('Wistia URL');
|
127 |
-
|
128 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
129 |
-
if (!iframeSrc || editingURL) {
|
130 |
-
return (
|
131 |
-
<EmbedPlaceholder
|
132 |
-
label={label}
|
133 |
-
onSubmit={this.setUrl}
|
134 |
-
value={url}
|
135 |
-
cannotEmbed={cannotEmbed}
|
136 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
137 |
-
icon={wistiaIcon}
|
138 |
-
DocTitle={__('Learn more about Wistia embed')}
|
139 |
-
docLink={'https://embedpress.com/docs/embed-wistia-videos-wordpress/'}
|
140 |
-
/>
|
141 |
-
);
|
142 |
-
} else {
|
143 |
-
return (
|
144 |
-
<Fragment>
|
145 |
-
{fetching ? <EmbedLoading/> : null}
|
146 |
-
|
147 |
-
<div className="ose-wistia" id={"wistia_" + this.state.mediaId}>
|
148 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
149 |
-
frameborder="0" width="600" height="330"/>
|
150 |
-
</div>
|
151 |
-
|
152 |
-
{ ! interactive && (
|
153 |
-
<div
|
154 |
-
className="block-library-embed__interactive-overlay"
|
155 |
-
onMouseUp={ this.hideOverlay }
|
156 |
-
/>
|
157 |
-
) }
|
158 |
-
|
159 |
-
<EmbedControls
|
160 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
161 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
162 |
-
/>
|
163 |
-
</Fragment>
|
164 |
-
);
|
165 |
-
}
|
166 |
-
}
|
167 |
-
};
|
168 |
-
export default WistiaEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/editor.scss
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/index.js
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { wistiaIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType('embedpress/wistia-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __('Wistia'), // Block title.
|
32 |
-
icon: wistiaIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__('embedpress'),
|
36 |
-
__('wistia'),
|
37 |
-
],
|
38 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
39 |
-
edit,
|
40 |
-
save: function(props) {
|
41 |
-
return null;
|
42 |
-
},
|
43 |
-
deprecated: [{
|
44 |
-
attributes: {
|
45 |
-
url: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
},
|
49 |
-
iframeSrc: {
|
50 |
-
type: 'string',
|
51 |
-
default: ''
|
52 |
-
}
|
53 |
-
},
|
54 |
-
edit,
|
55 |
-
/**
|
56 |
-
* The save function defines the way in which the different attributes should be combined
|
57 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
58 |
-
*
|
59 |
-
* The "save" property must be specified and must be a valid function.
|
60 |
-
*
|
61 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
62 |
-
*/
|
63 |
-
save: function (props) {
|
64 |
-
const { iframeSrc } = props.attributes
|
65 |
-
return (
|
66 |
-
<div class="ose-wistia">
|
67 |
-
<iframe src={iframeSrc}
|
68 |
-
allowtransparency="true"
|
69 |
-
frameborder="0"
|
70 |
-
class="wistia_embed"
|
71 |
-
name="wistia_embed"
|
72 |
-
width="600" height="330"></iframe>
|
73 |
-
</div>
|
74 |
-
);
|
75 |
-
},
|
76 |
-
}]
|
77 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/style.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/edit.js
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from "../common/embed-controls";
|
5 |
-
import EmbedLoading from "../common/embed-loading";
|
6 |
-
import EmbedPlaceholder from "../common/embed-placeholder";
|
7 |
-
import Iframe from "../common/Iframe";
|
8 |
-
import {youtubeIcon} from "../common/icons";
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* WordPress dependencies
|
13 |
-
*/
|
14 |
-
const {__} = wp.i18n;
|
15 |
-
const {Component, Fragment} = wp.element;
|
16 |
-
|
17 |
-
class YoutubeEdit extends Component {
|
18 |
-
constructor() {
|
19 |
-
super(...arguments);
|
20 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
21 |
-
this.setUrl = this.setUrl.bind(this);
|
22 |
-
this.onLoad = this.onLoad.bind(this);
|
23 |
-
this.hideOverlay = this.hideOverlay.bind( this );
|
24 |
-
this.state = {
|
25 |
-
editingURL: false,
|
26 |
-
url: this.props.attributes.url,
|
27 |
-
fetching: true,
|
28 |
-
cannotEmbed: false,
|
29 |
-
interactive: false
|
30 |
-
};
|
31 |
-
}
|
32 |
-
|
33 |
-
static getDerivedStateFromProps( nextProps, state ) {
|
34 |
-
if ( ! nextProps.isSelected && state.interactive ) {
|
35 |
-
return { interactive: false };
|
36 |
-
}
|
37 |
-
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
|
41 |
-
hideOverlay() {
|
42 |
-
this.setState( { interactive: true } );
|
43 |
-
}
|
44 |
-
|
45 |
-
componentWillMount() {
|
46 |
-
if (this.state.url) {
|
47 |
-
this.setUrl();
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
onLoad() {
|
52 |
-
this.setState({
|
53 |
-
fetching: false
|
54 |
-
});
|
55 |
-
}
|
56 |
-
|
57 |
-
decodeHTMLEntities(str) {
|
58 |
-
if (str && typeof str === "string") {
|
59 |
-
// strip script/html tags
|
60 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim, "");
|
61 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, "");
|
62 |
-
}
|
63 |
-
return str;
|
64 |
-
}
|
65 |
-
|
66 |
-
setUrl(event) {
|
67 |
-
if (event) {
|
68 |
-
event.preventDefault();
|
69 |
-
}
|
70 |
-
const {url} = this.state;
|
71 |
-
const {setAttributes} = this.props;
|
72 |
-
setAttributes({url});
|
73 |
-
const matches = url.match(
|
74 |
-
/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/
|
75 |
-
);
|
76 |
-
if (url && matches) {
|
77 |
-
let mediaId = matches[1];
|
78 |
-
let iframeSrc = "https://www.youtube.com/embed/" + mediaId;
|
79 |
-
let iframeUrl = new URL(iframeSrc);
|
80 |
-
|
81 |
-
// // If your expected result is "http://foo.bar/?x=42&y=2"
|
82 |
-
if (typeof embedpressProObj !== 'undefined') {
|
83 |
-
for (var key in embedpressProObj.youtubeParams) {
|
84 |
-
iframeUrl.searchParams.set(
|
85 |
-
key,
|
86 |
-
embedpressProObj.youtubeParams[key]
|
87 |
-
);
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
92 |
-
setAttributes({iframeSrc: iframeUrl.href, mediaId});
|
93 |
-
} else {
|
94 |
-
this.setState({
|
95 |
-
cannotEmbed: true,
|
96 |
-
editingURL: true
|
97 |
-
});
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
switchBackToURLInput() {
|
102 |
-
this.setState({editingURL: true});
|
103 |
-
}
|
104 |
-
|
105 |
-
render() {
|
106 |
-
const {url, editingURL, fetching, cannotEmbed,interactive} = this.state;
|
107 |
-
const {iframeSrc, attrs} = this.props.attributes;
|
108 |
-
const label = __("Youtube URL");
|
109 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
110 |
-
if (!iframeSrc || editingURL) {
|
111 |
-
return (
|
112 |
-
<EmbedPlaceholder
|
113 |
-
label={label}
|
114 |
-
onSubmit={this.setUrl}
|
115 |
-
value={url}
|
116 |
-
cannotEmbed={cannotEmbed}
|
117 |
-
onChange={event => this.setState({url: event.target.value})}
|
118 |
-
icon={youtubeIcon}
|
119 |
-
DocTitle={__('Learn More About Youtube Embed')}
|
120 |
-
docLink={'https://embedpress.com/docs/embed-youtube-wordpress/'}
|
121 |
-
|
122 |
-
/>
|
123 |
-
);
|
124 |
-
} else {
|
125 |
-
return (
|
126 |
-
<Fragment>
|
127 |
-
{fetching ? <EmbedLoading/> : null}
|
128 |
-
|
129 |
-
<Iframe
|
130 |
-
src={iframeSrc}
|
131 |
-
{...attrs}
|
132 |
-
onLoad={this.onLoad}
|
133 |
-
style={{display: fetching ? "none" : ""}}
|
134 |
-
width="640"
|
135 |
-
onFocus={ this.hideOverlay }
|
136 |
-
height="450"
|
137 |
-
/>
|
138 |
-
{ ! interactive && (
|
139 |
-
<div
|
140 |
-
className="block-library-embed__interactive-overlay"
|
141 |
-
onMouseUp={ this.hideOverlay }
|
142 |
-
/>
|
143 |
-
) }
|
144 |
-
|
145 |
-
<EmbedControls
|
146 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
147 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
148 |
-
/>
|
149 |
-
</Fragment>
|
150 |
-
);
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
export default YoutubeEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/editor.scss
DELETED
File without changes
|
Gutenberg/src/youtube/index.js
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { youtubeIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType( 'embedpress/youtube-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __( 'Youtube' ), // Block title.
|
32 |
-
icon: youtubeIcon,
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__( 'embedpress' ),
|
36 |
-
__( 'youtube' ),
|
37 |
-
],
|
38 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
39 |
-
/**
|
40 |
-
* The edit function describes the structure of your block in the context of the editor.
|
41 |
-
* This represents what the editor will render when the block is used.
|
42 |
-
*
|
43 |
-
* The "edit" property must be a valid function.
|
44 |
-
*
|
45 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
46 |
-
*/
|
47 |
-
edit,
|
48 |
-
|
49 |
-
/**
|
50 |
-
* The save function defines the way in which the different attributes should be combined
|
51 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
52 |
-
*
|
53 |
-
* The "save" property must be specified and must be a valid function.
|
54 |
-
*
|
55 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
56 |
-
*/
|
57 |
-
save: () => {
|
58 |
-
return null
|
59 |
-
}
|
60 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/style.scss
DELETED
File without changes
|
assets/css/el-icon.css
CHANGED
@@ -27,9 +27,8 @@
|
|
27 |
|
28 |
.icon-embedpress:before {
|
29 |
content: "\e900";
|
30 |
-
color: #556068;
|
31 |
}
|
|
|
32 |
.icon-pdf:before {
|
33 |
content: "\e926";
|
34 |
-
color: #556068;
|
35 |
}
|
27 |
|
28 |
.icon-embedpress:before {
|
29 |
content: "\e900";
|
|
|
30 |
}
|
31 |
+
|
32 |
.icon-pdf:before {
|
33 |
content: "\e926";
|
|
|
34 |
}
|
assets/js/preview.js
CHANGED
@@ -238,7 +238,7 @@
|
|
238 |
|
239 |
self.loadAsyncDynamicJsCodeFromElement = function (subject, wrapper, editorInstance) {
|
240 |
subject = $(subject);
|
241 |
-
if (subject.prop('tagName').toLowerCase() === 'script') {
|
242 |
var scriptSrc = subject.attr('src') || null;
|
243 |
if (!scriptSrc) {
|
244 |
self.addScriptDeclaration(wrapper, subject.html(), editorInstance);
|
@@ -695,7 +695,7 @@
|
|
695 |
if (elementsList.length > 0) {
|
696 |
$.each(elementsList, function appendElementIntoWrapper (elementIndex, element) {
|
697 |
// Check if the element is a script and do not add it now (if added here it wouldn't be executed)
|
698 |
-
if (element.tagName.toLowerCase() !== 'script') {
|
699 |
wrapper.append($(element));
|
700 |
|
701 |
if (element.tagName.toLowerCase() === 'iframe') {
|
238 |
|
239 |
self.loadAsyncDynamicJsCodeFromElement = function (subject, wrapper, editorInstance) {
|
240 |
subject = $(subject);
|
241 |
+
if (subject.prop('tagName') && subject.prop('tagName').toLowerCase() === 'script') {
|
242 |
var scriptSrc = subject.attr('src') || null;
|
243 |
if (!scriptSrc) {
|
244 |
self.addScriptDeclaration(wrapper, subject.html(), editorInstance);
|
695 |
if (elementsList.length > 0) {
|
696 |
$.each(elementsList, function appendElementIntoWrapper (elementIndex, element) {
|
697 |
// Check if the element is a script and do not add it now (if added here it wouldn't be executed)
|
698 |
+
if (element.tagName && element.tagName.toLowerCase() !== 'script') {
|
699 |
wrapper.append($(element));
|
700 |
|
701 |
if (element.tagName.toLowerCase() === 'iframe') {
|
embedpress.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and uplaoad PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. 100+ sources supported.
|
6 |
* Author: WPDeveloper
|
7 |
* Author URI: https://wpdeveloper.net
|
8 |
-
* Version: 2.7.
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
@@ -27,6 +27,13 @@ defined('ABSPATH') or die("No direct script access allowed.");
|
|
27 |
define('EMBEDPRESS_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
28 |
define('EMBEDPRESS_FILE', __FILE__);
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
require_once plugin_dir_path(__FILE__) . 'includes.php';
|
31 |
|
32 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and uplaoad PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. 100+ sources supported.
|
6 |
* Author: WPDeveloper
|
7 |
* Author URI: https://wpdeveloper.net
|
8 |
+
* Version: 2.7.5
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
27 |
define('EMBEDPRESS_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
28 |
define('EMBEDPRESS_FILE', __FILE__);
|
29 |
|
30 |
+
define('EMBEDPRESS_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
|
31 |
+
define('EMBEDPRESS_PLUGIN_DIR_URL', plugin_dir_url(__FILE__));
|
32 |
+
define('EMBEDPRESS_GUTENBERG_DIR_URL', plugin_dir_url(__FILE__).'Gutenberg/');
|
33 |
+
define('EMBEDPRESS_GUTENBERG_DIR_PATH', plugin_dir_path(__FILE__).'Gutenberg/');
|
34 |
+
|
35 |
+
define('EMBEDPRESS_PLUGIN_URL', plugins_url('/', __FILE__));
|
36 |
+
|
37 |
require_once plugin_dir_path(__FILE__) . 'includes.php';
|
38 |
|
39 |
include_once ABSPATH . 'wp-admin/includes/plugin.php';
|
includes.php
CHANGED
@@ -22,7 +22,7 @@ if ( ! defined('EMBEDPRESS_PLG_NAME')) {
|
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
-
define('EMBEDPRESS_VERSION', "2.7.
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined('EMBEDPRESS_VERSION')) {
|
|
30 |
}
|
31 |
|
32 |
if ( ! defined('EMBEDPRESS_PRO_VERSION')) {
|
33 |
-
define('EMBEDPRESS_PRO_VERSION', "2.4.
|
34 |
}
|
35 |
|
36 |
if ( ! defined('EMBEDPRESS_ROOT')) {
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
+
define('EMBEDPRESS_VERSION', "2.7.5");
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
30 |
}
|
31 |
|
32 |
if ( ! defined('EMBEDPRESS_PRO_VERSION')) {
|
33 |
+
define('EMBEDPRESS_PRO_VERSION', "2.4.6");
|
34 |
}
|
35 |
|
36 |
if ( ! defined('EMBEDPRESS_ROOT')) {
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: embed, embed youtube, gutenberg embed, pdf, doc, docs, ppt, elementor embe
|
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 5.7
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.7.
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
@@ -14,15 +14,17 @@ EmbedPress lets you embed videos, images, posts, audio, maps and upload PDF, DOC
|
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
-
|
|
|
|
|
18 |
|
19 |
https://www.youtube.com/watch?v=fvYKLkEnJbI
|
20 |
|
21 |
-
🔥RICH MEDIA EMBEDS FROM MORE THAN 100 SITES
|
22 |
|
23 |
With EmbedPress, all you need is the URL. Find the URL for your video, image, audio file or map and simply cut-and-paste the URL into a WordPress post. EmbedPress automatically understands the URL and embeds your content. You can embed media from over 100 sites.
|
24 |
|
25 |
-
🌟Most Popular Sites People Are Embedding with EmbedPress:
|
26 |
|
27 |
- Google: You can embed Google Maps, Docs, Forms, Sheets and more.
|
28 |
|
@@ -35,13 +37,13 @@ With EmbedPress, all you need is the URL. Find the URL for your video, image, au
|
|
35 |
- Images: You can embed Imgur, Giphy and Deviantart images, plus others.
|
36 |
|
37 |
|
38 |
-
📄 Upload PDF, DOC, PPT or almost any filetypes, right from WordPress
|
39 |
|
40 |
- Supported Filetypes: PDF, PPT (Powerpoint Presentration), DOCS, XLS (Excel Files)
|
41 |
- Supported Editors: Block Editor (Gutenberg) & Elementor
|
42 |
|
43 |
|
44 |
-
|
45 |
|
46 |
The add-ons for EmbedPress give you far more control over your videos. With these add-ons, your videos will be responsive. You can also customize the video display to match your site’s design. Other features include auto-play and looping. Click the links below to get a full listing of all the features the add-ons provide:
|
47 |
|
@@ -52,7 +54,7 @@ The add-ons for EmbedPress give you far more control over your videos. With thes
|
|
52 |
- [Click here to get more Wistia features](https://embedpress.com/addons/embedpress-wistia/)
|
53 |
|
54 |
|
55 |
-
|
56 |
|
57 |
Google Drive is an enormously popular service that has replaced Microsoft Office for many companies. Using Google Drives can bring your information to life, whether it’s stored in documents, maps, drawings, spreadsheets, or presentations. EmbedPress supports all of these Google Drive options:
|
58 |
|
@@ -71,14 +73,14 @@ Google Drive is an enormously popular service that has replaced Microsoft Office
|
|
71 |
https://www.youtube.com/watch?v=3CWysKDRoG4
|
72 |
|
73 |
|
74 |
-
|
75 |
|
76 |
With EmbedPress, you can add Facebook Posts to WordPress, using just a URL. Facebook post embeds are possible, but they’re not easy to use via normal methods. EmbedPress is different:
|
77 |
|
78 |
- [How to use Facebook embeds in WordPress](https://embedpress.com/docs/embed-facebook-posts-wordpress/)
|
79 |
|
80 |
|
81 |
-
|
82 |
|
83 |
EmbedPress supports all of these major options for audio on your WordPress site:
|
84 |
|
@@ -102,7 +104,7 @@ Here are multiple other audio options supported by EmbedPress:
|
|
102 |
- [How to use ReverbNation in WordPress](https://embedpress.com/docs/embed-reverbnation-audio-wordpress/)
|
103 |
|
104 |
|
105 |
-
|
106 |
|
107 |
EmbedPress supports most popular image-hosting sites, including Deviantart, Giphy, Imgur, Flick and Instagram:
|
108 |
|
@@ -119,7 +121,7 @@ EmbedPress supports most popular image-hosting sites, including Deviantart, Giph
|
|
119 |
https://www.youtube.com/watch?v=h8oPwlZ9P5A
|
120 |
|
121 |
|
122 |
-
|
123 |
|
124 |
With EmbedPress, you have a wide variety of options for adding charts and diagrams to your WordPress site. We already saw that EmbedPress supports Google Drawings, but here are 5 more options for charts:
|
125 |
|
@@ -134,7 +136,7 @@ With EmbedPress, you have a wide variety of options for adding charts and diagra
|
|
134 |
- [Infogram embeds](https://embedpress.com/docs/embed-infogram-charts-wordpress/)
|
135 |
|
136 |
|
137 |
-
|
138 |
|
139 |
We’ve seen that EmbedPress supports YouTube, Wistia and Vimeo, but EmbedPress also supports around 20 more video sources:
|
140 |
|
@@ -177,7 +179,7 @@ We’ve seen that EmbedPress supports YouTube, Wistia and Vimeo, but EmbedPress
|
|
177 |
- [VideoPress embeds](https://embedpress.com/docs/embed-videopress-videos-wordpress/)
|
178 |
|
179 |
|
180 |
-
|
181 |
|
182 |
- [23hq embeds](https://embedpress.com/docs/embed-23hq-photos-wordpress/) (Images)
|
183 |
|
@@ -218,7 +220,7 @@ We’ve seen that EmbedPress supports YouTube, Wistia and Vimeo, but EmbedPress
|
|
218 |
|
219 |
🙌After reading this feature list, you can probably imagine EmbedPress is the best plugin in the market. So, do you want to unlock the advanced features? [Upgrade to our Pro version.](https://embedpress.com/#pricing)
|
220 |
|
221 |
-
|
222 |
|
223 |
This embed plugin is brought to you by the team behind [WPDeveloper](https://wpdeveloper.net/), a dedicated marketplace for WordPress, trusted by 3,000,000+ happy users.
|
224 |
|
@@ -239,10 +241,10 @@ This embed plugin is brought to you by the team behind [WPDeveloper](https://wpd
|
|
239 |
|
240 |
|
241 |
|
242 |
-
🔥 WHAT’S NEXT
|
243 |
If you like EmbedPress, then consider checking out our other WordPress Plugins:
|
244 |
|
245 |
-
🔝[Essential Addons For Elementor](https://essential-addons.com/elementor/) – Most popular Elementor extensions with
|
246 |
|
247 |
🔔[NotificationX](https://notificationx.com/) – Best Social Proof & FOMO Marketing Solution to increase conversion rates.
|
248 |
|
@@ -299,6 +301,12 @@ Not at all. You can set up everything your team needs without any coding knowled
|
|
299 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
300 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
= [2.7.4] - 2021-03-23 =
|
303 |
* Hotfix: Fatal Error
|
304 |
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 5.7
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.7.5
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
14 |
|
15 |
== Description ==
|
16 |
|
17 |
+
= EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT etc. Elementor, Block Editor & Classic Editor Supported =
|
18 |
+
|
19 |
+
[EmbedPress](https://embedpress.com/) lets you embed videos, images, posts, audio, maps and upload PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. Classic Editor, Gutenberg (Block Editor) & Elementor all supported.
|
20 |
|
21 |
https://www.youtube.com/watch?v=fvYKLkEnJbI
|
22 |
|
23 |
+
### 🔥RICH MEDIA EMBEDS FROM MORE THAN 100 SITES
|
24 |
|
25 |
With EmbedPress, all you need is the URL. Find the URL for your video, image, audio file or map and simply cut-and-paste the URL into a WordPress post. EmbedPress automatically understands the URL and embeds your content. You can embed media from over 100 sites.
|
26 |
|
27 |
+
### 🌟Most Popular Sites People Are Embedding with EmbedPress:
|
28 |
|
29 |
- Google: You can embed Google Maps, Docs, Forms, Sheets and more.
|
30 |
|
37 |
- Images: You can embed Imgur, Giphy and Deviantart images, plus others.
|
38 |
|
39 |
|
40 |
+
### 📄 Upload PDF, DOC, PPT or almost any filetypes, right from WordPress
|
41 |
|
42 |
- Supported Filetypes: PDF, PPT (Powerpoint Presentration), DOCS, XLS (Excel Files)
|
43 |
- Supported Editors: Block Editor (Gutenberg) & Elementor
|
44 |
|
45 |
|
46 |
+
### 🎥YOUTUBE, VIMEO AND WISTIA VIDEOS
|
47 |
|
48 |
The add-ons for EmbedPress give you far more control over your videos. With these add-ons, your videos will be responsive. You can also customize the video display to match your site’s design. Other features include auto-play and looping. Click the links below to get a full listing of all the features the add-ons provide:
|
49 |
|
54 |
- [Click here to get more Wistia features](https://embedpress.com/addons/embedpress-wistia/)
|
55 |
|
56 |
|
57 |
+
### ☁️GOOGLE DRIVE: DOCS, SHEETS, DRAWINGS, FORMS, SLIDES, MAPS
|
58 |
|
59 |
Google Drive is an enormously popular service that has replaced Microsoft Office for many companies. Using Google Drives can bring your information to life, whether it’s stored in documents, maps, drawings, spreadsheets, or presentations. EmbedPress supports all of these Google Drive options:
|
60 |
|
73 |
https://www.youtube.com/watch?v=3CWysKDRoG4
|
74 |
|
75 |
|
76 |
+
### 👍FACEBOOK POSTS AND VIDEOS
|
77 |
|
78 |
With EmbedPress, you can add Facebook Posts to WordPress, using just a URL. Facebook post embeds are possible, but they’re not easy to use via normal methods. EmbedPress is different:
|
79 |
|
80 |
- [How to use Facebook embeds in WordPress](https://embedpress.com/docs/embed-facebook-posts-wordpress/)
|
81 |
|
82 |
|
83 |
+
### 🎧AUDIO: SPOTIFY, SOUNDCLOUD AND MIXCLOUD
|
84 |
|
85 |
EmbedPress supports all of these major options for audio on your WordPress site:
|
86 |
|
104 |
- [How to use ReverbNation in WordPress](https://embedpress.com/docs/embed-reverbnation-audio-wordpress/)
|
105 |
|
106 |
|
107 |
+
### 🖼️PHOTOS: DEVIANTART, GIPHY, FLICK, IMGUR AND INSTAGRAM
|
108 |
|
109 |
EmbedPress supports most popular image-hosting sites, including Deviantart, Giphy, Imgur, Flick and Instagram:
|
110 |
|
121 |
https://www.youtube.com/watch?v=h8oPwlZ9P5A
|
122 |
|
123 |
|
124 |
+
### 📊CHARTS AND DIAGRAMS
|
125 |
|
126 |
With EmbedPress, you have a wide variety of options for adding charts and diagrams to your WordPress site. We already saw that EmbedPress supports Google Drawings, but here are 5 more options for charts:
|
127 |
|
136 |
- [Infogram embeds](https://embedpress.com/docs/embed-infogram-charts-wordpress/)
|
137 |
|
138 |
|
139 |
+
### 🎬OTHER VIDEO OPTIONS
|
140 |
|
141 |
We’ve seen that EmbedPress supports YouTube, Wistia and Vimeo, but EmbedPress also supports around 20 more video sources:
|
142 |
|
179 |
- [VideoPress embeds](https://embedpress.com/docs/embed-videopress-videos-wordpress/)
|
180 |
|
181 |
|
182 |
+
### ✅MORE SITES SUPPORTED BY EMBEDPRESS
|
183 |
|
184 |
- [23hq embeds](https://embedpress.com/docs/embed-23hq-photos-wordpress/) (Images)
|
185 |
|
220 |
|
221 |
🙌After reading this feature list, you can probably imagine EmbedPress is the best plugin in the market. So, do you want to unlock the advanced features? [Upgrade to our Pro version.](https://embedpress.com/#pricing)
|
222 |
|
223 |
+
### 🚀BACKED BY A TRUSTED TEAM
|
224 |
|
225 |
This embed plugin is brought to you by the team behind [WPDeveloper](https://wpdeveloper.net/), a dedicated marketplace for WordPress, trusted by 3,000,000+ happy users.
|
226 |
|
241 |
|
242 |
|
243 |
|
244 |
+
### 🔥 WHAT’S NEXT
|
245 |
If you like EmbedPress, then consider checking out our other WordPress Plugins:
|
246 |
|
247 |
+
🔝[Essential Addons For Elementor](https://essential-addons.com/elementor/) – Most popular Elementor extensions with 1,000,000+ active users in the WordPress repository.
|
248 |
|
249 |
🔔[NotificationX](https://notificationx.com/) – Best Social Proof & FOMO Marketing Solution to increase conversion rates.
|
250 |
|
301 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
302 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
303 |
|
304 |
+
= [2.7.5] - 2021-04-06 =
|
305 |
+
* Added: URL field type to settings library.
|
306 |
+
* Added: Number field type to settings library.
|
307 |
+
* Fixed: PHP dependency from src folder to be removed from plugin build.
|
308 |
+
* Few minor bug fix and improvements.
|
309 |
+
|
310 |
= [2.7.4] - 2021-03-23 =
|
311 |
* Hotfix: Fatal Error
|
312 |
|