Changeset 2818558
- Timestamp:
- 11/15/2022 09:09:29 PM (3 years ago)
- Location:
- block-controller
- Files:
-
- 34 added
- 7 edited
-
tags/1.2 (added)
-
tags/1.2/block-controller.php (added)
-
tags/1.2/build (added)
-
tags/1.2/build/block-controller-admin.min.js (added)
-
tags/1.2/build/block-controller-editor.min.js (added)
-
tags/1.2/build/block-controller.css (added)
-
tags/1.2/images (added)
-
tags/1.2/images/menu.svg (added)
-
tags/1.2/images/threepm.svg (added)
-
tags/1.2/inc (added)
-
tags/1.2/inc/assets.php (added)
-
tags/1.2/inc/inventory.php (added)
-
tags/1.2/inc/packages.php (added)
-
tags/1.2/inc/plugins-page.php (added)
-
tags/1.2/inc/settings.php (added)
-
tags/1.2/inc/templates (added)
-
tags/1.2/inc/templates/settings-inventory.php (added)
-
tags/1.2/inc/templates/settings-main.php (added)
-
tags/1.2/readme.txt (added)
-
tags/1.2/source (added)
-
tags/1.2/source/js (added)
-
tags/1.2/source/js/disable-blocks.js (added)
-
tags/1.2/source/js/disable-embeds.js (added)
-
tags/1.2/source/js/settings-page.js (added)
-
tags/1.2/source/scss (added)
-
tags/1.2/source/scss/block-controller.scss (added)
-
tags/1.2/source/scss/components (added)
-
tags/1.2/source/scss/components/_buttons.scss (added)
-
tags/1.2/source/scss/components/_checkboxes.scss (added)
-
tags/1.2/source/scss/components/_heading.scss (added)
-
tags/1.2/source/scss/components/_package.scss (added)
-
tags/1.2/source/scss/components/_post-list.scss (added)
-
tags/1.2/source/scss/global (added)
-
tags/1.2/source/scss/global/_colors.scss (added)
-
trunk/block-controller.php (modified) (1 diff)
-
trunk/build/block-controller-editor.min.js (modified) (1 diff)
-
trunk/inc/assets.php (modified) (5 diffs)
-
trunk/inc/packages.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/source/js/disable-blocks.js (modified) (1 diff)
-
trunk/source/js/disable-embeds.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
block-controller/trunk/block-controller.php
r2810324 r2818558 4 4 * Plugin Name: Block Controller 5 5 * Description: This WordPress plugin allows administrators to control editor access to content blocks. 6 * Version: 1. 1.36 * Version: 1.2 7 7 * Author: Joni Halabi 8 8 * Author URI: https://jhalabi.com -
block-controller/trunk/build/block-controller-editor.min.js
r2482804 r2818558 1 !function n(t,i,c){function s(r,e){if(!i[r]){if(!t[r]){var o="function"==typeof require&&require;if(!e&&o)return o(r,!0);if(u)return u(r,!0);throw(o=new Error("Cannot find module '"+r+"'")).code="MODULE_NOT_FOUND",o}o=i[r]={exports:{}},t[r][0].call(o.exports,function(e){return s(t[r][1][e]||e)},o,o.exports,n,t,i,c)}return i[r].exports}for(var u="function"==typeof require&&require,e=0;e<c.length;e++)s(c[e]);return s}({1:[function(e,r,o){"use strict";wp.hooks.addFilter("blocks.registerBlockType","tpmBlockController",function(e,r){return disabledBlocks.includes(r)?lodash.assign({},e,{supports:{inserter:!1}}):e});document.addEventListener("DOMContentLoaded",void 0)},{}],2:[function(e,r,o){"use strict";wp.domReady(function(){disabledBlocks.includes("core/embed")||disabledBlocks.forEach(function(e){e=e.split("/");"core-embed"==e[0]&&wp.blocks.unregisterBlockVariation("core/embed",e[1])})})},{}]},{},[1,2]);1 !function n(t,i,c){function s(r,e){if(!i[r]){if(!t[r]){var o="function"==typeof require&&require;if(!e&&o)return o(r,!0);if(u)return u(r,!0);throw(o=new Error("Cannot find module '"+r+"'")).code="MODULE_NOT_FOUND",o}o=i[r]={exports:{}},t[r][0].call(o.exports,function(e){return s(t[r][1][e]||e)},o,o.exports,n,t,i,c)}return i[r].exports}for(var u="function"==typeof require&&require,e=0;e<c.length;e++)s(c[e]);return s}({1:[function(e,r,o){"use strict";wp.hooks.addFilter("blocks.registerBlockType","tpmBlockController",function(e,r){return TPM_BC_GLOBAL.disabledBlocks.includes(r)?lodash.assign({},e,{supports:{inserter:!1}}):e});document.addEventListener("DOMContentLoaded",void 0)},{}],2:[function(e,r,o){"use strict";wp.domReady(function(){TPM_BC_GLOBAL.disabledBlocks.includes("core/embed")||TPM_BC_GLOBAL.disabledBlocks.forEach(function(e){e=e.split("/");"core-embed"==e[0]&&wp.blocks.unregisterBlockVariation("core/embed",e[1])})})},{}]},{},[1,2]); -
block-controller/trunk/inc/assets.php
r2482804 r2818558 9 9 10 10 class Assets { 11 12 private const HANDLE_ADMIN = 'tpm-block-controller-admin'; 13 private const HANDLE_EDITOR = 'tpm-block-controller-editor'; 14 11 15 12 16 /** … … 27 31 */ 28 32 public function set_admin_assets(): void { 29 $handle = 'tpm-block-controller-admin';30 33 $css = '../build/block-controller.css'; 31 34 $js = '../build/block-controller-admin.min.js'; 32 35 33 36 wp_enqueue_style( 34 $handle,37 self::HANDLE_ADMIN, 35 38 plugins_url( $css, __FILE__ ), 36 39 [], … … 39 42 40 43 wp_enqueue_script( 41 $handle,44 self::HANDLE_ADMIN, 42 45 plugins_url( $js, __FILE__ ), 43 46 [ 'wp-data', 'jquery' ], … … 55 58 */ 56 59 public function set_editor_assets(): void { 57 $handle = 'tpm-block-controller-editor';58 60 $js = '../build/block-controller-editor.min.js'; 59 61 60 62 wp_enqueue_script( 61 $handle,63 self::HANDLE_EDITOR, 62 64 plugins_url( $js, __FILE__ ), 63 65 [ 'wp-hooks', 'wp-blocks', 'wp-dom-ready', 'wp-edit-post' ], … … 65 67 ); 66 68 67 // Send list of blocks to disable to the JS for it to handle. 68 wp_localize_script( $handle, 'disabledBlocks', $this->get_disabled_blocks() ); 69 // Get global data to pass to the JS. 70 wp_add_inline_script( 71 self::HANDLE_EDITOR, 72 'const TPM_BC_GLOBAL = ' . json_encode([ 73 'disabledBlocks' => $this->get_disabled_blocks() 74 ]), 75 'before' 76 ); 69 77 } 70 78 -
block-controller/trunk/inc/packages.php
r2810324 r2818558 46 46 ], 47 47 48 'Theme' => [ 49 'core/avatar' => 'Avatar', 50 'core/comments' => 'Comments', 51 'core/loginout' => 'Login/out', 52 'core/navigation' => 'Navigation', 53 'core/page-list' => 'Page List', 54 'core/post-author' => 'Post Author', 55 'core/post-author-biography' => 'Post Author Biography', 56 'core/post-comments-form' => 'Post Comments Form', 57 'core/post-content' => 'Post Content', 58 'core/post-date' => 'Post Date', 59 'core/post-excerpt' => 'Post Excerpt', 60 'core/post-featured-image' => 'Post Featured Image', 61 'core/post-navigation-link' => 'Post Navigation Link', 62 'core/post-terms' => 'Post Terms', 63 'core/post-title' => 'Post Title', 64 'core/query' => 'Query', 65 'core/query-title' => 'Query Title', 66 'core/read-more' => 'Read More', 67 'core/site-logo' => 'Site Logo', 68 'core/site-tagline' => 'Site Tag Line', 69 'core/site-title' => 'Site Title', 70 'core/term-description' => 'Term Description' 71 ], 72 48 73 'Widgets' => [ 49 74 'core/archives' => 'Archives', … … 77 102 'core-embed/meetup-com' => 'Meetup.com', 78 103 'core-embed/mixcloud' => 'Mixcloud', 104 'core-embed/pinterest' => 'Pinterest', 79 105 'core-embed/polldaddy' => 'Polldaddy', 80 106 'core-embed/reddit' => 'Reddit', … … 94 120 'core-embed/videopress' => 'VideoPress', 95 121 'core-embed/vimeo' => 'Vimeo', 122 'core-embed/wolfram-cloud' => 'Wolfram', 96 123 'core-embed/wordpress' => 'WordPress', 97 124 'core-embed/wordpress-tv' => 'WordPress.tv', -
block-controller/trunk/readme.txt
r2810324 r2818558 6 6 Requires PHP: 7.0 7 7 Tested up to: 6.1 8 Stable tag: 1.1. 38 Stable tag: 1.1.4 9 9 10 10 Turn on and off specific post editor content blocks. … … 36 36 == Changelog == 37 37 38 = 1.2 = 39 * Replacing `wp_localize_script` with `wp_add_inline_script` to pass PHP data to the JavaScript. This better adheres to WordPress standards. 40 * Adding new blocks to the list of blocks capable of being disabled. Most of them are the ones that support full-site editing. 41 38 42 = 1.1.3 = 39 43 * Fixing a fatal PHP bug that was discovered in PHP 8, where the array_merge to combine all blocks across all packages into a single array fails because the keys are also passed to the array_merge function. -
block-controller/trunk/source/js/disable-blocks.js
r2482804 r2818558 19 19 */ 20 20 function hide( settings, name ) { 21 if ( disabledBlocks.includes( name ) ) {21 if ( TPM_BC_GLOBAL.disabledBlocks.includes( name ) ) { 22 22 // Hide block by setting the inserter attribute in block supports to false. 23 23 return lodash.assign( {}, settings, { -
block-controller/trunk/source/js/disable-embeds.js
r2482804 r2818558 14 14 wp.domReady( () => { 15 15 16 if ( ! disabledBlocks.includes( 'core/embed' ) ) {17 disabledBlocks.forEach( (block) => {16 if ( !TPM_BC_GLOBAL.disabledBlocks.includes( 'core/embed' ) ) { 17 TPM_BC_GLOBAL.disabledBlocks.forEach( (block) => { 18 18 const blockName = block.split('/'); 19 19
Note: See TracChangeset
for help on using the changeset viewer.