PluginProbe
Image Optimization – Compress Images and Convert to WebP or AVIF / 1.6.6
Image Optimization – Compress Images and Convert to WebP or AVIF v1.6.6
1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 All 32 releases
image-optimization / modules / connect-manager / module.php

module.php in Image Optimization – Compress Images and Convert to WebP or AVIF 1.6.6, at modules/connect-manager/module.php

78 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImageOptimization\Modules\ConnectManager;
4
5 use ImageOptimization;
6 use ImageOptimization\Classes\{
7 Module_Base,
8 };
9
10 use ImageOptimization\Modules\ConnectManager\Classes\Connect_Runner;
11
12 use ImageOptimization\Modules\ConnectManager\Components\Legacy_Connect;
13 use ImageOptimization\Modules\ConnectManager\Components\Connect;
14
15 use ImageOptimization\Plugin;
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit; // Exit if accessed directly
19 }
20
21 /**
22 * Class Module
23 */
24 class Module extends Module_Base {
25
26 /**
27 * Connect instance
28 *
29 * @var connect_instance
30 */
31 public $connect_instance;
32
33 /**
34 * Get module name.
35 * Retrieve the module name.
36 * @access public
37 * @return string Module name.
38 */
39 public function get_name() {
40 return 'connect-manager';
41 }
42
43 /**
44 * component_list
45 * @return string[]
46 */
47 public static function component_list() : array {
48 return [
49 'Legacy_Connect',
50 'Connect',
51 ];
52 }
53
54 public function __construct() {
55 // Register components.
56 $this->register_components();
57 // Load Connect Manager.
58 add_action( 'plugins_loaded', [ $this, 'load_connect_manager' ] );
59 }
60
61 /**
62 * Load Connect Manager
63 *
64 * Load the correct version of Connect Manager based on whether
65 * the user is already connected using legacy version or not.
66 *
67 * @return void
68 */
69 public function load_connect_manager() {
70
71 if ( ImageOptimization\Modules\Connect\Module::is_active() ) {
72 $this->connect_instance = new Connect_Runner( new Connect() );
73 } else {
74 $this->connect_instance = new Connect_Runner( new Legacy_Connect() );
75 }
76 }
77 }
78