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 / module.php

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

69 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 ImageOptimization\Modules\Connect;
4
5 use ImageOptimization\Classes\Module_Base;
6 use ImageOptimization\Modules\Connect\Classes\{
7 Data,
8 Utils,
9 };
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14
15 /**
16 * Class Module
17 */
18 class Module extends Module_Base {
19
20 /**
21 * Get module name.
22 * Retrieve the module name.
23 * @access public
24 * @return string Module name.
25 */
26 public function get_name() {
27 return 'connect';
28 }
29
30 /**
31 * component_list
32 * @return string[]
33 */
34 public static function component_list() : array {
35 return [
36 'Handler',
37 ];
38 }
39
40 /**
41 * routes_list
42 * @return string[]
43 */
44 public static function routes_list() : array {
45 return [
46 'Authorize',
47 'Disconnect',
48 'Deactivate',
49 'Deactivate_And_Disconnect',
50 'Version',
51 'Switch_Domain',
52 ];
53 }
54
55 public static function is_connected() : bool {
56 return ! ! Data::get_access_token() && Utils::is_valid_home_url();
57 }
58
59 public static function is_active() : bool {
60 // TODO: Add login to check if the function should be active or not.
61 return empty( get_option( 'image_optimizer_client_data' ) );
62 }
63
64 public function __construct() {
65 $this->register_components();
66 $this->register_routes();
67 }
68 }
69