Skip to content

Commit

Permalink
New tag
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge committed Jul 15, 2020
1 parent 295040e commit 9467368
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 65 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased](https://github.com/bueltge/Adminimize/compare/1.11.6...HEAD)
## [Unreleased](https://github.com/bueltge/Adminimize/compare/1.11.7...HEAD)
*

## [1.11.6](https://github.com/bueltge/Adminimize/compare/1.11.6...1.11.7)
* Add Im-/Export possibility only for different roles, Probs @JulietNoth, #139
* Fix problems with plugins in menus, like WooCommerce, #130
* Fix UI topics on settings page
Expand Down
14 changes: 7 additions & 7 deletions adminimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
* Description: Visually compresses the administrative meta-boxes so that more admin page content can be initially seen. The plugin that lets you hide 'unnecessary' items from the WordPress administration menu, for all roles of your install. You can also hide post meta controls on the edit-area to simplify the interface. It is possible to simplify the admin in different for all roles.
* Author: Frank Bültge
* Author URI: http://bueltge.de/
* Version: 1.11.7-dev
* Version: 1.11.7
* License: GPLv2+
*
* Php Version 5.6
*
* @package WordPress
* @author Frank Bültge <[email protected]>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version 2020-01-27
* @version 2020-07-15
*/

/**
Expand Down Expand Up @@ -163,7 +163,7 @@ function _mw_adminimize_get_all_user_roles() {

$user_roles = array();

if ( NULL !== $wp_roles->roles && is_array( $wp_roles->roles ) ) {
if ( null !== $wp_roles->roles && is_array( $wp_roles->roles ) ) {
foreach ( $wp_roles->roles as $role => $data ) {
$user_roles[] = $role;
// The $data var contains caps, maybe for later use.
Expand Down Expand Up @@ -1781,7 +1781,7 @@ function _mw_adminimize_install() {

/**
* Make sure adminimize option is complete when a role json file is imported
*
*
* @param array $roles_options
*
* @return array
Expand All @@ -1799,7 +1799,7 @@ function _mw_adminimize_roles_complete_options( $roles_options ){

/**
* Check if options comes from roles adminimize settings export
*
*
* @param array $options
*
* @return bool
Expand All @@ -1820,10 +1820,10 @@ function _mw_adminimize_is_roles_options_import( $options ){
$roles_options = $role_options;
} else {
$roles_options = array_merge( $roles_options, $role_options );
}
}
}

if ( count( $options ) === count( $roles_options ) ){
return true;
}
}
}
80 changes: 30 additions & 50 deletions inc-options/im_export_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,74 +9,55 @@
exit;
}
global $wp_roles;

?>

<div id="poststuff" class="ui-sortable meta-box-sortables">
<div class="postbox">
<h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="import"><?php esc_attr_e( 'Export/Import Options', 'adminimize' ) ?></h3>
<h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"
id="import"><?php esc_attr_e( 'Export/Import Options', 'adminimize' ); ?></h3>

<div class="inside">

<h4><?php esc_attr_e( 'Export', 'adminimize' ) ?></h4>
<p><?php esc_attr_e(
'You can save a JSON formatted ".json" file with your settings.', 'adminimize'
) ?></p>
<h3><?php esc_attr_e( 'Export', 'adminimize' ); ?></h3>
<p><?php esc_attr_e( 'You can save a JSON formatted ".json" file with your settings.', 'adminimize' ); ?></p>
<label for="_mw_adminimize_choose_export" class="control-label">Export All Roles</label>
<input type="checkbox" id="adminimize-toggle" name="_mw_adminimize_choose_export" value="1" class="adminimize-checkbox" checked="checked">
<input type="checkbox" id="adminimize-toggle" name="_mw_adminimize_choose_export" value="1"
class="adminimize-checkbox" checked="checked">
<label for="adminimize-toggle" class="switch"></label>
<form method="post" id="adminimize-export">
<p><input type="hidden" name="_mw_adminimize_export" value="true" /></p>
<p><input type="hidden" name="_mw_adminimize_export" value="true"/></p>
<p>
<?php wp_nonce_field( 'mw_adminimize_export_nonce', 'mw_adminimize_export_nonce' ); ?>
<?php
$submit_text = esc_html__( 'Export &raquo;', 'adminimize' );
submit_button( $submit_text, 'primary', '_mw_adminimize_save', false ); ?>
submit_button( $submit_text, 'primary', '_mw_adminimize_save', false );
?>
</p>
</form>
<br class="clear" />
<br class="clear">
<form method="post" id="adminimize-export-role">
<p>
<label><?php esc_attr_e( 'Choose one or more roles :', 'adminimize' ); ?>
<select name="select_adminimize_roles[]" multiple id="mw_adminimize_export_select_roles" >
<?php
foreach ( $wp_roles->role_names as $role_name => $data ) : ?>
<option value="<?php echo $role_name; ?>"><?php echo $data; ?></option>
<?php endforeach; ?>
</select>
<label><?php esc_attr_e( 'Choose one or more roles:', 'adminimize' ); ?><br>
<select name="select_adminimize_roles[]" multiple id="mw_adminimize_export_select_roles">
<?php foreach ( $wp_roles->role_names as $role_name => $data ) : ?>
<option value="<?php echo $role_name; ?>"><?php echo $data; ?></option>
<?php endforeach; ?>
</select>
</label>
</p>
<p><input type="hidden" name="_mw_adminimize_export_role" value="true" /></p>
<p><input type="hidden" name="_mw_adminimize_export_role" value="true"/></p>
<p>
<?php wp_nonce_field( 'mw_adminimize_export_role_nonce', 'mw_adminimize_export_role_nonce' ); ?>
<?php
$submit_text = esc_html__( 'Export role(s) &raquo;', 'adminimize' );
submit_button( $submit_text, 'primary', '_mw_adminimize_save', false ); ?>
</p>
</form>
<br class="clear">

<?php /*
<form name="export_options" method="get" action="">
<p><?php esc_attr_e(
'You can save a JSON formatted ".json" file with your settings.', 'adminimize'
) ?></p>
<p>
<?php wp_nonce_field( 'mw_adminimize_export_nonce', 'mw_adminimize_export_nonce' ); ?>
<input type="hidden" name="_mw_adminimize_export" value="true" />
<?php
$submit_text = esc_html__( 'Export &raquo;', 'adminimize' );
submit_button(
$text = $submit_text, $type = 'primary', $name = '_mw_adminimize_save', $wrap = FALSE,
$other_attributes = NULL
);
?>
</p>
</form>
*/ ?>
<h4><?php esc_attr_e( 'Import', 'adminimize' ) ?></h4>
<form name="import_options" enctype="multipart/form-data" method="post" action="?page=<?php echo esc_attr(
$_GET[ 'page' ]
); ?>">
<h3><?php esc_attr_e( 'Import', 'adminimize' ) ?></h3>
<form name="import_options" enctype="multipart/form-data" method="post"
action="?page=<?php echo esc_attr( $_GET['page'] ); ?>">
<?php wp_nonce_field( 'mw_adminimize_nonce' ); ?>
<p><?php _e(
'Choose a Adminimize (<em>.json</em>) file to upload, then click <em>Upload file and import</em>.',
Expand All @@ -91,28 +72,27 @@
'Choose a ".json" file from your computer:', 'adminimize'
) ?>
</label>
<input name="import_file" id="datei_id" type="file" />
<input name="import_file" id="datei_id" type="file"/>
</p>

