PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 4.2.8
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v4.2.8
4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 3.12.1 All 134 releases
optimole-wp / inc / v2 / Offload / Loader.php

Loader.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 4.2.8, at inc/v2/Offload/Loader.php

48 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace OptimoleWP\Offload;
4
5 /**
6 * Class Loader
7 *
8 * Handles the registration of custom image editors for the Optimole WordPress plugin.
9 * This class is responsible for integrating Optimole's custom image processing
10 * capabilities into WordPress's image editing system.
11 *
12 * @package OptimoleWP\Offload
13 */
14 class Loader {
15
16 /**
17 * Constructor for the Loader class.
18 */
19 public function __construct() {
20 }
21
22 /**
23 * Register WordPress hooks needed for the image editor functionality.
24 *
25 * Adds filters to integrate the custom image editor into WordPress.
26 */
27 public function register_hooks() {
28 if ( has_filter( 'wp_image_editors', 'photon_subsizes_override_image_editors' ) ) {
29 return;
30 }
31 add_filter( 'wp_image_editors', [ $this, 'register_image_editor' ] );
32 }
33
34 /**
35 * Register the custom ImageEditor class to WordPress's image editors list.
36 *
37 * Adds Optimole's custom ImageEditor to the beginning of WordPress's image editors array,
38 * giving it priority over the default editors.
39 *
40 * @param array $editors Array of image editor class names.
41 * @return array Modified array of image editor class names.
42 */
43 public function register_image_editor( $editors ) {
44 array_unshift( $editors, ImageEditor::class );
45 return $editors;
46 }
47 }
48