├── .gitignore ├── README.md ├── assets ├── css │ ├── main.css │ └── prism.css ├── images │ ├── donate-banner.jpg │ ├── github-banner.jpg │ ├── github-icon.png │ ├── rate-us-banner.jpg │ ├── share-ideas-banner.jpg │ ├── working-hard.jpg │ └── wp-icon.png └── js │ ├── prism.min.js │ └── scripts.js ├── gutenberg-manager.php ├── inc ├── core.php ├── default-blocks.php ├── hooks.php └── options.php ├── index.php ├── languages └── readme.txt └── uninstall.php /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gutenberg Manager 2 | 3 | A simple and easy way to manage Gutenberg editor. You can disable/enable the editor and the elements for every post types. 4 | 5 | Gutenberg is a great editor but sometime you could want to disable it for Pages, Posts or other post types. Gutenberg Manager allow you to enable/disable the editor where you want. Why would you want to disable the editor on pages? Maybe you would like to use a page builder like Visual Composer or Elementor instead! 6 | 7 | Gutenberg Editor will be probably included in the next great release of WordPress (5.0) so Gutenberg Manager will be really useful. With the Manager you can also decide to disable specific blocks in the editor if you don't need them. 8 | 9 | If you are developing or editing a theme/plugin all features are also available via Hooks so you can include Gutenberg Manager plugin inside your theme and use it without the Option Panel. 10 | 11 | ## Installation (WordPress Backend) 12 | 13 | 1. Login to your WordPress website. When you're logged in, you will be in your "Dashboard". On the left-hand side, you will see a menu. In that menu, click on "Plugins". 14 | 2. Click on "Add New" near the top of the screen. Type "Gutenberg Manager" in the search bar. 15 | 3. This will give you a page of search results. Our plugin should be visible now. Click the "Install Now" link to start installing our plugin. 16 | 4. Click the "Activate" button that appeared where the "Install Now" button was previously located. 17 | 18 | ## Installation (FTP) 19 | 20 | 1. Download Gutenberg Manager zip file from Github (Releases) or WordPress.org repository. 21 | 2. "Unzip" the file you just downloaded and you will see a folder called "manager-for-gutenberg". 22 | 3. Login to your hosting using your FTP account. 23 | 4. Go to the folder /wp-content/plugins/ on your WP installation and upload the "manager-for-gutenberg" folder. 24 | 5. Now login your WP backend and in Plugins page "Activate" Gutenberg Manager 25 | 26 | ## How to use 27 | 28 | Under "Gutenberg" menu in your dashboard you'll find a new button "Gutenberg Manager". This is the Option Panel of our plugin. For now it includes 4 options areas: 29 | 30 | 1. Settings 31 | 2. Default Blocks 32 | 3. Additional Blocks 33 | 4. API/Hooks 34 | 35 | ## Settings 36 | 37 | Here you can globally disable Gutenberg Editor or manage the visibility of editor in the different post types. 38 | 39 | ![Gutenberg Manager Panel](http://uncommons.pro/github/gutenberg-manager-media/Gutenberg_Manager_Panel.png) 40 | 41 | ## Default Blocks 42 | 43 | Here you can disable the default blocks in the Editor. 44 | 45 | ![Gutenberg Manager Default Blocks](http://uncommons.pro/github/gutenberg-manager-media/Gutenberg_Manager_Default_Blocks.png) 46 | 47 | ## Additional Blocks 48 | 49 | Here you can enable our additional blocks in the Editor. 50 | 51 | > This section is under construction 52 | 53 | ## API/Hooks 54 | 55 | Here you find a list of Hooks to use in your custom Theme/Plugin! 56 | > Note: there is an action to disable the Option Panel of Gutenberg Manager so our plugin will be hidden for the final user but the theme/plugin developer can use all the plugin's features. 57 | 58 | ![Gutenberg Manager Hooks](http://uncommons.pro/github/gutenberg-manager-media/Gutenberg_Manager_Hooks.png) 59 | 60 | ## How You Can Contribute 61 | 62 | Anyone is welcome to contribute to Gutenberg Manager. 63 | 64 | There are various ways you can contribute: 65 | 66 | * [Raise an issue](https://github.com/unCommonsTeam/gutenberg-manager/issues) on GitHub. 67 | * [Send us a Pull Request](https://github.com/unCommonsTeam/gutenberg-manager/pulls) with your bug fixes and/or new features. 68 | * Provide feedbacks and [suggestions on enhancements](https://github.com/unCommonsTeam/gutenberg-manager/labels/enhancement). -------------------------------------------------------------------------------- /assets/css/main.css: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Gutenberg Manager Main Style. 4 | * @since 1.0 5 | */ 6 | 7 | /* GLOBALS */ 8 | .gm-clearfix { 9 | clear: both; 10 | } 11 | 12 | /* CONTENT/SIDEBAR SYSTEM */ 13 | 14 | .gm-content-sidebar-wrap { 15 | display: table; 16 | width: 100%; 17 | table-layout: fixed; 18 | } 19 | 20 | .gm-content { 21 | width: 100%; 22 | display: table-cell; 23 | margin: 0; 24 | padding: 0; 25 | vertical-align: top; 26 | } 27 | 28 | .gm-sidebar { 29 | width: 260px; 30 | padding-left: 20px; 31 | display: table-cell; 32 | margin: 0; 33 | vertical-align: top; 34 | } 35 | 36 | .gm-sidebar-spot { 37 | margin-bottom: 40px; 38 | } 39 | 40 | .gm-sidebar-spot h2 { 41 | color: #019875; 42 | padding-bottom: 9px; 43 | border-bottom: solid 1px #ccc; 44 | } 45 | 46 | .gm-sidebar-spot p { 47 | font-size: 16px; 48 | font-weight: 300; 49 | } 50 | 51 | .gm-sidebar-spot img { 52 | display: block; 53 | width: 100%; 54 | margin-bottom: 10px; 55 | } 56 | 57 | 58 | /* OPTIONS */ 59 | 60 | .gm-content .dashicons, 61 | .gm-content .dashicons-before::before { 62 | line-height: 1.3; 63 | } 64 | 65 | .gm-container { 66 | position: relative; 67 | max-width: 100%; 68 | margin: 20px 0 1px; 69 | padding: 20px 20px 0; 70 | border: 1px solid #e5e5e5; 71 | background-color: #fdfdfd; 72 | box-shadow: 0 1px 1px rgba(0,0,0,.04); 73 | } 74 | 75 | .gm-container h3 { 76 | margin: -20px -20px 0; 77 | padding: 1em; 78 | border-bottom: 1px solid #ccc; 79 | background-color: #fdfdfd; 80 | } 81 | 82 | .gm-container .dashicons, 83 | .gm-container .dashicons-before::before { 84 | line-height: 1; 85 | } 86 | 87 | .gm-image { 88 | max-width: 100%; 89 | margin: 10px 0; 90 | } 91 | 92 | .gm-more-image { 93 | width: 400px; 94 | float: left; 95 | margin: 0 20px 0 0; 96 | } 97 | 98 | .gm-more-title { 99 | font-size: 30px; 100 | margin-top: 40px; 101 | font-weight: 200; 102 | line-height: normal; 103 | } 104 | 105 | .gm-more-text .button-secondary img { 106 | margin-top: 4px; 107 | } 108 | 109 | .gm-container pre { 110 | overflow: hidden; 111 | } 112 | 113 | 114 | /* GRID SYSTEM */ 115 | 116 | .gm-row { 117 | display: -webkit-box; 118 | display: -ms-flexbox; 119 | display: flex; 120 | -ms-flex-wrap: wrap; 121 | flex-wrap: wrap; 122 | } 123 | 124 | .gm-col-1, .gm-col-2, .gm-col-3, .gm-col-4, .gm-col-5, .gm-col-6, .gm-col-7, .gm-col-8, .gm-col-9, .gm-col-10, .gm-col-11, .gm-col-12 { 125 | position: relative; 126 | width: 100%; 127 | min-height: 1px; 128 | } 129 | 130 | .gm-col-1 { 131 | -webkit-box-flex: 0; 132 | -ms-flex: 0 0 8.333333%; 133 | flex: 0 0 8.333333%; 134 | max-width: 8.333333%; 135 | } 136 | 137 | .gm-col-2 { 138 | -webkit-box-flex: 0; 139 | -ms-flex: 0 0 16.666667%; 140 | flex: 0 0 16.666667%; 141 | max-width: 16.666667%; 142 | } 143 | 144 | .gm-col-3 { 145 | -webkit-box-flex: 0; 146 | -ms-flex: 0 0 25%; 147 | flex: 0 0 25%; 148 | max-width: 25%; 149 | } 150 | 151 | .gm-col-4 { 152 | -webkit-box-flex: 0; 153 | -ms-flex: 0 0 33.333333%; 154 | flex: 0 0 33.333333%; 155 | max-width: 33.333333%; 156 | } 157 | 158 | .gm-col-5 { 159 | -webkit-box-flex: 0; 160 | -ms-flex: 0 0 41.666667%; 161 | flex: 0 0 41.666667%; 162 | max-width: 41.666667%; 163 | } 164 | 165 | .gm-col-6 { 166 | -webkit-box-flex: 0; 167 | -ms-flex: 0 0 50%; 168 | flex: 0 0 50%; 169 | max-width: 50%; 170 | } 171 | 172 | .gm-col-7 { 173 | -webkit-box-flex: 0; 174 | -ms-flex: 0 0 58.333333%; 175 | flex: 0 0 58.333333%; 176 | max-width: 58.333333%; 177 | } 178 | 179 | .gm-col-8 { 180 | -webkit-box-flex: 0; 181 | -ms-flex: 0 0 66.666667%; 182 | flex: 0 0 66.666667%; 183 | max-width: 66.666667%; 184 | } 185 | 186 | .gm-col-9 { 187 | -webkit-box-flex: 0; 188 | -ms-flex: 0 0 75%; 189 | flex: 0 0 75%; 190 | max-width: 75%; 191 | } 192 | 193 | .gm-col-10 { 194 | -webkit-box-flex: 0; 195 | -ms-flex: 0 0 83.333333%; 196 | flex: 0 0 83.333333%; 197 | max-width: 83.333333%; 198 | } 199 | 200 | .gm-col-11 { 201 | -webkit-box-flex: 0; 202 | -ms-flex: 0 0 91.666667%; 203 | flex: 0 0 91.666667%; 204 | max-width: 91.666667%; 205 | } 206 | 207 | .gm-col-12 { 208 | -webkit-box-flex: 0; 209 | -ms-flex: 0 0 100%; 210 | flex: 0 0 100%; 211 | max-width: 100%; 212 | } 213 | 214 | 215 | /* RESPONSIVE */ 216 | 217 | @media screen and (max-width: 1400px) { 218 | 219 | .gm-more-title { 220 | font-size: 24px; 221 | } 222 | 223 | } 224 | 225 | @media screen and (max-width: 1200px) { 226 | 227 | .gm-more-title { 228 | font-size: 20px; 229 | } 230 | 231 | } 232 | 233 | @media screen and (max-width: 1100px) { 234 | 235 | .gm-more-image { 236 | width: 100%; 237 | margin-bottom: 20px; 238 | } 239 | 240 | .gm-more-title { 241 | font-size: 24px; 242 | } 243 | 244 | } 245 | 246 | @media screen and (max-width: 960px) { 247 | 248 | .gm-col-1, .gm-col-2, .gm-col-3, .gm-col-4, .gm-col-5, .gm-col-6, .gm-col-7, .gm-col-8, .gm-col-9, .gm-col-10, .gm-col-11, .gm-col-12 { 249 | max-width: 100%; 250 | flex: 0 0 100%; 251 | } 252 | 253 | .gm-content-sidebar-wrap, 254 | .gm-content, 255 | .gm-sidebar { 256 | display: inherit; 257 | width: 100%; 258 | padding: 0; 259 | } 260 | 261 | } 262 | 263 | 264 | @media screen and (max-width: 400px) { 265 | 266 | .gm-more-title { 267 | font-size: 20px; 268 | } 269 | 270 | } 271 | 272 | -------------------------------------------------------------------------------- /assets/css/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.9.0 2 | http://prismjs.com/download.html?themes=prism-coy&languages=markup+css+clike+javascript+php */ 3 | /** 4 | * prism.js Coy theme for JavaScript, CoffeeScript, CSS and HTML 5 | * Based on https://github.com/tshedor/workshop-wp-theme (Example: http://workshop.kansan.com/category/sessions/basics or http://workshop.timshedor.com/category/sessions/basics); 6 | * @author Tim Shedor 7 | */ 8 | 9 | code[class*="language-"], 10 | pre[class*="language-"] { 11 | color: black; 12 | background: none; 13 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 14 | text-align: left; 15 | white-space: pre; 16 | word-spacing: normal; 17 | word-break: normal; 18 | word-wrap: normal; 19 | line-height: 1.5; 20 | 21 | -moz-tab-size: 4; 22 | -o-tab-size: 4; 23 | tab-size: 4; 24 | 25 | -webkit-hyphens: none; 26 | -moz-hyphens: none; 27 | -ms-hyphens: none; 28 | hyphens: none; 29 | } 30 | 31 | /* Code blocks */ 32 | pre[class*="language-"] { 33 | position: relative; 34 | margin: .5em 0; 35 | overflow: visible; 36 | padding: 0; 37 | } 38 | pre[class*="language-"]>code { 39 | position: relative; 40 | border-left: 10px solid #019875; 41 | box-shadow: -1px 0px 0px 0px #019875, 0px 0px 0px 1px #dfdfdf; 42 | background-color: #fdfdfd; 43 | background-image: linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); 44 | background-size: 3em 3em; 45 | background-origin: content-box; 46 | background-attachment: local; 47 | } 48 | 49 | code[class*="language"] { 50 | max-height: inherit; 51 | padding: 0 1em; 52 | display: block; 53 | overflow: auto; 54 | } 55 | 56 | /* Margin bottom to accomodate shadow */ 57 | :not(pre) > code[class*="language-"], 58 | pre[class*="language-"] { 59 | background-color: #fdfdfd; 60 | -webkit-box-sizing: border-box; 61 | -moz-box-sizing: border-box; 62 | box-sizing: border-box; 63 | margin-bottom: 1em; 64 | } 65 | 66 | /* Inline code */ 67 | :not(pre) > code[class*="language-"] { 68 | position: relative; 69 | padding: .2em; 70 | border-radius: 0.3em; 71 | color: #c92c2c; 72 | border: 1px solid rgba(0, 0, 0, 0.1); 73 | display: inline; 74 | white-space: normal; 75 | } 76 | 77 | pre[class*="language-"]:before, 78 | pre[class*="language-"]:after { 79 | content: ''; 80 | z-index: -2; 81 | display: block; 82 | position: absolute; 83 | bottom: 0.75em; 84 | left: 0.18em; 85 | width: 40%; 86 | height: 20%; 87 | max-height: 13em; 88 | box-shadow: 0px 13px 8px #979797; 89 | -webkit-transform: rotate(-2deg); 90 | -moz-transform: rotate(-2deg); 91 | -ms-transform: rotate(-2deg); 92 | -o-transform: rotate(-2deg); 93 | transform: rotate(-2deg); 94 | } 95 | 96 | :not(pre) > code[class*="language-"]:after, 97 | pre[class*="language-"]:after { 98 | right: 0.75em; 99 | left: auto; 100 | -webkit-transform: rotate(2deg); 101 | -moz-transform: rotate(2deg); 102 | -ms-transform: rotate(2deg); 103 | -o-transform: rotate(2deg); 104 | transform: rotate(2deg); 105 | } 106 | 107 | .token.comment, 108 | .token.block-comment, 109 | .token.prolog, 110 | .token.doctype, 111 | .token.cdata { 112 | color: #7D8B99; 113 | } 114 | 115 | .token.punctuation { 116 | color: #5F6364; 117 | } 118 | 119 | .token.property, 120 | .token.tag, 121 | .token.boolean, 122 | .token.number, 123 | .token.function-name, 124 | .token.constant, 125 | .token.symbol, 126 | .token.deleted { 127 | color: #c92c2c; 128 | } 129 | 130 | .token.selector, 131 | .token.attr-name, 132 | .token.string, 133 | .token.char, 134 | .token.function, 135 | .token.builtin, 136 | .token.inserted { 137 | color: #2f9c0a; 138 | } 139 | 140 | .token.operator, 141 | .token.entity, 142 | .token.url, 143 | .token.variable { 144 | color: #a67f59; 145 | background: rgba(255, 255, 255, 0.5); 146 | } 147 | 148 | .token.atrule, 149 | .token.attr-value, 150 | .token.keyword, 151 | .token.class-name { 152 | color: #1990b8; 153 | } 154 | 155 | .token.regex, 156 | .token.important { 157 | color: #e90; 158 | } 159 | 160 | .language-css .token.string, 161 | .style .token.string { 162 | color: #a67f59; 163 | background: rgba(255, 255, 255, 0.5); 164 | } 165 | 166 | .token.important { 167 | font-weight: normal; 168 | } 169 | 170 | .token.bold { 171 | font-weight: bold; 172 | } 173 | .token.italic { 174 | font-style: italic; 175 | } 176 | 177 | .token.entity { 178 | cursor: help; 179 | } 180 | 181 | .namespace { 182 | opacity: .7; 183 | } 184 | 185 | @media screen and (max-width: 767px) { 186 | pre[class*="language-"]:before, 187 | pre[class*="language-"]:after { 188 | bottom: 14px; 189 | box-shadow: none; 190 | } 191 | 192 | } 193 | 194 | /* Plugin styles */ 195 | .token.tab:not(:empty):before, 196 | .token.cr:before, 197 | .token.lf:before { 198 | color: #e0d7d1; 199 | } 200 | 201 | /* Plugin styles: Line Numbers */ 202 | pre[class*="language-"].line-numbers { 203 | padding-left: 0; 204 | } 205 | 206 | pre[class*="language-"].line-numbers code { 207 | padding-left: 3.8em; 208 | } 209 | 210 | pre[class*="language-"].line-numbers .line-numbers-rows { 211 | left: 0; 212 | } 213 | 214 | /* Plugin styles: Line Highlight */ 215 | pre[class*="language-"][data-line] { 216 | padding-top: 0; 217 | padding-bottom: 0; 218 | padding-left: 0; 219 | } 220 | pre[data-line] code { 221 | position: relative; 222 | padding-left: 4em; 223 | } 224 | pre .line-highlight { 225 | margin-top: 0; 226 | } 227 | 228 | -------------------------------------------------------------------------------- /assets/images/donate-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/donate-banner.jpg -------------------------------------------------------------------------------- /assets/images/github-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/github-banner.jpg -------------------------------------------------------------------------------- /assets/images/github-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/github-icon.png -------------------------------------------------------------------------------- /assets/images/rate-us-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/rate-us-banner.jpg -------------------------------------------------------------------------------- /assets/images/share-ideas-banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/share-ideas-banner.jpg -------------------------------------------------------------------------------- /assets/images/working-hard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/working-hard.jpg -------------------------------------------------------------------------------- /assets/images/wp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/unCommonsTeam/gutenberg-manager/1a91d756f3d8c8423c27668885881fa7a27b8261/assets/images/wp-icon.png -------------------------------------------------------------------------------- /assets/js/prism.min.js: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.9.0 2 | http://prismjs.com/download.html?themes=prism-coy&languages=markup+css+clike+javascript+php */ 3 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={manual:_self.Prism&&_self.Prism.manual,disableWorkerMessageHandler:_self.Prism&&_self.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof r?new r(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(w instanceof s)){h.lastIndex=0;var _=h.exec(w),P=1;if(!_&&m&&b!=t.length-1){if(h.lastIndex=k,_=h.exec(e),!_)break;for(var A=_.index+(d?_[1].length:0),j=_.index+_[0].length,x=b,O=k,N=t.length;N>x&&(j>O||!t[x].type&&!t[x-1].greedy);++x)O+=t[x].length,A>=O&&(++b,k=O);if(t[b]instanceof s||t[x-1].greedy)continue;P=x-b,w=e.slice(k,O),_.index-=k}if(_){d&&(p=_[1].length);var A=_.index+p,_=_[0].slice(p),j=A+_.length,S=w.slice(0,A),C=w.slice(j),M=[b,P];S&&(++b,k+=S.length,M.push(S));var E=new s(g,f?n.tokenize(_,f):_,y,_,m);if(M.push(E),C&&M.push(C),Array.prototype.splice.apply(t,M),1!=P&&n.matchGrammar(e,t,r,b,k,!0,g),i)break}else if(i)break}}}}},tokenize:function(e,t){var r=[e],a=t.rest;if(a){for(var l in a)t[l]=a[l];delete t.rest}return n.matchGrammar(e,r,t,0,0,!1),r},hooks:{all:{},add:function(e,t){var r=n.hooks.all;r[e]=r[e]||[],r[e].push(t)},run:function(e,t){var r=n.hooks.all[e];if(r&&r.length)for(var a,l=0;a=r[l++];)a(t)}}},r=n.Token=function(e,t,n,r,a){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!a};if(r.stringify=function(e,t,a){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return r.stringify(n,t,e)}).join("");var l={type:e.type,content:r.stringify(e.content,t,a),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:a};if(e.alias){var i="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}n.hooks.run("wrap",l);var o=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(o?" "+o:"")+">"+l.content+""},!_self.document)return _self.addEventListener?(n.disableWorkerMessageHandler||_self.addEventListener("message",function(e){var t=JSON.parse(e.data),r=t.language,a=t.code,l=t.immediateClose;_self.postMessage(n.highlight(a,n.languages[r],r)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return a&&(n.filename=a.src,n.manual||a.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); 4 | Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; 5 | Prism.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/()[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css",greedy:!0}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); 6 | Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(?:true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; 7 | Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|\d*\.?\d+(?:[Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"}}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/()[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript",greedy:!0}}),Prism.languages.js=Prism.languages.javascript; 8 | Prism.languages.php=Prism.languages.extend("clike",{string:{pattern:/(["'])(?:\\[\s\S]|(?!\1)[^\\])*\1/,greedy:!0},keyword:/\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,constant:/\b[A-Z0-9_]{2,}\b/,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0}}),Prism.languages.insertBefore("php","class-name",{"shell-comment":{pattern:/(^|[^\\])#.*/,lookbehind:!0,alias:"comment"}}),Prism.languages.insertBefore("php","keyword",{delimiter:{pattern:/\?>|<\?(?:php|=)?/i,alias:"important"},variable:/\$\w+\b/i,"package":{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),Prism.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}}),Prism.languages.markup&&(Prism.hooks.add("before-highlight",function(e){"php"===e.language&&/(?:<\?php|<\?)/gi.test(e.code)&&(e.tokenStack=[],e.backupCode=e.code,e.code=e.code.replace(/(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/gi,function(a){for(var n=e.tokenStack.length;-1!==e.backupCode.indexOf("___PHP"+n+"___");)++n;return e.tokenStack[n]=a,"___PHP"+n+"___"}),e.grammar=Prism.languages.markup)}),Prism.hooks.add("before-insert",function(e){"php"===e.language&&e.backupCode&&(e.code=e.backupCode,delete e.backupCode)}),Prism.hooks.add("after-highlight",function(e){if("php"===e.language&&e.tokenStack){e.grammar=Prism.languages.php;for(var a=0,n=Object.keys(e.tokenStack);a'+Prism.highlight(r,e.grammar,"php").replace(/\$/g,"$$$$")+"")}e.element.innerHTML=e.highlightedCode}})); 9 | -------------------------------------------------------------------------------- /assets/js/scripts.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | /* Gutenberg Manager Scripts 4 | * @since 1.0 5 | */ 6 | 7 | jQuery(function($) { 8 | 9 | "use strict"; 10 | 11 | // Options save warning 12 | var $warn = $('input[name=warn]'); 13 | 14 | $(document).ready(function() { 15 | 16 | $('.gm-options-form input').change(function() { 17 | $warn.val('1'); 18 | }); 19 | 20 | $('.gm-options-form').submit(function () { 21 | $warn.val('0'); 22 | }); 23 | 24 | // Select/Deselect all Common Blocks 25 | $('#select-Common').change(function() { 26 | if(this.checked) { 27 | $('.form-table.Common input[type=checkbox]').prop("checked", true); 28 | }else{ 29 | $('.form-table.Common input[type=checkbox]').prop("checked", false); 30 | } 31 | }); 32 | 33 | // Select/Deselect all Formatting Blocks 34 | $('#select-Formatting').change(function() { 35 | if(this.checked) { 36 | $('.form-table.Formatting input[type=checkbox]').prop("checked", true); 37 | }else{ 38 | $('.form-table.Formatting input[type=checkbox]').prop("checked", false); 39 | } 40 | }); 41 | 42 | // Select/Deselect all Layout Blocks 43 | $('#select-Layout').change(function() { 44 | if(this.checked) { 45 | $('.form-table.Layout input[type=checkbox]').prop("checked", true); 46 | }else{ 47 | $('.form-table.Layout input[type=checkbox]').prop("checked", false); 48 | } 49 | }); 50 | 51 | // Select/Deselect all Widgets Blocks 52 | $('#select-Widgets').change(function() { 53 | if(this.checked) { 54 | $('.form-table.Widgets input[type=checkbox]').prop("checked", true); 55 | }else{ 56 | $('.form-table.Widgets input[type=checkbox]').prop("checked", false); 57 | } 58 | }); 59 | 60 | // Select/Deselect all Embed Blocks 61 | $('#select-Embed').change(function() { 62 | if(this.checked) { 63 | $('.form-table.Embed input[type=checkbox]').prop("checked", true); 64 | }else{ 65 | $('.form-table.Embed input[type=checkbox]').prop("checked", false); 66 | } 67 | }); 68 | 69 | }); 70 | 71 | window.onbeforeunload = function () { 72 | 73 | if( $warn.val() == 1 ) { 74 | return true; 75 | } 76 | 77 | } 78 | 79 | }); -------------------------------------------------------------------------------- /gutenberg-manager.php: -------------------------------------------------------------------------------- 1 | 33 |

