| @@ -182,9 +182,9 @@ | ||
| 182 | 182 | ] |
| 183 | 183 | ); |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - $user_cap = ! empty( $details['capability'] ) ? (string) $details['capability'] : ''; | |
| 186 | + $user_cap = ! empty( $details['capability'] ) ? (string) $details['capability'] : 'manage_options'; | |
| 187 | 187 | $allow_visitor = ! empty( $details['allow_visitor_action'] ) && (bool) $details['allow_visitor_action']; |
| 188 | 188 | $has_permission = $this->check_permission( $user_cap, $allow_visitor ); |
| 189 | 189 | |
| 190 | 190 | if ( is_wp_error( $has_permission ) ) { |
| @@ -260,8 +260,9 @@ | ||
| 260 | 260 | case 'string': |
| 261 | 261 | $payload[ $key ][ $type_key ][ $type_value_key ] = sanitize_text_field( wp_unslash( $_REQUEST[ $key ][ $type_key ][ $type_value_key ] ) ); |
| 262 | 262 | break; |
| 263 | 263 | case 'json': |
| 264 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 264 | 265 | $payload[ $key ][ $type_key ][ $type_value_key ] = Sanitizer::sanitize_json_form_data( $_REQUEST[ $key ][ $type_key ][ $type_value_key ] ); |
| 265 | 266 | break; |
| 266 | 267 | case 'hex_color': |
| 267 | 268 | $payload[ $key ][ $type_key ][ $type_value_key ] = sanitize_hex_color( wp_unslash( $_REQUEST[ $key ][ $type_key ][ $type_value_key ] ) ); |
| @@ -272,8 +273,9 @@ | ||
| 272 | 273 | case 'key': |
| 273 | 274 | $payload[ $key ][ $type_key ][ $type_value_key ] = sanitize_key( wp_unslash( $_REQUEST[ $key ][ $type_key ][ $type_value_key ] ) ); |
| 274 | 275 | break; |
| 275 | 276 | case 'safe_text': |
| 277 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 276 | 278 | $payload[ $key ][ $type_key ][ $type_value_key ] = wp_kses( force_balance_tags( stripslashes( wp_unslash( $_REQUEST[ $key ][ $type_key ][ $type_value_key ] ) ) ), $this->safe_text_kses_rules ); |
| 277 | 279 | break; |
| 278 | 280 | default: |
| 279 | 281 | if ( is_array( $payload[ $key ][ $type_key ][ $type_value_key ] ) ) { |
| @@ -335,8 +337,9 @@ | ||
| 335 | 337 | case 'string': |
| 336 | 338 | $payload[ $key ][ $type_key ] = sanitize_text_field( wp_unslash( $_REQUEST[ $key ][ $type_key ] ) ); |
| 337 | 339 | break; |
| 338 | 340 | case 'json': |
| 341 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 339 | 342 | $payload[ $key ][ $type_key ] = Sanitizer::sanitize_json_form_data( $_REQUEST[ $key ][ $type_key ] ); |
| 340 | 343 | break; |
| 341 | 344 | case 'hex_color': |
| 342 | 345 | $payload[ $key ][ $type_key ] = sanitize_hex_color( wp_unslash( $_REQUEST[ $key ][ $type_key ] ) ); |
| @@ -347,8 +350,9 @@ | ||
| 347 | 350 | case 'key': |
| 348 | 351 | $payload[ $key ][ $type_key ] = sanitize_key( wp_unslash( $_REQUEST[ $key ][ $type_key ] ) ); |
| 349 | 352 | break; |
| 350 | 353 | case 'safe_text': |
| 354 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 351 | 355 | $payload[ $key ][ $type_key ] = wp_kses( force_balance_tags( stripslashes( wp_unslash( $_REQUEST[ $key ][ $type_key ] ) ) ), $this->safe_text_kses_rules ); |
| 352 | 356 | break; |
| 353 | 357 | default: |
| 354 | 358 | if ( is_array( $payload[ $key ][ $type_key ] ) ) { |
| @@ -420,8 +424,9 @@ | ||
| 420 | 424 | case 'key': |
| 421 | 425 | $payload[ $key ] = sanitize_key( wp_unslash( $_REQUEST[ $key ] ) ); |
| 422 | 426 | break; |
| 423 | 427 | case 'safe_text': |
| 428 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.ValidatedSanitizedInput.MissingUnslash | |
| 424 | 429 | $payload[ $key ] = wp_kses( force_balance_tags( stripslashes( wp_unslash( $_REQUEST[ $key ] ) ) ), $this->safe_text_kses_rules ); |
| 425 | 430 | break; |
| 426 | 431 | case 'array-string': |
| 427 | 432 | $payload[ $key ] = array_map( 'sanitize_text_field', wp_unslash( $_REQUEST[ $key ] ) ); |