dep
1 month ago
premium-banner.php
3 weeks ago
premium-blog.php
3 weeks ago
premium-button.php
3 weeks ago
premium-carousel.php
3 weeks ago
premium-contactform.php
3 weeks ago
premium-countdown.php
3 weeks ago
premium-counter.php
3 weeks ago
premium-dual-header.php
3 weeks ago
premium-fancytext.php
3 weeks ago
premium-grid.php
3 weeks ago
premium-icon-list.php
3 weeks ago
premium-image-button.php
3 weeks ago
premium-image-scroll.php
3 weeks ago
premium-image-separator.php
3 weeks ago
premium-lottie.php
3 weeks ago
premium-maps.php
3 weeks ago
premium-media-wheel.php
3 weeks ago
premium-mobile-menu.php
3 weeks ago
premium-modalbox.php
3 weeks ago
premium-nav-menu.php
3 weeks ago
premium-notifications.php
3 weeks ago
premium-person.php
3 weeks ago
premium-pinterest-feed.php
3 weeks ago
premium-post-ticker.php
3 weeks ago
premium-pricing-table.php
3 weeks ago
premium-progressbar.php
3 weeks ago
premium-search-form.php
3 weeks ago
premium-svg-drawer.php
3 weeks ago
premium-tcloud.php
3 weeks ago
premium-testimonials.php
3 weeks ago
premium-textual-showcase.php
3 weeks ago
premium-tiktok-feed.php
3 weeks ago
premium-title.php
3 weeks ago
premium-videobox.php
3 weeks ago
premium-vscroll.php
3 weeks ago
premium-weather.php
3 weeks ago
premium-world-clock.php
3 weeks ago
premium-videobox.php
3801 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Premium Video Box. |
| 4 | */ |
| 5 | |
| 6 | namespace PremiumAddons\Widgets; |
| 7 | |
| 8 | // Elementor Classes. |
| 9 | use Elementor\Modules\DynamicTags\Module as TagsModule; |
| 10 | use Elementor\Widget_Base; |
| 11 | use Elementor\Utils; |
| 12 | use Elementor\Embed; |
| 13 | use Elementor\Icons_Manager; |
| 14 | use Elementor\Controls_Manager; |
| 15 | use Elementor\Core\Kits\Documents\Tabs\Global_Colors; |
| 16 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 17 | use Elementor\Group_Control_Border; |
| 18 | use Elementor\Group_Control_Typography; |
| 19 | use Elementor\Group_Control_Text_Shadow; |
| 20 | use Elementor\Group_Control_Box_Shadow; |
| 21 | |
| 22 | // PremiumAddons Classes. |
| 23 | use PremiumAddons\Admin\Includes\Admin_Helper; |
| 24 | use PremiumAddons\Includes\Helper_Functions; |
| 25 | use PremiumAddons\Includes\Controls\Premium_Background; |
| 26 | |
| 27 | if ( ! defined( 'ABSPATH' ) ) { |
| 28 | exit; // If this file is called directly, abort. |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Class Premium_Videobox |
| 33 | */ |
| 34 | class Premium_Videobox extends Widget_Base { |
| 35 | |
| 36 | /** |
| 37 | * Retrieve Widget Name. |
| 38 | * |
| 39 | * @since 1.0.0 |
| 40 | * @access public |
| 41 | */ |
| 42 | public function get_name() { |
| 43 | return 'premium-addon-video-box'; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Retrieve Widget Title. |
| 48 | * |
| 49 | * @since 1.0.0 |
| 50 | * @access public |
| 51 | */ |
| 52 | public function get_title() { |
| 53 | return __( 'Video Box', 'premium-addons-for-elementor' ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Retrieve Widget Icon. |
| 58 | * |
| 59 | * @since 1.0.0 |
| 60 | * @access public |
| 61 | * |
| 62 | * @return string widget icon. |
| 63 | */ |
| 64 | public function get_icon() { |
| 65 | return 'pa-video-box'; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Retrieve Widget Categories. |
| 70 | * |
| 71 | * @since 1.5.1 |
| 72 | * @access public |
| 73 | * |
| 74 | * @return array Widget categories. |
| 75 | */ |
| 76 | public function get_categories() { |
| 77 | return array( 'premium-elements' ); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Retrieve Widget Dependent CSS. |
| 82 | * |
| 83 | * @since 1.0.0 |
| 84 | * @access public |
| 85 | * |
| 86 | * @return array CSS style handles. |
| 87 | */ |
| 88 | public function get_style_depends() { |
| 89 | return array( |
| 90 | 'pa-prettyphoto', |
| 91 | 'font-awesome-5-all', |
| 92 | 'premium-addons', |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Retrieve Widget Dependent JS. |
| 98 | * |
| 99 | * @since 1.0.0 |
| 100 | * @access public |
| 101 | * |
| 102 | * @return array JS script handles. |
| 103 | */ |
| 104 | public function get_script_depends() { |
| 105 | return array( |
| 106 | 'pa-scrolldir', |
| 107 | 'prettyPhoto-js', |
| 108 | 'jquery-ui-draggable', |
| 109 | 'premium-addons', |
| 110 | ); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Retrieve Widget Keywords. |
| 115 | * |
| 116 | * @since 1.0.0 |
| 117 | * @access public |
| 118 | * |
| 119 | * @return string Widget keywords. |
| 120 | */ |
| 121 | public function get_keywords() { |
| 122 | return array( 'pa', 'premium', 'premium video box', 'youtube', 'vimeo', 'self', 'hosted', 'media', 'list', 'embed', 'dailymotion' ); |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Retrieve Widget Support URL. |
| 127 | * |
| 128 | * @access public |
| 129 | * |
| 130 | * @return string support URL. |
| 131 | */ |
| 132 | public function get_custom_help_url() { |
| 133 | return 'https://premiumaddons.com/support/'; |
| 134 | } |
| 135 | |
| 136 | public function has_widget_inner_wrapper(): bool { |
| 137 | return true; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Register Video Box controls. |
| 142 | * |
| 143 | * @since 1.0.0 |
| 144 | * @access protected |
| 145 | */ |
| 146 | protected function register_controls() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore |
| 147 | |
| 148 | $this->start_controls_section( |
| 149 | 'premium_video_box_general_settings', |
| 150 | array( |
| 151 | 'label' => __( 'Video Box', 'premium-addons-for-elementor' ), |
| 152 | ) |
| 153 | ); |
| 154 | |
| 155 | $demo = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/elementor-video-box-widget/', 'video-box', 'wp-editor', 'demo' ); |
| 156 | Helper_Functions::add_templates_controls( $this, 'video-box', $demo ); |
| 157 | |
| 158 | $this->add_control( |
| 159 | 'premium_video_box_video_type', |
| 160 | array( |
| 161 | 'label' => __( 'Video Type', 'premium-addons-for-elementor' ), |
| 162 | 'type' => Controls_Manager::SELECT, |
| 163 | 'default' => 'youtube', |
| 164 | 'options' => array( |
| 165 | 'youtube' => __( 'Youtube', 'premium-addons-for-elementor' ), |
| 166 | 'vimeo' => __( 'Vimeo', 'premium-addons-for-elementor' ), |
| 167 | 'dailymotion' => __( 'Dailymotion', 'premium-addons-for-elementor' ), |
| 168 | 'self' => __( 'Self Hosted', 'premium-addons-for-elementor' ), |
| 169 | ), |
| 170 | 'frontend_available' => true, |
| 171 | ) |
| 172 | ); |
| 173 | |
| 174 | $this->add_control( |
| 175 | 'premium_video_box_video_id_embed_selection', |
| 176 | array( |
| 177 | 'label' => __( 'Link', 'premium-addons-for-elementor' ), |
| 178 | 'type' => Controls_Manager::HIDDEN, |
| 179 | 'default' => 'id', |
| 180 | 'options' => array( |
| 181 | 'id' => __( 'ID', 'premium-addons-for-elementor' ), |
| 182 | 'embed' => __( 'Embed URL', 'premium-addons-for-elementor' ), |
| 183 | ), |
| 184 | 'condition' => array( |
| 185 | 'premium_video_box_video_type!' => 'self', |
| 186 | ), |
| 187 | ) |
| 188 | ); |
| 189 | |
| 190 | $this->add_control( |
| 191 | 'premium_video_box_video_id', |
| 192 | array( |
| 193 | 'label' => __( 'Video ID', 'premium-addons-for-elementor' ), |
| 194 | 'description' => __( 'Enter the numbers and letters after the equal sign which located in your YouTube video link or after the slash sign in your Vimeo video link. For example, z1hQgVpfTKU', 'premium-addons-for-elementor' ), |
| 195 | 'type' => Controls_Manager::HIDDEN, |
| 196 | 'condition' => array( |
| 197 | 'premium_video_box_video_type!' => 'self', |
| 198 | 'premium_video_box_video_id_embed_selection' => 'id', |
| 199 | ), |
| 200 | ) |
| 201 | ); |
| 202 | |
| 203 | $this->add_control( |
| 204 | 'premium_video_box_video_embed', |
| 205 | array( |
| 206 | 'label' => __( 'Embed URL', 'premium-addons-for-elementor' ), |
| 207 | 'description' => __( 'Enter your YouTube/Vimeo video link. For example, https://www.youtube.com/watch?v=eRnPSnx8nPY', 'premium-addons-for-elementor' ), |
| 208 | 'type' => Controls_Manager::HIDDEN, |
| 209 | 'condition' => array( |
| 210 | 'premium_video_box_video_type!' => 'self', |
| 211 | 'premium_video_box_video_id_embed_selection' => 'embed', |
| 212 | ), |
| 213 | ) |
| 214 | ); |
| 215 | |
| 216 | $this->add_control( |
| 217 | 'youtube_list', |
| 218 | array( |
| 219 | 'label' => __( 'Get Videos From Channel/Playlist', 'premium-addons-for-elementor' ), |
| 220 | 'type' => Controls_Manager::SWITCHER, |
| 221 | 'condition' => array( |
| 222 | 'premium_video_box_video_type' => 'youtube', |
| 223 | ), |
| 224 | ) |
| 225 | ); |
| 226 | |
| 227 | $this->add_responsive_control( |
| 228 | 'source', |
| 229 | array( |
| 230 | 'label' => __( 'Source', 'premium-addons-for-elementor' ), |
| 231 | 'type' => Controls_Manager::SELECT, |
| 232 | 'options' => array( |
| 233 | 'playlist' => __( 'Playlist', 'premium-addons-for-elementor' ), |
| 234 | 'channel' => __( 'Channel', 'premium-addons-for-elementor' ), |
| 235 | ), |
| 236 | 'default' => 'playlist', |
| 237 | 'condition' => array( |
| 238 | 'premium_video_box_video_type' => 'youtube', |
| 239 | 'youtube_list' => 'yes', |
| 240 | ), |
| 241 | ) |
| 242 | ); |
| 243 | |
| 244 | $this->add_control( |
| 245 | 'playlist_id', |
| 246 | array( |
| 247 | 'label' => __( 'Playlist ID', 'premium-addons-for-elementor' ), |
| 248 | 'type' => Controls_Manager::TEXT, |
| 249 | 'default' => 'PLLpZVOYpMtTArB4hrlpSnDJB36D2sdoTv', |
| 250 | 'label_block' => true, |
| 251 | 'dynamic' => array( 'active' => true ), |
| 252 | 'description' => 'Click <a href="https://premiumaddons.com/docs/how-to-find-youtube-channel-playlist-id/" target="_blank">here</a> to get your playlist ID', |
| 253 | 'condition' => array( |
| 254 | 'premium_video_box_video_type' => 'youtube', |
| 255 | 'youtube_list' => 'yes', |
| 256 | 'source' => 'playlist', |
| 257 | ), |
| 258 | 'ai' => array( |
| 259 | 'active' => false, |
| 260 | ), |
| 261 | ) |
| 262 | ); |
| 263 | |
| 264 | $this->add_control( |
| 265 | 'channel_id', |
| 266 | array( |
| 267 | 'label' => __( 'Channel ID', 'premium-addons-for-elementor' ), |
| 268 | 'type' => Controls_Manager::TEXT, |
| 269 | 'default' => 'UCXcJ9BeO2sKKHor7Q9VglTQ', |
| 270 | 'label_block' => true, |
| 271 | 'dynamic' => array( 'active' => true ), |
| 272 | 'description' => 'Click <a href="https://premiumaddons.com/docs/how-to-find-youtube-channel-playlist-id/" target="_blank">here</a> to get your channel ID', |
| 273 | 'condition' => array( |
| 274 | 'premium_video_box_video_type' => 'youtube', |
| 275 | 'youtube_list' => 'yes', |
| 276 | 'source' => 'channel', |
| 277 | ), |
| 278 | 'ai' => array( |
| 279 | 'active' => false, |
| 280 | ), |
| 281 | ) |
| 282 | ); |
| 283 | |
| 284 | $this->add_control( |
| 285 | 'reload', |
| 286 | array( |
| 287 | 'label' => __( 'Reload Video Once Every', 'premium-addons-for-elementor' ), |
| 288 | 'type' => Controls_Manager::SELECT, |
| 289 | 'options' => array( |
| 290 | 'hour' => __( 'Hour', 'premium-addons-for-elementor' ), |
| 291 | 'day' => __( 'Day', 'premium-addons-for-elementor' ), |
| 292 | 'week' => __( 'Week', 'premium-addons-for-elementor' ), |
| 293 | 'month' => __( 'Month', 'premium-addons-for-elementor' ), |
| 294 | 'year' => __( 'Year', 'premium-addons-for-elementor' ), |
| 295 | ), |
| 296 | 'default' => 'day', |
| 297 | 'condition' => array( |
| 298 | 'premium_video_box_video_type' => 'youtube', |
| 299 | 'youtube_list' => 'yes', |
| 300 | ), |
| 301 | ) |
| 302 | ); |
| 303 | |
| 304 | $this->add_control( |
| 305 | 'youtube_videos_title', |
| 306 | array( |
| 307 | 'label' => __( 'Show Video Title', 'premium-addons-for-elementor' ), |
| 308 | 'type' => Controls_Manager::SWITCHER, |
| 309 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 310 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 311 | 'condition' => array( |
| 312 | 'youtube_list' => 'yes', |
| 313 | 'premium_video_box_video_type' => 'youtube', |
| 314 | ), |
| 315 | ) |
| 316 | ); |
| 317 | |
| 318 | $this->add_control( |
| 319 | 'youtube_videos_title_link', |
| 320 | array( |
| 321 | 'label' => __( 'Link Title To Videos', 'premium-addons-for-elementor' ), |
| 322 | 'type' => Controls_Manager::SWITCHER, |
| 323 | 'condition' => array( |
| 324 | 'youtube_list' => 'yes', |
| 325 | 'youtube_videos_title' => 'yes', |
| 326 | 'premium_video_box_video_type' => 'youtube', |
| 327 | ), |
| 328 | ) |
| 329 | ); |
| 330 | |
| 331 | $this->add_control( |
| 332 | 'youtube_videos_title_tag', |
| 333 | array( |
| 334 | 'label' => __( 'Title HTML Tag', 'premium-addons-for-elementor' ), |
| 335 | 'type' => Controls_Manager::SELECT, |
| 336 | 'options' => array( |
| 337 | 'h1' => 'H1', |
| 338 | 'h2' => 'H2', |
| 339 | 'h3' => 'H3', |
| 340 | 'h4' => 'H4', |
| 341 | 'h5' => 'H5', |
| 342 | 'h6' => 'H6', |
| 343 | 'span' => 'span', |
| 344 | 'p' => 'p', |
| 345 | ), |
| 346 | 'default' => 'h4', |
| 347 | 'label_block' => true, |
| 348 | 'condition' => array( |
| 349 | 'youtube_list' => 'yes', |
| 350 | 'youtube_videos_title' => 'yes', |
| 351 | 'premium_video_box_video_type' => 'youtube', |
| 352 | ), |
| 353 | ) |
| 354 | ); |
| 355 | |
| 356 | $this->add_control( |
| 357 | 'youtube_videos_title_pos', |
| 358 | array( |
| 359 | 'label' => __( 'Title Position', 'premium-addons-for-elementor' ), |
| 360 | 'type' => Controls_Manager::SELECT, |
| 361 | 'default' => 'column', |
| 362 | 'options' => array( |
| 363 | 'column-reverse' => __( 'Top', 'premium-addons-for-elementor' ), |
| 364 | 'column' => __( 'Bottom', 'premium-addons-for-elementor' ), |
| 365 | ), |
| 366 | 'condition' => array( |
| 367 | 'youtube_list' => 'yes', |
| 368 | 'youtube_videos_title' => 'yes', |
| 369 | 'premium_video_box_video_type' => 'youtube', |
| 370 | ), |
| 371 | 'selectors' => array( |
| 372 | '{{WRAPPER}} .premium-video-box-container' => 'flex-direction: {{VALUE}}', |
| 373 | ), |
| 374 | ) |
| 375 | ); |
| 376 | |
| 377 | $this->add_control( |
| 378 | 'premium_video_box_link', |
| 379 | array( |
| 380 | 'label' => __( 'Link', 'premium-addons-for-elementor' ), |
| 381 | 'type' => Controls_Manager::TEXT, |
| 382 | 'label_block' => true, |
| 383 | 'default' => 'https://www.youtube.com/watch?v=ydv343MTf4w', |
| 384 | 'dynamic' => array( |
| 385 | 'active' => true, |
| 386 | 'categories' => array( |
| 387 | TagsModule::POST_META_CATEGORY, |
| 388 | TagsModule::URL_CATEGORY, |
| 389 | ), |
| 390 | ), |
| 391 | 'conditions' => array( |
| 392 | 'relation' => 'or', |
| 393 | 'terms' => array( |
| 394 | array( |
| 395 | 'name' => 'premium_video_box_video_type', |
| 396 | 'value' => 'vimeo', |
| 397 | ), |
| 398 | array( |
| 399 | 'name' => 'premium_video_box_video_type', |
| 400 | 'value' => 'dailymotion', |
| 401 | ), |
| 402 | array( |
| 403 | 'relation' => 'and', |
| 404 | 'terms' => array( |
| 405 | array( |
| 406 | 'name' => 'premium_video_box_video_type', |
| 407 | 'value' => 'youtube', |
| 408 | ), |
| 409 | array( |
| 410 | 'name' => 'youtube_list', |
| 411 | 'value' => '', |
| 412 | ), |
| 413 | ), |
| 414 | ), |
| 415 | ), |
| 416 | ), |
| 417 | 'ai' => array( |
| 418 | 'active' => false, |
| 419 | ), |
| 420 | ) |
| 421 | ); |
| 422 | |
| 423 | $this->add_responsive_control( |
| 424 | 'playlist_layout', |
| 425 | array( |
| 426 | 'label' => __( 'Layout', 'premium-addons-for-elementor' ), |
| 427 | 'type' => Controls_Manager::SELECT, |
| 428 | 'options' => array( |
| 429 | 'layout1' => __( 'Layout 1', 'premium-addons-for-elementor' ), |
| 430 | 'layout2' => __( 'Layout 2', 'premium-addons-for-elementor' ), |
| 431 | ), |
| 432 | 'prefix_class' => 'premium-videobox-', |
| 433 | 'default' => 'layout1', |
| 434 | 'render_type' => 'template', |
| 435 | 'condition' => array( |
| 436 | 'premium_video_box_video_type' => 'youtube', |
| 437 | 'youtube_list' => 'yes', |
| 438 | ), |
| 439 | ) |
| 440 | ); |
| 441 | |
| 442 | $this->add_responsive_control( |
| 443 | 'first_column_width', |
| 444 | array( |
| 445 | 'label' => __( 'First Column Width', 'premium-addons-for-elementor' ), |
| 446 | 'type' => Controls_Manager::SLIDER, |
| 447 | 'render_type' => 'template', |
| 448 | 'size_units' => array( '%' ), |
| 449 | 'default' => array( |
| 450 | 'size' => 60, |
| 451 | 'unit' => '%', |
| 452 | ), |
| 453 | 'range' => array( |
| 454 | '%' => array( |
| 455 | 'min' => 0, |
| 456 | 'max' => 100, |
| 457 | ), |
| 458 | ), |
| 459 | 'condition' => array( |
| 460 | 'youtube_list' => 'yes', |
| 461 | 'premium_video_box_video_type' => 'youtube', |
| 462 | 'playlist_layout' => 'layout2', |
| 463 | ), |
| 464 | 'selectors' => array( |
| 465 | '{{WRAPPER}} .premium-videobox-column:first-child' => 'width: {{SIZE}}%;', |
| 466 | '{{WRAPPER}} .premium-videobox-column:nth-child(2)' => '--pa-first-column-width: {{SIZE}}%;', |
| 467 | ), |
| 468 | |
| 469 | ) |
| 470 | ); |
| 471 | |
| 472 | $this->add_responsive_control( |
| 473 | 'premium_video_box_video_height', |
| 474 | array( |
| 475 | 'label' => __( 'Video Height (%)', 'premium-addons-for-elementor' ), |
| 476 | 'type' => Controls_Manager::SLIDER, |
| 477 | 'render_type' => 'template', |
| 478 | 'size_units' => array( '%' ), |
| 479 | 'default' => array( |
| 480 | 'size' => 32, |
| 481 | 'unit' => '%', |
| 482 | ), |
| 483 | 'range' => array( |
| 484 | '%' => array( |
| 485 | 'min' => 0, |
| 486 | 'max' => 100, |
| 487 | ), |
| 488 | ), |
| 489 | 'condition' => array( |
| 490 | 'youtube_list' => 'yes', |
| 491 | 'premium_video_box_video_type' => 'youtube', |
| 492 | 'playlist_layout' => 'layout1', |
| 493 | ), |
| 494 | 'selectors' => array( |
| 495 | '{{WRAPPER}} .premium-video-box-container > div' => 'padding-bottom: {{SIZE}}%;', |
| 496 | ), |
| 497 | |
| 498 | ) |
| 499 | ); |
| 500 | |
| 501 | $this->add_responsive_control( |
| 502 | 'video_columns', |
| 503 | array( |
| 504 | 'label' => __( 'Videos/Row', 'premium-addons-for-elementor' ), |
| 505 | 'type' => Controls_Manager::SELECT, |
| 506 | 'options' => array( |
| 507 | '100%' => __( '1 Column', 'premium-addons-for-elementor' ), |
| 508 | '50%' => __( '2 Columns', 'premium-addons-for-elementor' ), |
| 509 | '33.33%' => __( '3 Columns', 'premium-addons-for-elementor' ), |
| 510 | '25%' => __( '4 Columns', 'premium-addons-for-elementor' ), |
| 511 | '20%' => __( '5 Columns', 'premium-addons-for-elementor' ), |
| 512 | '16.667%' => __( '6 Columns', 'premium-addons-for-elementor' ), |
| 513 | ), |
| 514 | 'desktop_default' => '50%', |
| 515 | 'tablet_default' => '50%', |
| 516 | 'mobile_default' => '100%', |
| 517 | 'render_type' => 'template', |
| 518 | 'separator' => 'before', |
| 519 | 'selectors' => array( |
| 520 | '{{WRAPPER}}.premium-videobox-layout1 .premium-video-box-container' => 'width: {{VALUE}}', |
| 521 | '{{WRAPPER}} .premium-videobox-column:nth-child(2) .premium-video-box-container' => 'width: {{VALUE}}', |
| 522 | ), |
| 523 | 'condition' => array( |
| 524 | 'premium_video_box_video_type' => 'youtube', |
| 525 | 'youtube_list' => 'yes', |
| 526 | ), |
| 527 | ) |
| 528 | ); |
| 529 | |
| 530 | $this->add_control( |
| 531 | 'limit_num', |
| 532 | array( |
| 533 | 'label' => __( 'Number of Videos', 'premium-addons-for-elementor' ), |
| 534 | 'type' => Controls_Manager::NUMBER, |
| 535 | 'min' => 0, |
| 536 | 'default' => 6, |
| 537 | 'description' => __( 'Set a number of videos to show', 'premium-addons-for-elementor' ), |
| 538 | 'condition' => array( |
| 539 | 'premium_video_box_video_type' => 'youtube', |
| 540 | 'youtube_list' => 'yes', |
| 541 | ), |
| 542 | ) |
| 543 | ); |
| 544 | |
| 545 | $this->add_control( |
| 546 | 'featured_video', |
| 547 | array( |
| 548 | 'label' => __( 'Feature The First Video', 'premium-addons-for-elementor' ), |
| 549 | 'type' => Controls_Manager::SWITCHER, |
| 550 | 'condition' => array( |
| 551 | 'premium_video_box_video_type' => 'youtube', |
| 552 | 'youtube_list' => 'yes', |
| 553 | 'playlist_layout' => 'layout1', |
| 554 | ), |
| 555 | 'selectors' => array( |
| 556 | '{{WRAPPER}} .premium-video-box-container:first-of-type' => 'width: 100%', |
| 557 | ), |
| 558 | ) |
| 559 | ); |
| 560 | |
| 561 | $this->add_control( |
| 562 | 'premium_video_box_self_hosted', |
| 563 | array( |
| 564 | 'label' => __( 'URL', 'premium-addons-for-elementor' ), |
| 565 | 'type' => Controls_Manager::MEDIA, |
| 566 | 'dynamic' => array( |
| 567 | 'active' => true, |
| 568 | 'categories' => array( |
| 569 | TagsModule::MEDIA_CATEGORY, |
| 570 | ), |
| 571 | ), |
| 572 | 'media_type' => 'video', |
| 573 | 'condition' => array( |
| 574 | 'premium_video_box_video_type' => 'self', |
| 575 | ), |
| 576 | ) |
| 577 | ); |
| 578 | |
| 579 | $this->add_control( |
| 580 | 'premium_video_box_self_hosted_remote', |
| 581 | array( |
| 582 | 'label' => __( 'Remote Video URL', 'premium-addons-for-elementor' ), |
| 583 | 'type' => Controls_Manager::TEXT, |
| 584 | 'dynamic' => array( |
| 585 | 'active' => true, |
| 586 | ), |
| 587 | 'label_block' => true, |
| 588 | 'condition' => array( |
| 589 | 'premium_video_box_video_type' => 'self', |
| 590 | ), |
| 591 | 'ai' => array( |
| 592 | 'active' => false, |
| 593 | ), |
| 594 | ) |
| 595 | ); |
| 596 | |
| 597 | $playlist_condition = array( |
| 598 | 'relation' => 'or', |
| 599 | 'terms' => array( |
| 600 | array( |
| 601 | 'name' => 'premium_video_box_video_type', |
| 602 | 'operator' => '!==', |
| 603 | 'value' => 'youtube', |
| 604 | ), |
| 605 | array( |
| 606 | 'name' => 'youtube_list', |
| 607 | 'value' => '', |
| 608 | ), |
| 609 | ), |
| 610 | ); |
| 611 | |
| 612 | $this->add_control( |
| 613 | 'premium_video_box_controls', |
| 614 | array( |
| 615 | 'label' => __( 'Player Controls', 'premium-addons-for-elementor' ), |
| 616 | 'type' => Controls_Manager::SWITCHER, |
| 617 | 'description' => __( 'Show/hide player controls', 'premium-addons-for-elementor' ), |
| 618 | 'default' => 'yes', |
| 619 | 'conditions' => array( |
| 620 | 'terms' => array( |
| 621 | $playlist_condition, |
| 622 | ), |
| 623 | ), |
| 624 | ) |
| 625 | ); |
| 626 | |
| 627 | $this->add_control( |
| 628 | 'premium_video_box_mute', |
| 629 | array( |
| 630 | 'label' => __( 'Mute', 'premium-addons-for-elementor' ), |
| 631 | 'type' => Controls_Manager::SWITCHER, |
| 632 | 'description' => __( 'This will play the video muted', 'premium-addons-for-elementor' ), |
| 633 | ) |
| 634 | ); |
| 635 | |
| 636 | $this->add_control( |
| 637 | 'play_inline', |
| 638 | array( |
| 639 | 'label' => __( 'Play Inline', 'premium-addons-for-elementor' ), |
| 640 | 'type' => Controls_Manager::SWITCHER, |
| 641 | 'description' => __( 'Enable this option to play the video in its position, not in popup on touch devices.', 'premium-addons-for-elementor' ), |
| 642 | ) |
| 643 | ); |
| 644 | |
| 645 | $this->add_control( |
| 646 | 'cc_load_policy', |
| 647 | array( |
| 648 | 'label' => esc_html__( 'Captions', 'premium-addons-for-elementor' ), |
| 649 | 'type' => Controls_Manager::SWITCHER, |
| 650 | 'condition' => array( |
| 651 | 'video_type' => array( 'youtube' ), |
| 652 | 'controls' => 'yes', |
| 653 | ), |
| 654 | 'condition' => array( |
| 655 | 'premium_video_box_controls' => 'yes', |
| 656 | 'premium_video_box_video_type' => 'youtube', |
| 657 | ), |
| 658 | ) |
| 659 | ); |
| 660 | |
| 661 | $this->add_control( |
| 662 | 'privacy_mode', |
| 663 | array( |
| 664 | 'label' => __( 'Privacy Mode', 'premium-addons-for-elementor' ), |
| 665 | 'type' => Controls_Manager::SWITCHER, |
| 666 | 'description' => __( 'When turned on, YouTube won\'t store information about visitors on your website unless they play the video.', 'premium-addons-for-elementor' ), |
| 667 | 'condition' => array( |
| 668 | 'premium_video_box_video_type' => 'youtube', |
| 669 | ), |
| 670 | ) |
| 671 | ); |
| 672 | |
| 673 | $this->add_control( |
| 674 | 'premium_video_box_self_autoplay', |
| 675 | array( |
| 676 | 'label' => __( 'Autoplay', 'premium-addons-for-elementor' ), |
| 677 | 'type' => Controls_Manager::SWITCHER, |
| 678 | 'conditions' => array( |
| 679 | 'terms' => array( |
| 680 | $playlist_condition, |
| 681 | |
| 682 | ), |
| 683 | ), |
| 684 | ) |
| 685 | ); |
| 686 | |
| 687 | $this->add_control( |
| 688 | 'autoplay_viewport', |
| 689 | array( |
| 690 | 'label' => __( 'Autoplay On Viewport', 'premium-addons-for-elementor' ), |
| 691 | 'type' => Controls_Manager::SWITCHER, |
| 692 | 'conditions' => array( |
| 693 | 'terms' => array( |
| 694 | array( |
| 695 | 'name' => 'premium_video_box_self_autoplay', |
| 696 | 'value' => 'yes', |
| 697 | ), |
| 698 | $playlist_condition, |
| 699 | ), |
| 700 | ), |
| 701 | ) |
| 702 | ); |
| 703 | |
| 704 | $this->add_control( |
| 705 | 'autoplay_reset', |
| 706 | array( |
| 707 | 'label' => __( 'Restart Video on Scroll Up', 'premium-addons-for-elementor' ), |
| 708 | 'type' => Controls_Manager::SWITCHER, |
| 709 | 'conditions' => array( |
| 710 | 'terms' => array( |
| 711 | array( |
| 712 | 'name' => 'premium_video_box_video_type', |
| 713 | 'value' => 'self', |
| 714 | ), |
| 715 | array( |
| 716 | 'name' => 'premium_video_box_self_autoplay', |
| 717 | 'value' => 'yes', |
| 718 | ), |
| 719 | array( |
| 720 | 'name' => 'autoplay_viewport', |
| 721 | 'value' => 'yes', |
| 722 | ), |
| 723 | $playlist_condition, |
| 724 | ), |
| 725 | ), |
| 726 | ) |
| 727 | ); |
| 728 | |
| 729 | $this->add_control( |
| 730 | 'autoplay_notice', |
| 731 | array( |
| 732 | 'raw' => __( 'Please note that autoplay option works only when Overlay option is disabled', 'premium-addons-for-elementor' ), |
| 733 | 'type' => Controls_Manager::RAW_HTML, |
| 734 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 735 | 'conditions' => array( |
| 736 | 'terms' => array( |
| 737 | array( |
| 738 | 'name' => 'premium_video_box_self_autoplay', |
| 739 | 'value' => 'yes', |
| 740 | ), |
| 741 | $playlist_condition, |
| 742 | ), |
| 743 | ), |
| 744 | ) |
| 745 | ); |
| 746 | |
| 747 | $this->add_control( |
| 748 | 'premium_video_box_loop', |
| 749 | array( |
| 750 | 'label' => __( 'Loop', 'premium-addons-for-elementor' ), |
| 751 | 'type' => Controls_Manager::SWITCHER, |
| 752 | 'condition' => array( |
| 753 | 'youtube_list!' => 'yes', |
| 754 | ), |
| 755 | ) |
| 756 | ); |
| 757 | |
| 758 | $this->add_control( |
| 759 | 'download_button', |
| 760 | array( |
| 761 | 'label' => __( 'Download Button', 'premium-addons-for-elementor' ), |
| 762 | 'type' => Controls_Manager::SWITCHER, |
| 763 | 'condition' => array( |
| 764 | 'premium_video_box_video_type' => 'self', |
| 765 | ), |
| 766 | ) |
| 767 | ); |
| 768 | |
| 769 | $this->add_control( |
| 770 | 'premium_video_box_sticky_switcher', |
| 771 | array( |
| 772 | 'label' => __( 'Sticky', 'premium-addons-for-elementor' ), |
| 773 | 'type' => Controls_Manager::SWITCHER, |
| 774 | 'render_type' => 'template', |
| 775 | 'separator' => 'before', |
| 776 | 'conditions' => array( |
| 777 | 'terms' => array( |
| 778 | $playlist_condition, |
| 779 | ), |
| 780 | ), |
| 781 | ) |
| 782 | ); |
| 783 | |
| 784 | $sticky_condition = array( |
| 785 | 'terms' => array( |
| 786 | array( |
| 787 | 'name' => 'premium_video_box_sticky_switcher', |
| 788 | 'value' => 'yes', |
| 789 | ), |
| 790 | $playlist_condition, |
| 791 | ), |
| 792 | ); |
| 793 | |
| 794 | $this->add_control( |
| 795 | 'premium_video_box_sticky_on_play', |
| 796 | array( |
| 797 | 'label' => __( 'Sticky Only After Played', 'premium-addons-for-elementor' ), |
| 798 | 'type' => Controls_Manager::SWITCHER, |
| 799 | 'render_type' => 'template', |
| 800 | 'conditions' => array( |
| 801 | 'terms' => array( |
| 802 | $sticky_condition, |
| 803 | ), |
| 804 | ), |
| 805 | ) |
| 806 | ); |
| 807 | |
| 808 | $left_direction = is_rtl() ? 'right' : 'left'; |
| 809 | |
| 810 | $right_direction = is_rtl() ? 'left' : 'right'; |
| 811 | |
| 812 | $this->add_control( |
| 813 | 'premium_video_box_sticky_position', |
| 814 | array( |
| 815 | 'label' => __( 'Position', 'premium-addons-for-elementor' ), |
| 816 | 'type' => Controls_Manager::SELECT, |
| 817 | 'options' => array( |
| 818 | 'top-left' => sprintf( __( 'Top %s', 'premium-addons-for-elementor' ), ucfirst( $left_direction ) ), |
| 819 | 'top-right' => sprintf( __( 'Top %s', 'premium-addons-for-elementor' ), ucfirst( $right_direction ) ), |
| 820 | 'bottom-left' => sprintf( __( 'Bottom %s', 'premium-addons-for-elementor' ), ucfirst( $left_direction ) ), |
| 821 | 'bottom-right' => sprintf( __( 'Bottom %s', 'premium-addons-for-elementor' ), ucfirst( $right_direction ) ), |
| 822 | 'center-left' => sprintf( __( 'Center %s', 'premium-addons-for-elementor' ), ucfirst( $left_direction ) ), |
| 823 | 'center-right' => sprintf( __( 'Center %s', 'premium-addons-for-elementor' ), ucfirst( $right_direction ) ), |
| 824 | ), |
| 825 | 'default' => 'bottom-left', |
| 826 | 'conditions' => $sticky_condition, |
| 827 | 'prefix_class' => 'premium-video-sticky-', |
| 828 | 'render_type' => 'template', |
| 829 | ) |
| 830 | ); |
| 831 | |
| 832 | $this->add_control( |
| 833 | 'premium_video_box_sticky_hide', |
| 834 | array( |
| 835 | 'label' => __( 'Disable Sticky On', 'premium-addons-for-elementor' ), |
| 836 | 'type' => Controls_Manager::SELECT2, |
| 837 | 'multiple' => true, |
| 838 | 'label_block' => true, |
| 839 | 'options' => array( |
| 840 | 'desktop' => __( 'Desktop', 'premium-addons-for-elementor' ), |
| 841 | 'tablet' => __( 'Tablet', 'premium-addons-for-elementor' ), |
| 842 | 'mobile' => __( 'Mobile', 'premium-addons-for-elementor' ), |
| 843 | ), |
| 844 | 'conditions' => $sticky_condition, |
| 845 | 'render_type' => 'template', |
| 846 | 'frontend_available' => true, |
| 847 | ) |
| 848 | ); |
| 849 | |
| 850 | $this->add_control( |
| 851 | 'premium_video_box_animation', |
| 852 | array( |
| 853 | 'label' => __( 'Entrance Animation', 'premium-addons-for-elementor' ), |
| 854 | 'type' => Controls_Manager::ANIMATION, |
| 855 | 'label_block' => true, |
| 856 | 'frontend_available' => true, |
| 857 | 'render_type' => 'template', |
| 858 | 'conditions' => $sticky_condition, |
| 859 | ) |
| 860 | ); |
| 861 | |
| 862 | $this->add_control( |
| 863 | 'premium_video_box_animation_duration', |
| 864 | array( |
| 865 | 'label' => __( 'Animation Duration', 'premium-addons-for-elementor' ), |
| 866 | 'type' => Controls_Manager::SELECT, |
| 867 | 'default' => '', |
| 868 | 'options' => array( |
| 869 | 'slow' => __( 'Slow', 'premium-addons-for-elementor' ), |
| 870 | '' => __( 'Normal', 'premium-addons-for-elementor' ), |
| 871 | 'fast' => __( 'Fast', 'premium-addons-for-elementor' ), |
| 872 | ), |
| 873 | 'conditions' => array( |
| 874 | 'terms' => array( |
| 875 | array( |
| 876 | 'name' => 'premium_video_box_animation', |
| 877 | 'operator' => '!==', |
| 878 | 'value' => '', |
| 879 | ), |
| 880 | array( |
| 881 | 'name' => 'premium_video_box_sticky_switcher', |
| 882 | 'value' => 'yes', |
| 883 | ), |
| 884 | $playlist_condition, |
| 885 | ), |
| 886 | ), |
| 887 | ) |
| 888 | ); |
| 889 | |
| 890 | $this->add_control( |
| 891 | 'premium_video_box_animation_delay', |
| 892 | array( |
| 893 | 'label' => __( 'Animation Delay', 'premium-addons-for-elementor' ) . ' (s)', |
| 894 | 'type' => Controls_Manager::NUMBER, |
| 895 | 'default' => '', |
| 896 | 'step' => 0.1, |
| 897 | 'conditions' => array( |
| 898 | 'terms' => array( |
| 899 | array( |
| 900 | 'name' => 'premium_video_box_animation', |
| 901 | 'operator' => '!==', |
| 902 | 'value' => '', |
| 903 | ), |
| 904 | array( |
| 905 | 'name' => 'premium_video_box_sticky_switcher', |
| 906 | 'value' => 'yes', |
| 907 | ), |
| 908 | $playlist_condition, |
| 909 | ), |
| 910 | ), |
| 911 | 'frontend_available' => true, |
| 912 | ) |
| 913 | ); |
| 914 | |
| 915 | $this->add_control( |
| 916 | 'sticky_info_bar_switch', |
| 917 | array( |
| 918 | 'label' => __( 'Info Section', 'premium-addons-for-elementor' ), |
| 919 | 'type' => Controls_Manager::SWITCHER, |
| 920 | 'conditions' => $sticky_condition, |
| 921 | ) |
| 922 | ); |
| 923 | |
| 924 | $this->add_control( |
| 925 | 'sticky_info_bar_text', |
| 926 | array( |
| 927 | 'label' => __( 'Text', 'premium-addons-for-elementor' ), |
| 928 | 'type' => Controls_Manager::TEXTAREA, |
| 929 | 'default' => __( 'Watching: Sticky Video', 'premium-addons-for-elementor' ), |
| 930 | 'rows' => 2, |
| 931 | 'dynamic' => array( |
| 932 | 'active' => true, |
| 933 | ), |
| 934 | 'conditions' => |
| 935 | array( |
| 936 | 'terms' => array( |
| 937 | array( |
| 938 | 'name' => 'premium_video_box_sticky_switcher', |
| 939 | 'value' => 'yes', |
| 940 | ), |
| 941 | array( |
| 942 | 'name' => 'sticky_info_bar_switch', |
| 943 | 'value' => 'yes', |
| 944 | ), |
| 945 | $playlist_condition, |
| 946 | ), |
| 947 | ), |
| 948 | ) |
| 949 | ); |
| 950 | |
| 951 | $this->add_control( |
| 952 | 'premium_video_box_start', |
| 953 | array( |
| 954 | 'label' => __( 'Start Time', 'premium-addons-for-elementor' ), |
| 955 | 'type' => Controls_Manager::NUMBER, |
| 956 | 'separator' => 'before', |
| 957 | 'dynamic' => array( |
| 958 | 'active' => true, |
| 959 | ), |
| 960 | 'description' => __( 'Specify a start time (in seconds)', 'premium-addons-for-elementor' ), |
| 961 | 'condition' => array( |
| 962 | 'premium_video_box_video_type!' => 'vimeo', |
| 963 | ), |
| 964 | ) |
| 965 | ); |
| 966 | |
| 967 | $this->add_control( |
| 968 | 'premium_video_box_end', |
| 969 | array( |
| 970 | 'label' => __( 'End Time', 'premium-addons-for-elementor' ), |
| 971 | 'type' => Controls_Manager::NUMBER, |
| 972 | 'description' => __( 'Specify an end time (in seconds)', 'premium-addons-for-elementor' ), |
| 973 | 'separator' => 'after', |
| 974 | 'dynamic' => array( |
| 975 | 'active' => true, |
| 976 | ), |
| 977 | 'condition' => array( |
| 978 | 'premium_video_box_video_type!' => array( 'vimeo', 'dailymotion' ), |
| 979 | ), |
| 980 | ) |
| 981 | ); |
| 982 | |
| 983 | $this->add_control( |
| 984 | 'premium_video_box_suggested_videos', |
| 985 | array( |
| 986 | 'label' => __( 'Suggested Videos From', 'premium-addons-for-elementor' ), |
| 987 | 'type' => Controls_Manager::SELECT, |
| 988 | 'options' => array( |
| 989 | '' => __( 'Current Channel', 'premium-addons-for-elementor' ), |
| 990 | 'yes' => __( 'Any Channel', 'premium-addons-for-elementor' ), |
| 991 | ), |
| 992 | 'condition' => array( |
| 993 | 'premium_video_box_video_type' => 'youtube', |
| 994 | ), |
| 995 | ) |
| 996 | ); |
| 997 | |
| 998 | $this->add_control( |
| 999 | 'vimeo_controls_color', |
| 1000 | array( |
| 1001 | 'label' => __( 'Controls Color', 'premium-addons-for-elementor' ), |
| 1002 | 'type' => Controls_Manager::COLOR, |
| 1003 | 'selectors' => array( |
| 1004 | '{{WRAPPER}} .premium-video-box-vimeo-title a, {{WRAPPER}} .premium-video-box-vimeo-byline a, {{WRAPPER}} .premium-video-box-vimeo-title a:hover, {{WRAPPER}} .premium-video-box-vimeo-byline a:hover, {{WRAPPER}} .premium-video-box-vimeo-title a:focus, {{WRAPPER}} .premium-video-box-vimeo-byline a:focus' => 'color: {{VALUE}}', |
| 1005 | ), |
| 1006 | 'render_type' => 'template', |
| 1007 | 'condition' => array( |
| 1008 | 'premium_video_box_video_type' => 'vimeo', |
| 1009 | ), |
| 1010 | ) |
| 1011 | ); |
| 1012 | |
| 1013 | $this->add_control( |
| 1014 | 'vimeo_title', |
| 1015 | array( |
| 1016 | 'label' => __( 'Intro Title', 'premium-addons-for-elementor' ), |
| 1017 | 'type' => Controls_Manager::SWITCHER, |
| 1018 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 1019 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 1020 | 'default' => 'yes', |
| 1021 | 'condition' => array( |
| 1022 | 'premium_video_box_video_type' => 'vimeo', |
| 1023 | ), |
| 1024 | ) |
| 1025 | ); |
| 1026 | |
| 1027 | $this->add_control( |
| 1028 | 'vimeo_portrait', |
| 1029 | array( |
| 1030 | 'label' => __( 'Intro Portrait', 'premium-addons-for-elementor' ), |
| 1031 | 'type' => Controls_Manager::SWITCHER, |
| 1032 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 1033 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 1034 | 'default' => 'yes', |
| 1035 | 'condition' => array( |
| 1036 | 'premium_video_box_video_type' => 'vimeo', |
| 1037 | ), |
| 1038 | ) |
| 1039 | ); |
| 1040 | |
| 1041 | $this->add_control( |
| 1042 | 'vimeo_byline', |
| 1043 | array( |
| 1044 | 'label' => __( 'Intro Byline', 'premium-addons-for-elementor' ), |
| 1045 | 'type' => Controls_Manager::SWITCHER, |
| 1046 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 1047 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 1048 | 'default' => 'yes', |
| 1049 | 'condition' => array( |
| 1050 | 'premium_video_box_video_type' => 'vimeo', |
| 1051 | ), |
| 1052 | ) |
| 1053 | ); |
| 1054 | |
| 1055 | // dailymotion specific. |
| 1056 | |
| 1057 | $this->add_control( |
| 1058 | 'dailymotion_logo', |
| 1059 | array( |
| 1060 | 'label' => __( 'Show Logo', 'premium-addons-for-elementor' ), |
| 1061 | 'type' => Controls_Manager::SWITCHER, |
| 1062 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 1063 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 1064 | 'condition' => array( |
| 1065 | 'premium_video_box_video_type' => 'dailymotion', |
| 1066 | ), |
| 1067 | ) |
| 1068 | ); |
| 1069 | |
| 1070 | $this->add_control( |
| 1071 | 'dailymotion_info', |
| 1072 | array( |
| 1073 | 'label' => __( 'Video Info', 'premium-addons-for-elementor' ), |
| 1074 | 'type' => Controls_Manager::SWITCHER, |
| 1075 | 'label_on' => __( 'Show', 'premium-addons-for-elementor' ), |
| 1076 | 'label_off' => __( 'Hide', 'premium-addons-for-elementor' ), |
| 1077 | 'condition' => array( |
| 1078 | 'premium_video_box_video_type' => 'dailymotion', |
| 1079 | ), |
| 1080 | ) |
| 1081 | ); |
| 1082 | |
| 1083 | $this->add_control( |
| 1084 | 'dm_controls_color', |
| 1085 | array( |
| 1086 | 'label' => __( 'Controls Color', 'premium-addons-for-elementor' ), |
| 1087 | 'type' => Controls_Manager::COLOR, |
| 1088 | 'condition' => array( |
| 1089 | 'premium_video_box_video_type' => 'dailymotion', |
| 1090 | ), |
| 1091 | ) |
| 1092 | ); |
| 1093 | |
| 1094 | $this->add_control( |
| 1095 | 'aspect_ratio', |
| 1096 | array( |
| 1097 | 'label' => __( 'Aspect Ratio', 'premium-addons-for-elementor' ), |
| 1098 | 'type' => Controls_Manager::SELECT, |
| 1099 | 'options' => array( |
| 1100 | '169' => '16:9', |
| 1101 | '219' => '21:9', |
| 1102 | '43' => '4:3', |
| 1103 | '32' => '3:2', |
| 1104 | '11' => '1:1', |
| 1105 | '916' => '9:16', |
| 1106 | ), |
| 1107 | 'selectors_dictionary' => array( |
| 1108 | '169' => '1.77777', // 16 / 9 |
| 1109 | '219' => '2.33333', // 21 / 9 |
| 1110 | '43' => '1.33333', // 4 / 3 |
| 1111 | '32' => '1.5', // 3 / 2 |
| 1112 | '11' => '1', // 1 / 1 |
| 1113 | '916' => '0.5625', // 9 / 16 |
| 1114 | ), |
| 1115 | 'default' => '169', |
| 1116 | 'selectors' => array( |
| 1117 | '{{WRAPPER}} .premium-video-box-container > div' => 'aspect-ratio: {{VALUE}}', |
| 1118 | ), |
| 1119 | 'frontend_available' => true, |
| 1120 | ) |
| 1121 | ); |
| 1122 | |
| 1123 | $this->add_responsive_control( |
| 1124 | 'object_fit', |
| 1125 | array( |
| 1126 | 'label' => __( 'Object Fit', 'premium-addons-for-elementor' ), |
| 1127 | 'type' => Controls_Manager::SELECT, |
| 1128 | 'options' => array( |
| 1129 | '' => __( 'Default', 'premium-addons-for-elementor' ), |
| 1130 | 'fill' => __( 'Fill', 'premium-addons-for-elementor' ), |
| 1131 | 'cover' => __( 'Cover', 'premium-addons-for-elementor' ), |
| 1132 | 'contain' => __( 'Contain', 'premium-addons-for-elementor' ), |
| 1133 | ), |
| 1134 | 'default' => 'contain', |
| 1135 | 'selectors' => array( |
| 1136 | '{{WRAPPER}} .premium-video-box-video-container video' => 'object-fit: {{VALUE}};', |
| 1137 | ), |
| 1138 | 'condition' => array( |
| 1139 | 'premium_video_box_video_type' => 'self', |
| 1140 | ), |
| 1141 | ) |
| 1142 | ); |
| 1143 | |
| 1144 | $this->add_control( |
| 1145 | 'premium_video_box_image_switcher', |
| 1146 | array( |
| 1147 | 'label' => __( 'Overlay', 'premium-addons-for-elementor' ), |
| 1148 | 'type' => Controls_Manager::SWITCHER, |
| 1149 | 'default' => 'yes', |
| 1150 | 'conditions' => array( |
| 1151 | 'terms' => array( |
| 1152 | $playlist_condition, |
| 1153 | ), |
| 1154 | ), |
| 1155 | ) |
| 1156 | ); |
| 1157 | |
| 1158 | $this->add_control( |
| 1159 | 'premium_video_box_yt_thumbnail_size', |
| 1160 | array( |
| 1161 | 'label' => __( 'Thumbnail Size', 'premium-addons-for-elementor' ), |
| 1162 | 'type' => Controls_Manager::SELECT, |
| 1163 | 'options' => array( |
| 1164 | 'maxresdefault' => __( 'Maximum Resolution', 'premium-addons-for-elementor' ), |
| 1165 | 'hqdefault' => __( 'High Quality', 'premium-addons-for-elementor' ), |
| 1166 | 'mqdefault' => __( 'Medium Quality', 'premium-addons-for-elementor' ), |
| 1167 | 'sddefault' => __( 'Standard Quality', 'premium-addons-for-elementor' ), |
| 1168 | ), |
| 1169 | 'default' => 'maxresdefault', |
| 1170 | 'conditions' => array( |
| 1171 | 'terms' => array( |
| 1172 | array( |
| 1173 | 'name' => 'premium_video_box_video_type', |
| 1174 | 'value' => 'youtube', |
| 1175 | ), |
| 1176 | array( |
| 1177 | 'relation' => 'or', |
| 1178 | 'terms' => array( |
| 1179 | array( |
| 1180 | 'name' => 'premium_video_box_image_switcher', |
| 1181 | 'value' => '', |
| 1182 | ), |
| 1183 | array( |
| 1184 | 'name' => 'youtube_list', |
| 1185 | 'value' => 'yes', |
| 1186 | ), |
| 1187 | ), |
| 1188 | ), |
| 1189 | ), |
| 1190 | ), |
| 1191 | 'render_type' => 'template', |
| 1192 | ) |
| 1193 | ); |
| 1194 | |
| 1195 | $this->add_control( |
| 1196 | 'premium_video_box_img_effect', |
| 1197 | array( |
| 1198 | 'label' => __( 'Hover Effect', 'premium-addons-for-elementor' ), |
| 1199 | 'type' => Controls_Manager::SELECT, |
| 1200 | 'description' => __( 'Choose a hover effect for the image', 'premium-addons-for-elementor' ), |
| 1201 | 'options' => array( |
| 1202 | 'none' => __( 'None', 'premium-addons-for-elementor' ), |
| 1203 | 'zoomin' => __( 'Zoom In', 'premium-addons-for-elementor' ), |
| 1204 | 'zoomout' => __( 'Zoom Out', 'premium-addons-for-elementor' ), |
| 1205 | 'scale' => __( 'Scale', 'premium-addons-for-elementor' ), |
| 1206 | 'gray' => __( 'Grayscale', 'premium-addons-for-elementor' ), |
| 1207 | 'blur' => __( 'Blur', 'premium-addons-for-elementor' ), |
| 1208 | 'bright' => __( 'Bright', 'premium-addons-for-elementor' ), |
| 1209 | 'sepia' => __( 'Sepia', 'premium-addons-for-elementor' ), |
| 1210 | 'trans' => __( 'Translate', 'premium-addons-for-elementor' ), |
| 1211 | ), |
| 1212 | 'default' => 'none', |
| 1213 | 'label_block' => true, |
| 1214 | ) |
| 1215 | ); |
| 1216 | |
| 1217 | $this->add_control( |
| 1218 | 'mask_video_box_switcher', |
| 1219 | array( |
| 1220 | 'label' => __( 'Mask Video Shape', 'premium-addons-for-elementor' ), |
| 1221 | 'type' => Controls_Manager::SWITCHER, |
| 1222 | 'separator' => 'before', |
| 1223 | ) |
| 1224 | ); |
| 1225 | |
| 1226 | $this->add_control( |
| 1227 | 'mask_shape_video_box', |
| 1228 | array( |
| 1229 | 'label' => __( 'Mask Image', 'premium-addons-for-elementor' ), |
| 1230 | 'type' => Controls_Manager::MEDIA, |
| 1231 | 'default' => array( |
| 1232 | 'url' => '', |
| 1233 | ), |
| 1234 | 'description' => __( 'Use PNG image with the shape you want to mask around feature video.', 'premium-addons-for-elementor' ), |
| 1235 | 'selectors' => array( |
| 1236 | '{{WRAPPER}} .premium-video-box-mask-media ' => 'mask-image: url("{{URL}}");-webkit-mask-image: url("{{URL}}")', |
| 1237 | ), |
| 1238 | 'condition' => array( |
| 1239 | 'mask_video_box_switcher' => 'yes', |
| 1240 | ), |
| 1241 | ) |
| 1242 | ); |
| 1243 | |
| 1244 | $this->add_control( |
| 1245 | 'mask_size', |
| 1246 | array( |
| 1247 | 'label' => __( 'Mask Size', 'premium-addons-for-elementor' ), |
| 1248 | 'type' => Controls_Manager::SELECT, |
| 1249 | 'options' => array( |
| 1250 | 'contain' => __( 'Contain', 'premium-addons-for-elementor' ), |
| 1251 | 'cover' => __( 'Cover', 'premium-addons-for-elementor' ), |
| 1252 | ), |
| 1253 | 'default' => 'contain', |
| 1254 | 'selectors' => array( |
| 1255 | '{{WRAPPER}} .premium-video-box-mask-media' => 'mask-size: {{VALUE}};-webkit-mask-size: {{VALUE}};', |
| 1256 | ), |
| 1257 | 'condition' => array( |
| 1258 | 'mask_video_box_switcher' => 'yes', |
| 1259 | ), |
| 1260 | ) |
| 1261 | ); |
| 1262 | |
| 1263 | $this->add_control( |
| 1264 | 'mask_position_cover', |
| 1265 | array( |
| 1266 | 'label' => __( 'Mask Position', 'premium-addons-for-elementor' ), |
| 1267 | 'type' => Controls_Manager::SELECT, |
| 1268 | 'options' => array( |
| 1269 | 'center center' => __( 'Center Center', 'premium-addons-for-elementor' ), |
| 1270 | 'center left' => __( 'Center Left', 'premium-addons-for-elementor' ), |
| 1271 | 'center right' => __( 'Center Right', 'premium-addons-for-elementor' ), |
| 1272 | 'top center' => __( 'Top Center', 'premium-addons-for-elementor' ), |
| 1273 | 'top left' => __( 'Top Left', 'premium-addons-for-elementor' ), |
| 1274 | 'top right' => __( 'Top Right', 'premium-addons-for-elementor' ), |
| 1275 | 'bottom center' => __( 'Bottom Center', 'premium-addons-for-elementor' ), |
| 1276 | 'bottom left' => __( 'Bottom Left', 'premium-addons-for-elementor' ), |
| 1277 | 'bottom right' => __( 'Bottom Right', 'premium-addons-for-elementor' ), |
| 1278 | ), |
| 1279 | 'default' => 'center center', |
| 1280 | 'selectors' => array( |
| 1281 | '{{WRAPPER}} .premium-video-box-mask-media' => 'mask-position: {{VALUE}}; -webkit-mask-position: {{VALUE}}', |
| 1282 | ), |
| 1283 | 'condition' => array( |
| 1284 | 'mask_video_box_switcher' => 'yes', |
| 1285 | 'mask_size' => 'cover', |
| 1286 | ), |
| 1287 | ) |
| 1288 | ); |
| 1289 | |
| 1290 | $this->add_control( |
| 1291 | 'mask_position_contain', |
| 1292 | array( |
| 1293 | 'label' => __( 'Mask Position', 'premium-addons-for-elementor' ), |
| 1294 | 'type' => Controls_Manager::SELECT, |
| 1295 | 'options' => array( |
| 1296 | 'center center' => __( 'Center Center', 'premium-addons-for-elementor' ), |
| 1297 | 'top center' => __( 'Top Center', 'premium-addons-for-elementor' ), |
| 1298 | 'bottom center' => __( 'Bottom Center', 'premium-addons-for-elementor' ), |
| 1299 | ), |
| 1300 | 'default' => 'center center', |
| 1301 | 'selectors' => array( |
| 1302 | '{{WRAPPER}} .premium-video-box-mask-media' => 'mask-position: {{VALUE}}; -webkit-mask-position: {{VALUE}}', |
| 1303 | ), |
| 1304 | 'condition' => array( |
| 1305 | 'mask_video_box_switcher' => 'yes', |
| 1306 | 'mask_size' => 'contain', |
| 1307 | ), |
| 1308 | ) |
| 1309 | ); |
| 1310 | |
| 1311 | $this->add_control( |
| 1312 | 'video_box_shadow', |
| 1313 | array( |
| 1314 | 'label' => __( 'Mask Shadow', 'premium-addons-for-elementor' ), |
| 1315 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 1316 | 'condition' => array( |
| 1317 | 'mask_video_box_switcher' => 'yes', |
| 1318 | ), |
| 1319 | 'return_value' => 'yes', |
| 1320 | 'render_type' => 'template', |
| 1321 | ) |
| 1322 | ); |
| 1323 | |
| 1324 | $this->start_popover(); |
| 1325 | |
| 1326 | $this->add_control( |
| 1327 | 'video_box_shadow_color', |
| 1328 | array( |
| 1329 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1330 | 'type' => Controls_Manager::COLOR, |
| 1331 | 'default' => 'rgba(0,0,0,0.5)', |
| 1332 | ) |
| 1333 | ); |
| 1334 | |
| 1335 | $this->add_control( |
| 1336 | 'video_box_shadow_h', |
| 1337 | array( |
| 1338 | 'label' => __( 'Horizontal', 'premium-addons-for-elementor' ), |
| 1339 | 'type' => Controls_Manager::SLIDER, |
| 1340 | 'range' => array( |
| 1341 | 'px' => array( |
| 1342 | 'min' => 0, |
| 1343 | 'max' => 100, |
| 1344 | 'step' => 1, |
| 1345 | ), |
| 1346 | ), |
| 1347 | 'default' => array( |
| 1348 | 'size' => 0, |
| 1349 | 'unit' => 'px', |
| 1350 | ), |
| 1351 | ) |
| 1352 | ); |
| 1353 | |
| 1354 | $this->add_control( |
| 1355 | 'video_box_shadow_v', |
| 1356 | array( |
| 1357 | 'label' => __( 'Vertical', 'premium-addons-for-elementor' ), |
| 1358 | 'type' => Controls_Manager::SLIDER, |
| 1359 | 'range' => array( |
| 1360 | 'px' => array( |
| 1361 | 'min' => 0, |
| 1362 | 'max' => 100, |
| 1363 | 'step' => 1, |
| 1364 | ), |
| 1365 | ), |
| 1366 | 'default' => array( |
| 1367 | 'size' => 0, |
| 1368 | 'unit' => 'px', |
| 1369 | ), |
| 1370 | ) |
| 1371 | ); |
| 1372 | |
| 1373 | $this->add_control( |
| 1374 | 'video_box_shadow_blur', |
| 1375 | array( |
| 1376 | 'label' => __( 'Blur', 'premium-addons-for-elementor' ), |
| 1377 | 'type' => Controls_Manager::SLIDER, |
| 1378 | 'range' => array( |
| 1379 | 'px' => array( |
| 1380 | 'min' => 0, |
| 1381 | 'max' => 100, |
| 1382 | 'step' => 1, |
| 1383 | ), |
| 1384 | ), |
| 1385 | 'default' => array( |
| 1386 | 'size' => 10, |
| 1387 | 'unit' => 'px', |
| 1388 | ), |
| 1389 | 'selectors' => array( |
| 1390 | '{{WRAPPER}} .premium-video-box-mask-filter' => 'filter: drop-shadow({{video_box_shadow_h.SIZE}}px {{video_box_shadow_v.SIZE}}px {{SIZE}}px {{video_box_shadow_color.VALUE}})', |
| 1391 | ), |
| 1392 | ) |
| 1393 | ); |
| 1394 | |
| 1395 | $this->end_popover(); |
| 1396 | |
| 1397 | $this->add_control( |
| 1398 | 'video_lightbox', |
| 1399 | array( |
| 1400 | 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ), |
| 1401 | 'type' => Controls_Manager::SWITCHER, |
| 1402 | 'separator' => 'before', |
| 1403 | 'condition' => array( |
| 1404 | 'premium_video_box_self_autoplay!' => 'yes', |
| 1405 | 'premium_video_box_sticky_switcher!' => 'yes', |
| 1406 | ), |
| 1407 | ) |
| 1408 | ); |
| 1409 | |
| 1410 | $this->add_control( |
| 1411 | 'video_lightbox_style', |
| 1412 | array( |
| 1413 | 'label' => __( 'Lightbox Style', 'premium-addons-for-elementor' ), |
| 1414 | 'type' => Controls_Manager::SELECT, |
| 1415 | 'default' => 'elementor', |
| 1416 | 'frontend_available' => true, |
| 1417 | 'options' => array( |
| 1418 | 'elementor' => __( 'Elementor Lightbox', 'premium-addons-for-elementor' ), |
| 1419 | 'prettyphoto' => __( 'PrettyPhoto', 'premium-addons-for-elementor' ), |
| 1420 | ), |
| 1421 | 'condition' => array( |
| 1422 | 'video_lightbox' => 'yes', |
| 1423 | 'premium_video_box_self_autoplay!' => 'yes', |
| 1424 | 'premium_video_box_video_type!' => 'dailymotion', |
| 1425 | 'premium_video_box_sticky_switcher!' => 'yes', |
| 1426 | ), |
| 1427 | ) |
| 1428 | ); |
| 1429 | |
| 1430 | $this->add_control( |
| 1431 | 'video_lightbox_theme', |
| 1432 | array( |
| 1433 | 'label' => __( 'Lightbox Theme', 'premium-addons-for-elementor' ), |
| 1434 | 'type' => Controls_Manager::SELECT, |
| 1435 | 'options' => array( |
| 1436 | 'pp_default' => __( 'Default', 'premium-addons-for-elementor' ), |
| 1437 | 'light_rounded' => __( 'Light Rounded', 'premium-addons-for-elementor' ), |
| 1438 | 'dark_rounded' => __( 'Dark Rounded', 'premium-addons-for-elementor' ), |
| 1439 | 'light_square' => __( 'Light Square', 'premium-addons-for-elementor' ), |
| 1440 | 'dark_square' => __( 'Dark Square', 'premium-addons-for-elementor' ), |
| 1441 | 'facebook' => __( 'Facebook', 'premium-addons-for-elementor' ), |
| 1442 | ), |
| 1443 | 'default' => 'pp_default', |
| 1444 | 'conditions' => array( |
| 1445 | 'terms' => array( |
| 1446 | array( |
| 1447 | 'name' => 'video_lightbox', |
| 1448 | 'value' => 'yes', |
| 1449 | ), |
| 1450 | array( |
| 1451 | 'name' => 'premium_video_box_self_autoplay', |
| 1452 | 'operator' => '!=', |
| 1453 | 'value' => 'yes', |
| 1454 | ), |
| 1455 | array( |
| 1456 | 'name' => 'premium_video_box_sticky_switcher', |
| 1457 | 'operator' => '!=', |
| 1458 | 'value' => 'yes', |
| 1459 | ), |
| 1460 | array( |
| 1461 | 'relation' => 'or', |
| 1462 | 'terms' => array( |
| 1463 | array( |
| 1464 | 'name' => 'premium_video_box_video_type', |
| 1465 | 'value' => 'dailymotion', |
| 1466 | ), |
| 1467 | array( |
| 1468 | 'name' => 'video_lightbox_style', |
| 1469 | 'value' => 'prettyphoto', |
| 1470 | ), |
| 1471 | ), |
| 1472 | ), |
| 1473 | ), |
| 1474 | ), |
| 1475 | ) |
| 1476 | ); |
| 1477 | |
| 1478 | $this->end_controls_section(); |
| 1479 | |
| 1480 | $this->start_controls_section( |
| 1481 | 'premium_video_box_image_settings', |
| 1482 | array( |
| 1483 | 'label' => __( 'Overlay', 'premium-addons-for-elementor' ), |
| 1484 | 'conditions' => array( |
| 1485 | 'terms' => array( |
| 1486 | array( |
| 1487 | 'name' => 'premium_video_box_image_switcher', |
| 1488 | 'value' => 'yes', |
| 1489 | ), |
| 1490 | $playlist_condition, |
| 1491 | ), |
| 1492 | ), |
| 1493 | ) |
| 1494 | ); |
| 1495 | |
| 1496 | $this->add_control( |
| 1497 | 'premium_video_box_image', |
| 1498 | array( |
| 1499 | 'label' => __( 'Image', 'premium-addons-for-elementor' ), |
| 1500 | 'description' => __( 'Choose an image for the video box', 'premium-addons-for-elementor' ), |
| 1501 | 'type' => Controls_Manager::MEDIA, |
| 1502 | 'dynamic' => array( 'active' => true ), |
| 1503 | // 'default' => array( |
| 1504 | // 'url' => Utils::get_placeholder_image_src(), |
| 1505 | // ), |
| 1506 | 'label_block' => true, |
| 1507 | ) |
| 1508 | ); |
| 1509 | |
| 1510 | $this->end_controls_section(); |
| 1511 | |
| 1512 | $this->start_controls_section( |
| 1513 | 'premium_video_box_play_icon_settings', |
| 1514 | array( |
| 1515 | 'label' => __( 'Play Icon', 'premium-addons-for-elementor' ), |
| 1516 | ) |
| 1517 | ); |
| 1518 | |
| 1519 | $this->add_control( |
| 1520 | 'premium_video_box_play_icon_switcher', |
| 1521 | array( |
| 1522 | 'label' => __( 'Play Icon', 'premium-addons-for-elementor' ), |
| 1523 | 'type' => Controls_Manager::SWITCHER, |
| 1524 | 'default' => 'yes', |
| 1525 | ) |
| 1526 | ); |
| 1527 | |
| 1528 | $this->add_responsive_control( |
| 1529 | 'premium_video_box_icon_hor_position', |
| 1530 | array( |
| 1531 | 'label' => __( 'Horizontal Position', 'premium-addons-for-elementor' ), |
| 1532 | 'type' => Controls_Manager::SLIDER, |
| 1533 | 'size_units' => array( 'px', 'em', '%' ), |
| 1534 | 'label_block' => true, |
| 1535 | 'default' => array( |
| 1536 | 'size' => 50, |
| 1537 | 'unit' => '%', |
| 1538 | ), |
| 1539 | 'range' => array( |
| 1540 | 'px' => array( |
| 1541 | 'min' => 1, |
| 1542 | 'max' => 500, |
| 1543 | ), |
| 1544 | 'em' => array( |
| 1545 | 'min' => 1, |
| 1546 | 'max' => 50, |
| 1547 | ), |
| 1548 | ), |
| 1549 | 'condition' => array( |
| 1550 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1551 | ), |
| 1552 | 'selectors' => array( |
| 1553 | '{{WRAPPER}} .premium-video-box-play-icon-container' => $left_direction . ': {{SIZE}}{{UNIT}};', |
| 1554 | ), |
| 1555 | ) |
| 1556 | ); |
| 1557 | |
| 1558 | $this->add_responsive_control( |
| 1559 | 'premium_video_box_icon_ver_position', |
| 1560 | array( |
| 1561 | 'label' => __( 'Vertical Position', 'premium-addons-for-elementor' ), |
| 1562 | 'type' => Controls_Manager::SLIDER, |
| 1563 | 'size_units' => array( 'px', 'em', '%' ), |
| 1564 | 'label_block' => true, |
| 1565 | 'default' => array( |
| 1566 | 'size' => 50, |
| 1567 | 'unit' => '%', |
| 1568 | ), |
| 1569 | 'range' => array( |
| 1570 | 'px' => array( |
| 1571 | 'min' => 1, |
| 1572 | 'max' => 500, |
| 1573 | ), |
| 1574 | 'em' => array( |
| 1575 | 'min' => 1, |
| 1576 | 'max' => 50, |
| 1577 | ), |
| 1578 | ), |
| 1579 | 'condition' => array( |
| 1580 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1581 | ), |
| 1582 | 'selectors' => array( |
| 1583 | '{{WRAPPER}} .premium-video-box-play-icon-container' => 'top: {{SIZE}}{{UNIT}};', |
| 1584 | ), |
| 1585 | ) |
| 1586 | ); |
| 1587 | |
| 1588 | $this->add_control( |
| 1589 | 'play_glow_effect', |
| 1590 | array( |
| 1591 | 'label' => __( 'Glow Effect Type', 'premium-addons-for-elementor' ), |
| 1592 | 'type' => Controls_Manager::SELECT, |
| 1593 | 'options' => array( |
| 1594 | 'none' => __( 'None', 'premium-addons-for-elementor' ), |
| 1595 | 'ripple' => __( 'Ripple', 'premium-addons-for-elementor' ), |
| 1596 | 'radio' => __( 'Radio Wave', 'premium-addons-for-elementor' ), |
| 1597 | ), |
| 1598 | 'default' => 'none', |
| 1599 | 'prefix_class' => 'premium-video__glow-', |
| 1600 | 'condition' => array( |
| 1601 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1602 | ), |
| 1603 | ) |
| 1604 | ); |
| 1605 | |
| 1606 | $this->end_controls_section(); |
| 1607 | |
| 1608 | $this->start_controls_section( |
| 1609 | 'premium_video_box_description_text_section', |
| 1610 | array( |
| 1611 | 'label' => __( 'Description', 'premium-addons-for-elementor' ), |
| 1612 | 'conditions' => array( |
| 1613 | 'terms' => array( |
| 1614 | $playlist_condition, |
| 1615 | ), |
| 1616 | ), |
| 1617 | ) |
| 1618 | ); |
| 1619 | |
| 1620 | $this->add_control( |
| 1621 | 'premium_video_box_video_text_switcher', |
| 1622 | array( |
| 1623 | 'label' => __( 'Video Text', 'premium-addons-for-elementor' ), |
| 1624 | 'type' => Controls_Manager::SWITCHER, |
| 1625 | ) |
| 1626 | ); |
| 1627 | |
| 1628 | $this->add_control( |
| 1629 | 'premium_video_box_description_text', |
| 1630 | array( |
| 1631 | 'label' => __( 'Text', 'premium-addons-for-elementor' ), |
| 1632 | 'type' => Controls_Manager::TEXTAREA, |
| 1633 | 'default' => __( 'Play Video', 'premium-addons-for-elementor' ), |
| 1634 | 'condition' => array( |
| 1635 | 'premium_video_box_video_text_switcher' => 'yes', |
| 1636 | ), |
| 1637 | 'dynamic' => array( 'active' => true ), |
| 1638 | 'label_block' => true, |
| 1639 | ) |
| 1640 | ); |
| 1641 | |
| 1642 | $this->add_responsive_control( |
| 1643 | 'premium_video_box_description_hor_position', |
| 1644 | array( |
| 1645 | 'label' => __( 'Horizontal Position', 'premium-addons-for-elementor' ), |
| 1646 | 'type' => Controls_Manager::SLIDER, |
| 1647 | 'size_units' => array( 'px', 'em', '%' ), |
| 1648 | 'label_block' => true, |
| 1649 | 'default' => array( |
| 1650 | 'size' => 50, |
| 1651 | 'unit' => '%', |
| 1652 | ), |
| 1653 | 'range' => array( |
| 1654 | 'px' => array( |
| 1655 | 'min' => 1, |
| 1656 | 'max' => 500, |
| 1657 | ), |
| 1658 | 'em' => array( |
| 1659 | 'min' => 1, |
| 1660 | 'max' => 50, |
| 1661 | ), |
| 1662 | ), |
| 1663 | 'condition' => array( |
| 1664 | 'premium_video_box_video_text_switcher' => 'yes', |
| 1665 | ), |
| 1666 | 'selectors' => array( |
| 1667 | '{{WRAPPER}} .premium-video-box-description-container' => $left_direction . ': {{SIZE}}{{UNIT}};', |
| 1668 | ), |
| 1669 | ) |
| 1670 | ); |
| 1671 | |
| 1672 | $this->add_responsive_control( |
| 1673 | 'premium_video_box_description_ver_position', |
| 1674 | array( |
| 1675 | 'label' => __( 'Vertical Position', 'premium-addons-for-elementor' ), |
| 1676 | 'type' => Controls_Manager::SLIDER, |
| 1677 | 'size_units' => array( 'px', 'em', '%' ), |
| 1678 | 'label_block' => true, |
| 1679 | 'default' => array( |
| 1680 | 'size' => 60, |
| 1681 | 'unit' => '%', |
| 1682 | ), |
| 1683 | 'range' => array( |
| 1684 | 'px' => array( |
| 1685 | 'min' => 1, |
| 1686 | 'max' => 500, |
| 1687 | ), |
| 1688 | 'em' => array( |
| 1689 | 'min' => 1, |
| 1690 | 'max' => 50, |
| 1691 | ), |
| 1692 | ), |
| 1693 | 'condition' => array( |
| 1694 | 'premium_video_box_video_text_switcher' => 'yes', |
| 1695 | ), |
| 1696 | 'selectors' => array( |
| 1697 | '{{WRAPPER}} .premium-video-box-description-container' => 'top: {{SIZE}}{{UNIT}};', |
| 1698 | ), |
| 1699 | ) |
| 1700 | ); |
| 1701 | |
| 1702 | $this->end_controls_section(); |
| 1703 | |
| 1704 | $this->start_controls_section( |
| 1705 | 'video_background', |
| 1706 | array( |
| 1707 | 'label' => __( 'Background Image', 'premium-addons-for-elementor' ), |
| 1708 | 'conditions' => array( |
| 1709 | 'relation' => 'and', |
| 1710 | 'terms' => array( |
| 1711 | array( |
| 1712 | 'relation' => 'or', |
| 1713 | 'terms' => array( |
| 1714 | array( |
| 1715 | 'name' => 'premium_video_box_video_type', |
| 1716 | 'operator' => '!==', |
| 1717 | 'value' => 'youtube', |
| 1718 | ), |
| 1719 | array( |
| 1720 | 'name' => 'youtube_list', |
| 1721 | 'operator' => '!==', |
| 1722 | 'value' => 'yes', |
| 1723 | ), |
| 1724 | ), |
| 1725 | ), |
| 1726 | ), |
| 1727 | ), |
| 1728 | ) |
| 1729 | ); |
| 1730 | |
| 1731 | $this->add_control( |
| 1732 | 'background_image', |
| 1733 | array( |
| 1734 | 'label' => __( 'Select Image', 'premium-addons-for-elementor' ), |
| 1735 | 'type' => Controls_Manager::MEDIA, |
| 1736 | 'label_block' => true, |
| 1737 | ) |
| 1738 | ); |
| 1739 | |
| 1740 | $this->add_responsive_control( |
| 1741 | 'video_hor_position', |
| 1742 | array( |
| 1743 | 'label' => __( 'Horizontal Position', 'premium-addons-for-elementor' ), |
| 1744 | 'type' => Controls_Manager::SLIDER, |
| 1745 | 'label_block' => true, |
| 1746 | 'default' => array( |
| 1747 | 'size' => 5, |
| 1748 | 'unit' => '%', |
| 1749 | ), |
| 1750 | 'condition' => array( |
| 1751 | 'background_image[url]!' => '', |
| 1752 | ), |
| 1753 | 'selectors' => array( |
| 1754 | '{{WRAPPER}} .premium-video-box-background + div' => $left_direction . ': {{SIZE}}%; width: calc( 100% - 2 * {{SIZE}}% );', |
| 1755 | ), |
| 1756 | ) |
| 1757 | ); |
| 1758 | |
| 1759 | $this->add_responsive_control( |
| 1760 | 'video_ver_position', |
| 1761 | array( |
| 1762 | 'label' => __( 'Vertical Position', 'premium-addons-for-elementor' ), |
| 1763 | 'type' => Controls_Manager::SLIDER, |
| 1764 | 'label_block' => true, |
| 1765 | 'default' => array( |
| 1766 | 'size' => 5, |
| 1767 | 'unit' => '%', |
| 1768 | ), |
| 1769 | 'condition' => array( |
| 1770 | 'background_image[url]!' => '', |
| 1771 | ), |
| 1772 | 'selectors' => array( |
| 1773 | '{{WRAPPER}} .premium-video-box-background + div' => 'top: {{SIZE}}{{UNIT}};', |
| 1774 | ), |
| 1775 | ) |
| 1776 | ); |
| 1777 | |
| 1778 | $this->add_responsive_control( |
| 1779 | 'video_height', |
| 1780 | array( |
| 1781 | 'label' => __( 'Video Height', 'premium-addons-for-elementor' ), |
| 1782 | 'type' => Controls_Manager::SLIDER, |
| 1783 | 'label_block' => true, |
| 1784 | 'default' => array( |
| 1785 | 'size' => 50, |
| 1786 | 'unit' => '%', |
| 1787 | ), |
| 1788 | 'condition' => array( |
| 1789 | 'background_image[url]!' => '', |
| 1790 | ), |
| 1791 | 'selectors' => array( |
| 1792 | '{{WRAPPER}} .premium-video-box-container > div' => 'padding-bottom: {{SIZE}}%;', |
| 1793 | ), |
| 1794 | ) |
| 1795 | ); |
| 1796 | |
| 1797 | $this->end_controls_section(); |
| 1798 | |
| 1799 | $this->start_controls_section( |
| 1800 | 'section_pa_docs', |
| 1801 | array( |
| 1802 | 'label' => __( 'Help & Docs', 'premium-addons-for-elementor' ), |
| 1803 | ) |
| 1804 | ); |
| 1805 | |
| 1806 | $docs = array( |
| 1807 | 'https://premiumaddons.com/docs/video-box-widget-tutorial/' => __( 'Getting started »', 'premium-addons-for-elementor' ), |
| 1808 | 'https://premiumaddons.com/docs/how-to-enable-youtube-data-api-for-premium-video-box-widget/' => __( 'How to Enable Youtube Data API for Premium Video Box Widget »', 'premium-addons-for-elementor' ), |
| 1809 | 'https://premiumaddons.com/docs/how-to-find-youtube-channel-playlist-id/' => __( 'How to Find Youtube Channel/Playlist ID »', 'premium-addons-for-elementor' ), |
| 1810 | ); |
| 1811 | |
| 1812 | $doc_index = 1; |
| 1813 | foreach ( $docs as $url => $title ) { |
| 1814 | |
| 1815 | $doc_url = Helper_Functions::get_campaign_link( $url, 'video-widget', 'wp-editor', 'get-support' ); |
| 1816 | |
| 1817 | $this->add_control( |
| 1818 | 'doc_' . $doc_index, |
| 1819 | array( |
| 1820 | 'type' => Controls_Manager::RAW_HTML, |
| 1821 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url, $title ), |
| 1822 | 'content_classes' => 'editor-pa-doc', |
| 1823 | ) |
| 1824 | ); |
| 1825 | |
| 1826 | ++$doc_index; |
| 1827 | |
| 1828 | } |
| 1829 | |
| 1830 | Helper_Functions::register_element_feedback_controls( $this ); |
| 1831 | |
| 1832 | $this->end_controls_section(); |
| 1833 | |
| 1834 | $this->start_controls_section( |
| 1835 | 'premium_video_box_text_style_section', |
| 1836 | array( |
| 1837 | 'label' => __( 'Video Box', 'premium-addons-for-elementor' ), |
| 1838 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1839 | ) |
| 1840 | ); |
| 1841 | |
| 1842 | $this->add_group_control( |
| 1843 | Group_Control_Border::get_type(), |
| 1844 | array( |
| 1845 | 'name' => 'image_border', |
| 1846 | 'selector' => '{{WRAPPER}} .premium-video-box-image-container, {{WRAPPER}} .premium-video-box-video-container', |
| 1847 | ) |
| 1848 | ); |
| 1849 | |
| 1850 | // Border Radius Properties sepearated for responsive issues. |
| 1851 | $this->add_responsive_control( |
| 1852 | 'premium_video_box_image_border_radius', |
| 1853 | array( |
| 1854 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1855 | 'type' => Controls_Manager::SLIDER, |
| 1856 | 'size_units' => array( 'px', '%', 'em' ), |
| 1857 | 'selectors' => array( |
| 1858 | '{{WRAPPER}} .premium-video-box-image-container, {{WRAPPER}} .premium-video-box-video-container' => 'border-top-left-radius: {{SIZE}}{{UNIT}}; border-top-right-radius: {{SIZE}}{{UNIT}}; border-bottom-left-radius: {{SIZE}}{{UNIT}}; border-bottom-right-radius: {{SIZE}}{{UNIT}};', |
| 1859 | ), |
| 1860 | 'condition' => array( |
| 1861 | 'adv_radius!' => 'yes', |
| 1862 | ), |
| 1863 | ) |
| 1864 | ); |
| 1865 | |
| 1866 | $this->add_control( |
| 1867 | 'adv_radius', |
| 1868 | array( |
| 1869 | 'label' => __( 'Advanced Border Radius', 'premium-addons-for-elementor' ), |
| 1870 | 'type' => Controls_Manager::SWITCHER, |
| 1871 | 'description' => __( 'Apply custom radius values. Get the radius value from ', 'premium-addons-for-elementor' ) . '<a href="https://9elements.github.io/fancy-border-radius/" target="_blank">here</a>' . __( '. See ', 'premium-addons-for-elementor' ) . '<a href="https://www.youtube.com/watch?v=S0BJazLHV-M" target="_blank">tutorial</a>', |
| 1872 | ) |
| 1873 | ); |
| 1874 | |
| 1875 | $this->add_control( |
| 1876 | 'adv_radius_value', |
| 1877 | array( |
| 1878 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 1879 | 'type' => Controls_Manager::TEXT, |
| 1880 | 'dynamic' => array( 'active' => true ), |
| 1881 | 'selectors' => array( |
| 1882 | '{{WRAPPER}} .premium-banner-ib' => 'border-radius: {{VALUE}};', |
| 1883 | ), |
| 1884 | 'condition' => array( |
| 1885 | 'adv_radius' => 'yes', |
| 1886 | ), |
| 1887 | 'ai' => array( |
| 1888 | 'active' => false, |
| 1889 | ), |
| 1890 | ) |
| 1891 | ); |
| 1892 | |
| 1893 | $this->add_group_control( |
| 1894 | Group_Control_Box_Shadow::get_type(), |
| 1895 | array( |
| 1896 | 'label' => __( 'Shadow', 'premium-addons-for-elementor' ), |
| 1897 | 'name' => 'box_shadow', |
| 1898 | 'selector' => '{{WRAPPER}} .premium-video-box-video-container', |
| 1899 | ) |
| 1900 | ); |
| 1901 | |
| 1902 | $this->add_control( |
| 1903 | 'image_shadow_notice', |
| 1904 | array( |
| 1905 | 'raw' => __( 'Please note that in case Sticky and Mask Shape options are both enabled, image shadow will be applied only on sticky overlay image', 'premium-addons-for-elementor' ), |
| 1906 | 'type' => Controls_Manager::RAW_HTML, |
| 1907 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1908 | ) |
| 1909 | ); |
| 1910 | |
| 1911 | $this->add_responsive_control( |
| 1912 | 'columns_spacing', |
| 1913 | array( |
| 1914 | 'label' => __( 'Rows Spacing', 'premium-addons-for-elementor' ), |
| 1915 | 'type' => Controls_Manager::SLIDER, |
| 1916 | 'size_units' => array( 'px', '%', 'em' ), |
| 1917 | 'range' => array( |
| 1918 | 'px' => array( |
| 1919 | 'min' => 1, |
| 1920 | 'max' => 200, |
| 1921 | ), |
| 1922 | ), |
| 1923 | 'default' => array( |
| 1924 | 'size' => 5, |
| 1925 | 'unit' => 'px', |
| 1926 | ), |
| 1927 | 'condition' => array( |
| 1928 | 'premium_video_box_video_type' => 'youtube', |
| 1929 | 'youtube_list' => 'yes', |
| 1930 | ), |
| 1931 | 'separator' => 'before', |
| 1932 | 'selectors' => array( |
| 1933 | '{{WRAPPER}} .premium-video-box-container' => 'margin-bottom: {{SIZE}}{{UNIT}}', |
| 1934 | ), |
| 1935 | ) |
| 1936 | ); |
| 1937 | |
| 1938 | $this->add_responsive_control( |
| 1939 | 'premium_blog_posts_spacing', |
| 1940 | array( |
| 1941 | 'label' => __( 'Columns Spacing', 'premium-addons-for-elementor' ), |
| 1942 | 'type' => Controls_Manager::SLIDER, |
| 1943 | 'default' => array( |
| 1944 | 'size' => 5, |
| 1945 | ), |
| 1946 | 'range' => array( |
| 1947 | 'px' => array( |
| 1948 | 'min' => 0, |
| 1949 | 'max' => 50, |
| 1950 | ), |
| 1951 | ), |
| 1952 | 'selectors' => array( |
| 1953 | '{{WRAPPER}} .premium-video-box-container' => 'padding-right: calc( {{SIZE}}{{UNIT}}/2 ); padding-left: calc( {{SIZE}}{{UNIT}}/2 )', |
| 1954 | '{{WRAPPER}} .premium-video-box-playlist-container' => 'margin-left: calc( -{{SIZE}}{{UNIT}}/2 ); margin-right: calc( -{{SIZE}}{{UNIT}}/2 );', |
| 1955 | ), |
| 1956 | 'condition' => array( |
| 1957 | 'premium_video_box_video_type' => 'youtube', |
| 1958 | 'youtube_list' => 'yes', |
| 1959 | ), |
| 1960 | ) |
| 1961 | ); |
| 1962 | |
| 1963 | $this->end_controls_section(); |
| 1964 | |
| 1965 | $this->start_controls_section( |
| 1966 | 'premium_video_box_icon_style', |
| 1967 | array( |
| 1968 | 'label' => __( 'Play Icon', 'premium-addons-for-elementor' ), |
| 1969 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1970 | 'condition' => array( |
| 1971 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1972 | ), |
| 1973 | ) |
| 1974 | ); |
| 1975 | |
| 1976 | $this->add_control( |
| 1977 | 'premium_video_box_play_icon_size', |
| 1978 | array( |
| 1979 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 1980 | 'type' => Controls_Manager::SLIDER, |
| 1981 | 'size_units' => array( 'px', '%', 'em' ), |
| 1982 | 'default' => array( |
| 1983 | 'unit' => 'px', |
| 1984 | 'size' => 30, |
| 1985 | ), |
| 1986 | 'selectors' => array( |
| 1987 | '{{WRAPPER}} .premium-video-box-play-icon-container i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1988 | '{{WRAPPER}} .premium-video-box-play-icon-container svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', |
| 1989 | ), |
| 1990 | ) |
| 1991 | ); |
| 1992 | |
| 1993 | $this->add_control( |
| 1994 | 'premium_video_box_play_icon_color', |
| 1995 | array( |
| 1996 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 1997 | 'type' => Controls_Manager::COLOR, |
| 1998 | 'global' => array( |
| 1999 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2000 | ), |
| 2001 | 'selectors' => array( |
| 2002 | '{{WRAPPER}} .premium-video-box-play-icon-container i' => 'color: {{VALUE}};', |
| 2003 | '{{WRAPPER}} .premium-video-box-play-icon-container svg' => 'fill: {{VALUE}};', |
| 2004 | ), |
| 2005 | ) |
| 2006 | ); |
| 2007 | |
| 2008 | $this->add_control( |
| 2009 | 'premium_video_box_play_icon_color_hover', |
| 2010 | array( |
| 2011 | 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ), |
| 2012 | 'type' => Controls_Manager::COLOR, |
| 2013 | // 'global' => array( |
| 2014 | // 'default' => Global_Colors::COLOR_SECONDARY, |
| 2015 | // ), |
| 2016 | 'selectors' => array( |
| 2017 | '{{WRAPPER}} .premium-video-box-play-icon-container:hover i' => 'color: {{VALUE}};', |
| 2018 | '{{WRAPPER}} .premium-video-box-play-icon-container:hover svg' => 'fill: {{VALUE}};', |
| 2019 | ), |
| 2020 | ) |
| 2021 | ); |
| 2022 | |
| 2023 | $this->add_control( |
| 2024 | 'glow_color', |
| 2025 | array( |
| 2026 | 'label' => __( 'Glow Color', 'premium-addons-for-elementor' ), |
| 2027 | 'type' => Controls_Manager::COLOR, |
| 2028 | 'selectors' => array( |
| 2029 | '{{WRAPPER}}.premium-video__glow-ripple .premium-video-box-play-icon-container:before' => 'color: {{VALUE}}', |
| 2030 | '{{WRAPPER}}.premium-video__glow-ripple .premium-video-box-play-icon-container:after' => 'color: {{VALUE}}', |
| 2031 | '{{WRAPPER}}.premium-video__glow-radio .premium-video-box-play-icon-container:before' => 'color: {{VALUE}}', |
| 2032 | '{{WRAPPER}}.premium-video__glow-radio .premium-video-box-play-icon-container:after' => 'color: {{VALUE}}', |
| 2033 | ), |
| 2034 | 'default' => '#6EC1E4', |
| 2035 | 'separator' => 'before', |
| 2036 | 'condition' => array( |
| 2037 | 'play_glow_effect!' => 'none', |
| 2038 | ), |
| 2039 | ) |
| 2040 | ); |
| 2041 | |
| 2042 | $this->add_responsive_control( |
| 2043 | 'glow_size', |
| 2044 | array( |
| 2045 | 'label' => esc_html__( 'Glow Size (px)', 'premium-addons-for-elementor' ), |
| 2046 | 'type' => Controls_Manager::SLIDER, |
| 2047 | 'range' => array( |
| 2048 | 'px' => array( |
| 2049 | 'min' => 0, |
| 2050 | 'max' => 200, |
| 2051 | 'step' => 1, |
| 2052 | ), |
| 2053 | ), |
| 2054 | 'default' => array( |
| 2055 | 'unit' => 'px', |
| 2056 | 'size' => 15, |
| 2057 | ), |
| 2058 | 'selectors' => array( |
| 2059 | '{{WRAPPER}} .premium-video-box-play-icon-container' => '--glow-size: {{SIZE}}{{UNIT}};', |
| 2060 | ), |
| 2061 | 'condition' => array( |
| 2062 | 'play_glow_effect' => 'ripple', |
| 2063 | ), |
| 2064 | ) |
| 2065 | ); |
| 2066 | |
| 2067 | $this->add_control( |
| 2068 | 'wave_scale', |
| 2069 | array( |
| 2070 | 'label' => __( 'Radio Wave Size', 'premium-addons-for-elementor' ), |
| 2071 | 'type' => Controls_Manager::SLIDER, |
| 2072 | 'range' => array( |
| 2073 | 'px' => array( |
| 2074 | 'min' => 0.5, |
| 2075 | 'max' => 5, |
| 2076 | 'step' => 0.1, |
| 2077 | ), |
| 2078 | ), |
| 2079 | 'default' => array( |
| 2080 | 'unit' => 'px', |
| 2081 | 'size' => 2, |
| 2082 | ), |
| 2083 | 'selectors' => array( |
| 2084 | '{{WRAPPER}} .premium-video-box-play-icon-container' => '--glow-scale: {{SIZE}}', |
| 2085 | ), |
| 2086 | 'condition' => array( |
| 2087 | 'play_glow_effect' => 'radio', |
| 2088 | ), |
| 2089 | ) |
| 2090 | ); |
| 2091 | |
| 2092 | $this->add_group_control( |
| 2093 | Premium_Background::get_type(), |
| 2094 | array( |
| 2095 | 'name' => 'premium_video_box_play_icon_background_color', |
| 2096 | 'types' => array( 'classic', 'gradient' ), |
| 2097 | 'selector' => '{{WRAPPER}} .premium-video-box-play-icon-container', |
| 2098 | ) |
| 2099 | ); |
| 2100 | |
| 2101 | $this->add_group_control( |
| 2102 | Group_Control_Border::get_type(), |
| 2103 | array( |
| 2104 | 'name' => 'icon_border', |
| 2105 | 'selector' => '{{WRAPPER}} .premium-video-box-play-icon-container', |
| 2106 | ) |
| 2107 | ); |
| 2108 | |
| 2109 | $this->add_control( |
| 2110 | 'premium_video_box_icon_border_radius', |
| 2111 | array( |
| 2112 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2113 | 'type' => Controls_Manager::SLIDER, |
| 2114 | 'default' => array( |
| 2115 | 'unit' => 'px', |
| 2116 | 'size' => 100, |
| 2117 | ), |
| 2118 | 'size_units' => array( 'px', '%', 'em' ), |
| 2119 | 'selectors' => array( |
| 2120 | '{{WRAPPER}} .premium-video-box-play-icon-container' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2121 | ), |
| 2122 | ) |
| 2123 | ); |
| 2124 | |
| 2125 | $this->add_responsive_control( |
| 2126 | 'premium_video_box_icon_padding', |
| 2127 | array( |
| 2128 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2129 | 'type' => Controls_Manager::DIMENSIONS, |
| 2130 | 'default' => array( |
| 2131 | 'top' => 20, |
| 2132 | 'right' => 20, |
| 2133 | 'bottom' => 20, |
| 2134 | 'left' => 20, |
| 2135 | 'unit' => 'px', |
| 2136 | ), |
| 2137 | 'size_units' => array( 'px', 'em', '%' ), |
| 2138 | 'selectors' => array( |
| 2139 | '{{WRAPPER}} .premium-video-box-play-icon-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2140 | ), |
| 2141 | ) |
| 2142 | ); |
| 2143 | |
| 2144 | $this->add_responsive_control( |
| 2145 | 'premium_video_box_icon_padding_hover', |
| 2146 | array( |
| 2147 | 'label' => __( 'Hover Padding', 'premium-addons-for-elementor' ), |
| 2148 | 'type' => Controls_Manager::DIMENSIONS, |
| 2149 | 'size_units' => array( 'px', 'em', '%' ), |
| 2150 | 'selectors' => array( |
| 2151 | '{{WRAPPER}} .premium-video-box-play-icon-container:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2152 | ), |
| 2153 | ) |
| 2154 | ); |
| 2155 | |
| 2156 | $this->end_controls_section(); |
| 2157 | |
| 2158 | $this->start_controls_section( |
| 2159 | 'premium_video_box_text_style', |
| 2160 | array( |
| 2161 | 'label' => __( 'Video Description', 'premium-addons-for-elementor' ), |
| 2162 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2163 | 'conditions' => |
| 2164 | array( |
| 2165 | 'terms' => array( |
| 2166 | array( |
| 2167 | 'name' => 'premium_video_box_video_text_switcher', |
| 2168 | 'value' => 'yes', |
| 2169 | ), |
| 2170 | $playlist_condition, |
| 2171 | ), |
| 2172 | ), |
| 2173 | ) |
| 2174 | ); |
| 2175 | |
| 2176 | $this->add_control( |
| 2177 | 'premium_video_box_text_color', |
| 2178 | array( |
| 2179 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 2180 | 'type' => Controls_Manager::COLOR, |
| 2181 | 'global' => array( |
| 2182 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2183 | ), |
| 2184 | 'selectors' => array( |
| 2185 | '{{WRAPPER}} .premium-video-box-text' => 'color: {{VALUE}};', |
| 2186 | ), |
| 2187 | ) |
| 2188 | ); |
| 2189 | |
| 2190 | $this->add_control( |
| 2191 | 'premium_video_box_text_color_hover', |
| 2192 | array( |
| 2193 | 'label' => __( 'Hover Color', 'premium-addons-for-elementor' ), |
| 2194 | 'type' => Controls_Manager::COLOR, |
| 2195 | 'global' => array( |
| 2196 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2197 | ), |
| 2198 | 'selectors' => array( |
| 2199 | '{{WRAPPER}} .premium-video-box-description-container:hover .premium-video-box-text' => 'color: {{VALUE}};', |
| 2200 | ), |
| 2201 | ) |
| 2202 | ); |
| 2203 | |
| 2204 | $this->add_group_control( |
| 2205 | Group_Control_Typography::get_type(), |
| 2206 | array( |
| 2207 | 'name' => 'text_typography', |
| 2208 | 'global' => array( |
| 2209 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 2210 | ), |
| 2211 | 'selector' => '{{WRAPPER}} .premium-video-box-text', |
| 2212 | ) |
| 2213 | ); |
| 2214 | |
| 2215 | $this->add_control( |
| 2216 | 'premium_video_box_text_background_color', |
| 2217 | array( |
| 2218 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2219 | 'type' => Controls_Manager::COLOR, |
| 2220 | 'global' => array( |
| 2221 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 2222 | ), |
| 2223 | 'selectors' => array( |
| 2224 | '{{WRAPPER}} .premium-video-box-description-container' => 'background-color: {{VALUE}};', |
| 2225 | ), |
| 2226 | ) |
| 2227 | ); |
| 2228 | |
| 2229 | $this->add_responsive_control( |
| 2230 | 'premium_video_box_text_padding', |
| 2231 | array( |
| 2232 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2233 | 'type' => Controls_Manager::DIMENSIONS, |
| 2234 | 'size_units' => array( 'px', 'em', '%' ), |
| 2235 | 'selectors' => array( |
| 2236 | '{{WRAPPER}} .premium-video-box-description-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2237 | ), |
| 2238 | ) |
| 2239 | ); |
| 2240 | |
| 2241 | $this->add_group_control( |
| 2242 | Group_Control_Text_Shadow::get_type(), |
| 2243 | array( |
| 2244 | 'label' => __( 'Shadow', 'premium-addons-for-elementor' ), |
| 2245 | 'name' => 'premium_text_shadow', |
| 2246 | 'selector' => '{{WRAPPER}} .premium-video-box-text', |
| 2247 | ) |
| 2248 | ); |
| 2249 | |
| 2250 | $this->end_controls_section(); |
| 2251 | |
| 2252 | $this->start_controls_section( |
| 2253 | 'premium_video_box_sticky_options', |
| 2254 | array( |
| 2255 | 'label' => __( 'Sticky Options', 'premium-addons-for-elementor' ), |
| 2256 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2257 | 'conditions' => $sticky_condition, |
| 2258 | ) |
| 2259 | ); |
| 2260 | |
| 2261 | $this->add_responsive_control( |
| 2262 | 'sticky_video_width', |
| 2263 | array( |
| 2264 | 'label' => __( 'Video Size', 'premium-addons-for-elementor' ), |
| 2265 | 'type' => Controls_Manager::SLIDER, |
| 2266 | 'size_units' => array( 'px', 'em', '%' ), |
| 2267 | 'range' => array( |
| 2268 | 'px' => array( |
| 2269 | 'min' => 100, |
| 2270 | 'max' => 1000, |
| 2271 | ), |
| 2272 | ), |
| 2273 | 'default' => array( |
| 2274 | 'size' => 320, |
| 2275 | 'unit' => 'px', |
| 2276 | ), |
| 2277 | 'mobile_default' => array( |
| 2278 | 'size' => 250, |
| 2279 | 'unit' => 'px', |
| 2280 | ), |
| 2281 | 'selectors' => array( |
| 2282 | '{{WRAPPER}}.pa-aspect-ratio-169 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 2283 | {{WRAPPER}}.pa-aspect-ratio-169 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.5625 );', |
| 2284 | '{{WRAPPER}}.pa-aspect-ratio-43 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 2285 | {{WRAPPER}}.pa-aspect-ratio-43 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.75 );', |
| 2286 | '{{WRAPPER}}.pa-aspect-ratio-32 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 2287 | {{WRAPPER}}.pa-aspect-ratio-32 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.6666666666666667 );', |
| 2288 | '{{WRAPPER}}.pa-aspect-ratio-916 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 2289 | {{WRAPPER}}.pa-aspect-ratio-916 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.1778 );', |
| 2290 | '{{WRAPPER}}.pa-aspect-ratio-11 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 2291 | {{WRAPPER}}.pa-aspect-ratio-11 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 1 );', |
| 2292 | '{{WRAPPER}}.pa-aspect-ratio-219 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 2293 | {{WRAPPER}}.pa-aspect-ratio-219 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.4285 );', |
| 2294 | ), |
| 2295 | ) |
| 2296 | ); |
| 2297 | |
| 2298 | $this->add_responsive_control( |
| 2299 | 'sticky_video_margin', |
| 2300 | array( |
| 2301 | 'label' => __( 'Spaces Around', 'premium-addons-for-elementor' ), |
| 2302 | 'type' => Controls_Manager::DIMENSIONS, |
| 2303 | 'size_units' => array( 'px', 'em', '%' ), |
| 2304 | 'selectors' => array( |
| 2305 | '{{WRAPPER}}.premium-video-sticky-top-right .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'top: {{TOP}}{{UNIT}}; ' . $right_direction . ': {{RIGHT}}{{UNIT}}', |
| 2306 | '{{WRAPPER}}.premium-video-sticky-top-left .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'top: {{TOP}}{{UNIT}}; ' . $left_direction . ': {{LEFT}}{{UNIT}}', |
| 2307 | '{{WRAPPER}}.premium-video-sticky-bottom-right .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'bottom: {{BOTTOM}}{{UNIT}}; ' . $right_direction . ': {{RIGHT}}{{UNIT}}', |
| 2308 | '{{WRAPPER}}.premium-video-sticky-bottom-left .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'bottom: {{BOTTOM}}{{UNIT}}; ' . $left_direction . ': {{LEFT}}{{UNIT}}', |
| 2309 | '{{WRAPPER}}.premium-video-sticky-center-left .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => $left_direction . ': {{LEFT}}{{UNIT}}', |
| 2310 | '{{WRAPPER}}.premium-video-sticky-center-right .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => $right_direction . ': {{RIGHT}}{{UNIT}}', |
| 2311 | ), |
| 2312 | ) |
| 2313 | ); |
| 2314 | |
| 2315 | $this->add_group_control( |
| 2316 | Group_Control_Box_Shadow::get_type(), |
| 2317 | array( |
| 2318 | 'name' => 'sticky_box_shadow', |
| 2319 | 'selector' => '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-inner-wrap', |
| 2320 | 'condition' => array( |
| 2321 | 'sticky_info_bar_switch!' => 'yes', |
| 2322 | ), |
| 2323 | ) |
| 2324 | ); |
| 2325 | |
| 2326 | $this->add_control( |
| 2327 | 'info_bar_shadow_color', |
| 2328 | array( |
| 2329 | 'label' => __( 'Shadow Color', 'premium-addons-for-elementor' ), |
| 2330 | 'type' => Controls_Manager::COLOR, |
| 2331 | 'default' => 'rgba(0, 0, 0, 0.5)', |
| 2332 | 'condition' => array( |
| 2333 | 'sticky_info_bar_switch' => 'yes', |
| 2334 | ), |
| 2335 | ) |
| 2336 | ); |
| 2337 | |
| 2338 | $this->add_control( |
| 2339 | 'sticky_play_icon', |
| 2340 | array( |
| 2341 | 'label' => __( 'Play Icon', 'premium-addons-for-elementor' ), |
| 2342 | 'type' => Controls_Manager::HEADING, |
| 2343 | 'separator' => 'before', |
| 2344 | 'condition' => array( |
| 2345 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 2346 | ), |
| 2347 | ) |
| 2348 | ); |
| 2349 | |
| 2350 | $this->add_control( |
| 2351 | 'premium_video_box_play_icon_sticky_size', |
| 2352 | array( |
| 2353 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 2354 | 'type' => Controls_Manager::SLIDER, |
| 2355 | 'size_units' => array( 'px', '%', 'em' ), |
| 2356 | 'selectors' => array( |
| 2357 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-play-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 2358 | ), |
| 2359 | 'condition' => array( |
| 2360 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 2361 | ), |
| 2362 | ) |
| 2363 | ); |
| 2364 | |
| 2365 | $this->add_responsive_control( |
| 2366 | 'premium_video_box_icon_sticky_padding', |
| 2367 | array( |
| 2368 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2369 | 'type' => Controls_Manager::DIMENSIONS, |
| 2370 | 'default' => array( |
| 2371 | 'top' => 40, |
| 2372 | 'right' => 40, |
| 2373 | 'bottom' => 40, |
| 2374 | 'left' => 40, |
| 2375 | 'unit' => 'px', |
| 2376 | ), |
| 2377 | 'size_units' => array( 'px', 'em', '%' ), |
| 2378 | 'selectors' => array( |
| 2379 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-play-icon ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2380 | ), |
| 2381 | 'condition' => array( |
| 2382 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 2383 | ), |
| 2384 | ) |
| 2385 | ); |
| 2386 | |
| 2387 | $this->add_control( |
| 2388 | 'premium_video_box_text_sticky_size', |
| 2389 | array( |
| 2390 | 'label' => __( 'Video Text Size', 'premium-addons-for-elementor' ), |
| 2391 | 'type' => Controls_Manager::SLIDER, |
| 2392 | 'size_units' => array( 'px', '%', 'em' ), |
| 2393 | 'selectors' => array( |
| 2394 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-text' => 'font-size: {{SIZE}}{{UNIT}};', |
| 2395 | ), |
| 2396 | 'condition' => array( |
| 2397 | 'premium_video_box_video_text_switcher' => 'yes', |
| 2398 | ), |
| 2399 | ) |
| 2400 | ); |
| 2401 | |
| 2402 | $this->add_control( |
| 2403 | 'sticky_close', |
| 2404 | array( |
| 2405 | 'label' => __( 'Close Icon', 'premium-addons-for-elementor' ), |
| 2406 | 'type' => Controls_Manager::HEADING, |
| 2407 | 'separator' => 'before', |
| 2408 | ) |
| 2409 | ); |
| 2410 | |
| 2411 | $this->add_control( |
| 2412 | 'premium_video_box_sticky_close_color', |
| 2413 | array( |
| 2414 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2415 | 'type' => Controls_Manager::COLOR, |
| 2416 | 'selectors' => array( |
| 2417 | '{{WRAPPER}} .premium-video-box-sticky-close i' => 'color: {{VALUE}}!important', |
| 2418 | ), |
| 2419 | 'global' => array( |
| 2420 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 2421 | ), |
| 2422 | ) |
| 2423 | ); |
| 2424 | |
| 2425 | $this->add_control( |
| 2426 | 'premium_video_box_sticky_close_bg_color', |
| 2427 | array( |
| 2428 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2429 | 'type' => Controls_Manager::COLOR, |
| 2430 | 'selectors' => array( |
| 2431 | '{{WRAPPER}} .premium-video-box-sticky-close' => 'background: {{VALUE}}', |
| 2432 | ), |
| 2433 | 'default' => '#FFF', |
| 2434 | ) |
| 2435 | ); |
| 2436 | |
| 2437 | $this->add_responsive_control( |
| 2438 | 'sticky_video_icon_size', |
| 2439 | array( |
| 2440 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 2441 | 'type' => Controls_Manager::SLIDER, |
| 2442 | 'size_units' => array( 'px', 'em', '%' ), |
| 2443 | 'default' => array( |
| 2444 | 'size' => 15, |
| 2445 | 'unit' => 'px', |
| 2446 | ), |
| 2447 | 'selectors' => array( |
| 2448 | '{{WRAPPER}} .premium-video-box-sticky-close i' => 'font-size: {{SIZE}}{{UNIT}}', |
| 2449 | ), |
| 2450 | ) |
| 2451 | ); |
| 2452 | |
| 2453 | $this->add_control( |
| 2454 | 'sticky_hint', |
| 2455 | array( |
| 2456 | 'label' => __( 'Info Section', 'premium-addons-for-elementor' ), |
| 2457 | 'type' => Controls_Manager::HEADING, |
| 2458 | 'condition' => array( |
| 2459 | 'sticky_info_bar_switch' => 'yes', |
| 2460 | ), |
| 2461 | 'separator' => 'before', |
| 2462 | ) |
| 2463 | ); |
| 2464 | |
| 2465 | $this->add_control( |
| 2466 | 'premium_video_box_sticky_info_color', |
| 2467 | array( |
| 2468 | 'label' => __( 'Text Color', 'premium-addons-for-elementor' ), |
| 2469 | 'type' => Controls_Manager::COLOR, |
| 2470 | 'selectors' => array( |
| 2471 | '{{WRAPPER}} .premium-video-box-sticky-infobar' => 'color: {{VALUE}}', |
| 2472 | ), |
| 2473 | 'global' => array( |
| 2474 | 'default' => Global_Colors::COLOR_SECONDARY, |
| 2475 | ), |
| 2476 | 'condition' => array( |
| 2477 | 'sticky_info_bar_switch' => 'yes', |
| 2478 | ), |
| 2479 | ) |
| 2480 | ); |
| 2481 | |
| 2482 | $this->add_group_control( |
| 2483 | Group_Control_Typography::get_type(), |
| 2484 | array( |
| 2485 | 'name' => 'info_typography', |
| 2486 | 'global' => array( |
| 2487 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 2488 | ), |
| 2489 | 'selector' => '{{WRAPPER}} .premium-video-box-sticky-infobar', |
| 2490 | 'condition' => array( |
| 2491 | 'sticky_info_bar_switch' => 'yes', |
| 2492 | ), |
| 2493 | ) |
| 2494 | ); |
| 2495 | |
| 2496 | $this->add_control( |
| 2497 | 'premium_video_box_sticky_info_bg_color', |
| 2498 | array( |
| 2499 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2500 | 'type' => Controls_Manager::COLOR, |
| 2501 | 'selectors' => array( |
| 2502 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-sticky-infobar' => 'background: {{VALUE}}', |
| 2503 | ), |
| 2504 | 'default' => '#FFF', |
| 2505 | 'condition' => array( |
| 2506 | 'sticky_info_bar_switch' => 'yes', |
| 2507 | ), |
| 2508 | ) |
| 2509 | ); |
| 2510 | |
| 2511 | $this->end_controls_section(); |
| 2512 | |
| 2513 | $this->start_controls_section( |
| 2514 | 'premium_video_title_style', |
| 2515 | array( |
| 2516 | 'label' => __( 'Video Title', 'premium-addons-for-elementor' ), |
| 2517 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2518 | 'condition' => array( |
| 2519 | 'youtube_list' => 'yes', |
| 2520 | 'youtube_videos_title' => 'yes', |
| 2521 | 'premium_video_box_video_type' => 'youtube', |
| 2522 | ), |
| 2523 | ) |
| 2524 | ); |
| 2525 | |
| 2526 | $this->add_responsive_control( |
| 2527 | 'premium_video_title_align', |
| 2528 | array( |
| 2529 | 'label' => __( 'Alignment', 'premium-addons-for-elementor' ), |
| 2530 | 'type' => Controls_Manager::CHOOSE, |
| 2531 | 'options' => array( |
| 2532 | 'left' => array( |
| 2533 | 'title' => __( 'Left', 'premium-addons-for-elementor' ), |
| 2534 | 'icon' => 'eicon-text-align-left', |
| 2535 | ), |
| 2536 | 'center' => array( |
| 2537 | 'title' => __( 'Center', 'premium-addons-for-elementor' ), |
| 2538 | 'icon' => 'eicon-text-align-center', |
| 2539 | ), |
| 2540 | 'right' => array( |
| 2541 | 'title' => __( 'Right', 'premium-addons-for-elementor' ), |
| 2542 | 'icon' => 'eicon-text-align-right', |
| 2543 | ), |
| 2544 | ), |
| 2545 | 'toggle' => false, |
| 2546 | 'default' => 'center', |
| 2547 | 'selectors' => array( |
| 2548 | '{{WRAPPER}} .premium-youtube-vid-title' => 'text-align: {{VALUE}};', |
| 2549 | ), |
| 2550 | ) |
| 2551 | ); |
| 2552 | |
| 2553 | $this->add_group_control( |
| 2554 | Group_Control_Typography::get_type(), |
| 2555 | array( |
| 2556 | 'name' => 'premium_video_title_typo', |
| 2557 | 'selector' => '{{WRAPPER}} .premium-youtube-vid-title', |
| 2558 | ) |
| 2559 | ); |
| 2560 | |
| 2561 | $this->add_control( |
| 2562 | 'premium_video_title_color', |
| 2563 | array( |
| 2564 | 'label' => __( 'Color', 'premium-addons-for-elementor' ), |
| 2565 | 'type' => Controls_Manager::COLOR, |
| 2566 | 'global' => array( |
| 2567 | 'default' => Global_Colors::COLOR_PRIMARY, |
| 2568 | ), |
| 2569 | 'selectors' => array( |
| 2570 | '{{WRAPPER}} .premium-youtube-vid-title' => 'color: {{VALUE}};', |
| 2571 | ), |
| 2572 | ) |
| 2573 | ); |
| 2574 | |
| 2575 | $this->add_control( |
| 2576 | 'premium_video_title_bg_color', |
| 2577 | array( |
| 2578 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2579 | 'type' => Controls_Manager::COLOR, |
| 2580 | 'selectors' => array( |
| 2581 | '{{WRAPPER}} .premium-youtube-vid-title' => 'background-color: {{VALUE}};', |
| 2582 | ), |
| 2583 | ) |
| 2584 | ); |
| 2585 | |
| 2586 | $this->add_group_control( |
| 2587 | Group_Control_Text_Shadow::get_type(), |
| 2588 | array( |
| 2589 | 'name' => 'premium_video_title_text_shadow', |
| 2590 | 'selector' => '{{WRAPPER}} .premium-youtube-vid-title', |
| 2591 | ) |
| 2592 | ); |
| 2593 | |
| 2594 | $this->add_group_control( |
| 2595 | Group_Control_Box_Shadow::get_type(), |
| 2596 | array( |
| 2597 | 'label' => __( 'Box Shadow', 'premium-addons-for-elementor' ), |
| 2598 | 'name' => 'premium_video_title_shadow', |
| 2599 | 'selector' => '{{WRAPPER}} .premium-youtube-vid-title', |
| 2600 | ) |
| 2601 | ); |
| 2602 | |
| 2603 | $this->add_group_control( |
| 2604 | Group_Control_Border::get_type(), |
| 2605 | array( |
| 2606 | 'name' => 'premium_video_title_border', |
| 2607 | 'selector' => '{{WRAPPER}} .premium-youtube-vid-title', |
| 2608 | ) |
| 2609 | ); |
| 2610 | |
| 2611 | $this->add_control( |
| 2612 | 'premium_video_title_border_rad', |
| 2613 | array( |
| 2614 | 'label' => __( 'Border Radius', 'premium-addons-for-elementor' ), |
| 2615 | 'type' => Controls_Manager::SLIDER, |
| 2616 | 'size_units' => array( 'px', '%', 'em' ), |
| 2617 | 'selectors' => array( |
| 2618 | '{{WRAPPER}} .premium-youtube-vid-title' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 2619 | ), |
| 2620 | ) |
| 2621 | ); |
| 2622 | |
| 2623 | $this->add_responsive_control( |
| 2624 | 'premium_video_title_padding', |
| 2625 | array( |
| 2626 | 'label' => __( 'Padding', 'premium-addons-for-elementor' ), |
| 2627 | 'type' => Controls_Manager::DIMENSIONS, |
| 2628 | 'size_units' => array( 'px', 'em', '%' ), |
| 2629 | 'selectors' => array( |
| 2630 | '{{WRAPPER}} .premium-youtube-vid-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2631 | ), |
| 2632 | ) |
| 2633 | ); |
| 2634 | |
| 2635 | $this->add_responsive_control( |
| 2636 | 'premium_video_title_margin', |
| 2637 | array( |
| 2638 | 'label' => __( 'Margin', 'premium-addons-for-elementor' ), |
| 2639 | 'type' => Controls_Manager::DIMENSIONS, |
| 2640 | 'size_units' => array( 'px', 'em', '%' ), |
| 2641 | 'selectors' => array( |
| 2642 | '{{WRAPPER}} .premium-youtube-vid-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 2643 | ), |
| 2644 | ) |
| 2645 | ); |
| 2646 | |
| 2647 | $this->end_controls_section(); |
| 2648 | |
| 2649 | $this->start_controls_section( |
| 2650 | 'section_lightbox_style', |
| 2651 | array( |
| 2652 | 'label' => __( 'Lightbox', 'premium-addons-for-elementor' ), |
| 2653 | 'tab' => Controls_Manager::TAB_STYLE, |
| 2654 | 'condition' => array( |
| 2655 | 'video_lightbox' => 'yes', |
| 2656 | 'video_lightbox_style' => 'elementor', |
| 2657 | ), |
| 2658 | ) |
| 2659 | ); |
| 2660 | |
| 2661 | $this->add_control( |
| 2662 | 'lightbox_color', |
| 2663 | array( |
| 2664 | 'label' => __( 'Background Color', 'premium-addons-for-elementor' ), |
| 2665 | 'type' => Controls_Manager::COLOR, |
| 2666 | 'selectors' => array( |
| 2667 | '#elementor-lightbox-{{ID}}' => 'background-color: {{VALUE}};', |
| 2668 | ), |
| 2669 | ) |
| 2670 | ); |
| 2671 | |
| 2672 | $this->add_control( |
| 2673 | 'lightbox_ui_color', |
| 2674 | array( |
| 2675 | 'label' => __( 'UI Color', 'premium-addons-for-elementor' ), |
| 2676 | 'type' => Controls_Manager::COLOR, |
| 2677 | 'selectors' => array( |
| 2678 | '#elementor-lightbox-{{ID}} .dialog-lightbox-close-button' => 'color: {{VALUE}}', |
| 2679 | ), |
| 2680 | ) |
| 2681 | ); |
| 2682 | |
| 2683 | $this->add_control( |
| 2684 | 'lightbox_ui_color_hover', |
| 2685 | array( |
| 2686 | 'label' => __( 'UI Hover Color', 'premium-addons-for-elementor' ), |
| 2687 | 'type' => Controls_Manager::COLOR, |
| 2688 | 'selectors' => array( |
| 2689 | '#elementor-lightbox-{{ID}} .dialog-lightbox-close-button:hover' => 'color: {{VALUE}}', |
| 2690 | ), |
| 2691 | 'separator' => 'after', |
| 2692 | ) |
| 2693 | ); |
| 2694 | |
| 2695 | $this->add_control( |
| 2696 | 'lightbox_video_width', |
| 2697 | array( |
| 2698 | 'label' => __( 'Content Width', 'premium-addons-for-elementor' ), |
| 2699 | 'type' => Controls_Manager::SLIDER, |
| 2700 | 'default' => array( |
| 2701 | 'unit' => '%', |
| 2702 | ), |
| 2703 | 'range' => array( |
| 2704 | '%' => array( |
| 2705 | 'min' => 30, |
| 2706 | ), |
| 2707 | ), |
| 2708 | 'selectors' => array( |
| 2709 | '(desktop+)#elementor-lightbox-{{ID}} .elementor-video-container' => 'width: {{SIZE}}{{UNIT}};', |
| 2710 | ), |
| 2711 | ) |
| 2712 | ); |
| 2713 | |
| 2714 | $this->add_control( |
| 2715 | 'lightbox_content_position', |
| 2716 | array( |
| 2717 | 'label' => __( 'Content Position', 'premium-addons-for-elementor' ), |
| 2718 | 'type' => Controls_Manager::SELECT, |
| 2719 | 'frontend_available' => true, |
| 2720 | 'options' => array( |
| 2721 | '' => __( 'Center', 'premium-addons-for-elementor' ), |
| 2722 | 'top' => __( 'Top', 'premium-addons-for-elementor' ), |
| 2723 | ), |
| 2724 | 'selectors' => array( |
| 2725 | '#elementor-lightbox-{{ID}} .elementor-video-container' => '{{VALUE}}; transform: translateX(-50%);', |
| 2726 | ), |
| 2727 | 'selectors_dictionary' => array( |
| 2728 | 'top' => 'top: 60px', |
| 2729 | ), |
| 2730 | ) |
| 2731 | ); |
| 2732 | |
| 2733 | $this->add_responsive_control( |
| 2734 | 'lightbox_content_animation', |
| 2735 | array( |
| 2736 | 'label' => __( 'Entrance Animation', 'premium-addons-for-elementor' ), |
| 2737 | 'type' => Controls_Manager::ANIMATION, |
| 2738 | 'frontend_available' => true, |
| 2739 | ) |
| 2740 | ); |
| 2741 | |
| 2742 | $this->end_controls_section(); |
| 2743 | |
| 2744 | $this->update_controls(); |
| 2745 | } |
| 2746 | |
| 2747 | /** |
| 2748 | * Render video box widget output on the frontend. |
| 2749 | * |
| 2750 | * Written in PHP and used to generate the final HTML. |
| 2751 | * |
| 2752 | * @since 1.0.0 |
| 2753 | * @access protected |
| 2754 | */ |
| 2755 | protected function render() { |
| 2756 | |
| 2757 | $settings = $this->get_settings_for_display(); |
| 2758 | |
| 2759 | $video_type = $settings['premium_video_box_video_type']; |
| 2760 | |
| 2761 | $lightbox = $settings['video_lightbox']; |
| 2762 | |
| 2763 | $pretty_container = false; |
| 2764 | |
| 2765 | if ( 'youtube' === $video_type && 'yes' === $settings['youtube_list'] ) { |
| 2766 | |
| 2767 | $this->fetch_youtube_playlist_data(); |
| 2768 | |
| 2769 | return; |
| 2770 | |
| 2771 | } |
| 2772 | |
| 2773 | $id = $this->get_id(); |
| 2774 | |
| 2775 | $params = $this->get_video_params(); |
| 2776 | |
| 2777 | $autoplay = $settings['premium_video_box_self_autoplay']; |
| 2778 | |
| 2779 | $image = 'transparent'; |
| 2780 | |
| 2781 | // Make sure autoplay is disabled before getting any thumbnails. |
| 2782 | if ( 'yes' !== $autoplay ) { |
| 2783 | |
| 2784 | $thumbnail = $this->get_thumbnail( $params['id'] ); |
| 2785 | |
| 2786 | if ( ! empty( $thumbnail ) ) { |
| 2787 | $image = sprintf( 'url(\'%s\')', $thumbnail ); |
| 2788 | } |
| 2789 | } |
| 2790 | |
| 2791 | $mute = $settings['premium_video_box_mute']; |
| 2792 | |
| 2793 | $playsinline = $settings['play_inline']; |
| 2794 | |
| 2795 | $loop = $settings['premium_video_box_loop']; |
| 2796 | |
| 2797 | $controls = $settings['premium_video_box_controls']; |
| 2798 | |
| 2799 | if ( 'self' === $video_type ) { |
| 2800 | |
| 2801 | $overlay = $settings['premium_video_box_image_switcher']; |
| 2802 | |
| 2803 | if ( 'yes' !== $overlay ) { |
| 2804 | $image = 'transparent'; |
| 2805 | } |
| 2806 | |
| 2807 | if ( empty( $settings['premium_video_box_self_hosted_remote'] ) ) { |
| 2808 | $hosted_url = $settings['premium_video_box_self_hosted']['url']; |
| 2809 | } else { |
| 2810 | $hosted_url = $settings['premium_video_box_self_hosted_remote']; |
| 2811 | } |
| 2812 | |
| 2813 | $video_params = ''; |
| 2814 | |
| 2815 | if ( $controls ) { |
| 2816 | $video_params .= 'controls '; |
| 2817 | } |
| 2818 | if ( $mute ) { |
| 2819 | $video_params .= 'muted '; |
| 2820 | } |
| 2821 | if ( $loop ) { |
| 2822 | $video_params .= 'loop '; |
| 2823 | } |
| 2824 | if ( $autoplay ) { |
| 2825 | |
| 2826 | $video_params .= 'playsinline '; |
| 2827 | if ( 'yes' !== $settings['autoplay_viewport'] ) { |
| 2828 | $video_params .= 'autoplay '; |
| 2829 | } else { |
| 2830 | $this->add_render_attribute( 'container', 'data-play-viewport', 'true' ); |
| 2831 | if ( 'yes' === $settings['autoplay_reset'] ) { |
| 2832 | $this->add_render_attribute( 'container', 'data-play-reset', 'true' ); |
| 2833 | } |
| 2834 | |
| 2835 | $video_params .= ' preload="none"'; |
| 2836 | } |
| 2837 | } |
| 2838 | |
| 2839 | if ( $playsinline ) { |
| 2840 | $video_params .= 'playsinline '; |
| 2841 | } |
| 2842 | |
| 2843 | if ( ! $settings['download_button'] ) { |
| 2844 | $video_params .= ' controlsList="nodownload"'; |
| 2845 | } |
| 2846 | } else { |
| 2847 | // youtube - vimeo - dailymotion. |
| 2848 | $link = $params['link']; |
| 2849 | |
| 2850 | $related = $settings['premium_video_box_suggested_videos']; |
| 2851 | |
| 2852 | $options = 'youtube' === $video_type ? '&rel=' : '?rel='; |
| 2853 | $options .= 'yes' === $related ? '1' : '0'; |
| 2854 | $options .= 'youtube' === $video_type ? '&mute=' : '&muted='; |
| 2855 | $options .= 'yes' === $mute ? '1' : '0'; |
| 2856 | $options .= '&loop='; |
| 2857 | $options .= 'yes' === $loop ? '1' : '0'; |
| 2858 | $options .= '&controls='; |
| 2859 | $options .= 'yes' === $controls ? '1' : '0'; |
| 2860 | $options .= '&playsinline='; |
| 2861 | $options .= 'yes' === $playsinline ? '1' : '0'; |
| 2862 | |
| 2863 | if ( 'yes' === $autoplay && ! $this->has_image_overlay() ) { |
| 2864 | |
| 2865 | // Autoplay on Viewport. |
| 2866 | if ( 'yes' === $settings['autoplay_viewport'] ) { |
| 2867 | $this->add_render_attribute( 'container', 'data-play-viewport', 'true' ); |
| 2868 | } |
| 2869 | |
| 2870 | $options .= '&autoplay=1'; |
| 2871 | } |
| 2872 | |
| 2873 | if ( 'youtube' === $video_type ) { |
| 2874 | $options .= '&cc_load_policy=' . ( 'yes' === $settings['cc_load_policy'] ? '1' : '0' ); |
| 2875 | } elseif ( 'vimeo' === $video_type ) { |
| 2876 | |
| 2877 | // Filter any parameters after link to be added later. |
| 2878 | $query_string = wp_parse_url( $link, PHP_URL_QUERY ); |
| 2879 | |
| 2880 | // If video link contains parameters. |
| 2881 | if ( false !== strpos( $link, '?' ) ) { |
| 2882 | $link = strstr( $link, '?', true ); |
| 2883 | } else { |
| 2884 | $link = str_replace( '#t=', '', $link ); |
| 2885 | } |
| 2886 | |
| 2887 | $options .= '&color=' . str_replace( '#', '', $settings['vimeo_controls_color'] ); |
| 2888 | |
| 2889 | if ( 'yes' === $settings['vimeo_title'] ) { |
| 2890 | $options .= '&title=1'; |
| 2891 | } |
| 2892 | |
| 2893 | if ( 'yes' === $settings['vimeo_portrait'] ) { |
| 2894 | $options .= '&portrait=1'; |
| 2895 | } |
| 2896 | |
| 2897 | if ( 'yes' === $settings['vimeo_byline'] ) { |
| 2898 | $options .= '&byline=1'; |
| 2899 | } |
| 2900 | |
| 2901 | $options .= '&autopause=0'; |
| 2902 | |
| 2903 | $options .= '&' . $query_string . '#t='; |
| 2904 | |
| 2905 | } elseif ( 'dailymotion' === $video_type ) { |
| 2906 | // dailymotion options. |
| 2907 | |
| 2908 | $logo = $settings['dailymotion_logo'] ? '1' : '0'; |
| 2909 | $info = $settings['dailymotion_info'] ? '1' : '0'; |
| 2910 | |
| 2911 | $options .= '&ui-logo=' . $logo; |
| 2912 | $options .= '&ui-start-screen-info=' . $info; |
| 2913 | |
| 2914 | $options .= '&ui-highlight=' . trim( $settings['dm_controls_color'], '#' ); |
| 2915 | } |
| 2916 | } |
| 2917 | |
| 2918 | if ( $settings['premium_video_box_start'] || $settings['premium_video_box_end'] ) { |
| 2919 | |
| 2920 | if ( in_array( $video_type, array( 'youtube', 'dailymotion' ), true ) ) { |
| 2921 | |
| 2922 | if ( $settings['premium_video_box_start'] ) { |
| 2923 | $options .= '&start=' . $settings['premium_video_box_start']; |
| 2924 | } |
| 2925 | |
| 2926 | if ( $settings['premium_video_box_end'] && 'youtube' === $video_type ) { |
| 2927 | $options .= '&end=' . $settings['premium_video_box_end']; |
| 2928 | } |
| 2929 | } elseif ( 'self' === $video_type ) { |
| 2930 | |
| 2931 | $hosted_url .= '#t='; |
| 2932 | |
| 2933 | if ( $settings['premium_video_box_start'] ) { |
| 2934 | $hosted_url .= $settings['premium_video_box_start']; |
| 2935 | } |
| 2936 | |
| 2937 | if ( $settings['premium_video_box_end'] ) { |
| 2938 | $hosted_url .= ',' . $settings['premium_video_box_end']; |
| 2939 | } |
| 2940 | } |
| 2941 | } |
| 2942 | |
| 2943 | if ( 'self' !== $video_type && 'yes' !== $lightbox ) { |
| 2944 | |
| 2945 | if ( 'youtube' === $video_type && 'yes' === $settings['privacy_mode'] ) { |
| 2946 | $link = str_replace( '.com', '-nocookie.com', $link ); |
| 2947 | } |
| 2948 | |
| 2949 | $this->add_render_attribute( |
| 2950 | 'video_container', |
| 2951 | array( |
| 2952 | 'data-src' => $link . $options, |
| 2953 | ) |
| 2954 | ); |
| 2955 | } |
| 2956 | |
| 2957 | $sticky = $settings['premium_video_box_sticky_switcher']; |
| 2958 | |
| 2959 | if ( 'yes' === $sticky ) { |
| 2960 | |
| 2961 | $sticky_play = $settings['premium_video_box_sticky_on_play']; |
| 2962 | |
| 2963 | $sticky_desktop = ''; |
| 2964 | |
| 2965 | $sticky_tablet = ''; |
| 2966 | |
| 2967 | $sticky_mobile = ''; |
| 2968 | |
| 2969 | $sticky_infobar = ( 'yes' === $settings['sticky_info_bar_switch'] ) ? 'premium-video-box-sticky-infobar-wrap' : ''; |
| 2970 | |
| 2971 | if ( $settings['premium_video_box_sticky_hide'] ) { |
| 2972 | foreach ( $settings['premium_video_box_sticky_hide'] as $element ) { |
| 2973 | |
| 2974 | switch ( $element ) { |
| 2975 | case 'desktop': |
| 2976 | $sticky_desktop = 'desktop'; |
| 2977 | break; |
| 2978 | case 'tablet': |
| 2979 | $sticky_tablet = 'tablet'; |
| 2980 | break; |
| 2981 | case 'mobile': |
| 2982 | $sticky_mobile = 'mobile'; |
| 2983 | break; |
| 2984 | } |
| 2985 | } |
| 2986 | } |
| 2987 | |
| 2988 | $this->add_render_attribute( |
| 2989 | 'container', |
| 2990 | array( |
| 2991 | 'class' => $sticky_infobar, |
| 2992 | 'data-sticky' => $sticky, |
| 2993 | 'data-hide-desktop' => $sticky_desktop, |
| 2994 | 'data-hide-tablet' => $sticky_tablet, |
| 2995 | 'data-hide-mobile' => $sticky_mobile, |
| 2996 | 'data-sticky-play' => $sticky_play, |
| 2997 | ) |
| 2998 | ); |
| 2999 | |
| 3000 | if ( ! empty( $settings['sticky_video_margin'] ) ) { |
| 3001 | $this->add_render_attribute( 'container', 'data-sticky-margin', $settings['sticky_video_margin']['bottom'] ); |
| 3002 | } |
| 3003 | } |
| 3004 | |
| 3005 | if ( 'yes' === $lightbox ) { |
| 3006 | |
| 3007 | $lightbox_settings = array( |
| 3008 | 'type' => $settings['video_lightbox_style'], |
| 3009 | ); |
| 3010 | |
| 3011 | if ( 'elementor' === $settings['video_lightbox_style'] && 'dailymotion' !== $video_type ) { |
| 3012 | |
| 3013 | $lightbox_options = array( |
| 3014 | 'type' => 'video', |
| 3015 | 'videoType' => 'self' === $video_type ? 'hosted' : $video_type, |
| 3016 | 'url' => 'self' === $video_type ? $hosted_url : $link . $options, |
| 3017 | 'modalOptions' => array( |
| 3018 | 'id' => 'elementor-lightbox-' . $id, |
| 3019 | 'entranceAnimation' => $settings['lightbox_content_animation'], |
| 3020 | 'entranceAnimation_tablet' => $settings['lightbox_content_animation_tablet'], |
| 3021 | 'entranceAnimation_mobile' => $settings['lightbox_content_animation_mobile'], |
| 3022 | 'videoAspectRatio' => $settings['aspect_ratio'], |
| 3023 | ), |
| 3024 | ); |
| 3025 | |
| 3026 | if ( 'self' === $video_type ) { |
| 3027 | $lightbox_options['videoParams'] = $this->get_hosted_params( $settings ); |
| 3028 | } |
| 3029 | |
| 3030 | $this->add_render_attribute( |
| 3031 | 'video_container', |
| 3032 | array( |
| 3033 | 'data-elementor-open-lightbox' => 'yes', |
| 3034 | 'data-elementor-lightbox' => wp_json_encode( $lightbox_options ), |
| 3035 | ) |
| 3036 | ); |
| 3037 | } else { |
| 3038 | |
| 3039 | $rel = sprintf( 'prettyPhoto[premium-videobox-%s]', $id ); |
| 3040 | $link = ( 'self' === $video_type ) ? $hosted_url : $link . $options . '&autoplay=1&iframe=true'; |
| 3041 | $pretty_container = true; |
| 3042 | |
| 3043 | $this->add_render_attribute( |
| 3044 | 'video_lightbox_container', |
| 3045 | array( |
| 3046 | 'class' => 'premium-vid-lightbox-container', |
| 3047 | 'data-rel' => $rel, |
| 3048 | 'href' => $link, |
| 3049 | ) |
| 3050 | ); |
| 3051 | |
| 3052 | // make sure that lightbox type is prettyphoto when dailymotion || prettyphoto. |
| 3053 | $lightbox_settings['type'] = 'prettyphoto'; // TODO: remove when dailymotion issue is fixed. |
| 3054 | $lightbox_settings['theme'] = $settings['video_lightbox_theme']; |
| 3055 | } |
| 3056 | |
| 3057 | $this->add_render_attribute( |
| 3058 | 'container', |
| 3059 | array( |
| 3060 | 'data-lightbox' => wp_json_encode( $lightbox_settings ), |
| 3061 | ) |
| 3062 | ); |
| 3063 | } |
| 3064 | |
| 3065 | $this->add_inline_editing_attributes( 'premium_video_box_description_text' ); |
| 3066 | |
| 3067 | $this->add_render_attribute( |
| 3068 | 'container', |
| 3069 | array( |
| 3070 | 'id' => 'premium-video-box-container-' . $id, |
| 3071 | 'class' => 'premium-video-box-container', |
| 3072 | 'data-overlay' => 'yes' === $settings['premium_video_box_image_switcher'] ? 'true' : 'false', |
| 3073 | 'data-type' => $video_type, |
| 3074 | 'data-thumbnail' => ! empty( $thumbnail ), |
| 3075 | 'data-hover' => $settings['premium_video_box_img_effect'], |
| 3076 | ) |
| 3077 | ); |
| 3078 | |
| 3079 | $this->add_render_attribute( |
| 3080 | 'video_container', |
| 3081 | array( |
| 3082 | 'class' => 'premium-video-box-video-container', |
| 3083 | ) |
| 3084 | ); |
| 3085 | |
| 3086 | $this->add_render_attribute( |
| 3087 | 'video_wrap', |
| 3088 | array( |
| 3089 | 'class' => 'premium-video-box-inner-wrap', |
| 3090 | ) |
| 3091 | ); |
| 3092 | |
| 3093 | $animation_class = $settings['premium_video_box_animation']; |
| 3094 | |
| 3095 | if ( '' !== $settings['premium_video_box_animation'] ) { |
| 3096 | |
| 3097 | $animation_dur = 'animated-' . $settings['premium_video_box_animation_duration']; |
| 3098 | |
| 3099 | $this->add_render_attribute( |
| 3100 | 'video_wrap', |
| 3101 | 'data-video-animation', |
| 3102 | array( |
| 3103 | $animation_class, |
| 3104 | $animation_dur, |
| 3105 | ) |
| 3106 | ); |
| 3107 | |
| 3108 | $delay = '' !== $settings['premium_video_box_animation_delay'] ? $settings['premium_video_box_animation_delay'] : 0; |
| 3109 | |
| 3110 | $this->add_render_attribute( 'video_wrap', 'data-delay-animation', $delay ); |
| 3111 | } |
| 3112 | |
| 3113 | $this->add_render_attribute( 'info_bar', 'class', 'premium-video-box-sticky-infobar' ); |
| 3114 | |
| 3115 | if ( 'yes' === $settings['sticky_info_bar_switch'] ) { |
| 3116 | $this->add_render_attribute( 'info_bar', 'style', 'box-shadow:' . $settings['info_bar_shadow_color'] . ' 0px 5px 10px -5px ' ); |
| 3117 | } |
| 3118 | |
| 3119 | $this->add_render_attribute( |
| 3120 | 'image_container', |
| 3121 | array( |
| 3122 | 'style' => 'background-image:' . $image, |
| 3123 | 'class' => array( |
| 3124 | 'premium-video-box-image-container', |
| 3125 | $settings['premium_video_box_img_effect'], |
| 3126 | ), |
| 3127 | ) |
| 3128 | ); |
| 3129 | |
| 3130 | if ( 'yes' === $settings['mask_video_box_switcher'] ) { |
| 3131 | |
| 3132 | $this->add_render_attribute( 'container', 'data-pa-mask', 'true' ); |
| 3133 | $this->add_render_attribute( 'mask', 'class', 'premium-video-box-mask-media' ); |
| 3134 | |
| 3135 | if ( 'blur' === $settings['premium_video_box_img_effect'] ) { |
| 3136 | $this->add_render_attribute( 'image_container', 'class', 'premium-video-box-mask-media' ); |
| 3137 | } |
| 3138 | |
| 3139 | if ( '' !== $settings['mask_shape_video_box']['url'] && 'yes' === $settings['video_box_shadow'] ) { |
| 3140 | |
| 3141 | $this->add_render_attribute( 'mask_filter', 'class', 'premium-video-box-mask-filter' ); |
| 3142 | |
| 3143 | } |
| 3144 | } |
| 3145 | |
| 3146 | if ( ! empty( $settings['background_image']['url'] ) ) { |
| 3147 | $this->add_render_attribute( |
| 3148 | 'background', |
| 3149 | array( |
| 3150 | 'class' => 'premium-video-box-background', |
| 3151 | 'src' => $settings['background_image']['url'], |
| 3152 | ) |
| 3153 | ); |
| 3154 | } |
| 3155 | |
| 3156 | ?> |
| 3157 | |
| 3158 | |
| 3159 | <?php if ( ! empty( $settings['background_image']['url'] ) ) : ?> |
| 3160 | <img <?php $this->print_render_attribute_string( 'background' ); ?>> |
| 3161 | <?php endif; ?> |
| 3162 | |
| 3163 | <?php if ( 'yes' === $settings['mask_video_box_switcher'] ) : ?> |
| 3164 | <div <?php $this->print_render_attribute_string( 'mask_filter' ); ?>> |
| 3165 | <?php endif; ?> |
| 3166 | <div <?php $this->print_render_attribute_string( 'container' ); ?>> |
| 3167 | <div <?php $this->print_render_attribute_string( 'mask' ); ?> > |
| 3168 | <?php $this->get_vimeo_header( $params['id'] ); ?> |
| 3169 | |
| 3170 | <div <?php $this->print_render_attribute_string( 'video_wrap' ); ?>> |
| 3171 | <div <?php $this->print_render_attribute_string( 'video_container' ); ?>> |
| 3172 | <?php if ( $pretty_container ) : ?> |
| 3173 | <a <?php $this->print_render_attribute_string( 'video_lightbox_container' ); ?>></a> |
| 3174 | <?php endif; ?> |
| 3175 | |
| 3176 | <?php if ( 'self' === $video_type ) : ?> |
| 3177 | <video src="<?php echo esc_url( $hosted_url ); ?>" <?php echo wp_kses_post( $video_params ); ?>></video> |
| 3178 | <?php endif; ?> |
| 3179 | </div> |
| 3180 | <div <?php $this->print_render_attribute_string( 'image_container' ); ?>></div> |
| 3181 | <?php if ( 'yes' === $sticky ) { ?> |
| 3182 | <span class="premium-video-box-sticky-close"><i class="fas fa-times" aria-hidden="true"></i></span> |
| 3183 | <?php } ?> |
| 3184 | <?php if ( 'yes' === $settings['sticky_info_bar_switch'] && '' !== $settings['sticky_info_bar_text'] ) { ?> |
| 3185 | <div <?php $this->print_render_attribute_string( 'info_bar' ); ?>><?php echo wp_kses_post( $settings['sticky_info_bar_text'] ); ?></div> |
| 3186 | <?php } ?> |
| 3187 | <?php if ( 'yes' === $settings['premium_video_box_play_icon_switcher'] && 'yes' !== $autoplay && ! empty( $thumbnail ) ) : ?> |
| 3188 | <div class="premium-video-box-play-icon-container"> |
| 3189 | <?php |
| 3190 | Icons_Manager::render_icon( |
| 3191 | array( |
| 3192 | 'library' => 'fa-solid', |
| 3193 | 'value' => 'fas fa-play', |
| 3194 | ), |
| 3195 | array( |
| 3196 | 'class' => array( 'premium-video-box-play-icon' ), |
| 3197 | 'aria-hidden' => 'true', |
| 3198 | ) |
| 3199 | ); |
| 3200 | ?> |
| 3201 | </div> |
| 3202 | <?php endif; ?> |
| 3203 | <?php if ( 'yes' === $settings['premium_video_box_video_text_switcher'] && ! empty( $settings['premium_video_box_description_text'] ) ) : ?> |
| 3204 | <div class="premium-video-box-description-container"> |
| 3205 | <p class="premium-video-box-text"> |
| 3206 | <span <?php $this->print_render_attribute_string( 'premium_video_box_description_text' ); ?>> |
| 3207 | <?php echo wp_kses_post( $settings['premium_video_box_description_text'] ); ?> |
| 3208 | </span> |
| 3209 | </p> |
| 3210 | </div> |
| 3211 | <?php endif; ?> |
| 3212 | </div> |
| 3213 | |
| 3214 | </div> |
| 3215 | </div> |
| 3216 | <?php if ( 'yes' === $settings['mask_video_box_switcher'] ) : ?> |
| 3217 | </div> |
| 3218 | <?php endif; ?> |
| 3219 | |
| 3220 | <?php |
| 3221 | } |
| 3222 | |
| 3223 | /** |
| 3224 | * Get Hosted Videos Parameters |
| 3225 | * |
| 3226 | * @since 3.7.0 |
| 3227 | * @access private |
| 3228 | * |
| 3229 | * @param array $item image repeater item. |
| 3230 | */ |
| 3231 | private function get_hosted_params( $item ) { |
| 3232 | |
| 3233 | $video_params = array(); |
| 3234 | |
| 3235 | if ( $item['premium_video_box_controls'] ) { |
| 3236 | $video_params['controls'] = ''; |
| 3237 | } |
| 3238 | |
| 3239 | if ( $item['premium_video_box_mute'] ) { |
| 3240 | $video_params['muted'] = 'muted'; |
| 3241 | } |
| 3242 | |
| 3243 | if ( $item['premium_video_box_loop'] ) { |
| 3244 | $video_params['loop'] = ''; |
| 3245 | } |
| 3246 | |
| 3247 | if ( ! $item['download_button'] ) { |
| 3248 | $video_params['controlsList'] = 'nodownload'; |
| 3249 | } |
| 3250 | |
| 3251 | return $video_params; |
| 3252 | } |
| 3253 | |
| 3254 | /** |
| 3255 | * Get video thumbnail |
| 3256 | * |
| 3257 | * @access public |
| 3258 | * |
| 3259 | * @param string $video_id video ID. |
| 3260 | */ |
| 3261 | private function get_thumbnail( $video_id = '' ) { |
| 3262 | |
| 3263 | $settings = $this->get_settings_for_display(); |
| 3264 | |
| 3265 | $type = $settings['premium_video_box_video_type']; |
| 3266 | |
| 3267 | $overlay = $settings['premium_video_box_image_switcher']; |
| 3268 | |
| 3269 | if ( 'yes' === $overlay || 'self' === $type ) { |
| 3270 | |
| 3271 | $thumbnail_src = $settings['premium_video_box_image']['url']; |
| 3272 | |
| 3273 | // add default placeholder for self-hosted video if overlay is enabled. |
| 3274 | if ( 'self' === $type && ! $thumbnail_src ) { |
| 3275 | $thumbnail_src = Utils::get_placeholder_image_src(); |
| 3276 | } |
| 3277 | |
| 3278 | return $thumbnail_src; |
| 3279 | } |
| 3280 | |
| 3281 | // Check thumbnail size option only for Youtube videos. |
| 3282 | $size = ''; |
| 3283 | if ( 'youtube' === $type ) { |
| 3284 | $size = $settings['premium_video_box_yt_thumbnail_size']; |
| 3285 | } |
| 3286 | |
| 3287 | $thumbnail_src = Helper_Functions::get_video_thumbnail( $video_id, $type, $size ); |
| 3288 | |
| 3289 | return $thumbnail_src; |
| 3290 | } |
| 3291 | |
| 3292 | /** |
| 3293 | * Get video params |
| 3294 | * |
| 3295 | * Get video ID and url |
| 3296 | * |
| 3297 | * @access public |
| 3298 | * |
| 3299 | * @param string $video_url video URL. |
| 3300 | * |
| 3301 | * @return array video parameters |
| 3302 | */ |
| 3303 | private function get_video_params( $video_url = '' ) { |
| 3304 | |
| 3305 | $settings = $this->get_settings_for_display(); |
| 3306 | |
| 3307 | $type = $settings['premium_video_box_video_type']; |
| 3308 | |
| 3309 | if ( 'self' === $type ) { |
| 3310 | return array( |
| 3311 | 'link' => '', |
| 3312 | 'id' => '', |
| 3313 | ); |
| 3314 | } |
| 3315 | |
| 3316 | $identifier = $settings['premium_video_box_video_id_embed_selection']; |
| 3317 | |
| 3318 | $id = $settings['premium_video_box_video_id']; |
| 3319 | |
| 3320 | $embed = $settings['premium_video_box_video_embed']; |
| 3321 | |
| 3322 | $link = $video_url; |
| 3323 | |
| 3324 | if ( empty( $video_url ) ) { |
| 3325 | $link = $settings['premium_video_box_link']; |
| 3326 | } |
| 3327 | |
| 3328 | if ( ! empty( $link ) ) { |
| 3329 | |
| 3330 | $video_props = Embed::get_video_properties( $link ); |
| 3331 | $link = Embed::get_embed_url( $link ); |
| 3332 | $id = $video_props['video_id']; |
| 3333 | |
| 3334 | } elseif ( ! empty( $id ) || ! empty( $embed ) ) { |
| 3335 | |
| 3336 | if ( 'id' === $identifier ) { |
| 3337 | $link = 'youtube' === $type ? sprintf( 'https://www.youtube.com/embed/%s', $id ) : sprintf( 'https://player.vimeo.com/video/%s', $id ); |
| 3338 | } else { |
| 3339 | $link = $embed; |
| 3340 | } |
| 3341 | } |
| 3342 | |
| 3343 | return array( |
| 3344 | 'link' => $link, |
| 3345 | 'id' => $id, |
| 3346 | ); |
| 3347 | } |
| 3348 | |
| 3349 | /** |
| 3350 | * Get Vimeo header. |
| 3351 | * |
| 3352 | * Get Vimeo video meta data. |
| 3353 | * |
| 3354 | * @access private |
| 3355 | * |
| 3356 | * @param string $id video ID. |
| 3357 | */ |
| 3358 | private function get_vimeo_header( $id ) { |
| 3359 | |
| 3360 | $settings = $this->get_settings_for_display(); |
| 3361 | |
| 3362 | if ( 'vimeo' !== $settings['premium_video_box_video_type'] ) { |
| 3363 | return; |
| 3364 | } |
| 3365 | |
| 3366 | $vimeo_data = Helper_Functions::get_vimeo_video_data( $id ); |
| 3367 | |
| 3368 | if ( 'yes' === $settings['vimeo_portrait'] || 'yes' === $settings['vimeo_title'] || 'yes' === $settings['vimeo_byline'] |
| 3369 | ) { |
| 3370 | ?> |
| 3371 | <div class="premium-video-box-vimeo-wrap"> |
| 3372 | <?php if ( 'yes' === $settings['vimeo_portrait'] && ! empty( $vimeo_data['portrait'] ) ) { ?> |
| 3373 | <div class="premium-video-box-vimeo-portrait"> |
| 3374 | <a href="<?php echo esc_url( $vimeo_data['url'] ); ?>" target="_blank"> |
| 3375 | <img src="<?php echo esc_url( $vimeo_data['portrait'] ); ?>" alt="<?php echo esc_attr( $vimeo_data['user'] ); ?>"> |
| 3376 | </a> |
| 3377 | </div> |
| 3378 | <?php } ?> |
| 3379 | <?php |
| 3380 | if ( 'yes' === $settings['vimeo_title'] || 'yes' === $settings['vimeo_byline'] ) { |
| 3381 | ?> |
| 3382 | <div class="premium-video-box-vimeo-headers"> |
| 3383 | <?php if ( 'yes' === $settings['vimeo_title'] && ! empty( $vimeo_data['title'] ) ) { ?> |
| 3384 | <div class="premium-video-box-vimeo-title"> |
| 3385 | <a href="<?php echo esc_url( $settings['premium_video_box_link'] ); ?>" target="_blank"> |
| 3386 | <?php echo wp_kses_post( $vimeo_data['title'] ); ?> |
| 3387 | </a> |
| 3388 | </div> |
| 3389 | <?php } ?> |
| 3390 | <?php if ( 'yes' === $settings['vimeo_byline'] && ! empty( $vimeo_data['user'] ) ) { ?> |
| 3391 | <div class="premium-video-box-vimeo-byline"> |
| 3392 | <?php echo esc_html__( 'from ', 'premium-addons-for-elementor' ); ?> <a href="<?php echo esc_url( $vimeo_data['url'] ); ?>" target="_blank"><?php echo wp_kses_post( $vimeo_data['user'] ); ?></a> |
| 3393 | </div> |
| 3394 | <?php } ?> |
| 3395 | </div> |
| 3396 | <?php } ?> |
| 3397 | </div> |
| 3398 | <?php } ?> |
| 3399 | <?php |
| 3400 | |
| 3401 | return isset( $vimeo_data['user'] ) ? true : false; |
| 3402 | } |
| 3403 | |
| 3404 | /** |
| 3405 | * Has Image Overlay |
| 3406 | * |
| 3407 | * Check if video overlay option is enabled |
| 3408 | * |
| 3409 | * @access private |
| 3410 | * |
| 3411 | * @return boolean video overlay. |
| 3412 | */ |
| 3413 | private function has_image_overlay() { |
| 3414 | |
| 3415 | $settings = $this->get_settings_for_display(); |
| 3416 | |
| 3417 | return ! empty( $settings['premium_video_box_image']['url'] ) && 'yes' === $settings['premium_video_box_image_switcher']; |
| 3418 | } |
| 3419 | |
| 3420 | /** |
| 3421 | * Render Youtube Playlist |
| 3422 | * |
| 3423 | * Render the HTML Markup for a Youtube playlist |
| 3424 | * |
| 3425 | * @since 4.0.0 |
| 3426 | * @access private |
| 3427 | * |
| 3428 | * @param array $playlist_videos Playlist Videos. |
| 3429 | */ |
| 3430 | private function render_grid_youtube_playlist( $playlist_videos ) { |
| 3431 | |
| 3432 | $settings = $this->get_settings_for_display(); |
| 3433 | |
| 3434 | $source = $settings['source']; |
| 3435 | |
| 3436 | $lightbox = $settings['video_lightbox']; |
| 3437 | |
| 3438 | $limit = 9999; |
| 3439 | |
| 3440 | if ( ! empty( $settings['limit_num'] ) ) { |
| 3441 | $limit = $settings['limit_num']; |
| 3442 | } |
| 3443 | |
| 3444 | $this->add_render_attribute( |
| 3445 | 'playlist_container', |
| 3446 | array( |
| 3447 | 'class' => 'premium-video-box-playlist-container', |
| 3448 | ) |
| 3449 | ); |
| 3450 | |
| 3451 | if ( 'yes' === $lightbox ) { |
| 3452 | |
| 3453 | $this->add_render_attribute( |
| 3454 | 'playlist_container', |
| 3455 | array( |
| 3456 | 'data-lightbox' => wp_json_encode( |
| 3457 | array( |
| 3458 | 'type' => $settings['video_lightbox_style'], |
| 3459 | 'theme' => $settings['video_lightbox_theme'], |
| 3460 | ) |
| 3461 | ), |
| 3462 | ) |
| 3463 | ); |
| 3464 | } |
| 3465 | |
| 3466 | ?> |
| 3467 | <div <?php $this->print_render_attribute_string( 'playlist_container' ); ?>> |
| 3468 | <?php |
| 3469 | if ( count( $playlist_videos ) ) { |
| 3470 | |
| 3471 | $limit_counter = 0; |
| 3472 | |
| 3473 | foreach ( $playlist_videos as $index => $video ) { |
| 3474 | |
| 3475 | if ( 'playlist' === $source ) { |
| 3476 | $id = $video->snippet->resourceId->videoId; |
| 3477 | } else { |
| 3478 | |
| 3479 | if ( ! isset( $video->id->videoId ) ) { |
| 3480 | continue; |
| 3481 | } |
| 3482 | |
| 3483 | $id = $video->id->videoId; |
| 3484 | } |
| 3485 | |
| 3486 | if ( 'playlist' === $source && ! in_array( $video->status->privacyStatus, array( 'public', 'unlisted' ), true ) ) { |
| 3487 | continue; |
| 3488 | } |
| 3489 | |
| 3490 | if ( $limit_counter === $limit ) { |
| 3491 | break; |
| 3492 | } |
| 3493 | |
| 3494 | ++$limit_counter; |
| 3495 | |
| 3496 | $video_url = sprintf( 'https://www.youtube.com/watch?v=%s', $id ); |
| 3497 | |
| 3498 | $video_params = $this->get_video_params( $video_url ); |
| 3499 | |
| 3500 | $link = $video_params['link']; |
| 3501 | |
| 3502 | $size = $settings['premium_video_box_yt_thumbnail_size']; |
| 3503 | |
| 3504 | $thumbnails_url = sprintf( 'url(\'https://i.ytimg.com/vi/%s/%s.jpg\')', $id, $size ); |
| 3505 | |
| 3506 | $related = $settings['premium_video_box_suggested_videos']; |
| 3507 | |
| 3508 | $mute = $settings['premium_video_box_mute']; |
| 3509 | |
| 3510 | $loop = $settings['premium_video_box_loop']; |
| 3511 | |
| 3512 | $playsinline = $settings['play_inline']; |
| 3513 | |
| 3514 | $options = '&rel='; |
| 3515 | $options .= 'yes' === $related ? '1' : '0'; |
| 3516 | $options .= '&mute='; |
| 3517 | $options .= 'yes' === $mute ? '1' : '0'; |
| 3518 | $options .= '&loop='; |
| 3519 | $options .= 'yes' === $loop ? '1' : '0'; |
| 3520 | $options .= '&playsinline='; |
| 3521 | $options .= 'yes' === $playsinline ? '1' : '0'; |
| 3522 | |
| 3523 | if ( $settings['premium_video_box_start'] ) { |
| 3524 | $options .= '&start=' . $settings['premium_video_box_start']; |
| 3525 | } |
| 3526 | |
| 3527 | if ( $settings['premium_video_box_end'] ) { |
| 3528 | $options .= '&end=' . $settings['premium_video_box_end']; |
| 3529 | } |
| 3530 | |
| 3531 | if ( 'yes' === $settings['youtube_videos_title'] ) { |
| 3532 | $video_title = $video->snippet->title; |
| 3533 | |
| 3534 | $vid_title_tag = Helper_Functions::validate_html_tag( $settings['youtube_videos_title_tag'] ); |
| 3535 | } |
| 3536 | |
| 3537 | $title_link = 'yes' === $settings['youtube_videos_title_link'] ? '<a href="' . $video_url . '" target="_blank">' : ''; |
| 3538 | |
| 3539 | $link_close = 'yes' === $settings['youtube_videos_title_link'] ? '</a>' : ''; |
| 3540 | |
| 3541 | if ( 'yes' === $lightbox ) { |
| 3542 | |
| 3543 | $lightbox_key = 'video_lightbox_' . $id; |
| 3544 | |
| 3545 | $lightbox_options = array( |
| 3546 | 'privacy' => 'yes', |
| 3547 | ); |
| 3548 | |
| 3549 | if ( 'elementor' === $settings['video_lightbox_style'] ) { |
| 3550 | |
| 3551 | $this->add_render_attribute( |
| 3552 | 'video_container' . $id, |
| 3553 | array( |
| 3554 | 'data-elementor-open-lightbox' => 'yes', |
| 3555 | 'data-elementor-lightbox' => wp_json_encode( $lightbox_options ), |
| 3556 | 'data-elementor-lightbox-video' => $link, |
| 3557 | 'data-elementor-lightbox-slideshow' => count( $playlist_videos ) > 1 ? $this->get_id() : false, |
| 3558 | ) |
| 3559 | ); |
| 3560 | } else { |
| 3561 | |
| 3562 | $rel = sprintf( 'prettyPhoto[premium-videobox-%s]', $this->get_id() ); |
| 3563 | |
| 3564 | $this->add_render_attribute( |
| 3565 | 'video_lightbox_container' . $id, |
| 3566 | array( |
| 3567 | 'class' => 'premium-vid-lightbox-container', |
| 3568 | 'data-rel' => $rel, |
| 3569 | 'href' => $link . $options . '&autoplay=1&iframe=true', |
| 3570 | ) |
| 3571 | ); |
| 3572 | } |
| 3573 | } else { |
| 3574 | $this->add_render_attribute( |
| 3575 | 'video_container' . $id, |
| 3576 | array( |
| 3577 | 'data-src' => $link . $options, |
| 3578 | ) |
| 3579 | ); |
| 3580 | } |
| 3581 | |
| 3582 | $this->add_render_attribute( |
| 3583 | 'video_container' . $id, |
| 3584 | array( |
| 3585 | 'class' => 'premium-video-box-video-container', |
| 3586 | ) |
| 3587 | ); |
| 3588 | |
| 3589 | $this->add_render_attribute( |
| 3590 | 'container' . $id, |
| 3591 | array( |
| 3592 | 'id' => 'premium-video-box-container-' . $id, |
| 3593 | 'class' => 'premium-video-box-container', |
| 3594 | ) |
| 3595 | ); |
| 3596 | |
| 3597 | if ( 'yes' === $settings['privacy_mode'] ) { |
| 3598 | $link = str_replace( '.com', '-nocookie.com', $link ); |
| 3599 | } |
| 3600 | |
| 3601 | $this->add_render_attribute( |
| 3602 | 'image_container' . $id, |
| 3603 | array( |
| 3604 | 'style' => 'background-image:' . $thumbnails_url, |
| 3605 | 'class' => array( |
| 3606 | 'premium-video-box-image-container', |
| 3607 | $settings['premium_video_box_img_effect'], |
| 3608 | ), |
| 3609 | ) |
| 3610 | ); |
| 3611 | |
| 3612 | $this->add_render_attribute( 'mask' . $id, 'class', 'premium-video-box-trigger' ); |
| 3613 | |
| 3614 | if ( 'yes' === $settings['mask_video_box_switcher'] ) { |
| 3615 | |
| 3616 | $this->add_render_attribute( 'container' . $id, 'data-pa-mask', 'true' ); |
| 3617 | $this->add_render_attribute( 'mask' . $id, 'class', 'premium-video-box-mask-media' ); |
| 3618 | |
| 3619 | if ( 'blur' === $settings['premium_video_box_img_effect'] ) { |
| 3620 | $this->add_render_attribute( 'image_container' . $id, 'class', 'premium-video-box-mask-media' ); |
| 3621 | } |
| 3622 | |
| 3623 | if ( '' !== $settings['mask_shape_video_box']['url'] && 'yes' === $settings['video_box_shadow'] ) { |
| 3624 | |
| 3625 | $this->add_render_attribute( 'container' . $id, 'class', 'premium-video-box-mask-filter' ); |
| 3626 | |
| 3627 | } |
| 3628 | } |
| 3629 | |
| 3630 | ?> |
| 3631 | |
| 3632 | <?php |
| 3633 | |
| 3634 | if ( $index < 2 && 'layout2' === $settings['playlist_layout'] ) : |
| 3635 | ?> |
| 3636 | <div class="premium-videobox-column"> |
| 3637 | <?php endif; ?> |
| 3638 | |
| 3639 | <div <?php $this->print_render_attribute_string( 'container' . $id ); ?>> |
| 3640 | <div <?php $this->print_render_attribute_string( 'mask' . $id ); ?>> |
| 3641 | <div <?php $this->print_render_attribute_string( 'video_container' . $id ); ?>> |
| 3642 | <?php if ( 'yes' === $lightbox && $settings['video_lightbox_style'] ) : ?> |
| 3643 | <a <?php $this->print_render_attribute_string( 'video_lightbox_container' . $id ); ?>></a> |
| 3644 | <?php endif; ?> |
| 3645 | </div> |
| 3646 | <div <?php $this->print_render_attribute_string( 'image_container' . $id ); ?> ></div> |
| 3647 | <?php if ( 'yes' === $settings['premium_video_box_play_icon_switcher'] ) : ?> |
| 3648 | <div class="premium-video-box-play-icon-container"> |
| 3649 | <?php |
| 3650 | Icons_Manager::render_icon( |
| 3651 | array( |
| 3652 | 'library' => 'eicons', |
| 3653 | 'value' => 'eicon-play', |
| 3654 | ), |
| 3655 | array( |
| 3656 | 'class' => array( 'premium-video-box-play-icon' ), |
| 3657 | 'aria-hidden' => 'true', |
| 3658 | ) |
| 3659 | ); |
| 3660 | ?> |
| 3661 | </div> |
| 3662 | <?php endif; ?> |
| 3663 | </div> |
| 3664 | <?php |
| 3665 | if ( 'yes' === $settings['youtube_videos_title'] ) : |
| 3666 | echo wp_kses_post( $title_link ); |
| 3667 | ?> |
| 3668 | <<?php echo wp_kses_post( $vid_title_tag ); ?> class="premium-youtube-vid-title" > <?php echo esc_html( $video_title ); ?> </<?php echo wp_kses_post( $vid_title_tag ); ?>> |
| 3669 | <?php |
| 3670 | echo wp_kses_post( $link_close ); |
| 3671 | endif; |
| 3672 | ?> |
| 3673 | </div> |
| 3674 | |
| 3675 | <?php if ( 0 === $index && 'layout2' === $settings['playlist_layout'] ) : ?> |
| 3676 | </div> |
| 3677 | <?php endif; ?> |
| 3678 | |
| 3679 | <?php |
| 3680 | |
| 3681 | } |
| 3682 | |
| 3683 | if ( 'layout2' === $settings['playlist_layout'] ) : |
| 3684 | ?> |
| 3685 | </div> |
| 3686 | <?php |
| 3687 | endif; |
| 3688 | } |
| 3689 | ?> |
| 3690 | </div> |
| 3691 | <?php |
| 3692 | } |
| 3693 | |
| 3694 | /** |
| 3695 | * Fetch Youtube Playlist Data |
| 3696 | * |
| 3697 | * Fetch API Data for a Youtube playlist |
| 3698 | * |
| 3699 | * @since 4.0.0 |
| 3700 | * @access private |
| 3701 | */ |
| 3702 | private function fetch_youtube_playlist_data() { |
| 3703 | |
| 3704 | $settings = $this->get_settings_for_display(); |
| 3705 | |
| 3706 | $widget_id = $this->get_id(); |
| 3707 | |
| 3708 | $api_key = Admin_Helper::get_integrations_settings()['premium-youtube-api']; |
| 3709 | |
| 3710 | if ( empty( $api_key ) || '1' === $api_key ) { // phpcs:ignore WordPress.PHP.StrictComparisons |
| 3711 | ?> |
| 3712 | <div class="premium-error-notice"> |
| 3713 | <?php |
| 3714 | $doc_url = Helper_Functions::get_campaign_link( 'https://premiumaddons.com/docs/how-to-enable-youtube-data-api-for-premium-video-box-widget/', 'video-widget', 'wp-editor', 'get-support' ); |
| 3715 | $message = __( 'Please make sure to set your Youtube API key in ', 'premium-addons-for-elementor' ); |
| 3716 | $message .= sprintf( '<a href="%1$s" target="_blank">%2$s</a>', admin_url( 'admin.php?page=premium-addons#tab=integrations' ), __( 'Integrations', 'premium-addons-for-elementor' ) ); |
| 3717 | $message .= __( ' tab. For further information about getting an API key, please check this ', 'premium-addons-for-elementor' ); |
| 3718 | $message .= sprintf( '<a href="%1$s" target="_blank">%2$s</a>', $doc_url, __( 'article', 'premium-addons-for-elementor' ) ); |
| 3719 | echo wp_kses_post( $message ); |
| 3720 | ?> |
| 3721 | </div> |
| 3722 | <?php |
| 3723 | return false; |
| 3724 | } |
| 3725 | |
| 3726 | if ( empty( $api_key ) || ( empty( $settings['playlist_id'] ) && empty( $settings['channel_id'] ) ) ) { |
| 3727 | ?> |
| 3728 | <div class="premium-error-notice"> |
| 3729 | <?php echo esc_html__( 'Please Enter a Valid API Key & Channel/Playlist ID', 'premium-addons-for-elementor' ); ?> |
| 3730 | </div> |
| 3731 | <?php |
| 3732 | return false; |
| 3733 | } |
| 3734 | |
| 3735 | if ( 'playlist' === $settings['source'] ) { |
| 3736 | |
| 3737 | $source = $settings['playlist_id']; |
| 3738 | $api_url = 'https://www.googleapis.com/youtube/v3/playlistItems?key=' . $api_key . '&playlistId=' . $source . '&part=snippet,id,status&order=date&maxResults=50'; |
| 3739 | } else { |
| 3740 | $source = $settings['channel_id']; |
| 3741 | $api_url = 'https://www.googleapis.com/youtube/v3/search?key=' . $api_key . '&channelId=' . $source . '&part=snippet,id&order=date&maxResults=50'; |
| 3742 | } |
| 3743 | |
| 3744 | $transient_name = sprintf( 'pa_videos_%s_%s', $source, $widget_id ); |
| 3745 | |
| 3746 | $response_json = get_transient( $transient_name ); |
| 3747 | |
| 3748 | if ( false === $response_json ) { |
| 3749 | |
| 3750 | $api_response = wp_remote_get( $api_url ); |
| 3751 | |
| 3752 | $response_json = wp_remote_retrieve_body( $api_response ); |
| 3753 | $response_json = json_decode( $response_json ); |
| 3754 | |
| 3755 | $transient = $settings['reload']; |
| 3756 | |
| 3757 | $expire_time = Helper_Functions::transient_expire( $transient ); |
| 3758 | |
| 3759 | if ( isset( $response_json->items ) ) { |
| 3760 | set_transient( $transient_name, $response_json, $expire_time ); |
| 3761 | } |
| 3762 | } |
| 3763 | |
| 3764 | $playlist_videos = isset( $response_json->items ) ? $response_json->items : ''; |
| 3765 | |
| 3766 | if ( empty( $playlist_videos ) ) { |
| 3767 | ?> |
| 3768 | <div class="premium-error-notice"> |
| 3769 | <?php echo esc_html__( 'Something went wrong. It seems like the playlist you selected does not have any videos', 'premium-addons-for-elementor' ); ?> |
| 3770 | </div> |
| 3771 | <?php |
| 3772 | return false; |
| 3773 | } |
| 3774 | |
| 3775 | $this->render_grid_youtube_playlist( $playlist_videos ); |
| 3776 | } |
| 3777 | |
| 3778 | /** |
| 3779 | * Update Controls |
| 3780 | * |
| 3781 | * @since 4.9.58 |
| 3782 | * @access private |
| 3783 | */ |
| 3784 | private function update_controls() { |
| 3785 | |
| 3786 | $this->update_responsive_control( |
| 3787 | 'premium_video_box_image_border_radius', |
| 3788 | array( |
| 3789 | 'type' => Controls_Manager::DIMENSIONS, |
| 3790 | 'selectors' => array( |
| 3791 | '{{WRAPPER}} .premium-video-box-image-container, {{WRAPPER}} .premium-video-box-video-container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 3792 | ), |
| 3793 | 'condition' => array( |
| 3794 | 'adv_radius!' => 'yes', |
| 3795 | ), |
| 3796 | |
| 3797 | ) |
| 3798 | ); |
| 3799 | } |
| 3800 | } |
| 3801 |