PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 4.0.5
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v4.0.5
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_Calendar.php 2 years ago Embedpress_Document.php 2 years ago Embedpress_Elementor.php 2 years ago Embedpress_Pdf.php 2 years ago
Embedpress_Elementor.php
3950 lines
1 <?php
2
3 namespace EmbedPress\Elementor\Widgets;
4
5
6 use Elementor\Controls_Manager as Controls_Manager;
7
8 use Elementor\Plugin;
9 use Elementor\Widget_Base as Widget_Base;
10 use EmbedPress\Includes\Classes\Helper;
11 use EmbedPress\Includes\Traits\Branding;
12 use EmbedPress\Shortcode;
13
14 (defined('ABSPATH')) or die("No direct script access allowed.");
15
16 class Embedpress_Elementor extends Widget_Base
17 {
18
19 use Branding;
20 protected $pro_class = '';
21 protected $pro_text = '';
22 protected $pro_label = '';
23 public function get_name()
24 {
25 return 'embedpres_elementor';
26 }
27
28 public function get_title()
29 {
30 return esc_html__('EmbedPress', 'embedpress');
31 }
32
33 public function get_categories()
34 {
35 return ['embedpress'];
36 }
37
38 public function get_custom_help_url()
39 {
40 return 'https://embedpress.com/documentation';
41 }
42
43 public function get_icon()
44 {
45 return 'icon-embedpress';
46 }
47
48 public function get_style_depends() {
49 $handler_keys = get_option('enabled_elementor_scripts', []);
50
51 $handles = [];
52
53 if (isset($handler_keys['enabled_custom_player']) && $handler_keys['enabled_custom_player'] === 'yes') {
54 $handles[] = 'plyr';
55 }
56 if (isset($handler_keys['enabled_instafeed']) && $handler_keys['enabled_instafeed'] === 'yes') {
57 $handles[] = 'cg-carousel';
58 }
59
60 $handles[] = 'embedpress-elementor-css';
61 $handles[] = 'embedpress-style';
62
63
64 return $handles;
65 }
66
67
68
69 public function get_script_depends()
70 {
71 $handler_keys = get_option('enabled_elementor_scripts', []);
72
73 $handles = [];
74
75 if (isset($handler_keys['enabled_custom_player']) && $handler_keys['enabled_custom_player'] === 'yes') {
76 $handles[] = 'plyr.polyfilled';
77 $handles[] = 'initplyr';
78 $handles[] = 'vimeo-player';
79 }
80 $handles[] = 'embedpress-front';
81
82 if (isset($handler_keys['enabled_ads']) && $handler_keys['enabled_ads'] === 'yes') {
83 $handles[] = 'embedpress-ads';
84 }
85
86 if (isset($handler_keys['enabled_instafeed']) && $handler_keys['enabled_instafeed'] === 'yes') {
87 $handles[] = 'cg-carousel';
88 }
89
90 return $handles;
91 }
92
93
94 /**
95 * Get widget keywords.
96 *
97 * Retrieve the list of keywords the widget belongs to.
98 *
99 * @return array Widget keywords.
100 * @since 2.4.1
101 * @access public
102 *
103 */
104 public function get_keywords()
105 {
106 return [
107 'embedpress',
108 'audio',
109 'video',
110 'map',
111 'youtube',
112 'vimeo',
113 'wistia',
114 'twitch',
115 'soundcloud',
116 'giphy gifs',
117 'spotify',
118 'smugmug',
119 'meetup',
120 'apple',
121 'apple podcast',
122 'podcast',
123 'dailymotion',
124 'instagram',
125 'slideshare',
126 'flickr',
127 'ted',
128 'google docs',
129 'google slides',
130 'google drawings'
131 ];
132 }
133
134
135
136 protected function register_controls()
137 {
138 $this->pro_class = is_embedpress_pro_active() ? '' : 'embedpress-pro-control not-active';
139 $this->pro_label = is_embedpress_pro_active() ? '' : '(Pro)';
140 $this->pro_text = is_embedpress_pro_active() ? '' : '<sup class="embedpress-pro-label" style="color:red">' . __('Pro', 'embedpress') . '</sup>';
141 /**
142 * EmbedPress General Settings
143 */
144 $this->start_controls_section(
145 'embedpress_elementor_content_settings',
146 [
147 'label' => esc_html__('General', 'embedpress'),
148 ]
149 );
150
151 $this->add_control(
152 'instafeed_access_token_notice',
153 [
154 'type' => \Elementor\Controls_Manager::RAW_HTML,
155 'raw' => sprintf('%s <a href="%s" target="_blank">here</a>.',
156 esc_html__('To enable full Instagram embedding experience, please add your access token ', 'embedpress'),
157 esc_url(admin_url('/admin.php?page=embedpress&page_type=instagram'))
158 ),
159 'content_classes' => 'elementor-panel-alert elementor-panel-warning-info',
160 'condition' => [
161 'embedpress_pro_embeded_source' => 'instafeed',
162 ],
163 ]
164 );
165
166
167
168 do_action('embedpress/embeded/extend', $this);
169 $this->add_control(
170 'embedpress_pro_embeded_source',
171 [
172 'label' => __('Source Name', 'embedpress'),
173 'type' => Controls_Manager::SELECT2,
174 'label_block' => false,
175 'default' => 'default',
176 'options' => [
177 'default' => __('Default', 'embedpress'),
178 'youtube' => __('YouTube', 'embedpress'),
179 'vimeo' => __('Vimeo', 'embedpress'),
180 'dailymotion' => __('Dailymotion', 'embedpress'),
181 'wistia' => __('Wistia', 'embedpress'),
182 'twitch' => __('Twitch', 'embedpress'),
183 'soundcloud' => __('SoundCloud', 'embedpress'),
184 'opensea' => __('OpenSea', 'embedpress'),
185 'instafeed' => __('Instagram Feed', 'embedpress'),
186 'calendly' => __('Calendly', 'embedpress'),
187 'selfhosted_video' => __('Self-hosted Video', 'embedpress'),
188 'selfhosted_audio' => __('Self-hosted Audio', 'embedpress'),
189 ]
190 ]
191 );
192
193
194 $this->add_control(
195 'instafeedFeedType',
196 [
197 'type' => \Elementor\Controls_Manager::SELECT,
198 'label' => esc_html__( 'Feed Type', 'embedpress' ),
199 'options' => [
200 'user_account_type' => esc_html__( 'User Account', 'embedpress' ),
201 'hashtag_type' => sprintf(__('Hashtag%s', 'embedpress'), $this->pro_label),
202 'tagged_type' => esc_html__( 'Tagged(Coming Soon)', 'embedpress' ),
203 'mixed_type' => esc_html__( 'Mixed(Coming Soon)', 'embedpress' ),
204 ],
205 'default' => 'user_account_type',
206 'condition' => [
207 'embedpress_pro_embeded_source' => 'instafeed',
208 ]
209 ]
210 );
211
212 if ( !is_embedpress_pro_active() ) {
213 $this->add_control(
214 'embedpress_insta_layout__pro_enable_warning_1',
215 [
216 'label' => sprintf( '<a style="color: red" target="_blank" href="https://wpdeveloper.com/in/upgrade-embedpress">%s</a>',
217 esc_html__( 'Only Available in Pro Version!', 'essential-addons-for-elementor-lite' ) ),
218 'type' => Controls_Manager::RAW_HTML,
219 'condition' => [
220 'instafeedFeedType' => [ 'hashtag_type'],
221 ],
222 ]
223 );
224 }
225
226 $this->add_control(
227 'instafeedAccountType',
228 [
229 'type' => \Elementor\Controls_Manager::SELECT,
230 'label' => esc_html__( 'Account Type', 'embedpress' ),
231 'options' => [
232 'personal' => esc_html__( 'Personal', 'embedpress' ),
233 'business' => esc_html__( 'Business', 'embedpress' ),
234 ],
235 'default' => 'personal',
236 'condition' => [
237 'instafeedFeedType' => 'user_account_type',
238 'embedpress_pro_embeded_source' => 'instafeed'
239 ]
240 ]
241 );
242
243 $this->add_control(
244 'instafeed_feed_type_important_note',
245 [
246 'type' => \Elementor\Controls_Manager::RAW_HTML,
247 'raw' => 'To embed #hashtag posts you need to connect bussiness account. <a href="'.esc_url('https://embedpress.com/docs/generate-instagram-access-token/').'">Learn More</a>',
248 'content_classes' => 'elementor-panel-alert elementor-panel-warning-info',
249 'condition' => [
250 'instafeedFeedType' => 'hashtag_type',
251 ],
252 ]
253 );
254
255 $this->add_control(
256 'embedpress_pro_embeded_nft_type',
257 [
258 'label' => __('Type', 'embedpress'),
259 'type' => Controls_Manager::SELECT,
260 'label_block' => false,
261 'default' => 'collection',
262 'options' => [
263 'collection' => __('Assets Collection', 'embedpress'),
264 'single' => __('Single Asset', 'embedpress'),
265 ],
266 'condition' => [
267 'embedpress_pro_embeded_source' => 'opensea'
268 ]
269 ]
270 );
271
272 $this->add_control(
273 'embedpress_embeded_link',
274 [
275
276 'label' => __('Embedded Link', 'embedpress'),
277 'type' => Controls_Manager::TEXT,
278 'dynamic' => [
279 'active' => true,
280 ],
281 'placeholder' => __('Enter your Link', 'embedpress'),
282 'label_block' => true,
283 'ai' => [
284 'active' => false,
285 ],
286 'condition' => [
287 'instafeedAccountType!' => 'hashtag'
288 ]
289
290 ]
291 );
292
293
294
295 $this->add_control(
296 'spotify_theme',
297 [
298 'label' => __('Player Background', 'embedpress'),
299 'description' => __('Dynamic option will use the most vibrant color from the album art.', 'embedpress'),
300 'type' => Controls_Manager::SELECT,
301 'label_block' => false,
302 'default' => '1',
303 'options' => [
304 '1' => __('Dynamic', 'embedpress'),
305 '0' => __('Black & White', 'embedpress')
306 ],
307 'condition' => [
308 'embedpress_pro_embeded_source' => 'spotify'
309 ]
310 ]
311 );
312 do_action('embedpress/control/extend', $this);
313
314 $this->add_control(
315 'emberpress_custom_player',
316 [
317 'label' => __('Enable Custom Player', 'embedpress'),
318 'type' => Controls_Manager::SWITCHER,
319 'label_block' => false,
320 'return_value' => 'yes',
321 'default' => '',
322 'condition' => [
323 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'selfhosted_video', 'selfhosted_audio']
324 ],
325 ]
326 );
327
328 $this->add_control(
329 'custom_player_important_note',
330 [
331 'type' => \Elementor\Controls_Manager::RAW_HTML,
332 'raw' => esc_html__('Custom player take effect only when a single video is embedded.', 'embedpress'),
333 'content_classes' => 'elementor-panel-alert elementor-panel-warning-info',
334 'condition' => [
335 'emberpress_custom_player' => 'yes',
336 'embedpress_pro_embeded_source' => 'youtube',
337 ],
338 ]
339 );
340
341 $this->add_control(
342 'custom_payer_preset',
343 [
344 'label' => sprintf(__('Preset %s', 'embedpress'), $this->pro_text),
345
346 'type' => Controls_Manager::SELECT,
347 'label_block' => false,
348 'default' => 'default',
349 'options' => [
350 'default' => __('Default', 'embedpress'),
351 'custom-player-preset-1' => __('Preset 1', 'embedpress'),
352 // 'custom-player-preset-2' => __('Preset 2', 'embedpress'),
353 'custom-player-preset-3' => __('Preset 2', 'embedpress'),
354 // 'custom-player-preset-4' => __('Preset 4', 'embedpress'),
355 ],
356 'classes' => $this->pro_class,
357 'condition' => [
358 'emberpress_custom_player' => 'yes',
359 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'selfhosted_video']
360 ],
361 ]
362 );
363
364 $this->add_control(
365 'embedpress_pro_video_start_time',
366 [
367 'label' => __('Start Time', 'embedpress'),
368 'type' => Controls_Manager::NUMBER,
369 'description' => __('Specify a start time (in seconds)', 'embedpress'),
370 'condition' => [
371 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'wistia', 'dailymotion', 'twitch']
372 ],
373 ]
374 );
375
376
377
378
379 /**
380 * Initialized controls
381 */
382 $this->init_youtube_controls();
383 $this->init_vimeo_controls();
384
385 $this->init_wistia_controls();
386 $this->init_soundcloud_controls();
387 $this->init_dailymotion_control();
388 $this->init_twitch_control();
389 $this->init_opensea_control();
390 $this->end_controls_section();
391
392
393 $this->init_youtube_channel_section();
394 $this->init_youtube_subscription_section();
395 $this->init_youtube_livechat_section();
396
397
398 /**
399 * Opensea Control section
400 */
401 $this->init_opensea_control_section();
402 $this->init_instafeed_control_section();
403
404 /**
405 * Calendly Control section
406 */
407 $this->init_calendly_control_section();
408
409
410 do_action('extend_elementor_controls', $this, '_', $this->pro_text, $this->pro_class);
411
412 if (!is_embedpress_pro_active()) {
413 $this->start_controls_section(
414 'embedpress_pro_section',
415 [
416 'label' => __('Go Premium for More Features', 'embedpress'),
417 ]
418 );
419
420 $this->add_control(
421 'embedpress_pro_cta',
422 [
423 'label' => __('Unlock more possibilities', 'embedpress'),
424 'type' => Controls_Manager::CHOOSE,
425 'options' => [
426 '1' => [
427 'title' => '',
428 'icon' => 'eicon-lock',
429 ],
430 ],
431 'default' => '1',
432 'description' => '<span class="pro-feature"> Get the <a href="https://wpdeveloper.com/in/upgrade-embedpress" target="_blank">Pro version</a> for more provider support and customization options.</span>',
433 ]
434 );
435
436 $this->end_controls_section();
437 }
438
439 $this->init_style_controls();
440 $this->init_opensea_color_and_typography();
441 }
442
443 /**
444 * Youtube Controls
445 */
446
447 public function init_youtube_controls()
448 {
449 $yt_condition = [
450 'embedpress_pro_embeded_source' => 'youtube'
451 ];
452 $this->add_control(
453 'embedpress_pro_youtube_end_time',
454 [
455 'label' => __('End Time', 'embedpress'),
456 'type' => Controls_Manager::NUMBER,
457 'description' => __('Specify an end time (in seconds)', 'embedpress'),
458 'condition' => $yt_condition,
459 ]
460 );
461
462
463 $this->add_control(
464 'embedpress_player_color',
465 [
466 'label' => sprintf(__('Player Color %s', 'embedpress'), $this->pro_text),
467 'type' => Controls_Manager::COLOR,
468 'label_block' => false,
469 'classes' => $this->pro_class,
470 'default' => '#5b4e96',
471 'condition' => [
472 'emberpress_custom_player' => 'yes',
473 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'selfhosted_video', 'selfhosted_audio']
474 ],
475 ]
476 );
477
478 $this->add_control(
479 'embedpress_pro_vimeo_auto_play',
480 [
481 'label' => __('Auto Play', 'embedpress'),
482 'type' => Controls_Manager::SWITCHER,
483 'label_block' => false,
484 'return_value' => 'yes',
485 'default' => 'no',
486 'condition' => [
487 'embedpress_pro_embeded_source' => 'vimeo'
488 ]
489 ]
490 );
491
492 $this->add_control(
493 'embedpress_pro_vimeo_autopause',
494 [
495 'label' => sprintf(__('Auto Pause %s', 'embedpress'), $this->pro_text),
496 'type' => Controls_Manager::SWITCHER,
497 'label_block' => false,
498 'return_value' => 'yes',
499 'default' => 'no',
500 'description' => __(
501 'Automatically stop the current video from playing when another one starts.',
502 'embedpress'
503 ),
504 'condition' => [
505 'embedpress_pro_embeded_source' => 'vimeo'
506 ],
507 'classes' => $this->pro_class,
508 ]
509 );
510
511 $this->add_control(
512 'embedpress_pro_vimeo_dnt',
513 [
514 'label' => sprintf(__('DNT %s', 'embedpress'), $this->pro_text),
515 'type' => Controls_Manager::SWITCHER,
516 'label_block' => false,
517 'return_value' => 'yes',
518 'default' => 'yes',
519 'description' => __(
520 'Set this parameter to "yes" will block tracking any session data, including cookies. If Auto Pause is enabled this will not work.',
521 'embedpress'
522 ),
523 'condition' => [
524 'embedpress_pro_embeded_source' => 'vimeo'
525 ],
526 'classes' => $this->pro_class,
527 ]
528 );
529
530
531 $this->add_control(
532 'embedpress_pro_youtube_auto_play',
533 [
534 'label' => __('Auto Play', 'embedpress'),
535 'type' => Controls_Manager::SWITCHER,
536 'label_block' => false,
537 'return_value' => 'yes',
538 'default' => 'no',
539 'condition' => $yt_condition,
540 ]
541 );
542 $this->add_control(
543 'embedpress_pro_youtube_player_options',
544 [
545 'label' => __('Player Options', 'embedpress'),
546 'type' => Controls_Manager::HEADING,
547 'condition' => [
548 'embedpress_pro_embeded_source' => 'youtube',
549 'emberpress_custom_player!' => 'yes'
550 ],
551 ]
552 );
553 $this->add_control(
554 'embedpress_pro_youtube_display_controls',
555 [
556 'label' => __('Controls', 'embedpress'),
557 'type' => Controls_Manager::SELECT,
558 'label_block' => false,
559 'default' => 1,
560 'options' => [
561 '1' => __('Display immediately', 'embedpress'),
562 '2' => __('Display after user initiation', 'embedpress'),
563 '0' => __('Hide controls', 'embedpress')
564 ],
565 'condition' => [
566 'embedpress_pro_embeded_source' => 'youtube',
567 'emberpress_custom_player!' => 'yes'
568 ],
569 ]
570 );
571 $this->add_control(
572 'embedpress_pro_youtube_enable_fullscreen_button',
573 [
574 'label' => __('Fullscreen button', 'embedpress'),
575 'type' => Controls_Manager::SWITCHER,
576 'label_block' => false,
577 'return_value' => 'yes',
578 'default' => 'yes',
579 'condition' => [
580 'embedpress_pro_embeded_source' => ['youtube', 'vimeo'],
581 'embedpress_pro_youtube_display_controls!' => '0'
582 ]
583 ]
584 );
585 $this->add_control(
586 'embedpress_pro_youtube_display_video_annotations',
587 [
588 'label' => __('Video Annotations', 'embedpress'),
589 'type' => Controls_Manager::SWITCHER,
590 'label_block' => false,
591 'default' => 1,
592 'options' => [
593 '1' => __('Display', 'embedpress'),
594 '3' => __('Do Not Display', 'embedpress')
595 ],
596 'condition' => [
597 'embedpress_pro_embeded_source' => 'youtube',
598 'emberpress_custom_player!' => 'yes'
599 ],
600 ]
601 );
602 //--- YouTube Pro control starts ---
603 $this->add_control(
604 'embedpress_pro_youtube_progress_bar_color',
605 [
606 'label' => __('Progress Bar Color', 'embedpress'),
607 'type' => Controls_Manager::SELECT,
608 'label_block' => false,
609 'default' => 'red',
610 'options' => [
611 'red' => __('Red', 'embedpress'),
612 'white' => __('White', 'embedpress')
613 ],
614 'condition' => [
615 'embedpress_pro_embeded_source' => 'youtube',
616 'emberpress_custom_player!' => 'yes'
617 ],
618 ]
619 );
620 $this->add_control(
621 'embedpress_pro_youtube_force_closed_captions',
622 [
623 'label' => sprintf(__('Closed Captions %s', 'embedpress'), $this->pro_text),
624 'type' => Controls_Manager::SWITCHER,
625 'label_block' => false,
626 'return_value' => 'yes',
627 'default' => 'no',
628 'separator' => 'before',
629 'classes' => $this->pro_class,
630 'condition' => [
631 'embedpress_pro_embeded_source' => 'youtube',
632 'emberpress_custom_player!' => 'yes'
633 ],
634 ]
635 );
636 $this->add_control(
637 'embedpress_pro_youtube_modest_branding',
638 [
639 'label' => sprintf(__('Modest Branding %s', 'embedpress'), $this->pro_text),
640 'type' => Controls_Manager::SELECT,
641 'label_block' => false,
642 'default' => 1,
643 'options' => [
644 '0' => __('Display', 'embedpress'),
645 '1' => __('Do Not Display', 'embedpress')
646 ],
647 'condition' => [
648 'embedpress_pro_embeded_source' => 'youtube',
649 'embedpress_pro_youtube_display_controls!' => '0',
650 'embedpress_pro_youtube_progress_bar_color!' => 'white',
651 'embedpress_custom_player!' => 'yes',
652 ],
653 'classes' => $this->pro_class,
654 ]
655 );
656
657
658
659
660
661 do_action('extend_customplayer_controls', $this, '_', $this->pro_text, $this->pro_class);
662
663
664 $this->add_control(
665 'embepress_player_always_on_top',
666 [
667 'label' => sprintf(__('Sticky Video %s', 'embedpress'), $this->pro_text),
668 'description' => __('Watch video and seamlessly scroll through other content with a sleek pop-up window.', 'embedpress'),
669 'type' => Controls_Manager::SWITCHER,
670 'label_block' => false,
671 'return_value' => 'yes',
672 'classes' => $this->pro_class,
673 'default' => '',
674 'condition' => [
675 'emberpress_custom_player' => 'yes',
676 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'selfhosted_video']
677 ],
678 ]
679 );
680
681 $this->add_control(
682 'embedpress_pro_youtube_display_related_videos',
683 [
684 'label' => __('Related Videos', 'embedpress'),
685 'description' => __('Set it to "Yes" to display related videos from all channels. Otherwise, related videos will show from the same channel.', 'embedpress'),
686 'type' => Controls_Manager::SWITCHER,
687 'label_block' => false,
688 'return_value' => 'yes',
689 'default' => 'yes',
690 'condition' => $yt_condition,
691 ]
692 );
693
694
695
696 $this->add_control(
697 "embedpress_player_poster_thumbnail",
698 [
699 'label' => sprintf(__('Thumbnail %s', 'embedpress'), $this->pro_text),
700 'type' => Controls_Manager::MEDIA,
701 'dynamic' => [
702 'active' => true,
703 ],
704 'classes' => $this->pro_class,
705 'condition' => [
706 'emberpress_custom_player' => 'yes',
707 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'selfhosted_video']
708 ],
709 ]
710 );
711
712 $this->init_branding_controls('youtube');
713 }
714
715 public function init_youtube_channel_section()
716 {
717 $yt_condition = [
718 'embedpress_pro_embeded_source' => 'youtube',
719 ];
720 $this->start_controls_section(
721 'embedpress_yt_channel_section',
722 [
723 'label' => __('YouTube Channel', 'embedpress'),
724 'condition' => [
725 'embedpress_pro_embeded_source' => 'youtube',
726 'emberpress_custom_player!' => 'yes'
727 ],
728
729 ]
730 );
731
732 $this->add_control(
733 'important_note',
734 [
735 'type' => \Elementor\Controls_Manager::RAW_HTML,
736 'raw' => esc_html__('These options take effect only when a YouTube channel is embedded.', 'embedpress'),
737 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
738 ]
739 );
740
741 $this->add_control(
742 'pagesize',
743 [
744 'label' => __('Video Per Page', 'embedpress'),
745 'type' => Controls_Manager::NUMBER,
746 'label_block' => false,
747 'default' => 6,
748 'min' => 1,
749 'max' => 50,
750 'conditions' => [
751 'terms' => [
752 [
753 'name' => 'embedpress_pro_embeded_source',
754 'operator' => '===',
755 'value' => 'youtube',
756 ],
757 ],
758 ]
759 ]
760 );
761
762 $this->add_control(
763 'columns',
764 [
765 'label' => __('Column', 'embedpress'),
766 'type' => \Elementor\Controls_Manager::SELECT,
767 'label_block' => false,
768 'default' => '3',
769 'options' => [
770 '2' => esc_html__('2', 'embedpress'),
771 '3' => esc_html__('3', 'embedpress'),
772 '4' => esc_html__('4', 'embedpress'),
773 '6' => esc_html__('6', 'embedpress'),
774 'auto' => esc_html__('Auto', 'embedpress'),
775 ],
776 'conditions' => [
777 'terms' => [
778 [
779 'name' => 'embedpress_pro_embeded_source',
780 'operator' => '===',
781 'value' => 'youtube',
782 ],
783 ],
784 ]
785 ]
786 );
787 $this->add_control(
788 'gapbetweenvideos',
789 [
790 'label' => __('Gap Between Videos', 'embedpress'),
791 'label_block' => true,
792 'type' => \Elementor\Controls_Manager::SLIDER,
793 'size_units' => ['px', '%'],
794 'range' => [
795 'px' => [
796 'min' => 0,
797 'max' => 100,
798 'step' => 1,
799 ],
800 '%' => [
801 'min' => 0,
802 'max' => 100,
803 ],
804 ],
805 'default' => [
806 'unit' => 'px',
807 'size' => 30,
808 ],
809 'conditions' => [
810 'terms' => [
811 [
812 'name' => 'embedpress_pro_embeded_source',
813 'operator' => '===',
814 'value' => 'youtube',
815 ],
816 ],
817 ],
818 'selectors' => [
819 '{{WRAPPER}} .ep-youtube__content__block .youtube__content__body .content__wrap' => 'gap: {{SIZE}}{{UNIT}}!important;margin-top: {{SIZE}}{{UNIT}}!important;',
820 ],
821 ]
822 );
823
824 $this->add_control(
825 'pagination',
826 [
827 'label' => __('Pagination', 'embedpress'),
828 'type' => Controls_Manager::SWITCHER,
829 'label_block' => false,
830 'label_on' => esc_html__('Show', 'embedpress'),
831 'label_off' => esc_html__('Hide', 'embedpress'),
832 'return_value' => 'show',
833 'default' => 'show',
834 'condition' => $yt_condition,
835 ]
836 );
837
838
839 $this->end_controls_section();
840 }
841 public function init_youtube_subscription_section()
842 {
843 $yt_condition = [
844 'embedpress_pro_embeded_source' => 'youtube',
845 ];
846 $this->start_controls_section(
847 'embedpress_yt_subscription_section',
848 [
849 'label' => __('YouTube Subscriber', 'embedpress'),
850 'condition' => $yt_condition,
851
852 ]
853 );
854
855
856 $this->add_control(
857 'yt_sub_channel',
858 [
859
860 'label' => sprintf(__('Channel ID %s', 'embedpress'), $this->pro_text),
861 'type' => Controls_Manager::TEXT,
862 'dynamic' => [
863 'active' => true,
864 ],
865 'placeholder' => __('Enter Channel ID', 'embedpress'),
866 'label_block' => true,
867 'condition' => $yt_condition,
868 'classes' => $this->pro_class,
869 ]
870 );
871 $this->add_control(
872 'yt_sub_text',
873 [
874
875 'label' => sprintf(__('Subscription Text %s', 'embedpress'), $this->pro_text),
876 'type' => Controls_Manager::TEXT,
877 'dynamic' => [
878 'active' => true,
879 ],
880 'placeholder' => __('Eg. Don\'t miss out! Subscribe', 'embedpress'),
881 'label_block' => true,
882 'condition' => $yt_condition,
883 'classes' => $this->pro_class,
884 ]
885 );
886
887
888 $this->add_control(
889 'yt_sub_layout',
890 [
891 'label' => sprintf(__('Layout %s', 'embedpress'), $this->pro_text),
892 'type' => Controls_Manager::SELECT,
893 'label_block' => false,
894 'default' => 'default',
895 'options' => [
896 'default' => __('Default', 'embedpress'),
897 'full' => __('Full', 'embedpress')
898 ],
899 'condition' => [
900 'embedpress_pro_embeded_source' => 'youtube',
901 ],
902 'classes' => $this->pro_class,
903 ]
904 );
905
906 $this->add_control(
907 'yt_sub_theme',
908 [
909 'label' => sprintf(__('Theme %s', 'embedpress'), $this->pro_text),
910 'type' => Controls_Manager::SELECT,
911 'label_block' => false,
912 'default' => 'default',
913 'options' => [
914 'default' => __('Default', 'embedpress'),
915 'dark' => __('Dark', 'embedpress')
916 ],
917 'condition' => [
918 'embedpress_pro_embeded_source' => 'youtube',
919 ],
920 'classes' => $this->pro_class,
921 ]
922 );
923
924 $this->add_control(
925 'yt_sub_count',
926 [
927 'label' => sprintf(__('Subscriber Count %s', 'embedpress'), $this->pro_text),
928 'type' => Controls_Manager::SWITCHER,
929 'label_block' => false,
930 'return_value' => 'yes',
931 'default' => 'yes',
932 'condition' => $yt_condition,
933 'classes' => $this->pro_class,
934 ]
935 );
936
937 $this->end_controls_section();
938 }
939
940 public function init_youtube_livechat_section()
941 {
942 $yt_condition = [
943 'embedpress_pro_embeded_source' => 'youtube',
944 ];
945 $this->start_controls_section(
946 'embedpress_yt_livechat_section',
947 [
948 'label' => __('YouTube Live Chat', 'embedpress'),
949 'condition' => $yt_condition,
950
951 ]
952 );
953
954 $this->add_control(
955 'yt_lc_show',
956 [
957 'label' => sprintf(__('Show YouTube Live Chat %s', 'embedpress'), $this->pro_text),
958 'type' => Controls_Manager::SWITCHER,
959 'label_block' => false,
960 'return_value' => 'yes',
961 'default' => '',
962 'label_off' => __('Hide', 'embedpress'),
963 'label_on' => __('Show', 'embedpress'),
964 'condition' => $yt_condition,
965 'classes' => $this->pro_class,
966 ]
967 );
968
969
970 $this->end_controls_section();
971 }
972
973 //End Youtube Controls
974
975 /**
976 * Dailymotion Controls
977 */
978 public function init_dailymotion_control()
979 {
980 //@TODO; Kamal - migrate from 'embedpress_pro_dailymotion_logo' to 'embedpress_pro_dailymotion_ui_logo'
981 $this->add_control(
982 'embedpress_pro_dailymotion_ui_logo',
983 [
984 'label' => sprintf(__('Logo %s', 'embedpress'), $this->pro_text),
985 'type' => Controls_Manager::SWITCHER,
986 'label_block' => false,
987 'return_value' => 'yes',
988 'default' => 'yes',
989 'label_off' => __('Hide', 'embedpress'),
990 'label_on' => __('Show', 'embedpress'),
991 'condition' => [
992 'embedpress_pro_embeded_source' => 'dailymotion'
993 ],
994 'classes' => $this->pro_class,
995 ]
996 );
997 $this->add_control(
998 'embedpress_pro_dailymotion_autoplay',
999 [
1000 'label' => __('Auto Play', 'embedpress'),
1001 'type' => Controls_Manager::SWITCHER,
1002 'label_block' => false,
1003 'return_value' => 'yes',
1004 'default' => 'no',
1005 'label_off' => __('Hide', 'embedpress'),
1006 'label_on' => __('Show', 'embedpress'),
1007 'condition' => [
1008 'embedpress_pro_embeded_source' => 'dailymotion'
1009 ]
1010 ]
1011 );
1012 $this->add_control(
1013 'embedpress_pro_dailymotion_play_on_mobile',
1014 [
1015 'label' => __('Play On Mobile', 'embedpress'),
1016 'type' => Controls_Manager::SWITCHER,
1017 'label_block' => false,
1018 'return_value' => 'yes',
1019 'default' => 'no',
1020 'label_off' => __('Hide', 'embedpress'),
1021 'label_on' => __('Show', 'embedpress'),
1022 'condition' => [
1023 'embedpress_pro_embeded_source' => 'dailymotion',
1024 'embedpress_pro_dailymotion_autoplay' => 'yes'
1025 ]
1026 ]
1027 );
1028 $this->add_control(
1029 'embedpress_pro_dailymotion_mute',
1030 [
1031 'label' => __('Mute', 'embedpress'),
1032 'type' => Controls_Manager::SWITCHER,
1033 'label_block' => false,
1034 'return_value' => 'yes',
1035 'default' => 'no',
1036 'label_off' => __('Hide', 'embedpress'),
1037 'label_on' => __('Show', 'embedpress'),
1038 'condition' => [
1039 'embedpress_pro_embeded_source' => 'dailymotion'
1040 ]
1041 ]
1042 );
1043 $this->add_control(
1044 'embedpress_pro_dailymotion_player_control',
1045 [
1046 'label' => __('Player Controls', 'embedpress'),
1047 'type' => Controls_Manager::SWITCHER,
1048 'label_block' => false,
1049 'return_value' => 'yes',
1050 'default' => 'yes',
1051 'label_off' => __('Hide', 'embedpress'),
1052 'label_on' => __('Show', 'embedpress'),
1053 'condition' => [
1054 'embedpress_pro_embeded_source' => 'dailymotion'
1055 ]
1056 ]
1057 );
1058 $this->add_control(
1059 'embedpress_pro_dailymotion_video_info',
1060 [
1061 'label' => __('Video Info', 'embedpress'),
1062 'type' => Controls_Manager::SWITCHER,
1063 'label_block' => false,
1064 'return_value' => 'yes',
1065 'default' => 'yes',
1066 'label_off' => __('Hide', 'embedpress'),
1067 'label_on' => __('Show', 'embedpress'),
1068 'condition' => [
1069 'embedpress_pro_embeded_source' => 'dailymotion'
1070 ]
1071 ]
1072 );
1073 $this->add_control(
1074 'embedpress_pro_dailymotion_control_color',
1075 [
1076 'label' => __('Control Color', 'embedpress'),
1077 'type' => Controls_Manager::COLOR,
1078 'label_block' => false,
1079 'default' => '#dd3333',
1080 'condition' => [
1081 'embedpress_pro_embeded_source' => 'dailymotion'
1082 ]
1083 ]
1084 );
1085 $this->init_branding_controls('dailymotion');
1086 }
1087 //End Dailymotion Controls
1088
1089 /**
1090 * Wistia Controls
1091 */
1092 public function init_wistia_controls()
1093 {
1094 $this->add_control(
1095 'embedpress_pro_wistia_auto_play',
1096 [
1097 'label' => __('Auto Play', 'embedpress'),
1098 'type' => Controls_Manager::SWITCHER,
1099 'label_block' => false,
1100 'return_value' => 'yes',
1101 'default' => 'no',
1102 'condition' => [
1103 'embedpress_pro_embeded_source' => 'wistia'
1104 ],
1105 ]
1106 );
1107
1108 $this->add_control(
1109 'embedpress_pro_wistia_color',
1110 [
1111 'label' => __('Scheme', 'embedpress'),
1112 'type' => Controls_Manager::COLOR,
1113 'label_block' => false,
1114 'default' => '#dd3333',
1115 'condition' => [
1116 'embedpress_pro_embeded_source' => 'wistia'
1117 ]
1118 ]
1119 );
1120
1121
1122
1123 $this->add_control(
1124 'embedpress_pro_wistia_captions_enabled_by_default',
1125 [
1126 'label' => __('Captions Enabled By Default', 'embedpress'),
1127 'type' => Controls_Manager::SWITCHER,
1128 'label_block' => false,
1129 'return_value' => 'yes',
1130 'default' => 'no',
1131 'condition' => [
1132 'embedpress_pro_embeded_source' => 'wistia',
1133 'embedpress_pro_wistia_captions' => 'yes'
1134 ],
1135 'classes' => $this->pro_class,
1136 ]
1137 );
1138
1139 $this->add_control(
1140 'embedpress_pro_wistia_player_options',
1141 [
1142 'label' => __('Player Options', 'embedpress'),
1143 'type' => Controls_Manager::HEADING,
1144 'separator' => 'before',
1145 'condition' => [
1146 'embedpress_pro_embeded_source' => 'wistia'
1147 ]
1148 ]
1149 );
1150
1151
1152
1153 $this->add_control(
1154 'embedpress_pro_wistia_fullscreen_button',
1155 [
1156 'label' => __('Fullscreen Button', 'embedpress'),
1157 'type' => Controls_Manager::SWITCHER,
1158 'label_block' => false,
1159 'return_value' => 'yes',
1160 'default' => 'no',
1161 'condition' => [
1162 'embedpress_pro_embeded_source' => 'wistia'
1163 ],
1164 ]
1165 );
1166
1167 $this->add_control(
1168 'embedpress_pro_wistia_small_play_button',
1169 [
1170 'label' => __('Small Play Button', 'embedpress'),
1171 'type' => Controls_Manager::SWITCHER,
1172 'label_block' => false,
1173 'return_value' => 'yes',
1174 'default' => 'no',
1175 'condition' => [
1176 'embedpress_pro_embeded_source' => 'wistia'
1177 ],
1178 ]
1179 );
1180
1181
1182
1183
1184 $this->add_control(
1185 'embedpress_pro_wistia_resumable',
1186 [
1187 'label' => __('Resumable', 'embedpress'),
1188 'type' => Controls_Manager::SWITCHER,
1189 'label_block' => false,
1190 'return_value' => 'yes',
1191 'default' => 'no',
1192 'condition' => [
1193 'embedpress_pro_embeded_source' => 'wistia'
1194 ],
1195 ]
1196 );
1197
1198
1199 $this->add_control(
1200 'embedpress_pro_wistia_focus',
1201 [
1202 'label' => __('Focus', 'embedpress'),
1203 'type' => Controls_Manager::SWITCHER,
1204 'label_block' => false,
1205 'return_value' => 'yes',
1206 'default' => 'no',
1207 'condition' => [
1208 'embedpress_pro_embeded_source' => 'wistia'
1209 ],
1210 ]
1211 );
1212
1213 // --- Wistia PRO Controls --
1214 $this->add_control(
1215 'embedpress_pro_wistia_captions',
1216 [
1217 'label' => sprintf(__('Closed Captions %s', 'embedpress'), $this->pro_text),
1218 'type' => Controls_Manager::SWITCHER,
1219 'label_block' => false,
1220 'return_value' => 'yes',
1221 'default' => 'no',
1222 'condition' => [
1223 'embedpress_pro_embeded_source' => 'wistia'
1224 ],
1225 'classes' => $this->pro_class,
1226 ]
1227 );
1228 $this->add_control(
1229 'embedpress_pro_wistia_playbar',
1230 [
1231 'label' => __('Playbar ', 'embedpress'),
1232 'type' => Controls_Manager::SWITCHER,
1233 'label_block' => false,
1234 'return_value' => 'yes',
1235 'default' => 'no',
1236 'condition' => [
1237 'embedpress_pro_embeded_source' => 'wistia'
1238 ],
1239 ]
1240 );
1241
1242 $this->add_control(
1243 'embedpress_pro_wistia_volume_control',
1244 [
1245 'label' => sprintf(__('Volume Control %s', 'embedpress'), $this->pro_text),
1246 'type' => Controls_Manager::SWITCHER,
1247 'label_block' => false,
1248 'return_value' => 'yes',
1249 'default' => 'yes',
1250 'condition' => [
1251 'embedpress_pro_embeded_source' => 'wistia'
1252 ],
1253 'classes' => $this->pro_class,
1254 ]
1255 );
1256
1257
1258 $this->add_control(
1259 'embedpress_pro_wistia_volume',
1260 [
1261 'label' => sprintf(__('Volume %s', 'embedpress'), $this->pro_text),
1262 'type' => Controls_Manager::SLIDER,
1263 'default' => [
1264 'size' => 100,
1265 ],
1266 'range' => [
1267 'px' => [
1268 'min' => 0,
1269 'max' => 100,
1270 ]
1271 ],
1272 'condition' => [
1273 'embedpress_pro_embeded_source' => 'wistia',
1274 'embedpress_pro_wistia_volume_control' => 'yes'
1275 ],
1276 'classes' => $this->pro_class,
1277 ]
1278 );
1279
1280 $this->add_control(
1281 'embedpress_pro_wistia_rewind',
1282 [
1283 'label' => __('Rewind', 'embedpress'),
1284 'type' => Controls_Manager::SWITCHER,
1285 'label_block' => false,
1286 'return_value' => 'yes',
1287 'default' => 'no',
1288 'condition' => [
1289 'embedpress_pro_embeded_source' => 'wistia'
1290 ],
1291 ]
1292 );
1293
1294 $this->add_control(
1295 'embedpress_pro_wistia_rewind_time',
1296 [
1297 'label' => __('Rewind time', 'embedpress'),
1298 'type' => Controls_Manager::SLIDER,
1299 'default' => [
1300 'size' => 10,
1301 ],
1302 'range' => [
1303 'px' => [
1304 'min' => 1,
1305 'max' => 100,
1306 ]
1307 ],
1308 'condition' => [
1309 'embedpress_pro_wistia_rewind' => 'yes',
1310 'embedpress_pro_embeded_source' => 'wistia'
1311 ],
1312 ]
1313 );
1314 $this->init_branding_controls('wistia');
1315 }
1316 //End Wistia controls
1317
1318
1319
1320 /**
1321 * Twitch Controls
1322 */
1323 public function init_twitch_control()
1324 {
1325 $condition = [
1326 'embedpress_pro_embeded_source' => 'twitch'
1327 ];
1328 $this->add_control(
1329 'embedpress_pro_twitch_autoplay',
1330 [
1331 'label' => __('Autoplay', 'embedpress'),
1332 'type' => Controls_Manager::SWITCHER,
1333 'label_off' => __('No', 'embedpress'),
1334 'label_on' => __('Yes', 'embedpress'),
1335 'default' => 'yes',
1336 'condition' => $condition,
1337 ]
1338 );
1339 $this->add_control(
1340 'embedpress_pro_fs',
1341 [
1342 'label' => __('Allow Full Screen Video', 'embedpress'),
1343 'type' => Controls_Manager::SWITCHER,
1344 'label_off' => __('No', 'embedpress'),
1345 'label_on' => __('Yes', 'embedpress'),
1346 'default' => 'yes',
1347 'condition' => $condition,
1348 ]
1349 );
1350
1351 // -- Twitch PRO controls --
1352 $this->add_control(
1353 'embedpress_pro_twitch_chat',
1354 [
1355 'label' => sprintf(__('Show Chat %s', 'embedpress'), $this->pro_text),
1356 'type' => Controls_Manager::SWITCHER,
1357 'label_off' => __('Hide', 'embedpress'),
1358 'label_on' => __('Show', 'embedpress'),
1359 'condition' => $condition,
1360 'classes' => $this->pro_class,
1361
1362 ]
1363 );
1364 $this->add_control(
1365 'embedpress_pro_twitch_mute',
1366 [
1367 'label' => __('Mute on start', 'embedpress'),
1368 'type' => Controls_Manager::SWITCHER,
1369 'label_off' => __('Hide', 'embedpress'),
1370 'label_on' => __('Show', 'embedpress'),
1371 'condition' => $condition,
1372 ]
1373 );
1374 $this->add_control(
1375 'embedpress_pro_twitch_theme',
1376 [
1377 'label' => __('Theme', 'embedpress'),
1378 'type' => Controls_Manager::SELECT,
1379 'default' => 'dark',
1380 'options' => [
1381 'dark' => __('Dark', 'embedpress'),
1382 'light' => __('Light', 'embedpress'),
1383 ],
1384 'condition' => $condition,
1385 ]
1386 );
1387
1388 $this->init_branding_controls('twitch');
1389 }
1390 //End Twitch controls
1391
1392
1393 /**
1394 * SoundCloud Controls
1395 */
1396 public function init_soundcloud_controls()
1397 {
1398 $this->add_control(
1399 'embedpress_pro_soundcloud_visual',
1400 [
1401 'label' => __('Visual Player', 'embedpress'),
1402 'type' => Controls_Manager::SWITCHER,
1403 'label_block' => false,
1404 'return_value' => 'yes',
1405 'default' => 'no',
1406 'label_off' => __('Hide', 'embedpress'),
1407 'label_on' => __('Show', 'embedpress'),
1408 'condition' => [
1409 'embedpress_pro_embeded_source' => 'soundcloud'
1410 ],
1411 ]
1412 );
1413
1414 $this->add_control(
1415 'embedpress_pro_soundcloud_color',
1416 [
1417 'label' => __('Scheme', 'embedpress'),
1418 'type' => Controls_Manager::COLOR,
1419 'label_block' => false,
1420 'default' => '#FF5500',
1421 'condition' => [
1422 'embedpress_pro_embeded_source' => 'soundcloud'
1423 ]
1424 ]
1425 );
1426
1427 $this->add_control(
1428 'embedpress_pro_soundcloud_autoplay',
1429 [
1430 'label' => __('Auto Play', 'embedpress'),
1431 'type' => Controls_Manager::SWITCHER,
1432 'label_block' => false,
1433 'return_value' => 'yes',
1434 'default' => 'no',
1435 'label_off' => __('Hide', 'embedpress'),
1436 'label_on' => __('Show', 'embedpress'),
1437 'condition' => [
1438 'embedpress_pro_embeded_source' => 'soundcloud'
1439 ],
1440 ]
1441 );
1442
1443
1444
1445 $this->add_control(
1446 'embedpress_pro_soundcloud_share_button',
1447 [
1448 'label' => __('Share Button', 'embedpress'),
1449 'type' => Controls_Manager::SWITCHER,
1450 'label_block' => false,
1451 'return_value' => 'yes',
1452 'default' => 'yes',
1453 'label_off' => __('Hide', 'embedpress'),
1454 'label_on' => __('Show', 'embedpress'),
1455 'condition' => [
1456 'embedpress_pro_embeded_source' => 'soundcloud'
1457 ],
1458 ]
1459 );
1460
1461 $this->add_control(
1462 'embedpress_pro_soundcloud_comments',
1463 [
1464 'label' => __('Comments', 'embedpress'),
1465 'type' => Controls_Manager::SWITCHER,
1466 'label_block' => false,
1467 'return_value' => 'yes',
1468 'default' => 'yes',
1469 'label_off' => __('Hide', 'embedpress'),
1470 'label_on' => __('Show', 'embedpress'),
1471 'condition' => [
1472 'embedpress_pro_embeded_source' => 'soundcloud'
1473 ],
1474 ]
1475 );
1476
1477
1478
1479 $this->add_control(
1480 'embedpress_pro_soundcloud_artwork',
1481 [
1482 'label' => __('Artwork', 'embedpress'),
1483 'type' => Controls_Manager::SWITCHER,
1484 'label_block' => false,
1485 'return_value' => 'yes',
1486 'default' => 'yes',
1487 'label_off' => __('Hide', 'embedpress'),
1488 'label_on' => __('Show', 'embedpress'),
1489 'condition' => [
1490 'embedpress_pro_embeded_source' => 'soundcloud',
1491 'embedpress_pro_soundcloud_visual!' => 'yes'
1492 ]
1493 ]
1494 );
1495
1496 $this->add_control(
1497 'embedpress_pro_soundcloud_play_count',
1498 [
1499 'label' => __('Play Count', 'embedpress'),
1500 'type' => Controls_Manager::SWITCHER,
1501 'label_block' => false,
1502 'return_value' => 'yes',
1503 'default' => 'yes',
1504 'label_off' => __('Hide', 'embedpress'),
1505 'label_on' => __('Show', 'embedpress'),
1506 'condition' => [
1507 'embedpress_pro_embeded_source' => 'soundcloud',
1508 'embedpress_pro_soundcloud_visual!' => 'yes'
1509 ],
1510 ]
1511 );
1512
1513 $this->add_control(
1514 'embedpress_pro_soundcloud_user_name',
1515 [
1516 'label' => __('User Name', 'embedpress'),
1517 'type' => Controls_Manager::SWITCHER,
1518 'label_block' => false,
1519 'return_value' => 'yes',
1520 'default' => 'yes',
1521 'label_off' => __('Hide', 'embedpress'),
1522 'label_on' => __('Show', 'embedpress'),
1523 'condition' => [
1524 'embedpress_pro_embeded_source' => 'soundcloud'
1525 ],
1526 ]
1527 );
1528
1529 $this->add_control(
1530 'embedpress_pro_soundcloud_buy_button',
1531 [
1532 'label' => sprintf(__('Buy Button %s', 'embedpress'), $this->pro_text),
1533 'type' => Controls_Manager::SWITCHER,
1534 'label_block' => false,
1535 'return_value' => 'yes',
1536 'default' => 'yes',
1537 'label_off' => __('Hide', 'embedpress'),
1538 'label_on' => __('Show', 'embedpress'),
1539 'condition' => [
1540 'embedpress_pro_embeded_source' => 'soundcloud'
1541 ],
1542 'classes' => $this->pro_class,
1543 ]
1544 );
1545 $this->add_control(
1546 'embedpress_pro_soundcloud_download_button',
1547 [
1548 'label' => sprintf(__('Download Button %s', 'embedpress'), $this->pro_text),
1549 'type' => Controls_Manager::SWITCHER,
1550 'label_block' => false,
1551 'return_value' => 'yes',
1552 'default' => 'yes',
1553 'label_off' => __('Hide', 'embedpress'),
1554 'label_on' => __('Show', 'embedpress'),
1555 'condition' => [
1556 'embedpress_pro_embeded_source' => 'soundcloud'
1557 ],
1558 'classes' => $this->pro_class,
1559 ]
1560 );
1561 }
1562 //End SoundCloud controls
1563
1564 /**
1565 * Vimeo Controls
1566 */
1567 public function init_vimeo_controls()
1568 {
1569
1570
1571
1572 $this->add_control(
1573 'embedpress_pro_vimeo_color',
1574 [
1575 'label' => __('Scheme', 'embedpress'),
1576 'type' => Controls_Manager::COLOR,
1577 'label_block' => false,
1578 'default' => '#00adef',
1579 'condition' => [
1580 'emberpress_custom_player!' => 'yes',
1581 'embedpress_pro_embeded_source' => 'vimeo'
1582 ]
1583 ]
1584 );
1585
1586 $this->add_control(
1587 'embedpress_pro_vimeo_author_options',
1588 [
1589 'label' => __('Author Information', 'embedpress'),
1590 'type' => Controls_Manager::HEADING,
1591 'separator' => 'before',
1592 'condition' => [
1593 'embedpress_pro_embeded_source' => 'vimeo',
1594 'emberpress_custom_player!' => 'yes',
1595 ]
1596 ]
1597 );
1598
1599 $this->add_control(
1600 'embedpress_pro_vimeo_display_title',
1601 [
1602 'label' => __('Title', 'embedpress'),
1603 'type' => Controls_Manager::SWITCHER,
1604 'label_block' => false,
1605 'return_value' => 'yes',
1606 'default' => 'yes',
1607 'condition' => [
1608 'emberpress_custom_player!' => 'yes',
1609 'embedpress_pro_embeded_source' => 'vimeo'
1610 ]
1611 ]
1612 );
1613
1614 //----- Vimeo PRO controls
1615
1616 $this->add_control(
1617 'embedpress_pro_vimeo_display_author',
1618 [
1619 'label' => __('Author', 'embedpress'),
1620 'type' => Controls_Manager::SWITCHER,
1621 'label_block' => false,
1622 'return_value' => 'yes',
1623 'default' => 'yes',
1624 'condition' => [
1625 'emberpress_custom_player!' => 'yes',
1626 'embedpress_pro_embeded_source' => 'vimeo'
1627 ],
1628 ]
1629 );
1630
1631 $this->add_control(
1632 'embedpress_pro_vimeo_avatar',
1633 [
1634 'label' => __('Avatar', 'embedpress'),
1635 'type' => Controls_Manager::SWITCHER,
1636 'label_block' => false,
1637 'return_value' => 'yes',
1638 'default' => 'yes',
1639 'condition' => [
1640 'emberpress_custom_player!' => 'yes',
1641 'embedpress_pro_embeded_source' => 'vimeo'
1642 ],
1643 ]
1644 );
1645
1646 $this->add_control(
1647 'embedpress_pro_vimeo_loop',
1648 [
1649 'label' => sprintf(__('Loop %s', 'embedpress'), $this->pro_text),
1650 'type' => Controls_Manager::SWITCHER,
1651 'label_block' => false,
1652 'return_value' => 'yes',
1653 'default' => 'no',
1654 'condition' => [
1655 'emberpress_custom_player!' => 'yes',
1656 'embedpress_pro_embeded_source' => 'vimeo'
1657 ],
1658 'classes' => $this->pro_class,
1659 ]
1660 );
1661
1662 $this->init_branding_controls('vimeo');
1663 }
1664 //End Vimeo controls
1665
1666
1667 /**
1668 * Spotify Controls
1669 */
1670 public function init_spotify_controls()
1671 {
1672 $condition = [
1673 'embedpress_pro_embeded_source' => 'spotify'
1674 ];
1675
1676 $this->add_control(
1677 'spotify_theme',
1678 [
1679 'label' => __('Player Background', 'embedpress'),
1680 'description' => __('Dynamic option will use the most vibrant color from the album art.', 'embedpress'),
1681 'type' => Controls_Manager::SELECT,
1682 'label_block' => false,
1683 'default' => '1',
1684 'options' => [
1685 '1' => __('Dynamic', 'embedpress'),
1686 '0' => __('Black & White', 'embedpress')
1687 ],
1688 'condition' => $condition
1689 ]
1690 );
1691 }
1692 //End Spotify controls
1693
1694 /**
1695 * OpenSea Controls
1696 */
1697 public function init_opensea_control()
1698 {
1699 $condition = [
1700 'embedpress_pro_embeded_source' => 'opensea'
1701 ];
1702
1703 $this->add_control(
1704 'limit',
1705 [
1706 'type' => \Elementor\Controls_Manager::NUMBER,
1707 'label' => esc_html__('Limit', 'embedpress'),
1708 'placeholder' => '9',
1709 'min' => 1,
1710 'max' => 100,
1711 'step' => 1,
1712 'default' => 20,
1713 'condition' => [
1714 'embedpress_pro_embeded_nft_type' => ['collection'],
1715 'embedpress_pro_embeded_source!' => [
1716 'default',
1717 'youtube',
1718 'vimeo',
1719 'dailymotion',
1720 'wistia',
1721 'twitch',
1722 'soundcloud',
1723 'instafeed',
1724 'calendly',
1725 'selfhosted_video',
1726 'selfhosted_audio',
1727 ],
1728 ],
1729 ]
1730 );
1731
1732
1733 $this->add_control(
1734 'orderby',
1735 [
1736 'type' => \Elementor\Controls_Manager::SELECT,
1737 'label' => esc_html__('Order By', 'embedpress'),
1738 'options' => [
1739 'asc' => esc_html__('Oldest', 'embedpress'),
1740 'desc' => esc_html__('Newest', 'embedpress'),
1741 ],
1742 'default' => 'desc',
1743 'condition' => [
1744 'embedpress_pro_embeded_nft_type' => ['collection'],
1745 'embedpress_pro_embeded_source!' => [
1746 'default',
1747 'youtube',
1748 'vimeo',
1749 'dailymotion',
1750 'wistia',
1751 'twitch',
1752 'soundcloud',
1753 'instafeed',
1754 'calendly',
1755 'selfhosted_video',
1756 'selfhosted_audio',
1757 ],
1758 ],
1759 ]
1760 );
1761 }
1762
1763 public function init_opensea_control_section()
1764 {
1765 $condition = [
1766 'embedpress_pro_embeded_source' => 'opensea',
1767 ];
1768
1769 $this->start_controls_section(
1770 'embedpress_opensea_control_section',
1771 [
1772 'label' => __('OpenSea Control Settings', 'embedpress'),
1773 'condition' => $condition,
1774 ]
1775 );
1776
1777 $this->add_control(
1778 'opense_important_note_single',
1779 [
1780 'type' => \Elementor\Controls_Manager::RAW_HTML,
1781 'raw' => esc_html__('These options take effect only when a Opensea Single Asset is embedded.', 'embedpress'),
1782 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
1783 'condition' => [
1784 'embedpress_pro_embeded_nft_type' => 'single'
1785 ],
1786
1787 ]
1788 );
1789 $this->add_control(
1790 'opense_important_note_collection',
1791 [
1792 'type' => \Elementor\Controls_Manager::RAW_HTML,
1793 'raw' => esc_html__('These options take effect only when a Opensea Collection is embedded.', 'embedpress'),
1794 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
1795 'condition' => [
1796 'embedpress_pro_embeded_nft_type' => 'collection'
1797 ],
1798 ]
1799 );
1800
1801 $this->add_control(
1802 'layout',
1803 [
1804 'label' => __('Layout', 'embedpress'),
1805 'type' => \Elementor\Controls_Manager::SELECT,
1806 'label_block' => false,
1807 'default' => 'ep-grid',
1808 'options' => [
1809 'ep-grid' => esc_html__('Grid', 'embedpress'),
1810 'ep-list' => esc_html__('List', 'embedpress'),
1811 ],
1812 'conditions' => [
1813 'terms' => [
1814 [
1815 'name' => 'embedpress_pro_embeded_nft_type',
1816 'operator' => '===',
1817 'value' => 'collection',
1818 ],
1819 ],
1820 ]
1821
1822 ]
1823 );
1824
1825
1826 $this->add_control(
1827 'preset',
1828 [
1829 'label' => __('Preset', 'embedpress'),
1830 'type' => \Elementor\Controls_Manager::SELECT,
1831 'label_block' => false,
1832 'default' => 'ep-preset-1',
1833 'options' => [
1834 'ep-preset-1' => esc_html__('Preset 1', 'embedpress'),
1835 'ep-preset-2' => esc_html__('Preset 2', 'embedpress'),
1836 ],
1837 'conditions' => [
1838 'terms' => [
1839 [
1840 'name' => 'embedpress_pro_embeded_nft_type',
1841 'operator' => '===',
1842 'value' => 'collection',
1843 'relation' => 'and'
1844 ],
1845 [
1846 'name' => 'layout',
1847 'operator' => '===',
1848 'value' => 'ep-grid',
1849 'relation' => 'and'
1850 ],
1851 ],
1852 ]
1853
1854 ]
1855 );
1856
1857 $this->add_control(
1858 'nftperrow',
1859 [
1860 'label' => __('Column', 'embedpress'),
1861 'type' => \Elementor\Controls_Manager::SELECT,
1862 'label_block' => false,
1863 'default' => '3',
1864 'options' => [
1865 '1' => esc_html__('1', 'embedpress'),
1866 '2' => esc_html__('2', 'embedpress'),
1867 '3' => esc_html__('3', 'embedpress'),
1868 '4' => esc_html__('4', 'embedpress'),
1869 '5' => esc_html__('5', 'embedpress'),
1870 '6' => esc_html__('6', 'embedpress'),
1871 'auto' => esc_html__('Auto', 'embedpress'),
1872 ],
1873 'condition' => [
1874 'embedpress_pro_embeded_nft_type' => ['collection']
1875 ],
1876
1877 ]
1878 );
1879
1880 $this->add_control(
1881 'gapbetweenitem',
1882 [
1883 'label' => esc_html__('Gap Between Item', 'embedpress'),
1884 'type' => \Elementor\Controls_Manager::SLIDER,
1885 'size_units' => ['px'],
1886 'range' => [
1887 'px' => [
1888 'min' => 1,
1889 'max' => 100,
1890 'step' => 1,
1891 ],
1892 ],
1893 'default' => [
1894 'unit' => 'px',
1895 'size' => 15,
1896 ],
1897 'condition' => [
1898 'embedpress_pro_embeded_nft_type' => ['collection']
1899 ],
1900 ]
1901 );
1902
1903 $this->add_control(
1904 'collectionname',
1905 [
1906 'label' => __('Collection Name', 'embedpress'),
1907 'type' => Controls_Manager::SWITCHER,
1908 'label_block' => false,
1909 'return_value' => 'yes',
1910 'label_off' => __('Hide', 'embedpress'),
1911 'label_on' => __('Show', 'embedpress'),
1912 'default' => 'yes',
1913 'condition' => [
1914 'embedpress_pro_embeded_nft_type' => 'single'
1915 ],
1916 ]
1917 );
1918 $this->add_control(
1919 'nftimage',
1920 [
1921 'label' => __('Thumbnail', 'embedpress'),
1922 'type' => Controls_Manager::SWITCHER,
1923 'label_block' => false,
1924 'return_value' => 'yes',
1925 'label_off' => __('Hide', 'embedpress'),
1926 'label_on' => __('Show', 'embedpress'),
1927 'default' => 'yes',
1928 'condition' => $condition,
1929 ]
1930 );
1931 $this->add_control(
1932 'nfttitle',
1933 [
1934 'label' => __('Title', 'embedpress'),
1935 'type' => Controls_Manager::SWITCHER,
1936 'label_block' => false,
1937 'return_value' => 'yes',
1938 'default' => '',
1939 'label_off' => __('Hide', 'embedpress'),
1940 'label_on' => __('Show', 'embedpress'),
1941 'default' => 'yes',
1942 'condition' => $condition,
1943 ]
1944 );
1945 $this->add_control(
1946 'nftcreator',
1947 [
1948 'label' => __('Creator', 'embedpress'),
1949 'type' => Controls_Manager::SWITCHER,
1950 'label_block' => false,
1951 'return_value' => 'yes',
1952 'default' => '',
1953 'label_off' => __('Hide', 'embedpress'),
1954 'label_on' => __('Show', 'embedpress'),
1955 'default' => 'yes',
1956 'condition' => $condition,
1957 ]
1958 );
1959
1960 $this->add_control(
1961 'prefix_nftcreator',
1962 [
1963 'label' => sprintf(__('Prefix %s', 'embedpress'), $this->pro_text),
1964 'type' => \Elementor\Controls_Manager::TEXT,
1965 'default' => esc_html__('Created By', 'embedpress'),
1966 'placeholder' => esc_html__('Created By', 'embedpress'),
1967 'classes' => $this->pro_class,
1968 'condition' => [
1969 'nftcreator' => 'yes',
1970 ]
1971 ]
1972 );
1973
1974 $this->add_control(
1975 'nftprice',
1976 [
1977 'label' => __('Current Price', 'embedpress'),
1978 'type' => Controls_Manager::SWITCHER,
1979 'label_block' => false,
1980 'return_value' => 'yes',
1981 'default' => '',
1982 'label_off' => __('Hide', 'embedpress'),
1983 'label_on' => __('Show', 'embedpress'),
1984 'default' => 'yes',
1985 'condition' => $condition,
1986 ]
1987 );
1988
1989 $this->add_control(
1990 'prefix_nftprice',
1991 [
1992 'label' => sprintf(__('Prefix %s', 'embedpress'), $this->pro_text),
1993 'type' => \Elementor\Controls_Manager::TEXT,
1994 'default' => esc_html__('Current Price', 'embedpress'),
1995 'placeholder' => esc_html__('Current Price', 'embedpress'),
1996 'classes' => $this->pro_class,
1997 'condition' => [
1998 'nftprice' => 'yes',
1999 ]
2000 ]
2001 );
2002
2003 $this->add_control(
2004 'nftlastsale',
2005 [
2006 'label' => __('Last Sale', 'embedpress'),
2007 'type' => Controls_Manager::SWITCHER,
2008 'label_block' => false,
2009 'return_value' => 'yes',
2010 'default' => '',
2011 'label_off' => __('Hide', 'embedpress'),
2012 'label_on' => __('Show', 'embedpress'),
2013 'default' => 'yes',
2014 'condition' => $condition,
2015 ]
2016 );
2017
2018 $this->add_control(
2019 'prefix_nftlastsale',
2020 [
2021 'label' => sprintf(__('Prefix %s', 'embedpress'), $this->pro_text),
2022 'type' => \Elementor\Controls_Manager::TEXT,
2023 'default' => esc_html__('Last Sale', 'embedpress'),
2024 'placeholder' => esc_html__('Last Sale', 'embedpress'),
2025 'classes' => $this->pro_class,
2026 'condition' => [
2027 'nftlastsale' => 'yes',
2028 ]
2029 ]
2030 );
2031
2032 $this->add_control(
2033 'nftbutton',
2034 [
2035 'label' => __('Button', 'embedpress'),
2036 'type' => Controls_Manager::SWITCHER,
2037 'label_block' => false,
2038 'return_value' => 'yes',
2039 'default' => '',
2040 'label_off' => __('Hide', 'embedpress'),
2041 'label_on' => __('Show', 'embedpress'),
2042 'default' => 'yes',
2043 'condition' => $condition,
2044 ]
2045 );
2046 $this->add_control(
2047 'label_nftbutton',
2048 [
2049 'label' => sprintf(__('Button Label %s', 'embedpress'), $this->pro_text),
2050 'type' => \Elementor\Controls_Manager::TEXT,
2051 'default' => esc_html__('See Details', 'embedpress'),
2052 'placeholder' => esc_html__('See Details', 'embedpress'),
2053 'classes' => $this->pro_class,
2054 'condition' => [
2055 'nftbutton' => 'yes',
2056 ]
2057 ]
2058 );
2059
2060 $this->add_control(
2061 'loadmore',
2062 [
2063 'label' => sprintf(__('Load More %s', 'embedpress'), $this->pro_text),
2064 'type' => Controls_Manager::SWITCHER,
2065 'label_block' => false,
2066 'return_value' => 'yes',
2067 'default' => '',
2068 'label_off' => __('Hide', 'embedpress'),
2069 'label_on' => __('Show', 'embedpress'),
2070 'default' => '',
2071 'classes' => $this->pro_class,
2072 'condition' => [
2073 'embedpress_pro_embeded_nft_type' => ['collection']
2074 ],
2075 ]
2076 );
2077 $this->add_control(
2078 'itemperpage',
2079 [
2080 'type' => \Elementor\Controls_Manager::NUMBER,
2081 'label' => esc_html__('Item Per Page', 'embedpress'),
2082 'placeholder' => '9',
2083 'min' => 1,
2084 'max' => 100,
2085 'step' => 1,
2086 'default' => 9,
2087 'condition' => [
2088 'loadmore' => 'yes'
2089 ],
2090 ]
2091 );
2092 $this->add_control(
2093 'loadmorelabel',
2094 [
2095 'type' => \Elementor\Controls_Manager::TEXT,
2096 'label' => esc_html__('Load More Label', 'embedpress'),
2097 'placeholder' => 'Load More',
2098 'default' => 'Load More',
2099 'condition' => [
2100 'loadmore' => 'yes'
2101 ],
2102 ]
2103 );
2104
2105 $this->add_control(
2106 'nftrank',
2107 [
2108 'label' => __('Rank', 'embedpress'),
2109 'type' => Controls_Manager::SWITCHER,
2110 'label_block' => false,
2111 'return_value' => 'yes',
2112 'label_off' => __('Hide', 'embedpress'),
2113 'label_on' => __('Show', 'embedpress'),
2114 'default' => 'yes',
2115 'condition' => [
2116 'embedpress_pro_embeded_nft_type' => 'single'
2117 ],
2118 ]
2119 );
2120 $this->add_control(
2121 'label_nftrank',
2122 [
2123 'label' => sprintf(__('Rank Label %s', 'embedpress'), $this->pro_text),
2124 'type' => \Elementor\Controls_Manager::TEXT,
2125 'default' => esc_html__('Rank', 'embedpress'),
2126 'placeholder' => esc_html__('Rank', 'embedpress'),
2127 'classes' => $this->pro_class,
2128 'condition' => [
2129 'nftrank' => 'yes',
2130 'embedpress_pro_embeded_nft_type!' => 'collection'
2131 ]
2132 ]
2133 );
2134
2135 $this->add_control(
2136 'nftdetails',
2137 [
2138 'label' => __('Details', 'embedpress'),
2139 'type' => Controls_Manager::SWITCHER,
2140 'label_block' => false,
2141 'return_value' => 'yes',
2142 'label_off' => __('Hide', 'embedpress'),
2143 'label_on' => __('Show', 'embedpress'),
2144 'default' => 'yes',
2145 'condition' => [
2146 'embedpress_pro_embeded_nft_type' => 'single'
2147 ],
2148 ]
2149 );
2150
2151 $this->add_control(
2152 'label_nftdetails',
2153 [
2154 'label' => sprintf(__('Details Label %s', 'embedpress'), $this->pro_text),
2155 'type' => \Elementor\Controls_Manager::TEXT,
2156 'default' => esc_html__('Details', 'embedpress'),
2157 'placeholder' => esc_html__('Details', 'embedpress'),
2158 'classes' => $this->pro_class,
2159 'condition' => [
2160 'nftdetails' => 'yes',
2161 'embedpress_pro_embeded_nft_type!' => 'collection'
2162 ]
2163 ]
2164 );
2165
2166 $this->end_controls_section();
2167 }
2168
2169 public function init_opensea_color_and_typography()
2170 {
2171 $condition = [
2172 'embedpress_pro_embeded_source' => 'opensea',
2173 ];
2174
2175 $this->start_controls_section(
2176 'embedpress_color_typography_control_section',
2177 [
2178 'label' => __('Color and Typography', 'embedpress'),
2179 'tab' => Controls_Manager::TAB_STYLE,
2180 'condition' => $condition,
2181 ]
2182 );
2183
2184 $this->add_control(
2185 'opense_color_important_note_single',
2186 [
2187 'type' => \Elementor\Controls_Manager::RAW_HTML,
2188 'raw' => esc_html__('These options take effect only when a Opensea Single Asset is embedded.', 'embedpress'),
2189 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
2190 'condition' => [
2191 'embedpress_pro_embeded_nft_type' => 'single'
2192 ],
2193
2194 ]
2195 );
2196 $this->add_control(
2197 'opense_color_important_note_collection',
2198 [
2199 'type' => \Elementor\Controls_Manager::RAW_HTML,
2200 'raw' => esc_html__('These options take effect only when a Opensea Collection is embedded.', 'embedpress'),
2201 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info',
2202 'condition' => [
2203 'embedpress_pro_embeded_nft_type' => 'collection'
2204 ],
2205 ]
2206 );
2207
2208
2209 $this->add_control(
2210 'item_heading',
2211 [
2212 'label' => esc_html__('Item', 'embedpress'),
2213 'type' => \Elementor\Controls_Manager::HEADING,
2214 'separator' => 'before',
2215 ]
2216 );
2217
2218 $this->add_control(
2219 'nft_item_background_color',
2220 [
2221 'label' => esc_html__('Background Color', 'embedpress'),
2222 'type' => \Elementor\Controls_Manager::COLOR,
2223 'selectors' => [
2224 '{{WRAPPER}} .ep_nft_content_wrap .ep_nft_item' => 'background-color: {{VALUE}}',
2225 ],
2226 ]
2227 );
2228
2229 $this->add_control(
2230 'collectionname_heading',
2231 [
2232 'label' => esc_html__('Collection Name', 'embedpress'),
2233 'type' => \Elementor\Controls_Manager::HEADING,
2234 'separator' => 'before',
2235 ]
2236 );
2237
2238 $this->add_control(
2239 'nft_collectionname_color',
2240 [
2241 'label' => esc_html__('Color', 'embedpress'),
2242 'type' => \Elementor\Controls_Manager::COLOR,
2243 'selectors' => [
2244 '{{WRAPPER}} .ep-nft-single-item-wraper a.CollectionLink--link' => 'color: {{VALUE}}',
2245 ],
2246 ]
2247 );
2248 $this->add_control(
2249 'nft_collectionname_hover_color',
2250 [
2251 'label' => esc_html__('Hove Color', 'embedpress'),
2252 'type' => \Elementor\Controls_Manager::COLOR,
2253 'selectors' => [
2254 '{{WRAPPER}} .ep-nft-single-item-wraper a.CollectionLink--link:hover' => 'color: {{VALUE}}',
2255 ],
2256 ]
2257 );
2258 $this->add_group_control(
2259 \Elementor\Group_Control_Typography::get_type(),
2260 [
2261 'name' => 'nft_collectionname_typography',
2262 'selector' => '{{WRAPPER}} .ep-nft-single-item-wraper a.CollectionLink--link',
2263 ]
2264 );
2265
2266 $this->add_control(
2267 'title_heading',
2268 [
2269 'label' => esc_html__('Title', 'embedpress'),
2270 'type' => \Elementor\Controls_Manager::HEADING,
2271 'separator' => 'before',
2272 ]
2273 );
2274
2275 $this->add_control(
2276 'nft_title_color',
2277 [
2278 'label' => esc_html__('Color', 'embedpress'),
2279 'type' => \Elementor\Controls_Manager::COLOR,
2280 'selectors' => [
2281 '{{WRAPPER}} .ep_nft_title' => 'color: {{VALUE}}',
2282 ],
2283 ]
2284 );
2285 $this->add_group_control(
2286 \Elementor\Group_Control_Typography::get_type(),
2287 [
2288 'name' => 'nft_title_typography',
2289 'selector' => '{{WRAPPER}} .ep_nft_title',
2290 ]
2291 );
2292
2293
2294 $this->add_control(
2295 'creator_heading',
2296 [
2297 'label' => esc_html__('Creator', 'embedpress'),
2298 'type' => \Elementor\Controls_Manager::HEADING,
2299 'separator' => 'before',
2300 ]
2301 );
2302
2303 $this->add_control(
2304 'nft_creator_color',
2305 [
2306 'label' => esc_html__('Color', 'embedpress'),
2307 'type' => \Elementor\Controls_Manager::COLOR,
2308 'selectors' => [
2309 '{{WRAPPER}} .ep_nft_creator span' => 'color: {{VALUE}}',
2310 ],
2311 ]
2312 );
2313 $this->add_group_control(
2314 \Elementor\Group_Control_Typography::get_type(),
2315 [
2316 'name' => 'nft_creator_typography',
2317 'selector' => '{{WRAPPER}} .ep_nft_creator span',
2318 ]
2319 );
2320
2321 $this->add_control(
2322 'nft_created_by_color',
2323 [
2324 'label' => esc_html__('Link Color', 'embedpress'),
2325 'type' => \Elementor\Controls_Manager::COLOR,
2326 'selectors' => [
2327 '{{WRAPPER}} .ep_nft_creator span a' => 'color: {{VALUE}}',
2328 ],
2329 ]
2330 );
2331 $this->add_group_control(
2332 \Elementor\Group_Control_Typography::get_type(),
2333 [
2334 'label' => esc_html__('Link Typography', 'embedpress'),
2335 'name' => 'nft_created_by_typography',
2336 'selector' => '{{WRAPPER}} .ep_nft_creator span a',
2337 ]
2338 );
2339
2340 $this->add_control(
2341 'price_heading',
2342 [
2343 'label' => esc_html__('Current Price', 'embedpress'),
2344 'type' => \Elementor\Controls_Manager::HEADING,
2345 'separator' => 'before',
2346 ]
2347 );
2348
2349 $this->add_control(
2350 'nft_price_color',
2351 [
2352 'label' => esc_html__('Color', 'embedpress'),
2353 'type' => \Elementor\Controls_Manager::COLOR,
2354 'selectors' => [
2355 '{{WRAPPER}} .ep_current_price span' => 'color: {{VALUE}}',
2356 ],
2357 ]
2358 );
2359
2360 $this->add_group_control(
2361 \Elementor\Group_Control_Typography::get_type(),
2362 [
2363 'name' => 'nft_price_typography',
2364 'selector' => '{{WRAPPER}} .ep_current_price span',
2365 ]
2366 );
2367 $this->add_control(
2368 'last_sale_heading',
2369 [
2370 'label' => esc_html__('Last Sale Price', 'embedpress'),
2371 'type' => \Elementor\Controls_Manager::HEADING,
2372 'separator' => 'before',
2373 ]
2374 );
2375
2376 $this->add_control(
2377 'nft_last_sale_color',
2378 [
2379 'label' => esc_html__('Color', 'embedpress'),
2380 'type' => \Elementor\Controls_Manager::COLOR,
2381 'selectors' => [
2382 '{{WRAPPER}} .ep_nft_last_sale span' => 'color: {{VALUE}}',
2383 ],
2384 ]
2385 );
2386 $this->add_group_control(
2387 \Elementor\Group_Control_Typography::get_type(),
2388 [
2389 'name' => 'nft_last_sale_typography',
2390 'selector' => '{{WRAPPER}} .ep_nft_last_sale span',
2391 ]
2392 );
2393 $this->add_control(
2394 'nftbutton_heading',
2395 [
2396 'label' => esc_html__('Button', 'embedpress'),
2397 'type' => \Elementor\Controls_Manager::HEADING,
2398 'separator' => 'before',
2399 ]
2400 );
2401
2402
2403 $this->add_control(
2404 'nftbutton_color',
2405 [
2406 'label' => esc_html__('Color', 'embedpress'),
2407 'type' => \Elementor\Controls_Manager::COLOR,
2408 'selectors' => [
2409 '{{WRAPPER}} .ep-nft-gallery-wrapper.ep-nft-gallery-r1a5mbx .ep_nft_button a' => 'color: {{VALUE}}',
2410 ],
2411 ]
2412 );
2413 $this->add_control(
2414 'nftbutton_bg_color',
2415 [
2416 'label' => esc_html__('Background Color', 'embedpress'),
2417 'type' => \Elementor\Controls_Manager::COLOR,
2418 'selectors' => [
2419 '{{WRAPPER}} .ep-nft-gallery-wrapper.ep-nft-gallery-r1a5mbx .ep_nft_button a' => 'background-color: {{VALUE}}',
2420 ],
2421 ]
2422 );
2423 $this->add_group_control(
2424 \Elementor\Group_Control_Typography::get_type(),
2425 [
2426 'name' => 'nftbutton_typography',
2427 'selector' => '{{WRAPPER}} .ep-nft-gallery-wrapper.ep-nft-gallery-r1a5mbx .ep_nft_button a',
2428 ]
2429 );
2430 $this->add_control(
2431 'nft_loadmore_style',
2432 [
2433 'label' => esc_html__('Load More', 'embedpress'),
2434 'type' => \Elementor\Controls_Manager::HEADING,
2435 'separator' => 'before',
2436 'condition' => [
2437 'loadmore' => 'yes',
2438 'embedpress_pro_embeded_nft_type' => 'collection'
2439 ]
2440 ]
2441 );
2442
2443 $this->add_control(
2444 'nft_loadmore_color',
2445 [
2446 'label' => esc_html__('Text Color', 'embedpress'),
2447 'type' => \Elementor\Controls_Manager::COLOR,
2448 'selectors' => [
2449 '{{WRAPPER}} .nft-loadmore' => 'color: {{VALUE}}!important;',
2450 '{{WRAPPER}} .nft-loadmore svg' => 'fill: {{VALUE}}!important;',
2451 ],
2452 'condition' => [
2453 'loadmore' => 'yes',
2454 'embedpress_pro_embeded_nft_type' => 'collection'
2455 ]
2456 ]
2457 );
2458 $this->add_group_control(
2459 \Elementor\Group_Control_Typography::get_type(),
2460 [
2461 'name' => 'nft_loadmore_typography',
2462 'selector' => '{{WRAPPER}} .nft-loadmore, {{WRAPPER}} .nft-loadmore svg',
2463 'condition' => [
2464 'loadmore' => 'yes',
2465 'embedpress_pro_embeded_nft_type' => 'collection'
2466 ]
2467 ]
2468 );
2469 $this->add_control(
2470 'nft_loadmore_bgcolor',
2471 [
2472 'label' => esc_html__('Background Color', 'embedpress'),
2473 'type' => \Elementor\Controls_Manager::COLOR,
2474 'selectors' => [
2475 '{{WRAPPER}} .nft-loadmore' => 'background-color: {{VALUE}}!important;',
2476 ],
2477 'condition' => [
2478 'loadmore' => 'yes',
2479 'embedpress_pro_embeded_nft_type' => 'collection'
2480 ]
2481 ]
2482 );
2483
2484 $this->add_control(
2485 'nftrank_heading',
2486 [
2487 'label' => esc_html__('Rank', 'embedpress'),
2488 'type' => \Elementor\Controls_Manager::HEADING,
2489 'separator' => 'before',
2490 'condition' => [
2491 'nftrank' => 'yes',
2492 'embedpress_pro_embeded_nft_type!' => 'collection'
2493 ]
2494 ]
2495 );
2496
2497 $this->add_control(
2498 'nftrank_label_color',
2499 [
2500 'label' => esc_html__('Label Color', 'embedpress'),
2501 'type' => \Elementor\Controls_Manager::COLOR,
2502 'selectors' => [
2503 '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper' => 'color: {{VALUE}}!important;',
2504 ],
2505 'condition' => [
2506 'nftrank' => 'yes',
2507 'embedpress_pro_embeded_nft_type!' => 'collection'
2508 ]
2509 ]
2510 );
2511 $this->add_group_control(
2512 \Elementor\Group_Control_Typography::get_type(),
2513 [
2514 'name' => 'nftrank_label_typography',
2515 'selector' => '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper ',
2516 'condition' => [
2517 'nftrank' => 'yes',
2518 'embedpress_pro_embeded_nft_type!' => 'collection'
2519 ]
2520 ]
2521 );
2522 $this->add_control(
2523 'nftrank_color',
2524 [
2525 'label' => esc_html__('Rank Color', 'embedpress'),
2526 'type' => \Elementor\Controls_Manager::COLOR,
2527 'selectors' => [
2528 '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper span.ep-nft-rank' => 'color: {{VALUE}}!important;',
2529 ],
2530 'condition' => [
2531 'nftrank' => 'yes',
2532 'embedpress_pro_embeded_nft_type!' => 'collection'
2533 ]
2534 ]
2535 );
2536 $this->add_control(
2537 'nftrank_border_color',
2538 [
2539 'label' => esc_html__('Border Color', 'embedpress'),
2540 'type' => \Elementor\Controls_Manager::COLOR,
2541 'selectors' => [
2542 '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper span.ep-nft-rank' => 'border-color: {{VALUE}}!important',
2543 ],
2544 'condition' => [
2545 'nftrank' => 'yes',
2546 'embedpress_pro_embeded_nft_type!' => 'collection'
2547 ]
2548 ]
2549 );
2550 $this->add_group_control(
2551 \Elementor\Group_Control_Typography::get_type(),
2552 [
2553 'name' => 'nftrank_typography',
2554 'selector' => '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper span.ep-nft-rank',
2555 'condition' => [
2556 'nftrank' => 'yes',
2557 'embedpress_pro_embeded_nft_type!' => 'collection'
2558 ]
2559 ]
2560 );
2561
2562
2563
2564 $this->add_control(
2565 'nftdetails_heading',
2566 [
2567 'label' => esc_html__('Details', 'embedpress'),
2568 'type' => \Elementor\Controls_Manager::HEADING,
2569 'separator' => 'before',
2570 'condition' => [
2571 'nftrank' => 'yes',
2572 'embedpress_pro_embeded_nft_type!' => 'collection'
2573 ]
2574 ]
2575 );
2576
2577 $this->add_control(
2578 'nftdetail_title_color',
2579 [
2580 'label' => esc_html__('Title Color', 'embedpress'),
2581 'type' => \Elementor\Controls_Manager::COLOR,
2582 'selectors' => [
2583 '{{WRAPPER}} .ep-title' => 'color: {{VALUE}}',
2584 ],
2585 'condition' => [
2586 'nftrank' => 'yes',
2587 'embedpress_pro_embeded_nft_type!' => 'collection'
2588 ]
2589 ]
2590 );
2591 $this->add_group_control(
2592 \Elementor\Group_Control_Typography::get_type(),
2593 [
2594 'label' => esc_html__('Title Typography', 'embedpress'),
2595 'name' => 'nftdetail_title_typography',
2596 'selector' => '{{WRAPPER}} .ep-title',
2597 'condition' => [
2598 'nftrank' => 'yes',
2599 'embedpress_pro_embeded_nft_type!' => 'collection'
2600 ]
2601 ]
2602 );
2603
2604 $this->add_control(
2605 'nftdetail_color',
2606 [
2607 'label' => esc_html__('Content Color', 'embedpress'),
2608 'type' => \Elementor\Controls_Manager::COLOR,
2609 'selectors' => [
2610 '{{WRAPPER}} .ep-asset-detail-item' => 'color: {{VALUE}}',
2611 ],
2612 'condition' => [
2613 'nftrank' => 'yes',
2614 'embedpress_pro_embeded_nft_type!' => 'collection'
2615 ]
2616 ]
2617 );
2618 $this->add_group_control(
2619 \Elementor\Group_Control_Typography::get_type(),
2620 [
2621 'label' => esc_html__('Content Typography', 'embedpress'),
2622 'name' => 'nftdetail_typography',
2623 'selector' => '{{WRAPPER}} .ep-asset-detail-item',
2624 'condition' => [
2625 'nftrank' => 'yes',
2626 'embedpress_pro_embeded_nft_type!' => 'collection'
2627 ]
2628 ]
2629 );
2630
2631 $this->add_control(
2632 'nftdetail_link_color',
2633 [
2634 'label' => esc_html__('Link Color', 'embedpress'),
2635 'type' => \Elementor\Controls_Manager::COLOR,
2636 'selectors' => [
2637 '{{WRAPPER}} .ep-asset-detail-item a' => 'color: {{VALUE}}',
2638 ],
2639 'condition' => [
2640 'nftrank' => 'yes',
2641 'embedpress_pro_embeded_nft_type!' => 'collection'
2642 ]
2643 ]
2644 );
2645 $this->add_group_control(
2646 \Elementor\Group_Control_Typography::get_type(),
2647 [
2648 'name' => 'nftdetail_link_typography',
2649 'selector' => '{{WRAPPER}} .ep-asset-detail-item a, .ep-asset-detail-item',
2650 'condition' => [
2651 'nftrank' => 'yes',
2652 'embedpress_pro_embeded_nft_type!' => 'collection'
2653 ]
2654 ]
2655 );
2656
2657
2658 $this->end_controls_section();
2659 }
2660
2661 //End OpenSea controls
2662
2663
2664
2665 /**
2666 * Instagram Feed Controls
2667 */
2668 public function init_instafeed_control(){
2669 $condition = [
2670 'embedpress_pro_embeded_source' => 'instafeed'
2671 ];
2672 $disableAi = [
2673 'active' => false,
2674 ];
2675
2676 $this->add_control(
2677 'instaLayout',
2678 [
2679 'type' => \Elementor\Controls_Manager::SELECT,
2680 'label' => esc_html__( 'Layout', 'embedpress' ),
2681 'options' => [
2682 'insta-grid' => esc_html__( 'Grid', 'embedpress' ),
2683 'insta-masonry' => sprintf(__('Masonry%s', 'embedpress'), $this->pro_label),
2684 'insta-carousel' => sprintf(__('Carousel%s', 'embedpress'), $this->pro_label),
2685 ],
2686 'default' => 'insta-grid',
2687 'condition' => $condition,
2688 ]
2689 );
2690
2691 if ( !is_embedpress_pro_active() ) {
2692 $this->add_control(
2693 'embedpress_insta_layout__pro_enable_warning',
2694 [
2695 'label' => sprintf( '<a style="color: red" target="_blank" href="https://wpdeveloper.com/in/upgrade-embedpress">%s</a>',
2696 esc_html__( 'Only Available in Pro Version!', 'essential-addons-for-elementor-lite' ) ),
2697 'type' => Controls_Manager::RAW_HTML,
2698 'condition' => [
2699 'instaLayout' => [ 'insta-masonry', 'insta-carousel' ],
2700 ],
2701 ]
2702 );
2703 }
2704
2705 $this->add_control(
2706 'instafeedColumns',
2707 [
2708 'label' => __('Column', 'embedpress'),
2709 'type' => \Elementor\Controls_Manager::SELECT,
2710 'label_block' => false,
2711 'default' => '3',
2712 'options' => [
2713 '2' => esc_html__('2', 'embedpress'),
2714 '3' => esc_html__('3', 'embedpress'),
2715 '4' => esc_html__('4', 'embedpress'),
2716 '6' => esc_html__('6', 'embedpress'),
2717 'auto' => esc_html__('Auto', 'embedpress'),
2718 ],
2719 'condition' => [
2720 'instaLayout' => ['insta-grid', 'insta-masonry'],
2721 'embedpress_pro_embeded_source' => 'instafeed'
2722 ],
2723 ]
2724 );
2725
2726 $this->add_control(
2727 'instafeedColumnsGap',
2728 [
2729 'label' => esc_html__( 'Column Gap', 'embedpress' ),
2730 'type' => \Elementor\Controls_Manager::NUMBER,
2731 'min' => 0,
2732 'max' => 100,
2733 'step' => 1,
2734 'default' => 5,
2735 'condition' => [
2736 'instaLayout' => [ 'insta-masonry', 'insta-grid' ],
2737 ],
2738 ]
2739 );
2740
2741 $this->add_control(
2742 'embedpress_instafeed_slide_show',
2743 [
2744 'type' => \Elementor\Controls_Manager::SELECT,
2745 'label' => esc_html__( 'Slides to Show', 'embedpress' ),
2746 'options' => [
2747 '1' => esc_html__( '1', 'embedpress' ),
2748 '2' => esc_html__( '2', 'embedpress' ),
2749 '3' => esc_html__( '3', 'embedpress' ),
2750 '4' => esc_html__( '4', 'embedpress' ),
2751 '5' => esc_html__( '5', 'embedpress' ),
2752 '6' => esc_html__( '6', 'embedpress' ),
2753 '7' => esc_html__( '7', 'embedpress' ),
2754 '8' => esc_html__( '8', 'embedpress' ),
2755 '9' => esc_html__( '9', 'embedpress' ),
2756 '10' => esc_html__( '10', 'embedpress' ),
2757 ],
2758 'default' => '5',
2759 'condition' => [
2760 'embedpress_pro_embeded_source' => 'instafeed',
2761 'instaLayout' => 'insta-carousel'
2762 ],
2763 ]
2764 );
2765
2766 $this->add_control(
2767 'embedpress_carousel_autoplay',
2768 [
2769 'label' => __('Auto Play', 'embedpress'),
2770 'type' => Controls_Manager::SWITCHER,
2771 'label_block' => false,
2772 'return_value' => 'yes',
2773 'default' => '',
2774 'condition' => [
2775 'embedpress_pro_embeded_source' => 'instafeed',
2776 'instaLayout' => 'insta-carousel'
2777 ],
2778 ]
2779 );
2780 $this->add_control(
2781 'embedpress_carousel_autoplay_speed',
2782 [
2783 'label' => esc_html__( 'Autoplay Speed(ms)', 'embedpress' ),
2784 'type' => \Elementor\Controls_Manager::NUMBER,
2785 'min' => 0,
2786 'step' => 1,
2787 'default' => 0,
2788 'condition' => [
2789 'embedpress_pro_embeded_source' => 'instafeed',
2790 'instaLayout' => 'insta-carousel'
2791 ],
2792 ]
2793 );
2794 $this->add_control(
2795 'embedpress_carousel_transition_speed',
2796 [
2797 'label' => esc_html__( 'Transition Speed(ms)', 'embedpress' ),
2798 'type' => \Elementor\Controls_Manager::NUMBER,
2799 'min' => 0,
2800 'step' => 1,
2801 'default' => 0,
2802 'condition' => [
2803 'embedpress_pro_embeded_source' => 'instafeed',
2804 'instaLayout' => 'insta-carousel'
2805 ],
2806 ]
2807 );
2808 $this->add_control(
2809 'embedpress_carousel_loop',
2810 [
2811 'label' => __('Loop', 'embedpress'),
2812 'type' => Controls_Manager::SWITCHER,
2813 'label_block' => false,
2814 'return_value' => 'yes',
2815 'default' => 'yes',
2816 'condition' => [
2817 'embedpress_pro_embeded_source' => 'instafeed',
2818 'instaLayout' => 'insta-carousel'
2819 ],
2820 ]
2821 );
2822
2823 $this->add_control(
2824 'embedpress_carousel_arrows',
2825 [
2826 'label' => __('Arrows', 'embedpress'),
2827 'type' => Controls_Manager::SWITCHER,
2828 'label_block' => false,
2829 'return_value' => 'yes',
2830 'default' => 'yes',
2831 'condition' => [
2832 'embedpress_pro_embeded_source' => 'instafeed',
2833 'instaLayout' => 'insta-carousel'
2834 ],
2835 ]
2836 );
2837
2838
2839 $this->add_control(
2840 'embedpress_carousel_spacing',
2841 [
2842 'label' => esc_html__( 'Spacing', 'embedpress' ),
2843 'type' => \Elementor\Controls_Manager::NUMBER,
2844 'min' => 0,
2845 'max' => 100,
2846 'step' => 1,
2847 'default' => 0,
2848 'condition' => [
2849 'embedpress_pro_embeded_source' => 'instafeed',
2850 'instaLayout' => 'insta-carousel'
2851 ],
2852 ]
2853 );
2854
2855 $this->add_control(
2856 'instafeedPostsPerPage',
2857 [
2858 'label' => esc_html__( 'Posts Per Page', 'embedpress' ),
2859 'type' => \Elementor\Controls_Manager::NUMBER,
2860 'min' => 1,
2861 'max' => 100,
2862 'step' => 12,
2863 'default' => 12,
2864 'condition' => [
2865 'embedpress_pro_embeded_source' => 'instafeed',
2866 ],
2867 ]
2868 );
2869
2870 $this->add_control(
2871 'instafeedTab',
2872 [
2873 'label' => sprintf(__('Feed Tab %s', 'embedpress'), $this->pro_text),
2874 'type' => Controls_Manager::SWITCHER,
2875 'classes' => $this->pro_class,
2876 'label_block' => false,
2877 'return_value' => 'yes',
2878 'default' => 'yes',
2879 'condition' => $condition,
2880 ]
2881 );
2882
2883 $this->add_control(
2884 'instafeedLikesCount',
2885 [
2886 'label' => sprintf(__('Like Count %s', 'embedpress'), $this->pro_text),
2887 'type' => Controls_Manager::SWITCHER,
2888 'classes' => $this->pro_class,
2889 'label_block' => false,
2890 'return_value' => 'true',
2891 'default' => 'true',
2892 'conditions' => [
2893 'relation' => 'or',
2894 'terms' => [
2895 [
2896 'name' => 'instafeedFeedType',
2897 'operator' => '===',
2898 'value' => 'hashtag_type',
2899 ],
2900 [
2901 'relation' => 'and',
2902 'terms' => [
2903 [
2904 'name' => 'instafeedAccountType',
2905 'operator' => '===',
2906 'value' => 'business',
2907 ],
2908 [
2909 'name' => 'embedpress_pro_embeded_source',
2910 'operator' => '===',
2911 'value' => 'instafeed',
2912 ],
2913 ],
2914 ],
2915 ],
2916 ],
2917 ]
2918 );
2919
2920 $this->add_control(
2921 'instafeedCommentsCount',
2922 [
2923 'label' => sprintf(__('Comments Count %s', 'embedpress'), $this->pro_text),
2924 'type' => Controls_Manager::SWITCHER,
2925 'classes' => $this->pro_class,
2926 'label_block' => false,
2927 'return_value' => 'true',
2928 'default' => 'true',
2929
2930 'conditions' => [
2931 'relation' => 'or',
2932 'terms' => [
2933 [
2934 'name' => 'instafeedFeedType',
2935 'operator' => '===',
2936 'value' => 'hashtag_type',
2937 ],
2938 [
2939 'relation' => 'and',
2940 'terms' => [
2941 [
2942 'name' => 'instafeedAccountType',
2943 'operator' => '===',
2944 'value' => 'business',
2945 ],
2946 [
2947 'name' => 'embedpress_pro_embeded_source',
2948 'operator' => '===',
2949 'value' => 'instafeed',
2950 ],
2951 ],
2952 ],
2953 ],
2954 ],
2955
2956 ]
2957 );
2958
2959
2960 $this->add_control(
2961 'instafeedPopup',
2962 [
2963 'label' => __('Popup', 'embedpress'),
2964 'type' => Controls_Manager::SWITCHER,
2965 'label_block' => false,
2966 'return_value' => 'yes',
2967 'default' => 'yes',
2968 'condition' => $condition,
2969 ]
2970 );
2971
2972 $this->add_control(
2973 'instafeedPopupFollowBtn',
2974 [
2975 'label' => __('Popup Follow Button', 'embedpress'),
2976 'type' => Controls_Manager::SWITCHER,
2977 'label_block' => false,
2978 'return_value' => 'yes',
2979 'default' => 'yes',
2980 'condition' => [
2981 'embedpress_pro_embeded_source' => 'instafeed',
2982 'instafeedPopup' => 'yes'
2983 ],
2984 ]
2985 );
2986
2987 $this->add_control(
2988 'instafeedPopupFollowBtnLabel',
2989 [
2990 'type' => \Elementor\Controls_Manager::TEXT,
2991 'label' => esc_html__('Follow Button Label', 'embedpress'),
2992 'placeholder' => 'Follow',
2993 'default' => 'Follow',
2994 'separator' => 'after',
2995 'condition' => [
2996 'instafeedPopupFollowBtn' => 'yes',
2997 'instafeedPopup' => 'yes',
2998 'embedpress_pro_embeded_source' => 'instafeed'
2999 ],
3000 'ai' => $disableAi
3001 ]
3002 );
3003
3004 $this->add_control(
3005 'instafeedLoadmore',
3006 [
3007 'label' => __('Load More', 'embedpress'),
3008 'type' => Controls_Manager::SWITCHER,
3009 'label_block' => false,
3010 'return_value' => 'yes',
3011 'default' => 'yes',
3012 'condition' => [
3013 'embedpress_pro_embeded_source' => 'instafeed',
3014 'instaLayout!' => 'insta-carousel'
3015 ],
3016 ]
3017 );
3018 $this->add_control(
3019 'instafeedLoadmoreLabel',
3020 [
3021 'type' => \Elementor\Controls_Manager::TEXT,
3022 'label' => esc_html__('Load More Button Label', 'embedpress'),
3023 'placeholder' => 'Load More',
3024 'default' => 'Load More',
3025 'condition' => [
3026 'embedpress_pro_embeded_source' => 'instafeed',
3027 'instafeedLoadmore' => 'yes',
3028 'instaLayout!' => 'insta-carousel'
3029 ],
3030 'ai' => $disableAi
3031 ]
3032 );
3033
3034 }
3035
3036 public function init_instafeed_control_section()
3037 {
3038 $condition = [
3039 'embedpress_pro_embeded_source' => 'instafeed'
3040 ];
3041 $disableAi = [
3042 'active' => false,
3043 ];
3044
3045 $this->start_controls_section(
3046 'embedpress_instafeed_profile_section',
3047 [
3048 'label' => __('Instagram Profile Settings', 'embedpress'),
3049 'condition' => [
3050 'embedpress_pro_embeded_source' => 'instafeed'
3051 ],
3052 ]
3053 );
3054
3055
3056 $this->add_control(
3057 'instafeedProfileImage',
3058 [
3059 'label' => __('Profile Image', 'embedpress'),
3060 'type' => Controls_Manager::SWITCHER,
3061 'label_block' => false,
3062 'return_value' => 'yes',
3063 'default' => 'yes',
3064 'condition' => [
3065 'embedpress_pro_embeded_source' => 'instafeed'
3066 ],
3067 ]
3068 );
3069
3070 $this->add_control(
3071 "instafeedProfileImageUrl",
3072 [
3073 'label' => sprintf(__('Image %s', 'embedpress'), $this->pro_text),
3074 'type' => Controls_Manager::MEDIA,
3075 'classes' => $this->pro_class,
3076 'dynamic' => [
3077 'active' => false,
3078 ],
3079 'condition' => [
3080 'instafeedProfileImage' => 'yes',
3081 'embedpress_pro_embeded_source' => 'instafeed'
3082 ],
3083 'ai' => $disableAi
3084 ]
3085 );
3086
3087
3088 $this->add_control(
3089 'instafeedFollowBtn',
3090 [
3091 'label' => __('Follow Button', 'embedpress'),
3092 'type' => Controls_Manager::SWITCHER,
3093 'label_block' => false,
3094 'return_value' => 'yes',
3095 'default' => 'yes',
3096 'condition' => $condition,
3097 ]
3098 );
3099
3100 $this->add_control(
3101 'instafeedFollowBtnLabel',
3102 [
3103 'label' => sprintf(__('Button Label %s', 'embedpress'), $this->pro_text),
3104 'type' => Controls_Manager::TEXT,
3105 'classes' => $this->pro_class,
3106 'placeholder' => __('Follow', 'embedpress'),
3107 'default' => 'Follow',
3108 'separator' => 'after',
3109 'label_block' => false,
3110 'condition' => [
3111 'instafeedFollowBtn' => 'yes',
3112 'embedpress_pro_embeded_source' => 'instafeed'
3113 ],
3114 'ai' => $disableAi
3115 ]
3116 );
3117
3118 $this->add_control(
3119 'instafeedPostsCount',
3120 [
3121 'label' => __('Posts Count', 'embedpress'),
3122 'type' => Controls_Manager::SWITCHER,
3123 'label_block' => false,
3124 'return_value' => 'yes',
3125 'default' => 'yes',
3126 'condition' => [
3127 'embedpress_pro_embeded_source' => 'instafeed',
3128 'instafeedFeedType!' => 'hashtag_type'
3129 ],
3130 ]
3131 );
3132 $this->add_control(
3133 'instafeedPostsCountText',
3134 [
3135 'label' => __('Count Text', 'embedpress'),
3136 'type' => Controls_Manager::TEXT,
3137 'placeholder' => __('[count] posts', 'embedpress'),
3138 'default' => '[count] posts',
3139 'label_block' => false,
3140 'separator' => 'after',
3141 'condition' => [
3142 'instafeedPostsCount' => 'yes',
3143 'instafeedFeedType!' => 'hashtag_type',
3144 'embedpress_pro_embeded_source' => 'instafeed',
3145 ],
3146 'ai' => $disableAi
3147 ]
3148 );
3149 $this->add_control(
3150 'instafeedFollowersCount',
3151 [
3152 'label' => __('Followers Count', 'embedpress'),
3153 'type' => Controls_Manager::SWITCHER,
3154 'label_block' => false,
3155 'return_value' => 'yes',
3156 'default' => 'yes',
3157 'condition' => [
3158 'instafeedAccountType!' => 'personal',
3159 'instafeedFeedType!' => 'hashtag_type',
3160 'embedpress_pro_embeded_source' => 'instafeed',
3161 ],
3162 ]
3163 );
3164 $this->add_control(
3165 'instafeedFollowersCountText',
3166 [
3167 'label' => __('Count Text', 'embedpress'),
3168 'type' => Controls_Manager::TEXT,
3169 'placeholder' => __('[count] followers', 'embedpress'),
3170 'default' => '[count] followers',
3171 'label_block' => false,
3172 'separator' => 'after',
3173 'condition' => [
3174 'instafeedAccountType!' => 'personal',
3175 'instafeedFollowersCount' => 'yes',
3176 'instafeedFeedType!' => 'hashtag_type',
3177 'embedpress_pro_embeded_source' => 'instafeed'
3178 ],
3179 'ai' => $disableAi
3180 ]
3181 );
3182
3183 $this->add_control(
3184 'instafeedAccName',
3185 [
3186 'label' => __('Account Name', 'embedpress'),
3187 'type' => Controls_Manager::SWITCHER,
3188 'label_block' => false,
3189 'return_value' => 'yes',
3190 'default' => 'yes',
3191 'condition' => [
3192 'instafeedAccountType!' => 'personal',
3193 'instafeedFeedType!' => 'hashtag_type',
3194 'embedpress_pro_embeded_source' => 'instafeed'
3195 ],
3196 ]
3197 );
3198 $this->end_controls_section();
3199
3200 $this->start_controls_section(
3201 'embedpress_instafeed_control_section',
3202 [
3203 'label' => __('Instagram Feed Settings', 'embedpress'),
3204 'condition' => [
3205 'embedpress_pro_embeded_source' => 'instafeed'
3206 ],
3207 ]
3208 );
3209
3210 $this->init_instafeed_control();
3211
3212 $this->end_controls_section();
3213
3214
3215
3216 }
3217
3218
3219 //End Feed Controls
3220
3221
3222 /**
3223 * Calendly Controls
3224 */
3225 public function init_calendly_control_section()
3226 {
3227
3228 $condition = [
3229 'embedpress_pro_embeded_source' => 'calendly',
3230 ];
3231
3232 $this->start_controls_section(
3233 'embedpress_calendly_control_section',
3234 [
3235 'label' => __('Calendly Controls', 'embedpress'),
3236 'condition' => $condition,
3237 ]
3238 );
3239 $this->add_control(
3240 'cEmbedType',
3241 [
3242 'label' => __('Embed Type', 'embedpress'),
3243 'type' => \Elementor\Controls_Manager::SELECT,
3244 'default' => 'inline',
3245 'options' => [
3246 'inline' => __('Inline', 'embedpress'),
3247 'popup_button' => __('Popup Button', 'embedpress'),
3248 ],
3249 'condition' => $condition
3250 ]
3251 );
3252 $this->add_control(
3253 'popupControlsHeadding',
3254 [
3255 'label' => esc_html__('Popup Button Settings', 'embedpress'),
3256 'type' => \Elementor\Controls_Manager::HEADING,
3257 'separator' => 'before',
3258 'condition' => [
3259 'embedpress_pro_embeded_source' => 'calendly',
3260 'cEmbedType' => 'popup_button'
3261 ]
3262 ]
3263 );
3264 $this->add_control(
3265 'cPopupButtonText',
3266 [
3267 'label' => __('Button Text', 'embedpress'),
3268 'type' => \Elementor\Controls_Manager::TEXT,
3269 'label_block' => true,
3270 'default' => 'Schedule time with me',
3271 'condition' => [
3272 'embedpress_pro_embeded_source' => 'calendly',
3273 'cEmbedType' => 'popup_button'
3274 ],
3275 'ai' => [
3276 'active' => false,
3277 ],
3278 ]
3279 );
3280
3281
3282 $this->add_control(
3283 'cPopupButtonTextColor',
3284 [
3285 'label' => __('Text Color', 'embedpress'),
3286 'type' => \Elementor\Controls_Manager::COLOR,
3287 'default' => '#ffffff',
3288 'condition' => [
3289 'embedpress_pro_embeded_source' => 'calendly',
3290 'cEmbedType' => 'popup_button'
3291 ]
3292 ]
3293 );
3294 $this->add_control(
3295 'cPopupButtonBGColor',
3296 [
3297 'label' => __('Background Color', 'embedpress'),
3298 'type' => \Elementor\Controls_Manager::COLOR,
3299 'default' => '#0000FF',
3300 'condition' => [
3301 'embedpress_pro_embeded_source' => 'calendly',
3302 'cEmbedType' => 'popup_button'
3303 ]
3304 ]
3305 );
3306
3307 $this->add_control(
3308 'calendlyControlsHeadding',
3309 [
3310 'label' => esc_html__('Calender Settings', 'embedpress'),
3311 'type' => \Elementor\Controls_Manager::HEADING,
3312 'separator' => 'before',
3313 ]
3314 );
3315
3316 $this->add_control(
3317 'calendlyData',
3318 [
3319 'label' => sprintf(__('Calendly Data %s', 'embedpress'), $this->pro_text),
3320 'type' => \Elementor\Controls_Manager::SWITCHER,
3321 'default' => '',
3322 'classes' => $this->pro_class,
3323 'condition' => $condition
3324 ]
3325 );
3326
3327 $this->add_control(
3328 'calendlyDataLink',
3329 [
3330 'type' => \Elementor\Controls_Manager::RAW_HTML,
3331 'raw' => '<div style="display: flex; align-items: center;gap:5px;"><span style="font-size:18px" class="eicon-editor-external-link"></span><a href="/wp-admin/admin.php?page=embedpress&page_type=calendly" target="_blank" >View Calendly Data</a></div>',
3332 'condition' => [
3333 'calendlyData' => 'yes'
3334 ]
3335
3336 ]
3337 );
3338
3339 $this->add_control(
3340 'hideCookieBanner',
3341 [
3342 'label' => __('Hide Cookie Banner', 'embedpress'),
3343 'type' => \Elementor\Controls_Manager::SWITCHER,
3344 'default' => '',
3345 'condition' => $condition
3346 ]
3347 );
3348 $this->add_control(
3349 'hideEventTypeDetails',
3350 [
3351 'label' => __('Hide Event Type Details', 'embedpress'),
3352 'type' => \Elementor\Controls_Manager::SWITCHER,
3353 'default' => '',
3354 'condition' => $condition
3355 ]
3356 );
3357
3358 $this->add_control(
3359 'cBackgroundColor',
3360 [
3361 'label' => __('Background Color', 'embedpress'),
3362 'type' => \Elementor\Controls_Manager::COLOR,
3363 'default' => '',
3364 'condition' => $condition
3365 ]
3366 );
3367
3368 $this->add_control(
3369 'cTextColor',
3370 [
3371 'label' => __('Text Color', 'embedpress'),
3372 'type' => \Elementor\Controls_Manager::COLOR,
3373 'default' => '',
3374 'condition' => $condition
3375 ]
3376 );
3377
3378 $this->add_control(
3379 'cButtonLinkColor',
3380 [
3381 'label' => __('Button & Link Color', 'embedpress'),
3382 'type' => \Elementor\Controls_Manager::COLOR,
3383 'default' => '',
3384 'condition' => $condition
3385 ]
3386 );
3387
3388 $this->end_controls_section();
3389 }
3390
3391 //End calendly controlS
3392
3393 public function init_style_controls()
3394 {
3395 $this->start_controls_section(
3396 'embedpress_style_section',
3397 [
3398 'label' => __('General', 'embedpress'),
3399 'tab' => Controls_Manager::TAB_STYLE,
3400 'condition' => [
3401 'embedpress_pro_embeded_source!' => 'opensea',
3402 ]
3403
3404 ]
3405 );
3406 $this->add_responsive_control(
3407 'width',
3408 [
3409 'label' => __('Width', 'embedpress'),
3410 'type' => Controls_Manager::SLIDER,
3411 'size_units' => ['px'],
3412 'range' => [
3413 'px' => [
3414 'min' => 0,
3415 'max' => 1500,
3416 'step' => 1,
3417 ],
3418 ],
3419 'devices' => ['desktop', 'tablet', 'mobile'],
3420 'default' => [
3421 'size' => Helper::get_options_value('enableEmbedResizeWidth'),
3422 'unit' => 'px',
3423 ],
3424 'desktop_default' => [
3425 'size' => 600,
3426 'unit' => 'px',
3427 ],
3428 'tablet_default' => [
3429 'size' => 600,
3430 'unit' => 'px',
3431 ],
3432 'mobile_default' => [
3433 'size' => 600,
3434 'unit' => 'px',
3435 ],
3436 'selectors' => [
3437 '{{WRAPPER}} .embedpress-elements-wrapper .ose-embedpress-responsive>iframe,{{WRAPPER}} .embedpress-elements-wrapper .ose-embedpress-responsive, {{WRAPPER}} .ad-youtube-video > iframe,
3438 {{WRAPPER}} .plyr--video, {{WRAPPER}} .ose-giphy img' => 'width: {{size}}{{UNIT}}!important; max-width: 100%!important;',
3439 ],
3440 ]
3441 );
3442
3443 $this->add_responsive_control(
3444 'height',
3445 [
3446 'label' => __('Height', 'embedpress'),
3447 'type' => Controls_Manager::SLIDER,
3448 'size_units' => ['px'],
3449 'range' => [
3450 'px' => [
3451 'min' => 0,
3452 'max' => 1500,
3453 'step' => 1,
3454 ],
3455 ],
3456 'devices' => ['desktop', 'tablet', 'mobile'],
3457 'desktop_default' => [
3458 'size' => 400,
3459 'unit' => 'px',
3460 ],
3461 'default' => [
3462 'size' => Helper::get_options_value('enableEmbedResizeHeight'),
3463 'unit' => 'px',
3464 ],
3465 'tablet_default' => [
3466 'size' => 400,
3467 'unit' => 'px',
3468 ],
3469 'mobile_default' => [
3470 'size' => 400,
3471 'unit' => 'px',
3472 ],
3473 'selectors' => [
3474 '{{WRAPPER}} .embedpress-elements-wrapper .ose-embedpress-responsive iframe, {{WRAPPER}} .embedpress-elements-wrapper .ose-embedpress-responsive,{{WRAPPER}} .ad-youtube-video > iframe,
3475 {{WRAPPER}} .plyr--video, {{WRAPPER}} .ose-giphy img' => 'height: {{size}}{{UNIT}}!important;max-height: 100%!important',
3476 ],
3477 'condition' => [
3478 'embedpress_pro_embeded_source!' => 'instafeed'
3479 ],
3480 ]
3481 );
3482 $this->add_control(
3483 'width_height_important_note',
3484 [
3485 'type' => \Elementor\Controls_Manager::RAW_HTML,
3486 'raw' => esc_html__('Note: The maximum width and height are set to 100%.', 'embedpress'),
3487 'content_classes' => 'elementor-panel-alert elementor-panel-warning-info',
3488 ]
3489 );
3490 $this->add_responsive_control(
3491 'margin',
3492 [
3493 'label' => __('Margin', 'embedpress'),
3494 'type' => Controls_Manager::DIMENSIONS,
3495 'size_units' => ['px', '%', 'em'],
3496 'selectors' => [
3497 '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3498 ],
3499 ]
3500 );
3501 $this->add_responsive_control(
3502 'padding',
3503 [
3504 'label' => __('Padding', 'embedpress'),
3505 'type' => Controls_Manager::DIMENSIONS,
3506 'size_units' => ['px', '%', 'em'],
3507 'selectors' => [
3508 '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3509 ],
3510 ]
3511 );
3512 $this->add_responsive_control(
3513 'align',
3514 [
3515 'label' => esc_html__('Alignment', 'embedpress'),
3516 'type' => Controls_Manager::CHOOSE,
3517 'options' => [
3518 'left' => [
3519 'title' => esc_html__('Left', 'embedpress'),
3520 'icon' => 'eicon-text-align-left',
3521 ],
3522 'center' => [
3523 'title' => esc_html__('Center', 'embedpress'),
3524 'icon' => 'eicon-text-align-center',
3525 ],
3526 'right' => [
3527 'title' => esc_html__('Right', 'embedpress'),
3528 'icon' => 'eicon-text-align-right',
3529 ],
3530 ],
3531 'prefix_class' => 'elementor%s-align-',
3532 'default' => '',
3533 ]
3534 );
3535 $this->end_controls_section();
3536 }
3537
3538 public function render_plain_content()
3539 {
3540 $args = "";
3541 $settings = $this->get_settings_for_display();
3542
3543 $_settings = $this->convert_settings($settings);
3544 foreach ($_settings as $key => $value) {
3545 $args .= "$key='" . esc_attr($value) . "' ";
3546 }
3547
3548 $args = trim($args);
3549 $embed_code = sprintf("[embedpress %s]%s[/embedpress]", $args, esc_url($settings['embedpress_embeded_link']));
3550 echo $embed_code;
3551 }
3552
3553
3554 public function get_custom_player_options($settings)
3555 {
3556
3557 $_player_options = '';
3558
3559 if (!empty($settings['emberpress_custom_player'])) {
3560
3561 $player_preset = !empty($settings['custom_payer_preset']) ? sanitize_text_field($settings['custom_payer_preset']) : 'preset-default';
3562
3563 $player_color = !empty($settings['embedpress_player_color']) ? sanitize_hex_color($settings['embedpress_player_color']) : '';
3564
3565 $poster_thumbnail = !empty($settings['embedpress_player_poster_thumbnail']['url']) ? esc_url($settings['embedpress_player_poster_thumbnail']['url']) : '';
3566
3567
3568 $is_self_hosted = Helper::check_media_format($settings['embedpress_embeded_link']);
3569
3570
3571 $player_pip = !empty($settings['embepress_player_always_on_top']) ? true : false;
3572 $player_restart = !empty($settings['embepress_player_restart']) ? true : false;
3573 $player_rewind = !empty($settings['embepress_player_rewind']) ? true : false;
3574 $player_fastForward = !empty($settings['embepress_player_fast_forward']) ? true : false;
3575 $player_tooltip = !empty($settings['embepress_player_tooltip']) ? true : false;
3576 $player_hide_controls = !empty($settings['embepress_player_hide_controls']) ? true : false;
3577 $player_download = !empty($settings['embepress_player_download']) ? true : false;
3578 $player_fullscreen = !empty($settings['embedpress_pro_youtube_enable_fullscreen_button']) ? true : false;
3579
3580 $playerOptions = [
3581 'rewind' => $player_rewind,
3582 'restart' => $player_restart,
3583 'pip' => $player_pip,
3584 'poster_thumbnail' => $poster_thumbnail,
3585 'player_color' => $player_color,
3586 'player_preset' => $player_preset,
3587 'fast_forward' => $player_fastForward,
3588 'player_tooltip' => $player_tooltip,
3589 'hide_controls' => $player_hide_controls,
3590 'download' => $player_download,
3591 'fullscreen' => $player_fullscreen,
3592 ];
3593
3594
3595 //Youtube options
3596 if (!empty($settings['embedpress_pro_video_start_time'])) {
3597 $playerOptions['start'] = $settings['embedpress_pro_video_start_time'];
3598 }
3599 if (!empty($settings['embedpress_pro_youtube_end_time'])) {
3600 $playerOptions['end'] = $settings['embedpress_pro_youtube_end_time'];
3601 }
3602 if (!empty($settings['embedpress_pro_youtube_display_related_videos'])) {
3603 $playerOptions['rel'] = true;
3604 } else {
3605 $playerOptions['rel'] = false;
3606 }
3607
3608 //vimeo options
3609 if (!empty($settings['embedpress_pro_video_start_time'])) {
3610 $playerOptions['t'] = $settings['embedpress_pro_video_start_time'];
3611 }
3612 if (!empty($settings['embedpress_pro_vimeo_auto_play'])) {
3613 $playerOptions['vautoplay'] = true;
3614 } else {
3615 $playerOptions['vautoplay'] = false;
3616 }
3617 if (!empty($settings['embedpress_pro_vimeo_autopause'])) {
3618 $playerOptions['autopause'] = true;
3619 } else {
3620 $playerOptions['autopause'] = false;
3621 }
3622
3623 if (!empty($settings['embedpress_pro_vimeo_dnt'])) {
3624 $playerOptions['dnt'] = true;
3625 } else {
3626 $playerOptions['dnt'] = false;
3627 }
3628
3629 if (!empty($is_self_hosted['selhosted'])) {
3630 $playerOptions['self_hosted'] = $is_self_hosted['selhosted'];
3631 $playerOptions['hosted_format'] = $is_self_hosted['format'];
3632 }
3633
3634 $playerOptionsString = json_encode($playerOptions);
3635 $_player_options = 'data-options=' . htmlentities($playerOptionsString, ENT_QUOTES);
3636
3637 }
3638
3639 return $_player_options;
3640 }
3641
3642 public function get_instafeed_carousel_options($settings)
3643 {
3644 $_carousel_options = '';
3645
3646 if(!empty($settings['instaLayout']) && $settings['instaLayout'] === 'insta-carousel'){
3647 $_carousel_id = 'data-carouselid=' . esc_attr($this->get_id()) . '';
3648
3649 $layout = $settings['instaLayout'];
3650 $embedpress_instafeed_slide_show = !empty($settings['embedpress_instafeed_slide_show']) ? $settings['embedpress_instafeed_slide_show'] : 5;
3651 $embedpress_carousel_autoplay = !empty($settings['embedpress_carousel_autoplay']) ? $settings['embedpress_carousel_autoplay'] : 0;
3652 $embedpress_carousel_autoplay_speed = !empty($settings['embedpress_carousel_autoplay_speed']) ? $settings['embedpress_carousel_autoplay_speed'] : 3000;
3653 $embedpress_carousel_transition_speed = !empty($settings['embedpress_carousel_transition_speed']) ? $settings['embedpress_carousel_transition_speed'] : 1000;
3654 $embedpress_carousel_loop = !empty($settings['embedpress_carousel_loop']) ? $settings['embedpress_carousel_loop'] : 0;
3655 $embedpress_carousel_arrows = !empty($settings['embedpress_carousel_arrows']) ? $settings['embedpress_carousel_arrows'] : 0;
3656 $spacing = !empty($settings['embedpress_carousel_spacing']) ? $settings['embedpress_carousel_spacing'] : 0;
3657
3658 // print_r($settings);
3659
3660 $carousel_options = [
3661 'layout' => $layout,
3662 'slideshow' => $embedpress_instafeed_slide_show,
3663 'autoplay' => $embedpress_carousel_autoplay,
3664 'autoplayspeed' => $embedpress_carousel_autoplay_speed,
3665 'transitionspeed' => $embedpress_carousel_transition_speed,
3666 'loop' => $embedpress_carousel_loop,
3667 'arrows' => $embedpress_carousel_arrows,
3668 'spacing' => $spacing
3669 ];
3670
3671 $carousel_options_string = json_encode($carousel_options);
3672 $_carousel_options = 'data-carousel-options='. htmlentities($carousel_options_string, ENT_QUOTES) .'';
3673 }
3674 return $_carousel_options;
3675 }
3676
3677 public function get_instafeed_layout($settings){
3678 $insta_layout = '';
3679 if($settings['embedpress_pro_embeded_source'] == 'instafeed'){
3680 $insta_layout = ' '. $settings['instaLayout'];
3681 }
3682
3683 return $insta_layout;
3684 }
3685
3686 protected function convert_settings($settings)
3687 {
3688 $_settings = [];
3689 foreach ($settings as $key => $value) {
3690 if (empty($value)) {
3691 $_settings[$key] = 'false';
3692 } else if (!empty($value['size'])) {
3693 $_settings[$key] = $value['size'];
3694 } else if (!empty($value['url'])) {
3695 $_settings[$key] = $value['url'];
3696 } else if (\is_scalar($value)) {
3697 $_settings[$key] = $value;
3698 }
3699 }
3700
3701 return $_settings;
3702 }
3703
3704 public function validUserAccountUrl($url){
3705 $pattern = '/^(?:https?:\/\/)?(?:www\.)?instagram\.com\/(?:[a-zA-Z0-9_\.]+\/?)$/';
3706 return (bool) preg_match($pattern, $url);
3707 }
3708
3709 function validInstagramTagUrl($url) {
3710 $pattern = '/^(?:https?:\/\/)?(?:www\.)?instagram\.com\/explore\/tags\/[a-zA-Z0-9_\-]+\/?$/';
3711 return (bool) preg_match($pattern, $url);
3712 }
3713
3714 protected function render()
3715 {
3716 $settings = $this->get_settings_for_display();
3717 Helper::get_enable_settings_data_for_scripts($settings);
3718
3719 add_filter('embedpress_should_modify_spotify', '__return_false');
3720 $embed_link = isset($settings['embedpress_embeded_link']) ? $settings['embedpress_embeded_link'] : '';
3721
3722
3723 if(!is_embedpress_pro_active() && ($settings['instaLayout'] === 'insta-masonry' || $settings['instaLayout'] === 'insta-carousel' || $settings['instafeedFeedType'] === 'hashtag_type')){
3724 return '';
3725 }
3726
3727 if($settings['instafeedFeedType'] === 'mixed_type' || $settings['instafeedFeedType'] === 'tagged_type'){
3728 echo 'Comming Soon.';
3729 return '';
3730 }
3731
3732 if($settings['instafeedFeedType'] === 'hashtag_type' && !$this->validInstagramTagUrl($embed_link)){
3733 echo 'Please add valid hashtag link url';
3734 return '';
3735 }
3736
3737 if($settings['instafeedFeedType'] === 'user_account_type' && !$this->validUserAccountUrl($embed_link)){
3738 echo 'Please add valid user account link url';
3739 return '';
3740 }
3741
3742 $is_editor_view = Plugin::$instance->editor->is_edit_mode();
3743 $link = $settings['embedpress_embeded_link'];
3744 $is_apple_podcast = (strpos($link, 'podcasts.apple.com') !== false);
3745
3746 // conditionaly convert settings data
3747 $_settings = [];
3748 $source = isset($settings['embedpress_pro_embeded_source']) ? esc_attr($settings['embedpress_pro_embeded_source']) : 'default';
3749 $embed_link = isset($settings['embedpress_embeded_link']) ? esc_url($settings['embedpress_embeded_link']) : '';
3750 $pass_hash_key = isset($settings['embedpress_lock_content_password']) ? md5($settings['embedpress_lock_content_password']) : '';
3751
3752
3753
3754 Helper::get_source_data(md5($this->get_id()) . '_eb_elementor', esc_url($embed_link), 'elementor_source_data', 'elementor_temp_source_data');
3755
3756 if (!(($source === 'default' || !empty($source[0]) && $source[0] === 'default') && strpos($embed_link, 'opensea.io') !== false)) {
3757 $_settings = $this->convert_settings($settings);
3758 }
3759
3760 if (strpos($embed_link, 'opensea.io') !== false) {
3761 $source = 'opensea';
3762 }
3763
3764 $embed_content = Shortcode::parseContent($settings['embedpress_embeded_link'], true, $_settings);
3765 $embed_content = $this->onAfterEmbedSpotify($embed_content, $settings);
3766 $embed = apply_filters('embedpress_elementor_embed', $embed_content, $settings);
3767 $content = is_object($embed) ? $embed->embed : $embed;
3768
3769 $embed_settings = [];
3770 $embed_settings['customThumbnail'] = !empty($settings['embedpress_content_share_custom_thumbnail']['url']) ? esc_url($settings['embedpress_content_share_custom_thumbnail']['url']) : '';
3771
3772 $embed_settings['customTitle'] = !empty($settings['embedpress_content_title']) ? sanitize_text_field($settings['embedpress_content_title']) : Helper::get_file_title($embed_link);
3773
3774 $embed_settings['customDescription'] = !empty($settings['embedpress_content_descripiton']) ? sanitize_text_field($settings['embedpress_content_descripiton']) : Helper::get_file_title($embed_link);
3775
3776 $embed_settings['sharePosition'] = !empty($settings['embedpress_content_share_position']) ? sanitize_text_field($settings['embedpress_content_share_position']) : 'right';
3777
3778 $embed_settings['lockHeading'] = !empty($settings['embedpress_lock_content_heading']) ? sanitize_text_field($settings['embedpress_lock_content_heading']) : '';
3779
3780 $embed_settings['lockSubHeading'] = !empty($settings['embedpress_lock_content_sub_heading']) ? sanitize_text_field($settings['embedpress_lock_content_sub_heading']) : '';
3781
3782 $embed_settings['passwordPlaceholder'] = !empty($settings['embedpress_password_placeholder']) ? sanitize_text_field($settings['embedpress_password_placeholder']) : '';
3783
3784 $embed_settings['submitButtonText'] = !empty($settings['embedpress_submit_button_text']) ? sanitize_text_field($settings['embedpress_submit_button_text']) : '';
3785
3786 $embed_settings['submitUnlockingText'] = !empty($settings['embedpress_submit_Unlocking_text']) ? sanitize_text_field($settings['embedpress_submit_Unlocking_text']) : '';
3787
3788 $embed_settings['lockErrorMessage'] = !empty($settings['embedpress_lock_content_error_message']) ? sanitize_text_field($settings['embedpress_lock_content_error_message']) : '';
3789
3790 $embed_settings['enableFooterMessage'] = !empty($settings['embedpress_enable_footer_message']) ? sanitize_text_field($settings['embedpress_enable_footer_message']) : '';
3791
3792 $embed_settings['footerMessage'] = !empty($settings['embedpress_lock_content_footer_message']) ? sanitize_text_field($settings['embedpress_lock_content_footer_message']) : '';
3793
3794
3795
3796 $client_id = $this->get_id();
3797 $hash_pass = hash('sha256', wp_salt(32) . md5($settings['embedpress_lock_content_password'] ? sanitize_text_field($settings['embedpress_lock_content_password']) : ''));
3798
3799 $password_correct = isset($_COOKIE['password_correct_' . $client_id]) ? sanitize_text_field($_COOKIE['password_correct_' . $client_id]) : '';
3800
3801 $ispagination = 'flex';
3802
3803 if ($settings['pagination'] != 'show') {
3804 $ispagination = 'none';
3805 }
3806
3807
3808 $calVal = '';
3809
3810 if (!empty($settings['columns']) && is_numeric($settings['columns']) && (int) $settings['columns'] > 0) {
3811 $columns = (int) $settings['columns'];
3812 $gap_size = isset($settings['gapbetweenvideos']['size']) ? absint($settings['gapbetweenvideos']['size']) : 0;
3813 $calVal = 'calc(' . (100 / $columns) . '% - ' . $gap_size . 'px)';
3814 } else {
3815 $calVal = 'auto';
3816 }
3817
3818
3819 $content_share_class = '';
3820 $share_position_class = '';
3821 $share_position = isset($settings['embedpress_content_share_position']) ? esc_attr($settings['embedpress_content_share_position']) : 'right';
3822
3823 if (!empty($settings['embedpress_content_share'])) {
3824 $content_share_class = 'ep-content-share-enabled';
3825 $share_position_class = 'ep-share-position-' . $share_position;
3826 }
3827
3828 $content_protection_class = 'ep-content-protection-enabled';
3829 if (empty($settings['embedpress_lock_content']) || empty($settings['embedpress_lock_content_password']) || $hash_pass === $password_correct) {
3830 $content_protection_class = 'ep-content-protection-disabled';
3831 }
3832
3833 $data_playerid = '';
3834 if(!empty($settings['embedpress_custom_player'])){
3835 $data_playerid = 'data-playerid='.esc_attr($this->get_id());
3836 }
3837
3838 $data_carouselid = '';
3839 if(!empty($settings['instaLayout'] && $settings['instaLayout'] === 'insta-carousel')){
3840 $data_playerid = 'data-carouselid="'.esc_attr($this->get_id()).'"';
3841 }
3842
3843 $cEmbedType = !empty($settings['cEmbedType']) ? sanitize_text_field($settings['cEmbedType']) : '';
3844
3845 $adsAtts = '';
3846
3847 if (!empty($settings['adManager'])) {
3848 $ad = base64_encode(json_encode($settings)); // Using WordPress JSON encoding function
3849 $adsAtts = 'data-sponsored-id="' . esc_attr($client_id) . '" data-sponsored-attrs="' . esc_attr($ad) . '" class="ad-mask"';
3850 }
3851
3852 $data_player_id = '';
3853
3854 if (!empty($settings['emberpress_custom_player']) && $settings['emberpress_custom_player'] === 'yes') {
3855 $data_player_id = "data-playerid=" . esc_attr($this->get_id());
3856 }
3857
3858 $hosted_format = '';
3859 if (!empty($settings['emberpress_custom_player'])) {
3860 $self_hosted = Helper::check_media_format($settings['embedpress_embeded_link']);
3861 $hosted_format = isset($self_hosted['format']) ? $self_hosted['format'] : '';
3862 }
3863
3864 ?>
3865
3866 <div class="embedpress-elements-wrapper <?php echo !empty($settings['embedpress_elementor_aspect_ratio']) ? 'embedpress-fit-aspect-ratio' : '';
3867 echo esc_attr($cEmbedType); ?>" id="ep-elements-id-<?php echo esc_attr($this->get_id()); ?>">
3868 <?php
3869 // handle notice display
3870 if ($is_editor_view && $is_apple_podcast && !is_embedpress_pro_active()) {
3871 ?>
3872 <p><?php esc_html_e('You need EmbedPress Pro to Embed Apple Podcast. Note. This message is only visible to you.', 'embedpress'); ?></p>
3873 <?php
3874 } else { ?>
3875 <div id="ep-elementor-content-<?php echo esc_attr($client_id) ?>" class="ep-elementor-content <?php if (!empty($settings['embedpress_content_share'])) : echo esc_attr('position-' . $settings['embedpress_content_share_position'] . '-wraper'); endif; ?> <?php echo esc_attr($content_share_class . ' ' . $share_position_class . ' ' . $content_protection_class); echo esc_attr(' source-' . $source); ?>">
3876 <div id="<?php echo esc_attr($this->get_id()); ?>" class="ep-embed-content-wraper <?php echo esc_attr($settings['custom_payer_preset']); ?><?php echo esc_attr($this->get_instafeed_layout($settings)); ?> <?php echo esc_attr($hosted_format); ?>" <?php echo $data_playerid; ?> <?php echo $data_carouselid; ?> <?php echo $this->get_custom_player_options($settings); ?> <?php echo $this->get_instafeed_carousel_options($settings); ?>>
3877 <div id="ep-elementor-content-<?php echo esc_attr($client_id) ?>" class="ep-elementor-content
3878 <?php if (!empty($settings['embedpress_content_share'])) : echo esc_attr('position-' . $settings['embedpress_content_share_position'] . '-wraper'); endif; ?>
3879 <?php echo esc_attr($content_share_class . ' ' . $share_position_class . ' ' . $content_protection_class); echo esc_attr(' source-' . $source); ?>">
3880 <div <?php echo $adsAtts; ?>>
3881 <div id="<?php echo esc_attr($this->get_id()); ?>" class="ep-embed-content-wraper <?php echo esc_attr($settings['custom_payer_preset']); ?>" <?php echo esc_attr($data_player_id); ?> <?php echo $this->get_custom_player_options($settings); ?>>
3882 <?php
3883 $content_id = $client_id;
3884 if ((empty($settings['embedpress_lock_content']) || empty($settings['embedpress_lock_content_password']) || $settings['embedpress_lock_content'] == 'no') || (!empty(Helper::is_password_correct($client_id)) && ($hash_pass === $password_correct))) {
3885 if (!empty($settings['embedpress_content_share'])) {
3886 $content .= Helper::embed_content_share($content_id, $embed_settings);
3887 }
3888 echo $content;
3889 } else {
3890 if (!empty($settings['embedpress_content_share'])) {
3891 $content .= Helper::embed_content_share($content_id, $embed_settings);
3892 }
3893 Helper::display_password_form($client_id, $content, $pass_hash_key, $embed_settings);
3894 }
3895 ?>
3896 </div>
3897 <?php
3898 if (!empty($settings['adManager'])) {
3899 $content .= Helper::generateAdTemplate($client_id, $settings, 'elementor');
3900 }
3901 ?>
3902 </div>
3903 </div>
3904 </div>
3905 </div>
3906 <?php
3907 }
3908 ?>
3909 </div>
3910
3911
3912
3913 <?php if ($settings['embedpress_pro_embeded_source'] === 'youtube') : ?>
3914 <style>
3915 #ep-elements-id-<?php echo esc_html($this->get_id()); ?>.ep-youtube__content__block .youtube__content__body .content__wrap {
3916 grid-template-columns: repeat(auto-fit, minmax(<?php echo esc_html($calVal); ?>, 1fr)) !important;
3917 }
3918
3919 #ep-elements-id-<?php echo esc_html($this->get_id()); ?>.ep-youtube__content__pagination {
3920 display: <?php echo esc_html($ispagination); ?> !important;
3921 }
3922 </style>
3923 <?php endif; ?>
3924
3925 <?php
3926 }
3927 public function onAfterEmbedSpotify($embed, $setting)
3928 {
3929 if (!isset($embed->provider_name) || strtolower($embed->provider_name) !== 'spotify' || !isset($embed->embed)) {
3930 return $embed;
3931 }
3932 $match = array();
3933 preg_match('/src=\"(.+?)\"/', $embed->embed, $match);
3934 if (empty($match)) {
3935 return $embed;
3936 }
3937 $url_full = $match[1];
3938 $modified_url = str_replace('playlist-v2', 'playlist', $url_full);
3939 if (isset($setting['spotify_theme'])) {
3940 if (strpos($modified_url, '?') !== false) {
3941 $modified_url .= '&theme=' . sanitize_text_field($setting['spotify_theme']);
3942 } else {
3943 $modified_url .= '?theme=' . sanitize_text_field($setting['spotify_theme']);
3944 }
3945 }
3946 $embed->embed = str_replace($url_full, $modified_url, $embed->embed);
3947 return $embed;
3948 }
3949 }
3950