PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.2.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.2.2
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 / Context / ContextInterface.php

ContextInterface.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.2.2, at classes/Context/ContextInterface.php

142 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Imagify\Context;
3
4 /**
5 * Interface to use for contexts.
6 *
7 * @since 1.9
8 * @author Grégory Viguier
9 */
10 interface ContextInterface {
11
12 /**
13 * Get the main Instance.
14 *
15 * @since 1.9
16 * @author Grégory Viguier
17 *
18 * @return object Main instance.
19 */
20 public static function get_instance();
21
22 /**
23 * Get the context "short name".
24 *
25 * @since 1.9
26 * @author Grégory Viguier
27 *
28 * @return string
29 */
30 public function get_name();
31
32 /**
33 * Tell if the context is network-wide.
34 *
35 * @since 1.9
36 * @author Grégory Viguier
37 *
38 * @return bool
39 */
40 public function is_network_wide();
41
42 /**
43 * Get the type of files this context allows.
44 *
45 * @since 1.9
46 * @see imagify_get_mime_types()
47 * @author Grégory Viguier
48 *
49 * @return string Possible values are:
50 * - 'all' to allow all types.
51 * - 'image' to allow only images.
52 * - 'not-image' to allow only pdf files.
53 */
54 public function get_allowed_mime_types();
55
56 /**
57 * Get the thumbnail sizes for this context, except the full size.
58 *
59 * @since 1.9
60 * @author Grégory Viguier
61 *
62 * @return array {
63 * Data for the currently registered thumbnail sizes.
64 * Size names are used as array keys.
65 *
66 * @type int $width The image width.
67 * @type int $height The image height.
68 * @type bool $crop True to crop, false to resize.
69 * @type string $name The size name.
70 * }
71 */
72 public function get_thumbnail_sizes();
73
74 /**
75 * Get images max width for this context. This is used when resizing.
76 * 0 means to not resize.
77 *
78 * @since 1.9.8
79 * @author Grégory Viguier
80 *
81 * @return int
82 */
83 public function get_resizing_threshold();
84
85 /**
86 * Tell if the optimization process is allowed resize in this context.
87 *
88 * @since 1.9
89 * @author Grégory Viguier
90 *
91 * @return bool
92 */
93 public function can_resize();
94
95 /**
96 * Tell if the optimization process is allowed to backup in this context.
97 *
98 * @since 1.9
99 * @author Grégory Viguier
100 *
101 * @return bool
102 */
103 public function can_backup();
104
105 /**
106 * Tell if the current user is allowed to operate Imagify in this context.
107 *
108 * @since 1.9
109 * @author Grégory Viguier
110 *
111 * @param string $describer Capacity describer. See $this->get_capacity() for possible values. Can also be a "real" user capacity.
112 * @param int $media_id A media ID.
113 * @return bool
114 */
115 public function current_user_can( $describer, $media_id = null );
116
117 /**
118 * Tell if a user is allowed to operate Imagify in this context.
119 *
120 * @since 1.9
121 * @author Grégory Viguier
122 *
123 * @param int $user_id A user ID.
124 * @param string $describer Capacity describer. See $this->get_capacity() for possible values. Can also be a "real" user capacity.
125 * @param int $media_id A media ID.
126 * @return bool
127 */
128 public function user_can( $user_id, $describer, $media_id = null );
129
130 /**
131 * Get user capacity to operate Imagify in this context.
132 *
133 * @since 1.9
134 * @since 1.9 The describer 'auto-optimize' is not used anymore.
135 * @author Grégory Viguier
136 *
137 * @param string $describer Capacity describer. Possible values are like 'manage', 'bulk-optimize', 'manual-optimize', 'auto-optimize'.
138 * @return string
139 */
140 public function get_capacity( $describer );
141 }
142