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 +12 -137 3.0.01.0.4 View file →
@@ -12,27 +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 rest class.
25 + * Holds the replacer class.
28 26 *
29 27 * @access public
30 28 * @since 1.0.0
31 - * @var Optml_Rest REST instance.
29 + * @var Optml_Rest Replacer instance.
32 30 */
33 31 public $rest;
34 -
35 32 /**
36 33 * Holds the admin class.
37 34 *
38 35 * @access public
@@ -41,22 +38,13 @@
41 38 */
42 39 public $admin;
43 40
44 41 /**
45 - * Holds the cli class.
46 - *
47 - * @access public
48 - * @since 1.0.0
49 - * @var Optml_Cli Cli instance.
50 - */
51 - public $cli;
52 -
53 - /**
54 42 * Optml_Main constructor.
55 43 */
56 44 public function __construct() {
57 45
58 - register_activation_hook( OPTML_BASEFILE, [ $this, 'activate' ] );
46 + register_activation_hook( OPTML_BASEFILE, array( $this, 'activate' ) );
59 47 }
60 48
61 49 /**
62 50 * Main Starter_Plugin Instance
@@ -62,133 +50,20 @@
62 50 * Main Starter_Plugin Instance
63 51 *
64 52 * Ensures only one instance of Starter_Plugin is loaded or can be loaded.
65 53 *
54 + * @since 1.0.0
66 55 * @return Optml_Main Plugin instance.
67 - * @since 1.0.0
68 56 */
69 57 public static function instance() {
70 - if ( null === self::$_instance ) {
71 - add_filter( 'themeisle_sdk_products', [ __CLASS__, 'register_sdk' ] );
72 - add_filter( 'optimole-wp_uninstall_feedback_icon', [ __CLASS__, 'change_icon' ] );
73 - add_filter( 'optimole_wp_uninstall_feedback_after_css', [ __CLASS__, 'adds_uf_css' ] );
74 - add_filter( 'optimole_wp_feedback_review_message', [ __CLASS__, 'change_review_message' ] );
75 - add_filter( 'optimole_wp_logger_heading', [ __CLASS__, 'change_review_message' ] );
76 - add_filter( 'optml_default_settings', [ __CLASS__, 'change_lazyload_default' ] );
77 - add_filter( 'optml_register_conflicts', [ __CLASS__, 'register_conflicts' ] );
78 - self::$_instance = new self();
79 - self::$_instance->manager = Optml_Manager::instance();
80 - self::$_instance->rest = new Optml_Rest();
81 - self::$_instance->admin = new Optml_Admin();
82 - self::$_instance->media_offload = new Optml_Media_Offload();
83 - if ( class_exists( 'WP_CLI' ) ) {
84 - self::$_instance->cli = new Optml_Cli();
85 - }
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();
86 63 }
87 - $vendor_file = OPTML_PATH . 'vendor/autoload.php';
88 - if ( is_readable( $vendor_file ) ) {
89 - include_once $vendor_file;
90 - }
91 64
92 65 return self::$_instance;
93 - }
94 -
95 - /**
96 - * Register Conflicts to watch for
97 - *
98 - * @param array $conflicts_to_register A list of class names of conflicts to register.
99 - *
100 - * @return array
101 - * @since 2.0.6
102 - * @access public
103 - */
104 - public static function register_conflicts( $conflicts_to_register = [] ) {
105 - $conflicts_to_register = array_merge(
106 - $conflicts_to_register,
107 - [
108 - 'Optml_Elementor',
109 - 'Optml_Beaver',
110 - 'Optml_Jetpack_Photon',
111 - 'Optml_Jetpack_Lazyload',
112 - 'Optml_Wprocket',
113 - 'Optml_Divi',
114 - 'Optml_w3_total_cache_cdn',
115 - ]
116 - );
117 -
118 - return $conflicts_to_register;
119 - }
120 -
121 - /**
122 - * Change lazyload default for new users.
123 - *
124 - * @param array $defaults Old defaults.
125 - *
126 - * @return array New defaults.
127 - */
128 - public static function change_lazyload_default( $defaults ) {
129 - $install_time = get_option( 'optimole_wp_install', 0 );
130 -
131 - if ( $install_time < 1545652321 ) {
132 - return $defaults;
133 - }
134 -
135 - $defaults['lazyload'] = 'enabled';
136 -
137 - return $defaults;
138 - }
139 -
140 - /**
141 - * Change review message.
142 - *
143 - * @param string $message Old review message.
144 - *
145 - * @return string New review message.
146 - */
147 - public static function change_review_message( $message ) {
148 - return str_replace( '{product}', 'Optimole', $message );
149 - }
150 -
151 - /**
152 - * Register product into SDK.
153 - *
154 - * @param array $products All products.
155 - *
156 - * @return array Registered product.
157 - */
158 - public static function register_sdk( $products ) {
159 - $products[] = OPTML_BASEFILE;
160 -
161 - return $products;
162 - }
163 -
164 - /**
165 - * Adds aditional CSS for uninstall feedback popup.
166 - */
167 - public static function adds_uf_css() {
168 - ?>
169 - <style type="text/css">
170 - body.plugins-php .optimole_wp-container #TB_title {
171 - background-position: 30px 10px;
172 - background-size: 80px;
173 - }
174 -
175 - body.plugins-php .optimole_wp-container input.button:hover,
176 - body.plugins-php .optimole_wp-container input.button {
177 - background: #5080C1;
178 - }
179 - </style>
180 - <?php
181 - }
182 -
183 - /**
184 - * Change icon for uninstall feedback.
185 - *
186 - * @return string Registered product.
187 - */
188 - public static function change_icon( $old_icon ) {
189 -
190 - return OPTML_URL . 'assets/img/logo.png';
191 66 }
192 67
193 68 /**
194 69 * Load the localisation file.