Skip to content

Commit 7d2a8f8

Browse files
authored
Merge pull request #1 from angelorocha/v1.1.1
Add tiny editor support to content access message, change autoload wp…
2 parents c95e8e3 + bb6e7e6 commit 7d2a8f8

File tree

6 files changed

+35
-17
lines changed

6 files changed

+35
-17
lines changed

admin/classes/WPSSAdminFrontend.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function render_template( array $template ): void {
7474
*/
7575
public static function sanitize_output(): array {
7676
return [
77-
'div' => [ 'class' => [], 'id' => [] ],
77+
'div' => [ 'class' => [], 'id' => [], 'role' => [], 'aria-label' => [], 'aria-pressed' => [] ],
7878
'table' => [ 'class' => [], 'id' => [] ],
7979
'thead' => [ 'class' => [], 'id' => [] ],
8080
'tr' => [ 'class' => [], 'id' => [] ],
@@ -93,6 +93,8 @@ public static function sanitize_output(): array {
9393
'h3' => [ 'class' => [], 'id' => [] ],
9494
'h4' => [ 'class' => [], 'id' => [] ],
9595
'u' => [],
96+
'i' => [ 'class' => [], 'id' => [] ],
97+
'link' => [ 'rel' => [], 'href' => [], 'id' => [] ],
9698
'small' => [],
9799
'pre' => [],
98100
'br' => [],
@@ -109,20 +111,24 @@ public static function sanitize_output(): array {
109111
'form' => [ 'method' => [], 'action' => [], 'class' => [], 'id' => [] ],
110112
'label' => [ 'for' => [], 'class' => [], 'id' => [] ],
111113
'input' => [
112-
'type' => [],
113-
'name' => [],
114-
'value' => [],
115-
'id' => [],
116-
'class' => [],
117-
'required' => [],
118-
'checked' => [],
119-
'placeholder' => [],
120-
'title' => [],
114+
'type' => [],
115+
'name' => [],
116+
'value' => [],
117+
'id' => [],
118+
'class' => [],
119+
'required' => [],
120+
'checked' => [],
121+
'placeholder' => [],
122+
'title' => [],
123+
'autocomplete' => [],
124+
'aria-expanded' => [],
125+
'aria-owns' => [],
126+
'style' => [],
121127
],
122128
'select' => [ 'name' => [], 'class' => [], 'id' => [], 'required' => [], 'onchange' => [], ],
123129
'textarea' => [ 'name' => [], 'class' => [], 'id' => [], 'rows' => [], 'cols' => [] ],
124130
'option' => [ 'value' => [], 'selected' => [] ],
125-
'button' => [ 'type' => [], 'class' => [], 'id' => [] ],
131+
'button' => [ 'type' => [], 'class' => [], 'id' => [], 'role' => [], 'hidefocus' => [] ],
126132
];
127133
}
128134

admin/classes/WPSSPluginSettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static function instance(): object {
6767
foreach ( $settings as $key => $value ) {
6868
if ( in_array( $key, $allow_keys ) ) {
6969
if ( ! is_array( $value ) ) {
70-
WPSSPluginHelper::update_option( $key, sanitize_text_field( $value ) );
70+
WPSSPluginHelper::update_option( $key, wp_kses_post( $value ) );
7171
} else {
7272
$value = array_map( 'sanitize_text_field', $value );
7373
WPSSPluginHelper::update_option( $key, wp_json_encode( $value ) );

admin/templates/settings-tab.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@
119119
<label for="wpss_cpt_access_message">
120120
<?php esc_html_e( 'Type a message to show when user no have access to content:', 'wpss-ultimate-user-management' ); ?>
121121
</label>
122-
<textarea id="wpss_cpt_access_message" name="wpss_cpt_access_message" rows="5" cols="100"><?php echo wp_kses_post( $access_message ); ?></textarea>
122+
<?php
123+
$editor_config = [
124+
'textarea_rows' => 5,
125+
'quicktags' => false,
126+
];
127+
wp_editor( wp_kses_post( $access_message ), 'wpss_cpt_access_message', $editor_config );
128+
?>
123129
<hr>
124130
<strong>
125131
<?php esc_html_e( 'Hide admin bar to this roles:', 'wpss-ultimate-user-management' ); ?>

autoload.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ function wpss_autoload( $dir ): void {
1515
if ( !file_exists( "$dir/composer.json" ) ) {
1616
return;
1717
}
18-
$composer = wp_remote_get( WPSS_URCM_PLUGIN_URI . "composer.json" );
19-
$composer = wp_remote_retrieve_body( $composer );
18+
if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php' ) ) {
19+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
20+
}
21+
if ( file_exists( ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php' ) ) {
22+
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
23+
}
24+
$content = new WP_Filesystem_Direct( false );
25+
$composer = $content->get_contents( WPSS_URCM_PLUGIN_PATH . "composer.json" );
2026
$composer = json_decode( $composer, true );
2127
$namespaces = $composer['autoload']['psr-4'] ?? [];
2228
foreach ( $namespaces as $namespace => $classpaths ) {

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: role, capabilities, user, widgets, permissions
55
Requires at least: 6.1
66
Tested up to: 6.6
77
Requires PHP: 8.1
8-
Stable tag: 1.1.0
8+
Stable tag: 1.1.1
99
License: GNU General Public License v3 or later
1010
License URI: /licence.txt
1111

wpss-ultimate-user-management.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Plugin Name: WPSS Ultimate User Management
99
* Plugin URI: https://github.com/angelorocha/wpss-ultimate-user-management
1010
* Description: Manage users, roles and capabilities more easily.
11-
* Version: 1.1.0
11+
* Version: 1.1.1
1212
* Requires at least: 6.1
1313
* Requires PHP: 8.1
1414
* Author: Angelo Rocha

0 commit comments

Comments
 (0)