Changeset 3492219
- Timestamp:
- 03/26/2026 11:00:09 PM (7 days ago)
- Location:
- madnesschat-button/tags/1.0.2
- Files:
-
- 3 edited
-
includes/class-mcnb-settings.php (modified) (4 diffs)
-
madnesschat-button.php (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
madnesschat-button/tags/1.0.2/includes/class-mcnb-settings.php
r3488520 r3492219 9 9 $saved = get_option( 'mcnb_basic_options', array() ); 10 10 $result = wp_parse_args( $saved, $defaults ); 11 12 11 12 if ( isset( $defaults['responsive_config'] ) && is_array( $defaults['responsive_config'] ) ) { 13 $result['responsive_config'] = self::merge_responsive_config( 14 is_array( $saved['responsive_config'] ?? null ) ? $saved['responsive_config'] : array(), 15 $defaults['responsive_config'] 16 ); 17 } 18 13 19 return $result; 14 20 } … … 116 122 // Checkbox responsive_enabled: ya procesado arriba 117 123 118 // Procesar configuración responsive 119 $responsive_config = $pick( 'responsive_config' ); 120 if ( is_array( $responsive_config ) ) { 121 $clean_responsive = array(); 122 $valid_devices = array( 'mobile', 'tablet', 'laptop', 'desktop' ); 123 foreach ( $valid_devices as $device ) { 124 if ( isset( $responsive_config[ $device ] ) && is_array( $responsive_config[ $device ] ) ) { 125 $device_config = $responsive_config[ $device ]; 126 $clean_responsive[ $device ] = array( 127 'size' => in_array( (string) $device_config['size'], array( '48', '56', '64', '72', '80' ), true ) ? (string) $device_config['size'] : '56', 128 'position' => in_array( (string) $device_config['position'], array( 'bottom-right', 'bottom-left' ), true ) ? (string) $device_config['position'] : 'bottom-right', 129 'offset_x' => max( 0, min( 500, intval( $device_config['offset_x'] ) ) ), 130 'offset_y' => max( 0, min( 500, intval( $device_config['offset_y'] ) ) ), 131 'show_label' => ! empty( $device_config['show_label'] ) 132 ); 133 } 134 } 135 $sanitized['responsive_config'] = $clean_responsive; 136 } else { 137 $sanitized['responsive_config'] = $pick( 'responsive_config' ); 138 } 124 // Procesar configuración responsive preservando valores faltantes por dispositivo. 125 $default_responsive = is_array( $defaults['responsive_config'] ?? null ) ? $defaults['responsive_config'] : array(); 126 $saved_responsive = is_array( $saved['responsive_config'] ?? null ) ? $saved['responsive_config'] : array(); 127 $input_responsive = is_array( $input['responsive_config'] ?? null ) ? $input['responsive_config'] : array(); 128 $base_responsive = self::merge_responsive_config( $saved_responsive, $default_responsive ); 129 $sanitized['responsive_config'] = self::sanitize_responsive_config( $input_responsive, $base_responsive ); 139 130 140 131 … … 508 499 $sizes = array( '48' => '48px', '56' => '56px', '64' => '64px', '72' => '72px', '80' => '80px' ); 509 500 foreach ( $sizes as $value => $label ) { 510 $selected = ( $device_config['size'] ?? '56' ) ===$value;501 $selected = (string) ( $device_config['size'] ?? '56' ) === (string) $value; 511 502 printf( '<option value="%s" %s>%s</option>', esc_attr( $value ), selected( $selected, true, false ), esc_html( $label ) ); 512 503 } … … 1104 1095 } 1105 1096 1097 private static function merge_responsive_config( $config, $defaults ) { 1098 $merged = array(); 1099 $valid_devices = array( 'mobile', 'tablet', 'laptop', 'desktop' ); 1100 1101 foreach ( $valid_devices as $device ) { 1102 $merged[ $device ] = wp_parse_args( 1103 is_array( $config[ $device ] ?? null ) ? $config[ $device ] : array(), 1104 is_array( $defaults[ $device ] ?? null ) ? $defaults[ $device ] : array() 1105 ); 1106 } 1107 1108 return $merged; 1109 } 1110 1111 private static function sanitize_responsive_config( $input_config, $base_config ) { 1112 $clean = array(); 1113 $valid_devices = array( 'mobile', 'tablet', 'laptop', 'desktop' ); 1114 1115 foreach ( $valid_devices as $device ) { 1116 $device_base = is_array( $base_config[ $device ] ?? null ) ? $base_config[ $device ] : array(); 1117 $device_input = is_array( $input_config[ $device ] ?? null ) ? $input_config[ $device ] : array(); 1118 $device_config = wp_parse_args( $device_input, $device_base ); 1119 1120 $clean[ $device ] = array( 1121 'size' => in_array( (string) ( $device_config['size'] ?? '' ), array( '48', '56', '64', '72', '80' ), true ) ? (string) $device_config['size'] : (string) ( $device_base['size'] ?? '56' ), 1122 'position' => in_array( (string) ( $device_config['position'] ?? '' ), array( 'bottom-right', 'bottom-left' ), true ) ? (string) $device_config['position'] : (string) ( $device_base['position'] ?? 'bottom-right' ), 1123 'offset_x' => max( 0, min( 500, intval( $device_config['offset_x'] ?? ( $device_base['offset_x'] ?? 20 ) ) ) ), 1124 'offset_y' => max( 0, min( 500, intval( $device_config['offset_y'] ?? ( $device_base['offset_y'] ?? 20 ) ) ) ), 1125 'show_label' => array_key_exists( 'show_label', $device_input ) ? ! empty( $device_input['show_label'] ) : ! empty( $device_base['show_label'] ), 1126 ); 1127 } 1128 1129 return $clean; 1130 } 1131 1106 1132 } 1107 1133 -
madnesschat-button/tags/1.0.2/madnesschat-button.php
r3490823 r3492219 3 3 * Plugin Name: Floating Contact Button 4 4 * Description: Easy-to-configure floating WhatsApp button with GDPR compliance, basic analytics, and smart triggers. 5 * Version: 1.1. 25 * Version: 1.1.3 6 6 * Author: Vórtice Labs 7 7 * Requires at least: 5.6 … … 39 39 } 40 40 41 define( 'MCNB_VERSION', '1.1. 2' );41 define( 'MCNB_VERSION', '1.1.3' ); 42 42 define( 'MCNB_SLUG', 'madnesschat-button' ); 43 43 define( 'MCNB_FILE', __FILE__ ); -
madnesschat-button/tags/1.0.2/readme.txt
r3490823 r3492219 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.3 7 Stable tag: 1.1. 27 Stable tag: 1.1.3 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 123 123 124 124 == Changelog == 125 126 = 1.1.3 = 127 * FIXED: Responsive per-device settings now preserve values correctly when saving. 128 * FIXED: Device-specific size values are shown correctly after reloading the settings page. 125 129 126 130 = 1.1.2 = … … 202 206 == Upgrade Notice == 203 207 208 = 1.1.3 = 209 Fixes saving and reloading of responsive per-device size settings. Recommended update if you use device-specific design options. 210 204 211 = 1.1.2 = 205 212 Metadata compliance update for WordPress.org: fixed contributors, reduced tags, and refreshed release version.
Note: See TracChangeset
for help on using the changeset viewer.