PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.7.7
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.7.7
1.7.7 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 All 33 releases
image-optimization / modules / connect-manager / module.php

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

72 lines 1.4 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\Module_Base;
7
8 use ImageOptimization\Modules\ConnectManager\{
9 Classes\Connect_Runner,
10 Components\Legacy_Connect,
11 Components\Connect,
12 };
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly
16 }
17
18 /**
19 * Class Module
20 */
21 class Module extends Module_Base {
22
23 /**
24 * Connect instance
25 */
26 public $connect_instance;
27
28 /**
29 * Get module name.
30 * Retrieve the module name.
31 * @access public
32 * @return string Module name.
33 */
34 public function get_name() {
35 return 'connect-manager';
36 }
37
38 /**
39 * component_list
40 * @return string[]
41 */
42 public static function component_list(): array {
43 return [
44 'Legacy_Connect',
45 'Connect',
46 ];
47 }
48
49 public function __construct() {
50 // Register components.
51 $this->register_components();
52 // Load Connect Manager.
53 add_action( 'plugins_loaded', [ $this, 'load_connect_manager' ] );
54 }
55
56 /**
57 * Load Connect Manager
58 *
59 * Load the correct version of Connect Manager based on whether
60 * the user is already connected using legacy version or not.
61 *
62 * @return void
63 */
64 public function load_connect_manager() {
65 if ( ImageOptimization\Modules\Connect\Module::is_active() ) {
66 $this->connect_instance = new Connect_Runner( new Connect() );
67 } else {
68 $this->connect_instance = new Connect_Runner( new Legacy_Connect() );
69 }
70 }
71 }
72