| 1 |
<?php |
| 2 |
namespace Enteraddons\Widgets\Video_Button\Traits; |
| 3 |
/** |
| 4 |
* Enteraddons template class |
| 5 |
* |
| 6 |
* @package Enteraddons |
| 7 |
* @author ThemeLooks |
| 8 |
* @copyright 2022 ThemeLooks |
| 9 |
* @license GPL-2.0-or-later |
| 10 |
* |
| 11 |
* |
| 12 |
*/ |
| 13 |
|
| 14 |
trait Templates_Components { |
| 15 |
|
| 16 |
// Set Settings options |
| 17 |
protected static function getSettings() { |
| 18 |
return self::getDisplaySettings(); |
| 19 |
} |
| 20 |
// |
| 21 |
protected static function button() { |
| 22 |
$settings = self::getSettings(); |
| 23 |
|
| 24 |
if( !empty( $settings['btn_icon']['library'] ) && $settings['btn_icon']['library'] == 'svg' ) { |
| 25 |
$icon = !empty( $settings['btn_icon']['value']['url'] ) ? '<img src="'.esc_url( $settings['btn_icon']['value']['url'] ).'" />' : ''; |
| 26 |
} else { |
| 27 |
$icon = !empty( $settings['btn_icon']['value'] ) ? '<i class="'.esc_attr( $settings['btn_icon']['value'] ).'"></i>' : ''; |
| 28 |
} |
| 29 |
// |
| 30 |
if( !empty( $settings['video_url'] ) ) { |
| 31 |
$is_animation = !empty( $settings['circle_animation_active'] ) ? ' circle-ripple' : ''; |
| 32 |
echo '<a href="'.esc_url( $settings['video_url'] ).'" rel="magnificPopup" class="vdo_btn popup-video'.esc_attr( $is_animation ).'">'.$icon.'</a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
// |
| 37 |
protected static function image() { |
| 38 |
$settings = self::getSettings(); |
| 39 |
|
| 40 |
if( !empty( $settings['thumb_image']['url'] ) ) { |
| 41 |
echo '<img class="video-thumb-img" src="'.esc_url( $settings['thumb_image']['url'] ).'">'; |
| 42 |
} |
| 43 |
|
| 44 |
} |
| 45 |
// |
| 46 |
protected static function animation() { |
| 47 |
$settings = self::getSettings(); |
| 48 |
|
| 49 |
if( empty( $settings['circle_animation_active'] ) ) { |
| 50 |
return; |
| 51 |
} |
| 52 |
|
| 53 |
// |
| 54 |
$color1 = 'rgba(351, 148, 38, 0.3)'; |
| 55 |
$color2 = 'rgba(351, 148, 38, 0)'; |
| 56 |
if( !empty( $settings['play_btn_animation_color_one'] ) && !empty( $settings['play_btn_animation_color_two'] ) ) { |
| 57 |
$color1 = $settings['play_btn_animation_color_one']; |
| 58 |
$color2 = $settings['play_btn_animation_color_two']; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
echo '<style> |
| 63 |
@-webkit-keyframes enteraddons-ripple { |
| 64 |
0% { |
| 65 |
box-shadow: 0 0 0 0 '.esc_attr( $color1 ).', 0 0 0 10px '.esc_attr( $color1 ).', 0 0 0 20px '.esc_attr( $color1 ).', 0 0 0 30px '.esc_attr( $color1 ).'; |
| 66 |
} |
| 67 |
100% { |
| 68 |
box-shadow: 0 0 0 10px '.esc_attr( $color1 ).', 0 0 0 20px '.esc_attr( $color1 ).', 0 0 0 30px '.esc_attr( $color1 ).', 0 0 0 40px '.esc_attr($color2).'; |
| 69 |
} |
| 70 |
} |
| 71 |
@keyframes enteraddons-ripple { |
| 72 |
0% { |
| 73 |
box-shadow: 0 0 0 0 '.esc_attr( $color1 ).', 0 0 0 10px '.esc_attr( $color1 ).', 0 0 0 20px '.esc_attr( $color1 ).', 0 0 0 30px '.esc_attr( $color1 ).'; |
| 74 |
} |
| 75 |
100% { |
| 76 |
box-shadow: 0 0 0 10px '.esc_attr( $color1 ).', 0 0 0 20px '.esc_attr( $color1 ).', 0 0 0 30px '.esc_attr( $color1 ).', 0 0 0 40px '.esc_attr($color2).'; |
| 77 |
} |
| 78 |
} |
| 79 |
</style>'; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
} |