PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
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
← All changes | inc/classes/class-imagify-data.php +7 -32 1.10 → trunk View file →
@@ -1,7 +1,8 @@
1 1 <?php
2 -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3 2
3 +use Imagify\Traits\InstanceGetterTrait;
4 +
4 5 /**
5 6 * Class that handles the plugin data.
6 7 *
7 8 * @since 1.7
@@ -6,8 +7,9 @@
6 7 *
7 8 * @since 1.7
8 9 */
9 10 class Imagify_Data extends Imagify_Abstract_Options {
11 + use InstanceGetterTrait;
10 12
11 13 /**
12 14 * Class version.
13 15 *
@@ -33,41 +35,14 @@
33 35 * @var array
34 36 * @since 1.7
35 37 * @access protected
36 38 */
37 - protected $default_values = array(
39 + protected $default_values = [
38 40 'total_size_images_library' => 0.0,
39 41 'average_size_images_per_month' => 0.0,
40 42 'previous_quota_percent' => 0.0,
41 - );
43 + ];
42 44
43 - /**
44 - * The single instance of the class.
45 - *
46 - * @var object
47 - * @since 1.7
48 - * @access protected
49 - */
50 - protected static $_instance;
51 -
52 - /**
53 - * Get the main Instance.
54 - *
55 - * @since 1.7
56 - * @author Grégory Viguier
57 - * @access public
58 - *
59 - * @return object Main instance.
60 - */
61 - public static function get_instance() {
62 - if ( ! isset( self::$_instance ) ) {
63 - self::$_instance = new self();
64 - }
65 -
66 - return self::$_instance;
67 - }
68 -
69 -
70 45 /** ----------------------------------------------------------------------------------------- */
71 46 /** SANITIZATION, VALIDATION ================================================================ */
72 47 /** ----------------------------------------------------------------------------------------- */
73 48
@@ -79,12 +54,12 @@
79 54 * @access public
80 55 *
81 56 * @param string $key The option key.
82 57 * @param mixed $value The value.
83 - * @param mixed $default The default value.
58 + * @param mixed $default_value The default value.
84 59 * @return mixed
85 60 */
86 - public function sanitize_and_validate_value( $key, $value, $default ) {
61 + public function sanitize_and_validate_value( $key, $value, $default_value ) {
87 62 switch ( $key ) {
88 63 case 'total_size_images_library':
89 64 case 'average_size_images_per_month':
90 65 if ( $value <= 0 ) {