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-files-db.php +7 -31 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 * DB class that handles files in "custom folders".
6 7 *
7 8 * @since 1.7
@@ -7,8 +8,9 @@
7 8 * @since 1.7
8 9 * @author Grégory Viguier
9 10 */
10 11 class Imagify_Files_DB extends Imagify_Abstract_DB {
12 + use InstanceGetterTrait;
11 13
12 14 /**
13 15 * Class version.
14 16 *
@@ -16,17 +18,8 @@
16 18 */
17 19 const VERSION = '1.1';
18 20
19 21 /**
20 - * The single instance of the class.
21 - *
22 - * @var object
23 - * @since 1.7
24 - * @access protected
25 - */
26 - protected static $_instance;
27 -
28 - /**
29 22 * The suffix used in the name of the database table (so, without the wpdb prefix).
30 23 *
31 24 * @var string
32 25 * @since 1.7
@@ -61,25 +54,8 @@
61 54 */
62 55 protected $primary_key = 'file_id';
63 56
64 57 /**
65 - * Get the main Instance.
66 - *
67 - * @since 1.7
68 - * @access public
69 - * @author Grégory Viguier
70 - *
71 - * @return object Main instance.
72 - */
73 - public static function get_instance() {
74 - if ( ! isset( self::$_instance ) ) {
75 - self::$_instance = new self();
76 - }
77 -
78 - return self::$_instance;
79 - }
80 -
81 - /**
82 58 * Get the column placeholders.
83 59 *
84 60 * @since 1.7
85 61 * @access public
@@ -87,9 +63,9 @@
87 63 *
88 64 * @return array
89 65 */
90 66 public function get_columns() {
91 - return array(
67 + return [
92 68 'file_id' => '%d',
93 69 'folder_id' => '%d',
94 70 'file_date' => '%s',
95 71 'path' => '%s',
@@ -104,9 +80,9 @@
104 80 'optimization_level' => '%d',
105 81 'status' => '%s',
106 82 'error' => '%s',
107 83 'data' => '%s',
108 - );
84 + ];
109 85 }
110 86
111 87 /**
112 88 * Default column values.
@@ -117,9 +93,9 @@
117 93 *
118 94 * @return array
119 95 */
120 96 public function get_column_defaults() {
121 - return array(
97 + return [
122 98 'file_id' => 0,
123 99 'folder_id' => 0,
124 100 'file_date' => '0000-00-00 00:00:00',
125 101 'path' => '',
@@ -134,9 +110,9 @@
134 110 'optimization_level' => null,
135 111 'status' => null,
136 112 'error' => null,
137 113 'data' => [],
138 - );
114 + ];
139 115 }
140 116
141 117 /**
142 118 * Get the query to create the table fields.