Media_Library
Adds per-image status and actions to the media list table.
Namespace: WebberZone\Image_Optimizer\Admin
Since: 1.0.0
Source: includes/admin/class-media-library.php line 26
Methods
__construct()
Constructor.
Since: 1.0.0
Line: 34
public function __construct( );
enqueue_assets()
Enqueue the script that drives the “Optimize” action over AJAX.
Since: 1.0.0
Line: 56
public function enqueue_assets( $hook_suffix ): void;
| Type | Name | Description |
|---|---|---|
string |
$hook_suffix |
Current admin page. |
Returns: void
render_notice()
Confirm the outcome of a per-image action.
Since: 1.0.0
Line: 103
public function render_notice( ): void;
Returns: void
add_column()
Add the status column.
Since: 1.0.0
Line: 149
public function add_column( $columns ): array<string,;
| Type | Name | Description |
|---|---|---|
mixed |
$columns |
Returns: array<string, — string> Columns.
render_column()
Render the status column.
Since: 1.0.0
Line: 164
public function render_column( $column_name, $post_id ): void;
| Type | Name | Description |
|---|---|---|
string |
$column_name |
Column key. |
int |
$post_id |
Attachment ID. |
Returns: void
add_row_actions()
Add the per-image actions.
Since: 1.0.0
Line: 203
public function add_row_actions( $actions, $post ): array<string,;
| Type | Name | Description |
|---|---|---|
mixed |
$actions |
|
\WP_Post |
$post |
Attachment. |
Returns: array<string, — string> Actions.
add_bulk_actions()
Add the bulk action to delete optimized copies.
Since: 1.0.0
Line: 236
public function add_bulk_actions( $actions ): array<string,;
| Type | Name | Description |
|---|---|---|
mixed |
$actions |
Returns: array<string, — string> Bulk actions.
handle_bulk_restore()
Handle deletion after WordPress verifies the bulk action.
Since: 1.0.0
Line: 252
public function handle_bulk_restore( $redirect_to, $doaction, $post_ids ): string;
| Type | Name | Description |
|---|---|---|
string |
$redirect_to |
Redirect URL. |
string |
$doaction |
Bulk action name. |
mixed |
$post_ids |
Returns: string — Redirect URL.
render_submitbox()
Show optimization status and actions in the attachment edit Save box.
Since: 1.0.0
Line: 285
public function render_submitbox( $post ): void;
| Type | Name | Description |
|---|---|---|
\WP_Post |
$post |
Attachment. |
Returns: void
handle_optimize()
Convert one attachment as the no-JS fallback.
Since: 1.0.0
Line: 393
public function handle_optimize( ): void;
Returns: void
ajax_optimize()
Convert the next file of an attachment over AJAX, one file per call.
Since: 1.0.0
Line: 412
public function ajax_optimize( ): void;
Returns: void
handle_restore()
Delete the generated copies for a single attachment.
Since: 1.0.0
Line: 451
public function handle_restore( ): void;
Returns: void