PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / trunk
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF vtrunk
2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / includes / classes / processing / class-rio-folder-processing.php
robin-image-optimizer / includes / classes / processing Last commit date
class-rio-folder-processing.php 5 months ago class-rio-media-processing-avif.php 3 months ago class-rio-media-processing-webp.php 3 months ago class-rio-media-processing.php 3 months ago class-rio-nextgen-processing.php 5 months ago class-rio-processing.php 5 months ago
class-rio-folder-processing.php
56 lines
1 <?php
2
3 use WBCR\Factory_Processing_759\WP_Background_Process;
4
5 // Exit if accessed directly
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit;
8 }
9
10 /**
11 * Класс для работы оптимизации в фоне
12 *
13 * @version 1.0
14 */
15 class WRIO_Folder_Processing extends WRIO_Processing {
16
17 /**
18 * @return int Count of pushed queue
19 */
20 public function push_items() {
21 $attachment_ids = [];
22 if ( $this->scope === 'custom-folders' ) {
23 $cf = WRIO_Custom_Folders::get_instance();
24 $attachment_ids = $cf->getUnoptimizedImages();
25 }
26
27 foreach ( $attachment_ids as $attachment_id ) {
28 $this->push_to_queue( $attachment_id );
29 }
30
31 return $this->count_queue();
32 }
33
34 /**
35 * Метод оптимизирует изображения при выполнении задачи
36 *
37 * @param int $image
38 *
39 * @return bool
40 */
41 protected function task( $image ) {
42 if ( $image ) {
43 WRIO_Plugin::app()->logger->info( sprintf( 'Start optimize custom folder image: %s', $image ) );
44
45 if ( $this->scope === 'custom-folders' ) {
46 $cf = WRIO_Custom_Folders::get_instance();
47 $result = $cf->optimizeImage( $image );
48 }
49
50 WRIO_Plugin::app()->logger->info( sprintf( 'End optimize custom folder image: %s', $image ) );
51 }
52
53 return false;
54 }
55 }
56