PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.0
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.0
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / classes / Media / Subscriber.php

Subscriber.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.3.0, at classes/Media/Subscriber.php

53 lines 1020 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 declare(strict_types=1);
3
4 namespace Imagify\Media;
5
6 use Imagify\EventManagement\SubscriberInterface;
7 use Imagify\Media\Upload\Upload;
8
9 /**
10 * Media Subscriber
11 */
12 class Subscriber implements SubscriberInterface {
13
14 /**
15 * Upload instance.
16 *
17 * @var Upload
18 */
19 private $upload;
20 /**
21 * Constructor
22 *
23 * @param Upload $upload Upload Instance.
24 */
25 public function __construct( Upload $upload ) {
26 $this->upload = $upload;
27 }
28
29 /**
30 * Returns an array of events that this subscriber wants to listen to.
31 *
32 * @return array
33 */
34 public static function get_subscribed_events(): array {
35 return [
36 // @action
37 'restrict_manage_posts' => 'imagify_attachments_filter_dropdown',
38 ];
39 }
40
41 /**
42 * Adds a dropdown that allows filtering on the attachments Imagify status.
43 *
44 * @return void
45 */
46 public function imagify_attachments_filter_dropdown() {
47 if ( ! \Imagify_Views::get_instance()->is_wp_library_page() ) {
48 return;
49 }
50 $this->upload->add_imagify_filter_to_attachments_dropdown();
51 }
52 }
53