PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.5.1
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.5.1
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 / EmbedPress / Gutenberg / BlockManager.php
embedpress / EmbedPress / Gutenberg Last commit date
BlockManager.php 2 months ago EmbedPressBlockRenderer.php 3 months ago FallbackHandler.php 9 months ago InitBlocks.php 9 months ago
BlockManager.php
1756 lines
1 <?php
2
3 namespace EmbedPress\Gutenberg;
4
5 use EmbedPress\Includes\Classes\Helper;
6 use EmbedPress\Core\AssetManager;
7
8 /**
9 * Block Manager for EmbedPress
10 *
11 * Handles registration and management of all EmbedPress Gutenberg blocks
12 * using the new centralized structure.
13 */
14 class BlockManager
15 {
16
17 /**
18 * Instance of this class
19 */
20 private static $instance = null;
21
22 /**
23 * Blocks directory path
24 */
25 private $blocks_path;
26
27 /**
28 * Blocks directory URL
29 */
30 private $blocks_url;
31
32 /**
33 * Available blocks
34 */
35 private $available_blocks = [
36 'EmbedPress' => [
37 'name' => 'embedpress/embedpress',
38 'render_callback' => [EmbedPressBlockRenderer::class, 'render'],
39 'setting_key' => 'embedpress',
40 'supports_save_function' => true
41 ],
42 'embedpress-pdf' => [
43 'name' => 'embedpress/embedpress-pdf',
44 'render_callback' => [EmbedPressBlockRenderer::class, 'render_embedpress_pdf'],
45 'setting_key' => 'embedpress-pdf',
46 'supports_save_function' => true
47 ],
48 'document' => [
49 'name' => 'embedpress/document',
50 'render_callback' => [EmbedPressBlockRenderer::class, 'render_document'],
51 'setting_key' => 'document',
52 'supports_save_function' => true
53 ],
54 'embedpress-calendar' => [
55 'name' => 'embedpress/embedpress-calendar',
56 'render_callback' => [EmbedPressBlockRenderer::class, 'render_embedpress_calendar'],
57 'setting_key' => 'embedpress-calendar',
58 'supports_save_function' => true
59 ],
60 'youtube-block' => [
61 'name' => 'embedpress/youtube-block',
62 'render_callback' => [EmbedPressBlockRenderer::class, 'render_youtube_block'],
63 'setting_key' => 'youtube-block',
64 'supports_save_function' => false
65 ],
66 'wistia-block' => [
67 'name' => 'embedpress/wistia-block',
68 'render_callback' => [EmbedPressBlockRenderer::class, 'render_wistia_block'],
69 'setting_key' => 'wistia-block',
70 'supports_save_function' => false
71 ],
72 'pdf-gallery' => [
73 'name' => 'embedpress/pdf-gallery',
74 'render_callback' => [EmbedPressBlockRenderer::class, 'render_pdf_gallery'],
75 'setting_key' => 'pdf-gallery',
76 'supports_save_function' => true
77 ],
78 ];
79
80 /**
81 * Get instance
82 */
83 public static function get_instance()
84 {
85 if (null === self::$instance) {
86 self::$instance = new self();
87 }
88 return self::$instance;
89 }
90
91 /**
92 * Constructor
93 */
94 private function __construct()
95 {
96 // Use src directory if it exists (development), otherwise use built assets (production/distribution)
97 if (file_exists(EMBEDPRESS_PATH_BASE . 'src/Blocks/')) {
98 $this->blocks_path = EMBEDPRESS_PATH_BASE . 'src/Blocks/';
99 $this->blocks_url = EMBEDPRESS_URL_STATIC . '../src/Blocks/';
100 } else {
101 // Fallback to built assets directory when src is not available (distribution)
102 $this->blocks_path = EMBEDPRESS_PATH_BASE . 'assets/blocks/';
103 $this->blocks_url = EMBEDPRESS_URL_ASSETS . 'blocks/';
104 }
105
106
107 // AssetManager is initialized in Core/init.php
108
109 add_action('init', [$this, 'register_blocks']);
110 add_action('admin_enqueue_scripts', [$this, 'enqueue_block_assets']);
111 add_action('admin_enqueue_scripts', [$this, 'enqueue_editor_assets']);
112
113 // Register PDF gallery thumbnail AJAX handlers
114 // Uses Pdf_Thumbnail_Handler (no Elementor dependency) so this works with Gutenberg-only setups
115 add_action('wp_ajax_ep_upload_pdf_thumbnail', ['EmbedPress\Includes\Classes\Pdf_Thumbnail_Handler', 'ajax_upload_pdf_thumbnail']);
116 add_action('wp_ajax_ep_generate_pdf_thumbnail', ['EmbedPress\Includes\Classes\Pdf_Thumbnail_Handler', 'ajax_generate_pdf_thumbnail']);
117 }
118
119 /**
120 * Register all blocks
121 */
122 public function register_blocks()
123 {
124 if (!function_exists('register_block_type')) {
125 return;
126 }
127
128 $elements = (array) get_option(EMBEDPRESS_PLG_NAME . ":elements", []);
129 $g_blocks = isset($elements['gutenberg']) ? (array) $elements['gutenberg'] : [];
130
131
132 // Ensure embedpress block is enabled by default if no settings exist
133 if (empty($elements) || !isset($elements['gutenberg'])) {
134 $this->ensure_default_blocks_enabled();
135 $elements = (array) get_option(EMBEDPRESS_PLG_NAME . ":elements", []);
136 $g_blocks = isset($elements['gutenberg']) ? (array) $elements['gutenberg'] : [];
137 }
138
139 foreach ($this->available_blocks as $block_folder => $block_config) {
140 $setting_key = $block_config['setting_key'];
141
142 // Check if block is enabled in settings
143 if (!empty($g_blocks[$setting_key])) {
144 $this->register_single_block($block_folder, $block_config);
145 } else {
146 // Unregister if disabled
147 if (\WP_Block_Type_Registry::get_instance()->is_registered($block_config['name'])) {
148 unregister_block_type($block_config['name']);
149 }
150 }
151 }
152 }
153
154 /**
155 * Register a single block
156 */
157 private function register_single_block($block_folder, $block_config)
158 {
159 $block_path = $this->blocks_path . $block_folder;
160 $block_json_path = $block_path . '/block.json';
161
162 // Check if we're in development mode (src directory exists) or distribution mode
163 $is_development_mode = file_exists(EMBEDPRESS_PATH_BASE . 'src/Blocks/');
164
165 if ($is_development_mode && file_exists($block_json_path)) {
166 // Development mode: Use block.json files
167 $block_args = [];
168
169 // For blocks that support save function, render_callback is only used for dynamic content
170 if (isset($block_config['render_callback'])) {
171 $block_args['render_callback'] = $block_config['render_callback'];
172 }
173
174 // Add attributes from the old system for compatibility
175 if ($block_config['name'] === 'embedpress/embedpress') {
176 $block_args['attributes'] = $this->get_embedpress_block_attributes();
177 } else if ($block_config['name'] === 'embedpress/embedpress-pdf') {
178 $block_args['attributes'] = $this->get_embedpress_pdf_attributes();
179 } else if ($block_config['name'] === 'embedpress/document') {
180 $block_args['attributes'] = $this->get_embedpress_doc_attributes();
181 } else if ($block_config['name'] === 'embedpress/youtube-block') {
182 $block_args['attributes'] = $this->get_youtube_block_attributes();
183 } else if ($block_config['name'] === 'embedpress/wistia-block') {
184 $block_args['attributes'] = $this->get_wistia_block_attributes();
185 } else if ($block_config['name'] === 'embedpress/pdf-gallery') {
186 $block_args['attributes'] = $this->get_pdf_gallery_attributes();
187 }
188
189 register_block_type($block_json_path, $block_args);
190 } else {
191 // Distribution mode: Register blocks directly without block.json
192 // The JavaScript registration is handled by the bundled blocks.build.js file
193 // We only need to register the server-side render callbacks
194
195 $block_args = [
196 'render_callback' => $block_config['render_callback'] ?? null,
197 ];
198
199 // Add attributes for server-side rendering
200 if ($block_config['name'] === 'embedpress/embedpress') {
201 $block_args['attributes'] = $this->get_embedpress_block_attributes();
202 } else if ($block_config['name'] === 'embedpress/embedpress-pdf') {
203 $block_args['attributes'] = $this->get_embedpress_pdf_attributes();
204 } else if ($block_config['name'] === 'embedpress/document') {
205 $block_args['attributes'] = $this->get_embedpress_doc_attributes();
206 } else if ($block_config['name'] === 'embedpress/youtube-block') {
207 $block_args['attributes'] = $this->get_youtube_block_attributes();
208 } else if ($block_config['name'] === 'embedpress/wistia-block') {
209 $block_args['attributes'] = $this->get_wistia_block_attributes();
210 } else if ($block_config['name'] === 'embedpress/pdf-gallery') {
211 $block_args['attributes'] = $this->get_pdf_gallery_attributes();
212 }
213
214 // Only register if not already registered by JavaScript
215 if (!\WP_Block_Type_Registry::get_instance()->is_registered($block_config['name'])) {
216 register_block_type($block_config['name'], $block_args);
217 } else {
218 // Block already registered by JavaScript, just update the render callback
219 $block_type = \WP_Block_Type_Registry::get_instance()->get_registered($block_config['name']);
220 if ($block_type && isset($block_config['render_callback'])) {
221 $block_type->render_callback = $block_config['render_callback'];
222 }
223 }
224 }
225 }
226
227 /**
228 * Get EmbedPress block attributes for compatibility
229 */
230 private function get_embedpress_block_attributes()
231 {
232 // Base attributes for all embeds
233 $attributes = [
234 // Core attributes
235 'clientId' => [
236 'type' => 'string',
237 ],
238 'url' => [
239 'type' => 'string',
240 'default' => ''
241 ],
242 'providerName' => [
243 'type' => 'string',
244 'default' => ''
245 ],
246 'embedHTML' => [
247 'type' => 'string',
248 'default' => ''
249 ],
250 'height' => [
251 'type' => 'string',
252 'default' => '600'
253 ],
254 'width' => [
255 'type' => 'string',
256 'default' => '600'
257 ],
258
259 // State attributes
260 'editingURL' => [
261 'type' => 'boolean',
262 'default' => false
263 ],
264 'fetching' => [
265 'type' => 'boolean',
266 'default' => false
267 ],
268 'cannotEmbed' => [
269 'type' => 'boolean',
270 'default' => false
271 ],
272 'interactive' => [
273 'type' => 'boolean',
274 'default' => false
275 ],
276 'align' => [
277 'type' => 'string',
278 'default' => 'center'
279 ],
280
281
282 // Custom Player
283 'customPlayer' => [
284 'type' => 'boolean',
285 'default' => false
286 ],
287 'playerPreset' => [
288 'type' => 'string',
289 'default' => 'preset-default'
290 ],
291 'playerColor' => [
292 'type' => 'string',
293 'default' => '#5b4e96',
294 ],
295 'autoPause' => [
296 'type' => 'boolean',
297 'default' => false
298 ],
299 'posterThumbnail' => [
300 'type' => 'string',
301 'default' => ''
302 ],
303 'playerPip' => [
304 'type' => 'boolean',
305 'default' => true
306 ],
307 'playerRestart' => [
308 'type' => 'boolean',
309 'default' => true
310 ],
311 'playerRewind' => [
312 'type' => 'boolean',
313 'default' => false
314 ],
315 'playerFastForward' => [
316 'type' => 'boolean',
317 'default' => false
318 ],
319 'playerTooltip' => [
320 'type' => 'boolean',
321 'default' => true
322 ],
323 'playerHideControls' => [
324 'type' => 'boolean',
325 'default' => false
326 ],
327 'powered_by' => [
328 'type' => 'boolean',
329 'default' => true
330 ],
331 ];
332
333 // Add provider-specific attributes
334 $attributes = array_merge($attributes, $this->get_youtube_attributes());
335 $attributes = array_merge($attributes, $this->get_vimeo_attributes());
336 $attributes = array_merge($attributes, $this->get_wistia_attributes());
337 $attributes = array_merge($attributes, $this->get_instagram_attributes());
338 $attributes = array_merge($attributes, $this->get_calendly_attributes());
339 $attributes = array_merge($attributes, $this->get_podcast_attributes());
340 $attributes = array_merge($attributes, $this->get_google_photos_attributes());
341 $attributes = array_merge($attributes, $this->get_nft_attributes());
342 $attributes = array_merge($attributes, $this->get_ad_manager_attributes());
343 $attributes = array_merge($attributes, $this->get_content_protection_attributes());
344 $attributes = array_merge($attributes, $this->get_social_sharing_attributes());
345 $attributes = array_merge($attributes, $this->get_custom_branding_attributes());
346
347 return $attributes;
348 }
349
350 /**
351 * Get PDF-specific attributes
352 */
353 private function get_embedpress_pdf_attributes()
354 {
355 $attributes = [
356 'clientId' => [
357 'type' => 'string',
358 ],
359 'id' => [
360 'type' => 'string'
361 ],
362 'href' => [
363 'type' => 'string'
364 ],
365 'fileName' => [
366 'type' => 'string',
367 ],
368 'mime' => [
369 'type' => 'string',
370 ],
371 'url' => [
372 'type' => 'string',
373 'default' => ''
374 ],
375 'height' => [
376 'type' => 'string',
377 'default' => '600'
378 ],
379 'width' => [
380 'type' => 'string',
381 'default' => '600'
382 ],
383 'pageNumber' => [
384 'type' => 'number',
385 'default' => 1
386 ],
387 'viewerStyle' => [
388 'type' => 'string',
389 'default' => 'modern'
390 ],
391 'displayMode' => [
392 'type' => 'string',
393 'default' => 'inline'
394 ],
395 'lightboxThumbnail' => [
396 'type' => 'string',
397 'default' => ''
398 ],
399 'lightboxAlign' => [
400 'type' => 'string',
401 'default' => 'left'
402 ],
403 'triggerText' => [
404 'type' => 'string',
405 'default' => 'View PDF'
406 ],
407 'triggerColor' => [
408 'type' => 'string',
409 'default' => ''
410 ],
411 'triggerBgColor' => [
412 'type' => 'string',
413 'default' => ''
414 ],
415 'triggerFontSize' => [
416 'type' => 'string',
417 'default' => ''
418 ],
419 'triggerBorderRadius' => [
420 'type' => 'string',
421 'default' => ''
422 ],
423 'themeMode' => [
424 'type' => 'string',
425 'default' => 'default'
426 ],
427 'customColor' => [
428 'type' => 'string',
429 'default' => '#403A81'
430 ],
431 'toolbar' => [
432 'type' => 'boolean',
433 'default' => true
434 ],
435 'presentation' => [
436 'type' => 'boolean',
437 'default' => true
438 ],
439 'lazyLoad' => [
440 'type' => 'boolean',
441 'default' => false
442 ],
443 'position' => [
444 'type' => 'string',
445 'default' => 'top'
446 ],
447 'flipbook_toolbar_position' => [
448 'type' => 'string',
449 'default' => 'bottom'
450 ],
451 'download' => [
452 'type' => 'boolean',
453 'default' => true
454 ],
455 'open' => [
456 'type' => 'boolean',
457 'default' => false
458 ],
459 'copy_text' => [
460 'type' => 'boolean',
461 'default' => true
462 ],
463 'add_text' => [
464 'type' => 'boolean',
465 'default' => true
466 ],
467 'draw' => [
468 'type' => 'boolean',
469 'default' => true
470 ],
471 'add_image' => [
472 'type' => 'boolean',
473 'default' => true
474 ],
475 'zoomIn' => [
476 'type' => 'boolean',
477 'default' => true
478 ],
479 'zoomOut' => [
480 'type' => 'boolean',
481 'default' => true
482 ],
483 'fitView' => [
484 'type' => 'boolean',
485 'default' => true
486 ],
487 'bookmark' => [
488 'type' => 'boolean',
489 'default' => true
490 ],
491 'doc_details' => [
492 'type' => 'boolean',
493 'default' => true
494 ],
495 'doc_rotation' => [
496 'type' => 'boolean',
497 'default' => true
498 ],
499 'unitoption' => [
500 'type' => 'string',
501 'default' => '%'
502 ],
503 'powered_by' => [
504 'type' => 'boolean',
505 'default' => true
506 ],
507 'watermarkText' => [
508 'type' => 'string',
509 'default' => ''
510 ],
511 'watermarkFontSize' => [
512 'type' => 'number',
513 'default' => 48
514 ],
515 'watermarkColor' => [
516 'type' => 'string',
517 'default' => '#000000'
518 ],
519 'watermarkOpacity' => [
520 'type' => 'number',
521 'default' => 15
522 ],
523 'watermarkStyle' => [
524 'type' => 'string',
525 'default' => 'center'
526 ],
527
528 ];
529
530 $attributes = array_merge($attributes, $this->get_content_protection_attributes());
531 $attributes = array_merge($attributes, $this->get_social_sharing_attributes());
532 $attributes = array_merge($attributes, $this->get_custom_branding_attributes());
533
534 return $attributes;
535 }
536
537 /**
538 * Get PDF Gallery block attributes
539 */
540 private function get_pdf_gallery_attributes()
541 {
542 return [
543 'clientId' => ['type' => 'string'],
544 'pdfItems' => ['type' => 'array', 'default' => []],
545 'layout' => ['type' => 'string', 'default' => 'grid'],
546 'columns' => ['type' => 'number', 'default' => 3],
547 'columnsTablet' => ['type' => 'number', 'default' => 2],
548 'columnsMobile' => ['type' => 'number', 'default' => 1],
549 'gap' => ['type' => 'number', 'default' => 20],
550 'thumbnailAspectRatio' => ['type' => 'string', 'default' => '4:3'],
551 'thumbnailBorderRadius' => ['type' => 'number', 'default' => 8],
552 'carouselAutoplay' => ['type' => 'boolean', 'default' => false],
553 'carouselAutoplaySpeed' => ['type' => 'number', 'default' => 3000],
554 'carouselLoop' => ['type' => 'boolean', 'default' => true],
555 'carouselArrows' => ['type' => 'boolean', 'default' => true],
556 'carouselDots' => ['type' => 'boolean', 'default' => false],
557 'slidesPerView' => ['type' => 'number', 'default' => 3],
558 'viewerStyle' => ['type' => 'string', 'default' => 'modern'],
559 'themeMode' => ['type' => 'string', 'default' => 'default'],
560 'customColor' => ['type' => 'string', 'default' => '#403A81'],
561 'toolbar' => ['type' => 'boolean', 'default' => true],
562 'position' => ['type' => 'string', 'default' => 'top'],
563 'flipbook_toolbar_position' => ['type' => 'string', 'default' => 'bottom'],
564 'presentation' => ['type' => 'boolean', 'default' => true],
565 'download' => ['type' => 'boolean', 'default' => true],
566 'copy_text' => ['type' => 'boolean', 'default' => true],
567 'draw' => ['type' => 'boolean', 'default' => true],
568 'add_text' => ['type' => 'boolean', 'default' => true],
569 'add_image' => ['type' => 'boolean', 'default' => true],
570 'doc_rotation' => ['type' => 'boolean', 'default' => true],
571 'doc_details' => ['type' => 'boolean', 'default' => true],
572 'zoomIn' => ['type' => 'boolean', 'default' => true],
573 'zoomOut' => ['type' => 'boolean', 'default' => true],
574 'fitView' => ['type' => 'boolean', 'default' => true],
575 'bookmark' => ['type' => 'boolean', 'default' => true],
576 'powered_by' => ['type' => 'boolean', 'default' => true],
577 'watermarkText' => ['type' => 'string', 'default' => ''],
578 'watermarkFontSize' => ['type' => 'number', 'default' => 48],
579 'watermarkColor' => ['type' => 'string', 'default' => '#000000'],
580 'watermarkOpacity' => ['type' => 'number', 'default' => 15],
581 'watermarkStyle' => ['type' => 'string', 'default' => 'center'],
582 ];
583 }
584
585 private function get_embedpress_doc_attributes()
586 {
587 $attributes = [
588 'clientId' => [
589 'type' => 'string',
590 ],
591
592 'id' => [
593 'type' => 'string',
594 ],
595 'href' => [
596 'type' => 'string',
597 ],
598 'height' => [
599 'type' => 'string',
600 'default' => '600'
601 ],
602 'width' => [
603 'type' => 'string',
604 'default' => '600'
605 ],
606 'fileName' => [
607 'type' => 'string',
608 ],
609 'mime' => [
610 'type' => 'string',
611 ],
612 'powered_by' => [
613 'type' => 'boolean',
614 'default' => true,
615 ],
616 'presentation' => [
617 'type' => 'boolean',
618 'default' => true,
619 ],
620 'docViewer' => [
621 'type' => 'string',
622 'default' => 'custom',
623 ],
624 'themeMode' => [
625 'type' => 'string',
626 'default' => 'default',
627 ],
628 'customColor' => [
629 'type' => 'string',
630 'default' => '#403A81',
631 ],
632 'position' => [
633 'type' => 'string',
634 'default' => 'top',
635 ],
636 'download' => [
637 'type' => 'boolean',
638 'default' => true,
639 ],
640 'open' => [
641 'type' => 'boolean',
642 'default' => false,
643 ],
644 'copy_text' => [
645 'type' => 'boolean',
646 'default' => true,
647 ],
648 'draw' => [
649 'type' => 'boolean',
650 'default' => true,
651 ],
652 'toolbar' => [
653 'type' => 'boolean',
654 'default' => true,
655 ],
656 'doc_rotation' => [
657 'type' => 'boolean',
658 'default' => true,
659 ],
660 ];
661
662 $attributes = array_merge($attributes, $this->get_content_protection_attributes());
663 $attributes = array_merge($attributes, $this->get_social_sharing_attributes());
664 $attributes = array_merge($attributes, $this->get_custom_branding_attributes());
665
666 return $attributes;
667 }
668
669 /**
670 * Get YouTube block-specific attributes (for legacy youtube-block)
671 */
672 private function get_youtube_block_attributes()
673 {
674 return [
675 'url' => [
676 'type' => 'string',
677 'default' => ''
678 ],
679 'iframeSrc' => [
680 'type' => 'string',
681 'default' => ''
682 ],
683 'mediaId' => [
684 'type' => 'string',
685 'default' => ''
686 ],
687 'align' => [
688 'type' => 'string',
689 'default' => 'center'
690 ]
691 ];
692 }
693
694 /**
695 * Get Wistia block-specific attributes (for legacy wistia-block)
696 */
697 private function get_wistia_block_attributes()
698 {
699 return [
700 'url' => [
701 'type' => 'string',
702 'default' => ''
703 ],
704 'iframeSrc' => [
705 'type' => 'string',
706 'default' => ''
707 ],
708 'align' => [
709 'type' => 'string',
710 'default' => 'center'
711 ]
712 ];
713 }
714
715 /**
716 * Get ContenProtection-specific attributes
717 */
718 private function get_content_protection_attributes()
719 {
720 return [
721 'lockContent' => [
722 'type' => 'boolean',
723 'default' => false
724 ],
725 'protectionType' => [
726 'type' => 'string',
727 'default' => 'password'
728 ],
729 'userRole' => [
730 'type' => 'array',
731 'default' => []
732 ],
733 'protectionMessage' => [
734 'type' => 'string',
735 'default' => 'You do not have access to this content. Only users with the following roles can view it: [user_roles]'
736 ],
737 'contentPassword' => [
738 'type' => 'string',
739 'default' => ''
740 ],
741 'lockHeading' => [
742 'type' => 'string',
743 'default' => 'Content Locked'
744 ],
745 'lockSubHeading' => [
746 'type' => 'string',
747 'default' => 'Content is locked and requires password to access it.'
748 ],
749 'lockErrorMessage' => [
750 'type' => 'string',
751 'default' => 'Oops, that wasn\'t the right password. Try again.'
752 ],
753 'passwordPlaceholder' => [
754 'type' => 'string',
755 'default' => 'Password'
756 ],
757 'submitButtonText' => [
758 'type' => 'string',
759 'default' => 'Unlock'
760 ],
761 'submitUnlockingText' => [
762 'type' => 'string',
763 'default' => 'Unlocking'
764 ],
765 'enableFooterMessage' => [
766 'type' => 'boolean',
767 'default' => false
768 ],
769 'footerMessage' => [
770 'type' => 'string',
771 'default' => 'In case you don\'t have the password, kindly reach out to content owner or administrator to request access.'
772 ],
773 ];
774 }
775
776 /**
777 * Get SocialSharing-specific attributes
778 */
779 private function get_social_sharing_attributes()
780 {
781 return [
782 'contentShare' => [
783 'type' => 'boolean',
784 'default' => false
785 ],
786 'sharePosition' => [
787 'type' => 'string',
788 'default' => 'right'
789 ],
790 'customTitle' => [
791 'type' => 'string',
792 'default' => ''
793 ],
794 'customDescription' => [
795 'type' => 'string',
796 'default' => ''
797 ],
798 'customThumbnail' => [
799 'type' => 'string',
800 'default' => ''
801 ],
802 'shareFacebook' => [
803 'type' => 'boolean',
804 'default' => true
805 ],
806 'shareTwitter' => [
807 'type' => 'boolean',
808 'default' => true
809 ],
810 'sharePinterest' => [
811 'type' => 'boolean',
812 'default' => true
813 ],
814 'shareLinkedin' => [
815 'type' => 'boolean',
816 'default' => true
817 ],
818 ];
819 }
820
821 /**
822 * Get CustomBranding-specific attributes
823 */
824 private function get_custom_branding_attributes()
825 {
826 return [
827 'customlogo' => [
828 'type' => 'string',
829 'default' => ''
830 ],
831 'logoX' => [
832 'type' => 'number',
833 'default' => 5
834 ],
835 'logoY' => [
836 'type' => 'number',
837 'default' => 10
838 ],
839 'customlogoUrl' => [
840 'type' => 'string',
841 ],
842 'logoOpacity' => [
843 'type' => 'number',
844 'default' => 0.6
845 ],
846 ];
847 }
848
849
850 /**
851 * Get YouTube-specific attributes
852 */
853 private function get_youtube_attributes()
854 {
855 return [
856 // YouTube specific attributes
857 'ispagination' => [
858 'type' => 'boolean',
859 'default' => true
860 ],
861 'ytChannelLayout' => [
862 'type' => 'string',
863 'default' => 'gallery'
864 ],
865 'pagesize' => [
866 'type' => 'string',
867 'default' => '6'
868 ],
869 'columns' => [
870 'type' => 'string',
871 'default' => '3'
872 ],
873 'gapbetweenvideos' => [
874 'type' => 'number',
875 'default' => 30
876 ],
877 'videosize' => [
878 'type' => 'string',
879 'default' => 'fixed',
880 ],
881 'starttime' => [
882 'type' => 'string',
883 ],
884 'endtime' => [
885 'type' => 'string',
886 ],
887 'autoplay' => [
888 'type' => 'boolean',
889 'default' => false,
890 ],
891 'muteVideo' => [
892 'type' => 'boolean',
893 'default' => true,
894 ],
895 'controls' => [
896 'type' => 'string',
897 ],
898 'fullscreen' => [
899 'type' => 'boolean',
900 'default' => true,
901 ],
902 'videoannotations' => [
903 'type' => 'boolean',
904 'default' => true,
905 ],
906 'progressbarcolor' => [
907 'type' => 'string',
908 'default' => 'red'
909 ],
910 'closedcaptions' => [
911 'type' => 'boolean',
912 'default' => true,
913 ],
914 'modestbranding' => [
915 'type' => 'string',
916 ],
917 'relatedvideos' => [
918 'type' => 'boolean',
919 'default' => true,
920 ],
921 'showinfo' => [
922 'type' => 'boolean',
923 'default' => true,
924 ],
925 'showLoop' => [
926 'type' => 'boolean',
927 'default' => true,
928 ],
929 ];
930 }
931
932 /**
933 * Get Vimeo-specific attributes
934 */
935 private function get_vimeo_attributes()
936 {
937 return [
938 'vimeoAutoplay' => [
939 'type' => 'boolean',
940 'default' => false,
941 ],
942 'vimeoLoop' => [
943 'type' => 'boolean',
944 'default' => false,
945 ],
946 'vimeoPortrait' => [
947 'type' => 'boolean',
948 'default' => true,
949 ],
950 'vimeoTitle' => [
951 'type' => 'boolean',
952 'default' => true,
953 ],
954 'vimeoByline' => [
955 'type' => 'boolean',
956 'default' => true,
957 ],
958 'vimeoColor' => [
959 'type' => 'string',
960 'default' => '#00adef'
961 ],
962 'vimeoDnt' => [
963 'type' => 'boolean',
964 'default' => false,
965 ],
966 // Additional Vimeo attributes
967 'vstarttime' => [
968 'type' => 'string',
969 ],
970 'vautoplay' => [
971 'type' => 'boolean',
972 'default' => false
973 ],
974 'vscheme' => [
975 'type' => 'string',
976 ],
977 'vtitle' => [
978 'type' => 'boolean',
979 'default' => true
980 ],
981 'vauthor' => [
982 'type' => 'boolean',
983 'default' => true
984 ],
985 'vavatar' => [
986 'type' => 'boolean',
987 'default' => true
988 ],
989 'vloop' => [
990 'type' => 'boolean',
991 'default' => false
992 ],
993 'vautopause' => [
994 'type' => 'boolean',
995 'default' => false
996 ],
997 'vdnt' => [
998 'type' => 'boolean',
999 'default' => false
1000 ],
1001 ];
1002 }
1003
1004 /**
1005 * Get Wistia-specific attributes
1006 */
1007 private function get_wistia_attributes()
1008 {
1009 return [
1010 'wstarttime' => [
1011 'type' => 'string',
1012 ],
1013 'wautoplay' => [
1014 'type' => 'boolean',
1015 'default' => true
1016 ],
1017 'scheme' => [
1018 'type' => 'string',
1019 ],
1020 'captions' => [
1021 'type' => 'boolean',
1022 'default' => true
1023 ],
1024 'playbutton' => [
1025 'type' => 'boolean',
1026 'default' => true
1027 ],
1028 'smallplaybutton' => [
1029 'type' => 'boolean',
1030 'default' => true
1031 ],
1032 'playbar' => [
1033 'type' => 'boolean',
1034 'default' => true
1035 ],
1036 'resumable' => [
1037 'type' => 'boolean',
1038 'default' => true
1039 ],
1040 'wistiafocus' => [
1041 'type' => 'boolean',
1042 'default' => true
1043 ],
1044 'volumecontrol' => [
1045 'type' => 'boolean',
1046 'default' => true
1047 ],
1048 'volume' => [
1049 'type' => 'number',
1050 'default' => 100
1051 ],
1052 'rewind' => [
1053 'type' => 'boolean',
1054 'default' => false
1055 ],
1056 'wfullscreen' => [
1057 'type' => 'boolean',
1058 'default' => true
1059 ],
1060 ];
1061 }
1062
1063 /**
1064 * Get Instagram-specific attributes
1065 */
1066 private function get_instagram_attributes()
1067 {
1068 return [
1069 'instaLayout' => [
1070 'type' => 'string',
1071 'default' => 'insta-grid'
1072 ],
1073 'carouselArrows' => [
1074 'type' => 'boolean',
1075 'default' => true
1076 ],
1077 'carouselSpacing' => [
1078 'type' => 'string',
1079 'default' => '0'
1080 ],
1081 'carouselDots' => [
1082 'type' => 'boolean',
1083 'default' => false
1084 ],
1085 // Instagram Feed attributes
1086 'instafeedFeedType' => [
1087 'type' => 'string',
1088 'default' => 'user_account_type',
1089 ],
1090 'instafeedAccountType' => [
1091 'type' => 'string',
1092 'default' => 'personal',
1093 ],
1094 'instafeedProfileImage' => [
1095 'type' => 'boolean',
1096 'default' => true,
1097 ],
1098 'instafeedProfileImageUrl' => [
1099 'type' => 'string',
1100 'default' => '',
1101 ],
1102 'instafeedFollowBtn' => [
1103 'type' => 'boolean',
1104 'default' => true,
1105 ],
1106 'instafeedFollowBtnLabel' => [
1107 'type' => 'string',
1108 'default' => 'Follow',
1109 ],
1110 'instafeedPostsCount' => [
1111 'type' => 'boolean',
1112 'default' => true,
1113 ],
1114 'instafeedPostsCountText' => [
1115 'type' => 'string',
1116 'default' => '[count] posts',
1117 ],
1118 'instafeedFollowersCount' => [
1119 'type' => 'boolean',
1120 'default' => true,
1121 ],
1122 'instafeedFollowersCountText' => [
1123 'type' => 'string',
1124 'default' => '[count] followers',
1125 ],
1126 'instafeedAccName' => [
1127 'type' => 'boolean',
1128 'default' => true,
1129 ],
1130 'instafeedColumns' => [
1131 'type' => 'string',
1132 'default' => '3'
1133 ],
1134 'instafeedColumnsGap' => [
1135 'type' => 'string',
1136 'default' => '5'
1137 ],
1138 'instafeedPostsPerPage' => [
1139 'type' => 'string',
1140 'default' => '12'
1141 ],
1142 'instafeedTab' => [
1143 'type' => 'boolean',
1144 'default' => true,
1145 ],
1146 'instafeedLikesCount' => [
1147 'type' => 'boolean',
1148 'default' => true,
1149 ],
1150 'instafeedCommentsCount' => [
1151 'type' => 'boolean',
1152 'default' => true,
1153 ],
1154 'instafeedPopup' => [
1155 'type' => 'boolean',
1156 'default' => true,
1157 ],
1158 'instafeedPopupFollowBtn' => [
1159 'type' => 'boolean',
1160 'default' => true,
1161 ],
1162 'instafeedPopupFollowBtnLabel' => [
1163 'type' => 'string',
1164 'default' => 'Follow',
1165 ],
1166 'instafeedLoadmore' => [
1167 'type' => 'boolean',
1168 'default' => true,
1169 ],
1170 'instafeedLoadmoreLabel' => [
1171 'type' => 'string',
1172 'default' => 'Load More',
1173 ],
1174 'slidesShow' => [
1175 'type' => 'string',
1176 'default' => '4'
1177 ],
1178 'slidesScroll' => [
1179 'type' => 'string',
1180 'default' => '4'
1181 ],
1182 'carouselAutoplay' => [
1183 'type' => 'boolean',
1184 'default' => false
1185 ],
1186 'autoplaySpeed' => [
1187 'type' => 'string',
1188 'default' => '3000'
1189 ],
1190 'transitionSpeed' => [
1191 'type' => 'string',
1192 'default' => '1000'
1193 ],
1194 'carouselLoop' => [
1195 'type' => 'boolean',
1196 'default' => true
1197 ],
1198 ];
1199 }
1200
1201 /**
1202 * Get Calendly-specific attributes
1203 */
1204 private function get_calendly_attributes()
1205 {
1206 return [
1207 'cEmbedType' => [
1208 'type' => 'string',
1209 'default' => 'inline'
1210 ],
1211 'calendlyData' => [
1212 'type' => 'boolean',
1213 'default' => false
1214 ],
1215 'hideCookieBanner' => [
1216 'type' => 'boolean',
1217 'default' => false
1218 ],
1219 'hideEventTypeDetails' => [
1220 'type' => 'boolean',
1221 'default' => false
1222 ],
1223 'cBackgroundColor' => [
1224 'type' => 'string',
1225 'default' => 'ffffff'
1226 ],
1227 'cTextColor' => [
1228 'type' => 'string',
1229 'default' => '1A1A1A'
1230 ],
1231 'cButtonLinkColor' => [
1232 'type' => 'string',
1233 'default' => '0000FF'
1234 ],
1235 'cPopupButtonText' => [
1236 'type' => 'string',
1237 'default' => 'Schedule time with me'
1238 ],
1239 'cPopupButtonBGColor' => [
1240 'type' => 'string',
1241 'default' => '0000FF'
1242 ],
1243 'cPopupButtonTextColor' => [
1244 'type' => 'string',
1245 'default' => 'FFFFFF'
1246 ],
1247 'cPopupLinkText' => [
1248 'type' => 'string',
1249 'default' => 'Schedule time with me'
1250 ],
1251 ];
1252 }
1253
1254 /**
1255 * Get Podcast-specific attributes (Spreaker)
1256 */
1257 private function get_podcast_attributes()
1258 {
1259 return [
1260 // Spreaker attributes
1261 'theme' => [
1262 'type' => 'string',
1263 'default' => 'light'
1264 ],
1265 'color' => [
1266 'type' => 'string',
1267 'default' => ''
1268 ],
1269 'coverImageUrl' => [
1270 'type' => 'string',
1271 'default' => ''
1272 ],
1273 'playlist' => [
1274 'type' => 'boolean',
1275 'default' => false
1276 ],
1277 'playlistContinuous' => [
1278 'type' => 'boolean',
1279 'default' => false
1280 ],
1281 'playlistLoop' => [
1282 'type' => 'boolean',
1283 'default' => false
1284 ],
1285 'playlistAutoupdate' => [
1286 'type' => 'boolean',
1287 'default' => true
1288 ],
1289 'chaptersImage' => [
1290 'type' => 'boolean',
1291 'default' => true
1292 ],
1293 'episodeImagePosition' => [
1294 'type' => 'string',
1295 'default' => 'right'
1296 ],
1297 'hideLikes' => [
1298 'type' => 'boolean',
1299 'default' => false
1300 ],
1301 'hideComments' => [
1302 'type' => 'boolean',
1303 'default' => false
1304 ],
1305 'hideSharing' => [
1306 'type' => 'boolean',
1307 'default' => false
1308 ],
1309 'hideLogo' => [
1310 'type' => 'boolean',
1311 'default' => false
1312 ],
1313 'hideEpisodeDescription' => [
1314 'type' => 'boolean',
1315 'default' => false
1316 ],
1317 'hidePlaylistDescriptions' => [
1318 'type' => 'boolean',
1319 'default' => false
1320 ],
1321 'hidePlaylistImages' => [
1322 'type' => 'boolean',
1323 'default' => false
1324 ],
1325 'hideDownload' => [
1326 'type' => 'boolean',
1327 'default' => false
1328 ],
1329 ];
1330 }
1331
1332 /**
1333 * Get Google Photos-specific attributes
1334 */
1335 private function get_google_photos_attributes()
1336 {
1337 return [
1338 'mode' => [
1339 'type' => 'string',
1340 'default' => 'carousel'
1341 ],
1342 'imageWidth' => [
1343 'type' => 'number',
1344 'default' => 800
1345 ],
1346 'imageHeight' => [
1347 'type' => 'number',
1348 'default' => 600
1349 ],
1350 'showTitle' => [
1351 'type' => 'boolean',
1352 'default' => true
1353 ],
1354 'playerAutoplay' => [
1355 'type' => 'boolean',
1356 'default' => false
1357 ],
1358 'delay' => [
1359 'type' => 'number',
1360 'default' => 5
1361 ],
1362 'repeat' => [
1363 'type' => 'boolean',
1364 'default' => true
1365 ],
1366 'mediaitemsAspectRatio' => [
1367 'type' => 'boolean',
1368 'default' => true
1369 ],
1370 'mediaitemsEnlarge' => [
1371 'type' => 'boolean',
1372 'default' => false
1373 ],
1374 'mediaitemsStretch' => [
1375 'type' => 'boolean',
1376 'default' => false
1377 ],
1378 'mediaitemsCover' => [
1379 'type' => 'boolean',
1380 'default' => false
1381 ],
1382 'backgroundColor' => [
1383 'type' => 'string',
1384 'default' => '#000000'
1385 ],
1386 'expiration' => [
1387 'type' => 'number',
1388 'default' => 60
1389 ],
1390 ];
1391 }
1392
1393 /**
1394 * Get NFT/OpenSea-specific attributes
1395 */
1396 private function get_nft_attributes()
1397 {
1398 return [
1399 'limit' => [
1400 'type' => 'number',
1401 'default' => 20
1402 ],
1403 'itemperpage' => [
1404 'type' => 'number',
1405 'default' => 9
1406 ],
1407 'loadmore' => [
1408 'type' => 'boolean',
1409 'default' => false
1410 ],
1411 'loadmorelabel' => [
1412 'type' => 'text',
1413 'default' => 'Load More'
1414 ],
1415 'orderby' => [
1416 'type' => 'string',
1417 'default' => 'desc'
1418 ],
1419 'gapbetweenitem' => [
1420 'type' => 'number',
1421 'default' => 30
1422 ],
1423 'layout' => [
1424 'type' => 'string',
1425 'default' => 'ep-grid'
1426 ],
1427 'preset' => [
1428 'type' => 'string',
1429 'default' => 'preset-default'
1430 ],
1431 'nftperrow' => [
1432 'type' => 'number',
1433 'default' => 3
1434 ],
1435 'collectionname' => [
1436 'type' => 'boolean',
1437 'default' => true
1438 ],
1439 'nftimage' => [
1440 'type' => 'boolean',
1441 'default' => true
1442 ],
1443 'nfttitle' => [
1444 'type' => 'boolean',
1445 'default' => true
1446 ],
1447 'nftcreator' => [
1448 'type' => 'boolean',
1449 'default' => true
1450 ],
1451 'prefix_nftcreator' => [
1452 'type' => 'string',
1453 'default' => 'Created By'
1454 ],
1455 'nftprice' => [
1456 'type' => 'boolean',
1457 'default' => true
1458 ],
1459 'prefix_nftprice' => [
1460 'type' => 'string',
1461 'default' => 'Current Price'
1462 ],
1463 'nftlastsale' => [
1464 'type' => 'boolean',
1465 'default' => true
1466 ],
1467 'prefix_nftlastsale' => [
1468 'type' => 'string',
1469 'default' => 'Last Sale'
1470 ],
1471 'nftbutton' => [
1472 'type' => 'boolean',
1473 'default' => true
1474 ],
1475 'nftrank' => [
1476 'type' => 'boolean',
1477 'default' => true
1478 ],
1479 'label_nftrank' => [
1480 'type' => 'string',
1481 'default' => 'Rank'
1482 ],
1483 'nftdetails' => [
1484 'type' => 'boolean',
1485 'default' => true
1486 ],
1487 'label_nftdetails' => [
1488 'type' => 'string',
1489 'default' => 'Details'
1490 ],
1491 'label_nftbutton' => [
1492 'type' => 'string',
1493 'default' => 'See Details'
1494 ],
1495 'alignment' => [
1496 'type' => 'string',
1497 'default' => 'ep-item-center'
1498 ],
1499 // Color and Typography for NFT
1500 'itemBGColor' => [
1501 'type' => 'string',
1502 ],
1503 'collectionNameColor' => [
1504 'type' => 'string',
1505 ],
1506 'collectionNameFZ' => [
1507 'type' => 'number',
1508 ],
1509 'titleColor' => [
1510 'type' => 'string',
1511 ],
1512 'titleFontsize' => [
1513 'type' => 'number',
1514 ],
1515 'creatorColor' => [
1516 'type' => 'string',
1517 ],
1518 'creatorFontsize' => [
1519 'type' => 'number',
1520 ],
1521 'creatorLinkColor' => [
1522 'type' => 'string',
1523 ],
1524 'creatorLinkFontsize' => [
1525 'type' => 'number',
1526 ],
1527 'priceLabelColor' => [
1528 'type' => 'string',
1529 ],
1530 'priceLabelFontsize' => [
1531 'type' => 'number',
1532 ],
1533 'priceColor' => [
1534 'type' => 'string',
1535 ],
1536 'priceFontsize' => [
1537 'type' => 'number',
1538 ],
1539 'priceUSDColor' => [
1540 'type' => 'string',
1541 ],
1542 'priceUSDFontsize' => [
1543 'type' => 'number',
1544 ],
1545 'lastSaleLabelColor' => [
1546 'type' => 'string',
1547 ],
1548 'lastSaleLabelFontsize' => [
1549 'type' => 'number',
1550 ],
1551 'lastSaleColor' => [
1552 'type' => 'string',
1553 ],
1554 'lastSaleFontsize' => [
1555 'type' => 'number',
1556 ],
1557 'lastSaleUSDColor' => [
1558 'type' => 'string',
1559 ],
1560 'lastSaleUSDFontsize' => [
1561 'type' => 'number',
1562 ],
1563 'buttonTextColor' => [
1564 'type' => 'string',
1565 ],
1566 'buttonBackgroundColor' => [
1567 'type' => 'string',
1568 ],
1569 'buttonTextFontsize' => [
1570 'type' => 'number',
1571 ],
1572 'loadmoreTextColor' => [
1573 'type' => 'string',
1574 ],
1575 'loadmoreBackgroundColor' => [
1576 'type' => 'string',
1577 ],
1578 'loadmoreTextFontsize' => [
1579 'type' => 'number',
1580 ],
1581 'rankBtnColor' => [
1582 'type' => 'string',
1583 ],
1584 'rankBtnBorderColor' => [
1585 'type' => 'string',
1586 ],
1587 'rankBtnFZ' => [
1588 'type' => 'number',
1589 ],
1590 'rankLabelColor' => [
1591 'type' => 'string',
1592 ],
1593 'rankLabelFZ' => [
1594 'type' => 'number',
1595 ],
1596 'detialTitleColor' => [
1597 'type' => 'string',
1598 ],
1599 'detialTitleFZ' => [
1600 'type' => 'number',
1601 ],
1602 'detailTextColor' => [
1603 'type' => 'string',
1604 ],
1605 'detailTextLinkColor' => [
1606 'type' => 'string',
1607 ],
1608 'detailTextFZ' => [
1609 'type' => 'number',
1610 ],
1611 ];
1612 }
1613
1614 /**
1615 * Get Ad Manager-specific attributes
1616 */
1617 private function get_ad_manager_attributes()
1618 {
1619 return [
1620 'adManager' => [
1621 'type' => 'boolean',
1622 'default' => false
1623 ],
1624 'adSource' => [
1625 'type' => 'string',
1626 'default' => 'video'
1627 ],
1628 'adContent' => [
1629 'type' => 'object',
1630 ],
1631 'adFileUrl' => [
1632 'type' => 'string',
1633 'default' => ''
1634 ],
1635 'adWidth' => [
1636 'type' => 'string',
1637 'default' => '300'
1638 ],
1639 'adHeight' => [
1640 'type' => 'string',
1641 'default' => '200'
1642 ],
1643 'adXPosition' => [
1644 'type' => 'number',
1645 'default' => 25
1646 ],
1647 'adYPosition' => [
1648 'type' => 'number',
1649 'default' => 10
1650 ],
1651 'adUrl' => [
1652 'type' => 'string',
1653 'default' => ''
1654 ],
1655 'adStart' => [
1656 'type' => 'string',
1657 'default' => '10'
1658 ],
1659 'adSkipButton' => [
1660 'type' => 'boolean',
1661 'default' => true
1662 ],
1663 'adSkipButtonAfter' => [
1664 'type' => 'string',
1665 'default' => '5'
1666 ],
1667 ];
1668 }
1669
1670 /**
1671 * Enqueue block assets for both frontend and backend
1672 * Now handled by AssetManager
1673 */
1674 public function enqueue_block_assets()
1675 {
1676 // Assets are now handled by the centralized AssetManager
1677 // This method is kept for backward compatibility
1678 }
1679
1680 /**
1681 * Enqueue editor assets
1682 */
1683 public function enqueue_editor_assets()
1684 {
1685 // Assets are now handled by AssetManager, but we still need to localize the script
1686 $this->localize_editor_script();
1687 }
1688
1689 /**
1690 * Localize editor script with necessary data
1691 * Note: Localization is now handled by LocalizationManager
1692 */
1693 private function localize_editor_script()
1694 {
1695 // Localization is now handled by LocalizationManager
1696 // This method is kept for backward compatibility but functionality has been moved
1697 }
1698
1699 /**
1700 * Add a new block to the available blocks list
1701 */
1702 public function add_block($folder_name, $config)
1703 {
1704 $this->available_blocks[$folder_name] = $config;
1705 }
1706
1707 /**
1708 * Ensure default blocks are enabled if no settings exist
1709 */
1710 private function ensure_default_blocks_enabled()
1711 {
1712 $elements = (array) get_option(EMBEDPRESS_PLG_NAME . ":elements", []);
1713
1714 // If no gutenberg settings exist, create default ones
1715 if (!isset($elements['gutenberg'])) {
1716 $elements['gutenberg'] = [];
1717 }
1718
1719 // Enable embedpress block by default
1720 if (!isset($elements['gutenberg']['embedpress'])) {
1721 $elements['gutenberg']['embedpress'] = 'embedpress';
1722 }
1723
1724 // Enable embedpress-pdf block by default
1725 if (!isset($elements['gutenberg']['embedpress-pdf'])) {
1726 $elements['gutenberg']['embedpress-pdf'] = 'embedpress-pdf';
1727 }
1728
1729 // Enable youtube-block by default for legacy support
1730 if (!isset($elements['gutenberg']['youtube-block'])) {
1731 $elements['gutenberg']['youtube-block'] = 'youtube-block';
1732 }
1733
1734 // Enable wistia-block by default for legacy support
1735 if (!isset($elements['gutenberg']['wistia-block'])) {
1736 $elements['gutenberg']['wistia-block'] = 'wistia-block';
1737 }
1738
1739 // Enable pdf-gallery block by default
1740 if (!isset($elements['gutenberg']['pdf-gallery'])) {
1741 $elements['gutenberg']['pdf-gallery'] = 'pdf-gallery';
1742 }
1743
1744 // Update options if any changes were made
1745 update_option(EMBEDPRESS_PLG_NAME . ":elements", $elements);
1746 }
1747
1748 /**
1749 * Get available blocks
1750 */
1751 public function get_available_blocks()
1752 {
1753 return $this->available_blocks;
1754 }
1755 }
1756