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-abstract-background-process.php +21 -67 1.10 → trunk View file →
@@ -1,81 +1,46 @@
1 1 <?php
2 -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3 2
3 +use Imagify\Traits\InstanceGetterTrait;
4 +
4 5 /**
5 6 * Class handling background processes.
6 7 *
7 8 * @since 1.8.1
8 - * @author Grégory Viguier
9 9 */
10 10 abstract class Imagify_Abstract_Background_Process extends Imagify_WP_Background_Process {
11 + use InstanceGetterTrait;
11 12
12 13 /**
13 - * Class version.
14 + * Prefix used to build the global process identifier.
14 15 *
15 - * @var string
16 - * @since 1.8.1
17 - * @author Grégory Viguier
16 + * @var string
17 + * @since 1.8.1
18 18 */
19 - const VERSION = '1.1';
19 + protected $prefix = 'imagify';
20 20
21 21 /**
22 - * Prefix used to build the global process identifier.
22 + * URL to query on.
23 23 *
24 - * @var string
25 - * @since 1.8.1
26 - * @access protected
27 - * @author Grégory Viguier
24 + * @var string
28 25 */
29 - protected $prefix = 'imagify';
26 + protected $query_url = '';
30 27
31 28 /**
32 29 * Set to true to automatically displatch at the end of the page.
33 30 *
34 - * @var bool
35 - * @since 1.9
36 - * @access protected
37 - * @see $this->save()
38 - * @see $this->maybe_save_and_dispatch()
39 - * @author Grégory Viguier
31 + * @var bool
32 + * @since 1.9
33 + * @see $this->save()
34 + * @see $this->maybe_save_and_dispatch()
40 35 */
41 36 protected $auto_dispatch = false;
42 37
43 38 /**
44 - * The single instance of the class.
45 - *
46 - * @var object
47 - * @since 1.8.1
48 - * @access protected
49 - * @author Grégory Viguier
50 - */
51 - protected static $_instance;
52 -
53 -
54 - /**
55 - * Get the main Instance.
56 - *
57 - * @since 1.8.1
58 - * @access public
59 - * @author Grégory Viguier
60 - *
61 - * @return object Main instance.
62 - */
63 - public static function get_instance() {
64 - if ( ! isset( static::$_instance ) ) {
65 - static::$_instance = new static();
66 - }
67 -
68 - return static::$_instance;
69 - }
70 -
71 - /**
72 39 * Init: launch a hook that will clear the scheduled events and empty the queue when the plugin is disabled.
73 40 * This is only a precaution in case something went wrong.
74 41 *
75 - * @since 1.8.1
76 - * @access public
77 - * @author Grégory Viguier
42 + * @since 1.8.1
78 43 */
79 44 public function init() {
80 45 $this->query_url = admin_url( 'admin-ajax.php' );
81 46
@@ -81,10 +46,9 @@
81 46
82 47 /**
83 48 * Filter the URL to use for background processes.
84 49 *
85 - * @since 1.9.5
86 - * @author Grégory Viguier
50 + * @since 1.9.5
87 51 *
88 52 * @param string $query_url An URL.
89 53 * @param object $this This class instance.
90 54 */
@@ -114,11 +78,9 @@
114 78 * Cancel Process.
115 79 * Stop processing queue items, clear cronjob and delete batch.
116 80 * This is a copy of the parent's method, in case an older version of WP_Background_Process is loaded instead of this one (an old version without this method).
117 81 *
118 - * @since 1.8.1
119 - * @access public
120 - * @author Grégory Viguier
82 + * @since 1.8.1
121 83 */
122 84 public function cancel_process() {
123 85 if ( method_exists( $this, 'cancel_process' ) ) {
124 86 parent::cancel_process();
@@ -137,11 +99,9 @@
137 99 /**
138 100 * Save the queen. No, I meant the queue.
139 101 * Also empty the queue to avoid to create several batches with the same items.
140 102 *
141 - * @since 1.9
142 - * @access public
143 - * @author Grégory Viguier
103 + * @since 1.9
144 104 *
145 105 * @return $this
146 106 */
147 107 public function save() {
@@ -164,11 +124,9 @@
164 124
165 125 /**
166 126 * Save and dispatch if the queue is not empty.
167 127 *
168 - * @since 1.9
169 - * @access public
170 - * @author Grégory Viguier
128 + * @since 1.9
171 129 */
172 130 public function maybe_save_and_dispatch() {
173 131 $this->save();
174 132
@@ -179,11 +137,9 @@
179 137
180 138 /**
181 139 * Get the cron name.
182 140 *
183 - * @since 1.8.1
184 - * @access public
185 - * @author Grégory Viguier
141 + * @since 1.8.1
186 142 *
187 143 * @return string
188 144 */
189 145 public function get_event_name() {
@@ -192,11 +148,9 @@
192 148
193 149 /**
194 150 * Get the deactivation hook name.
195 151 *
196 - * @since 1.8.1
197 - * @access public
198 - * @author Grégory Viguier
152 + * @since 1.8.1
199 153 *
200 154 * @return string
201 155 */
202 156 public static function get_deactivation_hook_name() {