8889841cimage-optimization-operation-query.php000064400000003505150434622050014230 0ustar00query['hook'] = $hook; return $this; } /** * @param string|array $status * @return $this */ public function set_status( $status ): self { $this->query['status'] = $status; return $this; } public function set_image_id( int $image_id ): self { if ( empty( $this->query['args'] ) ) { $this->query['args'] = []; } $this->query['args']['attachment_id'] = $image_id; return $this; } public function set_bulk_operation_id( string $operation_id ): self { if ( empty( $this->query['args'] ) ) { $this->query['args'] = []; } $this->query['args']['operation_id'] = $operation_id; return $this; } public function set_limit( int $limit ): self { $this->query['per_page'] = $limit; return $this; } public function get_return_type(): string { return $this->query['_return_type']; } public function return_ids(): self { $this->query['_return_type'] = 'ids'; return $this; } public function get_query(): array { return $this->query; } public function __construct() { $this->query = [ 'group' => Async_Operation_Queue::OPTIMIZE, 'per_page' => 10, 'orderby' => 'date', 'order' => 'DESC', 'partial_args_matching' => 'json', '_return_type' => 'object', ]; } } operation-query.php000064400000003051150434622050010420 0ustar00query['hook'] = $hook; return $this; } /** * @param string|array $status * @return $this */ public function set_status( $status ): self { $this->query['status'] = $status; return $this; } public function set_image_id( int $image_id ): self { $this->query['args']['attachment_id'] = $image_id; return $this; } public function set_limit( int $limit ): self { $this->query['per_page'] = $limit; return $this; } public function get_return_type(): string { return $this->query['_return_type']; } public function return_ids(): self { $this->query['_return_type'] = 'ids'; return $this; } public function get_query(): array { $clone = $this->query; if ( empty( $clone['args'] ) ) { unset( $clone['args'] ); } return $clone; } public function __construct() { $this->query = [ 'args' => [], 'per_page' => 10, 'orderby' => 'date', 'order' => 'DESC', '_return_type' => 'object', ]; } }