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