Plugin Directory

Changeset 2897102


Ignore:
Timestamp:
04/11/2023 10:21:18 AM (3 years ago)
Author:
museai
Message:

Create tag 0.4

Location:
muse-ai
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • muse-ai/tags/0.4/muse-ai.php

    r2855229 r2897102  
    99
    1010add_action('init', 'museai_init');
     11add_action('elementor/widgets/register', 'museai_elementor');
    1112add_shortcode('muse-ai', 'museai_shortcode_video');
    1213
     
    8182    return $out;
    8283}
     84
     85function museai_elementor( $widgets_manager ) {
     86    class Elementor_Museai_Widget extends \Elementor\Widget_Base {
     87        public function get_name() {
     88            return 'muse.ai';
     89        }
     90        public function get_title() {
     91            return esc_html__( 'muse.ai', 'elementor-oembed-widget' );
     92        }
     93        public function get_icon() {
     94            return 'eicon-youtube';
     95        }
     96        public function get_custom_help_url() {
     97            return 'https://wordpress.org/plugins/muse-ai/';
     98        }
     99        public function get_categories() {
     100            return [ 'general' ];
     101        }
     102        public function get_keywords() {
     103            return [ 'embed', 'url', 'link', 'video' ];
     104        }
     105        protected function register_controls() {
     106            $this->start_controls_section(
     107                'content_section',
     108                [
     109                    'label' => esc_html__( 'Content', 'elementor-museai-widget' ),
     110                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
     111                ]
     112            );
     113            $this->add_control(
     114                'id',
     115                [
     116                    'label' => esc_html__( 'Video ID', 'elementor-museai-widget' ),
     117                    'type' => \Elementor\Controls_Manager::TEXT,
     118                    'input_type' => 'text',
     119                    'placeholder' => esc_html__( 'A1b2C3d', 'elementor-oembed-widget' ),
     120                ]
     121            );
     122            $this->add_control(
     123                'title',
     124                [
     125                    'label' => esc_html__( 'Title', 'elementor-museai-widget' ),
     126                    'type' => \Elementor\Controls_Manager::SWITCHER,
     127                    'label_on' => 'show',
     128                    'label_off' => 'hide',
     129                    'default' => 'yes',
     130                ]
     131            );
     132            $this->add_control(
     133                'logo',
     134                [
     135                    'label' => esc_html__( 'Logo', 'elementor-museai-widget' ),
     136                    'type' => \Elementor\Controls_Manager::SWITCHER,
     137                    'label_on' => 'show',
     138                    'label_off' => 'hide',
     139                    'default' => 'yes',
     140                ]
     141            );
     142            $this->add_control(
     143                'links',
     144                [
     145                    'label' => esc_html__( 'Link to video page', 'elementor-museai-widget' ),
     146                    'type' => \Elementor\Controls_Manager::SWITCHER,
     147                    'label_on' => 'yes',
     148                    'label_off' => 'no',
     149                    'default' => 'yes',
     150                ]
     151            );
     152            $this->add_control(
     153                'search',
     154                [
     155                    'label' => esc_html__( 'Search', 'elementor-museai-widget' ),
     156                    'type' => \Elementor\Controls_Manager::SWITCHER,
     157                    'label_on' => 'show',
     158                    'label_off' => 'hide',
     159                    'default' => 'yes',
     160                ]
     161            );
     162            $this->add_control(
     163                'autoplay',
     164                [
     165                    'label' => esc_html__( 'Autoplay', 'elementor-museai-widget' ),
     166                    'type' => \Elementor\Controls_Manager::SWITCHER,
     167                    'label_on' => 'yes',
     168                    'label_off' => 'no',
     169                    'default' => 'no',
     170                ]
     171            );
     172            $this->add_control(
     173                'mute',
     174                [
     175                    'label' => esc_html__( 'Mute', 'elementor-museai-widget' ),
     176                    'type' => \Elementor\Controls_Manager::SWITCHER,
     177                    'label_on' => 'yes',
     178                    'label_off' => 'no',
     179                    'default' => 'no',
     180                ]
     181            );
     182            $this->end_controls_section();
     183        }
     184        protected function render() {
     185            $settings = $this->get_settings_for_display();
     186            $embed_id = bin2hex(random_bytes(16));
     187            $html = wp_oembed_get( $settings['id'] );
     188
     189            $video_id = $settings['id'];
     190            $links = $settings['links'] == 'yes' ? 'true' : 'false';
     191            $logo = $settings['logo'] == 'yes' ? '1' : '0';
     192            $search = $settings['search'] == 'yes' ? '1' : '0';
     193            $title = $settings['title'] == 'yes' ? '1' : '0';
     194            $autoplay = $settings['autoplay'] == 'yes' ? '1' : '0';
     195            $volume = $settings['mute'] == 'yes' ? '0' : '100';
     196
     197            $out = sprintf(
     198                '<div id="museai-player-%s"></div>'.
     199                '<script>'.
     200                'MusePlayer({'.
     201                'container: "#museai-player-%1$s", video: "%s", '.
     202                'links: %s, logo: %s, search: %s, autoplay: %s, volume: %s, title: %s'.
     203                '})'.
     204                '</script>',
     205                $embed_id,
     206                $video_id,
     207                $links,
     208                $logo,
     209                $search,
     210                $autoplay,
     211                $volume,
     212                $title,
     213            );
     214            echo $out;
     215        }
     216    }
     217
     218    $widgets_manager->register( new Elementor_Museai_Widget() );
     219}
  • muse-ai/tags/0.4/readme.txt

    r2855229 r2897102  
    44Requires at least: 4.7
    55Tested up to: 6.1
    6 Stable tag: 0.3.4
     6Stable tag: 0.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    1212== Description ==
    1313
    14 This plugin simplifies the embedding of videos hosted on [muse.ai](https://muse.ai) platform. It does two things: whitelists muse.ai as an oEmbed provider (which lets you embed videos simply by pasting links), and adds shortcodes as an alternative method of embedding that gives you a bit more control. The shortcodes are essentially a wrapper around muse.ai [embed library](https://muse.ai/docs#embed-player).
     14This plugin simplifies the embedding of videos hosted on [muse.ai](https://muse.ai) platform.
     15
     16It does three things:
     17 - whitelists muse.ai as an oEmbed provider (which lets you embed videos simply by pasting links),
     18 - adds shortcodes as an alternative method of embedding that gives you a bit more control,
     19 - adds an Elementor widget for embedding muse.ai videos.
     20
     21The shortcodes are essentially a wrapper around muse.ai [embed library](https://muse.ai/docs#embed-player).
    1522
    1623To embed videos using oEmbed, simply paste a video link into a separate line in your post or page. For example:
     
    2330
    2431== Changelog ==
     32
     33= 0.4 =
     34* Basic Elementor widget.
    2535
    2636= 0.3.4 =
  • muse-ai/trunk/muse-ai.php

    r2855229 r2897102  
    99
    1010add_action('init', 'museai_init');
     11add_action('elementor/widgets/register', 'museai_elementor');
    1112add_shortcode('muse-ai', 'museai_shortcode_video');
    1213
     
    8182    return $out;
    8283}
     84
     85function museai_elementor( $widgets_manager ) {
     86    class Elementor_Museai_Widget extends \Elementor\Widget_Base {
     87        public function get_name() {
     88            return 'muse.ai';
     89        }
     90        public function get_title() {
     91            return esc_html__( 'muse.ai', 'elementor-oembed-widget' );
     92        }
     93        public function get_icon() {
     94            return 'eicon-youtube';
     95        }
     96        public function get_custom_help_url() {
     97            return 'https://wordpress.org/plugins/muse-ai/';
     98        }
     99        public function get_categories() {
     100            return [ 'general' ];
     101        }
     102        public function get_keywords() {
     103            return [ 'embed', 'url', 'link', 'video' ];
     104        }
     105        protected function register_controls() {
     106            $this->start_controls_section(
     107                'content_section',
     108                [
     109                    'label' => esc_html__( 'Content', 'elementor-museai-widget' ),
     110                    'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
     111                ]
     112            );
     113            $this->add_control(
     114                'id',
     115                [
     116                    'label' => esc_html__( 'Video ID', 'elementor-museai-widget' ),
     117                    'type' => \Elementor\Controls_Manager::TEXT,
     118                    'input_type' => 'text',
     119                    'placeholder' => esc_html__( 'A1b2C3d', 'elementor-oembed-widget' ),
     120                ]
     121            );
     122            $this->add_control(
     123                'title',
     124                [
     125                    'label' => esc_html__( 'Title', 'elementor-museai-widget' ),
     126                    'type' => \Elementor\Controls_Manager::SWITCHER,
     127                    'label_on' => 'show',
     128                    'label_off' => 'hide',
     129                    'default' => 'yes',
     130                ]
     131            );
     132            $this->add_control(
     133                'logo',
     134                [
     135                    'label' => esc_html__( 'Logo', 'elementor-museai-widget' ),
     136                    'type' => \Elementor\Controls_Manager::SWITCHER,
     137                    'label_on' => 'show',
     138                    'label_off' => 'hide',
     139                    'default' => 'yes',
     140                ]
     141            );
     142            $this->add_control(
     143                'links',
     144                [
     145                    'label' => esc_html__( 'Link to video page', 'elementor-museai-widget' ),
     146                    'type' => \Elementor\Controls_Manager::SWITCHER,
     147                    'label_on' => 'yes',
     148                    'label_off' => 'no',
     149                    'default' => 'yes',
     150                ]
     151            );
     152            $this->add_control(
     153                'search',
     154                [
     155                    'label' => esc_html__( 'Search', 'elementor-museai-widget' ),
     156                    'type' => \Elementor\Controls_Manager::SWITCHER,
     157                    'label_on' => 'show',
     158                    'label_off' => 'hide',
     159                    'default' => 'yes',
     160                ]
     161            );
     162            $this->add_control(
     163                'autoplay',
     164                [
     165                    'label' => esc_html__( 'Autoplay', 'elementor-museai-widget' ),
     166                    'type' => \Elementor\Controls_Manager::SWITCHER,
     167                    'label_on' => 'yes',
     168                    'label_off' => 'no',
     169                    'default' => 'no',
     170                ]
     171            );
     172            $this->add_control(
     173                'mute',
     174                [
     175                    'label' => esc_html__( 'Mute', 'elementor-museai-widget' ),
     176                    'type' => \Elementor\Controls_Manager::SWITCHER,
     177                    'label_on' => 'yes',
     178                    'label_off' => 'no',
     179                    'default' => 'no',
     180                ]
     181            );
     182            $this->end_controls_section();
     183        }
     184        protected function render() {
     185            $settings = $this->get_settings_for_display();
     186            $embed_id = bin2hex(random_bytes(16));
     187            $html = wp_oembed_get( $settings['id'] );
     188
     189            $video_id = $settings['id'];
     190            $links = $settings['links'] == 'yes' ? 'true' : 'false';
     191            $logo = $settings['logo'] == 'yes' ? '1' : '0';
     192            $search = $settings['search'] == 'yes' ? '1' : '0';
     193            $title = $settings['title'] == 'yes' ? '1' : '0';
     194            $autoplay = $settings['autoplay'] == 'yes' ? '1' : '0';
     195            $volume = $settings['mute'] == 'yes' ? '0' : '100';
     196
     197            $out = sprintf(
     198                '<div id="museai-player-%s"></div>'.
     199                '<script>'.
     200                'MusePlayer({'.
     201                'container: "#museai-player-%1$s", video: "%s", '.
     202                'links: %s, logo: %s, search: %s, autoplay: %s, volume: %s, title: %s'.
     203                '})'.
     204                '</script>',
     205                $embed_id,
     206                $video_id,
     207                $links,
     208                $logo,
     209                $search,
     210                $autoplay,
     211                $volume,
     212                $title,
     213            );
     214            echo $out;
     215        }
     216    }
     217
     218    $widgets_manager->register( new Elementor_Museai_Widget() );
     219}
  • muse-ai/trunk/readme.txt

    r2855229 r2897102  
    44Requires at least: 4.7
    55Tested up to: 6.1
    6 Stable tag: 0.3.4
     6Stable tag: 0.4
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    1212== Description ==
    1313
    14 This plugin simplifies the embedding of videos hosted on [muse.ai](https://muse.ai) platform. It does two things: whitelists muse.ai as an oEmbed provider (which lets you embed videos simply by pasting links), and adds shortcodes as an alternative method of embedding that gives you a bit more control. The shortcodes are essentially a wrapper around muse.ai [embed library](https://muse.ai/docs#embed-player).
     14This plugin simplifies the embedding of videos hosted on [muse.ai](https://muse.ai) platform.
     15
     16It does three things:
     17 - whitelists muse.ai as an oEmbed provider (which lets you embed videos simply by pasting links),
     18 - adds shortcodes as an alternative method of embedding that gives you a bit more control,
     19 - adds an Elementor widget for embedding muse.ai videos.
     20
     21The shortcodes are essentially a wrapper around muse.ai [embed library](https://muse.ai/docs#embed-player).
    1522
    1623To embed videos using oEmbed, simply paste a video link into a separate line in your post or page. For example:
     
    2330
    2431== Changelog ==
     32
     33= 0.4 =
     34* Basic Elementor widget.
    2535
    2636= 0.3.4 =
Note: See TracChangeset for help on using the changeset viewer.