PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 1.10
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v1.10
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 / inc / 3rd-party / nextgen-gallery / classes / Context / NGG.php

NGG.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 1.10, at inc/3rd-party/nextgen-gallery/classes/Context/NGG.php

129 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Imagify\ThirdParty\NGG\Context;
3
4 defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
5
6 /**
7 * Context class used for the WP media library.
8 *
9 * @since 1.9
10 * @author Grégory Viguier
11 */
12 class NGG extends \Imagify\Context\AbstractContext {
13 use \Imagify\Traits\InstanceGetterTrait;
14
15 /**
16 * Context "short name".
17 *
18 * @var string
19 * @since 1.9
20 * @access protected
21 * @author Grégory Viguier
22 */
23 protected $context = 'ngg';
24
25 /**
26 * Type of files this context allows.
27 *
28 * @var string Possible values are:
29 * - 'all' to allow all types.
30 * - 'image' to allow only images.
31 * - 'not-image' to allow only pdf files.
32 * @since 1.9
33 * @access protected
34 * @see imagify_get_mime_types()
35 * @author Grégory Viguier
36 */
37 protected $allowed_mime_types = 'image';
38
39 /**
40 * The thumbnail sizes for this context, except the full size.
41 *
42 * @var array {
43 * Data for the currently registered thumbnail sizes.
44 * Size names are used as array keys.
45 *
46 * @type int $width The image width.
47 * @type int $height The image height.
48 * @type bool $crop True to crop, false to resize.
49 * @type string $name The size name.
50 * }
51 * @since 1.9
52 * @access public
53 * @author Grégory Viguier
54 */
55 protected $thumbnail_sizes = [];
56
57 /**
58 * Tell if the optimization process is allowed to backup in this context.
59 *
60 * @var bool
61 * @since 1.9
62 * @access protected
63 * @author Grégory Viguier
64 */
65 protected $can_backup = true;
66
67 /**
68 * Tell if the optimization process is allowed to keep exif in this context.
69 *
70 * @var bool
71 * @since 1.9
72 * @access protected
73 * @author Grégory Viguier
74 */
75 protected $can_keep_exif = true;
76
77 /**
78 * Get images max width for this context. This is used when resizing.
79 * 0 means to not resize.
80 *
81 * @since 1.9.8
82 * @access public
83 * @author Grégory Viguier
84 *
85 * @return int
86 */
87 public function get_resizing_threshold() {
88 return 0;
89 }
90
91 /**
92 * Get user capacity to operate Imagify in this context.
93 *
94 * @since 1.9
95 * @access public
96 * @author Grégory Viguier
97 *
98 * @param string $describer Capacity describer. Possible values are like 'manage', 'bulk-optimize', 'manual-optimize', 'auto-optimize'.
99 * @return string
100 */
101 public function get_capacity( $describer = 'manage' ) {
102 switch ( $describer ) {
103 case 'manage':
104 $capacity = 'NextGEN Change options';
105 break;
106
107 case 'bulk-optimize':
108 $capacity = 'NextGEN Manage others gallery';
109 break;
110
111 case 'optimize':
112 case 'restore':
113 case 'manual-optimize':
114 case 'manual-restore':
115 $capacity = 'NextGEN Manage gallery';
116 break;
117
118 case 'auto-optimize':
119 $capacity = 'NextGEN Upload images';
120 break;
121
122 default:
123 $capacity = $describer;
124 }
125
126 return $this->filter_capacity( $capacity, $describer );
127 }
128 }
129