PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.1.9
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.1.9
4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / Gutenberg / plugin.php
embedpress / Gutenberg Last commit date
block-backend 1 year ago css 1 year ago dist 1 year ago plugin.php 1 year ago
plugin.php
1428 lines
1 <?php
2
3 /**
4 * Blocks Initializer
5 *
6 * Enqueue CSS/JS of all the blocks.
7 *
8 * @since 1.0.0
9 * @package CGB
10 */
11
12 // Exit if accessed directly.
13 use EmbedPress\Includes\Classes\Helper;
14
15 if (!defined('ABSPATH')) {
16 exit;
17 }
18
19
20 /**
21 * Enqueue Gutenberg block assets for both frontend + backend.
22 *
23 * @uses {wp-editor} for WP editor styles.
24 * @since 1.0.0
25 */
26 function embedpress_blocks_cgb_block_assets()
27 { // phpcs:ignore
28 // Styles.
29 wp_register_style(
30 'embedpress_blocks-cgb-style-css', // Handle.
31 EMBEDPRESS_GUTENBERG_DIR_URL . 'dist/blocks.style.build.css', // Block style CSS.
32 is_admin() ? array('wp-editor') : null, // Dependency to include the CSS after it.
33 filemtime(EMBEDPRESS_GUTENBERG_DIR_PATH . 'dist/blocks.style.build.css') // Version: File modification time.
34 );
35 }
36
37 // Hook: Frontend assets.
38 add_action('enqueue_block_assets', 'embedpress_blocks_cgb_block_assets');
39
40 if (!function_exists('get_options_value')) {
41 function get_options_value($key)
42 {
43 $g_settings = get_option(EMBEDPRESS_PLG_NAME);
44
45 if (isset($g_settings[$key])) {
46 return $g_settings[$key];
47 }
48 return '';
49 }
50 }
51 if (!function_exists('get_branding_value')) {
52 function get_branding_value($key, $provider)
53 {
54 $settings = get_option(EMBEDPRESS_PLG_NAME . ':' . $provider, []);
55
56 if (isset($settings['branding']) && $settings['branding'] === 'yes' && isset($settings[$key])) {
57 return $settings[$key];
58 }
59 return '';
60 }
61 }
62
63
64 /**
65 * Enqueue Gutenberg block assets for backend editor.
66 *
67 * @uses {wp-blocks} for block type registration & related functions.
68 * @uses {wp-element} for WP Element abstraction — structure of blocks.
69 * @uses {wp-i18n} to internationalize the block's text.
70 * @uses {wp-editor} for WP editor styles.
71 * @since 1.0.0
72 */
73
74 function get_user_roles()
75 {
76 global $wp_roles; // Access global roles object
77 $user_roles = [];
78
79 if (isset($wp_roles->roles) && is_array($wp_roles->roles)) {
80 foreach ($wp_roles->roles as $role_key => $role_data) {
81 $user_roles[] = [
82 'value' => $role_key, // Machine-readable key
83 'label' => $role_data['name'], // Human-readable name
84 ];
85 }
86 }
87
88 return $user_roles;
89 }
90
91 function embedpress_blocks_cgb_editor_assets()
92 { // phpcs:ignore
93 // Scripts.
94
95 $elements = (array) get_option(EMBEDPRESS_PLG_NAME . ":elements", []);
96 $g_blocks = isset($elements['gutenberg']) ? (array) $elements['gutenberg'] : [];
97
98 if (!wp_script_is('embedpress-pdfobject')) {
99 wp_enqueue_script(
100 'embedpress-pdfobject',
101 EMBEDPRESS_URL_ASSETS . 'js/pdfobject.js',
102 [],
103 EMBEDPRESS_VERSION
104 );
105 }
106
107 wp_enqueue_script(
108 'embedpress_blocks-cgb-block-js', // Handle.
109 EMBEDPRESS_GUTENBERG_DIR_URL . 'dist/blocks.build.js', // Block.build.js: We register the block here. Built with Webpack.
110 array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-api-fetch', 'wp-is-shallow-equal', 'wp-editor', 'wp-components', 'embedpress-pdfobject'), // Dependencies, defined above.
111 filemtime(EMBEDPRESS_GUTENBERG_DIR_PATH . 'dist/blocks.build.js'), // Version: File modification time.
112 true // Enqueue the script in the footer.
113 );
114
115 if (!empty($g_blocks['document'])) {
116 wp_enqueue_script(
117 'embedpress_documents_viewer_script',
118 EMBEDPRESS_PLUGIN_DIR_URL . 'assets/js/documents-viewer-script.js',
119 array('wp-blocks', 'wp-dom-ready', 'wp-edit-post'),
120 EMBEDPRESS_PLUGIN_VERSION,
121 true
122 );
123 }
124
125 $wistia_labels = array(
126 'watch_from_beginning' => __('Watch from the beginning', 'embedpress'),
127 'skip_to_where_you_left_off' => __('Skip to where you left off', 'embedpress'),
128 'you_have_watched_it_before' => __('It looks like you\'ve watched<br />part of this video before!', 'embedpress'),
129 );
130 $elements = (array) get_option(EMBEDPRESS_PLG_NAME . ":elements", []);
131 $active_blocks = isset($elements['gutenberg']) ? (array) $elements['gutenberg'] : [];
132
133 $wistia_labels = json_encode($wistia_labels);
134 $wistia_options = null;
135 if (function_exists('embedpress_wisita_pro_get_options')) :
136 $wistia_options = embedpress_wisita_pro_get_options();
137 endif;
138 $pars_url = wp_parse_url(get_site_url());
139 $documents_cta_options = (array) get_option(EMBEDPRESS_PLG_NAME . ':document');
140 wp_localize_script('embedpress_blocks-cgb-block-js', 'embedpressObj', array(
141 'wistia_labels' => $wistia_labels,
142 'wisita_options' => $wistia_options,
143 'embedpress_powered_by' => apply_filters('embedpress_document_block_powered_by', true),
144 'embedpress_pro' => defined('EMBEDPRESS_PRO_PLUGIN_FILE'),
145 'twitch_host' => !empty($pars_url['host']) ? $pars_url['host'] : '',
146 'site_url' => site_url(),
147 'active_blocks' => $active_blocks,
148 'document_cta' => $documents_cta_options,
149 'pdf_renderer' => Helper::get_pdf_renderer(),
150 'is_pro_plugin_active' => defined('EMBEDPRESS_SL_ITEM_SLUG'),
151 'ajaxurl' => admin_url('admin-ajax.php'),
152 'source_nonce' => wp_create_nonce('source_nonce_embedpress'),
153 'can_upload_media' => current_user_can('upload_files'),
154 'EMBEDPRESS_URL_ASSETS' => EMBEDPRESS_URL_ASSETS,
155 'iframe_width' => get_options_value('enableEmbedResizeWidth'),
156 'iframe_height' => get_options_value('enableEmbedResizeHeight'),
157 'pdf_custom_color' => get_options_value('custom_color'),
158 'pdf_custom_color' => get_options_value('custom_color'),
159 'youtube_brand_logo_url' => get_branding_value('logo_url', 'youtube'),
160 'vimeo_brand_logo_url' => get_branding_value('logo_url', 'vimeo'),
161 'wistia_brand_logo_url' => get_branding_value('logo_url', 'wistia'),
162 'twitch_brand_logo_url' => get_branding_value('logo_url', 'twitch'),
163 'dailymotion_brand_logo_url' => get_branding_value('logo_url', 'dailymotion'),
164 'user_roles' => get_user_roles()
165
166 ));
167
168 // Styles.
169 wp_enqueue_style(
170 'embedpress_blocks-cgb-block-editor-css', // Handle.
171 EMBEDPRESS_GUTENBERG_DIR_URL . 'dist/blocks.editor.build.css', // Block editor CSS.
172 array('wp-edit-blocks'), // Dependency to include the CSS after it.
173 filemtime(EMBEDPRESS_GUTENBERG_DIR_PATH . 'dist/blocks.editor.build.css') // Version: File modification time.
174 );
175 wp_enqueue_style('embedpress_blocks-cgb-style-css');
176 }
177
178 // Hook: Editor assets.
179 add_action('enqueue_block_editor_assets', 'embedpress_blocks_cgb_editor_assets');
180
181
182 function embedpress_block_category($categories, $post)
183 {
184 return array_merge(
185 $categories,
186 array(
187 array(
188 'slug' => 'embedpress',
189 'title' => 'EmbedPress',
190 'icon' => '',
191 ),
192 )
193 );
194 }
195 $wp_version = get_bloginfo('version', 'display');
196 if (version_compare($wp_version, '5.8', '>=')) {
197 add_filter('block_categories_all', 'embedpress_block_category', 10, 2);
198 } else {
199 add_filter('block_categories', 'embedpress_block_category', 10, 2);
200 }
201
202
203
204
205 foreach (glob(EMBEDPRESS_GUTENBERG_DIR_PATH . 'block-backend/*.php') as $block_logic) {
206 require_once $block_logic;
207 }
208
209 /**
210 * Registers the embedpress gutneberg block on server.
211 */
212
213 function embedpress_gutenberg_register_all_block()
214 {
215 if (function_exists('register_block_type')) :
216
217 $elements = (array) get_option(EMBEDPRESS_PLG_NAME . ":elements", []);
218 $g_blocks = isset($elements['gutenberg']) ? (array) $elements['gutenberg'] : [];
219 $blocks_to_registers = ['twitch-block', 'google-slides-block', 'google-sheets-block', 'google-maps-block', 'google-forms-block', 'google-drawings-block', 'google-docs-block', 'embedpress', 'embedpress-pdf', 'embedpress-calendar', 'document'];
220
221 foreach ($blocks_to_registers as $blocks_to_register) {
222 if (!empty($g_blocks[$blocks_to_register])) {
223 if ('embedpress' === $blocks_to_register) {
224 register_block_type('embedpress/embedpress', [
225 'render_callback' => 'embedpress_render_block',
226 // 'style' => [
227 // 'plyr',
228 // ],
229 // 'script' => [
230 // 'plyr.polyfilled',
231 // 'initplyr',
232 // 'vimeo-player',
233 // 'embedpress-front',
234 // 'embedpress-ads',
235 // ],
236 'attributes' => array(
237 'clientId' => [
238 'type' => 'string',
239 ],
240 'height' => [
241 'type' => 'string',
242 'default' => get_options_value('enableEmbedResizeHeight')
243 ],
244 'width' => [
245 'type' => 'string',
246 'default' => get_options_value('enableEmbedResizeWidth')
247 ],
248 'lockContent' => [
249 'type' => 'boolean',
250 'default' => false
251 ],
252 'protectionType' => [
253 'type' => 'string',
254 'default' => 'password'
255 ],
256 'userRole' => [
257 'type' => 'array',
258 'default' => []
259 ],
260 'protectionMessage' => [
261 'type' => 'string',
262 'default' => 'You do not have access to this content. Only users with the following roles can view it: [user_roles]'
263 ],
264 'lockHeading' => [
265 'type' => 'string',
266 'default' => 'Content Locked'
267 ],
268 'lockSubHeading' => [
269 'type' => 'string',
270 'default' => 'Content is locked and requires password to access it.'
271 ],
272 'lockErrorMessage' => [
273 'type' => 'string',
274 'default' => 'Oops, that wasn\'t the right password. Try again.'
275 ],
276 'passwordPlaceholder' => [
277 'type' => 'string',
278 'default' => 'Password'
279 ],
280 'submitButtonText' => [
281 'type' => 'string',
282 'default' => 'Unlock'
283 ],
284 'submitUnlockingText' => [
285 'type' => 'string',
286 'default' => 'Unlocking'
287 ],
288 'enableFooterMessage' => [
289 'type' => 'boolean',
290 'default' => false
291 ],
292 'footerMessage' => [
293 'type' => 'string',
294 'default' => 'In case you don\'t have the password, kindly reach out to content owner or administrator to request access.'
295 ],
296 'contentPassword' => [
297 'type' => 'string',
298 'default' => '',
299 ],
300 'contentShare' => [
301 'type' => 'boolean',
302 'default' => false
303 ],
304 'sharePosition' => [
305 'type' => 'string',
306 'default' => 'right'
307 ],
308 'customTitle' => [
309 'type' => 'string',
310 'default' => ''
311 ],
312 'customDescription' => [
313 'type' => 'string',
314 'default' => ''
315 ],
316 'customThumbnail' => [
317 'type' => 'string',
318 'default' => ''
319 ],
320
321 'videosize' => [
322 'type' => 'string',
323 'default' => 'fixed'
324 ],
325
326 'loadmore' => [
327 'type' => 'boolean',
328 'default' => false
329 ],
330 //Youtube Attributes
331 'starttime' => [
332 'type' => 'string',
333 ],
334 'endtime' => [
335 'type' => 'string',
336 ],
337 'autoplay' => [
338 'type' => 'boolean',
339 'default' => false
340 ],
341 'controls' => [
342 'type' => 'string',
343 ],
344 'progressbarcolor' => [
345 'type' => 'string',
346 ],
347 'videoannotations' => [
348 'type' => 'string',
349 ],
350 'closedcaptions' => [
351 'type' => 'boolean',
352 'default' => true
353 ],
354 'relatedvideos' => [
355 'type' => 'boolean',
356 'default' => true
357 ],
358 'fullscreen' => [
359 'type' => 'boolean',
360 'default' => true
361 ],
362
363 'modestbranding' => [
364 'type' => 'string',
365 ],
366 'pagesize' => [
367 'type' => 'number',
368 ],
369 // custom player attributes
370 'autoPause' => [
371 'type' => 'boolean',
372 'default' => false
373 ],
374 'customPlayer' => [
375 'type' => 'boolean',
376 'default' => false
377 ],
378
379 'posterThumbnail' => [
380 'type' => 'string',
381 'default' => ''
382 ],
383
384 'playerPreset' => [
385 'type' => 'string',
386 'default' => ''
387 ],
388
389 'playerColor' => [
390 'type' => 'string',
391 'default' => '#2e2e99'
392 ],
393
394 'playerPip' => [
395 'type' => 'boolean',
396 'default' => false
397 ],
398
399 'playerRestart' => [
400 'type' => 'boolean',
401 'default' => true
402 ],
403
404 'playerRewind' => [
405 'type' => 'boolean',
406 'default' => true
407 ],
408
409 'playerFastForward' => [
410 'type' => 'boolean',
411 'default' => true
412 ],
413 'playerTooltip' => [
414 'type' => 'boolean',
415 'default' => true
416 ],
417 'playerHideControls' => [
418 'type' => 'boolean',
419 'default' => true
420 ],
421 'playerDownload' => [
422 'type' => 'boolean',
423 'default' => true
424 ],
425 //Wistia Attributes
426 'wstarttime' => [
427 'type' => 'string',
428 ],
429 'wautoplay' => [
430 'type' => 'boolean',
431 'default' => true
432 ],
433 'scheme' => [
434 'type' => 'string',
435 ],
436 'captions' => [
437 'type' => 'boolean',
438 'default' => true
439 ],
440 'playbutton' => [
441 'type' => 'boolean',
442 'default' => true
443 ],
444 'smallplaybutton' => [
445 'type' => 'boolean',
446 'default' => true
447 ],
448 'playbar' => [
449 'type' => 'boolean',
450 'default' => true
451 ],
452 'resumable' => [
453 'type' => 'boolean',
454 'default' => true
455 ],
456 'wistiafocus' => [
457 'type' => 'boolean',
458 'default' => true
459 ],
460 'volumecontrol' => [
461 'type' => 'boolean',
462 'default' => true
463 ],
464 'volume' => [
465 'type' => 'number',
466 'default' => 100
467 ],
468 'rewind' => [
469 'type' => 'boolean',
470 'default' => false
471 ],
472 'wfullscreen' => [
473 'type' => 'boolean',
474 'default' => true
475 ],
476
477 // Vimeo attributes
478 'vstarttime' => [
479 'type' => 'string',
480 ],
481 'vautoplay' => [
482 'type' => 'boolean',
483 'default' => false
484 ],
485 'vscheme' => [
486 'type' => 'string',
487 ],
488 'vtitle' => [
489 'type' => 'boolean',
490 'default' => true
491 ],
492 'vauthor' => [
493 'type' => 'boolean',
494 'default' => true
495 ],
496 'vavatar' => [
497 'type' => 'boolean',
498 'default' => true
499 ],
500 'vloop' => [
501 'type' => 'boolean',
502 'default' => false
503 ],
504 'vautopause' => [
505 'type' => 'boolean',
506 'default' => false
507 ],
508 'vdnt' => [
509 'type' => 'boolean',
510 'default' => false
511 ],
512
513 // instaFeed attributes
514 'instaLayout' => [
515 'type' => 'string',
516 'default' => 'insta-grid',
517 ],
518 'instafeedFeedType' => [
519 'type' => 'string',
520 'default' => 'user_account_type',
521 ],
522 'instafeedAccountType' => [
523 'type' => 'string',
524 'default' => 'personal',
525 ],
526 'instafeedProfileImage' => [
527 'type' => 'boolean',
528 'default' => true,
529 ],
530 'instafeedProfileImageUrl' => [
531 'type' => 'string',
532 'default' => '',
533 ],
534 'instafeedFollowBtn' => [
535 'type' => 'boolean',
536 'default' => true,
537 ],
538 'instafeedFollowBtnLabel' => [
539 'type' => 'string',
540 'default' => 'Follow',
541 ],
542 'instafeedPostsCount' => [
543 'type' => 'boolean',
544 'default' => true,
545 ],
546 'instafeedPostsCountText' => [
547 'type' => 'string',
548 'default' => '[count] posts',
549 ],
550 'instafeedFollowersCount' => [
551 'type' => 'boolean',
552 'default' => true,
553 ],
554 'instafeedFollowersCountText' => [
555 'type' => 'string',
556 'default' => '[count] followers',
557 ],
558 'instafeedAccName' => [
559 'type' => 'boolean',
560 'default' => true,
561 ],
562 'instafeedColumns' => [
563 'type' => 'string',
564 'default' => '3',
565 ],
566 'instafeedColumnsGap' => [
567 'type' => 'string',
568 'default' => '5',
569 ],
570 'instafeedPostsPerPage' => [
571 'type' => 'string',
572 'default' => '12',
573 ],
574 'instafeedTab' => [
575 'type' => 'boolean',
576 'default' => true,
577 ],
578 'instafeedLikesCount' => [
579 'type' => 'boolean',
580 'default' => true,
581 ],
582 'instafeedCommentsCount' => [
583 'type' => 'boolean',
584 'default' => true,
585 ],
586 'instafeedPopup' => [
587 'type' => 'boolean',
588 'default' => true,
589 ],
590 'instafeedPopupFollowBtn' => [
591 'type' => 'boolean',
592 'default' => true,
593 ],
594 'instafeedPopupFollowBtnLabel' => [
595 'type' => 'string',
596 'default' => 'Follow',
597 ],
598 'instafeedLoadmore' => [
599 'type' => 'boolean',
600 'default' => true,
601 ],
602 'instafeedLoadmoreLabel' => [
603 'type' => 'string',
604 'default' => 'Load More',
605 ],
606 'slidesShow' => [
607 'type' => 'string',
608 'default' => '4',
609 ],
610 'slidesScroll' => [
611 'type' => 'string',
612 'default' => '4',
613 ],
614 'carouselAutoplay' => [
615 'type' => 'boolean',
616 'default' => false,
617 ],
618 'autoplaySpeed' => [
619 'type' => 'string',
620 'default' => '3000',
621 ],
622 'transitionSpeed' => [
623 'type' => 'string',
624 'default' => '1000',
625 ],
626 'carouselLoop' => [
627 'type' => 'boolean',
628 'default' => true,
629 ],
630 'carouselArrows' => [
631 'type' => 'boolean',
632 'default' => true,
633 ],
634 'carouselSpacing' => [
635 'type' => 'string',
636 'default' => '0',
637 ],
638 'carouselDots' => [
639 'type' => 'boolean',
640 'default' => false,
641 ],
642 // Calendly attributes
643 'cEmbedType' => array(
644 'type' => 'string',
645 'default' => 'inline'
646 ),
647 'calendlyData' => array(
648 'type' => 'boolean',
649 'default' => false
650 ),
651 'hideCookieBanner' => array(
652 'type' => 'boolean',
653 'default' => false
654 ),
655 'hideEventTypeDetails' => array(
656 'type' => 'boolean',
657 'default' => false
658 ),
659 'cBackgroundColor' => array(
660 'type' => 'string',
661 'default' => 'ffffff'
662 ),
663 'cTextColor' => array(
664 'type' => 'string',
665 'default' => '1A1A1A'
666 ),
667 'cButtonLinkColor' => array(
668 'type' => 'string',
669 'default' => '0000FF'
670 ),
671 'cPopupButtonText' => array(
672 'type' => 'string',
673 'default' => 'Schedule time with me'
674 ),
675 'cPopupButtonBGColor' => array(
676 'type' => 'string',
677 'default' => '#0000FF'
678 ),
679 'cPopupButtonTextColor' => array(
680 'type' => 'string',
681 'default' => '#FFFFFF'
682 ),
683 'cPopupLinkText' => array(
684 'type' => 'string',
685 'default' => 'Schedule time with me'
686 ),
687
688 //Ad attributes
689 'adManager' => [
690 'type' => 'boolean',
691 'default' => false
692 ],
693 'adSource' => [
694 'type' => 'string',
695 'default' => 'video'
696 ],
697 'adContent' => [
698 'type' => 'object',
699 ],
700 'adWidth' => array(
701 'type' => 'string',
702 'default' => '300'
703 ),
704 'adHeight' => array(
705 'type' => 'string',
706 'default' => '200'
707 ),
708 'adXPosition' => array(
709 'type' => 'number',
710 'default' => 25
711 ),
712 'adYPosition' => array(
713 'type' => 'number',
714 'default' => 10
715 ),
716 'adUrl' => [
717 'type' => 'string',
718 'default' => ''
719 ],
720 'adStart' => [
721 'type' => 'string',
722 'default' => '10'
723 ],
724 'adSkipButton' => [
725 'type' => 'boolean',
726 'default' => true
727 ],
728 'adSkipButtonAfter' => [
729 'type' => 'string',
730 'default' => '5'
731 ]
732
733 ),
734 ]);
735 } elseif ('embedpress-pdf' === $blocks_to_register) {
736 register_block_type('embedpress/embedpress-pdf', [
737 'attributes' => array(
738 'clientId' => [
739 'type' => 'string',
740 ],
741 // 'height' => [
742 // 'type' => 'string',
743 // 'default' => (int) get_options_value('enableEmbedResizeHeight')
744 // ],
745 // 'width' => [
746 // 'type' => 'string',
747 // 'default' => (int) get_options_value('enableEmbedResizeWidth')
748 // ],
749 'customColor' => [
750 'type' => 'string',
751 'default' => get_options_value('custom_color')
752 ],
753 'powered_by' => [
754 'type' => 'boolean',
755 'default' => true
756 ],
757 'lockContent' => [
758 'type' => 'boolean',
759 'default' => false
760 ],
761 'protectionType' => [
762 'type' => 'string',
763 'default' => 'password'
764 ],
765 'userRole' => [
766 'type' => 'array',
767 'default' => []
768 ],
769 'protectionMessage' => [
770 'type' => 'string',
771 'default' => 'You do not have access to this content. Only users with the following roles can view it: [user_roles]'
772 ],
773 'lockHeading' => [
774 'type' => 'string',
775 'default' => 'Content Locked'
776 ],
777 'lockSubHeading' => [
778 'type' => 'string',
779 'default' => 'Content is locked and requires password to access it.'
780 ],
781 'passwordPlaceholder' => [
782 'type' => 'string',
783 'default' => 'Password'
784 ],
785 'submitButtonText' => [
786 'type' => 'string',
787 'default' => 'Unlock'
788 ],
789 'submitUnlockingText' => [
790 'type' => 'string',
791 'default' => 'Unlocking'
792 ],
793 'lockErrorMessage' => [
794 'type' => 'string',
795 'default' => 'Oops, that wasn\'t the right password. Try again.'
796 ],
797 'enableFooterMessage' => [
798 'type' => 'boolean',
799 'default' => false
800 ],
801 'footerMessage' => [
802 'type' => 'string',
803 'default' => 'In case you don\'t have the password, kindly reach out to content owner or administrator to request access.'
804 ],
805 'contentPassword' => [
806 'type' => 'string',
807 'default' => ''
808 ],
809 'contentShare' => [
810 'type' => 'boolean',
811 'default' => false
812 ],
813 'sharePosition' => [
814 'type' => 'string',
815 'default' => 'right'
816 ],
817 'presentation' => [
818 'type' => "boolean",
819 'default' => true,
820 ],
821 'lazyLoad' => [
822 'type' => "boolean",
823 'default' => false,
824 ],
825
826 'position' => [
827 'type' => "string",
828 'default' => 'top',
829 ],
830 'flipbook_toolbar_position' => [
831 'type' => "string",
832 'default' => 'bottom',
833 ],
834
835 'print' => [
836 'type' => "boolean",
837 'default' => true,
838 ],
839
840 'download' => [
841 'type' => "boolean",
842 'default' => true,
843 ],
844 'open' => [
845 'type' => "boolean",
846 'default' => true,
847 ],
848 'selection_tool' => [
849 'type' => "string",
850 'default' => '0',
851 ],
852 'scrolling' => [
853 'type' => "string",
854 'default' => '-1',
855 ],
856 'spreads' => [
857 'type' => "string",
858 'default' => '-1',
859 ],
860 'copy_text' => [
861 'type' => "boolean",
862 'default' => true,
863 ],
864 'add_text' => [
865 'type' => "boolean",
866 'default' => true,
867 ],
868 'draw' => [
869 'type' => "boolean",
870 'default' => true,
871 ],
872 'toolbar' => [
873 'type' => "boolean",
874 'default' => true,
875 ],
876 'doc_details' => [
877 'type' => "boolean",
878 'default' => true,
879 ],
880 'doc_rotation' => [
881 'type' => "boolean",
882 'default' => true,
883 ],
884 'add_image' => [
885 'type' => "boolean",
886 'default' => true,
887 ],
888 'unitoption' => [
889 'type' => "string",
890 'default' => '%',
891 ],
892 'zoomIn' => [
893 'type' => "boolean",
894 'default' => true,
895 ],
896 'zoomOut' => [
897 'type' => "boolean",
898 'default' => true,
899 ],
900 'fitView' => [
901 'type' => "boolean",
902 'default' => true,
903 ],
904 'bookmark' => [
905 'type' => "boolean",
906 'default' => true,
907 ],
908 //Spreaker
909 'theme' => array(
910 'type' => 'string',
911 'default' => 'light',
912 ),
913 'color' => array(
914 'type' => 'string',
915 'default' => '',
916 ),
917 'coverImageUrl' => array(
918 'type' => 'string',
919 'default' => '',
920 ),
921 'playlist' => array(
922 'type' => 'boolean',
923 'default' => false,
924 ),
925 'playlistContinuous' => array(
926 'type' => 'boolean',
927 'default' => false,
928 ),
929 'playlistLoop' => array(
930 'type' => 'boolean',
931 'default' => false,
932 ),
933 'playlistAutoupdate' => array(
934 'type' => 'boolean',
935 'default' => true,
936 ),
937 'chaptersImage' => array(
938 'type' => 'boolean',
939 'default' => true,
940 ),
941 'episodeImagePosition' => array(
942 'type' => 'string',
943 'default' => 'right',
944 ),
945 'hideLikes' => array(
946 'type' => 'boolean',
947 'default' => false,
948 ),
949 'hideComments' => array(
950 'type' => 'boolean',
951 'default' => false,
952 ),
953 'hideSharing' => array(
954 'type' => 'boolean',
955 'default' => false,
956 ),
957 'hideLogo' => array(
958 'type' => 'boolean',
959 'default' => false,
960 ),
961 'hideEpisodeDescription' => array(
962 'type' => 'boolean',
963 'default' => false,
964 ),
965 'hidePlaylistDescriptions' => array(
966 'type' => 'boolean',
967 'default' => false,
968 ),
969 'hidePlaylistImages' => array(
970 'type' => 'boolean',
971 'default' => false,
972 ),
973 'hideDownload' => array(
974 'type' => 'boolean',
975 'default' => false,
976 ),
977 'mode' => array(
978 'type' => 'string',
979 'default' => 'carousel'
980 ),
981 'imageWidth' => array(
982 'type' => 'number',
983 'default' => 800
984 ),
985 'imageHeight' => array(
986 'type' => 'number',
987 'default' => 600
988 ),
989 'playerAutoplay' => array(
990 'type' => 'boolean',
991 'default' => false
992 ),
993 'delay' => array(
994 'type' => 'number',
995 'default' => 5
996 ),
997 'repeat' => array(
998 'type' => 'boolean',
999 'default' => true
1000 ),
1001 'mediaitemsAspectRatio' => array(
1002 'type' => 'boolean',
1003 'default' => true
1004 ),
1005 'mediaitemsEnlarge' => array(
1006 'type' => 'boolean',
1007 'default' => false
1008 ),
1009 'mediaitemsStretch' => array(
1010 'type' => 'boolean',
1011 'default' => false
1012 ),
1013 'mediaitemsCover' => array(
1014 'type' => 'boolean',
1015 'default' => false
1016 ),
1017 'backgroundColor' => array(
1018 'type' => 'string',
1019 'default' => ''
1020 ),
1021 'expiration' => array(
1022 'type' => 'number',
1023 'default' => 60
1024 ),
1025 //Ad attributes
1026 'adManager' => [
1027 'type' => 'boolean',
1028 'default' => false
1029 ],
1030 'adSource' => [
1031 'type' => 'string',
1032 'default' => 'video'
1033 ],
1034 'adContent' => [
1035 'type' => 'object',
1036 ],
1037 'adWidth' => array(
1038 'type' => 'string',
1039 'default' => '300'
1040 ),
1041 'adHeight' => array(
1042 'type' => 'string',
1043 'default' => '200'
1044 ),
1045 'adXPosition' => array(
1046 'type' => 'number',
1047 'default' => 25
1048 ),
1049 'adYPosition' => array(
1050 'type' => 'number',
1051 'default' => 20
1052 ),
1053 'adUrl' => [
1054 'type' => 'string',
1055 'default' => ''
1056 ],
1057 'adStart' => [
1058 'type' => 'string',
1059 'default' => '10'
1060 ],
1061 'adSkipButton' => [
1062 'type' => 'boolean',
1063 'default' => true
1064 ],
1065 'adSkipButtonAfter' => [
1066 'type' => 'string',
1067 'default' => '5'
1068 ]
1069 ),
1070 'render_callback' => 'embedpress_pdf_render_block',
1071 ]);
1072 } elseif ('embedpress-calendar' === $blocks_to_register) {
1073 register_block_type('embedpress/embedpress-calendar', [
1074 'render_callback' => 'embedpress_calendar_render_block',
1075 ]);
1076 } elseif ('document' === $blocks_to_register) {
1077 register_block_type('embedpress/' . $blocks_to_register, [
1078 // 'render_callback' => 'embedpress_document_render_block',
1079 ]);
1080 } else {
1081 register_block_type('embedpress/' . $blocks_to_register);
1082 }
1083 } else {
1084
1085 if (WP_Block_Type_Registry::get_instance()->is_registered('embedpress/' . $blocks_to_register)) {
1086 unregister_block_type('embedpress/' . $blocks_to_register);
1087 }
1088 }
1089 }
1090
1091 endif;
1092 }
1093
1094 add_action('init', 'embedpress_gutenberg_register_all_block');
1095
1096 function getParamData($attributes)
1097 {
1098
1099 $urlParamData = array(
1100 'themeMode' => !empty($attributes['themeMode']) ? $attributes['themeMode'] : 'default',
1101 'toolbar' => !empty($attributes['toolbar']) ? 'true' : 'false',
1102 'position' => $attributes['position'] ?? 'top',
1103 'presentation' => !empty($attributes['presentation']) ? 'true' : 'false',
1104 'lazyLoad' => !empty($attributes['lazyLoad']) ? 'true' : 'false',
1105 'download' => !empty($attributes['download']) ? 'true' : 'false',
1106 'copy_text' => !empty($attributes['copy_text']) ? 'true' : 'false',
1107 'add_text' => !empty($attributes['add_text']) ? 'true' : 'false',
1108 'draw' => !empty($attributes['draw']) ? 'true' : 'false',
1109 'doc_rotation' => !empty($attributes['doc_rotation']) ? 'true' : 'false',
1110 'add_image' => !empty($attributes['add_image']) ? 'true' : 'false',
1111 'doc_details' => !empty($attributes['doc_details']) ? 'true' : 'false',
1112 'zoom_in' => !empty($attributes['zoomIn']) ? 'true' : 'false',
1113 'zoom_out' => !empty($attributes['zoomOut']) ? 'true' : 'false',
1114 'fit_view' => !empty($attributes['fitView']) ? 'true' : 'false',
1115 'bookmark' => !empty($attributes['bookmark']) ? 'true' : 'false',
1116 'flipbook_toolbar_position' => !empty($attributes['flipbook_toolbar_position']) ? $attributes['flipbook_toolbar_position'] : 'bottom',
1117 'selection_tool' => isset($attributes['selection_tool']) ? esc_attr($attributes['selection_tool']) : '0',
1118 'scrolling' => isset($attributes['scrolling']) ? esc_attr($attributes['scrolling']) : '-1',
1119 'spreads' => isset($attributes['spreads']) ? esc_attr($attributes['spreads']) : '-1',
1120 );
1121
1122 if ($urlParamData['themeMode'] == 'custom') {
1123 $urlParamData['customColor'] = !empty($attributes['customColor']) ? $attributes['customColor'] : '#403A81';
1124 }
1125
1126 if (isset($attributes['viewerStyle']) && $attributes['viewerStyle'] == 'flip-book') {
1127 return "&key=" . base64_encode(mb_convert_encoding(http_build_query($urlParamData), 'UTF-8'));
1128 }
1129
1130 return "#key=" . base64_encode(mb_convert_encoding(http_build_query($urlParamData), 'UTF-8'));
1131 }
1132
1133 function embedpress_pdf_block_scripts($attributes)
1134 {
1135
1136 $script_handles = [];
1137
1138 $script_handles[] = 'embedpress-pdfobject';
1139 $script_handles[] = 'embedpress-front';
1140
1141 if (!empty($attributes['adManager'])) {
1142 $script_handles[] = 'embedpress-ads';
1143 }
1144
1145 foreach ($script_handles as $handle) {
1146 wp_enqueue_script($handle);
1147 }
1148
1149 $style_handles = [
1150 'embedpress_blocks-cgb-style-css',
1151 'embedpress-style'
1152 ];
1153
1154 foreach ($style_handles as $handle) {
1155 wp_enqueue_style($handle);
1156 }
1157 }
1158
1159 if (!function_exists('has_content_allowed_roles')) {
1160 function has_content_allowed_roles($allowed_roles = []) {
1161
1162 if ((count($allowed_roles) === 1 && empty($allowed_roles[0]))) {
1163 return true;
1164 }
1165
1166 $current_user = wp_get_current_user();
1167 $user_roles = $current_user->roles;
1168
1169 return !empty(array_intersect($user_roles, $allowed_roles));
1170 }
1171 }
1172
1173
1174
1175 function embedpress_pdf_render_block($attributes)
1176 {
1177 embedpress_pdf_block_scripts($attributes);
1178
1179 if (!empty($attributes['href'])) {
1180 $renderer = Helper::get_pdf_renderer();
1181 $pdf_url = $attributes['href'];
1182 $id = !empty($attributes['id']) ? $attributes['id'] : 'embedpress-pdf-' . rand(100, 10000);
1183 $client_id = md5($id);
1184
1185
1186 $unitoption = !empty($attributes['unitoption']) ? $attributes['unitoption'] : 'px';
1187 $width = !empty($attributes['width']) ? $attributes['width'] . $unitoption : (get_options_value('enableEmbedResizeWidth') ?: 600) . 'px';
1188
1189
1190 if ($unitoption == '%') {
1191 $width_class = ' ep-percentage-width';
1192 } else {
1193 $width_class = 'ep-fixed-width';
1194 }
1195 $content_share_class = '';
1196 $share_position_class = '';
1197 $share_position = isset($attributes['sharePosition']) ? $attributes['sharePosition'] : 'right';
1198
1199 if (!empty($attributes['contentShare'])) {
1200 $content_share_class = 'ep-content-share-enabled';
1201 $share_position_class = 'ep-share-position-' . $share_position;
1202 }
1203
1204 $password_correct = isset($_COOKIE['password_correct_' . $client_id]) ? $_COOKIE['password_correct_' . $client_id] : '';
1205 $hash_pass = hash('sha256', wp_salt(32) . md5(isset($attributes['contentPassword']) ? $attributes['contentPassword'] : ''));
1206
1207
1208 $content_protection_class = 'ep-content-protection-enabled';
1209 if (empty($attributes['lockContent']) || empty($attributes['contentPassword']) || $hash_pass === $password_correct) {
1210 $content_protection_class = 'ep-content-protection-disabled';
1211 }
1212
1213
1214 $height = !empty($attributes['height'])
1215 ? $attributes['height'] . 'px'
1216 : (get_options_value('enableEmbedResizeHeight') ?: 600) . 'px';
1217
1218 $gen_settings = get_option(EMBEDPRESS_PLG_NAME);
1219
1220 $powered_by = isset($gen_settings['embedpress_document_powered_by']) && 'yes' === $gen_settings['embedpress_document_powered_by'];
1221 if (isset($attributes['powered_by'])) {
1222 $powered_by = $attributes['powered_by'];
1223 }
1224
1225 $src = $renderer . ((strpos($renderer, '?') == false) ? '?' : '&') . 'file=' . urlencode($attributes['href']) . getParamData($attributes);
1226
1227 $pass_hash_key = isset($attributes['contentPassword']) ? md5($attributes['contentPassword']) : '';
1228
1229 $aligns = [
1230 'left' => 'ep-alignleft',
1231 'right' => 'ep-alignright',
1232 'center' => 'ep-aligncenter',
1233 'wide' => 'ep-alignwide',
1234 'full' => 'ep-alignfull'
1235 ];
1236 $alignment = isset($attributes['align']) && isset($aligns[$attributes['align']]) ? $aligns[$attributes['align']] : '';
1237 $dimension = "width:$width;height:$height";
1238 ob_start();
1239 ?>
1240
1241
1242 <?php
1243
1244 $url = !empty($attributes['href']) ? $attributes['href'] : '';
1245
1246 $embed_code = '<iframe title="' . esc_attr(Helper::get_file_title($attributes['href'])) . '" class="embedpress-embed-document-pdf ' . esc_attr($id) . '" style="' . esc_attr($dimension) . '; max-width:100%; display: inline-block" src="' . esc_url($src) . '" frameborder="0" oncontextmenu="return false;"></iframe> ';
1247
1248 if (isset($attributes['viewerStyle']) && $attributes['viewerStyle'] === 'flip-book') {
1249 $src = urlencode($url) . getParamData($attributes);
1250 $embed_code = '<iframe title="' . esc_attr(Helper::get_file_title($attributes['href'])) . '" class="embedpress-embed-document-pdf ' . esc_attr($id) . '" style="' . esc_attr($dimension) . '; max-width:100%; display: inline-block" src="' . esc_url(EMBEDPRESS_URL_ASSETS . 'pdf-flip-book/viewer.html?file=' . $src) . '" frameborder="0" oncontextmenu="return false;"></iframe> ';
1251 }
1252 if ($powered_by) {
1253 $embed_code .= sprintf('<p class="embedpress-el-powered">%s</p>', __('Powered By EmbedPress', 'embedpress'));
1254 }
1255
1256 $adsAtts = '';
1257 if (!empty($attributes['adManager'])) {
1258 $ad = base64_encode(json_encode($attributes));
1259 $adsAtts = "data-sponsored-id=$client_id data-sponsored-attrs=$ad class=sponsored-mask";
1260 }
1261 ?>
1262
1263 <div id="ep-gutenberg-content-<?php echo esc_attr($client_id) ?>" class="ep-gutenberg-content <?php echo esc_attr($alignment . ' ' . $width_class . ' ' . $content_share_class . ' ' . $share_position_class . ' ' . $content_protection_class); ?> ">
1264 <div class="embedpress-inner-iframe <?php if ($unitoption === '%') {
1265 echo esc_attr('emebedpress-unit-percent');
1266 } ?> ep-doc-<?php echo esc_attr($client_id); ?>" <?php if ($unitoption === '%' && !empty($attributes['width'])) {
1267 $style_attr = 'max-width:' . $attributes['width'] . '%';
1268 } else {
1269 $style_attr = 'max-width:100%';
1270 } ?> style="<?php echo esc_attr($style_attr); ?>" id="<?php echo esc_attr($id); ?>">
1271 <div <?php echo esc_attr($adsAtts); ?>>
1272 <?php
1273 do_action('embedpress_pdf_gutenberg_after_embed', $client_id, 'pdf', $attributes, $pdf_url);
1274 $embed = $embed_code;
1275
1276 if (
1277 !apply_filters('embedpress/is_allow_rander', false) ||
1278 empty($attributes['lockContent']) ||
1279 ($attributes['protectionType'] == 'password' && empty($attributes['contentPassword'])) ||
1280 ($attributes['protectionType'] == 'password' && (!empty(Helper::is_password_correct($client_id))) && ($hash_pass === $password_correct)) ||
1281 ($attributes['protectionType'] == 'user-role' && has_content_allowed_roles($attributes['userRole']))
1282 ) {
1283
1284 $custom_thumbnail = isset($attributes['customThumbnail']) ? $attributes['customThumbnail'] : '';
1285
1286 echo '<div class="ep-embed-content-wraper">';
1287 $embed = '<div class="position-' . esc_attr($share_position) . '-wraper gutenberg-pdf-wraper">';
1288 $embed .= $embed_code;
1289 $embed .= '</div>';
1290
1291 if (!empty($attributes['contentShare'])) {
1292 $content_id = $attributes['id'];
1293 $embed .= Helper::embed_content_share($content_id, $attributes);
1294 }
1295 echo $embed;
1296 echo '</div>';
1297 } else {
1298 if (!empty($attributes['contentShare'])) {
1299 $content_id = $attributes['clientId'];
1300 $embed = '<div class="position-' . esc_attr($share_position) . '-wraper gutenberg-pdf-wraper">';
1301 $embed .= $embed_code;
1302 $embed .= '</div>';
1303 $embed .= Helper::embed_content_share($content_id, $attributes);
1304 }
1305 echo '<div class="ep-embed-content-wraper">';
1306 if ($attributes['protectionType'] == 'password') {
1307 do_action('embedpress/display_password_form', $client_id, $embed, $pass_hash_key, $attributes);
1308 } else {
1309 do_action('embedpress/content_protection_content', $client_id, $attributes['protectionMessage'], $attributes['userRole']);
1310 }
1311 echo '</div>';
1312 }
1313
1314 ?>
1315
1316 <?php
1317 if (!empty($attributes['adManager'])) {
1318 $embed = apply_filters('embedpress/generate_ad_template', $embed, $client_id, $attributes, 'gutenberg');
1319 }
1320 ?>
1321 </div>
1322 </div>
1323 </div>
1324 <?php
1325 return ob_get_clean();
1326 }
1327 }
1328
1329 function isGoogleCalendar($url)
1330 {
1331 $pattern = '/^https:\/\/calendar\.google\.com\/calendar\/embed\?.*$/';
1332 return preg_match($pattern, $url);
1333 }
1334
1335 function embedpress_calendar_render_block($attributes)
1336 {
1337
1338 $id = !empty($attributes['id']) ? $attributes['id'] : 'embedpress-calendar-' . rand(100, 10000);
1339 $url = !empty($attributes['url']) ? $attributes['url'] : '';
1340
1341 if (!isGoogleCalendar($url)) {
1342 return;
1343 }
1344
1345 $is_private = isset($attributes['is_public']);
1346 $client_id = md5($id);
1347 $width = !empty($attributes['width']) ? $attributes['width'] . 'px' : '600px';
1348 $height = !empty($attributes['height']) ? $attributes['height'] . 'px' : '600px';
1349 $gen_settings = get_option(EMBEDPRESS_PLG_NAME);
1350 $powered_by = isset($gen_settings['embedpress_document_powered_by']) && 'yes' === $gen_settings['embedpress_document_powered_by'];
1351 if (isset($attributes['powered_by'])) {
1352 $powered_by = $attributes['powered_by'];
1353 }
1354
1355 $aligns = [
1356 'left' => 'alignleft',
1357 'right' => 'alignright',
1358 'wide' => 'alignwide',
1359 'full' => 'alignfull'
1360 ];
1361 $alignment = isset($attributes['align']) && isset($aligns[$attributes['align']]) ? $aligns[$attributes['align']] : '';
1362 $dimension = "width:$width;height:$height";
1363 ob_start();
1364 ?>
1365 <div class="embedpress-calendar-gutenberg embedpress-calendar ose-calendar <?php echo esc_attr($alignment) ?>" style="<?php echo esc_attr($dimension); ?>; max-width:100%;">
1366
1367 <?php
1368 if (!empty($url) && !$is_private) {
1369 ?>
1370 <iframe title="<?php echo esc_attr(Helper::get_file_title($url)); ?>" style="<?php echo esc_attr($dimension); ?>; max-width:100%; display: inline-block" src="<?php echo esc_url($url); ?>"></iframe>
1371 <?php } else {
1372 do_action('embedpress_google_helper_shortcode', 10);
1373 } ?>
1374 <?php do_action('embedpress_calendar_gutenberg_after_embed', $client_id, 'calendar', $attributes); ?>
1375
1376 <?php
1377 if ($powered_by) {
1378 printf('<p class="embedpress-el-powered" style="width:' . esc_attr($width) . '" >%s</p>', __('Powered By EmbedPress', 'embedpress'));
1379 } ?>
1380
1381 </div>
1382 <?php
1383 return ob_get_clean();
1384 }
1385
1386 function embedpress_document_block_scripts()
1387 {
1388 // Exit if this is the admin panel
1389 if (is_admin()) {
1390 return;
1391 }
1392
1393 global $post;
1394
1395 // Check for the presence of the 'embedpress/document' block
1396 $block_exists = false;
1397
1398 if (function_exists('has_block')) {
1399 $block_exists = has_block('embedpress/document');
1400 } elseif (isset($post->post_content)) {
1401 // Fallback for older WordPress versions
1402 $block_exists = strpos($post->post_content, '<!-- wp:embedpress/document') !== false;
1403 }
1404
1405 // If the block exists, enqueue the scripts and styles
1406 if ($block_exists) {
1407 $script_handles = [
1408 'embedpress-pdfobject',
1409 'embedpress-front',
1410 'embedpress_documents_viewer_script'
1411 ];
1412
1413 foreach ($script_handles as $handle) {
1414 wp_enqueue_script($handle);
1415 }
1416
1417 $style_handles = [
1418 'embedpress_blocks-cgb-style-css',
1419 'embedpress-style'
1420 ];
1421
1422 foreach ($style_handles as $handle) {
1423 wp_enqueue_style($handle);
1424 }
1425 }
1426 }
1427 add_action('wp_enqueue_scripts', 'embedpress_document_block_scripts');
1428