v1.4.0
This commit is contained in:
parent
916d7845be
commit
cc1bca74fa
29 changed files with 770 additions and 204 deletions
|
|
@ -240,6 +240,19 @@ class Config {
|
|||
return in_array( $value, $allowed, true ) ? $value : 'all';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user opted in to delete all data on uninstall.
|
||||
*
|
||||
* @since 1.4.0
|
||||
*
|
||||
* @return bool True if all plugin data should be removed on uninstall.
|
||||
*/
|
||||
public function is_delete_on_uninstall(): bool {
|
||||
$options = get_option( self::OPTION_NAME, array() );
|
||||
|
||||
return is_array( $options ) && isset( $options['delete_on_uninstall'] ) && '1' === $options['delete_on_uninstall'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update configuration options in WordPress database.
|
||||
*
|
||||
|
|
@ -268,6 +281,9 @@ class Config {
|
|||
$allowed_modes = array( 'all', 'thumbnail', 'none' );
|
||||
$options['subsizes_mode'] = in_array( $raw_mode, $allowed_modes, true ) ? $raw_mode : 'all';
|
||||
|
||||
// Data cleanup on uninstall: checkbox, default off (preserve data).
|
||||
$options['delete_on_uninstall'] = ! empty( $data['delete_on_uninstall'] ) ? '1' : '';
|
||||
|
||||
// Log configuration changes.
|
||||
if ( $this->logger ) {
|
||||
foreach ( $options as $key => $new_value ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue