diff --git a/.github/workflows/plugin-assets-deploy.yml b/.github/workflows/plugin-assets-deploy.yml new file mode 100644 index 00000000..e497f499 --- /dev/null +++ b/.github/workflows/plugin-assets-deploy.yml @@ -0,0 +1,20 @@ +name: Plugin asset/readme update +on: + push: + branches: + - main +jobs: + master: + name: Push to Main + runs-on: ubuntu-latest + if: "contains(github.event.head_commit.message, 'readme update')" + environment: wordpress + steps: + - uses: actions/checkout@main + - name: WordPress.org plugin asset/readme update + uses: 10up/action-wordpress-plugin-asset-update@stable + env: + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SLUG: protect-schemaorg-markup-in-html-editor + IGNORE_OTHER_FILES: true \ No newline at end of file diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml new file mode 100644 index 00000000..1af2d04e --- /dev/null +++ b/.github/workflows/release-deploy.yml @@ -0,0 +1,33 @@ +name: Deploy to WordPress.org +on: + release: + types: [published] +jobs: + tag: + name: New release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@main + + - name: Install WP CLI + run: curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && sudo mv wp-cli.phar /usr/local/bin/wp + + - name: WordPress Plugin Deploy + id: deploy + uses: 10up/action-wordpress-plugin-deploy@stable + with: + generate-zip: true + env: + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + SLUG: protect-schemaorg-markup-in-html-editor + - name: Upload release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ${{ steps.deploy.outputs.zip-path }} + asset_name: ${{ github.event.repository.name }}.zip + asset_content_type: application/zip \ No newline at end of file diff --git a/.wordpress-org/banner-1544x500.png b/.wordpress-org/banner-1544x500.png new file mode 100644 index 00000000..15b9bd0c Binary files /dev/null and b/.wordpress-org/banner-1544x500.png differ diff --git a/.wordpress-org/banner-772x250.png b/.wordpress-org/banner-772x250.png new file mode 100644 index 00000000..9708e025 Binary files /dev/null and b/.wordpress-org/banner-772x250.png differ diff --git a/.wordpress-org/icon-128x128.png b/.wordpress-org/icon-128x128.png new file mode 100644 index 00000000..f284e065 Binary files /dev/null and b/.wordpress-org/icon-128x128.png differ diff --git a/.wordpress-org/icon-256x256.png b/.wordpress-org/icon-256x256.png new file mode 100644 index 00000000..0b1923b6 Binary files /dev/null and b/.wordpress-org/icon-256x256.png differ diff --git a/.wordpress-org/icon.svg b/.wordpress-org/icon.svg new file mode 100644 index 00000000..551a3e73 --- /dev/null +++ b/.wordpress-org/icon.svg @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/.wordpress-org/screenshot-1.png b/.wordpress-org/screenshot-1.png new file mode 100644 index 00000000..cb43c3ab Binary files /dev/null and b/.wordpress-org/screenshot-1.png differ diff --git a/.wordpress-org/screenshot-2.png b/.wordpress-org/screenshot-2.png new file mode 100644 index 00000000..1e40a59a Binary files /dev/null and b/.wordpress-org/screenshot-2.png differ diff --git a/.wordpress-org/screenshot-3.png b/.wordpress-org/screenshot-3.png new file mode 100644 index 00000000..3b2b14e8 Binary files /dev/null and b/.wordpress-org/screenshot-3.png differ diff --git a/.wordpress-org/screenshot-4.png b/.wordpress-org/screenshot-4.png new file mode 100644 index 00000000..9ad0d47e Binary files /dev/null and b/.wordpress-org/screenshot-4.png differ diff --git a/.wordpress-org/screenshot-5.png b/.wordpress-org/screenshot-5.png new file mode 100644 index 00000000..b26fa39b Binary files /dev/null and b/.wordpress-org/screenshot-5.png differ diff --git a/.wordpress-org/screenshot-6.png b/.wordpress-org/screenshot-6.png new file mode 100644 index 00000000..36345106 Binary files /dev/null and b/.wordpress-org/screenshot-6.png differ diff --git a/.wordpress-org/screenshot-7.png b/.wordpress-org/screenshot-7.png new file mode 100644 index 00000000..ca58e798 Binary files /dev/null and b/.wordpress-org/screenshot-7.png differ diff --git a/.wordpress-org/screenshot-8.png b/.wordpress-org/screenshot-8.png new file mode 100755 index 00000000..d4f066db Binary files /dev/null and b/.wordpress-org/screenshot-8.png differ diff --git a/js/admin-menu.js b/js/admin-menu.js index aab7f0c0..9de60bf2 100644 --- a/js/admin-menu.js +++ b/js/admin-menu.js @@ -1,48 +1,46 @@ -function ecwidRefreshEcwidMenuItemSelection(slug) -{ +function ecwidRefreshEcwidMenuItemSelection(slug) { if (!slug) { slug = ecwidGetCurrentMenuSlug(); } - + if (!slug || slug.indexOf(ecwid_admin_menu.baseSlug) == -1) return; - + var parent = jQuery('li#toplevel_page_' + ecwid_admin_menu.baseSlug); parent.addClass('wp-has-current-submenu').addClass('wp-menu-open'); parent.find('a.toplevel_page_ec-store').addClass('wp-has-current-submenu').addClass('wp-menu-open'); - + var selector = 'a[data-ecwid-menu-slug="' + slug + '"]'; if (jQuery(selector).length == 0) { selector = 'a[data-ecwid-menu-slug="' + decodeURI(slug) + '"]'; } - + jQuery('.current', parent).removeClass('current'); jQuery('.wp-has-current-submenu3', parent).removeClass('wp-has-current-submenu3'); - + jQuery(selector, parent) .addClass('current') .closest('li') .addClass('current') .closest('.wp-has-submenu3').addClass('wp-has-current-submenu3'); - ecwidSetCurrentPageTitle( selector ); + ecwidSetCurrentPageTitle(selector); } function ecwidSetCurrentPageTitle(selector) { var delimiter = String.fromCharCode(8249), - title_splited = document.title.split( delimiter ), + title_splited = document.title.split(delimiter), title = jQuery(selector).last().text(); - if( title_splited.length ) { - title += ' ' + delimiter + ' ' + title_splited[title_splited.length-1]; + if (title_splited.length) { + title += ' ' + delimiter + ' ' + title_splited[title_splited.length - 1]; } document.title = title; } -function ecwidGetCurrentMenuSlug() -{ +function ecwidGetCurrentMenuSlug() { var query_parts = location.search.split('&'); var slug = null; for (var i = 0; i < query_parts.length; i++) { @@ -57,7 +55,7 @@ function ecwidGetCurrentMenuSlug() slug = param.substr(ecwidPagePrefix.length); } - + return slug; } @@ -67,79 +65,79 @@ var ec_admin_prev_slug = '', function ecwidApplyIframeAdminMenu($link, menu) { $link - .data('ecwid-menu', menu) - .attr('data-ecwid-menu-slug', menu.slug) - .on('click', function (e) { + .data('ecwid-menu', menu) + .attr('data-ecwid-menu-slug', menu.slug) + .on('click', function (e) { - var slug = jQuery(this).data('ecwid-menu-slug'); + var slug = jQuery(this).data('ecwid-menu-slug'); - if (e.shiftKey || e.ctrlKey || e.metaKey) { - if( !!jQuery(this).attr('href') ) { - window.open( jQuery(this).attr('href'), '_blank' ); - } - return false; - } - - if ( jQuery(this).hasClass('current') ) { - if( slug != 'ec-store-admin-products' ) { + if (e.shiftKey || e.ctrlKey || e.metaKey) { + if (!!jQuery(this).attr('href')) { + window.open(jQuery(this).attr('href'), '_blank'); + } return false; } - } - - if( ecwid_params.is_demo_store ) { - location.href = jQuery(this).attr('href'); - return false; - } - - var ecwidMenu = jQuery(this).data('ecwid-menu'); - var link = jQuery(this).closest('li'); - var is3dlevelMenuRoot = link.hasClass('wp-has-submenu3'); - - var isOpen = jQuery('li.current').closest('.toplevel_page_ec-store').length > 0; + if (jQuery(this).hasClass('current')) { + if (slug != 'ec-store-admin-products') { + return false; + } + } - if( slug == 'ec-storefront-settings' || slug == 'ec-store-developers' ) { - - if( !jQuery('#ecwid-frame').length ) { + if (ecwid_params.is_demo_store) { location.href = jQuery(this).attr('href'); + return false; } - jQuery('.ec-ui-framework-page, #ecwid-frame').hide(); - jQuery('#' + slug).show(); + var ecwidMenu = jQuery(this).data('ecwid-menu'); + + var link = jQuery(this).closest('li'); + var is3dlevelMenuRoot = link.hasClass('wp-has-submenu3'); - jQuery(document).scrollTop(0); - } else { + var isOpen = jQuery('li.current').closest('.toplevel_page_ec-store').length > 0; - if( ec_admin_prev_slug == '' || ec_admin_prev_slug == slug ) { + if (slug == 'ec-storefront-settings' || slug == 'ec-store-developers') { - if( !jQuery('#ecwid-frame').length ) { + if (!jQuery('#ecwid-frame').length) { location.href = jQuery(this).attr('href'); } - jQuery('#ecwid-frame').show(); + jQuery('.ec-ui-framework-page, #ecwid-frame').hide(); + jQuery('#' + slug).show(); - jQuery(document).scrollTop(48); + jQuery(document).scrollTop(0); } else { - ec_admin_wait_page_load = true; - } - jQuery('.ec-ui-framework-page').hide(); + if (ec_admin_prev_slug == '' || ec_admin_prev_slug == slug) { - ecwidOpenAdminPage(ecwidMenu.hash); - ec_admin_prev_slug = slug; - } + if (!jQuery('#ecwid-frame').length) { + location.href = jQuery(this).attr('href'); + } + + jQuery('#ecwid-frame').show(); - history.pushState({}, null, ecwidMenu.url); + jQuery(document).scrollTop(48); + } else { + ec_admin_wait_page_load = true; + } - ecwidRefreshEcwidMenuItemSelection(); + jQuery('.ec-ui-framework-page').hide(); - jQuery('#wpwrap.wp-responsive-open').removeClass('wp-responsive-open'); - jQuery(this).parents('.opensub').removeClass('opensub'); + ecwidOpenAdminPage(ecwidMenu.hash); + ec_admin_prev_slug = slug; + } - if ( !isOpen ) return true; - - return false; - }); + history.pushState({}, null, ecwidMenu.url); + + ecwidRefreshEcwidMenuItemSelection(); + + jQuery('#wpwrap.wp-responsive-open').removeClass('wp-responsive-open'); + jQuery(this).parents('.opensub').removeClass('opensub'); + + if (!isOpen) return true; + + return false; + }); } function ecwidAddSubmenu(items, parent) { @@ -164,7 +162,7 @@ function ecwidAddSubmenu(items, parent) { ecwidApplyIframeAdminMenu($link, item); } - $parent.closest('li').on('touchstart', function(e) { + $parent.closest('li').on('touchstart', function (e) { var link = jQuery(this); if (!link.hasClass('opensub') && link.hasClass('wp-has-submenu3')) { @@ -186,11 +184,11 @@ function ecwidAddMenuItems(items) { var prevItem = jQuery('#toplevel_page_ec-store .wp-submenu-head + li'); for (var i = 0; i < items.length; i++) { - + if (!items.hasOwnProperty(i)) continue; - + var menuItem = items[i]; - + var listItem = jQuery('
  • ').insertAfter(prevItem); var a = jQuery('').data('ecwid-url', menuItem.hash).text(menuItem.title).appendTo(listItem); ecwidApplyIframeAdminMenu(a, menuItem); @@ -206,7 +204,7 @@ function ecwidAddMenuItems(items) { } } -jQuery(document).ready(function() { +jQuery(document).ready(function () { var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var eventer = window[eventMethod]; @@ -214,38 +212,38 @@ jQuery(document).ready(function() { var previous_frame_page; // Listen to message from child window - eventer(messageEvent,function(e) { + eventer(messageEvent, function (e) { if (typeof e.data.height != 'undefined' && e.data.height > 0) { jQuery('#ecwid-frame').css('height', e.data.height + 'px'); - } + } - if ( typeof e.data.action != 'undefined') { + if (typeof e.data.action != 'undefined') { - if ( e.data.action == 'pageLoad' ) { + if (e.data.action == 'pageLoad') { var adminpage = e.currentTarget.adminpage; var page = e.data.data.page.path; - if( ec_admin_wait_page_load ) { + if (ec_admin_wait_page_load) { jQuery('#ecwid-frame').show(); jQuery('#ec-ui-framework-page').hide(); } - if( adminpage.indexOf(ecwid_admin_menu.baseSlug) != -1 ) { + if (adminpage.indexOf(ecwid_admin_menu.baseSlug) != -1) { jQuery('*[data-ecwid-menu-slug="ec-store-admin-' + page + '"]').eq(0).click(); - } + } - if( adminpage == 'plugin-install-php' ) { - if( page.indexOf('apps:view=app&name=') != -1 ) { + if (adminpage == 'plugin-install-php') { + if (page.indexOf('apps:view=app&name=') != -1) { var admin_page_app = 'admin.php?page=ec-store-admin-my_apps&ec-store-page='; - window.open( admin_page_app + encodeURIComponent(page), '_blank' ); + window.open(admin_page_app + encodeURIComponent(page), '_blank'); var frame_src = jQuery('#ecwid-frame') - .attr( 'src' ) - .replace( /(&place=).*?(&)/i, '$1' + previous_frame_page + '$2' ); - jQuery('#ecwid-frame').attr( 'src', frame_src ); + .attr('src') + .replace(/(&place=).*?(&)/i, '$1' + previous_frame_page + '$2'); + jQuery('#ecwid-frame').attr('src', frame_src); } else { previous_frame_page = page; } @@ -264,7 +262,7 @@ jQuery(document).ready(function() { 'menu': e.data.data.navigationMenuItems, '_ajax_nonce': ecwid_admin_menu.ajaxNonce }, - 'success': function(result) { + 'success': function (result) { jQuery('li[data-ecwid-dynamic-menu]').remove(); ecwidAddMenuItems(jQuery.parseJSON(result)); ecwidRefreshEcwidMenuItemSelection(); @@ -273,7 +271,7 @@ jQuery(document).ready(function() { }); } } - },false); + }, false); if (jQuery('#ecwid-frame').length > 0) { @@ -286,7 +284,7 @@ jQuery(document).ready(function() { if (jQuery('#ecwid-frame').length < 1) { return; } - + jQuery('#ecwid-frame')[0].contentWindow.postMessage(JSON.stringify({ ecwidAppNs: "ecwid-wp-plugin", method: "openPage", @@ -295,16 +293,16 @@ jQuery(document).ready(function() { } - if ( ecwid_admin_menu.enableAutoMenus ) { - + if (ecwid_admin_menu.enableAutoMenus) { + for (var i = 0; i < ecwid_admin_menu.menu.length; i++) { - + var menu = ecwid_admin_menu.menu[i]; - + var $link = jQuery('li.toplevel_page_ec-store .wp-submenu a[href$="' + menu.url + '"]'); $link.closest('li').attr('data-ecwid-dynamic-menu', 1); ecwidApplyIframeAdminMenu($link, menu); - + if (menu.children) { ecwidAddSubmenu(menu.children, $link); } @@ -312,17 +310,17 @@ jQuery(document).ready(function() { var $link = jQuery('li.toplevel_page_ec-store .wp-submenu a[href="admin.php?page"]'); $link.closest('li').attr('data-ecwid-dynamic-menu', 1); - $link.on('click', function() { return false; }); + $link.on('click', function () { return false; }); var $link = jQuery('li.toplevel_page_ec-store .wp-submenu a[href="admin.php?page=ec-store"]'); - ecwidApplyIframeAdminMenu($link, {slug:'ec-store', url: 'admin.php?page=ec-store', hash:'dashboard'}); + ecwidApplyIframeAdminMenu($link, { slug: 'ec-store', url: 'admin.php?page=ec-store', hash: 'dashboard' }); } - - if ( jQuery( '#calypsoify_wpadminmods_css-css' ).length > 0 ) { + + if (jQuery('#calypsoify_wpadminmods_css-css').length > 0) { jQuery('#toplevel_page_ec-store').addClass('wpcom-menu'); } - if ( jQuery( '#toplevel_page_ec-store .wp-submenu3 li.current' ).length > 0 ) { + if (jQuery('#toplevel_page_ec-store .wp-submenu3 li.current').length > 0) { jQuery('#toplevel_page_ec-store > a').addClass('wp-has-current-submenu'); } ecwidRefreshEcwidMenuItemSelection();