PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.4.1
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.4.1
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 / module.php

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

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