admin.php
7 years ago
backup-handler.php
7 years ago
backup.php
7 years ago
filters-woocommerce.php
7 years ago
filters.php
7 years ago
handler.php
7 years ago
manager.php
7 years ago
network.php
7 years ago
pp-handler.php
11 years ago
pp-ui.php
7 years ago
pp-handler.php
65 lines
| 1 | <?php |
| 2 | |
| 3 | function _cme_update_pp_usage() { |
| 4 | static $updated; |
| 5 | if ( ! empty($updated) ) { return true; } |
| 6 | |
| 7 | if ( ! current_user_can( 'pp_manage_settings' ) ) |
| 8 | return false; |
| 9 | |
| 10 | if ( ! empty( $_REQUEST['update_filtered_types']) ) { |
| 11 | // update Press Permit "Filtered Post Types". This determines whether type-specific capability definitions are forced |
| 12 | $options = array( 'enabled_post_types', 'enabled_taxonomies' ); |
| 13 | |
| 14 | foreach( $options as $option_basename ) { |
| 15 | if ( ! isset( $_POST["{$option_basename}-options"] ) ) |
| 16 | continue; |
| 17 | |
| 18 | $unselected = array(); |
| 19 | $value = array(); |
| 20 | |
| 21 | foreach( $_POST["{$option_basename}-options"] as $key ) { |
| 22 | if ( empty( $_POST["{$option_basename}-$key"] ) ) |
| 23 | $unselected[$key] = true; |
| 24 | else |
| 25 | $value[$key] = true; |
| 26 | } |
| 27 | |
| 28 | if ( $current = pp_get_option( $option_basename ) ) { |
| 29 | if ( $current = array_diff_key( $current, $unselected ) ) |
| 30 | $value = array_merge( $current, $value ); // retain setting for any types which were previously enabled for filtering but are currently not registered |
| 31 | } |
| 32 | |
| 33 | $value = stripslashes_deep($value); |
| 34 | pp_update_option( $option_basename, $value ); |
| 35 | |
| 36 | $updated = true; |
| 37 | } |
| 38 | |
| 39 | if ( pp_wp_ver( '3.5' ) ) { |
| 40 | pp_update_option( 'define_create_posts_cap', ! empty($_REQUEST['pp_define_create_posts_cap']) ); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | if ( ! empty( $_REQUEST['SaveRole']) ) { |
| 45 | if ( ! empty( $_REQUEST['role'] ) ) { |
| 46 | $pp_only = (array) pp_get_option( 'supplemental_role_defs' ); |
| 47 | |
| 48 | if ( empty($_REQUEST['pp_only_role']) ) |
| 49 | $pp_only = array_diff( $pp_only, array($_REQUEST['role']) ); |
| 50 | else |
| 51 | $pp_only[]= $_REQUEST['role']; |
| 52 | |
| 53 | pp_update_option( 'supplemental_role_defs', array_unique($pp_only) ); |
| 54 | _cme_pp_default_pattern_role( $_REQUEST['role'] ); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | if ( $updated ) { |
| 59 | pp_refresh_options(); |
| 60 | } |
| 61 | |
| 62 | return $updated; |
| 63 | } |
| 64 | |
| 65 |