- Added: Ability for the integration with Gutenberg Block restriction settings (extends the block restriction settings via 3rd-party plugins);

- Added: Invalid nonce validation on Login and Registration pages instead of wp_die()
This commit is contained in:
nikitasinelnikov
2020-12-04 03:54:59 +02:00
parent d5bafa9c60
commit 5afebdd786
17 changed files with 145 additions and 89 deletions
+10 -1
View File
@@ -181,7 +181,7 @@
.um-admin-btn-content {
display: none;
padding: 10px 0 0 0;
padding: 5px 0 0 0;
}
.um-admin-btn-content p {
@@ -190,6 +190,15 @@
padding: 0 !important;
}
.um-admin-btn-content p.um-admin-conditions-notice {
width: 100%;
margin: 0 0 9px 0 !important;
}
.um-admin-btn-content .um-admin-cur-condition:not(:last-child) {
margin: 0 0 5px 0;
}
.dynamic-mce-content {display: none}
/*
+33 -24
View File
@@ -1,24 +1,24 @@
'use strict';
/**
* Add Control element
*/
var um_el = wp.element.createElement;
var um_components = wp.components,
umToggleControl = um_components.ToggleControl,
umSelectControl = um_components.SelectControl,
umTextareaControl = um_components.TextareaControl,
umPanelBody = um_components.PanelBody;
umTextareaControl = um_components.TextareaControl;
function um_admin_blocks_custom_fields( um_condition_fields, props ) {
return wp.hooks.applyFilters( 'um_admin_blocks_custom_fields', [], um_condition_fields, props );
}
var um_block_restriction = wp.compose.createHigherOrderComponent( function( BlockEdit ) {
var um_condition_fields = {
um_who_access:'um_block_settings_hide',
um_roles_access:'um_block_settings_hide',
um_message_type:'um_block_settings_hide',
um_message_content:'um_block_settings_hide'
um_who_access: 'um_block_settings_hide',
um_roles_access: 'um_block_settings_hide',
um_message_type: 'um_block_settings_hide',
um_message_content: 'um_block_settings_hide'
};
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_default', um_condition_fields );
return function( props ) {
if ( props.attributes.um_is_restrict !== true ) {
@@ -53,20 +53,22 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc
}
}
return um_el(
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields', um_condition_fields, props );
return wp.element.createElement(
wp.element.Fragment,
{},
um_el( BlockEdit, props ),
um_el(
wp.element.createElement( BlockEdit, props ),
wp.element.createElement(
wp.editor.InspectorControls,
{},
um_el(
umPanelBody,
wp.element.createElement(
wp.components.PanelBody,
{
title: wp.i18n.__( 'UM access Controls', 'ultimate-member' )
},
um_el(
umToggleControl,
wp.element.createElement(
wp.components.ToggleControl,
{
label: wp.i18n.__( 'Restrict access?', 'ultimate-member' ),
checked: props.attributes.um_is_restrict,
@@ -80,10 +82,12 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc
} else {
um_condition_fields['um_who_access'] = '';
}
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_is_restrict', value );
}
}
),
um_el(
wp.element.createElement(
umSelectControl,
{
type: 'number',
@@ -117,10 +121,12 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc
um_condition_fields['um_message_type'] = '';
um_condition_fields['um_roles_access'] = 'um_block_settings_hide';
}
um_condition_fields = wp.hooks.applyFilters( 'um_admin_blocks_condition_fields_on_change', um_condition_fields, 'um_who_access', value );
}
}
),
um_el(
wp.element.createElement(
umSelectControl,
{
multiple: true,
@@ -133,7 +139,7 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc
}
}
),
um_el(
wp.element.createElement(
umSelectControl,
{
type: 'number',
@@ -164,7 +170,7 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc
}
}
),
um_el(
wp.element.createElement(
umTextareaControl,
{
type: 'number',
@@ -175,7 +181,8 @@ var um_block_restriction = wp.compose.createHigherOrderComponent( function( Bloc
props.setAttributes({ um_message_content: value });
}
}
)
),
um_admin_blocks_custom_fields( um_condition_fields, props )
)
)
);
@@ -208,6 +215,8 @@ var um_block_restrict_settings = {
}
};
um_block_restrict_settings = wp.hooks.applyFilters( 'um_admin_blocks_restrict_settings', um_block_restrict_settings );
/**
*