Changeset 2235095
- Timestamp:
- 01/29/2020 09:53:33 AM (6 years ago)
- Location:
- anyclip-media/trunk
- Files:
-
- 8 edited
-
anyclip-media.php (modified) (2 diffs)
-
css/anyclip-media.css (modified) (1 diff)
-
inc/anyclip-media-block.php (modified) (2 diffs)
-
inc/anyclip-media-classic-editor.php (modified) (6 diffs)
-
js/anyclip-editor-plugin.js (modified) (4 diffs)
-
js/anyclip-media-classic.js (modified) (4 diffs)
-
js/anyclip-media.js (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
anyclip-media/trunk/anyclip-media.php
r2226511 r2235095 5 5 * Description: Anyclip media plugin inserts playlists. 6 6 * Author: Anyclip R&D team 7 * Version: 1.0. 17 * Version: 1.0.3 8 8 * Author URI: https://anyclip.com 9 9 * Text Domain: inserts … … 17 17 require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-media-const.php'); 18 18 require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-media-block.php'); 19 require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-video-block.php'); 19 20 require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-media-classic-editor.php'); 21 require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-video-classic-editor.php'); -
anyclip-media/trunk/css/anyclip-media.css
r2224380 r2235095 10 10 } 11 11 12 .video-playlist-title-wrapper { 13 display: flex; 14 margin-top: 9px; 15 } 16 17 .title { 18 margin-left: 16px; 19 } 20 12 21 span[data-mce-p-class="anyclip-media"] { 13 22 width: 100%; -
anyclip-media/trunk/inc/anyclip-media-block.php
r2224380 r2235095 13 13 ); 14 14 wp_localize_script('anyclip-media-block', 'constants', array( 15 'ANYCLIP_EDITORIAL_URL' => ANYCLIP_EDITORIAL_URL 15 'ANYCLIP_EDITORIAL_URL' => ANYCLIP_EDITORIAL_URL, 16 'ANYCLIP_ASSETS_URL' => plugin_dir_url(__FILE__) . '../assets', 16 17 )); 17 18 wp_enqueue_style( … … 42 43 } 43 44 44 add_action( 'init', 'anyclip_gutenberg_media_init');45 add_action('init', 'anyclip_gutenberg_media_init'); -
anyclip-media/trunk/inc/anyclip-media-classic-editor.php
r2224380 r2235095 12 12 13 13 14 if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )) {14 if (preg_match_all('/'. $pattern .'/s', $post->post_content, $matches)) { 15 15 $keys = array(); 16 16 $result = array(); 17 foreach( $matches[0] as $key => $value) {17 foreach($matches[0] as $key => $value) { 18 18 // $matches[3] return the shortcode attribute as string 19 19 // replace space with '&' for parse_str() function 20 $get = str_replace(" ", "&" , $matches[3][$key] );20 $get = str_replace(" ", "&" , $matches[3][$key]); 21 21 parse_str($get, $output); 22 22 23 23 //get all shortcode attribute keys 24 $keys = array_unique( array_merge( $keys, array_keys($output)));24 $keys = array_unique(array_merge($keys, array_keys($output))); 25 25 $result[] = $output; 26 27 26 } 28 27 //var_dump($result); 29 if ( $keys && $result) {28 if ($keys && $result) { 30 29 // Loop the result array and add the missing shortcode attribute key 31 30 foreach ($result as $key => $value) { 32 31 // Loop the shortcode attribute key 33 32 foreach ($keys as $attr_key) { 34 $result[$key][$attr_key] = isset( $result[$key][$attr_key]) ? $result[$key][$attr_key] : NULL;33 $result[$key][$attr_key] = isset($result[$key][$attr_key]) ? $result[$key][$attr_key] : NULL; 35 34 } 36 35 //sort the array key 37 ksort( $result[$key]);36 ksort($result[$key]); 38 37 } 39 38 } … … 63 62 </div> 64 63 65 <a href="/?TB_inline&width= 600&height=550&inlineId=my-modal-id" class="thickbox button">64 <a href="/?TB_inline&width=1024&height=550&inlineId=my-modal-id" class="thickbox button"> 66 65 <span class="dashicons dashicons-playlist-video" style="vertical-align: text-top"></span> 67 66 AnyClip Playlist … … 72 71 add_thickbox(); 73 72 $template = <<<acm 74 <div id="anyclip-me ida-content" style="display:none;">73 <div id="anyclip-media-content" style="display:none;"> 75 74 </div> 76 <a href="%s&TB_iframe=true&width= 900&inlineId=anyclip-meida-content" class="thickbox button">75 <a href="%s&TB_iframe=true&width=1024&inlineId=anyclip-media-content" class="thickbox button"> 77 76 <span class="dashicons dashicons-playlist-video" style="vertical-align: text-top"></span> 78 77 AnyClip Playlist … … 91 90 92 91 function anyclip_js($plugins) { 93 if ( !function_exists('has_blocks') || !has_blocks()) {92 if (!function_exists('has_blocks') || !has_blocks()) { 94 93 wp_enqueue_script('anyclip_media', plugins_url('../js/anyclip-media-classic.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-dialog')); 95 94 }; … … 97 96 wp_localize_script('anyclip_media', 'constants', array( 98 97 'ANYCLIP_EDITORIAL_URL' => ANYCLIP_EDITORIAL_URL, 98 'ANYCLIP_ASSETS_URL' => plugin_dir_url(__FILE__) . '../assets', 99 99 'pluginsUrl' => plugins_url() 100 100 )); 101 101 102 add_editor_style(plugins_url( '../css/anyclip-media.css' , __FILE__ ));102 add_editor_style(plugins_url('../css/anyclip-media.css' , __FILE__ )); 103 103 } 104 104 105 add_filter( 'anyclip_mce_external_plugins', 'anyclip_mce_external_plugins');105 add_filter('anyclip_mce_external_plugins', 'anyclip_mce_external_plugins'); 106 106 107 function anyclip_mce_external_plugins( $plugin_array) {107 function anyclip_mce_external_plugins($plugin_array) { 108 108 return $array_merge($plugin_array, [ 109 'anyclip-media' => plugins_url( '../js/anyclip-editor-plugin.js' , __FILE__)109 'anyclip-media' => plugins_url('../js/anyclip-editor-plugin.js', __FILE__) 110 110 ]); 111 111 } … … 123 123 ); 124 124 125 return $content ?base64_decode($content) : '';125 return $content ? base64_decode($content) : ''; 126 126 } 127 127 -
anyclip-media/trunk/js/anyclip-editor-plugin.js
r2224380 r2235095 2 2 let currentAttrs; 3 3 4 tinymce.PluginManager.add('anyclip-media', function( editor, url) {4 tinymce.PluginManager.add('anyclip-media', function(editor, url) { 5 5 var sh_tag = 'anyclip-media'; 6 6 7 function replaceShortcodes( content) {8 return content.replace( /\[anyclip-media([^\]]*)\]([^\]]*)\[\/anyclip-media\]/g, function( all,attr,con) {7 function replaceShortcodes(content) { 8 return content.replace(/\[anyclip-media([^\]]*)\]([^\]]*)\[\/anyclip-media\]/g, function(all, attr, con) { 9 9 currentAttrs = attr; 10 10 return '<iframe class="anyclip-media" scrolling="no" id="anyclip-media" data-content="'+ btoa(attr) +'" ></iframe>'; … … 12 12 } 13 13 14 function restoreShortcodes( content) {15 return content.replace( /\<iframe.*anyclip\-media.*\<\/iframe\>/g, function( match) {16 return '[anyclip-media ' +currentAttrs+'][/anyclip-media]';14 function restoreShortcodes(content) { 15 return content.replace(/\<iframe.*anyclip\-media.*\<\/iframe\>/g, function(match) { 16 return '[anyclip-media ' + currentAttrs + '][/anyclip-media]'; 17 17 }); 18 18 } … … 20 20 //replace from shortcode to an image placeholder 21 21 editor.on('BeforeSetcontent', function(event){ 22 event.content = replaceShortcodes( event.content);22 event.content = replaceShortcodes(event.content); 23 23 }); 24 24 … … 32 32 }); 33 33 34 let acLogo = '<img style="position:absolute; top:5px; left:5px; opacity: 0.7;" src="' +url+'/../css/AnyClip-graystyle.png"/>';34 let acLogo = '<img style="position:absolute; top:5px; left:5px; opacity: 0.7;" src="' + url + '/../css/AnyClip-graystyle.png"/>'; 35 35 36 let acContent = acLogo + "<img style=\"width: 100%;\" src=" +params.thumbnail+"/>";36 let acContent = acLogo + "<img style=\"width: 100%;\" src=" + params.thumbnail + "/>"; 37 37 38 38 const iframeElement = document.querySelector('iframe#content_ifr').contentDocument.body.querySelector('iframe.anyclip-media'); -
anyclip-media/trunk/js/anyclip-media-classic.js
r2224380 r2235095 1 1 jQuery(document).ready(function ($) { 2 2 window.addEventListener("message", (msg) => { 3 if (msg && msg.data ) {3 if (msg && msg.data && msg.data.embed) { 4 4 doInsert({ 5 5 embedCode: msg.data.embed.embedCode, … … 16 16 let editorContent = getMceContent(); 17 17 18 if (editorContent.match(acRegEx)) {18 if (editorContent.match(acRegEx)) { 19 19 editorContent = editorContent.replace(acRegEx, () => generateSortCode(data)); 20 20 21 var activeEditor = tinymce.activeEditor ? tinymce.activeEditor :null;22 if (activeEditor!==null){21 var activeEditor = tinymce.activeEditor ? tinymce.activeEditor : null; 22 if (activeEditor !== null) { 23 23 activeEditor.setContent(editorContent); 24 24 } else { … … 42 42 if (jQuery("#wp-content-wrap").hasClass("tmce-active")){ 43 43 return tinyMCE.activeEditor.getContent(); 44 } else{44 } else { 45 45 return jQuery('textarea.wp-editor-area#content').val(); 46 46 } … … 51 51 52 52 window.eduResModalShow = function(that){ 53 tb_show( 'AnyClip Media', constants.ANYCLIP_EDITORIAL_URL+' /?TB_iframe&width=700&height=500' );53 tb_show( 'AnyClip Media', constants.ANYCLIP_EDITORIAL_URL+'?TB_iframe&width=1024&height=500' ); 54 54 return false; 55 55 } -
anyclip-media/trunk/js/anyclip-media.js
r2224380 r2235095 9 9 10 10 wp.blocks.registerBlockType('anyclip/media-box', { 11 title: 'Any clip Media',11 title: 'AnyClip Playlist', 12 12 description: 'Block inserts anyclip player', 13 icon: ' format-video',13 icon: 'playlist-video', 14 14 category: 'common', 15 15 supports: { 16 multiple: false,16 multiple: true, 17 17 html: true, 18 18 reusable: false, … … 46 46 const { attributes: { contentHTML, thumbnail, playlistId }, setAttributes } = props; 47 47 const postTitle = wp.data.select('core/editor').getCurrentPostAttribute('title'); 48 const msgEventList ner = (msg) => {49 if (msg && msg.data ) {48 const msgEventListener = (msg) => { 49 if (msg && msg.data && msg.data.embed) { 50 50 doInsert({ 51 51 embedCode: msg.data.embed.embedCode, 52 thumbnail: msg.data.thumbnail ,52 thumbnail: msg.data.thumbnail || '', 53 53 playlistId: msg.data.playlistId 54 54 }) … … 84 84 }); 85 85 86 window.removeEventListener("message", msgEventList ner, false);86 window.removeEventListener("message", msgEventListener, false); 87 87 88 88 updateContent(data); … … 104 104 wp.element.createElement( 105 105 'div', 106 {className: "components-placeholder"}, 107 // props.attributes.content? 108 thumbnail && thumbnail.length ? 109 wp.element.createElement('img', { 110 src: thumbnail 111 }) 112 : wp.element.createElement(wp.components.Icon, { 106 { 107 className: "components-placeholder", 108 }, 109 110 thumbnail && thumbnail.length 111 ? 112 wp.element.createElement('img', { 113 src: thumbnail, 114 }) 115 : 116 wp.element.createElement(wp.components.Icon, { 113 117 icon: 'format-video', 114 118 size: 320, 115 }, '') 116 // :null, 117 ,wp.element.createElement(wp.components.IconButton, { 118 icon: "media-video", 119 }, 120 '' 121 ), 122 wp.element.createElement(wp.components.IconButton, { 123 icon: "playlist-video", 119 124 onClick: openModal, 120 isLarge: !0 121 }, contentHTML ? __('Edit', 'anyclip-media') : __("Anyclip Media", "anyclip-media")) 122 , props.attributes.isModalOpen ? 123 window.removeEventListener("message", msgEventListner) || 124 window.addEventListener("message", msgEventListner, false) || 125 isLarge: !0, 126 }, 127 contentHTML ? __('Edit', 'anyclip-media') : __("AnyClip Playlist", "anyclip-media") 128 ), 125 129 126 React.createElement(wp.components.Modal, { 127 shouldCloseOnEsc: true, 128 isDefault: true, 129 shouldCloseOnClickOutside: false, 130 onRequestClose: closeModal, 131 title: `Insert AnyClip Playlist`, 132 }, 133 React.createElement("iframe", { 134 src: `${constants.ANYCLIP_EDITORIAL_URL}?playlist=${playlistId}&mode=wp&title=${postTitle}`, 135 className: 'anyclip-media-iframe' 136 }),) 130 props.attributes.isModalOpen 131 ? 132 window.removeEventListener("message", msgEventListener) 133 || 134 window.addEventListener("message", msgEventListener, false) 135 || 136 React.createElement(wp.components.Modal, { 137 shouldCloseOnEsc: true, 138 isDefault: true, 139 shouldCloseOnClickOutside: false, 140 onRequestClose: closeModal, 141 title: wp.element.createElement( 142 'div', 143 { className: 'video-playlist-title-wrapper' }, 144 wp.element.createElement('img', { 145 src: `${window.constants.ANYCLIP_ASSETS_URL}/anyclip-logo-transparent.png`, 146 width: '40px', 147 }), 148 wp.element.createElement('span', { className: 'title' }, 'Insert AnyClip Playlist') 149 ), 150 }, 151 React.createElement("iframe", { 152 src: `${constants.ANYCLIP_EDITORIAL_URL}?playlist=${playlistId}&mode=wp&title=${postTitle}`, 153 className: 'anyclip-media-iframe' 154 }), 155 ) 137 156 : null, 138 157 -
anyclip-media/trunk/readme.txt
r2226511 r2235095 4 4 Requires at least: 5.2.5 5 5 Tested up to: 5.2.5 6 Stable tag: 1.0. 16 Stable tag: 1.0.3 7 7 Requires PHP: 7.2 8 8 License: GPLv2 … … 33 33 == Changelog == 34 34 35 = 1.0. 1=35 = 1.0.3 = 36 36 * AnyClip video platform plugin for WordPress 37 * Insert AnyClip video player into post/page by the block AnyClip Media 38 * Search video library on AnyClip 39 * Create a playlist by adding videos 40 * Insert playlist into post/page 41 * Preview and publish post/page with AnyClip player and playlist 37 * Insert AnyClip video into post/page by the new block AnyClip Video 38 * Support for multiple insert into post 39 * Bug fixes
Note: See TracChangeset
for help on using the changeset viewer.