Changeset 2690905
- Timestamp:
- 03/08/2022 04:02:34 PM (4 years ago)
- Location:
- muse-ai
- Files:
-
- 1 edited
- 3 copied
-
tags/0.3 (copied) (copied from muse-ai/trunk)
-
tags/0.3/muse-ai.php (copied) (copied from muse-ai/trunk/muse-ai.php) (2 diffs)
-
tags/0.3/readme.txt (copied) (copied from muse-ai/trunk/readme.txt)
-
trunk/muse-ai.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
muse-ai/tags/0.3/muse-ai.php
r2689003 r2690905 3 3 * Plugin Name: muse.ai 4 4 * Description: Enable oEmbed and shortcode support for muse.ai video embedding. 5 * Version: 0. 25 * Version: 0.3 6 6 * Author: muse.ai 7 7 * Author URI: https://muse.ai … … 18 18 function museai_shortcode_video( $atts = [] ) { 19 19 $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']); 21 21 $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 22 36 $out = sprintf( 23 37 '<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>', 25 45 $embed_id, 26 46 $video_id, 27 $width 47 $width, 48 $links, 49 $logo, 50 $search, 51 $autoplay, 52 $volume, 53 $title, 54 $style 28 55 ); 29 56 return $out; -
muse-ai/trunk/muse-ai.php
r2689003 r2690905 3 3 * Plugin Name: muse.ai 4 4 * Description: Enable oEmbed and shortcode support for muse.ai video embedding. 5 * Version: 0. 25 * Version: 0.3 6 6 * Author: muse.ai 7 7 * Author URI: https://muse.ai … … 18 18 function museai_shortcode_video( $atts = [] ) { 19 19 $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']); 21 21 $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 22 36 $out = sprintf( 23 37 '<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>', 25 45 $embed_id, 26 46 $video_id, 27 $width 47 $width, 48 $links, 49 $logo, 50 $search, 51 $autoplay, 52 $volume, 53 $title, 54 $style 28 55 ); 29 56 return $out;
Note: See TracChangeset
for help on using the changeset viewer.