Embedpress_Calendar.php
3 years ago
Embedpress_Document.php
3 years ago
Embedpress_Elementor.php
3 years ago
Embedpress_Pdf.php
3 years ago
Embedpress_Elementor.php
2674 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 | public function get_name() |
| 23 | { |
| 24 | return 'embedpres_elementor'; |
| 25 | } |
| 26 | |
| 27 | public function get_title() |
| 28 | { |
| 29 | return esc_html__('EmbedPress', 'embedpress'); |
| 30 | } |
| 31 | |
| 32 | public function get_categories() |
| 33 | { |
| 34 | return ['embedpress']; |
| 35 | } |
| 36 | |
| 37 | public function get_custom_help_url() |
| 38 | { |
| 39 | return 'https://embedpress.com/documentation'; |
| 40 | } |
| 41 | |
| 42 | public function get_icon() |
| 43 | { |
| 44 | return 'icon-embedpress'; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Get widget keywords. |
| 49 | * |
| 50 | * Retrieve the list of keywords the widget belongs to. |
| 51 | * |
| 52 | * @return array Widget keywords. |
| 53 | * @since 2.4.1 |
| 54 | * @access public |
| 55 | * |
| 56 | */ |
| 57 | public function get_keywords() |
| 58 | { |
| 59 | return [ |
| 60 | 'embedpress', |
| 61 | 'audio', |
| 62 | 'video', |
| 63 | 'map', |
| 64 | 'youtube', |
| 65 | 'vimeo', |
| 66 | 'wistia', |
| 67 | 'twitch', |
| 68 | 'soundcloud', |
| 69 | 'giphy gifs', |
| 70 | 'spotify', |
| 71 | 'smugmug', |
| 72 | 'meetup', |
| 73 | 'apple', |
| 74 | 'apple podcast', |
| 75 | 'podcast', |
| 76 | 'dailymotion', |
| 77 | 'instagram', |
| 78 | 'slideshare', |
| 79 | 'flickr', |
| 80 | 'ted', |
| 81 | 'google docs', |
| 82 | 'google slides', |
| 83 | 'google drawings' |
| 84 | ]; |
| 85 | } |
| 86 | |
| 87 | protected function register_controls() |
| 88 | { |
| 89 | $this->pro_class = is_embedpress_pro_active() ? '' : 'embedpress-pro-control not-active'; |
| 90 | $this->pro_text = is_embedpress_pro_active() ? '' : '<sup class="embedpress-pro-label" style="color:red">' . __('Pro', 'embedpress') . '</sup>'; |
| 91 | /** |
| 92 | * EmbedPress General Settings |
| 93 | */ |
| 94 | $this->start_controls_section( |
| 95 | 'embedpress_elementor_content_settings', |
| 96 | [ |
| 97 | 'label' => esc_html__('General', 'embedpress'), |
| 98 | ] |
| 99 | ); |
| 100 | |
| 101 | do_action('embedpress/embeded/extend', $this); |
| 102 | $this->add_control( |
| 103 | 'embedpress_pro_embeded_source', |
| 104 | [ |
| 105 | 'label' => __('Source Name', 'embedpress'), |
| 106 | 'type' => Controls_Manager::SELECT, |
| 107 | 'label_block' => false, |
| 108 | 'default' => 'default', |
| 109 | 'options' => [ |
| 110 | 'default' => __('Default', 'embedpress'), |
| 111 | 'youtube' => __('YouTube', 'embedpress'), |
| 112 | 'vimeo' => __('Vimeo', 'embedpress'), |
| 113 | 'dailymotion' => __('Dailymotion', 'embedpress'), |
| 114 | 'wistia' => __('Wistia', 'embedpress'), |
| 115 | 'twitch' => __('Twitch', 'embedpress'), |
| 116 | 'soundcloud' => __('SoundCloud', 'embedpress'), |
| 117 | 'opensea' => __('OpenSea', 'embedpress'), |
| 118 | ] |
| 119 | ] |
| 120 | ); |
| 121 | |
| 122 | $this->add_control( |
| 123 | 'embedpress_pro_embeded_nft_type', |
| 124 | [ |
| 125 | 'label' => __('Type', 'embedpress'), |
| 126 | 'type' => Controls_Manager::SELECT, |
| 127 | 'label_block' => false, |
| 128 | 'default' => 'collection', |
| 129 | 'options' => [ |
| 130 | 'collection' => __('Assets Collection', 'embedpress'), |
| 131 | 'single' => __('Single Asset', 'embedpress'), |
| 132 | ], |
| 133 | 'condition' => [ |
| 134 | 'embedpress_pro_embeded_source' => 'opensea' |
| 135 | ] |
| 136 | ] |
| 137 | ); |
| 138 | |
| 139 | $this->add_control( |
| 140 | 'embedpress_embeded_link', |
| 141 | [ |
| 142 | |
| 143 | 'label' => __('Embedded Link', 'embedpress'), |
| 144 | 'type' => Controls_Manager::TEXT, |
| 145 | 'dynamic' => [ |
| 146 | 'active' => true, |
| 147 | ], |
| 148 | 'placeholder' => __('Enter your Link', 'embedpress'), |
| 149 | 'label_block' => true |
| 150 | |
| 151 | ] |
| 152 | ); |
| 153 | |
| 154 | $this->add_control( |
| 155 | 'spotify_theme', |
| 156 | [ |
| 157 | 'label' => __('Player Background', 'embedpress'), |
| 158 | 'description' => __('Dynamic option will use the most vibrant color from the album art.', 'embedpress'), |
| 159 | 'type' => Controls_Manager::SELECT, |
| 160 | 'label_block' => false, |
| 161 | 'default' => '1', |
| 162 | 'options' => [ |
| 163 | '1' => __('Dynamic', 'embedpress'), |
| 164 | '0' => __('Black & White', 'embedpress') |
| 165 | ], |
| 166 | 'condition' => [ |
| 167 | 'embedpress_pro_embeded_source' => 'spotify' |
| 168 | ] |
| 169 | ] |
| 170 | ); |
| 171 | do_action('embedpress/control/extend', $this); |
| 172 | $this->add_control( |
| 173 | 'embedpress_pro_video_start_time', |
| 174 | [ |
| 175 | 'label' => __('Start Time', 'embedpress'), |
| 176 | 'type' => Controls_Manager::NUMBER, |
| 177 | 'description' => __('Specify a start time (in seconds)', 'embedpress'), |
| 178 | 'condition' => [ |
| 179 | 'embedpress_pro_embeded_source' => ['youtube', 'vimeo', 'wistia', 'dailymotion', 'twitch'] |
| 180 | ], |
| 181 | ] |
| 182 | ); |
| 183 | |
| 184 | |
| 185 | /** |
| 186 | * Initialized controls |
| 187 | */ |
| 188 | $this->init_youtube_controls(); |
| 189 | $this->init_vimeo_controls(); |
| 190 | $this->init_wistia_controls(); |
| 191 | $this->init_soundcloud_controls(); |
| 192 | $this->init_dailymotion_control(); |
| 193 | $this->init_twitch_control(); |
| 194 | $this->init_opensea_control(); |
| 195 | $this->end_controls_section(); |
| 196 | |
| 197 | $this->init_youtube_channel_section(); |
| 198 | $this->init_youtube_subscription_section(); |
| 199 | $this->init_youtube_livechat_section(); |
| 200 | |
| 201 | |
| 202 | /** |
| 203 | * Opensea Control section |
| 204 | */ |
| 205 | $this->init_opensea_control_section(); |
| 206 | |
| 207 | |
| 208 | |
| 209 | do_action( 'extend_elementor_controls', $this, '_', $this->pro_text, $this->pro_class); |
| 210 | |
| 211 | if (!is_embedpress_pro_active()) { |
| 212 | $this->start_controls_section( |
| 213 | 'embedpress_pro_section', |
| 214 | [ |
| 215 | 'label' => __('Go Premium for More Features', 'embedpress'), |
| 216 | ] |
| 217 | ); |
| 218 | |
| 219 | $this->add_control( |
| 220 | 'embedpress_pro_cta', |
| 221 | [ |
| 222 | 'label' => __('Unlock more possibilities', 'embedpress'), |
| 223 | 'type' => Controls_Manager::CHOOSE, |
| 224 | 'options' => [ |
| 225 | '1' => [ |
| 226 | 'title' => '', |
| 227 | 'icon' => 'eicon-lock', |
| 228 | ], |
| 229 | ], |
| 230 | 'default' => '1', |
| 231 | '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>', |
| 232 | ] |
| 233 | ); |
| 234 | |
| 235 | $this->end_controls_section(); |
| 236 | } |
| 237 | |
| 238 | $this->init_style_controls(); |
| 239 | $this->init_opensea_color_and_typography(); |
| 240 | |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Youtube Controls |
| 245 | */ |
| 246 | |
| 247 | public function init_youtube_controls() |
| 248 | { |
| 249 | $yt_condition = [ |
| 250 | 'embedpress_pro_embeded_source' => 'youtube' |
| 251 | ]; |
| 252 | $this->add_control( |
| 253 | 'embedpress_pro_youtube_end_time', |
| 254 | [ |
| 255 | 'label' => __('End Time', 'embedpress'), |
| 256 | 'type' => Controls_Manager::NUMBER, |
| 257 | 'description' => __('Specify an end time (in seconds)', 'embedpress'), |
| 258 | 'condition' => $yt_condition, |
| 259 | ] |
| 260 | ); |
| 261 | |
| 262 | |
| 263 | $this->add_control( |
| 264 | 'embedpress_pro_youtube_auto_play', |
| 265 | [ |
| 266 | 'label' => __('Auto Play', 'embedpress'), |
| 267 | 'type' => Controls_Manager::SWITCHER, |
| 268 | 'label_block' => false, |
| 269 | 'return_value' => 'yes', |
| 270 | 'default' => 'no', |
| 271 | 'condition' => $yt_condition, |
| 272 | ] |
| 273 | ); |
| 274 | $this->add_control( |
| 275 | 'embedpress_pro_youtube_player_options', |
| 276 | [ |
| 277 | 'label' => __('Player Options', 'embedpress'), |
| 278 | 'type' => Controls_Manager::HEADING, |
| 279 | 'condition' => $yt_condition, |
| 280 | ] |
| 281 | ); |
| 282 | $this->add_control( |
| 283 | 'embedpress_pro_youtube_display_controls', |
| 284 | [ |
| 285 | 'label' => __('Controls', 'embedpress'), |
| 286 | 'type' => Controls_Manager::SELECT, |
| 287 | 'label_block' => false, |
| 288 | 'default' => 1, |
| 289 | 'options' => [ |
| 290 | '1' => __('Display immediately', 'embedpress'), |
| 291 | '2' => __('Display after user initiation', 'embedpress'), |
| 292 | '0' => __('Hide controls', 'embedpress') |
| 293 | ], |
| 294 | 'condition' => $yt_condition, |
| 295 | ] |
| 296 | ); |
| 297 | $this->add_control( |
| 298 | 'embedpress_pro_youtube_enable_fullscreen_button', |
| 299 | [ |
| 300 | 'label' => __('Fullscreen button', 'embedpress'), |
| 301 | 'type' => Controls_Manager::SWITCHER, |
| 302 | 'label_block' => false, |
| 303 | 'return_value' => 'yes', |
| 304 | 'default' => 'yes', |
| 305 | 'condition' => [ |
| 306 | 'embedpress_pro_embeded_source' => 'youtube', |
| 307 | 'embedpress_pro_youtube_display_controls!' => '0' |
| 308 | ] |
| 309 | ] |
| 310 | ); |
| 311 | $this->add_control( |
| 312 | 'embedpress_pro_youtube_display_video_annotations', |
| 313 | [ |
| 314 | 'label' => __('Video Annotations', 'embedpress'), |
| 315 | 'type' => Controls_Manager::SWITCHER, |
| 316 | 'label_block' => false, |
| 317 | 'default' => 1, |
| 318 | 'options' => [ |
| 319 | '1' => __('Display', 'embedpress'), |
| 320 | '3' => __('Do Not Display', 'embedpress') |
| 321 | ], |
| 322 | 'condition' => $yt_condition, |
| 323 | ] |
| 324 | ); |
| 325 | //--- YouTube Pro control starts --- |
| 326 | $this->add_control( |
| 327 | 'embedpress_pro_youtube_progress_bar_color', |
| 328 | [ |
| 329 | 'label' => __('Progress Bar Color', 'embedpress'), |
| 330 | 'type' => Controls_Manager::SELECT, |
| 331 | 'label_block' => false, |
| 332 | 'default' => 'red', |
| 333 | 'options' => [ |
| 334 | 'red' => __('Red', 'embedpress'), |
| 335 | 'white' => __('White', 'embedpress') |
| 336 | ], |
| 337 | 'condition' => $yt_condition, |
| 338 | ] |
| 339 | ); |
| 340 | $this->add_control( |
| 341 | 'embedpress_pro_youtube_force_closed_captions', |
| 342 | [ |
| 343 | 'label' => sprintf(__('Closed Captions %s', 'embedpress'), $this->pro_text), |
| 344 | 'type' => Controls_Manager::SWITCHER, |
| 345 | 'label_block' => false, |
| 346 | 'return_value' => 'yes', |
| 347 | 'default' => 'no', |
| 348 | 'separator' => 'before', |
| 349 | 'classes' => $this->pro_class, |
| 350 | 'condition' => $yt_condition, |
| 351 | ] |
| 352 | ); |
| 353 | $this->add_control( |
| 354 | 'embedpress_pro_youtube_modest_branding', |
| 355 | [ |
| 356 | 'label' => sprintf(__('Modest Branding %s', 'embedpress'), $this->pro_text), |
| 357 | 'type' => Controls_Manager::SELECT, |
| 358 | 'label_block' => false, |
| 359 | 'default' => 1, |
| 360 | 'options' => [ |
| 361 | '0' => __('Display', 'embedpress'), |
| 362 | '1' => __('Do Not Display', 'embedpress') |
| 363 | ], |
| 364 | 'condition' => [ |
| 365 | 'embedpress_pro_embeded_source' => 'youtube', |
| 366 | 'embedpress_pro_youtube_display_controls!' => '0', |
| 367 | 'embedpress_pro_youtube_progress_bar_color!' => 'white' |
| 368 | ], |
| 369 | 'classes' => $this->pro_class, |
| 370 | ] |
| 371 | ); |
| 372 | $this->add_control( |
| 373 | 'embedpress_pro_youtube_display_related_videos', |
| 374 | [ |
| 375 | 'label' => __('Related Videos', 'embedpress'), |
| 376 | 'description' => __('Set it to "Yes" to display related videos from all channels. Otherwise, related videos will show from the same channel.', 'embedpress'), |
| 377 | 'type' => Controls_Manager::SWITCHER, |
| 378 | 'label_block' => false, |
| 379 | 'return_value' => 'yes', |
| 380 | 'default' => 'yes', |
| 381 | 'condition' => $yt_condition, |
| 382 | ] |
| 383 | ); |
| 384 | $this->init_branding_controls('youtube'); |
| 385 | } |
| 386 | |
| 387 | public function init_youtube_channel_section() |
| 388 | { |
| 389 | $yt_condition = [ |
| 390 | 'embedpress_pro_embeded_source' => 'youtube', |
| 391 | ]; |
| 392 | $this->start_controls_section( |
| 393 | 'embedpress_yt_channel_section', |
| 394 | [ |
| 395 | 'label' => __('YouTube Channel', 'embedpress'), |
| 396 | 'condition' => $yt_condition, |
| 397 | |
| 398 | ] |
| 399 | ); |
| 400 | |
| 401 | $this->add_control( |
| 402 | 'important_note', |
| 403 | [ |
| 404 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 405 | 'raw' => esc_html__( 'These options take effect only when a YouTube channel is embedded.', 'embedpress' ), |
| 406 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 407 | ] |
| 408 | ); |
| 409 | |
| 410 | $this->add_control( |
| 411 | 'pagesize', |
| 412 | [ |
| 413 | 'label' => __('Video Per Page', 'embedpress'), |
| 414 | 'type' => Controls_Manager::NUMBER, |
| 415 | 'label_block' => false, |
| 416 | 'default' => 6, |
| 417 | 'min' => 1, |
| 418 | 'max' => 50, |
| 419 | 'conditions' => [ |
| 420 | 'terms' => [ |
| 421 | [ |
| 422 | 'name' => 'embedpress_pro_embeded_source', |
| 423 | 'operator' => '===', |
| 424 | 'value' => 'youtube', |
| 425 | ], |
| 426 | ], |
| 427 | ] |
| 428 | ] |
| 429 | ); |
| 430 | |
| 431 | $this->add_control( |
| 432 | 'columns', |
| 433 | [ |
| 434 | 'label' => __('Column', 'embedpress'), |
| 435 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 436 | 'label_block' => false, |
| 437 | 'default' => '3', |
| 438 | 'options' => [ |
| 439 | '2' => esc_html__('2', 'embedpress'), |
| 440 | '3' => esc_html__('3', 'embedpress'), |
| 441 | '4' => esc_html__('4', 'embedpress'), |
| 442 | '6' => esc_html__('6', 'embedpress'), |
| 443 | 'auto' => esc_html__('Auto', 'embedpress'), |
| 444 | ], |
| 445 | 'conditions' => [ |
| 446 | 'terms' => [ |
| 447 | [ |
| 448 | 'name' => 'embedpress_pro_embeded_source', |
| 449 | 'operator' => '===', |
| 450 | 'value' => 'youtube', |
| 451 | ], |
| 452 | ], |
| 453 | ] |
| 454 | ] |
| 455 | ); |
| 456 | $this->add_control( |
| 457 | 'gapbetweenvideos', |
| 458 | [ |
| 459 | 'label' => __('Gap Between Videos', 'embedpress'), |
| 460 | 'label_block' => true, |
| 461 | 'type' => \Elementor\Controls_Manager::SLIDER, |
| 462 | 'size_units' => ['px', '%'], |
| 463 | 'range' => [ |
| 464 | 'px' => [ |
| 465 | 'min' => 0, |
| 466 | 'max' => 100, |
| 467 | 'step' => 1, |
| 468 | ], |
| 469 | '%' => [ |
| 470 | 'min' => 0, |
| 471 | 'max' => 100, |
| 472 | ], |
| 473 | ], |
| 474 | 'default' => [ |
| 475 | 'unit' => 'px', |
| 476 | 'size' => 30, |
| 477 | ], |
| 478 | 'conditions' => [ |
| 479 | 'terms' => [ |
| 480 | [ |
| 481 | 'name' => 'embedpress_pro_embeded_source', |
| 482 | 'operator' => '===', |
| 483 | 'value' => 'youtube', |
| 484 | ], |
| 485 | ], |
| 486 | ], |
| 487 | 'selectors' => [ |
| 488 | '{{WRAPPER}} .ep-youtube__content__block .youtube__content__body .content__wrap' => 'gap: {{SIZE}}{{UNIT}}!important;margin-top: {{SIZE}}{{UNIT}}!important;', |
| 489 | ], |
| 490 | ] |
| 491 | ); |
| 492 | |
| 493 | $this->add_control( |
| 494 | 'pagination', |
| 495 | [ |
| 496 | 'label' => __('Pagination', 'embedpress'), |
| 497 | 'type' => Controls_Manager::SWITCHER, |
| 498 | 'label_block' => false, |
| 499 | 'label_on' => esc_html__('Show', 'embedpress'), |
| 500 | 'label_off' => esc_html__('Hide', 'embedpress'), |
| 501 | 'return_value' => 'show', |
| 502 | 'default' => 'show', |
| 503 | 'condition' => $yt_condition, |
| 504 | ] |
| 505 | ); |
| 506 | |
| 507 | |
| 508 | $this->end_controls_section(); |
| 509 | } |
| 510 | public function init_youtube_subscription_section() |
| 511 | { |
| 512 | $yt_condition = [ |
| 513 | 'embedpress_pro_embeded_source' => 'youtube', |
| 514 | ]; |
| 515 | $this->start_controls_section( |
| 516 | 'embedpress_yt_subscription_section', |
| 517 | [ |
| 518 | 'label' => __('YouTube Subscriber', 'embedpress'), |
| 519 | 'condition' => $yt_condition, |
| 520 | |
| 521 | ] |
| 522 | ); |
| 523 | |
| 524 | |
| 525 | $this->add_control( |
| 526 | 'yt_sub_channel', |
| 527 | [ |
| 528 | |
| 529 | 'label' => sprintf(__('Channel ID %s', 'embedpress'), $this->pro_text), |
| 530 | 'type' => Controls_Manager::TEXT, |
| 531 | 'dynamic' => [ |
| 532 | 'active' => true, |
| 533 | ], |
| 534 | 'placeholder' => __('Enter Channel ID', 'embedpress'), |
| 535 | 'label_block' => true, |
| 536 | 'condition' => $yt_condition, |
| 537 | 'classes' => $this->pro_class, |
| 538 | ] |
| 539 | ); |
| 540 | $this->add_control( |
| 541 | 'yt_sub_text', |
| 542 | [ |
| 543 | |
| 544 | 'label' => sprintf(__('Subscription Text %s', 'embedpress'), $this->pro_text), |
| 545 | 'type' => Controls_Manager::TEXT, |
| 546 | 'dynamic' => [ |
| 547 | 'active' => true, |
| 548 | ], |
| 549 | 'placeholder' => __('Eg. Don\'t miss out! Subscribe', 'embedpress'), |
| 550 | 'label_block' => true, |
| 551 | 'condition' => $yt_condition, |
| 552 | 'classes' => $this->pro_class, |
| 553 | ] |
| 554 | ); |
| 555 | |
| 556 | |
| 557 | $this->add_control( |
| 558 | 'yt_sub_layout', |
| 559 | [ |
| 560 | 'label' => sprintf(__('Layout %s', 'embedpress'), $this->pro_text), |
| 561 | 'type' => Controls_Manager::SELECT, |
| 562 | 'label_block' => false, |
| 563 | 'default' => 'default', |
| 564 | 'options' => [ |
| 565 | 'default' => __('Default', 'embedpress'), |
| 566 | 'full' => __('Full', 'embedpress') |
| 567 | ], |
| 568 | 'condition' => [ |
| 569 | 'embedpress_pro_embeded_source' => 'youtube', |
| 570 | ], |
| 571 | 'classes' => $this->pro_class, |
| 572 | ] |
| 573 | ); |
| 574 | |
| 575 | $this->add_control( |
| 576 | 'yt_sub_theme', |
| 577 | [ |
| 578 | 'label' => sprintf(__('Theme %s', 'embedpress'), $this->pro_text), |
| 579 | 'type' => Controls_Manager::SELECT, |
| 580 | 'label_block' => false, |
| 581 | 'default' => 'default', |
| 582 | 'options' => [ |
| 583 | 'default' => __('Default', 'embedpress'), |
| 584 | 'dark' => __('Dark', 'embedpress') |
| 585 | ], |
| 586 | 'condition' => [ |
| 587 | 'embedpress_pro_embeded_source' => 'youtube', |
| 588 | ], |
| 589 | 'classes' => $this->pro_class, |
| 590 | ] |
| 591 | ); |
| 592 | |
| 593 | $this->add_control( |
| 594 | 'yt_sub_count', |
| 595 | [ |
| 596 | 'label' => sprintf(__('Subscriber Count %s', 'embedpress'), $this->pro_text), |
| 597 | 'type' => Controls_Manager::SWITCHER, |
| 598 | 'label_block' => false, |
| 599 | 'return_value' => 'yes', |
| 600 | 'default' => 'yes', |
| 601 | 'condition' => $yt_condition, |
| 602 | 'classes' => $this->pro_class, |
| 603 | ] |
| 604 | ); |
| 605 | |
| 606 | $this->end_controls_section(); |
| 607 | } |
| 608 | |
| 609 | public function init_youtube_livechat_section() |
| 610 | { |
| 611 | $yt_condition = [ |
| 612 | 'embedpress_pro_embeded_source' => 'youtube', |
| 613 | ]; |
| 614 | $this->start_controls_section( |
| 615 | 'embedpress_yt_livechat_section', |
| 616 | [ |
| 617 | 'label' => __('YouTube Live Chat', 'embedpress'), |
| 618 | 'condition' => $yt_condition, |
| 619 | |
| 620 | ] |
| 621 | ); |
| 622 | |
| 623 | $this->add_control( |
| 624 | 'yt_lc_show', |
| 625 | [ |
| 626 | 'label' => sprintf(__('Show YouTube Live Chat %s', 'embedpress'), $this->pro_text), |
| 627 | 'type' => Controls_Manager::SWITCHER, |
| 628 | 'label_block' => false, |
| 629 | 'return_value' => 'yes', |
| 630 | 'default' => '', |
| 631 | 'label_off' => __('Hide', 'embedpress'), |
| 632 | 'label_on' => __('Show', 'embedpress'), |
| 633 | 'condition' => $yt_condition, |
| 634 | 'classes' => $this->pro_class, |
| 635 | ] |
| 636 | ); |
| 637 | |
| 638 | |
| 639 | $this->end_controls_section(); |
| 640 | } |
| 641 | |
| 642 | //End Youtube Controls |
| 643 | |
| 644 | /** |
| 645 | * Dailymotion Controls |
| 646 | */ |
| 647 | public function init_dailymotion_control() |
| 648 | { |
| 649 | //@TODO; Kamal - migrate from 'embedpress_pro_dailymotion_logo' to 'embedpress_pro_dailymotion_ui_logo' |
| 650 | $this->add_control( |
| 651 | 'embedpress_pro_dailymotion_ui_logo', |
| 652 | [ |
| 653 | 'label' => sprintf(__('Logo %s', 'embedpress'), $this->pro_text), |
| 654 | 'type' => Controls_Manager::SWITCHER, |
| 655 | 'label_block' => false, |
| 656 | 'return_value' => 'yes', |
| 657 | 'default' => 'yes', |
| 658 | 'label_off' => __('Hide', 'embedpress'), |
| 659 | 'label_on' => __('Show', 'embedpress'), |
| 660 | 'condition' => [ |
| 661 | 'embedpress_pro_embeded_source' => 'dailymotion' |
| 662 | ], |
| 663 | 'classes' => $this->pro_class, |
| 664 | ] |
| 665 | ); |
| 666 | $this->add_control( |
| 667 | 'embedpress_pro_dailymotion_autoplay', |
| 668 | [ |
| 669 | 'label' => __('Auto Play', 'embedpress'), |
| 670 | 'type' => Controls_Manager::SWITCHER, |
| 671 | 'label_block' => false, |
| 672 | 'return_value' => 'yes', |
| 673 | 'default' => 'no', |
| 674 | 'label_off' => __('Hide', 'embedpress'), |
| 675 | 'label_on' => __('Show', 'embedpress'), |
| 676 | 'condition' => [ |
| 677 | 'embedpress_pro_embeded_source' => 'dailymotion' |
| 678 | ] |
| 679 | ] |
| 680 | ); |
| 681 | $this->add_control( |
| 682 | 'embedpress_pro_dailymotion_play_on_mobile', |
| 683 | [ |
| 684 | 'label' => __('Play On Mobile', 'embedpress'), |
| 685 | 'type' => Controls_Manager::SWITCHER, |
| 686 | 'label_block' => false, |
| 687 | 'return_value' => 'yes', |
| 688 | 'default' => 'no', |
| 689 | 'label_off' => __('Hide', 'embedpress'), |
| 690 | 'label_on' => __('Show', 'embedpress'), |
| 691 | 'condition' => [ |
| 692 | 'embedpress_pro_embeded_source' => 'dailymotion', |
| 693 | 'embedpress_pro_dailymotion_autoplay' => 'yes' |
| 694 | ] |
| 695 | ] |
| 696 | ); |
| 697 | $this->add_control( |
| 698 | 'embedpress_pro_dailymotion_mute', |
| 699 | [ |
| 700 | 'label' => __('Mute', 'embedpress'), |
| 701 | 'type' => Controls_Manager::SWITCHER, |
| 702 | 'label_block' => false, |
| 703 | 'return_value' => 'yes', |
| 704 | 'default' => 'no', |
| 705 | 'label_off' => __('Hide', 'embedpress'), |
| 706 | 'label_on' => __('Show', 'embedpress'), |
| 707 | 'condition' => [ |
| 708 | 'embedpress_pro_embeded_source' => 'dailymotion' |
| 709 | ] |
| 710 | ] |
| 711 | ); |
| 712 | $this->add_control( |
| 713 | 'embedpress_pro_dailymotion_player_control', |
| 714 | [ |
| 715 | 'label' => __('Player Controls', 'embedpress'), |
| 716 | 'type' => Controls_Manager::SWITCHER, |
| 717 | 'label_block' => false, |
| 718 | 'return_value' => 'yes', |
| 719 | 'default' => 'yes', |
| 720 | 'label_off' => __('Hide', 'embedpress'), |
| 721 | 'label_on' => __('Show', 'embedpress'), |
| 722 | 'condition' => [ |
| 723 | 'embedpress_pro_embeded_source' => 'dailymotion' |
| 724 | ] |
| 725 | ] |
| 726 | ); |
| 727 | $this->add_control( |
| 728 | 'embedpress_pro_dailymotion_video_info', |
| 729 | [ |
| 730 | 'label' => __('Video Info', 'embedpress'), |
| 731 | 'type' => Controls_Manager::SWITCHER, |
| 732 | 'label_block' => false, |
| 733 | 'return_value' => 'yes', |
| 734 | 'default' => 'yes', |
| 735 | 'label_off' => __('Hide', 'embedpress'), |
| 736 | 'label_on' => __('Show', 'embedpress'), |
| 737 | 'condition' => [ |
| 738 | 'embedpress_pro_embeded_source' => 'dailymotion' |
| 739 | ] |
| 740 | ] |
| 741 | ); |
| 742 | $this->add_control( |
| 743 | 'embedpress_pro_dailymotion_control_color', |
| 744 | [ |
| 745 | 'label' => __('Control Color', 'embedpress'), |
| 746 | 'type' => Controls_Manager::COLOR, |
| 747 | 'label_block' => false, |
| 748 | 'default' => '#dd3333', |
| 749 | 'condition' => [ |
| 750 | 'embedpress_pro_embeded_source' => 'dailymotion' |
| 751 | ] |
| 752 | ] |
| 753 | ); |
| 754 | $this->init_branding_controls('dailymotion'); |
| 755 | } |
| 756 | //End Dailymotion Controls |
| 757 | |
| 758 | /** |
| 759 | * Wistia Controls |
| 760 | */ |
| 761 | public function init_wistia_controls() |
| 762 | { |
| 763 | $this->add_control( |
| 764 | 'embedpress_pro_wistia_auto_play', |
| 765 | [ |
| 766 | 'label' => __('Auto Play', 'embedpress'), |
| 767 | 'type' => Controls_Manager::SWITCHER, |
| 768 | 'label_block' => false, |
| 769 | 'return_value' => 'yes', |
| 770 | 'default' => 'no', |
| 771 | 'condition' => [ |
| 772 | 'embedpress_pro_embeded_source' => 'wistia' |
| 773 | ], |
| 774 | ] |
| 775 | ); |
| 776 | |
| 777 | $this->add_control( |
| 778 | 'embedpress_pro_wistia_color', |
| 779 | [ |
| 780 | 'label' => __('Scheme', 'embedpress'), |
| 781 | 'type' => Controls_Manager::COLOR, |
| 782 | 'label_block' => false, |
| 783 | 'default' => '#dd3333', |
| 784 | 'condition' => [ |
| 785 | 'embedpress_pro_embeded_source' => 'wistia' |
| 786 | ] |
| 787 | ] |
| 788 | ); |
| 789 | |
| 790 | |
| 791 | |
| 792 | $this->add_control( |
| 793 | 'embedpress_pro_wistia_captions_enabled_by_default', |
| 794 | [ |
| 795 | 'label' => __('Captions Enabled By Default', 'embedpress'), |
| 796 | 'type' => Controls_Manager::SWITCHER, |
| 797 | 'label_block' => false, |
| 798 | 'return_value' => 'yes', |
| 799 | 'default' => 'no', |
| 800 | 'condition' => [ |
| 801 | 'embedpress_pro_embeded_source' => 'wistia', |
| 802 | 'embedpress_pro_wistia_captions' => 'yes' |
| 803 | ], |
| 804 | 'classes' => $this->pro_class, |
| 805 | ] |
| 806 | ); |
| 807 | |
| 808 | $this->add_control( |
| 809 | 'embedpress_pro_wistia_player_options', |
| 810 | [ |
| 811 | 'label' => __('Player Options', 'embedpress'), |
| 812 | 'type' => Controls_Manager::HEADING, |
| 813 | 'separator' => 'before', |
| 814 | 'condition' => [ |
| 815 | 'embedpress_pro_embeded_source' => 'wistia' |
| 816 | ] |
| 817 | ] |
| 818 | ); |
| 819 | |
| 820 | |
| 821 | |
| 822 | $this->add_control( |
| 823 | 'embedpress_pro_wistia_fullscreen_button', |
| 824 | [ |
| 825 | 'label' => __('Fullscreen Button', 'embedpress'), |
| 826 | 'type' => Controls_Manager::SWITCHER, |
| 827 | 'label_block' => false, |
| 828 | 'return_value' => 'yes', |
| 829 | 'default' => 'no', |
| 830 | 'condition' => [ |
| 831 | 'embedpress_pro_embeded_source' => 'wistia' |
| 832 | ], |
| 833 | ] |
| 834 | ); |
| 835 | |
| 836 | $this->add_control( |
| 837 | 'embedpress_pro_wistia_small_play_button', |
| 838 | [ |
| 839 | 'label' => __('Small Play Button', 'embedpress'), |
| 840 | 'type' => Controls_Manager::SWITCHER, |
| 841 | 'label_block' => false, |
| 842 | 'return_value' => 'yes', |
| 843 | 'default' => 'no', |
| 844 | 'condition' => [ |
| 845 | 'embedpress_pro_embeded_source' => 'wistia' |
| 846 | ], |
| 847 | ] |
| 848 | ); |
| 849 | |
| 850 | |
| 851 | |
| 852 | |
| 853 | $this->add_control( |
| 854 | 'embedpress_pro_wistia_resumable', |
| 855 | [ |
| 856 | 'label' => __('Resumable', 'embedpress'), |
| 857 | 'type' => Controls_Manager::SWITCHER, |
| 858 | 'label_block' => false, |
| 859 | 'return_value' => 'yes', |
| 860 | 'default' => 'no', |
| 861 | 'condition' => [ |
| 862 | 'embedpress_pro_embeded_source' => 'wistia' |
| 863 | ], |
| 864 | ] |
| 865 | ); |
| 866 | |
| 867 | |
| 868 | $this->add_control( |
| 869 | 'embedpress_pro_wistia_focus', |
| 870 | [ |
| 871 | 'label' => __('Focus', 'embedpress'), |
| 872 | 'type' => Controls_Manager::SWITCHER, |
| 873 | 'label_block' => false, |
| 874 | 'return_value' => 'yes', |
| 875 | 'default' => 'no', |
| 876 | 'condition' => [ |
| 877 | 'embedpress_pro_embeded_source' => 'wistia' |
| 878 | ], |
| 879 | ] |
| 880 | ); |
| 881 | |
| 882 | // --- Wistia PRO Controls -- |
| 883 | $this->add_control( |
| 884 | 'embedpress_pro_wistia_captions', |
| 885 | [ |
| 886 | 'label' => sprintf(__('Closed Captions %s', 'embedpress'), $this->pro_text), |
| 887 | 'type' => Controls_Manager::SWITCHER, |
| 888 | 'label_block' => false, |
| 889 | 'return_value' => 'yes', |
| 890 | 'default' => 'no', |
| 891 | 'condition' => [ |
| 892 | 'embedpress_pro_embeded_source' => 'wistia' |
| 893 | ], |
| 894 | 'classes' => $this->pro_class, |
| 895 | ] |
| 896 | ); |
| 897 | $this->add_control( |
| 898 | 'embedpress_pro_wistia_playbar', |
| 899 | [ |
| 900 | 'label' => __('Playbar ', 'embedpress'), |
| 901 | 'type' => Controls_Manager::SWITCHER, |
| 902 | 'label_block' => false, |
| 903 | 'return_value' => 'yes', |
| 904 | 'default' => 'no', |
| 905 | 'condition' => [ |
| 906 | 'embedpress_pro_embeded_source' => 'wistia' |
| 907 | ], |
| 908 | ] |
| 909 | ); |
| 910 | |
| 911 | $this->add_control( |
| 912 | 'embedpress_pro_wistia_volume_control', |
| 913 | [ |
| 914 | 'label' => sprintf(__('Volume Control %s', 'embedpress'), $this->pro_text), |
| 915 | 'type' => Controls_Manager::SWITCHER, |
| 916 | 'label_block' => false, |
| 917 | 'return_value' => 'yes', |
| 918 | 'default' => 'yes', |
| 919 | 'condition' => [ |
| 920 | 'embedpress_pro_embeded_source' => 'wistia' |
| 921 | ], |
| 922 | 'classes' => $this->pro_class, |
| 923 | ] |
| 924 | ); |
| 925 | |
| 926 | |
| 927 | $this->add_control( |
| 928 | 'embedpress_pro_wistia_volume', |
| 929 | [ |
| 930 | 'label' => sprintf(__('Volume %s', 'embedpress'), $this->pro_text), |
| 931 | 'type' => Controls_Manager::SLIDER, |
| 932 | 'default' => [ |
| 933 | 'size' => 100, |
| 934 | ], |
| 935 | 'range' => [ |
| 936 | 'px' => [ |
| 937 | 'min' => 0, |
| 938 | 'max' => 100, |
| 939 | ] |
| 940 | ], |
| 941 | 'condition' => [ |
| 942 | 'embedpress_pro_embeded_source' => 'wistia', |
| 943 | 'embedpress_pro_wistia_volume_control' => 'yes' |
| 944 | ], |
| 945 | 'classes' => $this->pro_class, |
| 946 | ] |
| 947 | ); |
| 948 | |
| 949 | $this->add_control( |
| 950 | 'embedpress_pro_wistia_rewind', |
| 951 | [ |
| 952 | 'label' => __('Rewind', 'embedpress'), |
| 953 | 'type' => Controls_Manager::SWITCHER, |
| 954 | 'label_block' => false, |
| 955 | 'return_value' => 'yes', |
| 956 | 'default' => 'no', |
| 957 | 'condition' => [ |
| 958 | 'embedpress_pro_embeded_source' => 'wistia' |
| 959 | ], |
| 960 | ] |
| 961 | ); |
| 962 | |
| 963 | $this->add_control( |
| 964 | 'embedpress_pro_wistia_rewind_time', |
| 965 | [ |
| 966 | 'label' => __('Rewind time', 'embedpress'), |
| 967 | 'type' => Controls_Manager::SLIDER, |
| 968 | 'default' => [ |
| 969 | 'size' => 10, |
| 970 | ], |
| 971 | 'range' => [ |
| 972 | 'px' => [ |
| 973 | 'min' => 1, |
| 974 | 'max' => 100, |
| 975 | ] |
| 976 | ], |
| 977 | 'condition' => [ |
| 978 | 'embedpress_pro_wistia_rewind' => 'yes', |
| 979 | 'embedpress_pro_embeded_source' => 'wistia' |
| 980 | ], |
| 981 | ] |
| 982 | ); |
| 983 | $this->init_branding_controls('wistia'); |
| 984 | } |
| 985 | //End Wistia controls |
| 986 | |
| 987 | |
| 988 | |
| 989 | /** |
| 990 | * Twitch Controls |
| 991 | */ |
| 992 | public function init_twitch_control() |
| 993 | { |
| 994 | $condition = [ |
| 995 | 'embedpress_pro_embeded_source' => 'twitch' |
| 996 | ]; |
| 997 | $this->add_control( |
| 998 | 'embedpress_pro_twitch_autoplay', |
| 999 | [ |
| 1000 | 'label' => __('Autoplay', 'embedpress'), |
| 1001 | 'type' => Controls_Manager::SWITCHER, |
| 1002 | 'label_off' => __('No', 'embedpress'), |
| 1003 | 'label_on' => __('Yes', 'embedpress'), |
| 1004 | 'default' => 'yes', |
| 1005 | 'condition' => $condition, |
| 1006 | ] |
| 1007 | ); |
| 1008 | $this->add_control( |
| 1009 | 'embedpress_pro_fs', |
| 1010 | [ |
| 1011 | 'label' => __('Allow Full Screen Video', 'embedpress'), |
| 1012 | 'type' => Controls_Manager::SWITCHER, |
| 1013 | 'label_off' => __('No', 'embedpress'), |
| 1014 | 'label_on' => __('Yes', 'embedpress'), |
| 1015 | 'default' => 'yes', |
| 1016 | 'condition' => $condition, |
| 1017 | ] |
| 1018 | ); |
| 1019 | |
| 1020 | // -- Twitch PRO controls -- |
| 1021 | $this->add_control( |
| 1022 | 'embedpress_pro_twitch_chat', |
| 1023 | [ |
| 1024 | 'label' => sprintf(__('Show Chat %s', 'embedpress'), $this->pro_text), |
| 1025 | 'type' => Controls_Manager::SWITCHER, |
| 1026 | 'label_off' => __('Hide', 'embedpress'), |
| 1027 | 'label_on' => __('Show', 'embedpress'), |
| 1028 | 'condition' => $condition, |
| 1029 | 'classes' => $this->pro_class, |
| 1030 | |
| 1031 | ] |
| 1032 | ); |
| 1033 | $this->add_control( |
| 1034 | 'embedpress_pro_twitch_mute', |
| 1035 | [ |
| 1036 | 'label' => __('Mute on start', 'embedpress'), |
| 1037 | 'type' => Controls_Manager::SWITCHER, |
| 1038 | 'label_off' => __('Hide', 'embedpress'), |
| 1039 | 'label_on' => __('Show', 'embedpress'), |
| 1040 | 'condition' => $condition, |
| 1041 | ] |
| 1042 | ); |
| 1043 | $this->add_control( |
| 1044 | 'embedpress_pro_twitch_theme', |
| 1045 | [ |
| 1046 | 'label' => __('Theme', 'embedpress'), |
| 1047 | 'type' => Controls_Manager::SELECT, |
| 1048 | 'default' => 'dark', |
| 1049 | 'options' => [ |
| 1050 | 'dark' => __('Dark', 'embedpress'), |
| 1051 | 'light' => __('Light', 'embedpress'), |
| 1052 | ], |
| 1053 | 'condition' => $condition, |
| 1054 | ] |
| 1055 | ); |
| 1056 | |
| 1057 | $this->init_branding_controls('twitch'); |
| 1058 | } |
| 1059 | //End Twitch controls |
| 1060 | |
| 1061 | |
| 1062 | /** |
| 1063 | * SoundCloud Controls |
| 1064 | */ |
| 1065 | public function init_soundcloud_controls() |
| 1066 | { |
| 1067 | $this->add_control( |
| 1068 | 'embedpress_pro_soundcloud_visual', |
| 1069 | [ |
| 1070 | 'label' => __('Visual Player', 'embedpress'), |
| 1071 | 'type' => Controls_Manager::SWITCHER, |
| 1072 | 'label_block' => false, |
| 1073 | 'return_value' => 'yes', |
| 1074 | 'default' => 'no', |
| 1075 | 'label_off' => __('Hide', 'embedpress'), |
| 1076 | 'label_on' => __('Show', 'embedpress'), |
| 1077 | 'condition' => [ |
| 1078 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1079 | ], |
| 1080 | ] |
| 1081 | ); |
| 1082 | |
| 1083 | $this->add_control( |
| 1084 | 'embedpress_pro_soundcloud_color', |
| 1085 | [ |
| 1086 | 'label' => __('Scheme', 'embedpress'), |
| 1087 | 'type' => Controls_Manager::COLOR, |
| 1088 | 'label_block' => false, |
| 1089 | 'default' => '#FF5500', |
| 1090 | 'condition' => [ |
| 1091 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1092 | ] |
| 1093 | ] |
| 1094 | ); |
| 1095 | |
| 1096 | $this->add_control( |
| 1097 | 'embedpress_pro_soundcloud_autoplay', |
| 1098 | [ |
| 1099 | 'label' => __('Auto Play', 'embedpress'), |
| 1100 | 'type' => Controls_Manager::SWITCHER, |
| 1101 | 'label_block' => false, |
| 1102 | 'return_value' => 'yes', |
| 1103 | 'default' => 'no', |
| 1104 | 'label_off' => __('Hide', 'embedpress'), |
| 1105 | 'label_on' => __('Show', 'embedpress'), |
| 1106 | 'condition' => [ |
| 1107 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1108 | ], |
| 1109 | ] |
| 1110 | ); |
| 1111 | |
| 1112 | |
| 1113 | |
| 1114 | $this->add_control( |
| 1115 | 'embedpress_pro_soundcloud_share_button', |
| 1116 | [ |
| 1117 | 'label' => __('Share Button', 'embedpress'), |
| 1118 | 'type' => Controls_Manager::SWITCHER, |
| 1119 | 'label_block' => false, |
| 1120 | 'return_value' => 'yes', |
| 1121 | 'default' => 'yes', |
| 1122 | 'label_off' => __('Hide', 'embedpress'), |
| 1123 | 'label_on' => __('Show', 'embedpress'), |
| 1124 | 'condition' => [ |
| 1125 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1126 | ], |
| 1127 | ] |
| 1128 | ); |
| 1129 | |
| 1130 | $this->add_control( |
| 1131 | 'embedpress_pro_soundcloud_comments', |
| 1132 | [ |
| 1133 | 'label' => __('Comments', 'embedpress'), |
| 1134 | 'type' => Controls_Manager::SWITCHER, |
| 1135 | 'label_block' => false, |
| 1136 | 'return_value' => 'yes', |
| 1137 | 'default' => 'yes', |
| 1138 | 'label_off' => __('Hide', 'embedpress'), |
| 1139 | 'label_on' => __('Show', 'embedpress'), |
| 1140 | 'condition' => [ |
| 1141 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1142 | ], |
| 1143 | ] |
| 1144 | ); |
| 1145 | |
| 1146 | |
| 1147 | |
| 1148 | $this->add_control( |
| 1149 | 'embedpress_pro_soundcloud_artwork', |
| 1150 | [ |
| 1151 | 'label' => __('Artwork', 'embedpress'), |
| 1152 | 'type' => Controls_Manager::SWITCHER, |
| 1153 | 'label_block' => false, |
| 1154 | 'return_value' => 'yes', |
| 1155 | 'default' => 'yes', |
| 1156 | 'label_off' => __('Hide', 'embedpress'), |
| 1157 | 'label_on' => __('Show', 'embedpress'), |
| 1158 | 'condition' => [ |
| 1159 | 'embedpress_pro_embeded_source' => 'soundcloud', |
| 1160 | 'embedpress_pro_soundcloud_visual!' => 'yes' |
| 1161 | ] |
| 1162 | ] |
| 1163 | ); |
| 1164 | |
| 1165 | $this->add_control( |
| 1166 | 'embedpress_pro_soundcloud_play_count', |
| 1167 | [ |
| 1168 | 'label' => __('Play Count', 'embedpress'), |
| 1169 | 'type' => Controls_Manager::SWITCHER, |
| 1170 | 'label_block' => false, |
| 1171 | 'return_value' => 'yes', |
| 1172 | 'default' => 'yes', |
| 1173 | 'label_off' => __('Hide', 'embedpress'), |
| 1174 | 'label_on' => __('Show', 'embedpress'), |
| 1175 | 'condition' => [ |
| 1176 | 'embedpress_pro_embeded_source' => 'soundcloud', |
| 1177 | 'embedpress_pro_soundcloud_visual!' => 'yes' |
| 1178 | ], |
| 1179 | ] |
| 1180 | ); |
| 1181 | |
| 1182 | $this->add_control( |
| 1183 | 'embedpress_pro_soundcloud_user_name', |
| 1184 | [ |
| 1185 | 'label' => __('User Name', 'embedpress'), |
| 1186 | 'type' => Controls_Manager::SWITCHER, |
| 1187 | 'label_block' => false, |
| 1188 | 'return_value' => 'yes', |
| 1189 | 'default' => 'yes', |
| 1190 | 'label_off' => __('Hide', 'embedpress'), |
| 1191 | 'label_on' => __('Show', 'embedpress'), |
| 1192 | 'condition' => [ |
| 1193 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1194 | ], |
| 1195 | ] |
| 1196 | ); |
| 1197 | |
| 1198 | $this->add_control( |
| 1199 | 'embedpress_pro_soundcloud_buy_button', |
| 1200 | [ |
| 1201 | 'label' => sprintf(__('Buy Button %s', 'embedpress'), $this->pro_text), |
| 1202 | 'type' => Controls_Manager::SWITCHER, |
| 1203 | 'label_block' => false, |
| 1204 | 'return_value' => 'yes', |
| 1205 | 'default' => 'yes', |
| 1206 | 'label_off' => __('Hide', 'embedpress'), |
| 1207 | 'label_on' => __('Show', 'embedpress'), |
| 1208 | 'condition' => [ |
| 1209 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1210 | ], |
| 1211 | 'classes' => $this->pro_class, |
| 1212 | ] |
| 1213 | ); |
| 1214 | $this->add_control( |
| 1215 | 'embedpress_pro_soundcloud_download_button', |
| 1216 | [ |
| 1217 | 'label' => sprintf(__('Download Button %s', 'embedpress'), $this->pro_text), |
| 1218 | 'type' => Controls_Manager::SWITCHER, |
| 1219 | 'label_block' => false, |
| 1220 | 'return_value' => 'yes', |
| 1221 | 'default' => 'yes', |
| 1222 | 'label_off' => __('Hide', 'embedpress'), |
| 1223 | 'label_on' => __('Show', 'embedpress'), |
| 1224 | 'condition' => [ |
| 1225 | 'embedpress_pro_embeded_source' => 'soundcloud' |
| 1226 | ], |
| 1227 | 'classes' => $this->pro_class, |
| 1228 | ] |
| 1229 | ); |
| 1230 | } |
| 1231 | //End SoundCloud controls |
| 1232 | |
| 1233 | /** |
| 1234 | * Vimeo Controls |
| 1235 | */ |
| 1236 | public function init_vimeo_controls() |
| 1237 | { |
| 1238 | $this->add_control( |
| 1239 | 'embedpress_pro_vimeo_auto_play', |
| 1240 | [ |
| 1241 | 'label' => __('Auto Play', 'embedpress'), |
| 1242 | 'type' => Controls_Manager::SWITCHER, |
| 1243 | 'label_block' => false, |
| 1244 | 'return_value' => 'yes', |
| 1245 | 'default' => 'no', |
| 1246 | 'description' => __( |
| 1247 | 'Automatically stop the current video from playing when another one starts.', |
| 1248 | 'embedpress' |
| 1249 | ), |
| 1250 | 'condition' => [ |
| 1251 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1252 | ] |
| 1253 | ] |
| 1254 | ); |
| 1255 | |
| 1256 | |
| 1257 | $this->add_control( |
| 1258 | 'embedpress_pro_vimeo_color', |
| 1259 | [ |
| 1260 | 'label' => __('Scheme', 'embedpress'), |
| 1261 | 'type' => Controls_Manager::COLOR, |
| 1262 | 'label_block' => false, |
| 1263 | 'default' => '#00adef', |
| 1264 | 'condition' => [ |
| 1265 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1266 | ] |
| 1267 | ] |
| 1268 | ); |
| 1269 | |
| 1270 | $this->add_control( |
| 1271 | 'embedpress_pro_vimeo_author_options', |
| 1272 | [ |
| 1273 | 'label' => __('Author Information', 'embedpress'), |
| 1274 | 'type' => Controls_Manager::HEADING, |
| 1275 | 'separator' => 'before', |
| 1276 | 'condition' => [ |
| 1277 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1278 | ] |
| 1279 | ] |
| 1280 | ); |
| 1281 | |
| 1282 | $this->add_control( |
| 1283 | 'embedpress_pro_vimeo_display_title', |
| 1284 | [ |
| 1285 | 'label' => __('Title', 'embedpress'), |
| 1286 | 'type' => Controls_Manager::SWITCHER, |
| 1287 | 'label_block' => false, |
| 1288 | 'return_value' => 'yes', |
| 1289 | 'default' => 'yes', |
| 1290 | 'condition' => [ |
| 1291 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1292 | ] |
| 1293 | ] |
| 1294 | ); |
| 1295 | |
| 1296 | //----- Vimeo PRO controls |
| 1297 | |
| 1298 | $this->add_control( |
| 1299 | 'embedpress_pro_vimeo_display_author', |
| 1300 | [ |
| 1301 | 'label' => __('Author', 'embedpress'), |
| 1302 | 'type' => Controls_Manager::SWITCHER, |
| 1303 | 'label_block' => false, |
| 1304 | 'return_value' => 'yes', |
| 1305 | 'default' => 'yes', |
| 1306 | 'condition' => [ |
| 1307 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1308 | ], |
| 1309 | ] |
| 1310 | ); |
| 1311 | |
| 1312 | $this->add_control( |
| 1313 | 'embedpress_pro_vimeo_avatar', |
| 1314 | [ |
| 1315 | 'label' => __('Avatar', 'embedpress'), |
| 1316 | 'type' => Controls_Manager::SWITCHER, |
| 1317 | 'label_block' => false, |
| 1318 | 'return_value' => 'yes', |
| 1319 | 'default' => 'yes', |
| 1320 | 'condition' => [ |
| 1321 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1322 | ], |
| 1323 | ] |
| 1324 | ); |
| 1325 | |
| 1326 | $this->add_control( |
| 1327 | 'embedpress_pro_vimeo_loop', |
| 1328 | [ |
| 1329 | 'label' => sprintf(__('Loop %s', 'embedpress'), $this->pro_text), |
| 1330 | 'type' => Controls_Manager::SWITCHER, |
| 1331 | 'label_block' => false, |
| 1332 | 'return_value' => 'yes', |
| 1333 | 'default' => 'no', |
| 1334 | 'condition' => [ |
| 1335 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1336 | ], |
| 1337 | 'classes' => $this->pro_class, |
| 1338 | ] |
| 1339 | ); |
| 1340 | |
| 1341 | $this->add_control( |
| 1342 | 'embedpress_pro_vimeo_autopause', |
| 1343 | [ |
| 1344 | 'label' => sprintf(__('Auto Pause %s', 'embedpress'), $this->pro_text), |
| 1345 | 'type' => Controls_Manager::SWITCHER, |
| 1346 | 'label_block' => false, |
| 1347 | 'return_value' => 'yes', |
| 1348 | 'default' => 'no', |
| 1349 | 'description' => __( |
| 1350 | 'Automatically stop the current video from playing when another one starts.', |
| 1351 | 'embedpress' |
| 1352 | ), |
| 1353 | 'condition' => [ |
| 1354 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1355 | ], |
| 1356 | 'classes' => $this->pro_class, |
| 1357 | ] |
| 1358 | ); |
| 1359 | |
| 1360 | $this->add_control( |
| 1361 | 'embedpress_pro_vimeo_dnt', |
| 1362 | [ |
| 1363 | 'label' => sprintf(__('DNT %s', 'embedpress'), $this->pro_text), |
| 1364 | 'type' => Controls_Manager::SWITCHER, |
| 1365 | 'label_block' => false, |
| 1366 | 'return_value' => 'yes', |
| 1367 | 'default' => 'yes', |
| 1368 | 'description' => __( |
| 1369 | 'Set this parameter to "yes" will block tracking any session data, including cookies. If Auto Pause is enabled this will not work.', |
| 1370 | 'embedpress' |
| 1371 | ), |
| 1372 | 'condition' => [ |
| 1373 | 'embedpress_pro_embeded_source' => 'vimeo' |
| 1374 | ], |
| 1375 | 'classes' => $this->pro_class, |
| 1376 | ] |
| 1377 | ); |
| 1378 | |
| 1379 | |
| 1380 | $this->init_branding_controls('vimeo'); |
| 1381 | } |
| 1382 | //End Vimeo controls |
| 1383 | |
| 1384 | |
| 1385 | /** |
| 1386 | * Spotify Controls |
| 1387 | */ |
| 1388 | public function init_spotify_controls() |
| 1389 | { |
| 1390 | $condition = [ |
| 1391 | 'embedpress_pro_embeded_source' => 'spotify' |
| 1392 | ]; |
| 1393 | |
| 1394 | $this->add_control( |
| 1395 | 'spotify_theme', |
| 1396 | [ |
| 1397 | 'label' => __('Player Background', 'embedpress'), |
| 1398 | 'description' => __('Dynamic option will use the most vibrant color from the album art.', 'embedpress'), |
| 1399 | 'type' => Controls_Manager::SELECT, |
| 1400 | 'label_block' => false, |
| 1401 | 'default' => '1', |
| 1402 | 'options' => [ |
| 1403 | '1' => __('Dynamic', 'embedpress'), |
| 1404 | '0' => __('Black & White', 'embedpress') |
| 1405 | ], |
| 1406 | 'condition' => $condition |
| 1407 | ] |
| 1408 | ); |
| 1409 | } |
| 1410 | //End Spotify controls |
| 1411 | |
| 1412 | /** |
| 1413 | * OpenSea Controls |
| 1414 | */ |
| 1415 | public function init_opensea_control(){ |
| 1416 | $condition = [ |
| 1417 | 'embedpress_pro_embeded_source' => 'opensea' |
| 1418 | ]; |
| 1419 | |
| 1420 | $this->add_control( |
| 1421 | 'limit', |
| 1422 | [ |
| 1423 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 1424 | 'label' => esc_html__( 'Limit', 'embedpress' ), |
| 1425 | 'placeholder' => '9', |
| 1426 | 'min' => 1, |
| 1427 | 'max' => 100, |
| 1428 | 'step' => 1, |
| 1429 | 'default' => 20, |
| 1430 | 'condition' => [ |
| 1431 | 'embedpress_pro_embeded_nft_type' => ['collection'], |
| 1432 | 'embedpress_pro_embeded_source!' => [ |
| 1433 | 'default', |
| 1434 | 'youtube', |
| 1435 | 'vimeo', |
| 1436 | 'dailymotion', |
| 1437 | 'wistia', |
| 1438 | 'twitch', |
| 1439 | 'soundcloud', |
| 1440 | ], |
| 1441 | ], |
| 1442 | ] |
| 1443 | ); |
| 1444 | |
| 1445 | |
| 1446 | $this->add_control( |
| 1447 | 'orderby', |
| 1448 | [ |
| 1449 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1450 | 'label' => esc_html__( 'Order By', 'embedpress' ), |
| 1451 | 'options' => [ |
| 1452 | 'asc' => esc_html__( 'Oldest', 'embedpress' ), |
| 1453 | 'desc' => esc_html__( 'Newest', 'embedpress' ), |
| 1454 | ], |
| 1455 | 'default' => 'desc', |
| 1456 | 'condition' => [ |
| 1457 | 'embedpress_pro_embeded_nft_type' => ['collection'], |
| 1458 | 'embedpress_pro_embeded_source!' => [ |
| 1459 | 'default', |
| 1460 | 'youtube', |
| 1461 | 'vimeo', |
| 1462 | 'dailymotion', |
| 1463 | 'wistia', |
| 1464 | 'twitch', |
| 1465 | 'soundcloud', |
| 1466 | ], |
| 1467 | ], |
| 1468 | ] |
| 1469 | ); |
| 1470 | } |
| 1471 | |
| 1472 | public function init_opensea_control_section(){ |
| 1473 | $condition = [ |
| 1474 | 'embedpress_pro_embeded_source' => 'opensea', |
| 1475 | ]; |
| 1476 | |
| 1477 | $this->start_controls_section( |
| 1478 | 'embedpress_opensea_control_section', |
| 1479 | [ |
| 1480 | 'label' => __('OpenSea Control Settings', 'embedpress'), |
| 1481 | 'condition' => $condition, |
| 1482 | ] |
| 1483 | ); |
| 1484 | |
| 1485 | $this->add_control( |
| 1486 | 'opense_important_note_single', |
| 1487 | [ |
| 1488 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 1489 | 'raw' => esc_html__( 'These options take effect only when a Opensea Single Asset is embedded.', 'embedpress' ), |
| 1490 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1491 | 'condition' => [ |
| 1492 | 'embedpress_pro_embeded_nft_type' => 'single' |
| 1493 | ], |
| 1494 | |
| 1495 | ] |
| 1496 | ); |
| 1497 | $this->add_control( |
| 1498 | 'opense_important_note_collection', |
| 1499 | [ |
| 1500 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 1501 | 'raw' => esc_html__( 'These options take effect only when a Opensea Collection is embedded.', 'embedpress' ), |
| 1502 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1503 | 'condition' => [ |
| 1504 | 'embedpress_pro_embeded_nft_type' => 'collection' |
| 1505 | ], |
| 1506 | ] |
| 1507 | ); |
| 1508 | |
| 1509 | $this->add_control( |
| 1510 | 'layout', |
| 1511 | [ |
| 1512 | 'label' => __('Layout', 'embedpress'), |
| 1513 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1514 | 'label_block' => false, |
| 1515 | 'default' => 'ep-grid', |
| 1516 | 'options' => [ |
| 1517 | 'ep-grid' => esc_html__('Grid', 'embedpress'), |
| 1518 | 'ep-list' => esc_html__('List', 'embedpress'), |
| 1519 | ], |
| 1520 | 'conditions' => [ |
| 1521 | 'terms' => [ |
| 1522 | [ |
| 1523 | 'name' => 'embedpress_pro_embeded_nft_type', |
| 1524 | 'operator' => '===', |
| 1525 | 'value' => 'collection', |
| 1526 | ], |
| 1527 | ], |
| 1528 | ] |
| 1529 | |
| 1530 | ] |
| 1531 | ); |
| 1532 | |
| 1533 | |
| 1534 | $this->add_control( |
| 1535 | 'preset', |
| 1536 | [ |
| 1537 | 'label' => __('Preset', 'embedpress'), |
| 1538 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1539 | 'label_block' => false, |
| 1540 | 'default' => 'ep-preset-1', |
| 1541 | 'options' => [ |
| 1542 | 'ep-preset-1' => esc_html__('Preset 1', 'embedpress'), |
| 1543 | 'ep-preset-2' => esc_html__('Preset 2', 'embedpress'), |
| 1544 | ], |
| 1545 | 'conditions' => [ |
| 1546 | 'terms' => [ |
| 1547 | [ |
| 1548 | 'name' => 'embedpress_pro_embeded_nft_type', |
| 1549 | 'operator' => '===', |
| 1550 | 'value' => 'collection', |
| 1551 | 'relation' => 'and' |
| 1552 | ], |
| 1553 | [ |
| 1554 | 'name' => 'layout', |
| 1555 | 'operator' => '===', |
| 1556 | 'value' => 'ep-grid', |
| 1557 | 'relation' => 'and' |
| 1558 | ], |
| 1559 | ], |
| 1560 | ] |
| 1561 | |
| 1562 | ] |
| 1563 | ); |
| 1564 | |
| 1565 | $this->add_control( |
| 1566 | 'nftperrow', |
| 1567 | [ |
| 1568 | 'label' => __('Column', 'embedpress'), |
| 1569 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 1570 | 'label_block' => false, |
| 1571 | 'default' => '3', |
| 1572 | 'options' => [ |
| 1573 | '1' => esc_html__('1', 'embedpress'), |
| 1574 | '2' => esc_html__('2', 'embedpress'), |
| 1575 | '3' => esc_html__('3', 'embedpress'), |
| 1576 | '4' => esc_html__('4', 'embedpress'), |
| 1577 | '5' => esc_html__('5', 'embedpress'), |
| 1578 | '6' => esc_html__('6', 'embedpress'), |
| 1579 | 'auto' => esc_html__('Auto', 'embedpress'), |
| 1580 | ], |
| 1581 | 'condition' => [ |
| 1582 | 'embedpress_pro_embeded_nft_type' => ['collection'] |
| 1583 | ], |
| 1584 | |
| 1585 | ] |
| 1586 | ); |
| 1587 | |
| 1588 | $this->add_control( |
| 1589 | 'gapbetweenitem', |
| 1590 | [ |
| 1591 | 'label' => esc_html__( 'Gap Between Item', 'embedpress' ), |
| 1592 | 'type' => \Elementor\Controls_Manager::SLIDER, |
| 1593 | 'size_units' => [ 'px'], |
| 1594 | 'range' => [ |
| 1595 | 'px' => [ |
| 1596 | 'min' => 1, |
| 1597 | 'max' => 100, |
| 1598 | 'step' => 1, |
| 1599 | ], |
| 1600 | ], |
| 1601 | 'default' => [ |
| 1602 | 'unit' => 'px', |
| 1603 | 'size' => 15, |
| 1604 | ], |
| 1605 | 'condition' => [ |
| 1606 | 'embedpress_pro_embeded_nft_type' => ['collection'] |
| 1607 | ], |
| 1608 | ] |
| 1609 | ); |
| 1610 | |
| 1611 | $this->add_control( |
| 1612 | 'collectionname', |
| 1613 | [ |
| 1614 | 'label' => __('Collection Name', 'embedpress'), |
| 1615 | 'type' => Controls_Manager::SWITCHER, |
| 1616 | 'label_block' => false, |
| 1617 | 'return_value' => 'yes', |
| 1618 | 'label_off' => __('Hide', 'embedpress'), |
| 1619 | 'label_on' => __('Show', 'embedpress'), |
| 1620 | 'default' => 'yes', |
| 1621 | 'condition' => [ |
| 1622 | 'embedpress_pro_embeded_nft_type' => 'single' |
| 1623 | ], |
| 1624 | ] |
| 1625 | ); |
| 1626 | $this->add_control( |
| 1627 | 'nftimage', |
| 1628 | [ |
| 1629 | 'label' => __('Thumbnail', 'embedpress'), |
| 1630 | 'type' => Controls_Manager::SWITCHER, |
| 1631 | 'label_block' => false, |
| 1632 | 'return_value' => 'yes', |
| 1633 | 'label_off' => __('Hide', 'embedpress'), |
| 1634 | 'label_on' => __('Show', 'embedpress'), |
| 1635 | 'default' => 'yes', |
| 1636 | 'condition' => $condition, |
| 1637 | ] |
| 1638 | ); |
| 1639 | $this->add_control( |
| 1640 | 'nfttitle', |
| 1641 | [ |
| 1642 | 'label' => __('Title', 'embedpress'), |
| 1643 | 'type' => Controls_Manager::SWITCHER, |
| 1644 | 'label_block' => false, |
| 1645 | 'return_value' => 'yes', |
| 1646 | 'default' => '', |
| 1647 | 'label_off' => __('Hide', 'embedpress'), |
| 1648 | 'label_on' => __('Show', 'embedpress'), |
| 1649 | 'default' => 'yes', |
| 1650 | 'condition' => $condition, |
| 1651 | ] |
| 1652 | ); |
| 1653 | $this->add_control( |
| 1654 | 'nftcreator', |
| 1655 | [ |
| 1656 | 'label' => __('Creator', 'embedpress'), |
| 1657 | 'type' => Controls_Manager::SWITCHER, |
| 1658 | 'label_block' => false, |
| 1659 | 'return_value' => 'yes', |
| 1660 | 'default' => '', |
| 1661 | 'label_off' => __('Hide', 'embedpress'), |
| 1662 | 'label_on' => __('Show', 'embedpress'), |
| 1663 | 'default' => 'yes', |
| 1664 | 'condition' => $condition, |
| 1665 | ] |
| 1666 | ); |
| 1667 | |
| 1668 | $this->add_control( |
| 1669 | 'prefix_nftcreator', |
| 1670 | [ |
| 1671 | 'label' => sprintf(__('Prefix %s', 'embedpress'), $this->pro_text), |
| 1672 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1673 | 'default' => esc_html__( 'Created By', 'embedpress' ), |
| 1674 | 'placeholder' => esc_html__( 'Created By', 'embedpress' ), |
| 1675 | 'classes' => $this->pro_class, |
| 1676 | 'condition' => [ |
| 1677 | 'nftcreator' => 'yes', |
| 1678 | ] |
| 1679 | ] |
| 1680 | ); |
| 1681 | |
| 1682 | $this->add_control( |
| 1683 | 'nftprice', |
| 1684 | [ |
| 1685 | 'label' => __('Current Price', 'embedpress'), |
| 1686 | 'type' => Controls_Manager::SWITCHER, |
| 1687 | 'label_block' => false, |
| 1688 | 'return_value' => 'yes', |
| 1689 | 'default' => '', |
| 1690 | 'label_off' => __('Hide', 'embedpress'), |
| 1691 | 'label_on' => __('Show', 'embedpress'), |
| 1692 | 'default' => 'yes', |
| 1693 | 'condition' => $condition, |
| 1694 | ] |
| 1695 | ); |
| 1696 | |
| 1697 | $this->add_control( |
| 1698 | 'prefix_nftprice', |
| 1699 | [ |
| 1700 | 'label' => sprintf(__('Prefix %s', 'embedpress'), $this->pro_text), |
| 1701 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1702 | 'default' => esc_html__( 'Current Price', 'embedpress' ), |
| 1703 | 'placeholder' => esc_html__( 'Current Price', 'embedpress' ), |
| 1704 | 'classes' => $this->pro_class, |
| 1705 | 'condition' => [ |
| 1706 | 'nftprice' => 'yes', |
| 1707 | ] |
| 1708 | ] |
| 1709 | ); |
| 1710 | |
| 1711 | $this->add_control( |
| 1712 | 'nftlastsale', |
| 1713 | [ |
| 1714 | 'label' => __('Last Sale', 'embedpress'), |
| 1715 | 'type' => Controls_Manager::SWITCHER, |
| 1716 | 'label_block' => false, |
| 1717 | 'return_value' => 'yes', |
| 1718 | 'default' => '', |
| 1719 | 'label_off' => __('Hide', 'embedpress'), |
| 1720 | 'label_on' => __('Show', 'embedpress'), |
| 1721 | 'default' => 'yes', |
| 1722 | 'condition' => $condition, |
| 1723 | ] |
| 1724 | ); |
| 1725 | |
| 1726 | $this->add_control( |
| 1727 | 'prefix_nftlastsale', |
| 1728 | [ |
| 1729 | 'label' => sprintf(__('Prefix %s', 'embedpress'), $this->pro_text), |
| 1730 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1731 | 'default' => esc_html__( 'Last Sale', 'embedpress' ), |
| 1732 | 'placeholder' => esc_html__( 'Last Sale', 'embedpress' ), |
| 1733 | 'classes' => $this->pro_class, |
| 1734 | 'condition' => [ |
| 1735 | 'nftlastsale' => 'yes', |
| 1736 | ] |
| 1737 | ] |
| 1738 | ); |
| 1739 | |
| 1740 | $this->add_control( |
| 1741 | 'nftbutton', |
| 1742 | [ |
| 1743 | 'label' => __('Button', 'embedpress'), |
| 1744 | 'type' => Controls_Manager::SWITCHER, |
| 1745 | 'label_block' => false, |
| 1746 | 'return_value' => 'yes', |
| 1747 | 'default' => '', |
| 1748 | 'label_off' => __('Hide', 'embedpress'), |
| 1749 | 'label_on' => __('Show', 'embedpress'), |
| 1750 | 'default' => 'yes', |
| 1751 | 'condition' => $condition, |
| 1752 | ] |
| 1753 | ); |
| 1754 | $this->add_control( |
| 1755 | 'label_nftbutton', |
| 1756 | [ |
| 1757 | 'label' => sprintf(__('Button Label %s', 'embedpress'), $this->pro_text), |
| 1758 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1759 | 'default' => esc_html__( 'See Details', 'embedpress' ), |
| 1760 | 'placeholder' => esc_html__( 'See Details', 'embedpress' ), |
| 1761 | 'classes' => $this->pro_class, |
| 1762 | 'condition' => [ |
| 1763 | 'nftbutton' => 'yes', |
| 1764 | ] |
| 1765 | ] |
| 1766 | ); |
| 1767 | |
| 1768 | $this->add_control( |
| 1769 | 'loadmore', |
| 1770 | [ |
| 1771 | 'label' => sprintf(__('Load More %s', 'embedpress'), $this->pro_text), |
| 1772 | 'type' => Controls_Manager::SWITCHER, |
| 1773 | 'label_block' => false, |
| 1774 | 'return_value' => 'yes', |
| 1775 | 'default' => '', |
| 1776 | 'label_off' => __('Hide', 'embedpress'), |
| 1777 | 'label_on' => __('Show', 'embedpress'), |
| 1778 | 'default' => '', |
| 1779 | 'classes' => $this->pro_class, |
| 1780 | 'condition' => [ |
| 1781 | 'embedpress_pro_embeded_nft_type' => ['collection'] |
| 1782 | ], |
| 1783 | ] |
| 1784 | ); |
| 1785 | $this->add_control( |
| 1786 | 'itemperpage', |
| 1787 | [ |
| 1788 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 1789 | 'label' => esc_html__( 'Item Per Page', 'embedpress' ), |
| 1790 | 'placeholder' => '9', |
| 1791 | 'min' => 1, |
| 1792 | 'max' => 100, |
| 1793 | 'step' => 1, |
| 1794 | 'default' => 9, |
| 1795 | 'condition' => [ |
| 1796 | 'loadmore' => 'yes' |
| 1797 | ], |
| 1798 | ] |
| 1799 | ); |
| 1800 | $this->add_control( |
| 1801 | 'loadmorelabel', |
| 1802 | [ |
| 1803 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1804 | 'label' => esc_html__( 'Load More Label', 'embedpress' ), |
| 1805 | 'placeholder' => 'Load More', |
| 1806 | 'default' => 'Load More', |
| 1807 | 'condition' => [ |
| 1808 | 'loadmore' => 'yes' |
| 1809 | ], |
| 1810 | ] |
| 1811 | ); |
| 1812 | |
| 1813 | $this->add_control( |
| 1814 | 'nftrank', |
| 1815 | [ |
| 1816 | 'label' => __('Rank', 'embedpress'), |
| 1817 | 'type' => Controls_Manager::SWITCHER, |
| 1818 | 'label_block' => false, |
| 1819 | 'return_value' => 'yes', |
| 1820 | 'label_off' => __('Hide', 'embedpress'), |
| 1821 | 'label_on' => __('Show', 'embedpress'), |
| 1822 | 'default' => 'yes', |
| 1823 | 'condition' => [ |
| 1824 | 'embedpress_pro_embeded_nft_type' => 'single' |
| 1825 | ], |
| 1826 | ] |
| 1827 | ); |
| 1828 | $this->add_control( |
| 1829 | 'label_nftrank', |
| 1830 | [ |
| 1831 | 'label' => sprintf(__('Rank Label %s', 'embedpress'), $this->pro_text), |
| 1832 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1833 | 'default' => esc_html__( 'Rank', 'embedpress' ), |
| 1834 | 'placeholder' => esc_html__( 'Rank', 'embedpress' ), |
| 1835 | 'classes' => $this->pro_class, |
| 1836 | 'condition' => [ |
| 1837 | 'nftrank' => 'yes', |
| 1838 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 1839 | ] |
| 1840 | ] |
| 1841 | ); |
| 1842 | |
| 1843 | $this->add_control( |
| 1844 | 'nftdetails', |
| 1845 | [ |
| 1846 | 'label' => __('Details', 'embedpress'), |
| 1847 | 'type' => Controls_Manager::SWITCHER, |
| 1848 | 'label_block' => false, |
| 1849 | 'return_value' => 'yes', |
| 1850 | 'label_off' => __('Hide', 'embedpress'), |
| 1851 | 'label_on' => __('Show', 'embedpress'), |
| 1852 | 'default' => 'yes', |
| 1853 | 'condition' => [ |
| 1854 | 'embedpress_pro_embeded_nft_type' => 'single' |
| 1855 | ], |
| 1856 | ] |
| 1857 | ); |
| 1858 | |
| 1859 | $this->add_control( |
| 1860 | 'label_nftdetails', |
| 1861 | [ |
| 1862 | 'label' => sprintf(__('Details Label %s', 'embedpress'), $this->pro_text), |
| 1863 | 'type' => \Elementor\Controls_Manager::TEXT, |
| 1864 | 'default' => esc_html__( 'Details', 'embedpress' ), |
| 1865 | 'placeholder' => esc_html__( 'Details', 'embedpress' ), |
| 1866 | 'classes' => $this->pro_class, |
| 1867 | 'condition' => [ |
| 1868 | 'nftdetails' => 'yes', |
| 1869 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 1870 | ] |
| 1871 | ] |
| 1872 | ); |
| 1873 | |
| 1874 | $this->end_controls_section(); |
| 1875 | } |
| 1876 | |
| 1877 | public function init_opensea_color_and_typography(){ |
| 1878 | $condition = [ |
| 1879 | 'embedpress_pro_embeded_source' => 'opensea', |
| 1880 | ]; |
| 1881 | |
| 1882 | $this->start_controls_section( |
| 1883 | 'embedpress_color_typography_control_section', |
| 1884 | [ |
| 1885 | 'label' => __('Color and Typography', 'embedpress'), |
| 1886 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1887 | 'condition' => $condition, |
| 1888 | ] |
| 1889 | ); |
| 1890 | |
| 1891 | $this->add_control( |
| 1892 | 'opense_color_important_note_single', |
| 1893 | [ |
| 1894 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 1895 | 'raw' => esc_html__( 'These options take effect only when a Opensea Single Asset is embedded.', 'embedpress' ), |
| 1896 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1897 | 'condition' => [ |
| 1898 | 'embedpress_pro_embeded_nft_type' => 'single' |
| 1899 | ], |
| 1900 | |
| 1901 | ] |
| 1902 | ); |
| 1903 | $this->add_control( |
| 1904 | 'opense_color_important_note_collection', |
| 1905 | [ |
| 1906 | 'type' => \Elementor\Controls_Manager::RAW_HTML, |
| 1907 | 'raw' => esc_html__( 'These options take effect only when a Opensea Collection is embedded.', 'embedpress' ), |
| 1908 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1909 | 'condition' => [ |
| 1910 | 'embedpress_pro_embeded_nft_type' => 'collection' |
| 1911 | ], |
| 1912 | ] |
| 1913 | ); |
| 1914 | |
| 1915 | |
| 1916 | $this->add_control( |
| 1917 | 'item_heading', |
| 1918 | [ |
| 1919 | 'label' => esc_html__( 'Item', 'embedpress' ), |
| 1920 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 1921 | 'separator' => 'before', |
| 1922 | ] |
| 1923 | ); |
| 1924 | |
| 1925 | $this->add_control( |
| 1926 | 'nft_item_background_color', |
| 1927 | [ |
| 1928 | 'label' => esc_html__( 'Background Color', 'embedpress' ), |
| 1929 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 1930 | 'selectors' => [ |
| 1931 | '{{WRAPPER}} .ep_nft_content_wrap .ep_nft_item' => 'background-color: {{VALUE}}', |
| 1932 | ], |
| 1933 | ] |
| 1934 | ); |
| 1935 | |
| 1936 | $this->add_control( |
| 1937 | 'collectionname_heading', |
| 1938 | [ |
| 1939 | 'label' => esc_html__( 'Collection Name', 'embedpress' ), |
| 1940 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 1941 | 'separator' => 'before', |
| 1942 | ] |
| 1943 | ); |
| 1944 | |
| 1945 | $this->add_control( |
| 1946 | 'nft_collectionname_color', |
| 1947 | [ |
| 1948 | 'label' => esc_html__( 'Color', 'embedpress' ), |
| 1949 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 1950 | 'selectors' => [ |
| 1951 | '{{WRAPPER}} .ep-nft-single-item-wraper a.CollectionLink--link' => 'color: {{VALUE}}', |
| 1952 | ], |
| 1953 | ] |
| 1954 | ); |
| 1955 | $this->add_control( |
| 1956 | 'nft_collectionname_hover_color', |
| 1957 | [ |
| 1958 | 'label' => esc_html__( 'Hove Color', 'embedpress' ), |
| 1959 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 1960 | 'selectors' => [ |
| 1961 | '{{WRAPPER}} .ep-nft-single-item-wraper a.CollectionLink--link:hover' => 'color: {{VALUE}}', |
| 1962 | ], |
| 1963 | ] |
| 1964 | ); |
| 1965 | $this->add_group_control( |
| 1966 | \Elementor\Group_Control_Typography::get_type(), |
| 1967 | [ |
| 1968 | 'name' => 'nft_collectionname_typography', |
| 1969 | 'selector' => '{{WRAPPER}} .ep-nft-single-item-wraper a.CollectionLink--link', |
| 1970 | ] |
| 1971 | ); |
| 1972 | |
| 1973 | $this->add_control( |
| 1974 | 'title_heading', |
| 1975 | [ |
| 1976 | 'label' => esc_html__( 'Title', 'embedpress' ), |
| 1977 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 1978 | 'separator' => 'before', |
| 1979 | ] |
| 1980 | ); |
| 1981 | |
| 1982 | $this->add_control( |
| 1983 | 'nft_title_color', |
| 1984 | [ |
| 1985 | 'label' => esc_html__( 'Color', 'embedpress' ), |
| 1986 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 1987 | 'selectors' => [ |
| 1988 | '{{WRAPPER}} .ep_nft_title' => 'color: {{VALUE}}', |
| 1989 | ], |
| 1990 | ] |
| 1991 | ); |
| 1992 | $this->add_group_control( |
| 1993 | \Elementor\Group_Control_Typography::get_type(), |
| 1994 | [ |
| 1995 | 'name' => 'nft_title_typography', |
| 1996 | 'selector' => '{{WRAPPER}} .ep_nft_title', |
| 1997 | ] |
| 1998 | ); |
| 1999 | |
| 2000 | |
| 2001 | $this->add_control( |
| 2002 | 'creator_heading', |
| 2003 | [ |
| 2004 | 'label' => esc_html__( 'Creator', 'embedpress' ), |
| 2005 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2006 | 'separator' => 'before', |
| 2007 | ] |
| 2008 | ); |
| 2009 | |
| 2010 | $this->add_control( |
| 2011 | 'nft_creator_color', |
| 2012 | [ |
| 2013 | 'label' => esc_html__( 'Color', 'embedpress' ), |
| 2014 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2015 | 'selectors' => [ |
| 2016 | '{{WRAPPER}} .ep_nft_creator span' => 'color: {{VALUE}}', |
| 2017 | ], |
| 2018 | ] |
| 2019 | ); |
| 2020 | $this->add_group_control( |
| 2021 | \Elementor\Group_Control_Typography::get_type(), |
| 2022 | [ |
| 2023 | 'name' => 'nft_creator_typography', |
| 2024 | 'selector' => '{{WRAPPER}} .ep_nft_creator span', |
| 2025 | ] |
| 2026 | ); |
| 2027 | |
| 2028 | $this->add_control( |
| 2029 | 'nft_created_by_color', |
| 2030 | [ |
| 2031 | 'label' => esc_html__( 'Link Color', 'embedpress' ), |
| 2032 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2033 | 'selectors' => [ |
| 2034 | '{{WRAPPER}} .ep_nft_creator span a' => 'color: {{VALUE}}', |
| 2035 | ], |
| 2036 | ] |
| 2037 | ); |
| 2038 | $this->add_group_control( |
| 2039 | \Elementor\Group_Control_Typography::get_type(), |
| 2040 | [ |
| 2041 | 'label' => esc_html__( 'Link Typography', 'embedpress' ), |
| 2042 | 'name' => 'nft_created_by_typography', |
| 2043 | 'selector' => '{{WRAPPER}} .ep_nft_creator span a', |
| 2044 | ] |
| 2045 | ); |
| 2046 | |
| 2047 | $this->add_control( |
| 2048 | 'price_heading', |
| 2049 | [ |
| 2050 | 'label' => esc_html__( 'Current Price', 'embedpress' ), |
| 2051 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2052 | 'separator' => 'before', |
| 2053 | ] |
| 2054 | ); |
| 2055 | |
| 2056 | $this->add_control( |
| 2057 | 'nft_price_color', |
| 2058 | [ |
| 2059 | 'label' => esc_html__( 'Color', 'embedpress' ), |
| 2060 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2061 | 'selectors' => [ |
| 2062 | '{{WRAPPER}} .ep_current_price span' => 'color: {{VALUE}}', |
| 2063 | ], |
| 2064 | ] |
| 2065 | ); |
| 2066 | |
| 2067 | $this->add_group_control( |
| 2068 | \Elementor\Group_Control_Typography::get_type(), |
| 2069 | [ |
| 2070 | 'name' => 'nft_price_typography', |
| 2071 | 'selector' => '{{WRAPPER}} .ep_current_price span', |
| 2072 | ] |
| 2073 | ); |
| 2074 | $this->add_control( |
| 2075 | 'last_sale_heading', |
| 2076 | [ |
| 2077 | 'label' => esc_html__( 'Last Sale Price', 'embedpress' ), |
| 2078 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2079 | 'separator' => 'before', |
| 2080 | ] |
| 2081 | ); |
| 2082 | |
| 2083 | $this->add_control( |
| 2084 | 'nft_last_sale_color', |
| 2085 | [ |
| 2086 | 'label' => esc_html__( 'Color', 'embedpress' ), |
| 2087 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2088 | 'selectors' => [ |
| 2089 | '{{WRAPPER}} .ep_nft_last_sale span' => 'color: {{VALUE}}', |
| 2090 | ], |
| 2091 | ] |
| 2092 | ); |
| 2093 | $this->add_group_control( |
| 2094 | \Elementor\Group_Control_Typography::get_type(), |
| 2095 | [ |
| 2096 | 'name' => 'nft_last_sale_typography', |
| 2097 | 'selector' => '{{WRAPPER}} .ep_nft_last_sale span', |
| 2098 | ] |
| 2099 | ); |
| 2100 | $this->add_control( |
| 2101 | 'nftbutton_heading', |
| 2102 | [ |
| 2103 | 'label' => esc_html__( 'Button', 'embedpress' ), |
| 2104 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2105 | 'separator' => 'before', |
| 2106 | ] |
| 2107 | ); |
| 2108 | |
| 2109 | |
| 2110 | $this->add_control( |
| 2111 | 'nftbutton_color', |
| 2112 | [ |
| 2113 | 'label' => esc_html__( 'Color', 'embedpress' ), |
| 2114 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2115 | 'selectors' => [ |
| 2116 | '{{WRAPPER}} .ep-nft-gallery-wrapper.ep-nft-gallery-r1a5mbx .ep_nft_button a' => 'color: {{VALUE}}', |
| 2117 | ], |
| 2118 | ] |
| 2119 | ); |
| 2120 | $this->add_control( |
| 2121 | 'nftbutton_bg_color', |
| 2122 | [ |
| 2123 | 'label' => esc_html__( 'Background Color', 'embedpress' ), |
| 2124 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2125 | 'selectors' => [ |
| 2126 | '{{WRAPPER}} .ep-nft-gallery-wrapper.ep-nft-gallery-r1a5mbx .ep_nft_button a' => 'background-color: {{VALUE}}', |
| 2127 | ], |
| 2128 | ] |
| 2129 | ); |
| 2130 | $this->add_group_control( |
| 2131 | \Elementor\Group_Control_Typography::get_type(), |
| 2132 | [ |
| 2133 | 'name' => 'nftbutton_typography', |
| 2134 | 'selector' => '{{WRAPPER}} .ep-nft-gallery-wrapper.ep-nft-gallery-r1a5mbx .ep_nft_button a', |
| 2135 | ] |
| 2136 | ); |
| 2137 | $this->add_control( |
| 2138 | 'nft_loadmore_style', |
| 2139 | [ |
| 2140 | 'label' => esc_html__( 'Load More', 'embedpress' ), |
| 2141 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2142 | 'separator' => 'before', |
| 2143 | 'condition' => [ |
| 2144 | 'loadmore' => 'yes', |
| 2145 | 'embedpress_pro_embeded_nft_type' => 'collection' |
| 2146 | ] |
| 2147 | ] |
| 2148 | ); |
| 2149 | |
| 2150 | $this->add_control( |
| 2151 | 'nft_loadmore_color', |
| 2152 | [ |
| 2153 | 'label' => esc_html__( 'Text Color', 'embedpress' ), |
| 2154 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2155 | 'selectors' => [ |
| 2156 | '{{WRAPPER}} .nft-loadmore' => 'color: {{VALUE}}!important;', |
| 2157 | '{{WRAPPER}} .nft-loadmore svg' => 'fill: {{VALUE}}!important;', |
| 2158 | ], |
| 2159 | 'condition' => [ |
| 2160 | 'loadmore' => 'yes', |
| 2161 | 'embedpress_pro_embeded_nft_type' => 'collection' |
| 2162 | ] |
| 2163 | ] |
| 2164 | ); |
| 2165 | $this->add_group_control( |
| 2166 | \Elementor\Group_Control_Typography::get_type(), |
| 2167 | [ |
| 2168 | 'name' => 'nft_loadmore_typography', |
| 2169 | 'selector' => '{{WRAPPER}} .nft-loadmore, {{WRAPPER}} .nft-loadmore svg', |
| 2170 | 'condition' => [ |
| 2171 | 'loadmore' => 'yes', |
| 2172 | 'embedpress_pro_embeded_nft_type' => 'collection' |
| 2173 | ] |
| 2174 | ] |
| 2175 | ); |
| 2176 | $this->add_control( |
| 2177 | 'nft_loadmore_bgcolor', |
| 2178 | [ |
| 2179 | 'label' => esc_html__( 'Background Color', 'embedpress' ), |
| 2180 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2181 | 'selectors' => [ |
| 2182 | '{{WRAPPER}} .nft-loadmore' => 'background-color: {{VALUE}}!important;', |
| 2183 | ], |
| 2184 | 'condition' => [ |
| 2185 | 'loadmore' => 'yes', |
| 2186 | 'embedpress_pro_embeded_nft_type' => 'collection' |
| 2187 | ] |
| 2188 | ] |
| 2189 | ); |
| 2190 | |
| 2191 | $this->add_control( |
| 2192 | 'nftrank_heading', |
| 2193 | [ |
| 2194 | 'label' => esc_html__( 'Rank', 'embedpress' ), |
| 2195 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2196 | 'separator' => 'before', |
| 2197 | 'condition' => [ |
| 2198 | 'nftrank' => 'yes', |
| 2199 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2200 | ] |
| 2201 | ] |
| 2202 | ); |
| 2203 | |
| 2204 | $this->add_control( |
| 2205 | 'nftrank_label_color', |
| 2206 | [ |
| 2207 | 'label' => esc_html__( 'Label Color', 'embedpress' ), |
| 2208 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2209 | 'selectors' => [ |
| 2210 | '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper' => 'color: {{VALUE}}!important;', |
| 2211 | ], |
| 2212 | 'condition' => [ |
| 2213 | 'nftrank' => 'yes', |
| 2214 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2215 | ] |
| 2216 | ] |
| 2217 | ); |
| 2218 | $this->add_group_control( |
| 2219 | \Elementor\Group_Control_Typography::get_type(), |
| 2220 | [ |
| 2221 | 'name' => 'nftrank_label_typography', |
| 2222 | 'selector' => '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper ', |
| 2223 | 'condition' => [ |
| 2224 | 'nftrank' => 'yes', |
| 2225 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2226 | ] |
| 2227 | ] |
| 2228 | ); |
| 2229 | $this->add_control( |
| 2230 | 'nftrank_color', |
| 2231 | [ |
| 2232 | 'label' => esc_html__( 'Rank Color', 'embedpress' ), |
| 2233 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2234 | 'selectors' => [ |
| 2235 | '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper span.ep-nft-rank' => 'color: {{VALUE}}!important;', |
| 2236 | ], |
| 2237 | 'condition' => [ |
| 2238 | 'nftrank' => 'yes', |
| 2239 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2240 | ] |
| 2241 | ] |
| 2242 | ); |
| 2243 | $this->add_control( |
| 2244 | 'nftrank_border_color', |
| 2245 | [ |
| 2246 | 'label' => esc_html__( 'Border Color', 'embedpress' ), |
| 2247 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2248 | 'selectors' => [ |
| 2249 | '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper span.ep-nft-rank' => 'border-color: {{VALUE}}!important', |
| 2250 | ], |
| 2251 | 'condition' => [ |
| 2252 | 'nftrank' => 'yes', |
| 2253 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2254 | ] |
| 2255 | ] |
| 2256 | ); |
| 2257 | $this->add_group_control( |
| 2258 | \Elementor\Group_Control_Typography::get_type(), |
| 2259 | [ |
| 2260 | 'name' => 'nftrank_typography', |
| 2261 | 'selector' => '{{WRAPPER}} .ep-nft-single-item-wraper .ep-nft-rank-wraper span.ep-nft-rank', |
| 2262 | 'condition' => [ |
| 2263 | 'nftrank' => 'yes', |
| 2264 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2265 | ] |
| 2266 | ] |
| 2267 | ); |
| 2268 | |
| 2269 | |
| 2270 | |
| 2271 | $this->add_control( |
| 2272 | 'nftdetails_heading', |
| 2273 | [ |
| 2274 | 'label' => esc_html__( 'Details', 'embedpress' ), |
| 2275 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 2276 | 'separator' => 'before', |
| 2277 | 'condition' => [ |
| 2278 | 'nftrank' => 'yes', |
| 2279 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2280 | ] |
| 2281 | ] |
| 2282 | ); |
| 2283 | |
| 2284 | $this->add_control( |
| 2285 | 'nftdetail_title_color', |
| 2286 | [ |
| 2287 | 'label' => esc_html__( 'Title Color', 'embedpress' ), |
| 2288 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2289 | 'selectors' => [ |
| 2290 | '{{WRAPPER}} .ep-title' => 'color: {{VALUE}}', |
| 2291 | ], |
| 2292 | 'condition' => [ |
| 2293 | 'nftrank' => 'yes', |
| 2294 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2295 | ] |
| 2296 | ] |
| 2297 | ); |
| 2298 | $this->add_group_control( |
| 2299 | \Elementor\Group_Control_Typography::get_type(), |
| 2300 | [ |
| 2301 | 'label' => esc_html__( 'Title Typography', 'embedpress' ), |
| 2302 | 'name' => 'nftdetail_title_typography', |
| 2303 | 'selector' => '{{WRAPPER}} .ep-title', |
| 2304 | 'condition' => [ |
| 2305 | 'nftrank' => 'yes', |
| 2306 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2307 | ] |
| 2308 | ] |
| 2309 | ); |
| 2310 | |
| 2311 | $this->add_control( |
| 2312 | 'nftdetail_color', |
| 2313 | [ |
| 2314 | 'label' => esc_html__( 'Content Color', 'embedpress' ), |
| 2315 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2316 | 'selectors' => [ |
| 2317 | '{{WRAPPER}} .ep-asset-detail-item' => 'color: {{VALUE}}', |
| 2318 | ], |
| 2319 | 'condition' => [ |
| 2320 | 'nftrank' => 'yes', |
| 2321 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2322 | ] |
| 2323 | ] |
| 2324 | ); |
| 2325 | $this->add_group_control( |
| 2326 | \Elementor\Group_Control_Typography::get_type(), |
| 2327 | [ |
| 2328 | 'label' => esc_html__( 'Content Typography', 'embedpress' ), |
| 2329 | 'name' => 'nftdetail_typography', |
| 2330 | 'selector' => '{{WRAPPER}} .ep-asset-detail-item', |
| 2331 | 'condition' => [ |
| 2332 | 'nftrank' => 'yes', |
| 2333 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2334 | ] |
| 2335 | ] |
| 2336 | ); |
| 2337 | |
| 2338 | $this->add_control( |
| 2339 | 'nftdetail_link_color', |
| 2340 | [ |
| 2341 | 'label' => esc_html__( 'Link Color', 'embedpress' ), |
| 2342 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 2343 | 'selectors' => [ |
| 2344 | '{{WRAPPER}} .ep-asset-detail-item a' => 'color: {{VALUE}}', |
| 2345 | ], |
| 2346 | 'condition' => [ |
| 2347 | 'nftrank' => 'yes', |
| 2348 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2349 | ] |
| 2350 | ] |
| 2351 | ); |
| 2352 | $this->add_group_control( |
| 2353 | \Elementor\Group_Control_Typography::get_type(), |
| 2354 | [ |
| 2355 | 'name' => 'nftdetail_link_typography', |
| 2356 | 'selector' => '{{WRAPPER}} .ep-asset-detail-item a, .ep-asset-detail-item', |
| 2357 | 'condition' => [ |
| 2358 | 'nftrank' => 'yes', |
| 2359 | 'embedpress_pro_embeded_nft_type!' => 'collection' |
| 2360 | ] |
| 2361 | ] |
| 2362 | ); |
| 2363 | |
| 2364 | |
| 2365 | $this->end_controls_section(); |
| 2366 | } |
| 2367 | //End OpenSea controls |
| 2368 | |
| 2369 | |
| 2370 | |
| 2371 | public function init_style_controls() |
| 2372 | { |
| 2373 | $this->start_controls_section( |
| 2374 | 'embedpress_style_section', |
| 2375 | [ |
| 2376 | 'label' => __('General', 'embedpress'), |
| 2377 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2378 | 'conditions' => [ |
| 2379 | 'terms' => [ |
| 2380 | [ |
| 2381 | 'name' => 'embedpress_pro_embeded_source', |
| 2382 | 'operator' => '!==', |
| 2383 | 'value' => 'opensea', |
| 2384 | ], |
| 2385 | ], |
| 2386 | ] |
| 2387 | |
| 2388 | ] |
| 2389 | ); |
| 2390 | $this->add_control( |
| 2391 | 'width', |
| 2392 | [ |
| 2393 | 'label' => __('Width', 'embedpress'), |
| 2394 | 'type' => Controls_Manager::SLIDER, |
| 2395 | 'size_units' => ['px'], |
| 2396 | 'range' => [ |
| 2397 | 'px' => [ |
| 2398 | 'min' => 0, |
| 2399 | 'max' => 1500, |
| 2400 | 'step' => 5, |
| 2401 | ], |
| 2402 | ], |
| 2403 | 'default' => [ |
| 2404 | 'unit' => 'px', |
| 2405 | 'size' => 600, |
| 2406 | ] |
| 2407 | ] |
| 2408 | ); |
| 2409 | $this->add_control( |
| 2410 | 'height', |
| 2411 | [ |
| 2412 | 'label' => __('Height', 'embedpress'), |
| 2413 | 'type' => Controls_Manager::SLIDER, |
| 2414 | 'size_units' => ['px'], |
| 2415 | 'range' => [ |
| 2416 | 'px' => [ |
| 2417 | 'min' => 0, |
| 2418 | 'max' => 1500, |
| 2419 | 'step' => 5, |
| 2420 | ], |
| 2421 | ], |
| 2422 | 'default' => [ |
| 2423 | 'unit' => 'px', |
| 2424 | 'size' => 400, |
| 2425 | ] |
| 2426 | ] |
| 2427 | ); |
| 2428 | $this->add_responsive_control( |
| 2429 | 'margin', |
| 2430 | [ |
| 2431 | 'label' => __('Margin', 'embedpress'), |
| 2432 | 'type' => Controls_Manager::DIMENSIONS, |
| 2433 | 'size_units' => ['px', '%', 'em'], |
| 2434 | 'selectors' => [ |
| 2435 | '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2436 | ], |
| 2437 | ] |
| 2438 | ); |
| 2439 | $this->add_responsive_control( |
| 2440 | 'padding', |
| 2441 | [ |
| 2442 | 'label' => __('Padding', 'embedpress'), |
| 2443 | 'type' => Controls_Manager::DIMENSIONS, |
| 2444 | 'size_units' => ['px', '%', 'em'], |
| 2445 | 'selectors' => [ |
| 2446 | '{{WRAPPER}} .embedpress-elements-wrapper .embedpress-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 2447 | ], |
| 2448 | ] |
| 2449 | ); |
| 2450 | $this->add_responsive_control( |
| 2451 | 'align', |
| 2452 | [ |
| 2453 | 'label' => esc_html__('Alignment', 'embedpress'), |
| 2454 | 'type' => Controls_Manager::CHOOSE, |
| 2455 | 'options' => [ |
| 2456 | 'left' => [ |
| 2457 | 'title' => esc_html__('Left', 'embedpress'), |
| 2458 | 'icon' => 'eicon-text-align-left', |
| 2459 | ], |
| 2460 | 'center' => [ |
| 2461 | 'title' => esc_html__('Center', 'embedpress'), |
| 2462 | 'icon' => 'eicon-text-align-center', |
| 2463 | ], |
| 2464 | 'right' => [ |
| 2465 | 'title' => esc_html__('Right', 'embedpress'), |
| 2466 | 'icon' => 'eicon-text-align-right', |
| 2467 | ], |
| 2468 | ], |
| 2469 | 'prefix_class' => 'elementor%s-align-', |
| 2470 | 'default' => '', |
| 2471 | ] |
| 2472 | ); |
| 2473 | $this->end_controls_section(); |
| 2474 | } |
| 2475 | |
| 2476 | public function render_plain_content() |
| 2477 | { |
| 2478 | $args = ""; |
| 2479 | $settings = $this->get_settings_for_display(); |
| 2480 | |
| 2481 | $_settings = $this->convert_settings($settings); |
| 2482 | foreach ($_settings as $key => $value) { |
| 2483 | $args .= "$key='$value' "; |
| 2484 | } |
| 2485 | |
| 2486 | $args = trim($args); |
| 2487 | echo "[embedpress $args]{$settings['embedpress_embeded_link']}\[/embedpress]"; |
| 2488 | } |
| 2489 | |
| 2490 | protected function convert_settings($settings) |
| 2491 | { |
| 2492 | $_settings = []; |
| 2493 | foreach ($settings as $key => $value) { |
| 2494 | if(empty($value)){ |
| 2495 | $_settings[$key] = 'false'; |
| 2496 | }else if (!empty($value['size'])) { |
| 2497 | $_settings[$key] = $value['size']; |
| 2498 | } else if (!empty($value['url'])) { |
| 2499 | $_settings[$key] = $value['url']; |
| 2500 | } else if (\is_scalar($value)) { |
| 2501 | $_settings[$key] = $value; |
| 2502 | } |
| 2503 | } |
| 2504 | |
| 2505 | return $_settings; |
| 2506 | } |
| 2507 | |
| 2508 | |
| 2509 | |
| 2510 | protected function render() |
| 2511 | { |
| 2512 | |
| 2513 | add_filter('embedpress_should_modify_spotify', '__return_false'); |
| 2514 | $settings = $this->get_settings_for_display(); |
| 2515 | |
| 2516 | $is_editor_view = Plugin::$instance->editor->is_edit_mode(); |
| 2517 | $link = $settings['embedpress_embeded_link']; |
| 2518 | $is_apple_podcast = (strpos($link, 'podcasts.apple.com') !== false); |
| 2519 | |
| 2520 | // conditionaly convert settings data |
| 2521 | $_settings = []; |
| 2522 | $source = isset($settings['embedpress_pro_embeded_source']) ? $settings['embedpress_pro_embeded_source'] : 'default'; |
| 2523 | $embed_link = isset($settings['embedpress_embeded_link']) ? $settings['embedpress_embeded_link'] : ''; |
| 2524 | $pass_hash_key = isset($settings['embedpress_lock_content_password']) ? md5($settings['embedpress_lock_content_password']) : ''; |
| 2525 | |
| 2526 | |
| 2527 | |
| 2528 | Helper::get_source_data(md5($this->get_id()).'_eb_elementor', $embed_link, 'elementor_source_data', 'elementor_temp_source_data'); |
| 2529 | |
| 2530 | if(!(($source === 'default' || !empty($source[0]) && $source[0] === 'default') && strpos($embed_link, 'opensea.io') !== false)){ |
| 2531 | $_settings = $this->convert_settings($settings); |
| 2532 | } |
| 2533 | |
| 2534 | if (strpos($embed_link, 'opensea.io') !== false) { |
| 2535 | $source = 'opensea'; |
| 2536 | } |
| 2537 | |
| 2538 | |
| 2539 | $embed_content = Shortcode::parseContent($settings['embedpress_embeded_link'], true, $_settings); |
| 2540 | $embed_content = $this->onAfterEmbedSpotify($embed_content, $settings); |
| 2541 | $embed = apply_filters('embedpress_elementor_embed', $embed_content, $settings); |
| 2542 | $content = is_object($embed) ? $embed->embed : $embed; |
| 2543 | |
| 2544 | $embed_settings = []; |
| 2545 | $embed_settings['customThumbnail'] = !empty($settings['embedpress_content_share_custom_thumbnail']['url']) ? $settings['embedpress_content_share_custom_thumbnail']['url'] : ''; |
| 2546 | |
| 2547 | $embed_settings['customTitle'] = !empty($settings['embedpress_content_title']) ? $settings['embedpress_content_title'] : Helper::get_file_title($embed_link); |
| 2548 | |
| 2549 | $embed_settings['customDescription'] = !empty($settings['embedpress_content_descripiton']) ? $settings['embedpress_content_descripiton'] : Helper::get_file_title($embed_link); |
| 2550 | |
| 2551 | $embed_settings['sharePosition'] = !empty($settings['embedpress_content_share_position']) ? $settings['embedpress_content_share_position'] : 'right'; |
| 2552 | |
| 2553 | $embed_settings['lockHeading'] = !empty($settings['embedpress_lock_content_heading']) ? $settings['embedpress_lock_content_heading'] : ''; |
| 2554 | |
| 2555 | $embed_settings['lockSubHeading'] = !empty($settings['embedpress_lock_content_sub_heading']) ? $settings['embedpress_lock_content_sub_heading'] : ''; |
| 2556 | |
| 2557 | $embed_settings['passwordPlaceholder'] = !empty($settings['embedpress_password_placeholder']) ? $settings['embedpress_password_placeholder'] : ''; |
| 2558 | |
| 2559 | $embed_settings['submitButtonText'] = !empty($settings['embedpress_submit_button_text']) ? $settings['embedpress_submit_button_text'] : ''; |
| 2560 | |
| 2561 | $embed_settings['submitUnlockingText'] = !empty($settings['embedpress_submit_Unlocking_text']) ? $settings['embedpress_submit_Unlocking_text'] : ''; |
| 2562 | |
| 2563 | $embed_settings['lockErrorMessage'] = !empty($settings['embedpress_lock_content_error_message']) ? $settings['embedpress_lock_content_error_message'] : ''; |
| 2564 | |
| 2565 | $embed_settings['enableFooterMessage'] = !empty($settings['embedpress_enable_footer_message']) ? $settings['embedpress_enable_footer_message'] : ''; |
| 2566 | |
| 2567 | $embed_settings['footerMessage'] = !empty($settings['embedpress_lock_content_footer_message']) ? $settings['embedpress_lock_content_footer_message'] : ''; |
| 2568 | |
| 2569 | |
| 2570 | $client_id = $this->get_id(); |
| 2571 | $hash_pass = hash('sha256', wp_salt(32) . md5($settings['embedpress_lock_content_password'])); |
| 2572 | $password_correct = isset($_COOKIE['password_correct_'.$client_id]) ? $_COOKIE['password_correct_'.$client_id] : ''; |
| 2573 | |
| 2574 | $ispagination = 'flex'; |
| 2575 | |
| 2576 | if ($settings['pagination'] != 'show') { |
| 2577 | $ispagination = 'none'; |
| 2578 | } |
| 2579 | |
| 2580 | if (!empty($settings['columns']) && (int) $settings['columns'] > 0) { |
| 2581 | $calVal = 'calc(' . (100 / (int) $settings['columns']) . '% - ' . $settings['gapbetweenvideos']['size'] . 'px)'; |
| 2582 | } else { |
| 2583 | $calVal = 'auto'; |
| 2584 | } |
| 2585 | |
| 2586 | $content_share_class = ''; |
| 2587 | $share_position_class = ''; |
| 2588 | $share_position = isset($settings['embedpress_content_share_position']) ? $settings['embedpress_content_share_position'] : 'right'; |
| 2589 | |
| 2590 | if(!empty($settings['embedpress_content_share'])) { |
| 2591 | $content_share_class = 'ep-content-share-enabled'; |
| 2592 | $share_position_class = 'ep-share-position-'.$share_position; |
| 2593 | } |
| 2594 | |
| 2595 | $content_protection_class = 'ep-content-protection-enabled'; |
| 2596 | if(empty($settings['embedpress_lock_content']) || empty($settings['embedpress_lock_content_password']) || $hash_pass === $password_correct) { |
| 2597 | $content_protection_class = 'ep-content-protection-disabled'; |
| 2598 | } |
| 2599 | |
| 2600 | ?> |
| 2601 | |
| 2602 | <div class="embedpress-elements-wrapper <?php echo !empty($settings['embedpress_elementor_aspect_ratio']) ? 'embedpress-fit-aspect-ratio' : ''; ?>" id="ep-elements-id-<?php echo $this->get_id(); ?>"> |
| 2603 | <?php |
| 2604 | // handle notice display |
| 2605 | if ($is_editor_view && $is_apple_podcast && !is_embedpress_pro_active()) { |
| 2606 | ?> |
| 2607 | <p><?php esc_html_e('You need EmbedPress Pro to Embed Apple Podcast. Note. This message is only visible to you.', 'embedpress'); ?></p> |
| 2608 | <?php |
| 2609 | } else {?> |
| 2610 | |
| 2611 | <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 ); ?>"> |
| 2612 | <div id="<?php echo esc_attr( $this->get_id() ); ?>" class="ep-embed-content-wraper"> |
| 2613 | <?php |
| 2614 | $content_id = $client_id; |
| 2615 | |
| 2616 | 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 )) ){ |
| 2617 | |
| 2618 | if(!empty($settings['embedpress_content_share'])){ |
| 2619 | $content .=Helper::embed_content_share( $content_id, $embed_settings); |
| 2620 | } |
| 2621 | echo $content; |
| 2622 | } else { |
| 2623 | if(!empty($settings['embedpress_content_share'])){ |
| 2624 | $content .= Helper::embed_content_share( $content_id, $embed_settings); |
| 2625 | } |
| 2626 | Helper::display_password_form($client_id, $content, $pass_hash_key, $embed_settings); |
| 2627 | } |
| 2628 | ?> |
| 2629 | </div> |
| 2630 | </div> |
| 2631 | <?php |
| 2632 | } |
| 2633 | ?> |
| 2634 | </div> |
| 2635 | |
| 2636 | |
| 2637 | <?php if($settings['embedpress_pro_embeded_source'] === 'youtube'): ?> |
| 2638 | <style> |
| 2639 | #ep-elements-id-<?php echo esc_html($this->get_id()); ?> .ep-youtube__content__block .youtube__content__body .content__wrap { |
| 2640 | grid-template-columns: repeat(auto-fit, minmax(<?php echo esc_html($calVal); ?>, 1fr))!important; |
| 2641 | } |
| 2642 | |
| 2643 | #ep-elements-id-<?php echo esc_html($this->get_id()); ?> .ep-youtube__content__pagination { |
| 2644 | display: <?php echo esc_html($ispagination); ?>!important; |
| 2645 | } |
| 2646 | </style> |
| 2647 | <?php endif; ?> |
| 2648 | |
| 2649 | <?php |
| 2650 | } |
| 2651 | public function onAfterEmbedSpotify($embed, $setting) |
| 2652 | { |
| 2653 | if (!isset($embed->provider_name) || strtolower($embed->provider_name) !== 'spotify' || !isset($embed->embed)) { |
| 2654 | return $embed; |
| 2655 | } |
| 2656 | $match = array(); |
| 2657 | preg_match('/src=\"(.+?)\"/', $embed->embed, $match); |
| 2658 | if (empty($match)) { |
| 2659 | return $embed; |
| 2660 | } |
| 2661 | $url_full = $match[1]; |
| 2662 | $modified_url = str_replace('playlist-v2', 'playlist', $url_full); |
| 2663 | if (isset($setting['spotify_theme'])) { |
| 2664 | if (strpos($modified_url, '?') !== false) { |
| 2665 | $modified_url .= '&theme=' . sanitize_text_field($setting['spotify_theme']); |
| 2666 | } else { |
| 2667 | $modified_url .= '?theme=' . sanitize_text_field($setting['spotify_theme']); |
| 2668 | } |
| 2669 | } |
| 2670 | $embed->embed = str_replace($url_full, $modified_url, $embed->embed); |
| 2671 | return $embed; |
| 2672 | } |
| 2673 | } |
| 2674 |