-
Notifications
You must be signed in to change notification settings - Fork 2
/
easy-image-optimizer.php
98 lines (91 loc) · 3.22 KB
/
easy-image-optimizer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/**
* Loader for Easy IO plugin.
*
* This file bootstraps the rest of the Easy IO plugin after some basic checks.
*
* @link https://ewww.io/easy/
* @package Easy_Image_Optimizer
*/
/*
Plugin Name: Easy Image Optimizer
Plugin URI: https://wordpress.org/plugins/easy-image-optimizer/
Description: Easily speed up your website to better connect with your visitors. Properly compress and size/scale images. Includes lazy load and WebP auto-convert.
Author: Exactly WWW
Version: 4.0.0
Requires at least: 6.5
Requires PHP: 8.1
Author URI: https://ewww.io/
License: GPLv3
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Check the PHP version.
if ( ! defined( 'PHP_VERSION_ID' ) || PHP_VERSION_ID < 80100 ) {
add_action( 'network_admin_notices', 'easyio_unsupported_php' );
add_action( 'admin_notices', 'easyio_unsupported_php' );
} elseif ( false === strpos( add_query_arg( '', '' ), 'easyio_disable=1' ) ) {
define( 'EASYIO_VERSION', 400 );
/**
* The full path of the plugin file (this file).
*
* @var string EASYIO_PLUGIN_FILE
*/
define( 'EASYIO_PLUGIN_FILE', __FILE__ );
/**
* The path of the plugin file relative to the plugins/ folder.
*
* @var string EASYIO_PLUGIN_FILE_REL
*/
define( 'EASYIO_PLUGIN_FILE_REL', plugin_basename( __FILE__ ) );
/**
* This is the full system path to the plugin folder.
*
* @var string EASYIO_PLUGIN_PATH
*/
define( 'EASYIO_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
if ( ! defined( 'EASYIO_CONTENT_DIR' ) ) {
if ( defined( 'EWWWIO_CONTENT_DIR' ) ) {
define( 'EASYIO_CONTENT_DIR', EWWWIO_CONTENT_DIR );
} else {
$easyio_content_dir = trailingslashit( WP_CONTENT_DIR ) . trailingslashit( 'easyio' );
if ( ! is_writable( WP_CONTENT_DIR ) || ! empty( $_ENV['PANTHEON_ENVIRONMENT'] ) ) {
$upload_dir = wp_get_upload_dir();
if ( false === strpos( $upload_dir['basedir'], '://' ) && is_writable( $upload_dir['basedir'] ) ) {
$easyio_content_dir = trailingslashit( $upload_dir['basedir'] ) . trailingslashit( 'easyio' );
}
}
define( 'EASYIO_CONTENT_DIR', $easyio_content_dir );
}
}
/**
* All the 'unique' functions for the core Easy IO plugin.
*/
require_once EASYIO_PLUGIN_PATH . 'unique.php';
/**
* All the base functions for our plugins.
*/
require_once EASYIO_PLUGIN_PATH . 'classes/class-base.php';
/**
* The setup functions for Easy IO.
*/
require_once EASYIO_PLUGIN_PATH . 'classes/class-plugin.php';
/**
* The main function to return a single EasyIO\Plugin object to functions elsewhere.
*
* @return object object|EasyIO\Plugin The one true EasyIO\Plugin instance.
*/
function easyio() {
return EasyIO\Plugin::instance();
}
easyio();
} // End if().
if ( ! function_exists( 'easyio_unsupported_php' ) ) {
/**
* Display a notice that the PHP version is too old.
*/
function easyio_unsupported_php() {
echo '<div id="easyio-warning-php" class="error"><p><a href="https://docs.ewww.io/article/55-upgrading-php" target="_blank" data-beacon-article="5ab2baa6042863478ea7c2ae">' . esc_html__( 'Easy Image Optimizer requires PHP 8.1 or greater. Newer versions of PHP are faster and more secure. If you are unsure how to upgrade to a supported version, ask your webhost for instructions.', 'easy-image-optimizer' ) . '</a></p></div>';
}
}