' . esc_html__('Gutenberg Manager Warning: "Classic Editor" plugin is enabled, but you don\'t need it if you are using Gutenberg Manager. However our disabling options will be inhibited to allow "Classic Editor" to work properly (we always respect the other plugins).', 'gutenberg-manager') . '

34 | '; 35 | 36 | } 37 | 38 | } 39 | 40 | // CONSTANTS 41 | define( 'GM_DIR', plugin_dir_path( __FILE__ ) ); 42 | define( 'GM_URL', plugin_dir_url( __FILE__ ) ); 43 | 44 | // API/HOOKS 45 | require_once( GM_DIR.'inc/hooks.php' ); 46 | 47 | // OPTIONS 48 | require_once( GM_DIR.'inc/options.php' ); 49 | 50 | // CORE 51 | require_once( GM_DIR.'inc/core.php' ); 52 | 53 | // DEFAULT BLOCKS MANAGING 54 | require_once( GM_DIR.'inc/default-blocks.php' ); 55 | 56 | // ASSETS 57 | add_action( 'admin_enqueue_scripts', 'gm_admin_assets' ); 58 | function gm_admin_assets() { 59 | 60 | // Main Style 61 | wp_enqueue_style( 'gm-main-style', GM_URL . 'assets/css/main.css' ); 62 | 63 | // Prism Style 64 | wp_enqueue_style( 'gm-prism-style', GM_URL . 'assets/css/prism.css' ); 65 | 66 | // Main Scripts 67 | wp_enqueue_script( 'gm-main-scripts', GM_URL . 'assets/js/scripts.js', array( 'jquery' ) ); 68 | 69 | // Prism Script 70 | wp_enqueue_script( 'gm-prism-script', GM_URL . 'assets/js/prism.min.js', array( 'jquery' ), null, true ); 71 | 72 | } 73 | 74 | // LANGUAGE 75 | add_action('plugins_loaded', 'gm_language'); 76 | 77 | function gm_language() { 78 | 79 | load_plugin_textdomain( 'gutenberg-manager', false, GM_DIR . 'languages/' ); 80 | 81 | } 82 | 83 | // SETTINGS LINK 84 | add_filter( 'plugin_action_links_manager-for-gutenberg/gutenberg-manager.php', 'gm_settings_link' ); 85 | 86 | function gm_settings_link( $links ) { 87 | 88 | $settings_link = '' . esc_html__( 'Settings', 'gutenberg-manager' ) . ''; 89 | 90 | array_push( $links, $settings_link ); 91 | 92 | return $links; 93 | 94 | } -------------------------------------------------------------------------------- /inc/core.php: -------------------------------------------------------------------------------- 1 | post_type; 27 | 28 | // Pages 29 | if( get_option('gm-page-disable') && $current_post_type == 'page' ){ 30 | 31 | gm_gutenberg_removal(); 32 | 33 | } 34 | 35 | if( $current_post_type == 'page' && defined('GM_DISABLE_page') && GM_DISABLE_page ){ 36 | 37 | gm_gutenberg_removal(); 38 | 39 | } 40 | 41 | // Posts 42 | if( get_option('gm-post-disable') && $current_post_type == 'post' ){ 43 | 44 | gm_gutenberg_removal(); 45 | 46 | } 47 | 48 | if( $current_post_type == 'post' && defined('GM_DISABLE_post') && GM_DISABLE_post ){ 49 | 50 | gm_gutenberg_removal(); 51 | 52 | } 53 | 54 | // Other Post Types 55 | $post_types = get_post_types(array('public' => true, '_builtin' => false), 'object'); 56 | 57 | foreach( $post_types as $name=>$obj ){ 58 | 59 | if( get_option('gm-'.$name.'-disable') && $current_post_type == $name ){ 60 | 61 | gm_gutenberg_removal(); 62 | 63 | } 64 | 65 | if( $current_post_type == $name && defined('GM_DISABLE_'.$name) && constant('GM_DISABLE_'.$name) ){ 66 | 67 | gm_gutenberg_removal(); 68 | 69 | } 70 | 71 | } 72 | 73 | } 74 | 75 | 76 | // HELPER 77 | 78 | // Gutenberg Removal Actions and Filters 79 | function gm_gutenberg_removal() { 80 | 81 | if ( !is_plugin_active('classic-editor/classic-editor.php') ) { // Stop disabling Gutenberg Editor if is enabled Classic Editor plugin 82 | 83 | $gutenberg = function_exists('gutenberg_can_edit_post_type'); 84 | 85 | $block_editor = has_action('enqueue_block_assets'); 86 | 87 | if (!$gutenberg && $block_editor === false) return; 88 | 89 | if ($block_editor) { 90 | 91 | add_filter('use_block_editor_for_post_type', '__return_false', 100); 92 | 93 | } 94 | 95 | if ($gutenberg) { 96 | 97 | add_filter('gutenberg_can_edit_post_type', '__return_false', 100); 98 | 99 | // synced w/ Classic Editor plugin 100 | 101 | remove_action('admin_menu', 'gutenberg_menu'); 102 | remove_action('admin_init', 'gutenberg_redirect_demo'); 103 | 104 | remove_filter('wp_refresh_nonces', 'gutenberg_add_rest_nonce_to_heartbeat_response_headers'); 105 | remove_filter('get_edit_post_link', 'gutenberg_revisions_link_to_editor'); 106 | remove_filter('wp_prepare_revision_for_js', 'gutenberg_revisions_restore'); 107 | 108 | remove_action('rest_api_init', 'gutenberg_register_rest_routes'); 109 | remove_action('rest_api_init', 'gutenberg_add_taxonomy_visibility_field'); 110 | remove_filter('rest_request_after_callbacks', 'gutenberg_filter_oembed_result'); 111 | remove_filter('registered_post_type', 'gutenberg_register_post_prepare_functions'); 112 | 113 | remove_action('do_meta_boxes', 'gutenberg_meta_box_save', 1000); 114 | remove_action('submitpost_box', 'gutenberg_intercept_meta_box_render'); 115 | remove_action('submitpage_box', 'gutenberg_intercept_meta_box_render'); 116 | remove_action('edit_page_form', 'gutenberg_intercept_meta_box_render'); 117 | remove_action('edit_form_advanced', 'gutenberg_intercept_meta_box_render'); 118 | remove_filter('redirect_post_location', 'gutenberg_meta_box_save_redirect'); 119 | remove_filter('filter_gutenberg_meta_boxes', 'gutenberg_filter_meta_boxes'); 120 | 121 | remove_action('admin_notices', 'gutenberg_build_files_notice'); 122 | remove_filter('body_class', 'gutenberg_add_responsive_body_class'); 123 | remove_filter('admin_url', 'gutenberg_modify_add_new_button_url'); // old 124 | remove_action('admin_enqueue_scripts', 'gutenberg_check_if_classic_needs_warning_about_blocks'); 125 | remove_filter('register_post_type_args', 'gutenberg_filter_post_type_labels'); 126 | 127 | remove_action('admin_init', 'gutenberg_add_edit_link_filters'); 128 | remove_action('admin_print_scripts-edit.php', 'gutenberg_replace_default_add_new_button'); 129 | remove_filter('redirect_post_location', 'gutenberg_redirect_to_classic_editor_when_saving_posts'); 130 | remove_filter('display_post_states', 'gutenberg_add_gutenberg_post_state'); 131 | remove_action('edit_form_top', 'gutenberg_remember_classic_editor_when_saving_posts'); 132 | 133 | } 134 | 135 | } 136 | 137 | } 138 | 139 | -------------------------------------------------------------------------------- /inc/default-blocks.php: -------------------------------------------------------------------------------- 1 | 'core/image', 'opt' => 'gm-block-image-disable', 'title' => 'Image', 'const' => 'GM_DISABLE_BLOCK_image'), 15 | array('slug' => 'core/gallery', 'opt' => 'gm-block-gallery-disable', 'title' => 'Gallery', 'const' => 'GM_DISABLE_BLOCK_gallery'), 16 | array('slug' => 'core/heading', 'opt' => 'gm-block-heading-disable', 'title' => 'Heading', 'const' => 'GM_DISABLE_BLOCK_heading'), 17 | array('slug' => 'core/quote', 'opt' => 'gm-block-quote-disable', 'title' => 'Quote', 'const' => 'GM_DISABLE_BLOCK_quote'), 18 | array('slug' => 'core/list', 'opt' => 'gm-block-list-disable', 'title' => 'List', 'const' => 'GM_DISABLE_BLOCK_list'), 19 | array('slug' => 'core/cover', 'opt' => 'gm-block-cover-disable', 'title' => 'Cover', 'const' => 'GM_DISABLE_BLOCK_cover'), 20 | array('slug' => 'core/video', 'opt' => 'gm-block-video-disable', 'title' => 'Video', 'const' => 'GM_DISABLE_BLOCK_video'), 21 | array('slug' => 'core/audio', 'opt' => 'gm-block-audio-disable', 'title' => 'Audio', 'const' => 'GM_DISABLE_BLOCK_audio'), 22 | array('slug' => 'core/paragraph', 'opt' => 'gm-block-paragraph-disable', 'title' => 'Paragraph', 'const' => 'GM_DISABLE_BLOCK_paragraph'), 23 | array('slug' => 'core/file', 'opt' => 'gm-block-file-disable', 'title' => 'File', 'const' => 'GM_DISABLE_BLOCK_file'), 24 | 25 | array('slug' => 'core/pullquote', 'opt' => 'gm-block-pullquote-disable', 'title' => 'Pullquote', 'const' => 'GM_DISABLE_BLOCK_pullquote'), 26 | array('slug' => 'core/table', 'opt' => 'gm-block-table-disable', 'title' => 'Table', 'const' => 'GM_DISABLE_BLOCK_table'), 27 | array('slug' => 'core/preformatted', 'opt' => 'gm-block-preformatted-disable', 'title' => 'Preformatted', 'const' => 'GM_DISABLE_BLOCK_preformatted'), 28 | array('slug' => 'core/code', 'opt' => 'gm-block-code-disable', 'title' => 'Code', 'const' => 'GM_DISABLE_BLOCK_code'), 29 | array('slug' => 'core/html', 'opt' => 'gm-block-html-disable', 'title' => 'Custom HTML', 'const' => 'GM_DISABLE_BLOCK_custom_html'), 30 | array('slug' => 'core/freeform', 'opt' => 'gm-block-freeform-disable', 'title' => 'Classic', 'const' => 'GM_DISABLE_BLOCK_classic_text'), 31 | array('slug' => 'core/verse', 'opt' => 'gm-block-verse-disable', 'title' => 'Verse', 'const' => 'GM_DISABLE_BLOCK_verse'), 32 | 33 | array('slug' => 'core/media-text', 'opt' => 'gm-block-media-text-disable', 'title' => 'Media & Text', 'const' => 'GM_DISABLE_BLOCK_media_text'), 34 | array('slug' => 'core/separator', 'opt' => 'gm-block-separator-disable', 'title' => 'Separator', 'const' => 'GM_DISABLE_BLOCK_separator'), 35 | array('slug' => 'core/more', 'opt' => 'gm-block-more-disable', 'title' => 'More', 'const' => 'GM_DISABLE_BLOCK_more'), 36 | array('slug' => 'core/button', 'opt' => 'gm-block-button-disable', 'title' => 'Button', 'const' => 'GM_DISABLE_BLOCK_button'), 37 | array('slug' => 'core/columns', 'opt' => 'gm-block-columns-disable', 'title' => 'Columns', 'const' => 'GM_DISABLE_BLOCK_columns'), 38 | array('slug' => 'core/nextpage', 'opt' => 'gm-block-nextpage-disable', 'title' => 'Page Break', 'const' => 'GM_DISABLE_BLOCK_nextpage'), 39 | array('slug' => 'core/spacer', 'opt' => 'gm-block-spacer-disable', 'title' => 'Spacer', 'const' => 'GM_DISABLE_BLOCK_spacer'), 40 | 41 | array('slug' => 'core/shortcode', 'opt' => 'gm-block-shortcode-disable', 'title' => 'Shortcode', 'const' => 'GM_DISABLE_BLOCK_shortcode'), 42 | array('slug' => 'core/latest-posts', 'opt' => 'gm-block-latest-posts-disable', 'title' => 'Latest Posts', 'const' => 'GM_DISABLE_BLOCK_latest_posts'), 43 | array('slug' => 'core/latest-comments', 'opt' => 'gm-block-latest-comments-disable', 'title' => 'Latest Comments', 'const' => 'GM_DISABLE_BLOCK_latest_comments'), 44 | array('slug' => 'core/categories', 'opt' => 'gm-block-categories-disable', 'title' => 'Categories', 'const' => 'GM_DISABLE_BLOCK_categories'), 45 | array('slug' => 'core/archives', 'opt' => 'gm-block-archives-disable', 'title' => 'Archives', 'const' => 'GM_DISABLE_BLOCK_archives'), 46 | 47 | array('slug' => 'core/embed', 'opt' => 'gm-block-embed-disable', 'title' => 'Embed', 'const' => 'GM_DISABLE_BLOCK_embed'), 48 | array('slug' => 'core-embed/twitter', 'opt' => 'gm-block-twitter-disable', 'title' => 'Twitter', 'const' => 'GM_DISABLE_BLOCK_twitter'), 49 | array('slug' => 'core-embed/youtube', 'opt' => 'gm-block-youtube-disable', 'title' => 'YouTube', 'const' => 'GM_DISABLE_BLOCK_youtube'), 50 | array('slug' => 'core-embed/facebook', 'opt' => 'gm-block-facebook-disable', 'title' => 'Facebook', 'const' => 'GM_DISABLE_BLOCK_facebook'), 51 | array('slug' => 'core-embed/instagram', 'opt' => 'gm-block-instagram-disable', 'title' => 'Instagram', 'const' => 'GM_DISABLE_BLOCK_instagram'), 52 | array('slug' => 'core-embed/wordpress', 'opt' => 'gm-block-wordpress-disable', 'title' => 'WordPress', 'const' => 'GM_DISABLE_BLOCK_wordpress'), 53 | array('slug' => 'core-embed/soundcloud', 'opt' => 'gm-block-soundcloud-disable', 'title' => 'SoundCloud', 'const' => 'GM_DISABLE_BLOCK_soundcloud'), 54 | array('slug' => 'core-embed/spotify', 'opt' => 'gm-block-spotify-disable', 'title' => 'Spotify', 'const' => 'GM_DISABLE_BLOCK_spotify'), 55 | array('slug' => 'core-embed/flickr', 'opt' => 'gm-block-flickr-disable', 'title' => 'Flickr', 'const' => 'GM_DISABLE_BLOCK_flickr'), 56 | array('slug' => 'core-embed/vimeo', 'opt' => 'gm-block-vimeo-disable', 'title' => 'Vimeo', 'const' => 'GM_DISABLE_BLOCK_vimeo'), 57 | array('slug' => 'core-embed/animoto', 'opt' => 'gm-block-animoto-disable', 'title' => 'Animoto', 'const' => 'GM_DISABLE_BLOCK_animoto'), 58 | array('slug' => 'core-embed/cloudup', 'opt' => 'gm-block-cloudup-disable', 'title' => 'Cloudup', 'const' => 'GM_DISABLE_BLOCK_cloudup'), 59 | array('slug' => 'core-embed/collegehumor', 'opt' => 'gm-block-collegehumor-disable', 'title' => 'CollegeHumor', 'const' => 'GM_DISABLE_BLOCK_collegehumor'), 60 | array('slug' => 'core-embed/dailymotion', 'opt' => 'gm-block-dailymotion-disable', 'title' => 'Dailymotion', 'const' => 'GM_DISABLE_BLOCK_dailymotion'), 61 | array('slug' => 'core-embed/funnyordie', 'opt' => 'gm-block-funnyordie-disable', 'title' => 'Funny or Die', 'const' => 'GM_DISABLE_BLOCK_funny_or_die'), 62 | array('slug' => 'core-embed/hulu', 'opt' => 'gm-block-hulu-disable', 'title' => 'Hulu', 'const' => 'GM_DISABLE_BLOCK_hulu'), 63 | array('slug' => 'core-embed/imgur', 'opt' => 'gm-block-imgur-disable', 'title' => 'Imgur', 'const' => 'GM_DISABLE_BLOCK_imgur'), 64 | array('slug' => 'core-embed/issuu', 'opt' => 'gm-block-issuu-disable', 'title' => 'Issuu', 'const' => 'GM_DISABLE_BLOCK_issuu'), 65 | array('slug' => 'core-embed/kickstarter', 'opt' => 'gm-block-kickstarter-disable', 'title' => 'Kickstarter', 'const' => 'GM_DISABLE_BLOCK_kickstarter'), 66 | array('slug' => 'core-embed/meetup-com', 'opt' => 'gm-block-meetup-com-disable', 'title' => 'Meetup.com', 'const' => 'GM_DISABLE_BLOCK_meetup'), 67 | array('slug' => 'core-embed/mixcloud', 'opt' => 'gm-block-mixcloud-disable', 'title' => 'Mixcloud', 'const' => 'GM_DISABLE_BLOCK_mixcloud'), 68 | array('slug' => 'core-embed/photobucket', 'opt' => 'gm-block-photobucket-disable', 'title' => 'Photobucket', 'const' => 'GM_DISABLE_BLOCK_photobucket'), 69 | array('slug' => 'core-embed/polldaddy', 'opt' => 'gm-block-polldaddy-disable', 'title' => 'Polldaddy', 'const' => 'GM_DISABLE_BLOCK_polldaddy'), 70 | array('slug' => 'core-embed/reddit', 'opt' => 'gm-block-reddit-disable', 'title' => 'Reddit', 'const' => 'GM_DISABLE_BLOCK_reddit'), 71 | array('slug' => 'core-embed/reverbnation', 'opt' => 'gm-block-reverbnation-disable', 'title' => 'ReverbNation', 'const' => 'GM_DISABLE_BLOCK_reverbnation'), 72 | array('slug' => 'core-embed/screencast', 'opt' => 'gm-block-screencast-disable', 'title' => 'Screencast', 'const' => 'GM_DISABLE_BLOCK_screencast'), 73 | array('slug' => 'core-embed/scribd', 'opt' => 'gm-block-scribd-disable', 'title' => 'Scribd', 'const' => 'GM_DISABLE_BLOCK_scribd'), 74 | array('slug' => 'core-embed/slideshare', 'opt' => 'gm-block-slideshare-disable', 'title' => 'Slideshare', 'const' => 'GM_DISABLE_BLOCK_slideshare'), 75 | array('slug' => 'core-embed/smugmug', 'opt' => 'gm-block-smugmug-disable', 'title' => 'SmugMug', 'const' => 'GM_DISABLE_BLOCK_smugmug'), 76 | array('slug' => 'core-embed/speaker-deck', 'opt' => 'gm-block-speaker-deck-disable', 'title' => 'Speaker Deck', 'const' => 'GM_DISABLE_BLOCK_speaker_deck'), 77 | array('slug' => 'core-embed/ted', 'opt' => 'gm-block-ted-disable', 'title' => 'TED', 'const' => 'GM_DISABLE_BLOCK_ted'), 78 | array('slug' => 'core-embed/tumblr', 'opt' => 'gm-block-tumblr-disable', 'title' => 'Tumblr', 'const' => 'GM_DISABLE_BLOCK_tumblr'), 79 | array('slug' => 'core-embed/videopress', 'opt' => 'gm-block-videopress-disable', 'title' => 'VideoPress', 'const' => 'GM_DISABLE_BLOCK_videopress'), 80 | array('slug' => 'core-embed/wordpress-tv', 'opt' => 'gm-block-wordpress-tv-disable', 'title' => 'WordPress.tv', 'const' => 'GM_DISABLE_BLOCK_wordpress_tv'), 81 | 82 | ); 83 | 84 | $options_blocks = array(); 85 | $allowed_blocks = array(); 86 | 87 | // Allowed Blocks from Options 88 | foreach ( $default_blocks as $block ) { 89 | 90 | if (get_option($block['opt']) != 1) { 91 | 92 | $options_blocks[] = $block['slug']; 93 | 94 | } 95 | 96 | } 97 | 98 | // Remove Blocks from API 99 | foreach ( $default_blocks as $block ) { 100 | 101 | if (defined($block['const']) && constant($block['const']) === true) { 102 | 103 | if (($key = array_search($block['slug'], $options_blocks)) !== false) { 104 | unset($options_blocks[$key]); 105 | } 106 | 107 | } 108 | 109 | } 110 | 111 | // Generate the Allowed Blocks Array 112 | foreach ( $options_blocks as $block ){ 113 | 114 | $allowed_blocks[] = $block; 115 | 116 | } 117 | 118 | return $allowed_blocks; 119 | 120 | } -------------------------------------------------------------------------------- /inc/hooks.php: -------------------------------------------------------------------------------- 1 | $value ){ 44 | 45 | if(preg_match('/^gm-/', $key)) { 46 | 47 | if( get_option($key) ) { 48 | update_option($key, '0'); 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | } 56 | 57 | } 58 | 59 | // Global Disabling 60 | function gm_global_disable( $value = false ) { 61 | 62 | if( $value ) { 63 | gm_gutenberg_removal(); 64 | } 65 | 66 | } 67 | 68 | // Disable Post Type 69 | function gm_disable_post_type( $types ) { 70 | 71 | foreach ( $types as $name ) { 72 | 73 | define('GM_DISABLE_' . $name, true); 74 | 75 | } 76 | 77 | } 78 | 79 | // Disable Default Blocks 80 | function gm_disable_blocks( $blocks = array() ) { 81 | 82 | foreach ( $blocks as $name ) { 83 | 84 | define('GM_DISABLE_BLOCK_'.$name, true); 85 | 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /inc/options.php: -------------------------------------------------------------------------------- 1 | 22 | 23 |
24 | 25 |

