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