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
← All changes | inc/main.php +14 -148 3.11.31.0.4 View file →
@@ -12,36 +12,24 @@
12 12 * @since 1.0.0
13 13 */
14 14 private static $_instance = null;
15 15
16 -
17 16 /**
18 - * Holds the manager class.
17 + * Holds the replacer class.
19 18 *
20 19 * @access public
21 20 * @since 1.0.0
22 - * @var Optml_Manager Manager instance.
21 + * @var Optml_Replacer Replacer instance.
23 22 */
24 - public $manager;
25 -
23 + public $replacer;
26 24 /**
27 - * Holds the media_offload class.
25 + * Holds the replacer class.
28 26 *
29 27 * @access public
30 28 * @since 1.0.0
31 - * @var Optml_Media_Offload instance.
29 + * @var Optml_Rest Replacer instance.
32 30 */
33 - public $media_offload;
34 -
35 - /**
36 - * Holds the rest class.
37 - *
38 - * @access public
39 - * @since 1.0.0
40 - * @var Optml_Rest REST instance.
41 - */
42 31 public $rest;
43 -
44 32 /**
45 33 * Holds the admin class.
46 34 *
47 35 * @access public
@@ -50,31 +38,13 @@
50 38 */
51 39 public $admin;
52 40
53 41 /**
54 - * Holds the Dam class.
55 - *
56 - * @access public
57 - * @since 4.0
58 - * @var Optml_Dam Dam instance.
59 - */
60 - public $dam;
61 -
62 - /**
63 - * Holds the cli class.
64 - *
65 - * @access public
66 - * @since 1.0.0
67 - * @var Optml_Cli Cli instance.
68 - */
69 - public $cli;
70 -
71 - /**
72 42 * Optml_Main constructor.
73 43 */
74 44 public function __construct() {
75 - register_activation_hook( OPTML_BASEFILE, [ $this, 'activate' ] );
76 - register_deactivation_hook( OPTML_BASEFILE, [ $this, 'deactivate' ] );
45 +
46 + register_activation_hook( OPTML_BASEFILE, array( $this, 'activate' ) );
77 47 }
78 48
79 49 /**
80 50 * Main Starter_Plugin Instance
@@ -80,116 +50,23 @@
80 50 * Main Starter_Plugin Instance
81 51 *
82 52 * Ensures only one instance of Starter_Plugin is loaded or can be loaded.
83 53 *
54 + * @since 1.0.0
84 55 * @return Optml_Main Plugin instance.
85 - * @since 1.0.0
86 56 */
87 57 public static function instance() {
88 - if ( null === self::$_instance ) {
89 - add_filter( 'themeisle_sdk_products', [ __CLASS__, 'register_sdk' ] );
90 - add_filter( 'themeisle_sdk_ran_promos', '__return_true' );
91 - add_filter( 'optimole-wp_uninstall_feedback_icon', [ __CLASS__, 'change_icon' ] );
92 - add_filter( 'optimole_wp_uninstall_feedback_after_css', [ __CLASS__, 'adds_uf_css' ] );
93 - add_filter( 'optimole_wp_feedback_review_message', [ __CLASS__, 'change_review_message' ] );
94 - add_filter( 'optimole_wp_logger_heading', [ __CLASS__, 'change_review_message' ] );
95 - add_filter( 'optml_register_conflicts', [ __CLASS__, 'register_conflicts' ] );
96 - self::$_instance = new self();
97 - self::$_instance->manager = Optml_Manager::instance();
98 - self::$_instance->rest = new Optml_Rest();
99 - self::$_instance->admin = new Optml_Admin();
100 - self::$_instance->dam = new Optml_Dam();
101 - self::$_instance->media_offload = Optml_Media_Offload::instance();
102 - if ( class_exists( 'WP_CLI' ) ) {
103 - self::$_instance->cli = new Optml_Cli();
104 - }
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();
105 63 }
106 - $vendor_file = OPTML_PATH . 'vendor/autoload.php';
107 - if ( is_readable( $vendor_file ) ) {
108 - include_once $vendor_file;
109 - }
110 64
111 65 return self::$_instance;
112 66 }
113 67
114 68 /**
115 - * Register Conflicts to watch for
116 - *
117 - * @param array $conflicts_to_register A list of class names of conflicts to register.
118 - *
119 - * @return array
120 - * @since 2.0.6
121 - * @access public
122 - */
123 - public static function register_conflicts( $conflicts_to_register = [] ) {
124 - $conflicts_to_register = array_merge(
125 - $conflicts_to_register,
126 - [
127 - 'Optml_Jetpack_Photon',
128 - 'Optml_Jetpack_Lazyload',
129 - 'Optml_Wprocket',
130 - 'Optml_Divi',
131 - 'Optml_w3_total_cache_cdn',
132 - ]
133 - );
134 -
135 - return $conflicts_to_register;
136 - }
137 -
138 - /**
139 - * Change review message.
140 - *
141 - * @param string $message Old review message.
142 - *
143 - * @return string New review message.
144 - */
145 - public static function change_review_message( $message ) {
146 - return str_replace( '{product}', 'Optimole', $message );
147 - }
148 -
149 - /**
150 - * Register product into SDK.
151 - *
152 - * @param array $products All products.
153 - *
154 - * @return array Registered product.
155 - */
156 - public static function register_sdk( $products ) {
157 - $products[] = OPTML_BASEFILE;
158 -
159 - return $products;
160 - }
161 -
162 - /**
163 - * Adds aditional CSS for uninstall feedback popup.
164 - */
165 - public static function adds_uf_css() {
166 - ?>
167 - <style type="text/css">
168 - body.plugins-php .optimole_wp-container #TB_title {
169 - background-position: 30px 10px;
170 - background-size: 80px;
171 - }
172 -
173 - body.plugins-php .optimole_wp-container input.button:hover,
174 - body.plugins-php .optimole_wp-container input.button {
175 - background: #5080C1;
176 - }
177 - </style>
178 - <?php
179 - }
180 -
181 - /**
182 - * Change icon for uninstall feedback.
183 - *
184 - * @return string Registered product.
185 - */
186 - public static function change_icon( $old_icon ) {
187 -
188 - return OPTML_URL . 'assets/img/logo.png';
189 - }
190 -
191 - /**
192 69 * Load the localisation file.
193 70 *
194 71 * @access public
195 72 * @since 1.0.0
@@ -204,8 +81,9 @@
204 81 * @access public
205 82 * @since 1.0.0
206 83 */
207 84 public function activate() {
85 +
208 86 update_option( OPTML_NAMESPACE . '-version', OPTML_VERSION );
209 87
210 88 if ( is_multisite() ) {
211 89 return;
@@ -211,20 +89,8 @@
211 89 return;
212 90 }
213 91
214 92 set_transient( 'optml_fresh_install', true, MINUTE_IN_SECONDS );
215 - }
216 -
217 - /**
218 - * Deactivate routine actions.
219 - *
220 - * @access public
221 - * @since 3.11.0
222 - */
223 - public function deactivate() {
224 - // Clear registered cron events.
225 - wp_clear_scheduled_hook( 'optml_daily_sync' );
226 - wp_clear_scheduled_hook( 'optml_pull_image_data_init' );
227 93 }
228 94
229 95 /**
230 96 * Cloning is forbidden.