PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 4.0.1
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v4.0.1
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 3.12.10 All 133 releases
optimole-wp / optimole-wp.php

optimole-wp.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 4.0.1, at optimole-wp.php

115 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Image optimization service by Optimole
4 * Description: Complete handling of your website images.
5 * Version: 4.0.1
6 * Author: Optimole
7 * Author URI: https://optimole.com
8 * License: GPL-2.0+
9 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
10 * Text Domain: optimole-wp
11 * Domain Path: /languages
12 * WordPress Available: yes
13 * Requires License: no
14 */
15
16 if ( ! defined( 'WPINC' ) ) {
17 die;
18 }
19 /**
20 * Autoloader function.
21 *
22 * @param string $class_name Class to load.
23 */
24 function optml_autoload( $class_name ) {
25 $prefix = 'Optml';
26 if ( strpos( $class_name, $prefix ) !== 0 ) {
27 return;
28 }
29 foreach ( [ '/inc/', '/inc/traits/', '/inc/image_properties/', '/inc/asset_properties/', '/inc/compatibilities/', '/inc/conflicts/', '/inc/cli/', '/inc/media_rename/' ] as $folder ) {
30 $file = str_replace( $prefix . '_', '', $class_name );
31 $file = strtolower( $file );
32 $file = __DIR__ . $folder . $file . '.php';
33 if ( file_exists( $file ) ) {
34 require $file;
35 }
36 }
37 }
38
39 /**
40 * Deactivates optimole plugin.
41 *
42 * Used when the user does not have the minimum PHP required version.
43 *
44 * @since 8.1.4
45 */
46 function optml_deactivate() {
47 if ( is_plugin_active( 'optimole-wp/optimole-wp.php' ) ) {
48 deactivate_plugins( 'optimole-wp/optimole-wp.php' );
49 }
50 }
51
52 /**
53 * Shows a notice for sites running PHP less than 7.4.
54 */
55 function optml_php_notice() {
56 ?>
57 <div class="notice notice-error is-dismissible">
58 <?php
59
60 echo sprintf(
61 /* translators: 1 - opening paragraph tag, 2 - PHP Version, 3 - opening bold tag, 4 - closing bold tag, 5 - opening bold tag, 6 - closing bold tag, 7 - opening anchor tag, 8 - closing anchor tag, 9 - closing paragraph tag */
62 __( '%1$s You\'re using a PHP version lower than %2$s! %3$sOptimole%4$s requires at least %5$sPHP %2$s%6$s to function properly. Plugin has been deactivated. %7$sLearn more here%8$s. %9$s', 'optimole-wp' ),
63 '<p>',
64 '7.4',
65 '<b>',
66 '</b>',
67 '<b>',
68 '</b>',
69 '<a href="https://themeisle.com/blog/upgrade-wordpress-to-php-7/" target="_blank">',
70 '</a>',
71 '</p>'
72 );
73 ?>
74 </div>
75 <?php
76 }
77
78 /**
79 * Initiate the Optimole plugin.
80 *
81 * @return Optml_Main|null Optimole instance.
82 */
83 function optml() {
84 if ( version_compare( PHP_VERSION, '7.4.0', '<' ) ) {
85 add_action( 'admin_notices', 'optml_php_notice' );
86 add_action( 'admin_init', 'optml_deactivate' );
87
88 return null;
89 }
90 define( 'OPTML_URL', plugin_dir_url( __FILE__ ) );
91 define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) );
92 define( 'OPTML_VERSION', '4.0.1' );
93 define( 'OPTML_NAMESPACE', 'optml' );
94 define( 'OPTML_BASEFILE', __FILE__ );
95 define( 'OPTML_PRODUCT_SLUG', basename( OPTML_PATH ) );
96 // Fallback for old PHP versions when this constant is not defined.
97 if ( ! defined( 'PHP_INT_MIN' ) ) {
98 define( 'PHP_INT_MIN', - 999999 );
99 }
100
101 if ( ! defined( 'OPTML_DEBUG' ) ) {
102 define( 'OPTML_DEBUG', ( defined( 'TEST_GROUND' ) && TEST_GROUND ) ? true : false );
103
104 }
105 if ( ! defined( 'OPTML_DEBUG_MEDIA' ) ) {
106 define( 'OPTML_DEBUG_MEDIA', false );
107 }
108
109 return Optml_Main::instance();
110 }
111
112 spl_autoload_register( 'optml_autoload' );
113
114 optml();
115