dep
5 years ago
premium-banner.php
5 years ago
premium-blog.php
5 years ago
premium-button.php
5 years ago
premium-carousel.php
5 years ago
premium-contactform.php
5 years ago
premium-countdown.php
5 years ago
premium-counter.php
5 years ago
premium-dual-header.php
5 years ago
premium-fancytext.php
5 years ago
premium-grid.php
5 years ago
premium-icon-list.php
5 years ago
premium-image-button.php
5 years ago
premium-image-scroll.php
5 years ago
premium-image-separator.php
5 years ago
premium-lottie.php
5 years ago
premium-maps.php
5 years ago
premium-modalbox.php
5 years ago
premium-person.php
5 years ago
premium-pricing-table.php
5 years ago
premium-progressbar.php
5 years ago
premium-testimonials.php
5 years ago
premium-title.php
5 years ago
premium-videobox.php
5 years ago
premium-vscroll.php
5 years ago
premium-videobox.php
2427 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Premium Video Box. |
| 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\Scheme_Color; |
| 16 | use Elementor\Scheme_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 | use Elementor\Group_Control_Background; |
| 22 | |
| 23 | // PremiumAddons Classes. |
| 24 | use PremiumAddons\Admin\Includes\Admin_Helper; |
| 25 | use PremiumAddons\Includes\Helper_Functions; |
| 26 | |
| 27 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 28 | |
| 29 | /** |
| 30 | * Class Premium_Videobox |
| 31 | */ |
| 32 | class Premium_Videobox extends Widget_Base { |
| 33 | |
| 34 | public function get_name() { |
| 35 | return 'premium-addon-video-box'; |
| 36 | } |
| 37 | |
| 38 | public function get_title() { |
| 39 | return sprintf( '%1$s %2$s', Helper_Functions::get_prefix(), __('Video Box', 'premium-addons-for-elementor') ); |
| 40 | } |
| 41 | |
| 42 | public function get_icon() { |
| 43 | return 'pa-video-box'; |
| 44 | } |
| 45 | |
| 46 | public function get_categories() { |
| 47 | return [ 'premium-elements' ]; |
| 48 | } |
| 49 | |
| 50 | public function get_style_depends() { |
| 51 | return [ |
| 52 | // 'font-awesome', |
| 53 | 'premium-addons' |
| 54 | ]; |
| 55 | } |
| 56 | |
| 57 | public function get_script_depends() { |
| 58 | return [ |
| 59 | 'elementor-waypoints', |
| 60 | 'premium-addons' |
| 61 | ]; |
| 62 | } |
| 63 | |
| 64 | public function get_keywords() { |
| 65 | return ['youtube', 'vimeo', 'self', 'hosted', 'media']; |
| 66 | } |
| 67 | |
| 68 | public function get_custom_help_url() { |
| 69 | return 'https://premiumaddons.com/support/'; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Register Video Box controls. |
| 74 | * |
| 75 | * @since 1.0.0 |
| 76 | * @access protected |
| 77 | */ |
| 78 | protected function _register_controls() { |
| 79 | |
| 80 | $this->start_controls_section('premium_video_box_general_settings', |
| 81 | [ |
| 82 | 'label' => __('Video Box', 'premium-addons-for-elementor'), |
| 83 | ] |
| 84 | ); |
| 85 | |
| 86 | $this->add_control('premium_video_box_video_type', |
| 87 | [ |
| 88 | 'label' => __('Video Type', 'premium-addons-for-elementor'), |
| 89 | 'type' => Controls_Manager::SELECT, |
| 90 | 'default' => 'youtube', |
| 91 | 'options' => [ |
| 92 | 'youtube' => __('Youtube', 'premium-addons-for-elementor'), |
| 93 | 'vimeo' => __('Vimeo', 'premium-addons-for-elementor'), |
| 94 | 'self' => __('Self Hosted', 'premium-addons-for-elementor'), |
| 95 | ] |
| 96 | ] |
| 97 | ); |
| 98 | |
| 99 | $this->add_control('premium_video_box_video_id_embed_selection', |
| 100 | [ |
| 101 | 'label' => __('Link', 'premium-addons-for-elementor'), |
| 102 | 'type' => Controls_Manager::HIDDEN, |
| 103 | 'default' => 'id', |
| 104 | 'options' => [ |
| 105 | 'id' => __('ID', 'premium-addons-for-elementor'), |
| 106 | 'embed' => __('Embed URL', 'premium-addons-for-elementor'), |
| 107 | ], |
| 108 | 'condition' => [ |
| 109 | 'premium_video_box_video_type!' => 'self', |
| 110 | ] |
| 111 | ] |
| 112 | ); |
| 113 | |
| 114 | $this->add_control('premium_video_box_video_id', |
| 115 | [ |
| 116 | 'label' => __('Video ID', 'premium-addons-for-elementor'), |
| 117 | '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'), |
| 118 | 'type' => Controls_Manager::HIDDEN, |
| 119 | 'condition' => [ |
| 120 | 'premium_video_box_video_type!' => 'self', |
| 121 | 'premium_video_box_video_id_embed_selection' => 'id', |
| 122 | ] |
| 123 | ] |
| 124 | ); |
| 125 | |
| 126 | $this->add_control('premium_video_box_video_embed', |
| 127 | [ |
| 128 | 'label' => __('Embed URL', 'premium-addons-for-elementor'), |
| 129 | 'description' => __('Enter your YouTube/Vimeo video link. For example, https://www.youtube.com/embed/z1hQgVpfTKU', 'premium-addons-for-elementor'), |
| 130 | 'type' => Controls_Manager::HIDDEN, |
| 131 | 'condition' => [ |
| 132 | 'premium_video_box_video_type!' => 'self', |
| 133 | 'premium_video_box_video_id_embed_selection' => 'embed', |
| 134 | ] |
| 135 | ] |
| 136 | ); |
| 137 | |
| 138 | $this->add_control('youtube_list', |
| 139 | [ |
| 140 | 'label' => __('Get Videos From Channel/Playlist', 'premium-addons-for-elementor'), |
| 141 | 'type' => Controls_Manager::SWITCHER, |
| 142 | 'condition' => [ |
| 143 | 'premium_video_box_video_type' => 'youtube' |
| 144 | ] |
| 145 | ] |
| 146 | ); |
| 147 | |
| 148 | $this->add_control('premium_video_box_link', |
| 149 | [ |
| 150 | 'label' => __('Link', 'premium-addons-for-elementor'), |
| 151 | 'type' => Controls_Manager::TEXT, |
| 152 | 'label_block' => true, |
| 153 | 'default' => 'https://www.youtube.com/watch?v=07d2dXHYb94', |
| 154 | 'dynamic' => [ |
| 155 | 'active' => true, |
| 156 | 'categories' => [ |
| 157 | TagsModule::POST_META_CATEGORY, |
| 158 | TagsModule::URL_CATEGORY |
| 159 | ] |
| 160 | ], |
| 161 | 'conditions' => [ |
| 162 | 'terms' => [ |
| 163 | [ |
| 164 | 'relation' => 'or', |
| 165 | 'terms' => [ |
| 166 | [ |
| 167 | 'name' => 'premium_video_box_video_type', |
| 168 | 'value' => 'vimeo' |
| 169 | ], |
| 170 | [ |
| 171 | 'relation' => 'and', |
| 172 | 'terms' => [ |
| 173 | [ |
| 174 | 'name' => 'premium_video_box_video_type', |
| 175 | 'value' => 'youtube' |
| 176 | ], |
| 177 | [ |
| 178 | 'name' => 'youtube_list', |
| 179 | 'value' => '' |
| 180 | ] |
| 181 | ], |
| 182 | ] |
| 183 | ], |
| 184 | ] |
| 185 | ] |
| 186 | ], |
| 187 | ] |
| 188 | ); |
| 189 | |
| 190 | $this->add_responsive_control('source', |
| 191 | [ |
| 192 | 'label' => __('Source', 'premium-addons-for-elementor'), |
| 193 | 'type' => Controls_Manager::SELECT, |
| 194 | 'options' => [ |
| 195 | 'playlist' => __('Playlist', 'premium-addons-for-elementor'), |
| 196 | 'channel' => __('Channel', 'premium-addons-for-elementor'), |
| 197 | ], |
| 198 | 'default' => 'playlist', |
| 199 | 'condition' => [ |
| 200 | 'premium_video_box_video_type' => 'youtube', |
| 201 | 'youtube_list' => 'yes' |
| 202 | ] |
| 203 | ] |
| 204 | ); |
| 205 | |
| 206 | $this->add_control('playlist_id', |
| 207 | [ |
| 208 | 'label' => __('Playlist ID', 'premium-addons-for-elementor'), |
| 209 | 'type' => Controls_Manager::TEXT, |
| 210 | 'default' => 'PLLpZVOYpMtTArB4hrlpSnDJB36D2sdoTv', |
| 211 | 'label_block' => true, |
| 212 | 'dynamic' => [ 'active' => true ], |
| 213 | 'description' => 'Click <a href="https://www.sociablekit.com/find-youtube-playlist-id/" target="_blank">here</a> to get your playlist ID', |
| 214 | 'condition' => [ |
| 215 | 'premium_video_box_video_type' => 'youtube', |
| 216 | 'youtube_list' => 'yes', |
| 217 | 'source' => 'playlist' |
| 218 | ] |
| 219 | ] |
| 220 | ); |
| 221 | |
| 222 | $this->add_control('channel_id', |
| 223 | [ |
| 224 | 'label' => __('Channel ID', 'premium-addons-for-elementor'), |
| 225 | 'type' => Controls_Manager::TEXT, |
| 226 | 'default' => 'UCXcJ9BeO2sKKHor7Q9VglTQ', |
| 227 | 'label_block' => true, |
| 228 | 'dynamic' => [ 'active' => true ], |
| 229 | 'description' => 'Click <a href="https://www.sociablekit.com/find-youtube-playlist-id/" target="_blank">here</a> to get your playlist ID', |
| 230 | 'condition' => [ |
| 231 | 'premium_video_box_video_type' => 'youtube', |
| 232 | 'youtube_list' => 'yes', |
| 233 | 'source' => 'channel' |
| 234 | ] |
| 235 | ] |
| 236 | ); |
| 237 | |
| 238 | $this->add_responsive_control('video_columns', |
| 239 | [ |
| 240 | 'label' => __('Videos/Row', 'premium-addons-for-elementor'), |
| 241 | 'type' => Controls_Manager::SELECT, |
| 242 | 'options' => [ |
| 243 | '100%' => __('1 Column', 'premium-addons-for-elementor'), |
| 244 | '50%' => __('2 Columns', 'premium-addons-for-elementor'), |
| 245 | '33.33%' => __('3 Columns', 'premium-addons-for-elementor'), |
| 246 | '25%' => __('4 Columns', 'premium-addons-for-elementor'), |
| 247 | '20%' => __('5 Columns', 'premium-addons-for-elementor'), |
| 248 | '16.667%'=> __('6 Columns', 'premium-addons-for-elementor'), |
| 249 | ], |
| 250 | 'desktop_default' => '50%', |
| 251 | 'tablet_default' => '50%', |
| 252 | 'mobile_default' => '100%', |
| 253 | 'render_type' => 'template', |
| 254 | 'selectors' => [ |
| 255 | '{{WRAPPER}} .premium-video-box-container' => 'width: {{VALUE}}' |
| 256 | ], |
| 257 | 'condition' => [ |
| 258 | 'premium_video_box_video_type' => 'youtube', |
| 259 | 'youtube_list' => 'yes' |
| 260 | ] |
| 261 | ] |
| 262 | ); |
| 263 | |
| 264 | $this->add_control('limit_num', |
| 265 | [ |
| 266 | 'label' => __( 'Number of Videos', 'premium-addons-for-elementor' ), |
| 267 | 'type' => Controls_Manager::NUMBER, |
| 268 | 'min' => 0, |
| 269 | 'default' => 6, |
| 270 | 'description' => __( 'Set a number of videos to retrieve', 'premium-addons-for-elementor' ), |
| 271 | 'condition' => [ |
| 272 | 'premium_video_box_video_type' => 'youtube', |
| 273 | 'youtube_list' => 'yes' |
| 274 | ], |
| 275 | ] |
| 276 | ); |
| 277 | |
| 278 | $this->add_control('featured_video', |
| 279 | [ |
| 280 | 'label' => __('Featured The First Video', 'premium-addons-for-elementor'), |
| 281 | 'type' => Controls_Manager::SWITCHER, |
| 282 | 'condition' => [ |
| 283 | 'premium_video_box_video_type' => 'youtube', |
| 284 | 'youtube_list' => 'yes', |
| 285 | ], |
| 286 | 'selectors' => [ |
| 287 | '{{WRAPPER}} .premium-video-box-container:first-of-type' => 'width: 100%' |
| 288 | ], |
| 289 | ] |
| 290 | ); |
| 291 | |
| 292 | $this->add_control('premium_video_box_self_hosted', |
| 293 | [ |
| 294 | 'label' => __('URL', 'premium-addons-for-elementor'), |
| 295 | 'type' => Controls_Manager::MEDIA, |
| 296 | 'dynamic' => [ |
| 297 | 'active' => true, |
| 298 | 'categories' => [ |
| 299 | TagsModule::POST_META_CATEGORY, |
| 300 | TagsModule::URL_CATEGORY, |
| 301 | ], |
| 302 | ], |
| 303 | 'media_type' => 'video', |
| 304 | 'condition' => [ |
| 305 | 'premium_video_box_video_type' => 'self', |
| 306 | ] |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $this->add_control('premium_video_box_self_hosted_remote', |
| 311 | [ |
| 312 | 'label' => __('Remote Video URL', 'premium-addons-for-elementor'), |
| 313 | 'type' => Controls_Manager::TEXT, |
| 314 | 'dynamic' => [ |
| 315 | 'active' => true, |
| 316 | ], |
| 317 | 'label_block' => true, |
| 318 | 'condition' => [ |
| 319 | 'premium_video_box_video_type' => 'self', |
| 320 | ] |
| 321 | ] |
| 322 | ); |
| 323 | |
| 324 | $playlist_condition = [ |
| 325 | 'relation' => 'or', |
| 326 | 'terms' => [ |
| 327 | [ |
| 328 | 'name' => 'premium_video_box_video_type', |
| 329 | 'operator' => '!==', |
| 330 | 'value' => 'youtube' |
| 331 | ], |
| 332 | [ |
| 333 | 'name' => 'youtube_list', |
| 334 | 'value' => '' |
| 335 | ], |
| 336 | ], |
| 337 | ]; |
| 338 | |
| 339 | $this->add_control('premium_video_box_controls', |
| 340 | [ |
| 341 | 'label' => __('Player Controls', 'premium-addons-for-elementor'), |
| 342 | 'type' => Controls_Manager::SWITCHER, |
| 343 | 'description' => __('Show/hide player controls', 'premium-addons-for-elementor'), |
| 344 | 'default' => 'yes', |
| 345 | 'conditions' => [ |
| 346 | 'terms' => [ |
| 347 | $playlist_condition |
| 348 | ] |
| 349 | ] |
| 350 | ] |
| 351 | ); |
| 352 | |
| 353 | $this->add_control('premium_video_box_mute', |
| 354 | [ |
| 355 | 'label' => __('Mute', 'premium-addons-for-elementor'), |
| 356 | 'type' => Controls_Manager::SWITCHER, |
| 357 | 'description' => __('This will play the video muted', 'premium-addons-for-elementor') |
| 358 | ] |
| 359 | ); |
| 360 | |
| 361 | $this->add_control('premium_video_box_self_autoplay', |
| 362 | [ |
| 363 | 'label' => __('Autoplay', 'premium-addons-for-elementor'), |
| 364 | 'type' => Controls_Manager::SWITCHER, |
| 365 | 'conditions' => [ |
| 366 | 'terms' => [ |
| 367 | $playlist_condition |
| 368 | ] |
| 369 | ] |
| 370 | ] |
| 371 | ); |
| 372 | |
| 373 | $this->add_control('autoplay_viewport', |
| 374 | [ |
| 375 | 'label' => __('Autoplay On Viewport', 'premium-addons-for-elementor'), |
| 376 | 'type' => Controls_Manager::SWITCHER, |
| 377 | 'conditions' => [ |
| 378 | 'terms' => [ |
| 379 | [ |
| 380 | 'name' => 'premium_video_box_self_autoplay', |
| 381 | 'value' => 'yes' |
| 382 | ], |
| 383 | $playlist_condition |
| 384 | ] |
| 385 | ] |
| 386 | ] |
| 387 | ); |
| 388 | |
| 389 | $this->add_control('autoplay_notice', |
| 390 | [ |
| 391 | 'raw' => __( 'Please note that autoplay option works only when Overlay option is disabled', 'premium-addons-for-elementor' ), |
| 392 | 'type' => Controls_Manager::RAW_HTML, |
| 393 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 394 | 'conditions' => [ |
| 395 | 'terms' => [ |
| 396 | [ |
| 397 | 'name' => 'premium_video_box_self_autoplay', |
| 398 | 'value' => 'yes' |
| 399 | ], |
| 400 | $playlist_condition |
| 401 | ] |
| 402 | ] |
| 403 | ] |
| 404 | ); |
| 405 | |
| 406 | $this->add_control('premium_video_box_loop', |
| 407 | [ |
| 408 | 'label' => __('Loop', 'premium-addons-for-elementor'), |
| 409 | 'type' => Controls_Manager::SWITCHER, |
| 410 | 'condition' => [ |
| 411 | 'youtube_list!' => 'yes' |
| 412 | ] |
| 413 | ] |
| 414 | ); |
| 415 | |
| 416 | $this->add_control('download_button', |
| 417 | [ |
| 418 | 'label' => __('Download Button', 'premium-addons-for-elementor'), |
| 419 | 'type' => Controls_Manager::SWITCHER, |
| 420 | 'condition' => [ |
| 421 | 'premium_video_box_video_type' => 'self', |
| 422 | ] |
| 423 | ] |
| 424 | ); |
| 425 | |
| 426 | |
| 427 | $this->add_control('premium_video_box_sticky_switcher', |
| 428 | [ |
| 429 | 'label' => __('Sticky', 'premium-addons-for-elementor'), |
| 430 | 'type' => Controls_Manager::SWITCHER, |
| 431 | 'render_type' =>'template', |
| 432 | 'separator' => 'before', |
| 433 | 'conditions' => [ |
| 434 | 'terms' => [ |
| 435 | $playlist_condition |
| 436 | ] |
| 437 | ] |
| 438 | ] |
| 439 | ); |
| 440 | |
| 441 | $sticky_condition = [ |
| 442 | 'terms' => [ |
| 443 | [ |
| 444 | 'name' => 'premium_video_box_sticky_switcher', |
| 445 | 'value' => 'yes' |
| 446 | ], |
| 447 | $playlist_condition |
| 448 | ] |
| 449 | ]; |
| 450 | |
| 451 | $this->add_control('premium_video_box_sticky_on_play', |
| 452 | [ |
| 453 | 'label' => __('Sticky Only After Played', 'premium-addons-for-elementor'), |
| 454 | 'type' => Controls_Manager::SWITCHER, |
| 455 | 'render_type' =>'template', |
| 456 | 'conditions' => [ |
| 457 | 'terms' => [ |
| 458 | $sticky_condition |
| 459 | ] |
| 460 | ] |
| 461 | ] |
| 462 | ); |
| 463 | |
| 464 | $this->add_control('premium_video_box_sticky_position', |
| 465 | [ |
| 466 | 'label' => __( 'Position', 'premium-addons-for-elementor' ), |
| 467 | 'type' => Controls_Manager::SELECT, |
| 468 | 'options' => [ |
| 469 | 'top-left' => __( 'Top Left', 'premium-addons-for-elementor' ), |
| 470 | 'top-right' => __( 'Top Right', 'premium-addons-for-elementor' ), |
| 471 | 'bottom-left' => __( 'Bottom Left', 'premium-addons-for-elementor' ), |
| 472 | 'bottom-right' => __( 'Bottom Right', 'premium-addons-for-elementor' ), |
| 473 | 'center-left' => __( 'Center Left', 'premium-addons-for-elementor' ), |
| 474 | 'center-right' => __( 'Center Right', 'premium-addons-for-elementor' ), |
| 475 | ], |
| 476 | 'default' => 'bottom-left', |
| 477 | 'conditions' => $sticky_condition, |
| 478 | 'prefix_class' => 'premium-video-sticky-', |
| 479 | 'render_type' => 'template', |
| 480 | ] |
| 481 | ); |
| 482 | |
| 483 | $this->add_control('premium_video_box_sticky_hide', |
| 484 | [ |
| 485 | 'label' => __( 'Disable Sticky On', 'premium-addons-for-elementor' ), |
| 486 | 'type' => Controls_Manager::SELECT2, |
| 487 | 'multiple' => true, |
| 488 | 'label_block' => true, |
| 489 | 'options' => [ |
| 490 | 'desktop' => __( 'Desktop', 'premium-addons-for-elementor' ), |
| 491 | 'tablet' => __( 'Tablet', 'premium-addons-for-elementor' ), |
| 492 | 'mobile' => __( 'Mobile', 'premium-addons-for-elementor' ), |
| 493 | ], |
| 494 | 'conditions' => $sticky_condition, |
| 495 | 'render_type' => 'template', |
| 496 | 'frontend_available' => true, |
| 497 | ] |
| 498 | ); |
| 499 | |
| 500 | $this->add_control('premium_video_box_animation', |
| 501 | [ |
| 502 | 'label' => __( 'Entrance Animation', 'premium-addons-for-elementor' ), |
| 503 | 'type' => Controls_Manager::ANIMATION, |
| 504 | 'label_block' => true, |
| 505 | 'frontend_available' => true, |
| 506 | 'render_type' => 'template', |
| 507 | 'conditions' => $sticky_condition, |
| 508 | ] |
| 509 | ); |
| 510 | |
| 511 | $this->add_control('premium_video_box_animation_duration', |
| 512 | [ |
| 513 | 'label' => __( 'Animation Duration', 'premium-addons-for-elementor' ), |
| 514 | 'type' => Controls_Manager::SELECT, |
| 515 | 'default' => '', |
| 516 | 'options' => [ |
| 517 | 'slow' => __( 'Slow', 'premium-addons-for-elementor' ), |
| 518 | '' => __( 'Normal', 'premium-addons-for-elementor' ), |
| 519 | 'fast' => __( 'Fast', 'premium-addons-for-elementor' ), |
| 520 | ], |
| 521 | 'conditions' => [ |
| 522 | 'terms' => [ |
| 523 | [ |
| 524 | 'name' => 'premium_video_box_animation', |
| 525 | 'operator' => '!==', |
| 526 | 'value' => '' |
| 527 | ], |
| 528 | [ |
| 529 | 'name' => 'premium_video_box_sticky_switcher', |
| 530 | 'value' => 'yes' |
| 531 | ], |
| 532 | $playlist_condition |
| 533 | ] |
| 534 | ], |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->add_control('premium_video_box_animation_delay', |
| 539 | [ |
| 540 | 'label' => __( 'Animation Delay', 'premium-addons-for-elementor' ) . ' (s)', |
| 541 | 'type' => Controls_Manager::NUMBER, |
| 542 | 'default' => '', |
| 543 | 'step' => 0.1, |
| 544 | 'conditions' => [ |
| 545 | 'terms' => [ |
| 546 | [ |
| 547 | 'name' => 'premium_video_box_animation', |
| 548 | 'operator' => '!==', |
| 549 | 'value' => '' |
| 550 | ], |
| 551 | [ |
| 552 | 'name' => 'premium_video_box_sticky_switcher', |
| 553 | 'value' => 'yes' |
| 554 | ], |
| 555 | $playlist_condition |
| 556 | ] |
| 557 | ], |
| 558 | 'frontend_available' => true, |
| 559 | ] |
| 560 | ); |
| 561 | |
| 562 | $this->add_control('sticky_info_bar_switch', |
| 563 | [ |
| 564 | 'label' => __( 'Info Section', 'premium-addons-for-elementor' ), |
| 565 | 'type' => Controls_Manager::SWITCHER, |
| 566 | 'conditions' => $sticky_condition, |
| 567 | ] |
| 568 | ); |
| 569 | |
| 570 | $this->add_control('sticky_info_bar_text', |
| 571 | [ |
| 572 | 'label' => __( 'Text', 'premium-addons-for-elementor' ), |
| 573 | 'type' => Controls_Manager::TEXTAREA, |
| 574 | 'default' => __('Watching: Sticky Video', 'premium-addons-for-elementor'), |
| 575 | 'rows' => 2, |
| 576 | 'dynamic' => [ |
| 577 | 'active' => true, |
| 578 | ], |
| 579 | 'conditions' => |
| 580 | [ |
| 581 | 'terms' => [ |
| 582 | [ |
| 583 | 'name' => 'premium_video_box_sticky_switcher', |
| 584 | 'value' => 'yes' |
| 585 | ], |
| 586 | [ |
| 587 | 'name' => 'sticky_info_bar_switch', |
| 588 | 'value' => 'yes' |
| 589 | ], |
| 590 | $playlist_condition |
| 591 | ] |
| 592 | ] |
| 593 | ] |
| 594 | ); |
| 595 | |
| 596 | $this->add_control('premium_video_box_start', |
| 597 | [ |
| 598 | 'label' => __( 'Start Time', 'premium-addons-for-elementor' ), |
| 599 | 'type' => Controls_Manager::NUMBER, |
| 600 | 'separator' => 'before', |
| 601 | 'description'=> __( 'Specify a start time (in seconds)', 'premium-addons-for-elementor' ), |
| 602 | 'condition' => [ |
| 603 | 'premium_video_box_video_type!' => 'vimeo' |
| 604 | ] |
| 605 | ] |
| 606 | ); |
| 607 | |
| 608 | $this->add_control('premium_video_box_end', |
| 609 | [ |
| 610 | 'label' => __( 'End Time', 'premium-addons-for-elementor' ), |
| 611 | 'type' => Controls_Manager::NUMBER, |
| 612 | 'description' => __( 'Specify an end time (in seconds)', 'premium-addons-for-elementor' ), |
| 613 | 'separator' => 'after', |
| 614 | 'condition' => [ |
| 615 | 'premium_video_box_video_type!' => 'vimeo' |
| 616 | ] |
| 617 | ] |
| 618 | ); |
| 619 | |
| 620 | $this->add_control('premium_video_box_suggested_videos', |
| 621 | [ |
| 622 | 'label' => __('Suggested Videos From', 'premium-addons-for-elementor'), |
| 623 | 'type' => Controls_Manager::SELECT, |
| 624 | 'options' => [ |
| 625 | '' => __('Current Channel', 'premium-addons-for-elementor'), |
| 626 | 'yes' => __('Any Channel', 'premium-addons-for-elementor') |
| 627 | ], |
| 628 | 'condition' => [ |
| 629 | 'premium_video_box_video_type' => 'youtube', |
| 630 | ] |
| 631 | ] |
| 632 | ); |
| 633 | |
| 634 | $this->add_control('vimeo_controls_color', |
| 635 | [ |
| 636 | 'label' => __( 'Controls Color', 'premium-addons-for-elementor' ), |
| 637 | 'type' => Controls_Manager::COLOR, |
| 638 | 'selectors' => [ |
| 639 | '{{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}}', |
| 640 | ], |
| 641 | 'render_type'=> 'template', |
| 642 | 'condition' => [ |
| 643 | 'premium_video_box_video_type' => 'vimeo', |
| 644 | ], |
| 645 | ] |
| 646 | ); |
| 647 | |
| 648 | $this->add_control('vimeo_title', |
| 649 | [ |
| 650 | 'label' => __( 'Intro Title', 'elementor' ), |
| 651 | 'type' => Controls_Manager::SWITCHER, |
| 652 | 'label_on' => __( 'Show', 'elementor' ), |
| 653 | 'label_off' => __( 'Hide', 'elementor' ), |
| 654 | 'default' => 'yes', |
| 655 | 'condition' => [ |
| 656 | 'premium_video_box_video_type' => 'vimeo', |
| 657 | ], |
| 658 | ] |
| 659 | ); |
| 660 | |
| 661 | $this->add_control('vimeo_portrait', |
| 662 | [ |
| 663 | 'label' => __( 'Intro Portrait', 'elementor' ), |
| 664 | 'type' => Controls_Manager::SWITCHER, |
| 665 | 'label_on' => __( 'Show', 'elementor' ), |
| 666 | 'label_off' => __( 'Hide', 'elementor' ), |
| 667 | 'default' => 'yes', |
| 668 | 'condition' => [ |
| 669 | 'premium_video_box_video_type' => 'vimeo', |
| 670 | ], |
| 671 | ] |
| 672 | ); |
| 673 | |
| 674 | $this->add_control('vimeo_byline', |
| 675 | [ |
| 676 | 'label' => __( 'Intro Byline', 'elementor' ), |
| 677 | 'type' => Controls_Manager::SWITCHER, |
| 678 | 'label_on' => __( 'Show', 'elementor' ), |
| 679 | 'label_off' => __( 'Hide', 'elementor' ), |
| 680 | 'default' => 'yes', |
| 681 | 'condition' => [ |
| 682 | 'premium_video_box_video_type' => 'vimeo', |
| 683 | ], |
| 684 | ] |
| 685 | ); |
| 686 | |
| 687 | $this->add_control('aspect_ratio', |
| 688 | [ |
| 689 | 'label' => __( 'Aspect Ratio', 'premium-addons-for-elementor' ), |
| 690 | 'type' => Controls_Manager::SELECT, |
| 691 | 'options' => [ |
| 692 | '11' => '1:1', |
| 693 | '169' => '16:9', |
| 694 | '43' => '4:3', |
| 695 | '32' => '3:2', |
| 696 | '219' => '21:9', |
| 697 | '916' => '9:16', |
| 698 | ], |
| 699 | 'default' => '169', |
| 700 | 'prefix_class' => 'pa-aspect-ratio-', |
| 701 | 'frontend_available' => true, |
| 702 | ] |
| 703 | ); |
| 704 | |
| 705 | $this->add_responsive_control('premium_video_box_video_height', |
| 706 | [ |
| 707 | 'label' => __('Video Height (%)', 'premium-addons-for-elementor'), |
| 708 | 'type' => Controls_Manager::SLIDER, |
| 709 | 'render_type' => 'template', |
| 710 | 'condition' => [ |
| 711 | 'youtube_list' => 'yes', |
| 712 | 'premium_video_box_video_type' => 'youtube', |
| 713 | ], |
| 714 | 'selectors' => [ |
| 715 | '{{WRAPPER}} .premium-video-box-container > div' => 'padding-bottom: {{SIZE}}%;', |
| 716 | ] |
| 717 | |
| 718 | ] |
| 719 | ); |
| 720 | |
| 721 | $this->add_control('premium_video_box_image_switcher', |
| 722 | [ |
| 723 | 'label' => __('Overlay', 'premium-addons-for-elementor'), |
| 724 | 'type' => Controls_Manager::SWITCHER, |
| 725 | 'default' => 'yes', |
| 726 | 'conditions' => [ |
| 727 | 'terms' => [ |
| 728 | $playlist_condition |
| 729 | ] |
| 730 | ] |
| 731 | ] |
| 732 | ); |
| 733 | |
| 734 | $this->add_control('premium_video_box_yt_thumbnail_size', |
| 735 | [ |
| 736 | 'label' => __( 'Thumbnail Size', 'premium-addons-for-elementor' ), |
| 737 | 'type' => Controls_Manager::SELECT, |
| 738 | 'options' => [ |
| 739 | 'maxresdefault' => __( 'Maximum Resolution', 'premium-addons-for-elementor' ), |
| 740 | 'hqdefault' => __( 'High Quality', 'premium-addons-for-elementor' ), |
| 741 | 'mqdefault' => __( 'Medium Quality', 'premium-addons-for-elementor' ), |
| 742 | 'sddefault' => __( 'Standard Quality', 'premium-addons-for-elementor' ), |
| 743 | ], |
| 744 | 'default' => 'maxresdefault', |
| 745 | 'conditions'=> [ |
| 746 | 'terms' => [ |
| 747 | [ |
| 748 | 'name' => 'premium_video_box_video_type', |
| 749 | 'value' => 'youtube', |
| 750 | ], |
| 751 | [ |
| 752 | 'relation' => 'or', |
| 753 | 'terms' => [ |
| 754 | [ |
| 755 | 'name' => 'premium_video_box_image_switcher', |
| 756 | 'value' => '' |
| 757 | ], |
| 758 | [ |
| 759 | 'name' => 'youtube_list', |
| 760 | 'value' => 'yes' |
| 761 | ] |
| 762 | ], |
| 763 | ] |
| 764 | ] |
| 765 | ], |
| 766 | 'render_type'=> 'template' |
| 767 | ] |
| 768 | ); |
| 769 | |
| 770 | $this->add_control('premium_video_box_img_effect', |
| 771 | [ |
| 772 | 'label' => __('Hover Effect', 'premium-addons-for-elementor'), |
| 773 | 'type' => Controls_Manager::SELECT, |
| 774 | 'description' => __('Choose a hover effect for the image','premium-addons-for-elementor'), |
| 775 | 'options' => [ |
| 776 | 'none' => __('None', 'premium-addons-for-elementor'), |
| 777 | 'zoomin' => __('Zoom In', 'premium-addons-for-elementor'), |
| 778 | 'zoomout' => __('Zoom Out', 'premium-addons-for-elementor'), |
| 779 | 'scale' => __('Scale', 'premium-addons-for-elementor'), |
| 780 | 'gray' => __('Grayscale', 'premium-addons-for-elementor'), |
| 781 | 'blur' => __('Blur', 'premium-addons-for-elementor'), |
| 782 | 'bright' => __('Bright', 'premium-addons-for-elementor'), |
| 783 | 'sepia' => __('Sepia', 'premium-addons-for-elementor'), |
| 784 | 'trans' => __('Translate', 'premium-addons-for-elementor'), |
| 785 | ], |
| 786 | 'default' => 'none', |
| 787 | 'label_block' => true, |
| 788 | ] |
| 789 | ); |
| 790 | |
| 791 | $this->add_control('mask_video_box_switcher', |
| 792 | [ |
| 793 | 'label' => esc_html__( 'Mask Video Shape', 'premium-addons-for-elementor' ), |
| 794 | 'type' => Controls_Manager::SWITCHER, |
| 795 | 'separator' => 'before', |
| 796 | ] |
| 797 | ); |
| 798 | |
| 799 | $this->add_control('mask_shape_video_box', |
| 800 | [ |
| 801 | 'label' => esc_html__( 'Mask Image', 'premium-addons-for-elementor' ), |
| 802 | 'type' => Controls_Manager::MEDIA, |
| 803 | 'default' => [ |
| 804 | 'url' => '', |
| 805 | ], |
| 806 | 'description'=> __( 'Use PNG image with the shape you want to mask around feature video.', 'premium-addons-for-elementor' ), |
| 807 | 'selectors' => [ |
| 808 | '{{WRAPPER}} .premium-video-box-mask-media ' => 'mask-image: url("{{URL}}");-webkit-mask-image: url("{{URL}}")', |
| 809 | ], |
| 810 | 'condition' => [ |
| 811 | 'mask_video_box_switcher' => 'yes', |
| 812 | ], |
| 813 | ] |
| 814 | ); |
| 815 | |
| 816 | $this->add_control('mask_size', |
| 817 | [ |
| 818 | 'label' => __( 'Mask Size', 'premium-addons-for-elementor' ), |
| 819 | 'type' => Controls_Manager::SELECT, |
| 820 | 'options' => [ |
| 821 | 'contain' => __( 'Contain', 'premium-addons-for-elementor' ), |
| 822 | 'cover' => __( 'Cover', 'premium-addons-for-elementor' ) |
| 823 | ], |
| 824 | 'default' => 'contain', |
| 825 | 'selectors' => [ |
| 826 | '{{WRAPPER}} .premium-video-box-mask-media' => 'mask-size: {{VALUE}};-webkit-mask-size: {{VALUE}};', |
| 827 | ], |
| 828 | 'condition' => [ |
| 829 | 'mask_video_box_switcher' => 'yes', |
| 830 | ], |
| 831 | ] |
| 832 | ); |
| 833 | |
| 834 | $this->add_control('mask_position_cover', |
| 835 | [ |
| 836 | 'label' => __( 'Mask Position', 'premium-addons-for-elementor' ), |
| 837 | 'type' => Controls_Manager::SELECT, |
| 838 | 'options' => [ |
| 839 | 'center center' => __( 'Center Center','premium-addons-pro' ), |
| 840 | 'center left' => __( 'Center Left', 'premium-addons-pro' ), |
| 841 | 'center right' => __( 'Center Right', 'premium-addons-pro' ), |
| 842 | 'top center' => __( 'Top Center', 'premium-addons-pro' ), |
| 843 | 'top left' => __( 'Top Left', 'premium-addons-pro' ), |
| 844 | 'top right' => __( 'Top Right', 'premium-addons-pro' ), |
| 845 | 'bottom center' => __( 'Bottom Center', 'premium-addons-pro' ), |
| 846 | 'bottom left' => __( 'Bottom Left', 'premium-addons-pro' ), |
| 847 | 'bottom right' => __( 'Bottom Right', 'premium-addons-pro' ), |
| 848 | ], |
| 849 | 'default' => 'center center', |
| 850 | 'selectors' => [ |
| 851 | '{{WRAPPER}} .premium-video-box-mask-media' => 'mask-position: {{VALUE}}; -webkit-mask-position: {{VALUE}}', |
| 852 | ], |
| 853 | 'condition' => [ |
| 854 | 'mask_video_box_switcher' => 'yes', |
| 855 | 'mask_size' => 'cover' |
| 856 | ], |
| 857 | ] |
| 858 | ); |
| 859 | |
| 860 | $this->add_control('mask_position_contain', |
| 861 | [ |
| 862 | 'label' => __( 'Mask Position', 'premium-addons-for-elementor' ), |
| 863 | 'type' => Controls_Manager::SELECT, |
| 864 | 'options' => [ |
| 865 | 'center center' => __( 'Center Center','premium-addons-pro' ), |
| 866 | 'top center' => __( 'Top Center', 'premium-addons-pro' ), |
| 867 | 'bottom center' => __( 'Bottom Center', 'premium-addons-pro' ), |
| 868 | ], |
| 869 | 'default' => 'center center', |
| 870 | 'selectors' => [ |
| 871 | '{{WRAPPER}} .premium-video-box-mask-media' => 'mask-position: {{VALUE}}; -webkit-mask-position: {{VALUE}}', |
| 872 | ], |
| 873 | 'condition' => [ |
| 874 | 'mask_video_box_switcher' => 'yes', |
| 875 | 'mask_size' => 'contain' |
| 876 | ], |
| 877 | ] |
| 878 | ); |
| 879 | |
| 880 | $this->add_control('video_box_shadow', |
| 881 | [ |
| 882 | 'label' => __('Mask Shadow', 'premium-addons-for-elementor'), |
| 883 | 'type' => Controls_Manager::POPOVER_TOGGLE, |
| 884 | 'condition' => [ |
| 885 | 'mask_video_box_switcher' => 'yes', |
| 886 | ], |
| 887 | 'return_value' => 'yes', |
| 888 | 'render_type' => 'template', |
| 889 | ] |
| 890 | ); |
| 891 | |
| 892 | $this->start_popover(); |
| 893 | |
| 894 | $this->add_control('video_box_shadow_color', |
| 895 | [ |
| 896 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 897 | 'type' => Controls_Manager::COLOR, |
| 898 | 'default' => 'rgba(0,0,0,0.5)', |
| 899 | ] |
| 900 | ); |
| 901 | |
| 902 | $this->add_control('video_box_shadow_h', |
| 903 | [ |
| 904 | 'label' => __( 'Horizontal', 'premium-addons-for-elementor' ), |
| 905 | 'type' => Controls_Manager::SLIDER, |
| 906 | 'range' => [ |
| 907 | 'px' => [ |
| 908 | 'min' => 0, |
| 909 | 'max' => 100, |
| 910 | 'step' => 1 |
| 911 | ] |
| 912 | ], |
| 913 | 'default' => [ |
| 914 | 'size' => 0 , |
| 915 | 'unit' => 'px' |
| 916 | ], |
| 917 | ] |
| 918 | ); |
| 919 | |
| 920 | $this->add_control('video_box_shadow_v', |
| 921 | [ |
| 922 | 'label' => __( 'Vertical', 'premium-addons-for-elementor' ), |
| 923 | 'type' => Controls_Manager::SLIDER, |
| 924 | 'range' => [ |
| 925 | 'px' => [ |
| 926 | 'min' => 0, |
| 927 | 'max' => 100, |
| 928 | 'step' => 1 |
| 929 | ] |
| 930 | ], |
| 931 | 'default' => [ |
| 932 | 'size' => 0 , |
| 933 | 'unit' => 'px' |
| 934 | ], |
| 935 | ] |
| 936 | ); |
| 937 | |
| 938 | $this->add_control('video_box_shadow_blur', |
| 939 | [ |
| 940 | 'label' => __( 'Blur', 'premium-addons-for-elementor' ), |
| 941 | 'type' => Controls_Manager::SLIDER, |
| 942 | 'range' => [ |
| 943 | 'px' => [ |
| 944 | 'min' => 0, |
| 945 | 'max' => 100, |
| 946 | 'step' => 1 |
| 947 | ] |
| 948 | ], |
| 949 | 'default' => [ |
| 950 | 'size' => 10 , |
| 951 | 'unit' => 'px' |
| 952 | ], |
| 953 | 'selectors' => [ |
| 954 | '{{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}})' |
| 955 | ] |
| 956 | ] |
| 957 | ); |
| 958 | |
| 959 | $this->end_popover(); |
| 960 | |
| 961 | $this->end_controls_section(); |
| 962 | |
| 963 | $this->start_controls_section('premium_video_box_image_settings', |
| 964 | [ |
| 965 | 'label' => __('Overlay', 'premium-addons-for-elementor'), |
| 966 | 'conditions'=> [ |
| 967 | 'terms' => [ |
| 968 | [ |
| 969 | 'name' => 'premium_video_box_image_switcher', |
| 970 | 'value' => 'yes' |
| 971 | ], |
| 972 | $playlist_condition |
| 973 | ] |
| 974 | ] |
| 975 | ] |
| 976 | ); |
| 977 | |
| 978 | $this->add_control('premium_video_box_image', |
| 979 | [ |
| 980 | 'label' => __('Image', 'premium-addons-for-elementor'), |
| 981 | 'description' => __('Choose an image for the video box', 'premium-addons-for-elementor' ), |
| 982 | 'type' => Controls_Manager::MEDIA, |
| 983 | 'dynamic' => [ 'active' => true ], |
| 984 | 'default' => [ |
| 985 | 'url' => Utils::get_placeholder_image_src() |
| 986 | ], |
| 987 | 'label_block' => true, |
| 988 | ] |
| 989 | ); |
| 990 | |
| 991 | $this->end_controls_section(); |
| 992 | |
| 993 | $this->start_controls_section('premium_video_box_play_icon_settings', |
| 994 | [ |
| 995 | 'label' => __('Play Icon', 'premium-addons-for-elementor') |
| 996 | ] |
| 997 | ); |
| 998 | |
| 999 | $this->add_control('premium_video_box_play_icon_switcher', |
| 1000 | [ |
| 1001 | 'label' => __('Play Icon', 'premium-addons-for-elementor'), |
| 1002 | 'type' => Controls_Manager::SWITCHER, |
| 1003 | 'default' => 'yes' |
| 1004 | ] |
| 1005 | ); |
| 1006 | |
| 1007 | $this->add_responsive_control('premium_video_box_icon_hor_position', |
| 1008 | [ |
| 1009 | 'label' => __('Horizontal Position', 'premium-addons-for-elementor'), |
| 1010 | 'type' => Controls_Manager::SLIDER, |
| 1011 | 'size_units' => [ 'px', 'em', '%' ], |
| 1012 | 'label_block' => true, |
| 1013 | 'default' => [ |
| 1014 | 'size' => 50, |
| 1015 | 'unit' => '%' |
| 1016 | ], |
| 1017 | 'range' => [ |
| 1018 | 'px' => [ |
| 1019 | 'min' => 1, |
| 1020 | 'max' => 500, |
| 1021 | ], |
| 1022 | 'em' => [ |
| 1023 | 'min' => 1, |
| 1024 | 'max' => 50, |
| 1025 | ], |
| 1026 | ], |
| 1027 | 'condition' => [ |
| 1028 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1029 | ], |
| 1030 | 'selectors' => [ |
| 1031 | '{{WRAPPER}} .premium-video-box-play-icon-container' => 'left: {{SIZE}}{{UNIT}};', |
| 1032 | ] |
| 1033 | ] |
| 1034 | ); |
| 1035 | |
| 1036 | $this->add_responsive_control('premium_video_box_icon_ver_position', |
| 1037 | [ |
| 1038 | 'label' => __('Vertical Position', 'premium-addons-for-elementor'), |
| 1039 | 'type' => Controls_Manager::SLIDER, |
| 1040 | 'size_units' => [ 'px', 'em', '%' ], |
| 1041 | 'label_block' => true, |
| 1042 | 'default' => [ |
| 1043 | 'size' => 50, |
| 1044 | 'unit' => '%' |
| 1045 | ], |
| 1046 | 'range' => [ |
| 1047 | 'px' => [ |
| 1048 | 'min' => 1, |
| 1049 | 'max' => 500, |
| 1050 | ], |
| 1051 | 'em' => [ |
| 1052 | 'min' => 1, |
| 1053 | 'max' => 50, |
| 1054 | ], |
| 1055 | ], |
| 1056 | 'condition' => [ |
| 1057 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1058 | ], |
| 1059 | 'selectors' => [ |
| 1060 | '{{WRAPPER}} .premium-video-box-play-icon-container' => 'top: {{SIZE}}{{UNIT}};', |
| 1061 | ] |
| 1062 | ] |
| 1063 | ); |
| 1064 | |
| 1065 | $this->end_controls_section(); |
| 1066 | |
| 1067 | $this->start_controls_section('premium_video_box_description_text_section', |
| 1068 | [ |
| 1069 | 'label' => __('Description', 'premium-addons-for-elementor'), |
| 1070 | 'conditions' => [ |
| 1071 | 'terms' => [ |
| 1072 | $playlist_condition |
| 1073 | ] |
| 1074 | ] |
| 1075 | ] |
| 1076 | ); |
| 1077 | |
| 1078 | $this->add_control('premium_video_box_video_text_switcher', |
| 1079 | [ |
| 1080 | 'label' => __('Video Text', 'premium-addons-for-elementor'), |
| 1081 | 'type' => Controls_Manager::SWITCHER, |
| 1082 | ] |
| 1083 | ); |
| 1084 | |
| 1085 | $this->add_control('premium_video_box_description_text', |
| 1086 | [ |
| 1087 | 'label' => __('Text', 'premium-addons-for-elementor'), |
| 1088 | 'type' => Controls_Manager::TEXTAREA, |
| 1089 | 'dynamic' => [ 'active' => true ], |
| 1090 | 'default' => __('Play Video','premium-addons-for-elementor'), |
| 1091 | 'condition' => [ |
| 1092 | 'premium_video_box_video_text_switcher' => 'yes' |
| 1093 | ], |
| 1094 | 'dynamic' => [ 'active' => true ], |
| 1095 | 'label_block' => true, |
| 1096 | ] |
| 1097 | ); |
| 1098 | |
| 1099 | $this->add_responsive_control('premium_video_box_description_hor_position', |
| 1100 | [ |
| 1101 | 'label' => __('Horizontal Position', 'premium-addons-for-elementor'), |
| 1102 | 'type' => Controls_Manager::SLIDER, |
| 1103 | 'size_units' => [ 'px', 'em', '%' ], |
| 1104 | 'label_block' => true, |
| 1105 | 'default' => [ |
| 1106 | 'size' => 50, |
| 1107 | 'unit' => '%' |
| 1108 | ], |
| 1109 | 'range' => [ |
| 1110 | 'px' => [ |
| 1111 | 'min' => 1, |
| 1112 | 'max' => 500, |
| 1113 | ], |
| 1114 | 'em' => [ |
| 1115 | 'min' => 1, |
| 1116 | 'max' => 50, |
| 1117 | ], |
| 1118 | ], |
| 1119 | 'condition' => [ |
| 1120 | 'premium_video_box_video_text_switcher' => 'yes' |
| 1121 | ], |
| 1122 | 'selectors' => [ |
| 1123 | '{{WRAPPER}} .premium-video-box-description-container' => 'left: {{SIZE}}{{UNIT}};', |
| 1124 | ] |
| 1125 | ] |
| 1126 | ); |
| 1127 | |
| 1128 | $this->add_responsive_control('premium_video_box_description_ver_position', |
| 1129 | [ |
| 1130 | 'label' => __('Vertical Position', 'premium-addons-for-elementor'), |
| 1131 | 'type' => Controls_Manager::SLIDER, |
| 1132 | 'size_units' => [ 'px', 'em', '%' ], |
| 1133 | 'label_block' => true, |
| 1134 | 'default' => [ |
| 1135 | 'size' => 60, |
| 1136 | 'unit' => '%' |
| 1137 | ], |
| 1138 | 'range' => [ |
| 1139 | 'px' => [ |
| 1140 | 'min' => 1, |
| 1141 | 'max' => 500, |
| 1142 | ], |
| 1143 | 'em' => [ |
| 1144 | 'min' => 1, |
| 1145 | 'max' => 50, |
| 1146 | ], |
| 1147 | ], |
| 1148 | 'condition' => [ |
| 1149 | 'premium_video_box_video_text_switcher' => 'yes' |
| 1150 | ], |
| 1151 | 'selectors' => [ |
| 1152 | '{{WRAPPER}} .premium-video-box-description-container' => 'top: {{SIZE}}{{UNIT}};', |
| 1153 | ] |
| 1154 | ] |
| 1155 | ); |
| 1156 | |
| 1157 | $this->end_controls_section(); |
| 1158 | |
| 1159 | $this->start_controls_section('section_pa_docs', |
| 1160 | [ |
| 1161 | 'label' => __('Helpful Documentations', 'premium-addons-for-elementor'), |
| 1162 | ] |
| 1163 | ); |
| 1164 | |
| 1165 | $docs = [ |
| 1166 | 'https://premiumaddons.com/docs/video-box-widget-tutorial/' => 'Getting started »', |
| 1167 | '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 »', |
| 1168 | 'https://premiumaddons.com/docs/how-to-find-youtube-channel-playlist-id/' => 'How to Find Youtube Channel/Playlist ID »', |
| 1169 | ]; |
| 1170 | |
| 1171 | $doc_index = 1; |
| 1172 | foreach( $docs as $url => $title ) { |
| 1173 | |
| 1174 | $doc_url = Helper_Functions::get_campaign_link( $url, 'editor-page', 'wp-editor', 'get-support' ); |
| 1175 | |
| 1176 | $this->add_control('doc_' . $doc_index, |
| 1177 | [ |
| 1178 | 'type' => Controls_Manager::RAW_HTML, |
| 1179 | 'raw' => sprintf( '<a href="%s" target="_blank">%s</a>', $doc_url , __( $title, 'premium-addons-for-elementor' ) ), |
| 1180 | 'content_classes' => 'editor-pa-doc', |
| 1181 | ] |
| 1182 | ); |
| 1183 | |
| 1184 | $doc_index++; |
| 1185 | |
| 1186 | } |
| 1187 | |
| 1188 | $this->end_controls_section(); |
| 1189 | |
| 1190 | $this->start_controls_section('premium_video_box_text_style_section', |
| 1191 | [ |
| 1192 | 'label' => __('Video Box','premium-addons-for-elementor'), |
| 1193 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1194 | ] |
| 1195 | ); |
| 1196 | |
| 1197 | $this->add_group_control( |
| 1198 | Group_Control_Border::get_type(), |
| 1199 | [ |
| 1200 | 'name' => 'image_border', |
| 1201 | 'selector' => '{{WRAPPER}} .premium-video-box-image-container, {{WRAPPER}} .premium-video-box-video-container', |
| 1202 | ] |
| 1203 | ); |
| 1204 | |
| 1205 | //Border Radius Properties sepearated for responsive issues |
| 1206 | $this->add_responsive_control('premium_video_box_image_border_radius', |
| 1207 | [ |
| 1208 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1209 | 'type' => Controls_Manager::SLIDER, |
| 1210 | 'size_units' => ['px', '%', 'em'], |
| 1211 | 'selectors' => [ |
| 1212 | '{{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}};', |
| 1213 | ] |
| 1214 | ] |
| 1215 | ); |
| 1216 | |
| 1217 | $this->add_group_control( |
| 1218 | Group_Control_Box_Shadow::get_type(), |
| 1219 | [ |
| 1220 | 'label' => __('Shadow','premium-addons-for-elementor'), |
| 1221 | 'name' => 'box_shadow', |
| 1222 | 'selector' => '{{WRAPPER}} .premium-video-box-video-container', |
| 1223 | ] |
| 1224 | ); |
| 1225 | |
| 1226 | $this->add_control('image_shadow_notice', |
| 1227 | [ |
| 1228 | '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' ), |
| 1229 | 'type' => Controls_Manager::RAW_HTML, |
| 1230 | 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', |
| 1231 | ] |
| 1232 | ); |
| 1233 | |
| 1234 | $this->add_responsive_control('columns_spacing', |
| 1235 | [ |
| 1236 | 'label' => __('Rows Spacing', 'premium-addons-for-elementor'), |
| 1237 | 'type' => Controls_Manager::SLIDER, |
| 1238 | 'size_units' => [ 'px', '%', "em" ], |
| 1239 | 'range' => [ |
| 1240 | 'px' => [ |
| 1241 | 'min' => 1, |
| 1242 | 'max' => 200, |
| 1243 | ], |
| 1244 | ], |
| 1245 | 'default' => [ |
| 1246 | 'size' => 5, |
| 1247 | 'unit' => 'px' |
| 1248 | ], |
| 1249 | 'condition' => [ |
| 1250 | 'premium_video_box_video_type' => 'youtube', |
| 1251 | 'youtube_list' => 'yes' |
| 1252 | ], |
| 1253 | 'separator' => 'before', |
| 1254 | 'selectors' => [ |
| 1255 | '{{WRAPPER}} .premium-video-box-container' => 'margin-bottom: {{SIZE}}{{UNIT}}' |
| 1256 | ] |
| 1257 | ] |
| 1258 | ); |
| 1259 | |
| 1260 | $this->add_responsive_control('premium_blog_posts_spacing', |
| 1261 | [ |
| 1262 | 'label' => __('Columns Spacing', 'premium-addons-for-elementor'), |
| 1263 | 'type' => Controls_Manager::SLIDER, |
| 1264 | 'default' => [ |
| 1265 | 'size' => 5, |
| 1266 | ], |
| 1267 | 'range' => [ |
| 1268 | 'px' => [ |
| 1269 | 'min' => 0, |
| 1270 | 'max' => 50, |
| 1271 | ], |
| 1272 | ], |
| 1273 | 'selectors' => [ |
| 1274 | '{{WRAPPER}} .premium-video-box-container' => 'padding-right: calc( {{SIZE}}{{UNIT}}/2 ); padding-left: calc( {{SIZE}}{{UNIT}}/2 )', |
| 1275 | '{{WRAPPER}} .premium-video-box-playlist-container' => 'margin-left: calc( -{{SIZE}}{{UNIT}}/2 ); margin-right: calc( -{{SIZE}}{{UNIT}}/2 );', |
| 1276 | ], |
| 1277 | 'condition' => [ |
| 1278 | 'premium_video_box_video_type' => 'youtube', |
| 1279 | 'youtube_list' => 'yes' |
| 1280 | ], |
| 1281 | ] |
| 1282 | ); |
| 1283 | |
| 1284 | $this->end_controls_section(); |
| 1285 | |
| 1286 | $this->start_controls_section('premium_video_box_icon_style', |
| 1287 | [ |
| 1288 | 'label' => __('Play Icon','premium-addons-for-elementor'), |
| 1289 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1290 | 'condition' => [ |
| 1291 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1292 | ], |
| 1293 | ] |
| 1294 | ); |
| 1295 | |
| 1296 | $this->add_control('premium_video_box_play_icon_color', |
| 1297 | [ |
| 1298 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1299 | 'type' => Controls_Manager::COLOR, |
| 1300 | 'scheme' => [ |
| 1301 | 'type' => Scheme_Color::get_type(), |
| 1302 | 'value' => Scheme_Color::COLOR_1, |
| 1303 | ], |
| 1304 | 'selectors' => [ |
| 1305 | '{{WRAPPER}} .premium-video-box-play-icon' => 'color: {{VALUE}};', |
| 1306 | ] |
| 1307 | ] |
| 1308 | ); |
| 1309 | |
| 1310 | $this->add_control('premium_video_box_play_icon_color_hover', |
| 1311 | [ |
| 1312 | 'label' => __('Hover Color', 'premium-addons-for-elementor'), |
| 1313 | 'type' => Controls_Manager::COLOR, |
| 1314 | 'scheme' => [ |
| 1315 | 'type' => Scheme_Color::get_type(), |
| 1316 | 'value' => Scheme_Color::COLOR_2, |
| 1317 | ], |
| 1318 | 'selectors' => [ |
| 1319 | '{{WRAPPER}} .premium-video-box-play-icon-container:hover .premium-video-box-play-icon' => 'color: {{VALUE}};', |
| 1320 | ] |
| 1321 | ] |
| 1322 | ); |
| 1323 | |
| 1324 | $this->add_control('premium_video_box_play_icon_size', |
| 1325 | [ |
| 1326 | 'label' => __('Size', 'premium-addons-for-elementor'), |
| 1327 | 'type' => Controls_Manager::SLIDER, |
| 1328 | 'default' => [ |
| 1329 | 'unit' => 'px', |
| 1330 | 'size' => 30, |
| 1331 | ], |
| 1332 | 'size_units' => ['px', '%', 'em'], |
| 1333 | 'selectors' => [ |
| 1334 | '{{WRAPPER}} .premium-video-box-play-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1335 | ] |
| 1336 | ] |
| 1337 | ); |
| 1338 | |
| 1339 | $this->add_group_control( |
| 1340 | Group_Control_Background::get_type(), |
| 1341 | [ |
| 1342 | 'name' => 'premium_video_box_play_icon_background_color', |
| 1343 | 'types' => ['classic', 'gradient'], |
| 1344 | 'selector' => '{{WRAPPER}} .premium-video-box-play-icon-container', |
| 1345 | ] |
| 1346 | ); |
| 1347 | |
| 1348 | $this->add_group_control( |
| 1349 | Group_Control_Border::get_type(), |
| 1350 | [ |
| 1351 | 'name' => 'icon_border', |
| 1352 | 'selector' => '{{WRAPPER}} .premium-video-box-play-icon-container', |
| 1353 | ] |
| 1354 | ); |
| 1355 | |
| 1356 | $this->add_control('premium_video_box_icon_border_radius', |
| 1357 | [ |
| 1358 | 'label' => __('Border Radius', 'premium-addons-for-elementor'), |
| 1359 | 'type' => Controls_Manager::SLIDER, |
| 1360 | 'default' => [ |
| 1361 | 'unit' => 'px', |
| 1362 | 'size' => 100, |
| 1363 | ], |
| 1364 | 'size_units' => ['px', '%', 'em'], |
| 1365 | 'selectors' => [ |
| 1366 | '{{WRAPPER}} .premium-video-box-play-icon-container' => 'border-radius: {{SIZE}}{{UNIT}};', |
| 1367 | ] |
| 1368 | ] |
| 1369 | ); |
| 1370 | |
| 1371 | $this->add_responsive_control('premium_video_box_icon_padding', |
| 1372 | [ |
| 1373 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 1374 | 'type' => Controls_Manager::DIMENSIONS, |
| 1375 | 'default' => [ |
| 1376 | 'top' => 20, |
| 1377 | 'right' => 20, |
| 1378 | 'bottom'=> 20, |
| 1379 | 'left' => 20, |
| 1380 | 'unit' => 'px' |
| 1381 | ], |
| 1382 | 'size_units' => [ 'px', 'em', '%' ], |
| 1383 | 'selectors' => [ |
| 1384 | '{{WRAPPER}} .premium-video-box-play-icon ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1385 | ] |
| 1386 | ] |
| 1387 | ); |
| 1388 | |
| 1389 | $this->add_responsive_control('premium_video_box_icon_padding_hover', |
| 1390 | [ |
| 1391 | 'label' => __('Hover Padding', 'premium-addons-for-elementor'), |
| 1392 | 'type' => Controls_Manager::DIMENSIONS, |
| 1393 | 'size_units' => [ 'px', 'em', '%' ], |
| 1394 | 'selectors' => [ |
| 1395 | '{{WRAPPER}} .premium-video-box-play-icon:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1396 | ], |
| 1397 | ] |
| 1398 | ); |
| 1399 | |
| 1400 | $this->end_controls_section(); |
| 1401 | |
| 1402 | $this->start_controls_section('premium_video_box_text_style', |
| 1403 | [ |
| 1404 | 'label' => __('Video Text', 'premium-addons-for-elementor'), |
| 1405 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1406 | 'conditions' => |
| 1407 | [ |
| 1408 | 'terms' => [ |
| 1409 | [ |
| 1410 | 'name' => 'premium_video_box_video_text_switcher', |
| 1411 | 'value' => 'yes' |
| 1412 | ], |
| 1413 | $playlist_condition |
| 1414 | ] |
| 1415 | ] |
| 1416 | ] |
| 1417 | ); |
| 1418 | |
| 1419 | $this->add_control('premium_video_box_text_color', |
| 1420 | [ |
| 1421 | 'label' => __('Text Color', 'premium-addons-for-elementor'), |
| 1422 | 'type' => Controls_Manager::COLOR, |
| 1423 | 'scheme' => [ |
| 1424 | 'type' => Scheme_Color::get_type(), |
| 1425 | 'value' => Scheme_Color::COLOR_1, |
| 1426 | ], |
| 1427 | 'selectors' => [ |
| 1428 | '{{WRAPPER}} .premium-video-box-text' => 'color: {{VALUE}};', |
| 1429 | ] |
| 1430 | ] |
| 1431 | ); |
| 1432 | |
| 1433 | $this->add_control('premium_video_box_text_color_hover', |
| 1434 | [ |
| 1435 | 'label' => __('Hover Color', 'premium-addons-for-elementor'), |
| 1436 | 'type' => Controls_Manager::COLOR, |
| 1437 | 'scheme' => [ |
| 1438 | 'type' => Scheme_Color::get_type(), |
| 1439 | 'value' => Scheme_Color::COLOR_1, |
| 1440 | ], |
| 1441 | 'selectors' => [ |
| 1442 | '{{WRAPPER}} .premium-video-box-description-container:hover .premium-video-box-text' => 'color: {{VALUE}};', |
| 1443 | ] |
| 1444 | ] |
| 1445 | ); |
| 1446 | |
| 1447 | $this->add_group_control( |
| 1448 | Group_Control_Typography::get_type(), |
| 1449 | [ |
| 1450 | 'name' => 'text_typography', |
| 1451 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 1452 | 'selector' => '{{WRAPPER}} .premium-video-box-text', |
| 1453 | ] |
| 1454 | ); |
| 1455 | |
| 1456 | $this->add_control('premium_video_box_text_background_color', |
| 1457 | [ |
| 1458 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1459 | 'type' => Controls_Manager::COLOR, |
| 1460 | 'scheme' => [ |
| 1461 | 'type' => Scheme_Color::get_type(), |
| 1462 | 'value' => Scheme_Color::COLOR_2, |
| 1463 | ], |
| 1464 | 'selectors' => [ |
| 1465 | '{{WRAPPER}} .premium-video-box-description-container' => 'background-color: {{VALUE}};', |
| 1466 | ] |
| 1467 | ] |
| 1468 | ); |
| 1469 | |
| 1470 | $this->add_responsive_control('premium_video_box_text_padding', |
| 1471 | [ |
| 1472 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 1473 | 'type' => Controls_Manager::DIMENSIONS, |
| 1474 | 'size_units' => [ 'px', 'em', '%' ], |
| 1475 | 'selectors' => [ |
| 1476 | '{{WRAPPER}} .premium-video-box-description-container' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1477 | ], |
| 1478 | ] |
| 1479 | ); |
| 1480 | |
| 1481 | $this->add_group_control( |
| 1482 | Group_Control_Text_Shadow::get_type(), |
| 1483 | [ |
| 1484 | 'label' => __('Shadow','premium-addons-for-elementor'), |
| 1485 | 'name' => 'premium_text_shadow', |
| 1486 | 'selector' => '{{WRAPPER}} .premium-video-box-text' |
| 1487 | ] |
| 1488 | ); |
| 1489 | |
| 1490 | $this->end_controls_section(); |
| 1491 | |
| 1492 | $this->start_controls_section('premium_video_box_sticky_options', |
| 1493 | [ |
| 1494 | 'label' => __('Sticky Options', 'premium-addons-for-elementor'), |
| 1495 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1496 | 'conditions' => $sticky_condition |
| 1497 | ] |
| 1498 | ); |
| 1499 | |
| 1500 | $this->add_responsive_control('sticky_video_width', |
| 1501 | [ |
| 1502 | 'label' => __( 'Video Size', 'premium-addons-for-elementor' ), |
| 1503 | 'type' => Controls_Manager::SLIDER, |
| 1504 | 'size_units' => [ 'px', 'em', '%' ], |
| 1505 | 'range' => [ |
| 1506 | 'px' => [ |
| 1507 | 'min' => 100, |
| 1508 | 'max' => 1000, |
| 1509 | ], |
| 1510 | ], |
| 1511 | 'default' => [ |
| 1512 | 'size' => 320, |
| 1513 | 'unit' => 'px', |
| 1514 | ], |
| 1515 | 'mobile_default' => [ |
| 1516 | 'size' => 250, |
| 1517 | 'unit' => 'px', |
| 1518 | ], |
| 1519 | 'selectors' => [ |
| 1520 | '{{WRAPPER}}.pa-aspect-ratio-169 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 1521 | {{WRAPPER}}.pa-aspect-ratio-169 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.5625 );', |
| 1522 | '{{WRAPPER}}.pa-aspect-ratio-43 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 1523 | {{WRAPPER}}.pa-aspect-ratio-43 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.75 );', |
| 1524 | '{{WRAPPER}}.pa-aspect-ratio-32 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 1525 | {{WRAPPER}}.pa-aspect-ratio-32 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.6666666666666667 );', |
| 1526 | '{{WRAPPER}}.pa-aspect-ratio-916 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 1527 | {{WRAPPER}}.pa-aspect-ratio-916 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.1778 );', |
| 1528 | '{{WRAPPER}}.pa-aspect-ratio-11 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 1529 | {{WRAPPER}}.pa-aspect-ratio-11 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 1 );', |
| 1530 | '{{WRAPPER}}.pa-aspect-ratio-219 .premium-video-box-container.premium-video-box-sticky-apply .premium-video-box-inner-wrap, |
| 1531 | {{WRAPPER}}.pa-aspect-ratio-219 .premium-video-box-sticky-apply .premium-video-box-image-container' => 'width: {{SIZE}}px; height: calc( {{SIZE}}px * 0.4285 );', |
| 1532 | ], |
| 1533 | ] |
| 1534 | ); |
| 1535 | |
| 1536 | $this->add_responsive_control('sticky_video_margin', |
| 1537 | [ |
| 1538 | 'label' => __( 'Spaces Around', 'premium-addons-for-elementor' ), |
| 1539 | 'type' => Controls_Manager::DIMENSIONS, |
| 1540 | 'size_units' => [ 'px', 'em', '%' ], |
| 1541 | 'selectors' => [ |
| 1542 | '{{WRAPPER}}.premium-video-sticky-top-right .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'top: {{TOP}}{{UNIT}}; right: {{RIGHT}}{{UNIT}};', |
| 1543 | '{{WRAPPER}}.premium-video-sticky-top-left .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'top: {{TOP}}{{UNIT}}; left: {{LEFT}}{{UNIT}};', |
| 1544 | '{{WRAPPER}}.premium-video-sticky-bottom-right .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'bottom: {{BOTTOM}}{{UNIT}}; right: {{RIGHT}}{{UNIT}};', |
| 1545 | '{{WRAPPER}}.premium-video-sticky-bottom-left .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'bottom: {{BOTTOM}}{{UNIT}}; left: {{LEFT}}{{UNIT}};', |
| 1546 | '{{WRAPPER}}.premium-video-sticky-center-left .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'left: {{LEFT}}{{UNIT}};', |
| 1547 | '{{WRAPPER}}.premium-video-sticky-center-right .premium-video-box-sticky-apply .premium-video-box-inner-wrap' => 'right: {{RIGHT}}{{UNIT}};', |
| 1548 | ], |
| 1549 | ] |
| 1550 | ); |
| 1551 | |
| 1552 | $this->add_group_control( |
| 1553 | Group_Control_Box_Shadow::get_type(), |
| 1554 | [ |
| 1555 | 'name' => 'sticky_box_shadow', |
| 1556 | 'selector' => '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-inner-wrap', |
| 1557 | 'condition' => [ |
| 1558 | 'sticky_info_bar_switch!' => 'yes', |
| 1559 | ], |
| 1560 | ] |
| 1561 | ); |
| 1562 | |
| 1563 | $this->add_control('info_bar_shadow_color', |
| 1564 | [ |
| 1565 | 'label' => __('Shadow Color', 'premium-addons-for-elementor'), |
| 1566 | 'type' => Controls_Manager::COLOR, |
| 1567 | 'default' => 'rgba(0, 0, 0, 0.5)', |
| 1568 | 'condition' => [ |
| 1569 | 'sticky_info_bar_switch' => 'yes', |
| 1570 | ], |
| 1571 | ] |
| 1572 | ); |
| 1573 | |
| 1574 | $this->add_control('sticky_play_icon', |
| 1575 | [ |
| 1576 | 'label' => __('Play Icon', 'premium-addons-for-elementor'), |
| 1577 | 'type' => Controls_Manager::HEADING, |
| 1578 | 'separator' => 'before', |
| 1579 | 'condition' => [ |
| 1580 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1581 | ], |
| 1582 | ] |
| 1583 | ); |
| 1584 | |
| 1585 | $this->add_control('premium_video_box_play_icon_sticky_size', |
| 1586 | [ |
| 1587 | 'label' => __('Size', 'premium-addons-for-elementor'), |
| 1588 | 'type' => Controls_Manager::SLIDER, |
| 1589 | 'size_units' => ['px', '%', 'em'], |
| 1590 | 'selectors' => [ |
| 1591 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-play-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1592 | ], |
| 1593 | 'condition' => [ |
| 1594 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1595 | ], |
| 1596 | ] |
| 1597 | ); |
| 1598 | |
| 1599 | $this->add_responsive_control('premium_video_box_icon_sticky_padding', |
| 1600 | [ |
| 1601 | 'label' => __('Padding', 'premium-addons-for-elementor'), |
| 1602 | 'type' => Controls_Manager::DIMENSIONS, |
| 1603 | 'default' => [ |
| 1604 | 'top' => 40, |
| 1605 | 'right' => 40, |
| 1606 | 'bottom'=> 40, |
| 1607 | 'left' => 40, |
| 1608 | 'unit' => 'px' |
| 1609 | ], |
| 1610 | 'size_units' => [ 'px', 'em', '%' ], |
| 1611 | 'selectors' => [ |
| 1612 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-play-icon ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}', |
| 1613 | ], |
| 1614 | 'condition' => [ |
| 1615 | 'premium_video_box_play_icon_switcher' => 'yes', |
| 1616 | ], |
| 1617 | ] |
| 1618 | ); |
| 1619 | |
| 1620 | $this->add_control('premium_video_box_text_sticky_size', |
| 1621 | [ |
| 1622 | 'label' => __('Video Text Size', 'premium-addons-for-elementor'), |
| 1623 | 'type' => Controls_Manager::SLIDER, |
| 1624 | 'size_units' => ['px', '%', 'em'], |
| 1625 | 'selectors' => [ |
| 1626 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-text' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1627 | ], |
| 1628 | 'condition' => [ |
| 1629 | 'premium_video_box_video_text_switcher' => 'yes' |
| 1630 | ] |
| 1631 | ] |
| 1632 | ); |
| 1633 | |
| 1634 | $this->add_control('sticky_close', |
| 1635 | [ |
| 1636 | 'label' => __('Close Icon', 'premium-addons-for-elementor'), |
| 1637 | 'type' => Controls_Manager::HEADING, |
| 1638 | 'separator' => 'before' |
| 1639 | ] |
| 1640 | ); |
| 1641 | |
| 1642 | $this->add_control( 'premium_video_box_sticky_close_color', |
| 1643 | [ |
| 1644 | 'label' => __('Color', 'premium-addons-for-elementor'), |
| 1645 | 'type' => Controls_Manager::COLOR, |
| 1646 | 'selectors' => [ |
| 1647 | '{{WRAPPER}} .premium-video-box-sticky-close i' => 'color: {{VALUE}}!important', |
| 1648 | ], |
| 1649 | 'scheme' => [ |
| 1650 | 'type' => Scheme_Color::get_type(), |
| 1651 | 'value' => Scheme_Color::COLOR_2, |
| 1652 | ], |
| 1653 | ] |
| 1654 | ); |
| 1655 | |
| 1656 | $this->add_control('premium_video_box_sticky_close_bg_color', |
| 1657 | [ |
| 1658 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1659 | 'type' => Controls_Manager::COLOR, |
| 1660 | 'selectors' => [ |
| 1661 | '{{WRAPPER}} .premium-video-box-sticky-close' => 'background: {{VALUE}}', |
| 1662 | ], |
| 1663 | 'default' => '#FFF', |
| 1664 | ] |
| 1665 | ); |
| 1666 | |
| 1667 | $this->add_responsive_control('sticky_video_icon_size', |
| 1668 | [ |
| 1669 | 'label' => __( 'Size', 'premium-addons-for-elementor' ), |
| 1670 | 'type' => Controls_Manager::SLIDER, |
| 1671 | 'size_units' => [ 'px', 'em', '%' ], |
| 1672 | 'default' => [ |
| 1673 | 'size' => 15 , |
| 1674 | 'unit' => 'px', |
| 1675 | ], |
| 1676 | 'selectors' => [ |
| 1677 | '{{WRAPPER}} .premium-video-box-sticky-close i' => 'font-size: {{SIZE}}{{UNIT}}', |
| 1678 | ], |
| 1679 | ] |
| 1680 | ); |
| 1681 | |
| 1682 | $this->add_control('sticky_hint', |
| 1683 | [ |
| 1684 | 'label' => __('Info Section', 'premium-addons-for-elementor'), |
| 1685 | 'type' => Controls_Manager::HEADING, |
| 1686 | 'condition' => [ |
| 1687 | 'sticky_info_bar_switch' => 'yes', |
| 1688 | ], |
| 1689 | 'separator' => 'before' |
| 1690 | ] |
| 1691 | ); |
| 1692 | |
| 1693 | $this->add_control('premium_video_box_sticky_info_color', |
| 1694 | [ |
| 1695 | 'label' => __('Text Color', 'premium-addons-for-elementor'), |
| 1696 | 'type' => Controls_Manager::COLOR, |
| 1697 | 'selectors' => [ |
| 1698 | '{{WRAPPER}} .premium-video-box-sticky-infobar' => 'color: {{VALUE}}', |
| 1699 | ], |
| 1700 | 'scheme' => [ |
| 1701 | 'type' => Scheme_Color::get_type(), |
| 1702 | 'value' => Scheme_Color::COLOR_2, |
| 1703 | ], |
| 1704 | 'condition' => [ |
| 1705 | 'sticky_info_bar_switch' => 'yes', |
| 1706 | ] |
| 1707 | ] |
| 1708 | ); |
| 1709 | |
| 1710 | $this->add_group_control( |
| 1711 | Group_Control_Typography::get_type(), |
| 1712 | [ |
| 1713 | 'name' => 'info_typography', |
| 1714 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 1715 | 'selector' => '{{WRAPPER}} .premium-video-box-sticky-infobar', |
| 1716 | 'condition' => [ |
| 1717 | 'sticky_info_bar_switch' => 'yes', |
| 1718 | ] |
| 1719 | ] |
| 1720 | ); |
| 1721 | |
| 1722 | $this->add_control('premium_video_box_sticky_info_bg_color', |
| 1723 | [ |
| 1724 | 'label' => __('Background Color', 'premium-addons-for-elementor'), |
| 1725 | 'type' => Controls_Manager::COLOR, |
| 1726 | 'selectors' => [ |
| 1727 | '{{WRAPPER}} .premium-video-box-sticky-apply .premium-video-box-sticky-infobar' => 'background: {{VALUE}}', |
| 1728 | ], |
| 1729 | 'default' => '#FFF', |
| 1730 | 'condition' => [ |
| 1731 | 'sticky_info_bar_switch' => 'yes', |
| 1732 | ], |
| 1733 | ] |
| 1734 | ); |
| 1735 | |
| 1736 | $this->end_controls_section(); |
| 1737 | |
| 1738 | } |
| 1739 | |
| 1740 | /** |
| 1741 | * Render video box widget output on the frontend. |
| 1742 | * |
| 1743 | * Written in PHP and used to generate the final HTML. |
| 1744 | * |
| 1745 | * @since 1.0.0 |
| 1746 | * @access protected |
| 1747 | */ |
| 1748 | protected function render() { |
| 1749 | |
| 1750 | $settings = $this->get_settings_for_display(); |
| 1751 | |
| 1752 | $id = $this->get_id(); |
| 1753 | |
| 1754 | $video_type = $settings['premium_video_box_video_type']; |
| 1755 | |
| 1756 | if( 'youtube' === $video_type ) { |
| 1757 | |
| 1758 | $playlist = $settings['youtube_list']; |
| 1759 | |
| 1760 | if( 'yes' === $playlist ) { |
| 1761 | |
| 1762 | $is_fetched = $this->fetch_youtube_playlist_data(); |
| 1763 | |
| 1764 | return -1 ; |
| 1765 | |
| 1766 | } |
| 1767 | |
| 1768 | } |
| 1769 | |
| 1770 | $params = $this->get_video_params(); |
| 1771 | |
| 1772 | $autoplay = $settings['premium_video_box_self_autoplay']; |
| 1773 | |
| 1774 | $image = 'transparent'; |
| 1775 | |
| 1776 | //Make sure autoplay is disabled before getting any thumbnails |
| 1777 | if( 'yes' !== $autoplay ) { |
| 1778 | |
| 1779 | $thumbnail = $this->get_thumbnail( $params['id'] ); |
| 1780 | |
| 1781 | if( ! empty( $thumbnail ) ) { |
| 1782 | $image = sprintf( 'url(\'%s\')', $thumbnail ); |
| 1783 | } |
| 1784 | |
| 1785 | } |
| 1786 | |
| 1787 | if( 'self' === $video_type ) { |
| 1788 | |
| 1789 | $overlay = $settings['premium_video_box_image_switcher']; |
| 1790 | |
| 1791 | if( 'yes' !== $overlay ) |
| 1792 | $image = 'transparent'; |
| 1793 | |
| 1794 | if ( empty( $settings['premium_video_box_self_hosted_remote'] ) ) { |
| 1795 | $hosted_url = $settings['premium_video_box_self_hosted']['url']; |
| 1796 | } else { |
| 1797 | $hosted_url = $settings['premium_video_box_self_hosted_remote']; |
| 1798 | } |
| 1799 | } |
| 1800 | |
| 1801 | $link = $params['link']; |
| 1802 | |
| 1803 | $related = $settings['premium_video_box_suggested_videos']; |
| 1804 | |
| 1805 | $mute = $settings['premium_video_box_mute']; |
| 1806 | |
| 1807 | $loop = $settings['premium_video_box_loop']; |
| 1808 | |
| 1809 | $controls = $settings['premium_video_box_controls']; |
| 1810 | |
| 1811 | $sticky = $settings['premium_video_box_sticky_switcher']; |
| 1812 | |
| 1813 | $sticky_play = $settings['premium_video_box_sticky_on_play']; |
| 1814 | |
| 1815 | $sticky_desktop = ''; |
| 1816 | |
| 1817 | $sticky_tablet = ''; |
| 1818 | |
| 1819 | $sticky_mobile = ''; |
| 1820 | |
| 1821 | $sticky_infobar = ( 'yes' === $settings['sticky_info_bar_switch'] ) ? 'premium-video-box-sticky-infobar-wrap' : ''; |
| 1822 | |
| 1823 | $options = 'youtube' === $video_type ? '&rel=' : '?rel'; |
| 1824 | $options .= 'yes' === $related ? '1' : '0'; |
| 1825 | $options .= 'youtube' === $video_type ? '&mute=' : '&muted='; |
| 1826 | $options .= 'yes' === $mute ? '1' : '0'; |
| 1827 | $options .= '&loop='; |
| 1828 | $options .= 'yes' === $loop ? '1' : '0'; |
| 1829 | $options .= '&controls='; |
| 1830 | $options .= 'yes' === $controls ? '1' : '0'; |
| 1831 | |
| 1832 | if( 'self' !== $video_type ) { |
| 1833 | if ( 'yes' === $autoplay && ! $this->has_image_overlay() ) { |
| 1834 | |
| 1835 | //Autoplay on Viewport |
| 1836 | if( 'yes' === $settings['autoplay_viewport'] ) { |
| 1837 | $this->add_render_attribute('container', 'data-play-viewport', 'true' ); |
| 1838 | } |
| 1839 | |
| 1840 | |
| 1841 | $options .= '&autoplay=1'; |
| 1842 | } |
| 1843 | } |
| 1844 | |
| 1845 | if( 'vimeo' === $video_type ) { |
| 1846 | $options .= '&color=' . str_replace('#', '', $settings['vimeo_controls_color'] ); |
| 1847 | |
| 1848 | if( 'yes' === $settings['vimeo_title'] ) { |
| 1849 | $options .= '&title=1'; |
| 1850 | } |
| 1851 | |
| 1852 | if( 'yes' === $settings['vimeo_portrait'] ) { |
| 1853 | $options .= '&portrait=1'; |
| 1854 | } |
| 1855 | |
| 1856 | if( 'yes' === $settings['vimeo_byline'] ) { |
| 1857 | $options .= '&byline=1'; |
| 1858 | } |
| 1859 | |
| 1860 | } |
| 1861 | |
| 1862 | if ( $settings['premium_video_box_start'] || $settings['premium_video_box_end'] ) { |
| 1863 | |
| 1864 | if ( 'youtube' === $video_type ) { |
| 1865 | |
| 1866 | if ( $settings['premium_video_box_start'] ) { |
| 1867 | $options .= '&start=' . $settings['premium_video_box_start']; |
| 1868 | } |
| 1869 | |
| 1870 | if ( $settings['premium_video_box_end'] ) { |
| 1871 | $options .= '&end=' . $settings['premium_video_box_end']; |
| 1872 | } |
| 1873 | |
| 1874 | } elseif ( 'self' === $video_type ) { |
| 1875 | |
| 1876 | $hosted_url .= '#t='; |
| 1877 | |
| 1878 | if ( $settings['premium_video_box_start'] ) { |
| 1879 | $hosted_url .= $settings['premium_video_box_start']; |
| 1880 | } |
| 1881 | |
| 1882 | if ( $settings['premium_video_box_end'] ) { |
| 1883 | $hosted_url .= ',' . $settings['premium_video_box_end']; |
| 1884 | } |
| 1885 | |
| 1886 | } |
| 1887 | |
| 1888 | } |
| 1889 | |
| 1890 | if ( $loop ) { |
| 1891 | $options .= '&playlist=' . $params['id']; |
| 1892 | } |
| 1893 | |
| 1894 | if( 'self' === $video_type ) { |
| 1895 | |
| 1896 | $video_params = ''; |
| 1897 | |
| 1898 | if( $controls ) { |
| 1899 | $video_params .= 'controls '; |
| 1900 | } |
| 1901 | if( $mute ) { |
| 1902 | $video_params .= 'muted '; |
| 1903 | } |
| 1904 | if( $loop ) { |
| 1905 | $video_params .= 'loop '; |
| 1906 | } |
| 1907 | if( $autoplay ) { |
| 1908 | $video_params .= 'autoplay'; |
| 1909 | } |
| 1910 | |
| 1911 | if ( ! $settings['download_button'] ) { |
| 1912 | $video_params .= ' controlsList="nodownload"'; |
| 1913 | } |
| 1914 | |
| 1915 | |
| 1916 | } |
| 1917 | |
| 1918 | if ( $settings['premium_video_box_sticky_hide'] ) { |
| 1919 | foreach ( $settings['premium_video_box_sticky_hide'] as $element ) { |
| 1920 | if ( 'desktop' === $element ) { |
| 1921 | $sticky_desktop = 'desktop'; |
| 1922 | } elseif ( 'tablet' === $element ) { |
| 1923 | $sticky_tablet = 'tablet'; |
| 1924 | } elseif ( 'mobile' === $element ) { |
| 1925 | $sticky_mobile = 'mobile'; |
| 1926 | } |
| 1927 | } |
| 1928 | } |
| 1929 | |
| 1930 | if( $sticky === "yes") { |
| 1931 | |
| 1932 | $this->add_render_attribute('container', [ |
| 1933 | 'class' => $sticky_infobar, |
| 1934 | 'data-sticky' => $sticky, |
| 1935 | 'data-hide-desktop'=> $sticky_desktop, |
| 1936 | 'data-hide-tablet' => $sticky_tablet, |
| 1937 | 'data-hide-mobile' => $sticky_mobile, |
| 1938 | 'data-sticky-play' => $sticky_play |
| 1939 | ] |
| 1940 | ); |
| 1941 | |
| 1942 | if ( ! empty( $settings['sticky_video_margin'] ) ) { |
| 1943 | $this->add_render_attribute( 'container', 'data-sticky-margin', $settings['sticky_video_margin']['bottom']); |
| 1944 | } |
| 1945 | } |
| 1946 | |
| 1947 | $this->add_inline_editing_attributes( 'premium_video_box_description_text' ); |
| 1948 | |
| 1949 | $this->add_render_attribute('container', [ |
| 1950 | 'id' => 'premium-video-box-container-' . $id, |
| 1951 | 'class' => 'premium-video-box-container', |
| 1952 | 'data-overlay' => 'yes' === $settings['premium_video_box_image_switcher'] ? 'true' : 'false', |
| 1953 | 'data-type' => $video_type, |
| 1954 | 'data-thumbnail' => !empty( $thumbnail ), |
| 1955 | 'data-hover' => $settings['premium_video_box_img_effect'] |
| 1956 | ] |
| 1957 | ); |
| 1958 | |
| 1959 | $this->add_render_attribute('video_container', [ |
| 1960 | 'class' => 'premium-video-box-video-container', |
| 1961 | ] |
| 1962 | ); |
| 1963 | |
| 1964 | $this->add_render_attribute('video_wrap', [ |
| 1965 | 'class' => 'premium-video-box-inner-wrap', |
| 1966 | ] |
| 1967 | ); |
| 1968 | |
| 1969 | if ( 'self' !== $video_type ) { |
| 1970 | $this->add_render_attribute('video_container', [ |
| 1971 | 'data-src' => $link . $options |
| 1972 | ] |
| 1973 | ); |
| 1974 | } |
| 1975 | |
| 1976 | $animation_class = $settings['premium_video_box_animation']; |
| 1977 | |
| 1978 | if ("" !== $settings['premium_video_box_animation']){ |
| 1979 | |
| 1980 | if( '' != $settings['premium_video_box_animation_duration'] ) { |
| 1981 | $animation_dur = 'animated-' . $settings['premium_video_box_animation_duration']; |
| 1982 | } else { |
| 1983 | $animation_dur = 'animated-'; |
| 1984 | } |
| 1985 | |
| 1986 | $this->add_render_attribute( 'video_wrap', 'data-video-animation', |
| 1987 | [ |
| 1988 | $animation_class, |
| 1989 | $animation_dur, |
| 1990 | ] |
| 1991 | ); |
| 1992 | |
| 1993 | $delay = "" !== $settings['premium_video_box_animation_delay'] ? $settings['premium_video_box_animation_delay'] : 0 ; |
| 1994 | |
| 1995 | $this->add_render_attribute( 'video_wrap', 'data-delay-animation', $delay ); |
| 1996 | } |
| 1997 | |
| 1998 | $this->add_render_attribute( 'info_bar', 'class', 'premium-video-box-sticky-infobar' ); |
| 1999 | |
| 2000 | if($settings['sticky_info_bar_switch'] === 'yes'){ |
| 2001 | $this->add_render_attribute( 'info_bar', 'style', 'box-shadow:' . $settings['info_bar_shadow_color'] .' 0px 5px 10px -5px '); |
| 2002 | } |
| 2003 | |
| 2004 | $this->add_render_attribute('image_container', |
| 2005 | [ |
| 2006 | 'style' => "background-image:" . $image, |
| 2007 | 'class' => [ |
| 2008 | 'premium-video-box-image-container' , |
| 2009 | $settings['premium_video_box_img_effect'] |
| 2010 | ] |
| 2011 | ] |
| 2012 | ); |
| 2013 | |
| 2014 | if( $settings['mask_video_box_switcher'] === 'yes' ) { |
| 2015 | |
| 2016 | $this->add_render_attribute( 'container', 'data-mask', 'true' ); |
| 2017 | $this->add_render_attribute( 'mask', 'class', 'premium-video-box-mask-media' ); |
| 2018 | |
| 2019 | if( $settings['premium_video_box_img_effect'] === 'blur' ) |
| 2020 | $this->add_render_attribute( 'image_container', 'class', 'premium-video-box-mask-media' ); |
| 2021 | |
| 2022 | if( $settings['mask_shape_video_box']['url'] !== '' && $settings['video_box_shadow'] === 'yes' ) { |
| 2023 | |
| 2024 | $this->add_render_attribute( 'mask_filter', 'class', 'premium-video-box-mask-filter' ); |
| 2025 | |
| 2026 | } |
| 2027 | |
| 2028 | } |
| 2029 | |
| 2030 | |
| 2031 | ?> |
| 2032 | |
| 2033 | <div <?php echo $this->get_render_attribute_string('mask_filter'); ?>> |
| 2034 | <div <?php echo $this->get_render_attribute_string('container'); ?>> |
| 2035 | <div <?php echo $this->get_render_attribute_string('mask'); ?> > |
| 2036 | <?php $this->get_vimeo_header( $params['id'] ); ?> |
| 2037 | <div <?php echo $this->get_render_attribute_string('video_wrap'); ?>> |
| 2038 | <div <?php echo $this->get_render_attribute_string('video_container'); ?>> |
| 2039 | <?php if ( 'self' === $video_type ) : ?> |
| 2040 | <video src="<?php echo esc_url( $hosted_url ); ?>" <?php echo $video_params; ?>></video> |
| 2041 | <?php endif; ?> |
| 2042 | </div> |
| 2043 | <div <?php echo $this->get_render_attribute_string('image_container'); ?>></div> |
| 2044 | <?php if ( 'yes' === $sticky ) { ?> |
| 2045 | <span class="premium-video-box-sticky-close"><i class="fas fa-times"></i></span> |
| 2046 | <?php } ?> |
| 2047 | <?php if ( 'yes' === $settings['sticky_info_bar_switch'] && '' !== $settings['sticky_info_bar_text'] ) { ?> |
| 2048 | <div <?php echo $this->get_render_attribute_string('info_bar'); ?>><?php echo wp_kses_post( $settings['sticky_info_bar_text'] ); ?></div> |
| 2049 | <?php } ?> |
| 2050 | <?php if( 'yes' === $settings['premium_video_box_play_icon_switcher'] && 'yes' !== $autoplay && !empty($thumbnail) ) : ?> |
| 2051 | <div class="premium-video-box-play-icon-container"> |
| 2052 | <i class="premium-video-box-play-icon fa fa-play fa-lg"></i> |
| 2053 | </div> |
| 2054 | <?php endif; ?> |
| 2055 | <?php if( $settings['premium_video_box_video_text_switcher'] === 'yes' && !empty( $settings['premium_video_box_description_text'] ) ) : ?> |
| 2056 | <div class="premium-video-box-description-container"> |
| 2057 | <p class="premium-video-box-text"><span <?php echo $this->get_render_attribute_string('premium_video_box_description_text'); ?>><?php echo $settings['premium_video_box_description_text']; ?></span></p> |
| 2058 | </div> |
| 2059 | <?php endif; ?> |
| 2060 | </div> |
| 2061 | </div> |
| 2062 | </div> |
| 2063 | </div> |
| 2064 | <?php |
| 2065 | } |
| 2066 | |
| 2067 | /* |
| 2068 | * Get video thumbnail |
| 2069 | * |
| 2070 | * @access public |
| 2071 | * |
| 2072 | * @param string $id video ID |
| 2073 | */ |
| 2074 | private function get_thumbnail( $id = '' ) { |
| 2075 | |
| 2076 | $settings = $this->get_settings_for_display(); |
| 2077 | |
| 2078 | $type = $settings['premium_video_box_video_type']; |
| 2079 | |
| 2080 | $overlay = $settings['premium_video_box_image_switcher']; |
| 2081 | |
| 2082 | if ( 'yes' !== $overlay ) { |
| 2083 | |
| 2084 | //Check thumbnail size option only for Youtube videos |
| 2085 | $size = ''; |
| 2086 | if( 'youtube' === $type ) { |
| 2087 | $size = $settings['premium_video_box_yt_thumbnail_size']; |
| 2088 | } |
| 2089 | |
| 2090 | $thumbnail_src = Helper_Functions::get_video_thumbnail( $id, $type, $size ); |
| 2091 | |
| 2092 | } else { |
| 2093 | $thumbnail_src = $settings['premium_video_box_image']['url']; |
| 2094 | } |
| 2095 | |
| 2096 | return $thumbnail_src; |
| 2097 | |
| 2098 | } |
| 2099 | |
| 2100 | /* |
| 2101 | * Get video params |
| 2102 | * |
| 2103 | * Get video ID and url |
| 2104 | * |
| 2105 | * @access public |
| 2106 | * |
| 2107 | * @param string $video_url video URL |
| 2108 | * |
| 2109 | * @return array video parameters |
| 2110 | */ |
| 2111 | private function get_video_params( $video_url = '' ) { |
| 2112 | |
| 2113 | $settings = $this->get_settings_for_display(); |
| 2114 | |
| 2115 | $type = $settings['premium_video_box_video_type']; |
| 2116 | |
| 2117 | $identifier = $settings['premium_video_box_video_id_embed_selection']; |
| 2118 | |
| 2119 | $id = $settings['premium_video_box_video_id']; |
| 2120 | |
| 2121 | $embed = $settings['premium_video_box_video_embed']; |
| 2122 | |
| 2123 | if( empty( $video_url ) ) { |
| 2124 | $link = $settings['premium_video_box_link']; |
| 2125 | } else { |
| 2126 | $link = $video_url; |
| 2127 | } |
| 2128 | |
| 2129 | |
| 2130 | if ( ! empty( $link ) ) { |
| 2131 | if ( 'youtube' === $type ) { |
| 2132 | $video_props = Embed::get_video_properties( $link ); |
| 2133 | $link = Embed::get_embed_url( $link ); |
| 2134 | $video_id = $video_props['video_id']; |
| 2135 | |
| 2136 | } elseif ( 'vimeo' === $type ) { |
| 2137 | $mask = '/^.*vimeo\.com\/(?:[a-z]*\/)*([0-9]{6,11})[?]?.*/'; |
| 2138 | $video_id = substr( $link, strpos( $link, '.com/' ) + 5 ); |
| 2139 | preg_match( $mask, $link, $matches ); |
| 2140 | if( $matches ) { |
| 2141 | $video_id = $matches[1]; |
| 2142 | } else { |
| 2143 | $video_id = substr( $link, strpos( $link, '.com/' ) + 5 ); |
| 2144 | } |
| 2145 | $link = sprintf( 'https://player.vimeo.com/video/%s', $video_id ); |
| 2146 | } |
| 2147 | |
| 2148 | $id = $video_id; |
| 2149 | } elseif ( ! empty( $id ) || ! empty ( $embed ) ) { |
| 2150 | |
| 2151 | if( 'id' === $identifier ) { |
| 2152 | $link = 'youtube' === $type ? sprintf('https://www.youtube.com/embed/%s', $id ) : sprintf('https://player.vimeo.com/video/%s', $id ); |
| 2153 | } else { |
| 2154 | $link = $embed; |
| 2155 | } |
| 2156 | |
| 2157 | } |
| 2158 | |
| 2159 | return [ |
| 2160 | 'link' => $link, |
| 2161 | 'id' => $id |
| 2162 | ]; |
| 2163 | |
| 2164 | } |
| 2165 | |
| 2166 | /* |
| 2167 | * Get Vimeo header |
| 2168 | * |
| 2169 | * Get Vimeo video meta data |
| 2170 | * |
| 2171 | * @access private |
| 2172 | * |
| 2173 | * @param string $id video ID |
| 2174 | */ |
| 2175 | private function get_vimeo_header( $id ) { |
| 2176 | |
| 2177 | $settings = $this->get_settings_for_display(); |
| 2178 | |
| 2179 | if( 'vimeo' !== $settings['premium_video_box_video_type'] ) { |
| 2180 | return; |
| 2181 | } |
| 2182 | |
| 2183 | $vimeo_data = Helper_Functions::get_vimeo_video_data( $id ); |
| 2184 | |
| 2185 | if ( 'yes' === $settings['vimeo_portrait'] || 'yes' === $settings['vimeo_title'] || 'yes' === $settings['vimeo_byline'] |
| 2186 | ) { |
| 2187 | ?> |
| 2188 | <div class="premium-video-box-vimeo-wrap"> |
| 2189 | <?php if ( 'yes' === $settings['vimeo_portrait'] && !empty($vimeo_data['portrait']) ) { ?> |
| 2190 | <div class="premium-video-box-vimeo-portrait"> |
| 2191 | <a href="<?php echo $vimeo_data['url']; ?>" target="_blank"> |
| 2192 | <img src="<?php echo $vimeo_data['portrait']; ?>" alt=""> |
| 2193 | </a> |
| 2194 | </div> |
| 2195 | <?php } ?> |
| 2196 | <?php |
| 2197 | if ( 'yes' === $settings['vimeo_title'] || 'yes' === $settings['vimeo_byline'] ) { ?> |
| 2198 | <div class="premium-video-box-vimeo-headers"> |
| 2199 | <?php if ( 'yes' === $settings['vimeo_title'] && !empty( $vimeo_data['title'] ) ) { ?> |
| 2200 | <div class="premium-video-box-vimeo-title"> |
| 2201 | <a href="<?php echo $settings['premium_video_box_link']; ?>" target="_blank"> |
| 2202 | <?php echo $vimeo_data['title']; ?> |
| 2203 | </a> |
| 2204 | </div> |
| 2205 | <?php } ?> |
| 2206 | <?php if ( 'yes' === $settings['vimeo_byline'] && !empty( $vimeo_data['user'] ) ) { ?> |
| 2207 | <div class="premium-video-box-vimeo-byline"> |
| 2208 | <?php _e( 'from ', 'premium-addons-for-elementor' ); ?> <a href="<?php echo $vimeo_data['url']; ?>" target="_blank"><?php echo $vimeo_data['user']; ?></a> |
| 2209 | </div> |
| 2210 | <?php } ?> |
| 2211 | </div> |
| 2212 | <?php } ?> |
| 2213 | </div> |
| 2214 | <?php } ?> |
| 2215 | <?php |
| 2216 | |
| 2217 | return isset( $vimeo_data['user'] ) ? true : false; |
| 2218 | } |
| 2219 | |
| 2220 | /* |
| 2221 | * has image overlay |
| 2222 | * |
| 2223 | * Check if video overlay option is enabled |
| 2224 | * |
| 2225 | * @access private |
| 2226 | * |
| 2227 | */ |
| 2228 | private function has_image_overlay() { |
| 2229 | |
| 2230 | $settings = $this->get_settings_for_display(); |
| 2231 | |
| 2232 | return ! empty( $settings['premium_video_box_image']['url'] ) && 'yes' === $settings['premium_video_box_image_switcher']; |
| 2233 | |
| 2234 | } |
| 2235 | |
| 2236 | /** |
| 2237 | * Render Youtube Playlist |
| 2238 | * |
| 2239 | * Render the HTML Markup for a Youtube playlist |
| 2240 | * |
| 2241 | * @since 4.0.0 |
| 2242 | * @access private |
| 2243 | * |
| 2244 | * @param array $playlist_videos Playlist Videos |
| 2245 | * |
| 2246 | */ |
| 2247 | private function render_grid_youtube_playlist( $playlist_videos ) { |
| 2248 | |
| 2249 | $settings = $this->get_settings_for_display(); |
| 2250 | |
| 2251 | $source = $settings['source']; |
| 2252 | |
| 2253 | $limit = 9999; |
| 2254 | |
| 2255 | if ( ! empty( $settings['limit_num'] ) ) { |
| 2256 | $limit = $settings['limit_num']; |
| 2257 | } |
| 2258 | |
| 2259 | ?> |
| 2260 | <div class="premium-video-box-playlist-container"> |
| 2261 | <?php |
| 2262 | if( count( $playlist_videos ) ) { |
| 2263 | |
| 2264 | $limit_counter = 0; |
| 2265 | |
| 2266 | foreach( $playlist_videos as $video ) { |
| 2267 | |
| 2268 | $id = 'playlist' === $source ? $video->snippet->resourceId->videoId : $video->id->videoId; |
| 2269 | |
| 2270 | if( 'playlist' === $source && $video->status->privacyStatus !== 'public' ) { |
| 2271 | continue; |
| 2272 | } |
| 2273 | |
| 2274 | if( $limit_counter == $limit ) { |
| 2275 | break; |
| 2276 | } |
| 2277 | |
| 2278 | $limit_counter++ ; |
| 2279 | |
| 2280 | // $id = $video->snippet->resourceId->videoId; |
| 2281 | |
| 2282 | $video_url = sprintf( 'https://www.youtube.com/watch?v=%s', $id ); |
| 2283 | |
| 2284 | $video_params = $this->get_video_params( $video_url ); |
| 2285 | |
| 2286 | $link = $video_params['link']; |
| 2287 | |
| 2288 | $size = $settings['premium_video_box_yt_thumbnail_size']; |
| 2289 | |
| 2290 | $thumbnails_url = sprintf( 'url(\'https://i.ytimg.com/vi/%s/%s.jpg\')', $id , $size ); |
| 2291 | |
| 2292 | $related = $settings['premium_video_box_suggested_videos']; |
| 2293 | |
| 2294 | $mute = $settings['premium_video_box_mute']; |
| 2295 | |
| 2296 | $loop = $settings['premium_video_box_loop']; |
| 2297 | |
| 2298 | $options = '&rel=' ; |
| 2299 | $options .= 'yes' === $related ? '1' : '0'; |
| 2300 | $options .= '&mute=' ; |
| 2301 | $options .= 'yes' === $mute ? '1' : '0'; |
| 2302 | $options .= '&loop='; |
| 2303 | $options .= 'yes' === $loop ? '1' : '0'; |
| 2304 | |
| 2305 | if ( $settings['premium_video_box_start'] ) { |
| 2306 | $options .= '&start=' . $settings['premium_video_box_start']; |
| 2307 | } |
| 2308 | |
| 2309 | if ( $settings['premium_video_box_end'] ) { |
| 2310 | $options .= '&end=' . $settings['premium_video_box_end']; |
| 2311 | } |
| 2312 | |
| 2313 | |
| 2314 | $this->add_render_attribute('container' . $id, [ |
| 2315 | 'id' => 'premium-video-box-container-' . $id, |
| 2316 | 'class' => 'premium-video-box-container', |
| 2317 | ] |
| 2318 | ); |
| 2319 | |
| 2320 | $this->add_render_attribute('video_container' . $id, [ |
| 2321 | 'data-src' => $link . $options, |
| 2322 | 'class' => 'premium-video-box-video-container' |
| 2323 | ] |
| 2324 | ); |
| 2325 | |
| 2326 | $this->add_render_attribute('image_container' . $id, [ |
| 2327 | 'style' => "background-image:" . $thumbnails_url, |
| 2328 | 'class' => [ |
| 2329 | 'premium-video-box-image-container' , |
| 2330 | $settings['premium_video_box_img_effect'] |
| 2331 | ] |
| 2332 | ] |
| 2333 | ); |
| 2334 | |
| 2335 | if( $settings['mask_video_box_switcher'] === 'yes' ) { |
| 2336 | |
| 2337 | $this->add_render_attribute('container'. $id, 'data-mask', 'true' ); |
| 2338 | $this->add_render_attribute( 'mask' . $id, 'class', 'premium-video-box-mask-media' ); |
| 2339 | |
| 2340 | if ( $settings['premium_video_box_img_effect'] === 'blur') { |
| 2341 | $this->add_render_attribute( 'image_container' . $id, 'class', 'premium-video-box-mask-media' ); |
| 2342 | } |
| 2343 | |
| 2344 | if( $settings['mask_shape_video_box']['url'] !== '' && $settings['video_box_shadow'] === 'yes' ) { |
| 2345 | |
| 2346 | $this->add_render_attribute( 'container'. $id, 'class', 'premium-video-box-mask-filter' ); |
| 2347 | |
| 2348 | } |
| 2349 | |
| 2350 | } |
| 2351 | |
| 2352 | ?> |
| 2353 | <div <?php echo $this->get_render_attribute_string( 'container' . $id ); ?>> |
| 2354 | <div <?php echo $this->get_render_attribute_string( 'mask' . $id ); ?>> |
| 2355 | <div <?php echo $this->get_render_attribute_string('video_container' . $id); ?>> |
| 2356 | </div> |
| 2357 | <div <?php echo $this->get_render_attribute_string('image_container' . $id); ?> ></div> |
| 2358 | <?php if( 'yes' === $settings['premium_video_box_play_icon_switcher'] ) : ?> |
| 2359 | <div class="premium-video-box-play-icon-container"> |
| 2360 | <i class="premium-video-box-play-icon fa fa-play fa-lg"></i> |
| 2361 | </div> |
| 2362 | <?php endif; ?> |
| 2363 | </div> |
| 2364 | </div> |
| 2365 | <?php |
| 2366 | |
| 2367 | } |
| 2368 | |
| 2369 | } |
| 2370 | ?> |
| 2371 | </div> |
| 2372 | <?php |
| 2373 | } |
| 2374 | |
| 2375 | /** |
| 2376 | * Fetch Youtube Playlist Data |
| 2377 | * |
| 2378 | * Fetch API Data for a Youtube playlist |
| 2379 | * |
| 2380 | * @since 4.0.0 |
| 2381 | * @access private |
| 2382 | * |
| 2383 | */ |
| 2384 | private function fetch_youtube_playlist_data() { |
| 2385 | |
| 2386 | $settings = $this->get_settings_for_display(); |
| 2387 | |
| 2388 | $api_key = Admin_Helper::get_integrations_settings()['premium-youtube-api']; |
| 2389 | |
| 2390 | if ( empty( $api_key ) || ( empty ( $settings['playlist_id'] ) && empty ( $settings['channel_id'] ) ) ) { ?> |
| 2391 | <div class="premium-error-notice"> |
| 2392 | <?php echo __('Please Enter a Valid API Key & Channel/Playlist ID','premium-addons-for-elementor'); ?> |
| 2393 | </div> |
| 2394 | <?php |
| 2395 | return false; |
| 2396 | } |
| 2397 | |
| 2398 | if( 'playlist' === $settings['source'] ) { |
| 2399 | $api_url = 'https://www.googleapis.com/youtube/v3/playlistItems?key=' . $api_key . '&playlistId='. $settings['playlist_id'] .'&part=snippet,id,status&order=date&maxResults=50'; |
| 2400 | } else { |
| 2401 | $api_url = 'https://www.googleapis.com/youtube/v3/search?key=' . $api_key . '&channelId='. $settings['channel_id'] .'&part=snippet,id&order=date&maxResults=50'; |
| 2402 | } |
| 2403 | |
| 2404 | $api_response = rplg_urlopen( $api_url ); |
| 2405 | |
| 2406 | $response_data = $api_response[ 'data' ]; |
| 2407 | |
| 2408 | $response_json = rplg_json_decode( $response_data ); |
| 2409 | |
| 2410 | $playlist_videos = isset( $response_json->items ) ? $response_json->items : ''; |
| 2411 | |
| 2412 | if ( empty ( $playlist_videos ) ) { ?> |
| 2413 | <div class="premium-error-notice"> |
| 2414 | <?php echo __('Something went wrong. It seems like the playlist you selected does not have any videos','premium-addons-for-elementor'); ?> |
| 2415 | </div> |
| 2416 | <?php |
| 2417 | return false; |
| 2418 | } |
| 2419 | |
| 2420 | $video_number = intval ( 100 / substr( $settings['video_columns'], 0, strpos( $settings['video_columns'], '%') ) ); |
| 2421 | |
| 2422 | $this->render_grid_youtube_playlist( $playlist_videos ); |
| 2423 | |
| 2424 | } |
| 2425 | |
| 2426 | |
| 2427 | } |