wp/wp-admin/includes/class-wp-privacy-requests-table.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
--- a/wp/wp-admin/includes/class-wp-privacy-requests-table.php	Thu Sep 29 08:06:27 2022 +0200
+++ b/wp/wp-admin/includes/class-wp-privacy-requests-table.php	Fri Sep 05 18:40:08 2025 +0200
@@ -31,7 +31,7 @@
 	protected $post_type = 'INVALID';
 
 	/**
-	 * Get columns to show in the list table.
+	 * Gets columns to show in the list table.
 	 *
 	 * @since 4.9.6
 	 *
@@ -49,7 +49,7 @@
 	}
 
 	/**
-	 * Normalize the admin URL to the current page (by request_type).
+	 * Normalizes the admin URL to the current page (by request_type).
 	 *
 	 * @since 5.3.0
 	 *
@@ -66,7 +66,7 @@
 	}
 
 	/**
-	 * Get a list of sortable columns.
+	 * Gets a list of sortable columns.
 	 *
 	 * @since 4.9.6
 	 *
@@ -87,7 +87,7 @@
 	}
 
 	/**
-	 * Default primary column.
+	 * Returns the default primary column.
 	 *
 	 * @since 4.9.6
 	 *
@@ -98,7 +98,7 @@
 	}
 
 	/**
-	 * Count number of requests for each status.
+	 * Counts the number of requests for each status.
 	 *
 	 * @since 4.9.6
 	 *
@@ -137,7 +137,7 @@
 	}
 
 	/**
-	 * Get an associative array ( id => link ) with the list of views available on this table.
+	 * Gets an associative array ( id => link ) with the list of views available on this table.
 	 *
 	 * @since 4.9.6
 	 *
@@ -153,8 +153,7 @@
 		// Normalized admin URL.
 		$admin_url = $this->get_admin_url();
 
-		$current_link_attributes = empty( $current_status ) ? ' class="current" aria-current="page"' : '';
-		$status_label            = sprintf(
+		$status_label = sprintf(
 			/* translators: %s: Number of requests. */
 			_nx(
 				'All <span class="count">(%s)</span>',
@@ -165,11 +164,10 @@
 			number_format_i18n( $total_requests )
 		);
 
-		$views['all'] = sprintf(
-			'<a href="%s"%s>%s</a>',
-			esc_url( $admin_url ),
-			$current_link_attributes,
-			$status_label
+		$views['all'] = array(
+			'url'     => esc_url( $admin_url ),
+			'label'   => $status_label,
+			'current' => empty( $current_status ),
 		);
 
 		foreach ( $statuses as $status => $label ) {
@@ -178,8 +176,7 @@
 				continue;
 			}
 
-			$current_link_attributes = $status === $current_status ? ' class="current" aria-current="page"' : '';
-			$total_status_requests   = absint( $counts->{$status} );
+			$total_status_requests = absint( $counts->{$status} );
 
 			if ( ! $total_status_requests ) {
 				continue;
@@ -192,19 +189,18 @@
 
 			$status_link = add_query_arg( 'filter-status', $status, $admin_url );
 
-			$views[ $status ] = sprintf(
-				'<a href="%s"%s>%s</a>',
-				esc_url( $status_link ),
-				$current_link_attributes,
-				$status_label
+			$views[ $status ] = array(
+				'url'     => esc_url( $status_link ),
+				'label'   => $status_label,
+				'current' => $status === $current_status,
 			);
 		}
 
-		return $views;
+		return $this->get_views_links( $views );
 	}
 
 	/**
-	 * Get bulk actions.
+	 * Gets bulk actions.
 	 *
 	 * @since 4.9.6
 	 *
@@ -243,9 +239,9 @@
 					$resend = _wp_privacy_resend_request( $request_id );
 
 					if ( $resend && ! is_wp_error( $resend ) ) {
-						$count++;
+						++$count;
 					} else {
-						$failures++;
+						++$failures;
 					}
 				}
 
@@ -290,7 +286,7 @@
 					$result = _wp_privacy_completed_request( $request_id );
 
 					if ( $result && ! is_wp_error( $result ) ) {
-						$count++;
+						++$count;
 					}
 				}
 
@@ -313,9 +309,9 @@
 			case 'delete':
 				foreach ( $request_ids as $request_id ) {
 					if ( wp_delete_post( $request_id, true ) ) {
-						$count++;
+						++$count;
 					} else {
-						$failures++;
+						++$failures;
 					}
 				}
 
@@ -358,7 +354,7 @@
 	}
 
 	/**
-	 * Prepare items to output.
+	 * Prepares items to output.
 	 *
 	 * @since 4.9.6
 	 * @since 5.1.0 Added support for column sorting.
@@ -411,7 +407,7 @@
 	}
 
 	/**
-	 * Checkbox column.
+	 * Returns the markup for the Checkbox column.
 	 *
 	 * @since 4.9.6
 	 *
@@ -419,7 +415,13 @@
 	 * @return string Checkbox column markup.
 	 */
 	public function column_cb( $item ) {
-		return sprintf( '<input type="checkbox" name="request_id[]" value="%1$s" /><span class="spinner"></span>', esc_attr( $item->ID ) );
+		return sprintf(
+			'<input type="checkbox" name="request_id[]" id="requester_%1$s" value="%1$s" />' .
+			'<label for="requester_%1$s"><span class="screen-reader-text">%2$s</span></label><span class="spinner"></span>',
+			esc_attr( $item->ID ),
+			/* translators: Hidden accessibility text. %s: Email address. */
+			sprintf( __( 'Select %s' ), $item->email )
+		);
 	}
 
 	/**
@@ -460,7 +462,7 @@
 	}
 
 	/**
-	 * Convert timestamp for display.
+	 * Converts a timestamp for display.
 	 *
 	 * @since 4.9.6
 	 *
@@ -483,7 +485,7 @@
 	}
 
 	/**
-	 * Default column handler.
+	 * Handles the default column.
 	 *
 	 * @since 4.9.6
 	 * @since 5.7.0 Added `manage_{$this->screen->id}_custom_column` action.
@@ -507,7 +509,7 @@
 	}
 
 	/**
-	 * Created timestamp column. Overridden by children.
+	 * Returns the markup for the Created timestamp column. Overridden by children.
 	 *
 	 * @since 5.7.0
 	 *
@@ -531,7 +533,7 @@
 	}
 
 	/**
-	 * Next steps column. Overridden by children.
+	 * Returns the markup for the next steps column. Overridden by children.
 	 *
 	 * @since 4.9.6
 	 *
@@ -555,7 +557,7 @@
 	}
 
 	/**
-	 * Embed scripts used to perform actions. Overridden by children.
+	 * Embeds scripts used to perform actions. Overridden by children.
 	 *
 	 * @since 4.9.6
 	 */