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 / manager.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
manager.php
664 lines
1 <?php
2 /**
3 * Capability Manager.
4 * Plugin to create and manage roles and capabilities.
5 *
6 * @author Jordi Canals, Kevin Behrens
7 * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2020 PublishPress
8 * @license GNU General Public License version 2
9 * @link https://publishpress.com/
10 *
11 *
12 * Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13 *
14 * Modifications Copyright 2020, PublishPress <help@publishpress.com>
15 *
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * version 2 as published by the Free Software Foundation.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29 add_action( 'init', 'cme_update_pp_usage' ); // update early so resulting post type cap changes are applied for this request's UI construction
30
31 function cme_update_pp_usage() {
32 if ( ! empty($_REQUEST['update_filtered_types']) || ! empty($_REQUEST['update_filtered_taxonomies']) || ! empty($_REQUEST['update_detailed_taxonomies']) || ! empty($_REQUEST['SaveRole']) ) {
33 require_once( dirname(__FILE__).'/pp-handler.php' );
34 return _cme_update_pp_usage();
35 }
36 }
37
38 // Core WP roles to apply safeguard preventing accidental lockout from dashboard
39 function _cme_core_roles() {
40 return apply_filters( 'pp_caps_core_roles', array( 'administrator', 'editor', 'revisor', 'author', 'contributor', 'subscriber' ) );
41 }
42
43 function _cme_core_caps() {
44 $core_caps = array_fill_keys( array( 'switch_themes', 'edit_themes', 'activate_plugins', 'edit_plugins', 'edit_users', 'edit_files', 'manage_options', 'moderate_comments',
45 'manage_links', 'upload_files', 'import', 'unfiltered_html', 'read', 'delete_users', 'create_users', 'unfiltered_upload', 'edit_dashboard',
46 'update_plugins', 'delete_plugins', 'install_plugins', 'update_themes', 'install_themes',
47 'update_core', 'list_users', 'remove_users', 'promote_users', 'edit_theme_options', 'delete_themes', 'export' ), true );
48
49 ksort( $core_caps );
50 return $core_caps;
51 }
52
53 function _cme_is_read_removal_blocked( $role_name ) {
54 $role = get_role($role_name);
55 $rcaps = $role->capabilities;
56
57 $core_caps = array_diff_key( _cme_core_caps(), array_fill_keys( array( 'unfiltered_html', 'unfiltered_upload', 'upload_files', 'edit_files', 'read' ), true ) );
58
59 if ( empty( $rcaps['dashboard_lockout_ok'] ) ) {
60 $edit_caps = array();
61 foreach ( get_post_types( array( 'public' => true ), 'object' ) as $type_obj ) {
62 $edit_caps = array_merge( $edit_caps, array_values( array_diff_key( (array) $type_obj->cap, array( 'read_private_posts' => true ) ) ) );
63 }
64
65 $edit_caps = array_fill_keys( $edit_caps, true );
66 unset( $edit_caps['read'] );
67 unset( $edit_caps['upload_files'] );
68 unset( $edit_caps['edit_files'] );
69
70 if ( $role_has_admin_caps = in_array( $role_name, _cme_core_roles() ) && ( array_intersect_key( $rcaps, array_diff_key( $core_caps, array( 'read' => true ) ) ) || array_intersect_key( $rcaps, $edit_caps ) ) ) {
71 return true;
72 }
73 }
74
75 return false;
76 }
77
78 /**
79 * Class CapabilityManager.
80 * Sets the main environment for all Capability Manager components.
81 *
82 * @author Jordi Canals, Kevin Behrens
83 * @link https://publishpress.com/
84 */
85 class CapabilityManager
86 {
87 /**
88 * Array with all capabilities to be managed. (Depends on user caps).
89 * The array keys are the capability, the value is its screen name.
90 * @var array
91 */
92 var $capabilities = array();
93
94 /**
95 * Array with roles that can be managed. (Depends on user roles).
96 * The array keys are the role name, the value is its translated name.
97 * @var array
98 */
99 var $roles = array();
100
101 /**
102 * Current role we are managing
103 * @var string
104 */
105 var $current;
106
107 /**
108 * Maximum level current manager can assign to a user.
109 * @var int
110 */
111 private $max_level;
112
113 private $log_db_role_objects = array();
114
115 var $message;
116
117 /**
118 * Module ID. Is the module internal short name.
119 *
120 * @var string
121 */
122 public $ID;
123
124 public function __construct()
125 {
126 $this->ID = 'capsman';
127 $this->mod_url = plugins_url( '', CME_FILE );
128
129 $this->moduleLoad();
130
131 add_action('admin_menu', array($this, 'adminMenus'), 5); // execute prior to PP, to use menu hook
132
133 // Load styles
134 add_action('admin_print_styles', array($this, 'adminStyles'));
135
136 if ( isset($_REQUEST['page']) && ( 'capsman' == $_REQUEST['page'] ) ) {
137 add_action('admin_enqueue_scripts', array($this, 'adminScriptsPP'));
138 }
139 }
140
141 /**
142 * Enqueues administration styles.
143 *
144 * @hook action 'admin_print_styles'
145 *
146 * @return void
147 */
148 function adminStyles()
149 {
150 if ( empty( $_REQUEST['page'] ) || ! in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) ) )
151 return;
152
153 wp_enqueue_style('cme-admin-common', $this->mod_url . '/common/css/pressshack-admin.css', [], PUBLISHPRESS_CAPS_VERSION);
154
155 wp_register_style( $this->ID . 'framework_admin', $this->mod_url . '/framework/styles/admin.css', false, PUBLISHPRESS_CAPS_VERSION);
156 wp_enqueue_style( $this->ID . 'framework_admin');
157
158 wp_register_style( $this->ID . '_admin', $this->mod_url . '/admin.css', false, PUBLISHPRESS_CAPS_VERSION);
159 wp_enqueue_style( $this->ID . '_admin');
160
161 $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
162 $url = $this->mod_url . "/admin{$suffix}.js";
163 wp_enqueue_script( 'cme_admin', $url, array('jquery'), PUBLISHPRESS_CAPS_VERSION, true );
164 wp_localize_script( 'cme_admin', 'cmeAdmin', array(
165 'negationCaption' => __( 'Explicity negate this capability by storing as disabled', 'capsman-enhanced' ),
166 'typeCapsNegationCaption' => __( 'Explicitly negate these capabilities by storing as disabled', 'capsman-enhanced' ),
167 'typeCapUnregistered' => __( 'Post type registration does not define this capability distinctly', 'capsman-enhanced' ),
168 'capNegated' => __( 'This capability is explicitly negated. Click to add/remove normally.', 'capsman-enhanced' ),
169 'chkCaption' => __( 'Add or remove this capability from the WordPress role', 'capsman-enhanced' ),
170 'switchableCaption' => __( 'Add or remove capability from the role normally', 'capsman-enhanced' ) )
171 );
172 }
173
174 function adminScriptsPP() {
175 wp_enqueue_style( 'plugin-install' );
176 wp_enqueue_script( 'plugin-install' );
177 add_thickbox();
178 }
179
180 /**
181 * Creates some filters at module load time.
182 *
183 * @return void
184 */
185 protected function moduleLoad ()
186 {
187 $old_version = get_option($this->ID . '_version');
188 if ( version_compare( $old_version, PUBLISHPRESS_CAPS_VERSION, 'ne') ) {
189 update_option($this->ID . '_version', PUBLISHPRESS_CAPS_VERSION);
190 $this->pluginUpdate();
191 }
192
193 // Only roles that a user can administer can be assigned to others.
194 add_filter('editable_roles', array($this, 'filterEditRoles'));
195
196 // Users with roles that cannot be managed, are not allowed to be edited.
197 add_filter('map_meta_cap', array(&$this, 'filterUserEdit'), 10, 4);
198
199 // ensure storage, retrieval of db-stored customizations to dynamic roles
200 if ( isset($_REQUEST['page']) && in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) ) ) {
201 global $wpdb;
202 $role_key = $wpdb->prefix . 'user_roles';
203 $this->log_db_roles();
204 add_filter( 'option_' . $role_key, array( &$this, 'reinstate_db_roles' ), PHP_INT_MAX );
205 }
206
207 add_filter( 'plugins_loaded', array( &$this, 'processRoleUpdate' ) );
208 }
209
210 // Direct query of stored role definitions
211 function log_db_roles( $legacy_arg = '' ) {
212 global $wpdb;
213
214 $results = (array) maybe_unserialize( $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '{$wpdb->prefix}user_roles' LIMIT 1") );
215 foreach( $results as $_role_name => $_role ) {
216 $this->log_db_role_objects[$_role_name] = (object) $_role;
217 }
218
219 return $legacy_arg;
220 }
221
222 // note: this is only applied when accessing the cme role edit form
223 function reinstate_db_roles( $passthru_roles = array() ) {
224 global $wp_roles;
225
226 if ( isset($wp_roles) && $this->log_db_role_objects ) {
227 $intersect = array_intersect_key( $wp_roles->role_objects, $this->log_db_role_objects );
228 foreach( array_keys( $intersect ) as $key ) {
229 if ( ! empty( $this->log_db_role_objects[$key]->capabilities ) )
230 $wp_roles->role_objects[$key]->capabilities = $this->log_db_role_objects[$key]->capabilities;
231 }
232 }
233
234 return $passthru_roles;
235 }
236
237 /**
238 * Updates Capability Manager to a new version
239 *
240 * @return void
241 */
242 protected function pluginUpdate ()
243 {
244 $backup = get_option($this->ID . '_backup');
245 if ( false === $backup ) { // No previous backup found. Save it!
246 global $wpdb;
247 $roles = get_option($wpdb->prefix . 'user_roles');
248 update_option( $this->ID . '_backup', $roles, false );
249 update_option( $this->ID . '_backup_datestamp', current_time( 'timestamp' ), false );
250 }
251 }
252
253 /**
254 * Adds admin panel menus. (At plugins loading time. This is before plugins_loaded).
255 * User needs to have 'manage_capabilities' to access this menus.
256 * This is set as an action in the parent class constructor.
257 *
258 * @hook action admin_menu
259 * @return void
260 */
261 public function adminMenus ()
262 {
263 // First we check if user is administrator and can 'manage_capabilities'.
264 if ( current_user_can('administrator') && ! current_user_can('manage_capabilities') ) {
265 $this->setAdminCapability();
266 }
267
268 add_action( 'admin_menu', array( &$this, 'cme_menu' ), 18 );
269 }
270
271 public function cme_menu() {
272 $cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
273
274 $permissions_title = __('Capabilities', 'capsman-enhanced');
275
276 $menu_order = 72;
277
278 if (defined('PUBLISHPRESS_PERMISSIONS_MENU_GROUPING')) {
279 foreach (get_option('active_plugins') as $plugin_file) {
280 if ( false !== strpos($plugin_file, 'publishpress.php') ) {
281 $menu_order = 27;
282 }
283 }
284 }
285
286 add_menu_page(
287 $permissions_title,
288 $permissions_title,
289 $cap_name,
290 'capsman',
291 array($this, 'generalManager'),
292 'dashicons-admin-network',
293 $menu_order
294 );
295
296 add_submenu_page('capsman', __('Backup', 'capsman-enhanced'), __('Backup', 'capsman-enhanced'), $cap_name, $this->ID . '-tool', array($this, 'backupTool'));
297 }
298
299 /**
300 * Sets the 'manage_capabilities' cap to the administrator role.
301 *
302 * @return void
303 */
304 public function setAdminCapability ()
305 {
306 $admin = get_role('administrator');
307 $admin->add_cap('manage_capabilities');
308 }
309
310 /**
311 * Filters roles that can be shown in roles list.
312 * This is mainly used to prevent an user admin to create other users with
313 * higher capabilities.
314 *
315 * @hook 'editable_roles' filter.
316 *
317 * @param $roles List of roles to check.
318 * @return array Restircted roles list
319 */
320 function filterEditRoles ( $roles )
321 {
322 $this->generateNames();
323 $valid = array_keys($this->roles);
324
325 foreach ( $roles as $role => $caps ) {
326 if ( ! in_array($role, $valid) ) {
327 unset($roles[$role]);
328 }
329 }
330
331 return $roles;
332 }
333
334 /**
335 * Checks if a user can be edited or not by current administrator.
336 * Returns array('do_not_allow') if user cannot be edited.
337 *
338 * @hook 'map_meta_cap' filter
339 *
340 * @param array $caps Current user capabilities
341 * @param string $cap Capability to check
342 * @param int $user_id Current user ID
343 * @param array $args For our purpose, we receive edited user id at $args[0]
344 * @return array Allowed capabilities.
345 */
346 function filterUserEdit ( $caps, $cap, $user_id, $args )
347 {
348 if ( ! in_array( $cap, array( 'edit_user', 'delete_user', 'promote_user', 'remove_user' ) ) || ( ! isset($args[0]) ) || $user_id == (int) $args[0] ) {
349 return $caps;
350 }
351
352 $user = new WP_User( (int) $args[0] );
353
354 $this->generateNames();
355
356 if ( defined( 'CME_LEGACY_USER_EDIT_FILTER' ) && CME_LEGACY_USER_EDIT_FILTER ) {
357 $valid = array_keys($this->roles);
358
359 foreach ( $user->roles as $role ) {
360 if ( ! in_array($role, $valid) ) {
361 $caps = array('do_not_allow');
362 break;
363 }
364 }
365 } else {
366 global $wp_roles;
367
368 foreach ( $user->roles as $role ) {
369 $r = get_role( $role );
370 $level = ak_caps2level($r->capabilities);
371
372 if ( ( ! $level ) && ( 'administrator' == $role ) )
373 $level = 10;
374
375 if ( $level > $this->max_level ) {
376 $caps = array('do_not_allow');
377 break;
378 }
379 }
380
381 }
382
383 return $caps;
384 }
385
386 function processRoleUpdate() {
387 if ( 'POST' == $_SERVER['REQUEST_METHOD'] && ( ! empty($_REQUEST['SaveRole']) || ! empty($_REQUEST['AddCap']) ) ) {
388 if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
389 // TODO: Implement exceptions.
390 wp_die('<strong>' .__('What do you think you\'re doing?!?', 'capsman-enhanced') . '</strong>');
391 }
392
393 if ( ! empty($_REQUEST['current']) ) { // don't process role update unless form variable is received
394 check_admin_referer('capsman-general-manager');
395
396 $role = get_role($_REQUEST['current']);
397 $current_level = ($role) ? ak_caps2level($role->capabilities) : 0;
398
399 $this->processAdminGeneral();
400
401 $set_level = (isset($_POST['level'])) ? $_POST['level'] : 0;
402
403 if ($set_level != $current_level) {
404 global $wp_roles, $wp_version;
405
406 if ( version_compare($wp_version, '4.9', '>=') ) {
407 $wp_roles->for_site();
408 } else {
409 $wp_roles->reinit();
410 }
411
412 foreach( get_users(array('role' => $_REQUEST['current'], 'fields' => 'ID')) as $ID ) {
413 $user = new WP_User($ID);
414 $user->get_role_caps();
415 $user->update_user_level_from_caps();
416 }
417 }
418 }
419 }
420 }
421
422 /**
423 * Manages global settings admin.
424 *
425 * @hook add_submenu_page
426 * @return void
427 */
428 function generalManager () {
429 if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
430 // TODO: Implement exceptions.
431 wp_die('<strong>' .__('What do you think you\'re doing?!?', 'capsman-enhanced') . '</strong>');
432 }
433
434 if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
435 if ( empty($_REQUEST['SaveRole']) && empty($_REQUEST['AddCap']) ) {
436 check_admin_referer('capsman-general-manager');
437 $this->processAdminGeneral();
438 } elseif ( ! empty($_REQUEST['SaveRole']) ) {
439 ak_admin_notify( $this->message ); // moved update operation to earlier action to avoid UI refresh issues. But outputting notification there breaks styling.
440 } elseif ( ! empty($_REQUEST['AddCap']) ) {
441 ak_admin_notify( $this->message );
442 }
443 } else {
444 if (!empty($_REQUEST['added'])) {
445 ak_admin_notify(__('New capability added to role.'));
446 }
447 }
448
449 $this->generateNames();
450 $roles = array_keys($this->roles);
451
452 if ( isset($_GET['action']) && 'delete' == $_GET['action']) {
453 require_once( dirname(__FILE__).'/handler.php' );
454 $capsman_modify = new CapsmanHandler( $this );
455 $capsman_modify->adminDeleteRole();
456 }
457
458 if ( ! isset($this->current) ) { // By default, we manage the default role
459 if (empty($_POST) && !empty($_REQUEST['role'])) {
460 $this->current = $_REQUEST['role'];
461 }
462 }
463
464 if (!isset($this->current) || !get_role($this->current)) {
465 $this->current = get_option('default_role');
466 }
467
468 if ( ! in_array($this->current, $roles) ) { // Current role has been deleted.
469 $this->current = array_shift($roles);
470 }
471
472 include ( dirname(CME_FILE) . '/includes/admin.php' );
473 }
474
475 /**
476 * Processes and saves the changes in the general capabilities form.
477 *
478 * @return void
479 */
480 private function processAdminGeneral ()
481 {
482 if (! isset($_POST['action']) || 'update' != $_POST['action'] ) {
483 // TODO: Implement exceptions. This must be a fatal error.
484 ak_admin_error(__('Bad form Received', 'capsman-enhanced'));
485 return;
486 }
487
488 $post = stripslashes_deep($_POST);
489 if ( empty ($post['caps']) ) {
490 $post['caps'] = array();
491 }
492
493 $this->current = $post['current'];
494
495 // Select a new role.
496 if ( ! empty($post['LoadRole']) ) {
497 $this->current = $post['role'];
498 } else {
499 require_once( dirname(__FILE__).'/handler.php' );
500 $capsman_modify = new CapsmanHandler( $this );
501 $capsman_modify->processAdminGeneral( $post );
502 }
503 }
504
505 /**
506 * Callback function to create names.
507 * Replaces underscores by spaces and uppercases the first letter.
508 *
509 * @access private
510 * @param string $cap Capability name.
511 * @return string The generated name.
512 */
513 function _capNamesCB ( $cap )
514 {
515 $cap = str_replace('_', ' ', $cap);
516 //$cap = ucfirst($cap);
517
518 return $cap;
519 }
520
521 /**
522 * Generates an array with the system capability names.
523 * The key is the capability and the value the created screen name.
524 *
525 * @uses self::_capNamesCB()
526 * @return void
527 */
528 function generateSysNames ()
529 {
530 $this->max_level = 10;
531 $this->roles = ak_get_roles(true);
532 $caps = array();
533
534 foreach ( array_keys($this->roles) as $role ) {
535 $role_caps = get_role($role);
536 $caps = array_merge( $caps, (array) $role_caps->capabilities ); // user reported PHP 5.3.3 error without array cast
537 }
538
539 $keys = array_keys($caps);
540 $names = array_map(array($this, '_capNamesCB'), $keys);
541 $this->capabilities = array_combine($keys, $names);
542
543 asort($this->capabilities);
544 }
545
546 /**
547 * Generates an array with the user capability names.
548 * If user has 'administrator' role, system roles are generated.
549 * The key is the capability and the value the created screen name.
550 * A user cannot manage more capabilities that has himself (Except for administrators).
551 *
552 * @uses self::_capNamesCB()
553 * @return void
554 */
555 function generateNames ()
556 {
557 if ( current_user_can('administrator') || ( is_multisite() && is_super_admin() ) ) {
558 $this->generateSysNames();
559 } else {
560 global $user_ID;
561 $user = new WP_User($user_ID);
562 $this->max_level = ak_caps2level($user->allcaps);
563
564 $keys = array_keys($user->allcaps);
565 $names = array_map(array($this, '_capNamesCB'), $keys);
566
567 $this->capabilities = ( $keys ) ? array_combine($keys, $names) : array();
568
569 $roles = ak_get_roles(true);
570 unset($roles['administrator']);
571
572 if ( ( defined( 'CME_LEGACY_USER_EDIT_FILTER' ) && CME_LEGACY_USER_EDIT_FILTER ) || ( ! empty( $_REQUEST['page'] ) && 'capsman' == $_REQUEST['page'] ) ) {
573 foreach ( $user->roles as $role ) { // Unset the roles from capability list.
574 unset ( $this->capabilities[$role] );
575 unset ( $roles[$role]); // User cannot manage his roles.
576 }
577 }
578
579 asort($this->capabilities);
580
581 foreach ( array_keys($roles) as $role ) {
582 $r = get_role($role);
583 $level = ak_caps2level($r->capabilities);
584
585 if ( $level > $this->max_level ) {
586 unset($roles[$role]);
587 }
588 }
589
590 $this->roles = $roles;
591 }
592 }
593
594 /**
595 * Manages backup, restore and resset roles and capabilities
596 *
597 * @hook add_management_page
598 * @return void
599 */
600 function backupTool ()
601 {
602 if ( ! current_user_can('restore_roles') && ! is_super_admin() ) {
603 // TODO: Implement exceptions.
604 wp_die('<strong>' .__('What do you think you\'re doing?!?', 'capsman-enhanced') . '</strong>');
605 }
606
607 if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
608 require_once( dirname(__FILE__).'/backup-handler.php' );
609 $cme_backup_handler = new Capsman_BackupHandler( $this );
610 $cme_backup_handler->processBackupTool();
611 }
612
613 if ( isset($_GET['action']) && 'reset-defaults' == $_GET['action']) {
614 require_once( dirname(__FILE__).'/backup-handler.php' );
615 $cme_backup_handler = new Capsman_BackupHandler( $this );
616 $cme_backup_handler->backupToolReset();
617 }
618
619 include ( dirname(CME_FILE) . '/includes/backup.php' );
620 }
621 }
622
623 function cme_publishpressFooter() {
624 ?>
625 <footer>
626
627 <div class="pp-rating">
628 <a href="https://wordpress.org/support/plugin/capability-manager-enhanced/reviews/#new-post" target="_blank" rel="noopener noreferrer">
629 <?php printf(
630 __('If you like %s, please leave us a %s rating. Thank you!', 'capsman-enhanced'),
631 '<strong>PublishPress Capabilities</strong>',
632 '<span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>'
633 );
634 ?>
635 </a>
636 </div>
637
638 <hr>
639 <nav>
640 <ul>
641 <li><a href="https://publishpress.com/capability-manager/" target="_blank" rel="noopener noreferrer" title="<?php _e('About PublishPress Capabilities', 'capsman-enhanced');?>"><?php _e('About', 'capsman-enhanced');?>
642 </a></li>
643 <li><a href="https://publishpress.com/knowledge-base/how-to-use-capability-manager/" target="_blank" rel="noopener noreferrer" title="<?php _e('Capabilites Documentation', 'capsman-enhanced');?>"><?php _e('Documentation', 'capsman-enhanced');?>
644 </a></li>
645 <li><a href="https://publishpress.com/contact" target="_blank" rel="noopener noreferrer" title="<?php _e('Contact the PublishPress team', 'capsman-enhanced');?>"><?php _e('Contact', 'capsman-enhanced');?>
646 </a></li>
647 <li><a href="https://twitter.com/publishpresscom" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-twitter"></span>
648 </a></li>
649 <li><a href="https://facebook.com/publishpress" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-facebook"></span>
650 </a></li>
651 </ul>
652 </nav>
653
654 <div class="pp-pressshack-logo">
655 <a href="https://publishpress.com" target="_blank" rel="noopener noreferrer">
656
657 <img src="<?php echo plugins_url('', CME_FILE) . '/common/img/publishpress-logo.png';?>" />
658 </a>
659 </div>
660
661 </footer>
662 <?php
663 }
664