PluginProbe ʕ •ᴥ•ʔ
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus / 1.9
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus v1.9
2.45.0 2.44.0 trunk 1.10 1.10.1 1.4.1 1.4.10 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.7 1.5.8 1.5.9 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.8.1 1.9 1.9.10 1.9.12 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.9 2.0 2.0.2 2.0.3 2.1 2.1.1 2.10.0 2.10.1 2.10.2 2.10.3 2.11.1 2.12.1 2.12.2 2.13.0 2.14.0 2.15.0 2.16.0 2.17.0 2.18.0 2.18.2 2.19.0 2.19.1 2.19.2 2.2 2.2.1 2.20.0 2.21.0 2.22.0 2.23.0 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.30.0 2.31.0 2.32.0 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.40.0 2.41.0 2.42.0 2.43.0 2.5.0 2.5.1 2.5.2 2.6.0 2.6.1 2.7.0 2.7.1 2.8.0 2.8.1 2.9.0 2.9.1
capability-manager-enhanced / includes / backup.php
capability-manager-enhanced / includes Last commit date
admin.php 6 years ago backup-handler.php 7 years ago backup.php 6 years ago cap-helper.php 6 years ago filters-admin.php 6 years ago filters-woocommerce.php 7 years ago filters-wp_rest_workarounds.php 6 years ago filters.php 6 years ago functions-admin.php 6 years ago functions.php 6 years ago handler.php 6 years ago inflect-cme.php 7 years ago manager.php 6 years ago network.php 6 years ago pp-handler.php 6 years ago pp-ui.php 6 years ago publishpress-roles.php 6 years ago
backup.php
162 lines
1 <?php
2 /**
3 * Capability Manager Backup Tool.
4 * Provides backup and restore functionality to Capability Manager.
5 *
6 * @version $Rev: 198515 $
7 * @author Jordi Canals
8 * @copyright Copyright (C) 2009, 2010 Jordi Canals
9 * @license GNU General Public License version 2
10 * @link http://alkivia.org
11 * @package Alkivia
12 * @subpackage CapsMan
13 *
14 *
15 * Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
16 *
17 * Modifications Copyright 2020, PublishPress <help@publishpress.com>
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * version 2 as published by the Free Software Foundation.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
30 */
31
32 ?>
33
34 <div class="wrap publishpress-caps-manage pressshack-admin-wrapper">
35 <div id="icon-capsman-admin" class="icon32"></div>
36 <h2><?php printf( __('Backup Tool for %1$sPublishPress Capabilities%2$s', 'capsman-enhanced'), '<a href="admin.php?page=capsman">', '</a>' );?></h2>
37
38 <form method="post" action="admin.php?page=<?php echo $this->ID ?>-tool">
39 <?php wp_nonce_field('capsman-backup-tool'); ?>
40 <fieldset>
41 <table id="akmin">
42 <tr>
43 <td class="content">
44 <dl>
45 <dt><?php _e('Backup and Restore', 'capsman-enhanced'); ?></dt>
46 <dd>
47 <table width='100%' class="form-table">
48 <tr>
49 <th scope="row"><?php _e('Select action:', 'capsman-enhanced'); ?></th>
50 <td>
51 <select name="action">
52 <option value="backup"> <?php _e('Backup roles and capabilities', 'capsman-enhanced'); ?> </option>
53
54 <?php
55 if ( $initial = get_option( 'capsman_backup_initial' ) ):?>
56 <option value="restore_initial"> <?php _e('Restore initial backup', 'capsman-enhanced'); ?> </option>
57 <?php endif;?>
58
59 <option value="restore"> <?php _e('Restore last saved backup', 'capsman-enhanced'); ?> </option>
60 </select> &nbsp;
61 <input type="submit" name="Perform" value="<?php _e('Do Action', 'capsman-enhanced') ?>" class="button-primary" />
62 </td>
63 </tr>
64 </table>
65 </dd>
66
67 <p>&nbsp;
68 <?php if( ! empty( $initial ) ):?>
69 <a id="cme_show_initial" href="javascript:void(0)"><?php _e('Show initial backup', 'capsman-enhanced');?></a> &nbsp;&bull;&nbsp;
70 <?php endif;?>
71 <a id="cme_show_last" href="javascript:void(0)"><?php _e('Show last backup', 'capsman-enhanced');?></a>
72 </p>
73
74 <script type="text/javascript">
75 /* <![CDATA[ */
76 jQuery(document).ready( function($) {
77 $( '#cme_show_initial').click( function() {
78 $('#cme_display_capsman_backup_initial').show();
79 $('#cme_display_capsman_backup').hide();
80 });
81 $( '#cme_show_last').click( function() {
82 $('#cme_display_capsman_backup_initial').hide();
83 $('#cme_display_capsman_backup').show();
84 });
85 });
86 /* ]]> */
87 </script>
88
89 <?php
90 global $wp_roles;
91
92 $initial_caption = ( $backup_datestamp = get_option( 'capsman_backup_initial_datestamp' ) ) ? sprintf( __('Initial Backup - %s', 'capsman-enhanced'), date( 'j M Y, g:i a', $backup_datestamp ) ) : __('Initial Backup', 'capsman-enhanced');
93 $last_caption = ( $backup_datestamp = get_option( 'capsman_backup_datestamp' ) ) ? sprintf( __('Last Backup - %s', 'capsman-enhanced'), date( 'j M Y, g:i a', $backup_datestamp ) ) : __('Last Backup', 'capsman-enhanced');
94
95 $backups = array(
96 'capsman_backup_initial' => $initial_caption,
97 'capsman_backup' => $last_caption,
98 );
99
100 foreach( $backups as $name => $caption ) {
101 if ( $backup_data = get_option( $name ) ) :?>
102 <div id="cme_display_<?php echo $name;?>" style="display:none;padding-left:20px;">
103 <h3><?php printf( __( "%s (%s roles)", 'capsman-enhanded' ), $caption, count($backup_data) ); ?></h3>
104
105 <?php foreach( $backup_data as $role => $props ) :?>
106 <?php if ( ! isset( $props['name'] ) ) continue;?>
107 <?php
108 $level = 0;
109 for( $i=10; $i>=0; $i--) {
110 if ( ! empty( $props['capabilities']["level_{$i}"] ) ) {
111 $level = $i;
112 break;
113 }
114 }
115 ?>
116 <?php
117 $role_caption = $props['name'];
118 if ( empty( $wp_roles->role_objects[$role] ) ) $role_caption = "<span class='cme-plus' style='color:green;font-weight:800'>$role_caption</span>";?>
119 <h4><?php printf( __( '%s (level %s)', 'capsman-enhanced' ), translate_user_role($role_caption), $level );?></h4>
120 <ul style="list-style:disc;padding-left:30px">
121
122 <?php
123 ksort( $props['capabilities'] );
124 foreach( $props['capabilities'] as $cap_name => $val ) :
125 if ( 0 === strpos( $cap_name, 'level_' ) ) continue;
126 ?>
127 <?php if ( $val && ( empty( $wp_roles->role_objects[$role] ) || empty( $wp_roles->role_objects[$role]->capabilities[$cap_name] ) ) ) $cap_name = "<span class='cme-plus' style='color:green;font-weight:800'>$cap_name</span>";?>
128 <li><?php echo ( $val ) ? $cap_name : "<strike>$cap_name</strike>";?></li>
129 <?php endforeach;?>
130
131 </ul>
132 <?php endforeach;?>
133 </div>
134 <?php endif;
135 }
136 ?>
137 </dl>
138
139 <dl>
140 <dt><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reset WordPress Defaults', 'capsman-enhanced'); else echo 'Reset Roles to WordPress Defaults';?></dt>
141 <dd>
142 <p style="text-align:center;"><strong><span style="color:red;"><?php _e('WARNING:', 'capsman-enhanced'); ?></span> <?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reseting default Roles and Capabilities will set them to the WordPress install defaults.', 'capsman-enhanced'); else echo 'This will delete and/or modify stored role definitions.'; ?></strong><br />
143 <br />
144 <?php
145 _e('If you have installed any plugin that adds new roles or capabilities, these will be lost.', 'capsman-enhanced')?><br />
146 <strong><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('It is recommended to use this only as a last resource!'); else echo('It is recommended to use this only as a last resort!');?></strong></p>
147 <p style="text-align:center;"><a class="ak-delete" title="<?php echo esc_attr(__('Reset Roles and Capabilities to WordPress defaults', 'capsman-enhanced')) ?>" href="<?php echo wp_nonce_url("admin.php?page={$this->ID}-tool&amp;action=reset-defaults", 'capsman-reset-defaults'); ?>" onclick="if ( confirm('<?php echo esc_js(__("You are about to reset Roles and Capabilities to WordPress defaults.\n 'Cancel' to stop, 'OK' to reset.", 'capsman-enhanced')); ?>') ) { return true;}return false;"><?php _e('Reset to WordPress defaults', 'capsman-enhanced')?></a>
148
149 </dd>
150 </dl>
151
152 </td>
153 </tr>
154 </table>
155 </fieldset>
156 </form>
157
158 <?php if (!defined('PUBLISHPRESS_CAPS_PRO_VERSION') || get_option('cme_display_branding')) {
159 cme_publishpressFooter();
160 }
161 ?>
162 </div>