PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 3.1.2
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v3.1.2
4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 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 / Elementor / Widgets / Embedpress_Elementor.php
embedpress / EmbedPress / Elementor / Widgets Last commit date
Embedpress_Document.php 5 years ago Embedpress_Elementor.php 5 years ago
Embedpress_Elementor.php
1524 lines
1 <?php
2
3 namespace EmbedPress\Elementor\Widgets;
4
5
6 use \Elementor\Controls_Manager as Controls_Manager;
7 use Elementor\Group_Control_Background;
8 use \Elementor\Group_Control_Css_Filter;
9 use Elementor\Group_Control_Image_Size;
10 use \Elementor\Widget_Base as Widget_Base;
11 use \EmbedPress\Shortcode;
12
13 (defined( 'ABSPATH' )) or die( "No direct script access allowed." );
14
15 class Embedpress_Elementor extends Widget_Base {
16 protected $pro_class = '';
17 protected $pro_text = '';
18 public function get_name() {
19 return 'embedpres_elementor';
20 }
21
22 public function get_title() {
23 return esc_html__( 'EmbedPress', 'embedpress' );
24 }
25
26 public function get_categories() {
27 return [ 'embedpress' ];
28 }
29
30 public function get_custom_help_url() {
31 return 'https://embedpress.com/documentation';
32 }
33
34 public function get_icon() {
35 return 'icon-embedpress';
36 }
37
38 /**
39 * Get widget keywords.
40 *
41 * Retrieve the list of keywords the widget belongs to.
42 *
43 * @return array Widget keywords.
44 * @since 2.4.1
45 * @access public
46 *
47 */
48 public function get_keywords() {
49 return [
50 'embedpress',
51 'audio',
52 'video',
53 'map',
54 'youtube',
55 'vimeo',
56 'wistia',
57 'twitch',
58 'soundcloud',
59 'giphy gifs',
60 'spotify',
61 'smugmug',
62 'meetup',
63 'dailymotion',
64 'instagram',
65 'slideshare',
66 'flickr',
67 'ted',
68 'google docs',
69 'google slides',
70 'google drawings'
71 ];
72 }
73
74 protected function _register_controls() {
75 $this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
76 $this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
77 /**
78 * EmbedPress Content Settings
79 */
80 $this->start_controls_section(
81 'embedpress_elementor_content_settings',
82 [
83 'label' => esc_html__( 'Content Settings', 'embedpress' ),
84 ]
85 );
86
87 do_action( 'embedpress/embeded/extend', $this );
88 $this->add_control(
89 'embedpress_pro_embeded_source',
90 [
91 'label' => __( 'Source Name', 'embedpress' ),
92 'type' => Controls_Manager::SELECT,
93 'label_block' => false,
94 'default' => ['default'],
95 'options' => [
96 'default' => __( 'Default', 'embedpress' ),
97 'youtube' => __( 'YouTube', 'embedpress' ),
98 'vimeo' => __( 'Vimeo', 'embedpress' ),
99 'dailymotion' => __( 'Dailymotion', 'embedpress' ),
100 'wistia' => __( 'Wistia', 'embedpress' ),
101 'twitch' => __( 'Twitch', 'embedpress' ),
102 'soundcloud' => __( 'SoundCloud', 'embedpress' ),
103 ]
104 ]
105 );
106 $this->add_control(
107 'embedpress_embeded_link',
108 [
109
110 'label' => __( 'Embedded Link', 'embedpress' ),
111 'type' => Controls_Manager::TEXT,
112 'dynamic' => [
113 'active' => true,
114 ],
115 'placeholder' => __( 'Enter your Link', 'embedpress' ),
116 'label_block' => true
117
118 ]
119 );
120 $this->add_control(
121 'spotify_theme',
122 [
123 'label' => __( 'Player Background', 'embedpress' ),
124 'description' => __( 'Dynamic option will use the most vibrant color from the album art.', 'embedpress' ),
125 'type' => Controls_Manager::SELECT,
126 'label_block' => false,
127 'default' => '1',
128 'options' => [
129 '1' => __( 'Dynamic', 'embedpress' ),
130 '0' => __( 'Black & White', 'embedpress' )
131 ],
132 'condition' => [
133 'embedpress_pro_embeded_source' => 'spotify'
134 ]
135 ]
136 );
137 do_action( 'embedpress/control/extend', $this );
138 $this->add_control(
139 'embedpress_pro_video_start_time',
140 [
141 'label' => __( 'Start Time', 'embedpress' ),
142 'type' => Controls_Manager::NUMBER,
143 'description' => __( 'Specify a start time (in seconds)', 'embedpress' ),
144 'condition' => [
145 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'wistia', 'dailymotion', 'twitch']
146 ],
147 ]
148 );
149 $this->init_youtube_controls();
150 $this->init_vimeo_controls();
151 $this->init_wistia_controls();
152 $this->init_soundcloud_controls();
153 $this->init_dailymotion_control();
154 $this->init_twitch_control();
155
156 $this->end_controls_section();
157
158 $this->init_youtube_subscription_section();
159 $this->init_youtube_livechat_section();
160
161 if (! is_embedpress_pro_active()) {
162 $this->start_controls_section(
163 'embedpress_pro_section',
164 [
165 'label' => __('Go Premium for More Features', 'embedpress'),
166 ]
167 );
168
169 $this->add_control(
170 'embedpress_pro_cta',
171 [
172 'label' => __('Unlock more possibilities', 'embedpress'),
173 'type' => Controls_Manager::CHOOSE,
174 'options' => [
175 '1' => [
176 'title' => '',
177 'icon' => 'fa fa-unlock-alt',
178 ],
179 ],
180 'default' => '1',
181 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.net/in/upgrade-embedpress" target="_blank">Pro version</a> for more provider support and customization options.</span>',
182 ]
183 );
184
185 $this->end_controls_section();
186 }
187
188 $this->init_style_controls();
189 }
190 public function init_youtube_controls() {
191 $yt_condition = [
192 'embedpress_pro_embeded_source' => 'youtube'
193 ];
194 $this->add_control(
195 'embedpress_pro_youtube_end_time',
196 [
197 'label' => __( 'End Time', 'embedpress' ),
198 'type' => Controls_Manager::NUMBER,
199 'description' => __( 'Specify an end time (in seconds)', 'embedpress' ),
200 'condition' => $yt_condition,
201 ]
202 );
203 $this->add_control(
204 'embedpress_pro_youtube_auto_play',
205 [
206 'label' => __( 'Auto Play', 'embedpress' ),
207 'type' => Controls_Manager::SWITCHER,
208 'label_block' => false,
209 'return_value' => 'yes',
210 'default' => 'no',
211 'condition' => $yt_condition,
212 ]
213 );
214 $this->add_control(
215 'embedpress_pro_youtube_player_options',
216 [
217 'label' => __( 'Player Options', 'embedpress' ),
218 'type' => Controls_Manager::HEADING,
219 'condition' => $yt_condition,
220 ]
221 );
222 $this->add_control(
223 'embedpress_pro_youtube_display_controls',
224 [
225 'label' => __( 'Controls', 'embedpress' ),
226 'type' => Controls_Manager::SELECT,
227 'label_block' => false,
228 'default' => 1,
229 'options' => [
230 '1' => __( 'Display immediately', 'embedpress' ),
231 '2' => __( 'Display after user initiation', 'embedpress' ),
232 '0' => __( 'Hide controls', 'embedpress' )
233 ],
234 'condition' => $yt_condition,
235 ]
236 );
237 $this->add_control(
238 'embedpress_pro_youtube_enable_fullscreen_button',
239 [
240 'label' => __( 'Fullscreen button', 'embedpress' ),
241 'type' => Controls_Manager::SWITCHER,
242 'label_block' => false,
243 'return_value' => 'yes',
244 'default' => 'yes',
245 'condition' => [
246 'embedpress_pro_embeded_source' => 'youtube',
247 'embedpress_pro_youtube_display_controls!' => '0'
248 ]
249 ]
250 );
251 $this->add_control(
252 'embedpress_pro_youtube_display_video_annotations',
253 [
254 'label' => __( 'Video Annotations', 'embedpress' ),
255 'type' => Controls_Manager::SWITCHER,
256 'label_block' => false,
257 'default' => 1,
258 'options' => [
259 '1' => __( 'Display', 'embedpress' ),
260 '3' => __( 'Do Not Display', 'embedpress' )
261 ],
262 'condition' => $yt_condition,
263 ]
264 );
265 //--- Youtube Pro control starts ---
266 $this->add_control(
267 'embedpress_pro_youtube_progress_bar_color',
268 [
269 'label' => __( 'Progress Bar Color', 'embedpress' ),
270 'type' => Controls_Manager::SELECT,
271 'label_block' => false,
272 'default' => 'red',
273 'options' => [
274 'red' => __( 'Red', 'embedpress' ),
275 'white' => __( 'White', 'embedpress' )
276 ],
277 'condition' => $yt_condition,
278 ]
279 );
280 $this->add_control(
281 'embedpress_pro_youtube_force_closed_captions',
282 [
283 'label' => sprintf(__( 'Closed Captions %s', 'embedpress' ), $this->pro_text ),
284 'type' => Controls_Manager::SWITCHER,
285 'label_block' => false,
286 'return_value' => 'yes',
287 'default' => 'no',
288 'separator' => 'before',
289 'classes' => $this->pro_class,
290 'condition' => $yt_condition,
291 ]
292 );
293 $this->add_control(
294 'embedpress_pro_youtube_modest_branding',
295 [
296 'label' => sprintf(__( 'Modest Branding %s', 'embedpress' ), $this->pro_text ),
297 'type' => Controls_Manager::SELECT,
298 'label_block' => false,
299 'default' => 1,
300 'options' => [
301 '0' => __( 'Display', 'embedpress' ),
302 '1' => __( 'Do Not Display', 'embedpress' )
303 ],
304 'condition' => [
305 'embedpress_pro_embeded_source' => 'youtube',
306 'embedpress_pro_youtube_display_controls!' => '0',
307 'embedpress_pro_youtube_progress_bar_color!' => 'white'
308 ],
309 'classes' => $this->pro_class,
310 ]
311 );
312 $this->add_control(
313 'embedpress_pro_youtube_display_related_videos',
314 [
315 'label' => __( 'Related Videos', 'embedpress' ),
316 'description' => __( 'Set it to "Yes" to display related videos from all channels. Otherwise, related videos will show from the same channel.', 'embedpress' ),
317 'type' => Controls_Manager::SWITCHER,
318 'label_block' => false,
319 'return_value' => 'yes',
320 'default' => 'yes',
321 'condition' => $yt_condition,
322 ]
323 );
324 $this->init_branding_controls( 'youtube');
325 }
326
327 public function init_youtube_subscription_section() {
328 $yt_condition = [
329 'embedpress_pro_embeded_source' => 'youtube',
330 ];
331 $this->start_controls_section(
332 'embedpress_yt_subscription_section',
333 [
334 'label' => __( 'YouTube Subscriber', 'embedpress' ),
335 'condition' => $yt_condition,
336
337 ]
338 );
339
340
341 $this->add_control(
342 'yt_sub_channel',
343 [
344
345 'label' => sprintf( __( 'Channel Link or ID %s', 'embedpress' ), $this->pro_text),
346 'type' => Controls_Manager::TEXT,
347 'dynamic' => [
348 'active' => true,
349 ],
350 'placeholder' => __( 'Enter Channel Link or ID', 'embedpress' ),
351 'label_block' => true,
352 'condition' => $yt_condition,
353 'classes' => $this->pro_class,
354 ]
355 );
356 $this->add_control(
357 'yt_sub_text',
358 [
359
360 'label' => sprintf( __( 'Subscription Text %s', 'embedpress' ), $this->pro_text),
361 'type' => Controls_Manager::TEXT,
362 'dynamic' => [
363 'active' => true,
364 ],
365 'placeholder' => __( 'Eg. Don\'t miss out! Subscribe', 'embedpress' ),
366 'label_block' => true,
367 'condition' => $yt_condition,
368 'classes' => $this->pro_class,
369 ]
370 );
371
372
373 $this->add_control(
374 'yt_sub_layout',
375 [
376 'label' => sprintf(__( 'Layout %s', 'embedpress' ), $this->pro_text ),
377 'type' => Controls_Manager::SELECT,
378 'label_block' => false,
379 'default' => 'default',
380 'options' => [
381 'default' => __( 'Default', 'embedpress' ),
382 'full' => __( 'Full', 'embedpress' )
383 ],
384 'condition' => [
385 'embedpress_pro_embeded_source' => 'youtube',
386 ],
387 'classes' => $this->pro_class,
388 ]
389 );
390
391 $this->add_control(
392 'yt_sub_theme',
393 [
394 'label' => sprintf(__( 'Theme %s', 'embedpress' ), $this->pro_text ),
395 'type' => Controls_Manager::SELECT,
396 'label_block' => false,
397 'default' => 'default',
398 'options' => [
399 'default' => __( 'Default', 'embedpress' ),
400 'dark' => __( 'Dark', 'embedpress' )
401 ],
402 'condition' => [
403 'embedpress_pro_embeded_source' => 'youtube',
404 ],
405 'classes' => $this->pro_class,
406 ]
407 );
408
409 $this->add_control(
410 'yt_sub_count',
411 [
412 'label' => sprintf(__( 'Subscriber Count %s', 'embedpress' ), $this->pro_text ),
413 'type' => Controls_Manager::SWITCHER,
414 'label_block' => false,
415 'return_value' => 'yes',
416 'default' => 'yes',
417 'condition' => $yt_condition,
418 'classes' => $this->pro_class,
419 ]
420 );
421
422 $this->end_controls_section();
423
424 }
425 public function init_youtube_livechat_section() {
426 $yt_condition = [
427 'embedpress_pro_embeded_source' => 'youtube',
428 ];
429 $this->start_controls_section(
430 'embedpress_yt_livechat_section',
431 [
432 'label' => __( 'YouTube Live Chat', 'embedpress' ),
433 'condition' => $yt_condition,
434
435 ]
436 );
437
438 $this->add_control(
439 'yt_lc_show',
440 [
441 'label' => sprintf(__( 'Show YouTube Live Chat %s', 'embedpress' ), $this->pro_text ),
442 'type' => Controls_Manager::SWITCHER,
443 'label_block' => false,
444 'return_value' => 'yes',
445 'default' => '',
446 'label_off' => __( 'Hide', 'embedpress' ),
447 'label_on' => __( 'Show', 'embedpress' ),
448 'condition' => $yt_condition,
449 'classes' => $this->pro_class,
450 ]
451 );
452
453
454 $this->end_controls_section();
455
456 }
457 public function init_dailymotion_control ( ){
458 $this->add_control(
459 'embedpress_pro_dailymotion_logo',
460 [
461 'label' => sprintf(__( 'Logo %s', 'embedpress' ), $this->pro_text ),
462 'type' => Controls_Manager::SWITCHER,
463 'label_block' => false,
464 'return_value' => 'yes',
465 'default' => 'yes',
466 'label_off' => __( 'Hide', 'embedpress' ),
467 'label_on' => __( 'Show', 'embedpress' ),
468 'condition' => [
469 'embedpress_pro_embeded_source' => 'dailymotion'
470 ],
471 'classes' => $this->pro_class,
472 ]
473 );
474 $this->add_control(
475 'embedpress_pro_dailymotion_autoplay',
476 [
477 'label' => __( 'Auto Play', 'embedpress' ),
478 'type' => Controls_Manager::SWITCHER,
479 'label_block' => false,
480 'return_value' => 'yes',
481 'default' => 'no',
482 'label_off' => __( 'Hide', 'embedpress' ),
483 'label_on' => __( 'Show', 'embedpress' ),
484 'condition' => [
485 'embedpress_pro_embeded_source' => 'dailymotion'
486 ]
487 ]
488 );
489
490 $this->add_control(
491 'embedpress_pro_dailymotion_play_on_mobile',
492 [
493 'label' => __( 'Play On Mobile', 'embedpress' ),
494 'type' => Controls_Manager::SWITCHER,
495 'label_block' => false,
496 'return_value' => 'yes',
497 'default' => 'no',
498 'label_off' => __( 'Hide', 'embedpress' ),
499 'label_on' => __( 'Show', 'embedpress' ),
500 'condition' => [
501 'embedpress_pro_embeded_source' => 'dailymotion',
502 'embedpress_pro_dailymotion_autoplay' => 'yes'
503 ]
504 ]
505 );
506
507 $this->add_control(
508 'embedpress_pro_dailymotion_mute',
509 [
510 'label' => __( 'Mute', 'embedpress' ),
511 'type' => Controls_Manager::SWITCHER,
512 'label_block' => false,
513 'return_value' => 'yes',
514 'default' => 'no',
515 'label_off' => __( 'Hide', 'embedpress' ),
516 'label_on' => __( 'Show', 'embedpress' ),
517 'condition' => [
518 'embedpress_pro_embeded_source' => 'dailymotion'
519 ]
520 ]
521 );
522
523 $this->add_control(
524 'embedpress_pro_dailymotion_player_control',
525 [
526 'label' => __( 'Player Controls', 'embedpress' ),
527 'type' => Controls_Manager::SWITCHER,
528 'label_block' => false,
529 'return_value' => 'yes',
530 'default' => 'yes',
531 'label_off' => __( 'Hide', 'embedpress' ),
532 'label_on' => __( 'Show', 'embedpress' ),
533 'condition' => [
534 'embedpress_pro_embeded_source' => 'dailymotion'
535 ]
536 ]
537 );
538
539 $this->add_control(
540 'embedpress_pro_dailymotion_video_info',
541 [
542 'label' => __( 'Video Info', 'embedpress' ),
543 'type' => Controls_Manager::SWITCHER,
544 'label_block' => false,
545 'return_value' => 'yes',
546 'default' => 'yes',
547 'label_off' => __( 'Hide', 'embedpress' ),
548 'label_on' => __( 'Show', 'embedpress' ),
549 'condition' => [
550 'embedpress_pro_embeded_source' => 'dailymotion'
551 ]
552 ]
553 );
554
555
556
557 $this->add_control(
558 'embedpress_pro_dailymotion_control_color',
559 [
560 'label' => __( 'Control Color', 'embedpress' ),
561 'type' => Controls_Manager::COLOR,
562 'label_block' => false,
563 'default' => '#dd3333',
564 'condition' => [
565 'embedpress_pro_embeded_source' => 'dailymotion'
566 ]
567 ]
568 );
569 }
570 public function init_wistia_controls( ) {
571 $this->add_control(
572 'embedpress_pro_wistia_auto_play',
573 [
574 'label' => __( 'Auto Play', 'embedpress' ),
575 'type' => Controls_Manager::SWITCHER,
576 'label_block' => false,
577 'return_value' => 'yes',
578 'default' => 'no',
579 'condition' => [
580 'embedpress_pro_embeded_source' => 'wistia'
581 ],
582 ]
583 );
584
585 $this->add_control(
586 'embedpress_pro_wistia_color',
587 [
588 'label' => __( 'Scheme', 'embedpress' ),
589 'type' => Controls_Manager::COLOR,
590 'label_block' => false,
591 'default' => '#dd3333',
592 'condition' => [
593 'embedpress_pro_embeded_source' => 'wistia'
594 ]
595 ]
596 );
597
598
599
600 $this->add_control(
601 'embedpress_pro_wistia_captions_enabled_by_default',
602 [
603 'label' => __( 'Captions Enabled By Default', 'embedpress' ),
604 'type' => Controls_Manager::SWITCHER,
605 'label_block' => false,
606 'return_value' => 'yes',
607 'default' => 'no',
608 'condition' => [
609 'embedpress_pro_embeded_source' => 'wistia',
610 'embedpress_pro_wistia_captions' => 'yes'
611 ],
612 'classes' => $this->pro_class,
613 ]
614 );
615
616 $this->add_control(
617 'embedpress_pro_wistia_player_options',
618 [
619 'label' => __( 'Player Options', 'embedpress' ),
620 'type' => Controls_Manager::HEADING,
621 'separator' => 'before',
622 'condition' => [
623 'embedpress_pro_embeded_source' => 'wistia'
624 ]
625 ]
626 );
627
628
629
630 $this->add_control(
631 'embedpress_pro_wistia_fullscreen_button',
632 [
633 'label' => __( 'Fullscreen Button', 'embedpress' ),
634 'type' => Controls_Manager::SWITCHER,
635 'label_block' => false,
636 'return_value' => 'yes',
637 'default' => 'no',
638 'condition' => [
639 'embedpress_pro_embeded_source' => 'wistia'
640 ],
641 ]
642 );
643
644 $this->add_control(
645 'embedpress_pro_wistia_small_play_button',
646 [
647 'label' => __( 'Small Play Button', 'embedpress' ),
648 'type' => Controls_Manager::SWITCHER,
649 'label_block' => false,
650 'return_value' => 'yes',
651 'default' => 'no',
652 'condition' => [
653 'embedpress_pro_embeded_source' => 'wistia'
654 ],
655 ]
656 );
657
658
659
660
661 $this->add_control(
662 'embedpress_pro_wistia_resumable',
663 [
664 'label' => __( 'Resumable', 'embedpress' ),
665 'type' => Controls_Manager::SWITCHER,
666 'label_block' => false,
667 'return_value' => 'yes',
668 'default' => 'no',
669 'condition' => [
670 'embedpress_pro_embeded_source' => 'wistia'
671 ],
672 ]
673 );
674
675
676 $this->add_control(
677 'embedpress_pro_wistia_focus',
678 [
679 'label' => __( 'Focus', 'embedpress' ),
680 'type' => Controls_Manager::SWITCHER,
681 'label_block' => false,
682 'return_value' => 'yes',
683 'default' => 'no',
684 'condition' => [
685 'embedpress_pro_embeded_source' => 'wistia'
686 ],
687 ]
688 );
689
690 // --- Wistia PRO Controls --
691 $this->add_control(
692 'embedpress_pro_wistia_captions',
693 [
694 'label' => sprintf(__( 'Captions %s', 'embedpress' ), $this->pro_text ),
695 'type' => Controls_Manager::SWITCHER,
696 'label_block' => false,
697 'return_value' => 'yes',
698 'default' => 'no',
699 'condition' => [
700 'embedpress_pro_embeded_source' => 'wistia'
701 ],
702 'classes' => $this->pro_class,
703 ]
704 );
705 $this->add_control(
706 'embedpress_pro_wistia_playbar',
707 [
708 'label' => __( 'Playbar ', 'embedpress' ),
709 'type' => Controls_Manager::SWITCHER,
710 'label_block' => false,
711 'return_value' => 'yes',
712 'default' => 'no',
713 'condition' => [
714 'embedpress_pro_embeded_source' => 'wistia'
715 ],
716 ]
717 );
718
719 $this->add_control(
720 'embedpress_pro_wistia_volume_control',
721 [
722 'label' => sprintf(__( 'Volume Control %s', 'embedpress' ), $this->pro_text ),
723 'type' => Controls_Manager::SWITCHER,
724 'label_block' => false,
725 'return_value' => 'yes',
726 'default' => 'yes',
727 'condition' => [
728 'embedpress_pro_embeded_source' => 'wistia'
729 ],
730 'classes' => $this->pro_class,
731 ]
732 );
733
734
735 $this->add_control(
736 'embedpress_pro_wistia_volume',
737 [
738 'label' => sprintf(__( 'Volume %s', 'embedpress' ), $this->pro_text ),
739 'type' => Controls_Manager::SLIDER,
740 'default' => [
741 'size' => 100,
742 ],
743 'range' => [
744 'px' => [
745 'min' => 0,
746 'max' => 100,
747 ]
748 ],
749 'condition' => [
750 'embedpress_pro_embeded_source' => 'wistia',
751 'embedpress_pro_wistia_volume_control' => 'yes'
752 ],
753 'classes' => $this->pro_class,
754 ]
755 );
756
757 $this->add_control(
758 'embedpress_pro_wistia_rewind',
759 [
760 'label' => __( 'Rewind', 'embedpress' ),
761 'type' => Controls_Manager::SWITCHER,
762 'label_block' => false,
763 'return_value' => 'yes',
764 'default' => 'no',
765 'condition' => [
766 'embedpress_pro_embeded_source' => 'wistia'
767 ],
768 ]
769 );
770
771 $this->add_control(
772 'embedpress_pro_wistia_rewind_time',
773 [
774 'label' => __( 'Rewind time', 'embedpress' ),
775 'type' => Controls_Manager::SLIDER,
776 'default' => [
777 'size' => 10,
778 ],
779 'range' => [
780 'px' => [
781 'min' => 1,
782 'max' => 100,
783 ]
784 ],
785 'condition' => [
786 'embedpress_pro_wistia_rewind' => 'yes',
787 'embedpress_pro_embeded_source' => 'wistia'
788 ],
789 ]
790 );
791 $this->init_branding_controls( 'wistia');
792
793 }
794 public function init_twitch_control( ) {
795 $condition = [
796 'embedpress_pro_embeded_source' => 'twitch'
797 ];
798 $this->add_control(
799 'embedpress_pro_twitch_autoplay',
800 [
801 'label' => __( 'Autoplay', 'embedpress' ),
802 'type' => Controls_Manager::SWITCHER,
803 'label_off' => __( 'No', 'embedpress' ),
804 'label_on' => __( 'Yes', 'embedpress' ),
805 'default' => 'yes',
806 'condition' => $condition,
807 ]
808 );
809 $this->add_control(
810 'embedpress_pro_fs',
811 [
812 'label' => __( 'Allow Full Screen Video', 'embedpress' ),
813 'type' => Controls_Manager::SWITCHER,
814 'label_off' => __( 'No', 'embedpress' ),
815 'label_on' => __( 'Yes', 'embedpress' ),
816 'default' => 'yes',
817 'condition' => $condition,
818 ]
819 );
820
821 // -- Twitch PRO controls --
822 $this->add_control(
823 'embedpress_pro_twitch_chat',
824 [
825 'label' => sprintf(__( 'Show Chat %s', 'embedpress' ), $this->pro_text ),
826 'type' => Controls_Manager::SWITCHER,
827 'label_off' => __( 'Hide', 'embedpress' ),
828 'label_on' => __( 'Show', 'embedpress' ),
829 'condition' => $condition,
830 'classes' => $this->pro_class,
831
832 ]
833 );
834 $this->add_control(
835 'embedpress_pro_twitch_mute',
836 [
837 'label' => __( 'Mute on start', 'embedpress' ),
838 'type' => Controls_Manager::SWITCHER,
839 'label_off' => __( 'Hide', 'embedpress' ),
840 'label_on' => __( 'Show', 'embedpress' ),
841 'condition' => $condition,
842 ]
843 );
844 $this->add_control(
845 'embedpress_pro_twitch_theme',
846 [
847 'label' => __( 'Theme', 'embedpress' ),
848 'type' => Controls_Manager::SELECT,
849 'default' => 'dark',
850 'options' => [
851 'dark' => __( 'Dark', 'embedpress' ),
852 'light' => __( 'Light', 'embedpress' ),
853 ],
854 'condition' => $condition,
855 ]
856 );
857
858 $this->init_branding_controls( 'twitch');
859
860 }
861 public function init_soundcloud_controls( ) {
862 $this->add_control(
863 'embedpress_pro_soundcloud_visual',
864 [
865 'label' => __( 'Visual Player', 'embedpress' ),
866 'type' => Controls_Manager::SWITCHER,
867 'label_block' => false,
868 'return_value' => 'yes',
869 'default' => 'no',
870 'label_off' => __( 'Hide', 'embedpress' ),
871 'label_on' => __( 'Show', 'embedpress' ),
872 'condition' => [
873 'embedpress_pro_embeded_source' => 'soundcloud'
874 ],
875 ]
876 );
877
878 $this->add_control(
879 'embedpress_pro_soundcloud_color',
880 [
881 'label' => __( 'Scheme', 'embedpress' ),
882 'type' => Controls_Manager::COLOR,
883 'label_block' => false,
884 'default' => '#FF5500',
885 'condition' => [
886 'embedpress_pro_embeded_source' => 'soundcloud'
887 ]
888 ]
889 );
890
891 $this->add_control(
892 'embedpress_pro_soundcloud_autoplay',
893 [
894 'label' => __( 'Auto Play', 'embedpress' ),
895 'type' => Controls_Manager::SWITCHER,
896 'label_block' => false,
897 'return_value' => 'yes',
898 'default' => 'no',
899 'label_off' => __( 'Hide', 'embedpress' ),
900 'label_on' => __( 'Show', 'embedpress' ),
901 'condition' => [
902 'embedpress_pro_embeded_source' => 'soundcloud'
903 ],
904 ]
905 );
906
907
908
909 $this->add_control(
910 'embedpress_pro_soundcloud_share_button',
911 [
912 'label' => __( 'Share Button', 'embedpress' ),
913 'type' => Controls_Manager::SWITCHER,
914 'label_block' => false,
915 'return_value' => 'yes',
916 'default' => 'yes',
917 'label_off' => __( 'Hide', 'embedpress' ),
918 'label_on' => __( 'Show', 'embedpress' ),
919 'condition' => [
920 'embedpress_pro_embeded_source' => 'soundcloud'
921 ],
922 ]
923 );
924
925 $this->add_control(
926 'embedpress_pro_soundcloud_comments',
927 [
928 'label' => __( 'Comments', 'embedpress' ),
929 'type' => Controls_Manager::SWITCHER,
930 'label_block' => false,
931 'return_value' => 'yes',
932 'default' => 'yes',
933 'label_off' => __( 'Hide', 'embedpress' ),
934 'label_on' => __( 'Show', 'embedpress' ),
935 'condition' => [
936 'embedpress_pro_embeded_source' => 'soundcloud'
937 ],
938 ]
939 );
940
941
942
943 $this->add_control(
944 'embedpress_pro_soundcloud_artwork',
945 [
946 'label' => __( 'Artwork', 'embedpress' ),
947 'type' => Controls_Manager::SWITCHER,
948 'label_block' => false,
949 'return_value' => 'yes',
950 'default' => 'yes',
951 'label_off' => __( 'Hide', 'embedpress' ),
952 'label_on' => __( 'Show', 'embedpress' ),
953 'condition' => [
954 'embedpress_pro_embeded_source' => 'soundcloud',
955 'embedpress_pro_soundcloud_visual!' => 'yes'
956 ]
957 ]
958 );
959
960 $this->add_control(
961 'embedpress_pro_soundcloud_play_count',
962 [
963 'label' => __( 'Play Count', 'embedpress' ),
964 'type' => Controls_Manager::SWITCHER,
965 'label_block' => false,
966 'return_value' => 'yes',
967 'default' => 'yes',
968 'label_off' => __( 'Hide', 'embedpress' ),
969 'label_on' => __( 'Show', 'embedpress' ),
970 'condition' => [
971 'embedpress_pro_embeded_source' => 'soundcloud',
972 'embedpress_pro_soundcloud_visual!' => 'yes'
973 ],
974 ]
975 );
976
977 $this->add_control(
978 'embedpress_pro_soundcloud_user_name',
979 [
980 'label' => __( 'User Name', 'embedpress' ),
981 'type' => Controls_Manager::SWITCHER,
982 'label_block' => false,
983 'return_value' => 'yes',
984 'default' => 'yes',
985 'label_off' => __( 'Hide', 'embedpress' ),
986 'label_on' => __( 'Show', 'embedpress' ),
987 'condition' => [
988 'embedpress_pro_embeded_source' => 'soundcloud'
989 ],
990 ]
991 );
992
993 $this->add_control(
994 'embedpress_pro_soundcloud_buy_button',
995 [
996 'label' => sprintf(__( 'Buy Button %s', 'embedpress' ), $this->pro_text ),
997 'type' => Controls_Manager::SWITCHER,
998 'label_block' => false,
999 'return_value' => 'yes',
1000 'default' => 'yes',
1001 'label_off' => __( 'Hide', 'embedpress' ),
1002 'label_on' => __( 'Show', 'embedpress' ),
1003 'condition' => [
1004 'embedpress_pro_embeded_source' => 'soundcloud'
1005 ],
1006 'classes' => $this->pro_class,
1007 ]
1008 );
1009 $this->add_control(
1010 'embedpress_pro_soundcloud_download_button',
1011 [
1012 'label' => sprintf(__( 'Download Button %s', 'embedpress' ), $this->pro_text ),
1013 'type' => Controls_Manager::SWITCHER,
1014 'label_block' => false,
1015 'return_value' => 'yes',
1016 'default' => 'yes',
1017 'label_off' => __( 'Hide', 'embedpress' ),
1018 'label_on' => __( 'Show', 'embedpress' ),
1019 'condition' => [
1020 'embedpress_pro_embeded_source' => 'soundcloud'
1021 ],
1022 'classes' => $this->pro_class,
1023 ]
1024 );
1025 }
1026 public function init_vimeo_controls( ) {
1027 $this->add_control(
1028 'embedpress_pro_vimeo_auto_play',
1029 [
1030 'label' => __( 'Auto Play', 'embedpress' ),
1031 'type' => Controls_Manager::SWITCHER,
1032 'label_block' => false,
1033 'return_value' => 'yes',
1034 'default' => 'no',
1035 'condition' => [
1036 'embedpress_pro_embeded_source' => 'vimeo'
1037 ]
1038 ]
1039 );
1040
1041
1042 $this->add_control(
1043 'embedpress_pro_vimeo_color',
1044 [
1045 'label' => __( 'Scheme', 'embedpress' ),
1046 'type' => Controls_Manager::COLOR,
1047 'label_block' => false,
1048 'default' => '#00adef',
1049 'condition' => [
1050 'embedpress_pro_embeded_source' => 'vimeo'
1051 ]
1052 ]
1053 );
1054
1055 $this->add_control(
1056 'embedpress_pro_vimeo_author_options',
1057 [
1058 'label' => __( 'Author Information', 'embedpress' ),
1059 'type' => Controls_Manager::HEADING,
1060 'separator' => 'before',
1061 'condition' => [
1062 'embedpress_pro_embeded_source' => 'vimeo'
1063 ]
1064 ]
1065 );
1066
1067 $this->add_control(
1068 'embedpress_pro_vimeo_display_title',
1069 [
1070 'label' => __( 'Title', 'embedpress' ),
1071 'type' => Controls_Manager::SWITCHER,
1072 'label_block' => false,
1073 'return_value' => 'yes',
1074 'default' => 'yes',
1075 'condition' => [
1076 'embedpress_pro_embeded_source' => 'vimeo'
1077 ]
1078 ]
1079 );
1080
1081 //----- Vimeo PRO controls
1082
1083 $this->add_control(
1084 'embedpress_pro_vimeo_display_author',
1085 [
1086 'label' => __( 'Author', 'embedpress' ),
1087 'type' => Controls_Manager::SWITCHER,
1088 'label_block' => false,
1089 'return_value' => 'yes',
1090 'default' => 'yes',
1091 'condition' => [
1092 'embedpress_pro_embeded_source' => 'vimeo'
1093 ],
1094 ]
1095 );
1096
1097 $this->add_control(
1098 'embedpress_pro_vimeo_avatar',
1099 [
1100 'label' => __( 'Avatar', 'embedpress' ),
1101 'type' => Controls_Manager::SWITCHER,
1102 'label_block' => false,
1103 'return_value' => 'yes',
1104 'default' => 'yes',
1105 'condition' => [
1106 'embedpress_pro_embeded_source' => 'vimeo'
1107 ],
1108 ]
1109 );
1110
1111 $this->add_control(
1112 'embedpress_pro_vimeo_loop',
1113 [
1114 'label' => sprintf(__( 'Loop %s', 'embedpress' ), $this->pro_text ),
1115 'type' => Controls_Manager::SWITCHER,
1116 'label_block' => false,
1117 'return_value' => 'yes',
1118 'default' => 'no',
1119 'condition' => [
1120 'embedpress_pro_embeded_source' => 'vimeo'
1121 ],
1122 'classes' => $this->pro_class,
1123 ]
1124 );
1125
1126 $this->add_control(
1127 'embedpress_pro_vimeo_autopause',
1128 [
1129 'label' => sprintf(__( 'Auto Pause %s', 'embedpress' ), $this->pro_text ),
1130 'type' => Controls_Manager::SWITCHER,
1131 'label_block' => false,
1132 'return_value' => 'yes',
1133 'default' => 'no',
1134 'condition' => [
1135 'embedpress_pro_embeded_source' => 'vimeo'
1136 ],
1137 'classes' => $this->pro_class,
1138 ]
1139 );
1140
1141 $this->add_control(
1142 'embedpress_pro_vimeo_dnt',
1143 [
1144 'label' => sprintf(__( 'DNT %s', 'embedpress' ), $this->pro_text ),
1145 'type' => Controls_Manager::SWITCHER,
1146 'label_block' => false,
1147 'return_value' => 'yes',
1148 'default' => 'yes',
1149 'description' => __( 'Set this parameter to "yes" will block the player from tracking any session data, including all cookies',
1150 'embedpress' ),
1151 'condition' => [
1152 'embedpress_pro_embeded_source' => 'vimeo'
1153 ],
1154 'classes' => $this->pro_class,
1155 ]
1156 );
1157
1158
1159 $this->init_branding_controls( 'vimeo');
1160
1161 }
1162 public function init_spotify_controls() {
1163 $condition = [
1164 'embedpress_pro_embeded_source' => 'spotify'
1165 ];
1166
1167
1168 $this->add_control(
1169 'spotify_theme',
1170 [
1171 'label' => __( 'Player Background', 'embedpress' ),
1172 'description' => __( 'Dynamic option will use the most vibrant color from the album art.', 'embedpress' ),
1173 'type' => Controls_Manager::SELECT,
1174 'label_block' => false,
1175 'default' => '1',
1176 'options' => [
1177 '1' => __( 'Dynamic', 'embedpress' ),
1178 '0' => __( 'Black & White', 'embedpress' )
1179 ],
1180 'condition' => $condition
1181 ]
1182 );
1183
1184 $this->add_control(
1185 'spotify_follow_theme',
1186 [
1187 'label' => __( 'Follow Widget Background', 'embedpress' ),
1188 'type' => Controls_Manager::SELECT,
1189 'label_block' => false,
1190 'default' => 'light',
1191 'options' => [
1192 'light' => __( 'Light', 'embedpress' ),
1193 'dark' => __( 'Dark', 'embedpress' )
1194 ],
1195 'condition' => $condition
1196 ]
1197 );
1198 }
1199 public function init_branding_controls( $provider_name='' ) {
1200 $condition = [
1201 'embedpress_pro_embeded_source' => $provider_name,
1202 ];
1203 $logo_condition = [
1204 'embedpress_pro_embeded_source' => $provider_name,
1205 "embedpress_pro_{$provider_name}_logo[url]!" =>''
1206 ];
1207 $this->add_control(
1208 "{$provider_name}_custom_logo_cta_heading",
1209 [
1210 'label' => __( 'Custom Logo & CTA', 'embedpress' ),
1211 'type' => Controls_Manager::HEADING,
1212 'separator' => 'before',
1213 'condition' => $condition,
1214 ]
1215 );
1216 $this->add_control(
1217 "embedpress_pro_{$provider_name}_logo",
1218 [
1219 'label' => sprintf(__( 'Custom Logo %s', 'embedpress' ), $this->pro_text ),
1220 'description' => __( 'Leave it empty to hide it', 'embedpress' ),
1221 'type' => Controls_Manager::MEDIA,
1222 'dynamic' => [
1223 'active' => true,
1224 ],
1225 'condition' => $condition,
1226 'classes' => $this->pro_class,
1227 ]
1228 );
1229 $this->add_group_control(
1230 Group_Control_Image_Size::get_type(),
1231 [
1232 'name' => "embedpress_pro_{$provider_name}_logo",
1233 'default' => 'full',
1234 'condition' => $logo_condition,
1235 'classes' => $this->pro_class,
1236 ]
1237 );
1238 $this->add_responsive_control(
1239 "embedpress_pro_{$provider_name}_logo_xpos",
1240 [
1241 'label' => __( 'Logo X Position', 'embedpress' ),
1242 'description' => __( 'Change this number to move your logo in horizontal direction.', 'embedpress' ),
1243 'type' => Controls_Manager::SLIDER,
1244 'size_units' => [ 'px', '%' ],
1245 'range' => [
1246 'px' => [
1247 'min' => 0,
1248 'max' => 1000,
1249 'step' => 5,
1250 ],
1251 '%' => [
1252 'min' => 0,
1253 'max' => 100,
1254 ],
1255 ],
1256 'default' => [
1257 'unit' => '%',
1258 'size' => 10,
1259 ],
1260 'selectors' => [
1261 "{{WRAPPER}} .ose-{$provider_name} .watermark" => 'right: {{SIZE}}{{UNIT}};',
1262 ],
1263 'condition' => $logo_condition,
1264 'classes' => $this->pro_class,
1265 ]
1266 );
1267 $this->add_responsive_control(
1268 "embedpress_pro_{$provider_name}_logo_ypos",
1269 [
1270 'label' => __( 'Logo Y Position (%)', 'embedpress' ),
1271 'description' => __( 'Change this number to move your logo in vertical direction.', 'embedpress' ),
1272 'type' => Controls_Manager::SLIDER,
1273 'size_units' => [ 'px', '%' ],
1274 'range' => [
1275 'px' => [
1276 'min' => 0,
1277 'max' => 1000,
1278 'step' => 5,
1279 ],
1280 '%' => [
1281 'min' => 0,
1282 'max' => 100,
1283 ],
1284 ],
1285 'default' => [
1286 'unit' => '%',
1287 'size' => 10,
1288 ],
1289 'selectors' => [
1290 "{{WRAPPER}} .ose-{$provider_name} .watermark" => 'bottom: {{SIZE}}{{UNIT}};',
1291 ],
1292 'condition' => $logo_condition,
1293 'classes' => $this->pro_class,
1294
1295 ]
1296 );
1297 $this->start_controls_tabs(
1298 "ep_{$provider_name}_cta_style_tabs",
1299 [
1300 'condition' => $logo_condition,
1301 ]
1302 );
1303 $this->start_controls_tab( "ep_{$provider_name}_cta_normal_tab",
1304 [
1305 'label' => __( 'Normal', 'embedpress' ),
1306 ]
1307 );
1308 $this->add_control(
1309 "embedpress_pro_{$provider_name}_logo_opacity",
1310 [
1311 'label' => __( 'Logo Opacity', 'embedpress' ),
1312 'type' => Controls_Manager::SLIDER,
1313 'default' => [
1314 'size' => .5,
1315 ],
1316 'range' => [
1317 'px' => [
1318 'max' => 1,
1319 'step' => 0.01,
1320 ],
1321 ],
1322 'selectors' => [
1323 "{{WRAPPER}} .ose-{$provider_name} .watermark" => 'opacity: {{SIZE}};',
1324 ],
1325 'condition' => $logo_condition,
1326 'classes' => $this->pro_class,
1327
1328 ]
1329 );
1330 $this->end_controls_tab();
1331 $this->start_controls_tab( "ep_{$provider_name}_cta_hover__tab",
1332 [
1333 'label' => __( 'Hover', 'embedpress' ),
1334 ]
1335 );
1336 $this->add_control(
1337 "embedpress_pro_{$provider_name}_logo_opacity_hover",
1338 [
1339 'label' => __( 'Logo Opacity', 'embedpress' ),
1340 'type' => Controls_Manager::SLIDER,
1341 'size_units' => [ '%'],
1342 'default' => [
1343 'size' => 1,
1344 ],
1345 'range' => [
1346 'px' => [
1347 'max' => 1,
1348 'step' => 0.01,
1349 ],
1350 ],
1351 'selectors' => [
1352 "{{WRAPPER}} .ose-{$provider_name} .watermark:hover" => 'opacity: {{SIZE}};',
1353 ],
1354 'condition' => $logo_condition,
1355 'classes' => $this->pro_class,
1356
1357 ]
1358 );
1359 $this->end_controls_tab();
1360 $this->end_controls_tabs();
1361 $this->add_control(
1362 "embedpress_pro_{$provider_name}_cta",
1363 [
1364 'label' => __( 'CTA link for Logo', 'embedpress' ),
1365 'description' => __( 'You can show the logo inside a link. Leave it empty to hide it', 'embedpress' ),
1366 'type' => Controls_Manager::URL,
1367 'dynamic' => [
1368 'active' => true,
1369 ],
1370 'placeholder' => __( 'https://your-link.com', 'embedpress' ),
1371 'condition' => $logo_condition,
1372 'classes' => $this->pro_class,
1373 'separator' => 'before',
1374 ]
1375 );
1376 }
1377
1378 public function init_style_controls() {
1379 $this->start_controls_section(
1380 'embedpress_style_section',
1381 [
1382 'label' => __( 'Style', 'embedpress' ),
1383 'tab' => Controls_Manager::TAB_STYLE,
1384 ]
1385 );
1386 //$this->add_control(
1387 // 'embedpress_elementor_aspect_ratio',
1388 // [
1389 // 'label' => __( 'Aspect Ratio', 'embedpress' ),
1390 // 'description' => __( 'Good for any video. You may turn it off for other embed type.', 'embedpress' ),
1391 // 'type' => Controls_Manager::SELECT,
1392 // 'options' => [
1393 // 0 => __('None'),
1394 // '169' => '16:9',
1395 // '219' => '21:9',
1396 // '43' => '4:3',
1397 // '32' => '3:2',
1398 // '11' => '1:1',
1399 // '916' => '9:16',
1400 // ],
1401 // 'default' => 0,
1402 // 'prefix_class' => 'embedpress-aspect-ratio-',
1403 // 'frontend_available' => true,
1404 // ]
1405 //);
1406 $this->add_control(
1407 'width',
1408 [
1409 'label' => __( 'Width', 'embedpress' ),
1410 'type' => Controls_Manager::SLIDER,
1411 'size_units' => [ 'px' ],
1412 'range' => [
1413 'px' => [
1414 'min' => 0,
1415 'max' => 1500,
1416 'step' => 5,
1417 ],
1418 ],
1419 'default' => [
1420 'unit' => 'px',
1421 'size' => 600,
1422 ]
1423 ]
1424 );
1425 $this->add_control(
1426 'height',
1427 [
1428 'label' => __( 'Height', 'embedpress' ),
1429 'type' => Controls_Manager::SLIDER,
1430 'size_units' => [ 'px' ],
1431 'range' => [
1432 'px' => [
1433 'min' => 0,
1434 'max' => 1500,
1435 'step' => 5,
1436 ],
1437 ],
1438 'default' => [
1439 'unit' => 'px',
1440 'size' => 400,
1441 ]
1442 ]
1443 );
1444 $this->add_responsive_control(
1445 'margin',
1446 [
1447 'label' => __( 'Margin', 'embedpress' ),
1448 'type' => Controls_Manager::DIMENSIONS,
1449 'size_units' => [ 'px', '%', 'em' ],
1450 'selectors' => [
1451 '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1452 ],
1453 ]
1454 );
1455 $this->add_responsive_control(
1456 'padding',
1457 [
1458 'label' => __( 'Padding', 'embedpress' ),
1459 'type' => Controls_Manager::DIMENSIONS,
1460 'size_units' => [ 'px', '%', 'em' ],
1461 'selectors' => [
1462 '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1463 ],
1464 ]
1465 );
1466 $this->add_group_control(
1467 Group_Control_Background::get_type(),
1468 [
1469 'name' => 'background',
1470 'label' => __( 'Background', 'embedpress' ),
1471 'types' => [ 'classic', 'gradient' ],
1472 'selector' => '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper, {{WRAPPER}} .embedpress-fit-aspect-ratio .embedpress-wrapper iframe',
1473 ]
1474 );
1475 $this->add_group_control(
1476 Group_Control_Css_Filter::get_type(),
1477 [
1478 'name' => 'embedpress_elementor_css_filters',
1479 'selector' => '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper',
1480 ]
1481 );
1482 $this->end_controls_section();
1483 }
1484 protected function render() {
1485 add_filter( 'embedpress_should_modify_spotify', '__return_false');
1486 $settings = $this->get_settings_for_display();
1487 $height = (!empty( $settings['height']) && !empty( $settings['height']['size'] ))
1488 ? $settings['height']['size'] : null;
1489 $width = (!empty( $settings['width']) && !empty( $settings['width']['size'] ))
1490 ? $settings['width']['size'] : null;
1491
1492 $embed_content = Shortcode::parseContent( $settings['embedpress_embeded_link'], true, [ 'height'=> $height, 'width'=>$width ] );
1493 $embed_content = $this->onAfterEmbedSpotify($embed_content, $settings);
1494 $embed = apply_filters( 'embedpress_elementor_embed', $embed_content, $settings );
1495 $content = is_object( $embed ) ? $embed->embed : $embed;
1496
1497 ?>
1498 <div class="embedpress-elements-wrapper <?php echo !empty( $settings['embedpress_elementor_aspect_ratio']) ? 'embedpress-fit-aspect-ratio': ''; ?>">
1499 <?php echo $content; ?>
1500 </div>
1501 <?php
1502 }
1503 public function onAfterEmbedSpotify( $embed, $setting ) {
1504 if ( !isset( $embed->provider_name ) || strtolower( $embed->provider_name ) !== 'spotify' || !isset( $embed->embed ) ) {
1505 return $embed;
1506 }
1507 preg_match( '/src=\"(.+?)\"/', $embed->embed, $match );
1508 $url_full = $match[ 1 ];
1509 $modified_url = str_replace( 'playlist-v2', 'playlist', $url_full);
1510 // apply elementor related mod
1511 if(isset( $setting['spotify_theme'])){
1512 if ( strpos( $modified_url, '?') !== false ) {
1513 $modified_url .= '&theme='.sanitize_text_field( $setting['spotify_theme']);
1514 }else{
1515 $modified_url .= '?theme='.sanitize_text_field( $setting['spotify_theme']);
1516 }
1517 }
1518
1519
1520 $embed->embed = str_replace( $url_full, $modified_url, $embed->embed );
1521 return $embed;
1522 }
1523 }
1524