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