<p>
<?php wp_nonce_field( 'mw_adminimize_import_nonce', 'mw_adminimize_import_nonce' ); ?>
<input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_import" />
<input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_import"/>
<?php
$submit_text = esc_html__( 'Upload file and import &raquo;', 'adminimize' );
submit_button(
$text = $submit_text, $type = 'primary', $name = '_mw_adminimize_save', $wrap = FALSE,
$other_attributes = NULL
$text = $submit_text, $type = 'primary', $name = '_mw_adminimize_save', $wrap = false,
$other_attributes = null
);
?>
</p>
</form>

<p>
<a class="alignright button adminimize-scroltop" href="#" style="margin:3px 0 0 30px;">
<?php esc_html_e(
'scroll to top', 'adminimize'
); ?>
</a><br class="clear" />
<a class="alignright button adminimize-scroltop" href="#" style="margin:3px 0 0 30px;">
<?php esc_html_e( 'scroll to top', 'adminimize' ); ?>
</a>
<br class="clear"/>
</p>

</div>
Expand Down
9 changes: 9 additions & 0 deletions inc-options/widget_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
exit;
}

if ( ! isset( $user_roles ) ) {
$user_roles = _mw_adminimize_get_all_user_roles();
}

if ( ! isset( $user_roles_names ) ) {
$user_roles_names = _mw_adminimize_get_all_user_roles_names();
}
?>

