Recent

Media_Libraryclass

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 31

Methods

__construct()

Constructor.

Since: 1.0.0
Line: 54

public function __construct(  );

enqueue_assets()

Enqueue the script that drives the “Optimize” action over AJAX.

Since: 1.0.0
Line: 81

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: 135

public function render_notice(  ): void;

Returns: void

add_column()

Add the status column.

Since: 1.0.0
Line: 211

public function add_column( $columns ): array<string,;
Type Name Description
mixed $columns

Returns: array<string, — string> Columns.

render_status_filter()

Add the optimization status filter to the media list table.

Since: 1.1.0
Line: 226

public function render_status_filter( $post_type, $which ): void;
Type Name Description
string $post_type Current post type.
string $which Location of the filter controls.

Returns: void

filter_by_status()

Filter the media library query by optimization status.

Since: 1.1.0
Line: 259

public function filter_by_status( $query ): void;
Type Name Description
\WP_Query $query Current query.

Returns: void

filter_attachments_by_status()

Limit a flagged media query to eligible attachments in the requested queue state.

Since: 1.1.0
Line: 288

public function filter_attachments_by_status( $where, $query ): string;
Type Name Description
string $where Current WHERE clause.
\WP_Query $query Current query.

Returns: string — Filtered WHERE clause.

render_column()

Render the status column.

Since: 1.0.0
Line: 373

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: 781

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: 821

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: 838

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: 886

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: 1006

public function handle_optimize(  ): void;

Returns: void

handle_retry()

Retry skipped and failed copies of one attachment as the no-JS fallback.

Since: 1.1.2
Line: 1026

public function handle_retry(  ): void;

Returns: void

ajax_optimize()

Convert the next file of an attachment over AJAX, one file per call.

Since: 1.0.0
Line: 1047

public function ajax_optimize(  ): void;

Returns: void

handle_restore()

Delete the generated copies for a single attachment.

Since: 1.0.0
Line: 1094

public function handle_restore(  ): void;

Returns: void

handle_restore_originals()

Restore originals for one authorized attachment.

Line: 1122

public function handle_restore_originals(  ): void;

Returns: void