Plugin Directory

Changeset 2690905


Ignore:
Timestamp:
03/08/2022 04:02:34 PM (4 years ago)
Author:
museai
Message:

Tag version 0.3

Location:
muse-ai
Files:
1 edited
3 copied

Legend:

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

    r2689003 r2690905  
    33 * Plugin Name: muse.ai
    44 * Description: Enable oEmbed and shortcode support for muse.ai video embedding.
    5  * Version: 0.2
     5 * Version: 0.3
    66 * Author: muse.ai
    77 * Author URI: https://muse.ai
     
    1818function museai_shortcode_video( $atts = [] ) {
    1919    $embed_id = bin2hex(random_bytes(16));
    20     $video_id = preg_replace('/[^a-z0-9%]/i', '', $atts['id']);
     20    $video_id = preg_replace('/[^a-z0-9]/i', '', $atts['id']);
    2121    $width = preg_replace('/[^0-9%]/', '', $atts['width'] ?? '100%');
     22    $volume = (int) preg_replace('/[^0-9]/', '', $atts['volume'] ?? '50');
     23    $autoplay = (int) preg_replace('/[^01]/', '', $atts['autoplay'] ?? '0');
     24    $title = (int) preg_replace('/[^01]/', '', $atts['title'] ?? '1');
     25    $style = preg_replace('/"/', '', $atts['style'] ?? 'full');
     26
     27    $links = preg_replace('/"/', '', $atts['links'] ?? '1');
     28    $links = $links == '0' || $links == '1' ? (int) $links : sprintf('"%s"', $links);
     29
     30    $logo = preg_replace('/"/', '', $atts['logo'] ?? '1');
     31    $logo = $logo == '0' || $logo == '1' ? (int) $logo : sprintf('"%s"', $logo);
     32
     33    $search = preg_replace('/"/', '', $atts['search'] ?? '1');
     34    $search = $search == '0' || $search == '1' ? (int) $search : sprintf('"%s"', $search);
     35
    2236    $out = sprintf(
    2337        '<div id="museai-player-%s"></div>'.
    24         '<script>MusePlayer({container: "#museai-player-%1$s", video: "%s", width: "%s"})</script>',
     38        '<script>'.
     39        'MusePlayer({'.
     40        'container: "#museai-player-%1$s", video: "%s", '.
     41        'width: "%s", links: %s, logo: %s, search: %s, autoplay: %s, '.
     42        'volume: %s, title: %s, style: "%s"'.
     43        '})'.
     44        '</script>',
    2545        $embed_id,
    2646        $video_id,
    27     $width
     47        $width,
     48        $links,
     49        $logo,
     50        $search,
     51        $autoplay,
     52        $volume,
     53        $title,
     54        $style
    2855    );
    2956    return $out;
  • muse-ai/trunk/muse-ai.php

    r2689003 r2690905  
    33 * Plugin Name: muse.ai
    44 * Description: Enable oEmbed and shortcode support for muse.ai video embedding.
    5  * Version: 0.2
     5 * Version: 0.3
    66 * Author: muse.ai
    77 * Author URI: https://muse.ai
     
    1818function museai_shortcode_video( $atts = [] ) {
    1919    $embed_id = bin2hex(random_bytes(16));
    20     $video_id = preg_replace('/[^a-z0-9%]/i', '', $atts['id']);
     20    $video_id = preg_replace('/[^a-z0-9]/i', '', $atts['id']);
    2121    $width = preg_replace('/[^0-9%]/', '', $atts['width'] ?? '100%');
     22    $volume = (int) preg_replace('/[^0-9]/', '', $atts['volume'] ?? '50');
     23    $autoplay = (int) preg_replace('/[^01]/', '', $atts['autoplay'] ?? '0');
     24    $title = (int) preg_replace('/[^01]/', '', $atts['title'] ?? '1');
     25    $style = preg_replace('/"/', '', $atts['style'] ?? 'full');
     26
     27    $links = preg_replace('/"/', '', $atts['links'] ?? '1');
     28    $links = $links == '0' || $links == '1' ? (int) $links : sprintf('"%s"', $links);
     29
     30    $logo = preg_replace('/"/', '', $atts['logo'] ?? '1');
     31    $logo = $logo == '0' || $logo == '1' ? (int) $logo : sprintf('"%s"', $logo);
     32
     33    $search = preg_replace('/"/', '', $atts['search'] ?? '1');
     34    $search = $search == '0' || $search == '1' ? (int) $search : sprintf('"%s"', $search);
     35
    2236    $out = sprintf(
    2337        '<div id="museai-player-%s"></div>'.
    24         '<script>MusePlayer({container: "#museai-player-%1$s", video: "%s", width: "%s"})</script>',
     38        '<script>'.
     39        'MusePlayer({'.
     40        'container: "#museai-player-%1$s", video: "%s", '.
     41        'width: "%s", links: %s, logo: %s, search: %s, autoplay: %s, '.
     42        'volume: %s, title: %s, style: "%s"'.
     43        '})'.
     44        '</script>',
    2545        $embed_id,
    2646        $video_id,
    27     $width
     47        $width,
     48        $links,
     49        $logo,
     50        $search,
     51        $autoplay,
     52        $volume,
     53        $title,
     54        $style
    2855    );
    2956    return $out;
Note: See TracChangeset for help on using the changeset viewer.