PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.9.8
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.9.8
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 1.9.8, at classes/Context/ContextInterface.php

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