<div id="poststuff" class="ui-sortable meta-box-sortables">
<div class="postbox">
<h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="widget_options"><?php esc_attr_e( 'Widgets', 'adminimize' ); ?></h3>
Expand Down
2 changes: 1 addition & 1 deletion inc-options/write_cp_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
echo ' - ' . $post_type_object->label ?></th>
<?php
foreach ( (array) $user_roles_names as $role_name ) {
echo '<th>' . esc_attr_e( 'Deactivate for', 'adminimize' )
echo '<th>' . esc_attr__( 'Deactivate for', 'adminimize' )
. '<br/>' . esc_attr( $role_name ) . '</th>';
} ?>
</tr>
Expand Down
12 changes: 11 additions & 1 deletion inc-options/write_page_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@
echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
exit;
}

if ( ! isset( $user_roles ) ) {
$user_roles = _mw_adminimize_get_all_user_roles();
}

if ( ! isset( $user_roles_names ) ) {
$user_roles_names = _mw_adminimize_get_all_user_roles_names();
}
?>

<div id="poststuff" class="ui-sortable meta-box-sortables">
<div class="postbox">
<h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="config_edit_page"><?php esc_attr_e( 'Write options - Page', 'adminimize' ); ?></h3>
Expand All @@ -29,8 +38,9 @@
<tr>
<th><?php esc_attr_e( 'Write options - Page', 'adminimize' ); ?></th>
<?php

foreach ( (array) $user_roles_names as $role_name ) {
echo '<th>' . esc_attr_e( 'Deactivate for', 'adminimize' )
echo '<th>' . esc_attr__( 'Deactivate for', 'adminimize' )
. '<br />' . esc_attr( $role_name ) . '</th>';
} ?>
</tr>
Expand Down
13 changes: 10 additions & 3 deletions inc-options/write_post_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
exit;
}

if ( ! isset( $user_roles ) ) {
$user_roles = _mw_adminimize_get_all_user_roles();
}

if ( ! isset( $user_roles_names ) ) {
$user_roles_names = _mw_adminimize_get_all_user_roles_names();
}
?>

<div id="poststuff" class="ui-sortable meta-box-sortables">
Expand All @@ -33,16 +41,15 @@
<th><?php esc_attr_e( 'Write options - Post', 'adminimize' ); ?></th>
<?php
foreach ( (array) $user_roles_names as $role_name ) { ?>
<th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
echo '<br/>' . $role_name; ?></th>
<th><?php esc_attr_e( 'Deactivate for', 'adminimize' ); echo '<br/>' . $role_name; ?></th>
<?php } ?>
</tr>
<tr>
<td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
<?php
foreach ( (array) $user_roles as $role_slug ) {
echo '<td class="num"><input id="select_all" class="write_post_options_'
. esc_attr( $role_slug ) . '" type="checkbox" name="" value="" /></td>' . "\n";
. esc_attr( $role_slug ) . '" type="checkbox" name="" value="" /></td>' . "\n";
} ?>
</tr>
</thead>
Expand Down
10 changes: 8 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: Bueltge, inpsyde
Donate link: https://www.paypal.me/FrankBueltge
Tags: color, scheme, theme, admin, dashboard, color scheme, plugin, interface, ui, metabox, hide, editor, minimal, menu, customization, interface, administration, lite, light, usability, lightweight, layout, zen
Requires at least: 4.0
Tested up to: 5.3
Stable tag: 1.11.6
Tested up to: 5.5
Stable tag: 1.11.7

Adminimize that lets you hide 'unnecessary' items from the WordPress backend

Expand Down Expand Up @@ -40,6 +40,12 @@ Use the installer via back-end of your install or ...
4. Administrator can go to `Settings` > `Adminimize` menu and configure the plugin (Menu, Sub-menu, Meta boxes, ...)

== Changelog ==
= 1.11.7 (2020-07-15) =
* Add Im-/Export possibility only for different roles, Probs @JulietNoth, #139
* Fix problems with plugins in menus, like WooCommerce, #130
* Fix UI topics on settings page
* Fix simple PHP warnings

= 1.11.6 (2019-12-23) =
* Fixed to allow br, a, strong, em on admin footer hint.
* Add new filter hook to change the options, like more or less options. `mw_adminimize_options_before_update`, Probs @g-kanoufi
Expand Down

0 comments on commit 9467368

Please sign in to comment.