PluginProbe ʕ •ᴥ•ʔ
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus / 1.7
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus v1.7
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 7 years ago backup-handler.php 7 years ago backup.php 7 years ago cap-helper.php 7 years ago filters-woocommerce.php 7 years ago filters.php 7 years ago handler.php 7 years ago inflect-cme.php 7 years ago manager.php 7 years ago network.php 7 years ago pp-handler.php 7 years ago pp-ui.php 7 years ago
backup.php
155 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 This program is free software; you can redistribute it and/or
18 modify it under the terms of the GNU General Public License
19 version 2 as published by the Free Software Foundation.
20
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25
26 You should have received a copy of the GNU General Public License
27 along with this program. If not, see <http://www.gnu.org/licenses/>.
28 */
29
30 ?>
31 <div class="wrap">
32 <div id="icon-capsman-admin" class="icon32"></div>
33 <h2><?php printf( __('Backup Tool for %1$sCapability Manager%2$s', 'capsman-enhanced'), '<a href="admin.php?page=capsman">', '</a>' );?></h2>
34
35 <form method="post" action="tools.php?page=<?php echo $this->ID ?>-tool">
36 <?php wp_nonce_field('capsman-backup-tool'); ?>
37 <fieldset>
38 <table id="akmin">
39 <tr>
40 <td class="content">
41 <dl>
42 <dt><?php _e('Backup and Restore', 'capsman-enhanced'); ?></dt>
43 <dd>
44 <table width='100%' class="form-table">
45 <tr>
46 <th scope="row"><?php _e('Select action:', 'capsman-enhanced'); ?></th>
47 <td>
48 <select name="action">
49 <option value="backup"> <?php _e('Backup roles and capabilities', 'capsman-enhanced'); ?> </option>
50
51 <?php
52 if ( $initial = get_option( 'capsman_backup_initial' ) ):?>
53 <option value="restore_initial"> <?php _e('Restore initial backup', 'capsman-enhanced'); ?> </option>
54 <?php endif;?>
55
56 <option value="restore"> <?php _e('Restore last saved backup', 'capsman-enhanced'); ?> </option>
57 </select> &nbsp;
58 <input type="submit" name="Perform" value="<?php _e('Do Action', 'capsman-enhanced') ?>" class="button-primary" />
59 </td>
60 </tr>
61 </table>
62 </dd>
63
64 <p>&nbsp;
65 <?php if( ! empty( $initial ) ):?>
66 <a id="cme_show_initial" href="javascript:void(0)"><?php _e('Show initial backup', 'capsman-enhanced');?></a> &nbsp;&bull;&nbsp;
67 <?php endif;?>
68 <a id="cme_show_last" href="javascript:void(0)"><?php _e('Show last backup', 'capsman-enhanced');?></a>
69 </p>
70
71 <script type="text/javascript">
72 /* <![CDATA[ */
73 jQuery(document).ready( function($) {
74 $( '#cme_show_initial').click( function() {
75 $('#cme_display_capsman_backup_initial').show();
76 $('#cme_display_capsman_backup').hide();
77 });
78 $( '#cme_show_last').click( function() {
79 $('#cme_display_capsman_backup_initial').hide();
80 $('#cme_display_capsman_backup').show();
81 });
82 });
83 /* ]]> */
84 </script>
85
86 <?php
87 global $wp_roles;
88
89 $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');
90 $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');
91
92 $backups = array(
93 'capsman_backup_initial' => $initial_caption,
94 'capsman_backup' => $last_caption,
95 );
96
97 foreach( $backups as $name => $caption ) {
98 if ( $backup_data = get_option( $name ) ) :?>
99 <div id="cme_display_<?php echo $name;?>" style="display:none;padding-left:20px;">
100 <h3><?php printf( __( "%s (%s roles)", 'capsman-enhanded' ), $caption, count($backup_data) ); ?></h3>
101
102 <?php foreach( $backup_data as $role => $props ) :?>
103 <?php if ( ! isset( $props['name'] ) ) continue;?>
104 <?php
105 $level = 0;
106 for( $i=10; $i>=0; $i--) {
107 if ( ! empty( $props['capabilities']["level_{$i}"] ) ) {
108 $level = $i;
109 break;
110 }
111 }
112 ?>
113 <?php
114 $role_caption = $props['name'];
115 if ( empty( $wp_roles->role_objects[$role] ) ) $role_caption = "<span class='cme-plus' style='color:green;font-weight:800'>$role_caption</span>";?>
116 <h4><?php printf( __( '%s (level %s)', 'capsman-enhanced' ), $role_caption, $level );?></h4>
117 <ul style="list-style:disc;padding-left:30px">
118
119 <?php
120 ksort( $props['capabilities'] );
121 foreach( $props['capabilities'] as $cap_name => $val ) :
122 if ( 0 === strpos( $cap_name, 'level_' ) ) continue;
123 ?>
124 <?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>";?>
125 <li><?php echo ( $val ) ? $cap_name : "<strike>$cap_name</strike>";?></li>
126 <?php endforeach;?>
127
128 </ul>
129 <?php endforeach;?>
130 </div>
131 <?php endif;
132 }
133 ?>
134 </dl>
135
136 <dl>
137 <dt><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reset WordPress Defaults', 'capsman-enhanced'); else echo 'Reset Roles to WordPress Defaults';?></dt>
138 <dd>
139 <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 />
140 <br />
141 <?php
142 _e('If you have installed any plugin that adds new roles or capabilities, these will be lost.', 'capsman-enhanced')?><br />
143 <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>
144 <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("tools.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>
145
146 </dd>
147 </dl>
148
149 </td>
150 </tr>
151 </table>
152 </fieldset>
153 </form>
154 </div>
155