@@ -120,8 +120,10 @@ function ( $metadata, $post_meta_id ) use ( $post_id, $file_path, $mime_type, $e
120120
121121 $ old_metadata = wp_get_attachment_metadata ( $ post_id );
122122 $ resize_sizes = array ();
123- // PHPCS ignore reason: A nonce check is not necessary here as this logic directly ties in with WordPress core logic which already has one.
124- $ target = isset ( $ _REQUEST ['target ' ] ) ? sanitize_key ( $ _REQUEST ['target ' ] ) : 'all ' ; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
123+ // PHPCS ignore reason: A nonce check is not necessary here as this logic directly ties in with WordPress core
124+ // function `wp_ajax_image_editor()` which already has one.
125+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
126+ $ target = isset ( $ _REQUEST ['target ' ] ) ? sanitize_key ( $ _REQUEST ['target ' ] ) : 'all ' ;
125127
126128 foreach ( $ old_metadata ['sizes ' ] as $ size_name => $ size_details ) {
127129 // If the target is 'nothumb', skip generating the 'thumbnail' size.
@@ -238,7 +240,9 @@ function ( $metadata, $post_meta_id ) use ( $post_id, $file_path, $mime_type, $e
238240 * @return array The updated metadata for the attachment to be stored in the meta table.
239241 */
240242function webp_uploads_update_attachment_metadata ( $ data , $ attachment_id ) {
241- $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 10 ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
243+ // PHPCS ignore reason: Update the attachment's metadata by either restoring or editing it.
244+ // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace
245+ $ trace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS , 10 );
242246
243247 foreach ( $ trace as $ element ) {
244248 if ( ! isset ( $ element ['function ' ] ) ) {
@@ -273,7 +277,10 @@ function webp_uploads_update_attachment_metadata( $data, $attachment_id ) {
273277 * @return array The updated metadata for the attachment.
274278 */
275279function webp_uploads_backup_sources ( $ attachment_id , $ data ) {
276- $ target = isset ( $ _REQUEST ['target ' ] ) ? sanitize_key ( $ _REQUEST ['target ' ] ) : 'all ' ; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
280+ // PHPCS ignore reason: A nonce check is not necessary here as this logic directly ties in with WordPress core
281+ // function `wp_ajax_image_editor()` which already has one.
282+ // phpcs:ignore WordPress.Security.NonceVerification.Recommended
283+ $ target = isset ( $ _REQUEST ['target ' ] ) ? sanitize_key ( $ _REQUEST ['target ' ] ) : 'all ' ;
277284
278285 // When an edit to an image is only applied to a thumbnail there's nothing we need to back up.
279286 if ( 'thumbnail ' === $ target ) {
0 commit comments