PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.15.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.15.0
2.15.0 2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 All 82 releases
← All changes | includes/ajax/settings.php +23 -1 2.13.1 → 2.15.0 View file →
@@ -7,8 +7,9 @@
7 7 }
8 8
9 9 use ABlocks\Classes\AbstractAjaxHandler;
10 10 use ABlocks\Classes\Sanitizer;
11 +use ABlocks\Classes\Breakpoints;
11 12 use ABlocks\Helper;
12 13 use ABlocks\Admin\Settings\Base as BaseSettings;
13 14 use ABlocks\Permissions\SettingsGuard;
14 15
@@ -88,8 +89,13 @@
88 89 // Editor paste
89 90 'paste_google_docs' => 'boolean',
90 91 'paste_convert_webp' => 'boolean',
91 92 'paste_webp_quality' => 'integer',
93 + // Responsive breakpoints
94 + 'breakpoint_tablet' => 'integer',
95 + 'breakpoint_mobile' => 'integer',
96 + 'breakpoint_mode' => 'string',
97 + 'breakpoint_custom' => 'json',
92 98 // Performance Suite — full-page cache.
93 99 'perf_page_cache' => 'boolean',
94 100 'perf_page_cache_scope' => 'string',
95 101 'perf_page_cache_ttl' => 'integer',
@@ -309,8 +315,9 @@
309 315 'global_h3_typography' => 'json',
310 316 'global_h4_typography' => 'json',
311 317 'global_h5_typography' => 'json',
312 318 'global_h6_typography' => 'json',
319 + 'breakpoint_custom' => 'json',
313 320 ], $_POST ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
314 321
315 322 // The JSON fields are read straight from $_POST rather than the sanitized
316 323 // payload, so they need the same guard — the global colour and typography
@@ -316,10 +323,25 @@
316 323 // payload, so they need the same guard — the global colour and typography
317 324 // presets live in here, and they are the design system.
318 325 $json_payload = SettingsGuard::filter_payload( $json_payload );
319 326
327 + // Breakpoints are only written when the request carries them, so a save
328 + // that omits them keeps the stored list rather than resetting it.
329 + $breakpoints = [];
330 + foreach ( [ 'breakpoint_tablet', 'breakpoint_mobile' ] as $key ) {
331 + if ( isset( $payload[ $key ] ) && $payload[ $key ] > 0 ) {
332 + $breakpoints[ $key ] = $payload[ $key ];
333 + }
334 + }
335 + if ( isset( $payload['breakpoint_mode'] ) ) {
336 + $breakpoints['breakpoint_mode'] = 'strict' === $payload['breakpoint_mode'] ? 'strict' : 'cascade';
337 + }
338 + if ( isset( $json_payload['breakpoint_custom'] ) && is_array( $json_payload['breakpoint_custom'] ) ) {
339 + $breakpoints['breakpoint_custom'] = Breakpoints::sanitize( $json_payload['breakpoint_custom'] );
340 + }
341 +
320 342 $default = BaseSettings::get_default_data();
321 - $is_update = BaseSettings::save_settings( [
343 + $is_update = BaseSettings::save_settings( $breakpoints + [
322 344 'default_container_width' => $payload['default_container_width'] ?? $default['default_container_width'],
323 345 'container_padding' => $payload['container_padding'] ?? $default['container_padding'],
324 346 'container_element_gap' => $payload['container_element_gap'] ?? $default['container_element_gap'],
325 347 'enabled_assets_file_generation' => $payload['enabled_assets_file_generation'] ?? $default['enabled_assets_file_generation'],