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 / Noop.php

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

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