PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | minify/class-wp-optimize-minify-preloader.php +54 -17 3.4.1 → 4.7.0 View file →
@@ -31,9 +31,9 @@
31 31 public function is_option_active() {
32 32 if (!function_exists('wp_optimize_minify_config')) {
33 33 include_once WPO_PLUGIN_MAIN_PATH . 'minify/class-wp-optimize-minify-config.php';
34 34 }
35 - return wp_optimize_minify_config()->get('enabled');
35 + return (bool) wp_optimize_minify_config()->get('enabled');
36 36 }
37 37
38 38 /**
39 39 * Add intervals to cron schedules.
@@ -115,8 +115,13 @@
115 115 'error' => __('Probably minify preload is running already.', 'wp-optimize')
116 116 );
117 117 }
118 118
119 + /**
120 + * Returns preload data
121 + *
122 + * @return array
123 + */
119 124 protected function get_preload_data() {
120 125 $cache_path = WP_Optimize_Minify_Cache_Functions::cache_path();
121 126 $cache_dir = $cache_path['cachedir'];
122 127 $minify_cache_data = array();
@@ -123,41 +128,73 @@
123 128 $minify_cache_data['size'] = esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats($cache_dir));
124 129 $minify_cache_data['total_size'] = esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats(WPO_CACHE_MIN_FILES_DIR));
125 130 return $minify_cache_data;
126 131 }
127 -
128 - protected function get_preloading_message($minify_cache_data) {
132 +
133 + /**
134 + * Returns preloading message
135 + *
136 + * @param array $data
137 + *
138 + * @return array
139 + */
140 + protected function get_preloading_message($data) {
129 141 return array(
130 142 'done' => false,
131 143 'message' => __('Loading URLs...', 'wp-optimize'),
132 - 'size' => WP_Optimize()->format_size($minify_cache_data['size']),
133 - 'total_size' => $minify_cache_data['total_size']
144 + 'size' => WP_Optimize()->format_size($data['size']),
145 + 'total_size' => $data['total_size']
134 146 );
135 147 }
136 -
137 - protected function get_last_preload_message($minify_cache_data, $last_preload_time_str) {
148 +
149 + /**
150 + * Returns last preload message
151 + *
152 + * @param array $data
153 + * @param string $last_preload_time_str
154 + *
155 + * @return array
156 + */
157 + protected function get_last_preload_message($data, $last_preload_time_str) {
138 158 return array(
139 159 'done' => true,
160 + // translators: %s: last preload time
140 161 'message' => sprintf(__('Last preload finished at %s', 'wp-optimize'), $last_preload_time_str),
141 - 'size' => WP_Optimize()->format_size($minify_cache_data['size']),
142 - 'total_size' => $minify_cache_data['total_size']
162 + 'size' => WP_Optimize()->format_size($data['size']),
163 + 'total_size' => $data['total_size']
143 164 );
144 165 }
145 -
146 - protected function get_preload_success_message($minify_cache_data) {
166 +
167 + /**
168 + * Returns preload success message
169 + *
170 + * @param array $data
171 + *
172 + * @return array
173 + */
174 + protected function get_preload_success_message($data) {
147 175 return array(
148 176 'done' => true,
149 - 'size' => WP_Optimize()->format_size($minify_cache_data['size']),
150 - 'total_size' => $minify_cache_data['total_size']
177 + 'size' => WP_Optimize()->format_size($data['size']),
178 + 'total_size' => $data['total_size']
151 179 );
152 180 }
153 -
154 - protected function get_preload_progress_message($minify_cache_data, $preloaded_message, $preload_resuming_in) {
181 +
182 + /**
183 + * Returns preload progress message
184 + *
185 + * @param array $data
186 + * @param string $preloaded_message
187 + * @param int $preload_resuming_in
188 + *
189 + * @return array
190 + */
191 + protected function get_preload_progress_message($data, $preloaded_message, $preload_resuming_in) {
155 192 return array(
156 193 'done' => false,
157 194 'message' => $preloaded_message,
158 - 'size' => WP_Optimize()->format_size($minify_cache_data['size']),
159 - 'total_size' => $minify_cache_data['total_size'],
195 + 'size' => WP_Optimize()->format_size($data['size']),
196 + 'total_size' => $data['total_size'],
160 197 'resume_in' => $preload_resuming_in
161 198 );
162 199 }
163 200 }