theme-elements
6 years ago
accordion.php
6 years ago
audio.php
6 years ago
before-after.php
6 years ago
button.php
6 years ago
carousel-navigation.php
6 years ago
contact-box.php
6 years ago
contact-form.php
6 years ago
custom-list.php
6 years ago
divider.php
6 years ago
gallery.php
6 years ago
gmap.php
6 years ago
heading-modern.php
6 years ago
icon.php
6 years ago
image.php
6 years ago
mailchimp.php
6 years ago
modern-button.php
6 years ago
quote.php
6 years ago
recent-comments.php
6 years ago
recent-posts-grid-carousel.php
6 years ago
recent-posts-land-style.php
6 years ago
recent-posts-masonry.php
6 years ago
recent-posts-tiles-carousel.php
6 years ago
recent-posts-tiles.php
6 years ago
recent-posts-timeline.php
6 years ago
recent-products.php
6 years ago
responsive-table.php
6 years ago
search.php
6 years ago
staff.php
6 years ago
svg.php
6 years ago
tabs.php
6 years ago
testimonial.php
6 years ago
text.php
6 years ago
touch-slider.php
6 years ago
video.php
6 years ago
audio.php
201 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; // Exit if accessed directly. |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Elementor 'Audio' widget. |
| 15 | * |
| 16 | * Elementor widget that displays an 'Audio' with lightbox. |
| 17 | * |
| 18 | * @since 1.0.0 |
| 19 | */ |
| 20 | class Audio extends Widget_Base { |
| 21 | |
| 22 | /** |
| 23 | * Get widget name. |
| 24 | * |
| 25 | * Retrieve 'Audio' widget name. |
| 26 | * |
| 27 | * @since 1.0.0 |
| 28 | * @access public |
| 29 | * |
| 30 | * @return string Widget name. |
| 31 | */ |
| 32 | public function get_name() { |
| 33 | return 'aux_audio'; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Get widget title. |
| 38 | * |
| 39 | * Retrieve 'Audio' widget title. |
| 40 | * |
| 41 | * @since 1.0.0 |
| 42 | * @access public |
| 43 | * |
| 44 | * @return string Widget title. |
| 45 | */ |
| 46 | public function get_title() { |
| 47 | return __('Audio Player', 'auxin-elements' ); |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Get widget icon. |
| 52 | * |
| 53 | * Retrieve 'Audio' widget icon. |
| 54 | * |
| 55 | * @since 1.0.0 |
| 56 | * @access public |
| 57 | * |
| 58 | * @return string Widget icon. |
| 59 | */ |
| 60 | public function get_icon() { |
| 61 | return 'eicon-play auxin-badge'; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Get widget categories. |
| 66 | * |
| 67 | * Retrieve 'Audio' widget icon. |
| 68 | * |
| 69 | * @since 1.0.0 |
| 70 | * @access public |
| 71 | * |
| 72 | * @return string Widget icon. |
| 73 | */ |
| 74 | public function get_categories() { |
| 75 | return array( 'auxin-core' ); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Register 'Audio' widget controls. |
| 80 | * |
| 81 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 82 | * |
| 83 | * @since 1.0.0 |
| 84 | * @access protected |
| 85 | */ |
| 86 | protected function _register_controls() { |
| 87 | |
| 88 | /*-----------------------------------------------------------------------------------*/ |
| 89 | /* audio_section |
| 90 | /*-----------------------------------------------------------------------------------*/ |
| 91 | |
| 92 | $this->start_controls_section( |
| 93 | 'audio_section', |
| 94 | array( |
| 95 | 'label' => __('Audio', 'auxin-elements' ), |
| 96 | ) |
| 97 | ); |
| 98 | |
| 99 | $this->add_control( |
| 100 | 'src', |
| 101 | array( |
| 102 | 'label' => __('Audio file(MP3 or ogg)','auxin-elements' ), |
| 103 | 'type' => 'aux-media', |
| 104 | 'media_filter' => 'audio', |
| 105 | ) |
| 106 | ); |
| 107 | |
| 108 | $this->add_control( |
| 109 | 'autoplay', |
| 110 | array( |
| 111 | 'label' => __('AutoPlay','auxin-elements' ), |
| 112 | 'description' => __('Play the audio file automatically.','auxin-elements' ), |
| 113 | 'type' => Controls_Manager::SWITCHER, |
| 114 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 115 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 116 | 'return_value' => 'yes', |
| 117 | 'default' => 'no' |
| 118 | ) |
| 119 | ); |
| 120 | |
| 121 | $this->add_control( |
| 122 | 'loop', |
| 123 | array( |
| 124 | 'label' => __('Repeat the audio','auxin-elements' ), |
| 125 | 'type' => Controls_Manager::SWITCHER, |
| 126 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 127 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 128 | 'return_value' => 'yes', |
| 129 | 'default' => 'yes' |
| 130 | ) |
| 131 | ); |
| 132 | |
| 133 | $this->end_controls_section(); |
| 134 | |
| 135 | /*-----------------------------------------------------------------------------------*/ |
| 136 | /* skin_section |
| 137 | /*-----------------------------------------------------------------------------------*/ |
| 138 | |
| 139 | $this->start_controls_section( |
| 140 | 'skin_section', |
| 141 | array( |
| 142 | 'label' => __('Skin', 'auxin-elements' ), |
| 143 | 'tab' => Controls_Manager::TAB_STYLE, |
| 144 | ) |
| 145 | ); |
| 146 | |
| 147 | $this->add_control( |
| 148 | 'skin', |
| 149 | array( |
| 150 | 'label' => __('Skin','auxin-elements' ), |
| 151 | 'description' => __('The skin of audio element.','auxin-elements' ), |
| 152 | 'type' => 'aux-visual-select', |
| 153 | 'options' => array( |
| 154 | 'default' => array( |
| 155 | 'label' => __('Theme Default', 'auxin-elements'), |
| 156 | 'image' => AUXIN_URL . 'images/visual-select/default2.svg' |
| 157 | ), |
| 158 | 'dark' => array( |
| 159 | 'label' => __('Dark', 'auxin-elements'), |
| 160 | 'image' => AUXIN_URL . 'images/visual-select/audio-player-dark.svg' |
| 161 | ), |
| 162 | 'light' => array( |
| 163 | 'label' => __('Light', 'auxin-elements'), |
| 164 | 'image' => AUXIN_URL . 'images/visual-select/audio-player-light.svg' |
| 165 | ) |
| 166 | ), |
| 167 | 'default' => 'dark' |
| 168 | ) |
| 169 | ); |
| 170 | |
| 171 | $this->end_controls_section(); |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Render image box widget output on the frontend. |
| 176 | * |
| 177 | * Written in PHP and used to generate the final HTML. |
| 178 | * |
| 179 | * @since 1.0.0 |
| 180 | * @access protected |
| 181 | */ |
| 182 | protected function render() { |
| 183 | |
| 184 | $settings = $this->get_settings_for_display(); |
| 185 | |
| 186 | |
| 187 | $args = array( |
| 188 | 'src' => $settings['src']['id'], |
| 189 | 'loop' => $settings['loop'], |
| 190 | 'autoplay' => $settings['autoplay'], |
| 191 | |
| 192 | 'skin' => $settings['skin'], |
| 193 | ); |
| 194 | |
| 195 | // get the shortcode base blog page |
| 196 | echo auxin_widget_audio_callback( $args ); |
| 197 | |
| 198 | } |
| 199 | |
| 200 | } |
| 201 |