Plugin Directory

Changeset 2235095


Ignore:
Timestamp:
01/29/2020 09:53:33 AM (6 years ago)
Author:
anyclip
Message:

Updated version

Location:
anyclip-media/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • anyclip-media/trunk/anyclip-media.php

    r2226511 r2235095  
    55 * Description: Anyclip media plugin inserts playlists.
    66 * Author: Anyclip R&D team
    7  * Version: 1.0.1
     7 * Version: 1.0.3
    88 * Author URI:  https://anyclip.com
    99 * Text Domain: inserts
     
    1717require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-media-const.php');
    1818require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-media-block.php');
     19require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-video-block.php');
    1920require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-media-classic-editor.php');
     21require_once(plugin_dir_path(__FILE__) . 'inc/anyclip-video-classic-editor.php');
  • anyclip-media/trunk/css/anyclip-media.css

    r2224380 r2235095  
    1010}
    1111
     12.video-playlist-title-wrapper {
     13    display: flex;
     14    margin-top: 9px;
     15}
     16
     17.title {
     18    margin-left: 16px;
     19}
     20
    1221span[data-mce-p-class="anyclip-media"] {
    1322    width: 100%;
  • anyclip-media/trunk/inc/anyclip-media-block.php

    r2224380 r2235095  
    1313    );
    1414    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',
    1617    ));
    1718    wp_enqueue_style(
     
    4243}
    4344
    44 add_action( 'init', 'anyclip_gutenberg_media_init' );
     45add_action('init', 'anyclip_gutenberg_media_init');
  • anyclip-media/trunk/inc/anyclip-media-classic-editor.php

    r2224380 r2235095  
    1212   
    1313   
    14     if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) ) {
     14    if (preg_match_all('/'. $pattern .'/s', $post->post_content, $matches)) {
    1515        $keys = array();
    1616        $result = array();
    17         foreach( $matches[0] as $key => $value) {
     17        foreach($matches[0] as $key => $value) {
    1818            // $matches[3] return the shortcode attribute as string
    1919            // replace space with '&' for parse_str() function
    20             $get = str_replace(" ", "&" , $matches[3][$key] );
     20            $get = str_replace(" ", "&" , $matches[3][$key]);
    2121            parse_str($get, $output);
    2222   
    2323            //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)));
    2525            $result[] = $output;
    26    
    2726        }
    2827        //var_dump($result);
    29         if ( $keys && $result ) {
     28        if ($keys && $result) {
    3029            // Loop the result array and add the missing shortcode attribute key
    3130            foreach ($result as $key => $value) {
    3231                // Loop the shortcode attribute key
    3332                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;
    3534                }
    3635                //sort the array key
    37                 ksort( $result[$key]);             
     36                ksort($result[$key]);             
    3837            }
    3938        }
     
    6362        </div>
    6463
    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">
    6665            <span class="dashicons dashicons-playlist-video" style="vertical-align: text-top"></span>
    6766            AnyClip Playlist
     
    7271        add_thickbox();
    7372        $template = <<<acm
    74     <div id="anyclip-meida-content" style="display:none;">
     73    <div id="anyclip-media-content" style="display:none;">
    7574    </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">
    7776        <span class="dashicons dashicons-playlist-video" style="vertical-align: text-top"></span>
    7877        AnyClip Playlist
     
    9190
    9291function anyclip_js($plugins) {
    93     if ( !function_exists('has_blocks') || !has_blocks() ) {
     92    if (!function_exists('has_blocks') || !has_blocks()) {
    9493        wp_enqueue_script('anyclip_media', plugins_url('../js/anyclip-media-classic.js', __FILE__), array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'));
    9594    };
     
    9796    wp_localize_script('anyclip_media', 'constants', array(
    9897        'ANYCLIP_EDITORIAL_URL' => ANYCLIP_EDITORIAL_URL,
     98        'ANYCLIP_ASSETS_URL' => plugin_dir_url(__FILE__) . '../assets',
    9999        'pluginsUrl' => plugins_url()
    100100    ));
    101101
    102     add_editor_style(plugins_url( '../css/anyclip-media.css' , __FILE__ ) );   
     102    add_editor_style(plugins_url('../css/anyclip-media.css' , __FILE__ ));   
    103103}
    104104
    105 add_filter( 'anyclip_mce_external_plugins', 'anyclip_mce_external_plugins' );
     105add_filter('anyclip_mce_external_plugins', 'anyclip_mce_external_plugins');
    106106
    107 function anyclip_mce_external_plugins( $plugin_array ) {
     107function anyclip_mce_external_plugins($plugin_array) {
    108108    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__)
    110110    ]);
    111111}
     
    123123    );
    124124
    125     return $content?base64_decode($content) : '';
     125    return $content ? base64_decode($content) : '';
    126126}
    127127
  • anyclip-media/trunk/js/anyclip-editor-plugin.js

    r2224380 r2235095  
    22    let currentAttrs;
    33
    4     tinymce.PluginManager.add('anyclip-media', function( editor, url ) {
     4    tinymce.PluginManager.add('anyclip-media', function(editor, url) {
    55        var sh_tag = 'anyclip-media';
    66 
    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) {
    99                currentAttrs = attr;
    1010                return '<iframe class="anyclip-media" scrolling="no" id="anyclip-media" data-content="'+ btoa(attr) +'" ></iframe>';
     
    1212        }
    1313 
    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]';
    1717            });
    1818        }
     
    2020        //replace from shortcode to an image placeholder
    2121        editor.on('BeforeSetcontent', function(event){
    22             event.content = replaceShortcodes( event.content );
     22            event.content = replaceShortcodes(event.content);
    2323        });
    2424
     
    3232                });
    3333
    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"/>';
    3535
    36                 let acContent = acLogo + "<img style=\"width: 100%;\" src="+params.thumbnail+"/>";
     36                let acContent = acLogo + "<img style=\"width: 100%;\" src=" + params.thumbnail + "/>";
    3737
    3838                const iframeElement = document.querySelector('iframe#content_ifr').contentDocument.body.querySelector('iframe.anyclip-media');
  • anyclip-media/trunk/js/anyclip-media-classic.js

    r2224380 r2235095  
    11jQuery(document).ready(function ($) {
    22    window.addEventListener("message", (msg) => {
    3         if (msg && msg.data) {
     3        if (msg && msg.data && msg.data.embed) {
    44            doInsert({
    55                embedCode: msg.data.embed.embedCode,
     
    1616        let editorContent = getMceContent();
    1717       
    18         if(editorContent.match(acRegEx)) {
     18        if (editorContent.match(acRegEx)) {
    1919            editorContent = editorContent.replace(acRegEx, () => generateSortCode(data));
    2020   
    21             var activeEditor = tinymce.activeEditor ? tinymce.activeEditor:null;
    22             if(activeEditor!==null){
     21            var activeEditor = tinymce.activeEditor ? tinymce.activeEditor : null;
     22            if (activeEditor !== null) {
    2323                activeEditor.setContent(editorContent);
    2424            } else {
     
    4242        if (jQuery("#wp-content-wrap").hasClass("tmce-active")){
    4343            return tinyMCE.activeEditor.getContent();
    44         }else{
     44        } else {
    4545            return jQuery('textarea.wp-editor-area#content').val();
    4646        }
     
    5151
    5252    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' );
    5454        return false;
    5555    }
  • anyclip-media/trunk/js/anyclip-media.js

    r2224380 r2235095  
    99
    1010wp.blocks.registerBlockType('anyclip/media-box', {
    11     title: 'Anyclip Media',
     11    title: 'AnyClip Playlist',
    1212    description: 'Block inserts anyclip player',
    13     icon: 'format-video',
     13    icon: 'playlist-video',
    1414    category: 'common',
    1515    supports: {
    16         multiple: false,
     16        multiple: true,
    1717        html: true,
    1818        reusable: false,
     
    4646        const { attributes: { contentHTML, thumbnail, playlistId }, setAttributes } = props;
    4747        const postTitle = wp.data.select('core/editor').getCurrentPostAttribute('title');
    48         const msgEventListner = (msg) => {
    49             if (msg && msg.data) {
     48        const msgEventListener = (msg) => {
     49            if (msg && msg.data && msg.data.embed) {
    5050                doInsert({
    5151                    embedCode: msg.data.embed.embedCode,
    52                     thumbnail: msg.data.thumbnail,
     52                    thumbnail: msg.data.thumbnail || '',
    5353                    playlistId: msg.data.playlistId
    5454                })
     
    8484            });
    8585
    86             window.removeEventListener("message", msgEventListner, false);
     86            window.removeEventListener("message", msgEventListener, false);
    8787
    8888            updateContent(data);
     
    104104            wp.element.createElement(
    105105                '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, {
    113117                    icon: 'format-video',
    114118                    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",
    119124                    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                ),
    125129
    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                )
    137156                : null,
    138157
  • anyclip-media/trunk/readme.txt

    r2226511 r2235095  
    44Requires at least: 5.2.5
    55Tested up to: 5.2.5
    6 Stable tag: 1.0.1
     6Stable tag: 1.0.3
    77Requires PHP: 7.2
    88License: GPLv2
     
    3333== Changelog ==
    3434
    35 = 1.0.1 =
     35= 1.0.3 =
    3636* 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.