| @@ -51,9 +51,9 @@ | ||
| 51 | 51 | $list = []; |
| 52 | 52 | if ( isset( $_POST['breakpoints'] ) ) { |
| 53 | 53 | $decoded = json_decode( wp_unslash( $_POST['breakpoints'] ), true ); |
| 54 | 54 | if ( is_array( $decoded ) ) { |
| 55 | - $list = $this->sanitize( $decoded ); | |
| 55 | + $list = self::sanitize( $decoded ); | |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | // Merge into the settings option without disturbing other keys. |
| @@ -72,9 +72,13 @@ | ||
| 72 | 72 | |
| 73 | 73 | wp_send_json_success( self::payload() ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - private function sanitize( $list ) { | |
| 76 | + /** | |
| 77 | + * Normalise a raw breakpoint list. Shared with Ajax\Settings::save_settings() | |
| 78 | + * so the editor modal and the admin settings page store the same shape. | |
| 79 | + */ | |
| 80 | + public static function sanitize( $list ) { | |
| 77 | 81 | $out = []; |
| 78 | 82 | $seen = []; |
| 79 | 83 | foreach ( $list as $item ) { |
| 80 | 84 | $item = (array) $item; |