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 +11 -135 2.5.51.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,17 +38,8 @@
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
@@ -62,132 +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', array( __CLASS__, 'register_sdk' ) );
72 - add_filter( 'optimole-wp_uninstall_feedback_icon', array( __CLASS__, 'change_icon' ) );
73 - add_filter( 'optimole_wp_uninstall_feedback_after_css', array( __CLASS__, 'adds_uf_css' ) );
74 - add_filter( 'optimole_wp_feedback_review_message', array( __CLASS__, 'change_review_message' ) );
75 - add_filter( 'optimole_wp_logger_heading', array( __CLASS__, 'change_review_message' ) );
76 - add_filter( 'optml_default_settings', array( __CLASS__, 'change_lazyload_default' ) );
77 - add_filter( 'optml_register_conflicts', array( __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 - if ( class_exists( 'WP_CLI' ) ) {
83 - self::$_instance->cli = new Optml_Cli();
84 - }
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();
85 63 }
86 - $vendor_file = OPTML_PATH . 'vendor/autoload.php';
87 - if ( is_readable( $vendor_file ) ) {
88 - include_once $vendor_file;
89 - }
90 64
91 65 return self::$_instance;
92 - }
93 -
94 - /**
95 - * Register Conflicts to watch for
96 - *
97 - * @param array $conflicts_to_register A list of class names of conflicts to register.
98 - *
99 - * @return array
100 - * @since 2.0.6
101 - * @access public
102 - */
103 - public static function register_conflicts( $conflicts_to_register = array() ) {
104 - $conflicts_to_register = array_merge(
105 - $conflicts_to_register,
106 - array(
107 - 'Optml_Elementor',
108 - 'Optml_Beaver',
109 - 'Optml_Jetpack_Photon',
110 - 'Optml_Jetpack_Lazyload',
111 - 'Optml_Wprocket',
112 - 'Optml_Divi',
113 - 'Optml_w3_total_cache_cdn',
114 - )
115 - );
116 -
117 - return $conflicts_to_register;
118 - }
119 -
120 - /**
121 - * Change lazyload default for new users.
122 - *
123 - * @param array $defaults Old defaults.
124 - *
125 - * @return array New defaults.
126 - */
127 - public static function change_lazyload_default( $defaults ) {
128 - $install_time = get_option( 'optimole_wp_install', 0 );
129 -
130 - if ( $install_time < 1545652321 ) {
131 - return $defaults;
132 - }
133 -
134 - $defaults['lazyload'] = 'enabled';
135 -
136 - return $defaults;
137 - }
138 -
139 - /**
140 - * Change review message.
141 - *
142 - * @param string $message Old review message.
143 - *
144 - * @return string New review message.
145 - */
146 - public static function change_review_message( $message ) {
147 - return str_replace( '{product}', 'Optimole', $message );
148 - }
149 -
150 - /**
151 - * Register product into SDK.
152 - *
153 - * @param array $products All products.
154 - *
155 - * @return array Registered product.
156 - */
157 - public static function register_sdk( $products ) {
158 - $products[] = OPTML_BASEFILE;
159 -
160 - return $products;
161 - }
162 -
163 - /**
164 - * Adds aditional CSS for uninstall feedback popup.
165 - */
166 - public static function adds_uf_css() {
167 - ?>
168 - <style type="text/css">
169 - body.plugins-php .optimole_wp-container #TB_title {
170 - background-position: 30px 10px;
171 - background-size: 80px;
172 - }
173 -
174 - body.plugins-php .optimole_wp-container input.button:hover,
175 - body.plugins-php .optimole_wp-container input.button {
176 - background: #5080C1;
177 - }
178 - </style>
179 - <?php
180 - }
181 -
182 - /**
183 - * Change icon for uninstall feedback.
184 - *
185 - * @return string Registered product.
186 - */
187 - public static function change_icon( $old_icon ) {
188 -
189 - return OPTML_URL . 'assets/img/logo.png';
190 66 }
191 67
192 68 /**
193 69 * Load the localisation file.