Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Get list of IDs for settings that have values different from what is currently
- * saved in the changeset. By skipping any values that are already the same, the
- * subset of changed settings can be passed into validate_setting_values to prevent
- * an underprivileged modifying a single setting for which they have the capability
- * from being blocked from saving. This also prevents a user from touching of the
- * previous saved settings and overriding the associated user_id if they made no change.
- */
- $changed_setting_ids = array();
- foreach ( $post_values as $setting_id => $setting_value ) {
- $setting = $this->get_setting( $setting_id );
- if ( $setting && 'theme_mod' === $setting->type ) {
- $prefixed_setting_id = $this->get_stylesheet() . '::' . $setting->id;
- } else {
- $prefixed_setting_id = $setting_id;
- }
- $is_value_changed = (
- ! isset( $existing_changeset_data[ $prefixed_setting_id ] )
- ||
- ! array_key_exists( 'value', $existing_changeset_data[ $prefixed_setting_id ] )
- ||
- $existing_changeset_data[ $prefixed_setting_id ]['value'] !== $setting_value
- );
- if ( $is_value_changed ) {
- $changed_setting_ids[] = $setting_id;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement