PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 1.0.4
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v1.0.4
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 / main.php

main.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 1.0.4, at inc/main.php

116 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Main Plugin Class
5 */
6 final class Optml_Main {
7 /**
8 * Optml_Main The single instance of Starter_Plugin.
9 *
10 * @var object
11 * @access private
12 * @since 1.0.0
13 */
14 private static $_instance = null;
15
16 /**
17 * Holds the replacer class.
18 *
19 * @access public
20 * @since 1.0.0
21 * @var Optml_Replacer Replacer instance.
22 */
23 public $replacer;
24 /**
25 * Holds the replacer class.
26 *
27 * @access public
28 * @since 1.0.0
29 * @var Optml_Rest Replacer instance.
30 */
31 public $rest;
32 /**
33 * Holds the admin class.
34 *
35 * @access public
36 * @since 1.0.0
37 * @var Optml_Admin Admin instance.
38 */
39 public $admin;
40
41 /**
42 * Optml_Main constructor.
43 */
44 public function __construct() {
45
46 register_activation_hook( OPTML_BASEFILE, array( $this, 'activate' ) );
47 }
48
49 /**
50 * Main Starter_Plugin Instance
51 *
52 * Ensures only one instance of Starter_Plugin is loaded or can be loaded.
53 *
54 * @since 1.0.0
55 * @return Optml_Main Plugin instance.
56 */
57 public static function instance() {
58 if ( is_null( self::$_instance ) ) {
59 self::$_instance = new self();
60 self::$_instance->replacer = Optml_Replacer::instance();
61 self::$_instance->rest = new Optml_Rest();
62 self::$_instance->admin = new Optml_Admin();
63 }
64
65 return self::$_instance;
66 }
67
68 /**
69 * Load the localisation file.
70 *
71 * @access public
72 * @since 1.0.0
73 */
74 public function load_plugin_textdomain() {
75 load_plugin_textdomain( 'optimole-wp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
76 }
77
78 /**
79 * Install routine actions.
80 *
81 * @access public
82 * @since 1.0.0
83 */
84 public function activate() {
85
86 update_option( OPTML_NAMESPACE . '-version', OPTML_VERSION );
87
88 if ( is_multisite() ) {
89 return;
90 }
91
92 set_transient( 'optml_fresh_install', true, MINUTE_IN_SECONDS );
93 }
94
95 /**
96 * Cloning is forbidden.
97 *
98 * @access public
99 * @since 1.0.0
100 */
101 public function __clone() {
102 _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'optimole-wp' ), '1.0.0' );
103 }
104
105 /**
106 * Unserializing instances of this class is forbidden.
107 *
108 * @access public
109 * @since 1.0.0
110 */
111 public function __wakeup() {
112 _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'optimole-wp' ), '1.0.0' );
113 }
114
115 }
116