| 1 |
<?php |
| 2 |
namespace Imagify\Bulk; |
| 3 |
|
| 4 |
/** |
| 5 |
* Falback class for bulk. |
| 6 |
* |
| 7 |
* @since 1.9 |
| 8 |
*/ |
| 9 |
class Noop extends AbstractBulk { |
| 10 |
/** |
| 11 |
* Get all unoptimized media ids. |
| 12 |
* |
| 13 |
* @since 1.9 |
| 14 |
* |
| 15 |
* @param int $optimization_level The optimization level. |
| 16 |
* @return array A list of unoptimized media. Array keys are media IDs prefixed with an underscore character, array values are the main file’s URL. |
| 17 |
*/ |
| 18 |
public function get_unoptimized_media_ids( $optimization_level ) { |
| 19 |
return []; |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Get all optimized media ids that can be restored. |
| 24 |
* |
| 25 |
* @since 2.3 |
| 26 |
* |
| 27 |
* @return array A list of optimized media IDs with backup files available. |
| 28 |
*/ |
| 29 |
public function get_optimized_media_ids(): array { |
| 30 |
return []; |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* * Get ids of all optimized media without Next gen versions. |
| 35 |
* |
| 36 |
* @since 2.2 |
| 37 |
* |
| 38 |
* @param string $format Format we are looking for. (webp|avif). |
| 39 |
* |
| 40 |
* @return array { |
| 41 |
* @type array $ids A list of media IDs. |
| 42 |
* @type array $errors { |
| 43 |
* @type array $no_file_path A list of media IDs. |
| 44 |
* @type array $no_backup A list of media IDs. |
| 45 |
* } |
| 46 |
* } |
| 47 |
*/ |
| 48 |
public function get_optimized_media_ids_without_format( $format ) { |
| 49 |
return [ |
| 50 |
'ids' => [], |
| 51 |
'errors' => [ |
| 52 |
'no_file_path' => [], |
| 53 |
'no_backup' => [], |
| 54 |
], |
| 55 |
]; |
| 56 |
} |
| 57 |
|
| 58 |
/** |
| 59 |
* Get the context data. |
| 60 |
* |
| 61 |
* @since 1.9 |
| 62 |
* |
| 63 |
* @return array { |
| 64 |
* The formated data. |
| 65 |
* |
| 66 |
* @type string $count-optimized Number of media optimized. |
| 67 |
* @type string $count-errors Number of media having an optimization error, with a link to the page listing the optimization errors. |
| 68 |
* @type string $optimized-size Optimized filesize. |
| 69 |
* @type string $original-size Original filesize. |
| 70 |
* } |
| 71 |
*/ |
| 72 |
public function get_context_data() { |
| 73 |
$data = [ |
| 74 |
'count-optimized' => 0, |
| 75 |
'count-errors' => 0, |
| 76 |
'optimized-size' => 0, |
| 77 |
'original-size' => 0, |
| 78 |
'errors_url' => get_imagify_admin_url( 'folder-errors', 'noop' ), |
| 79 |
]; |
| 80 |
|
| 81 |
return $this->format_context_data( $data ); |
| 82 |
} |
| 83 |
} |
| 84 |
|