26 | 27 | 39 |

' . esc_html__('Attention: if you disable a block that you have already used in a post/page you may get an editor issue.', 'gutenberg-manager') . '

40 |
'; 41 | } 42 | 43 | // Notices 44 | if( get_option('gm-global-disable') && !is_plugin_active('classic-editor/classic-editor.php') ){ ?> 45 | 46 |
47 |

48 |
49 | 50 | true, '_builtin' => false), 'object'); 54 | 55 | // Default Blocks Array 56 | $default_blocks = array( 57 | 58 | 'Common' => array( 59 | array( 'slug' => 'core/image', 'name' => 'image', 'title' => 'Image' ), 60 | array( 'slug' => 'core/gallery', 'name' => 'gallery', 'title' => 'Gallery' ), 61 | array( 'slug' => 'core/heading', 'name' => 'heading', 'title' => 'Heading' ), 62 | array( 'slug' => 'core/quote', 'name' => 'quote', 'title' => 'Quote' ), 63 | array( 'slug' => 'core/list', 'name' => 'list', 'title' => 'List' ), 64 | array( 'slug' => 'core/cover', 'name' => 'cover', 'title' => 'Cover' ), 65 | array( 'slug' => 'core/video', 'name' => 'video', 'title' => 'Video' ), 66 | array( 'slug' => 'core/audio', 'name' => 'audio', 'title' => 'Audio' ), 67 | array( 'slug' => 'core/paragraph', 'name' => 'paragraph', 'title' => 'Paragraph' ), 68 | array( 'slug' => 'core/file', 'name' => 'file', 'title' => 'File' ), 69 | ), 70 | 71 | 'Formatting' => array( 72 | array( 'slug' => 'core/pullquote', 'name' => 'pullquote', 'title' => 'Pullquote' ), 73 | array( 'slug' => 'core/table', 'name' => 'table', 'title' => 'Table' ), 74 | array( 'slug' => 'core/preformatted', 'name' => 'preformatted', 'title' => 'Preformatted' ), 75 | array( 'slug' => 'core/code', 'name' => 'code', 'title' => 'Code' ), 76 | array( 'slug' => 'core/html', 'name' => 'html', 'title' => 'Custom HTML' ), 77 | array( 'slug' => 'core/freeform', 'name' => 'freeform', 'title' => 'Classic' ), 78 | array( 'slug' => 'core/verse', 'name' => 'verse', 'title' => 'Verse' ), 79 | ), 80 | 81 | 'Layout' => array( 82 | array( 'slug' => 'core/media-text', 'name' => 'media-text', 'title' => 'Media & Text' ), 83 | array( 'slug' => 'core/separator', 'name' => 'separator', 'title' => 'Separator' ), 84 | array( 'slug' => 'core/more', 'name' => 'more', 'title' => 'More' ), 85 | array( 'slug' => 'core/button', 'name' => 'button', 'title' => 'Button' ), 86 | array( 'slug' => 'core/columns', 'name' => 'columns', 'title' => 'Columns' ), 87 | array( 'slug' => 'core/nextpage', 'name' => 'nextpage', 'title' => 'Page Break' ), 88 | array( 'slug' => 'core/spacer', 'name' => 'spacer', 'title' => 'Spacer' ), 89 | ), 90 | 91 | 'Widgets' => array( 92 | array( 'slug' => 'core/shortcode', 'name' => 'shortcode', 'title' => 'Shortcode' ), 93 | array( 'slug' => 'core/latest-posts', 'name' => 'latest-posts', 'title' => 'Latest Posts' ), 94 | array( 'slug' => 'core/latest-comments', 'name' => 'latest-comments', 'title' => 'Latest Comments' ), 95 | array( 'slug' => 'core/categories', 'name' => 'categories', 'title' => 'Categories' ), 96 | array( 'slug' => 'core/archives', 'name' => 'archives', 'title' => 'Archives' ), 97 | ), 98 | 99 | 'Embed' => array( 100 | array( 'slug' => 'core/embed', 'name' => 'embed', 'title' => 'Embed' ), 101 | array( 'slug' => 'core-embed/twitter', 'name' => 'twitter', 'title' => 'Twitter' ), 102 | array( 'slug' => 'core-embed/youtube', 'name' => 'youtube', 'title' => 'YouTube' ), 103 | array( 'slug' => 'core-embed/facebook', 'name' => 'facebook', 'title' => 'Facebook' ), 104 | array( 'slug' => 'core-embed/instagram', 'name' => 'instagram', 'title' => 'Instagram' ), 105 | array( 'slug' => 'core-embed/wordpress', 'name' => 'wordpress', 'title' => 'WordPress' ), 106 | array( 'slug' => 'core-embed/soundcloud', 'name' => 'soundcloud', 'title' => 'SoundCloud' ), 107 | array( 'slug' => 'core-embed/spotify', 'name' => 'spotify', 'title' => 'Spotify' ), 108 | array( 'slug' => 'core-embed/flickr', 'name' => 'flickr', 'title' => 'Flickr' ), 109 | array( 'slug' => 'core-embed/vimeo', 'name' => 'vimeo', 'title' => 'Vimeo' ), 110 | array( 'slug' => 'core-embed/animoto', 'name' => 'animoto', 'title' => 'Animoto' ), 111 | array( 'slug' => 'core-embed/cloudup', 'name' => 'cloudup', 'title' => 'Cloudup' ), 112 | array( 'slug' => 'core-embed/collegehumor', 'name' => 'collegehumor', 'title' => 'CollegeHumor' ), 113 | array( 'slug' => 'core-embed/dailymotion', 'name' => 'dailymotion', 'title' => 'Dailymotion' ), 114 | array( 'slug' => 'core-embed/funnyordie', 'name' => 'funnyordie', 'title' => 'Funny or Die' ), 115 | array( 'slug' => 'core-embed/hulu', 'name' => 'hulu', 'title' => 'Hulu' ), 116 | array( 'slug' => 'core-embed/imgur', 'name' => 'imgur', 'title' => 'Imgur' ), 117 | array( 'slug' => 'core-embed/issuu', 'name' => 'issuu', 'title' => 'Issuu' ), 118 | array( 'slug' => 'core-embed/kickstarter', 'name' => 'kickstarter', 'title' => 'Kickstarter' ), 119 | array( 'slug' => 'core-embed/meetup-com', 'name' => 'meetup-com', 'title' => 'Meetup.com' ), 120 | array( 'slug' => 'core-embed/mixcloud', 'name' => 'mixcloud', 'title' => 'Mixcloud' ), 121 | array( 'slug' => 'core-embed/photobucket', 'name' => 'photobucket', 'title' => 'Photobucket' ), 122 | array( 'slug' => 'core-embed/polldaddy', 'name' => 'polldaddy', 'title' => 'Polldaddy' ), 123 | array( 'slug' => 'core-embed/reddit', 'name' => 'reddit', 'title' => 'Reddit' ), 124 | array( 'slug' => 'core-embed/reverbnation', 'name' => 'reverbnation', 'title' => 'ReverbNation' ), 125 | array( 'slug' => 'core-embed/screencast', 'name' => 'screencast', 'title' => 'Screencast' ), 126 | array( 'slug' => 'core-embed/scribd', 'name' => 'scribd', 'title' => 'Scribd' ), 127 | array( 'slug' => 'core-embed/slideshare', 'name' => 'slideshare', 'title' => 'Slideshare' ), 128 | array( 'slug' => 'core-embed/smugmug', 'name' => 'smugmug', 'title' => 'SmugMug' ), 129 | array( 'slug' => 'core-embed/speaker-deck', 'name' => 'speaker-deck', 'title' => 'Speaker Deck' ), 130 | array( 'slug' => 'core-embed/ted', 'name' => 'ted', 'title' => 'TED' ), 131 | array( 'slug' => 'core-embed/tumblr', 'name' => 'tumblr', 'title' => 'Tumblr' ), 132 | array( 'slug' => 'core-embed/videopress', 'name' => 'videopress', 'title' => 'VideoPress' ), 133 | array( 'slug' => 'core-embed/wordpress-tv', 'name' => 'wordpress-tv', 'title' => 'WordPress.tv' ), 134 | ), 135 | 136 | ); 137 | 138 | // Options names list 139 | $opt_names_list = ''; 140 | 141 | ?> 142 | 143 | 737 | 738 | 739 | 740 | $value ){ 12 | 13 | if(preg_match('/^gm-/', $key)) { 14 | 15 | delete_option( $key ); 16 | 17 | } 18 | 19 | } 20 | --------------------------------------------------------------------------------