| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | private $max_number_of_interactions = 5; |
| 17 | 17 | |
| 18 | 18 | private const VALID_EFFECTS = [ 'fade', 'slide', 'scale', 'custom' ]; |
| 19 | 19 | private const VALID_TYPES = [ 'in', 'out' ]; |
| 20 | - private const VALID_DIRECTIONS = [ '', 'left', 'right', 'top', 'bottom', 'top-left', 'top-right', 'bottom-left', 'bottom-right' ]; | |
| 20 | + private const VALID_DIRECTIONS = [ '', 'left', 'right', 'top', 'bottom' ]; | |
| 21 | 21 | private const VALID_REPEAT_MODES = [ '', 'loop', 'times' ]; |
| 22 | 22 | |
| 23 | 23 | public function sanitize( $document ) { |
| 24 | 24 | return $this->sanitize_document_data( $document ); |
| @@ -238,10 +238,20 @@ | ||
| 238 | 238 | if ( ! isset( $data['config'] ) || ! is_array( $data['config'] ) ) { |
| 239 | 239 | return false; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - $config_value = $data['config']['value']; | |
| 242 | + $config = $data['config']; | |
| 243 | 243 | |
| 244 | + if ( ! isset( $config['$$type'] ) || 'config' !== $config['$$type'] ) { | |
| 245 | + return false; | |
| 246 | + } | |
| 247 | + | |
| 248 | + if ( ! isset( $config['value'] ) || ! is_array( $config['value'] ) ) { | |
| 249 | + return false; | |
| 250 | + } | |
| 251 | + | |
| 252 | + $config_value = $config['value']; | |
| 253 | + | |
| 244 | 254 | if ( isset( $config_value['replay'] ) && ! $this->is_valid_boolean_prop( $config_value, 'replay' ) ) { |
| 245 | 255 | return false; |
| 246 | 256 | } |
| 247 | 257 | |
| @@ -298,9 +308,10 @@ | ||
| 298 | 308 | if ( ! $this->is_valid_string_prop( $animation_value, 'type', self::VALID_TYPES ) ) { |
| 299 | 309 | return false; |
| 300 | 310 | } |
| 301 | 311 | |
| 302 | - if ( array_key_exists( 'direction', $animation_value ) && ! $this->is_valid_string_prop( $animation_value, 'direction', self::VALID_DIRECTIONS ) ) { | |
| 312 | + // Validate direction (can be empty string) | |
| 313 | + if ( ! $this->is_valid_string_prop( $animation_value, 'direction', self::VALID_DIRECTIONS ) ) { | |
| 303 | 314 | return false; |
| 304 | 315 | } |
| 305 | 316 | |
| 306 | 317 | // Validate timing_config |