| @@ -2,66 +2,44 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Imagify |
| 4 | 4 | * Plugin URI: https://wordpress.org/plugins/imagify/ |
| 5 | 5 | * Description: Dramatically reduce image file sizes without losing quality, make your website load faster, boost your SEO and save money on your bandwidth using Imagify, the new most advanced image optimization tool. |
| 6 | - * Version: 1.10 | |
| 6 | + * Version: 2.3.4 | |
| 7 | 7 | * Requires at least: 5.3 |
| 8 | - * Requires PHP: 7.0 | |
| 9 | - * Author: WP Media | |
| 10 | - * Author URI: https://wp-media.me/ | |
| 8 | + * Requires PHP: 7.4 | |
| 9 | + * Author: Imagify Image Optimizer – Optimize Images & Convert WebP & Avif | |
| 10 | + * Author URI: https://imagify.io | |
| 11 | 11 | * Licence: GPLv2 |
| 12 | 12 | * |
| 13 | 13 | * Text Domain: imagify |
| 14 | 14 | * Domain Path: languages |
| 15 | 15 | * |
| 16 | - * Copyright 2019 WP Media | |
| 17 | - * | |
| 18 | - * @package WP-Media\Imagify\WordPress-Plugin | |
| 16 | + * Copyright 2024 WP Media | |
| 19 | 17 | */ |
| 20 | 18 | |
| 21 | -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | |
| 19 | +defined( 'ABSPATH' ) || exit; | |
| 22 | 20 | |
| 23 | 21 | // Imagify defines. |
| 24 | -define( 'IMAGIFY_VERSION', '1.10' ); | |
| 25 | -define( 'IMAGIFY_SLUG', 'imagify' ); | |
| 26 | -define( 'IMAGIFY_FILE', __FILE__ ); | |
| 27 | -define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' ); | |
| 28 | -define( 'IMAGIFY_URL', plugin_dir_url( IMAGIFY_FILE ) ); | |
| 22 | +define( 'IMAGIFY_VERSION', '2.3.4' ); | |
| 23 | +define( 'IMAGIFY_SLUG', 'imagify' ); | |
| 24 | +define( 'IMAGIFY_FILE', __FILE__ ); | |
| 25 | +define( 'IMAGIFY_PATH', realpath( plugin_dir_path( IMAGIFY_FILE ) ) . '/' ); | |
| 26 | +define( 'IMAGIFY_URL', plugin_dir_url( IMAGIFY_FILE ) ); | |
| 29 | 27 | define( 'IMAGIFY_ASSETS_IMG_URL', IMAGIFY_URL . 'assets/images/' ); |
| 30 | -define( 'IMAGIFY_MAX_BYTES', 5242880 ); | |
| 31 | -define( 'IMAGIFY_INT_MAX', PHP_INT_MAX - 30 ); | |
| 28 | +define( 'IMAGIFY_MAX_BYTES', 5242880 ); | |
| 29 | +define( 'IMAGIFY_INT_MAX', PHP_INT_MAX - 30 ); | |
| 30 | +if ( ! defined( 'IMAGIFY_SITE_DOMAIN' ) ) { | |
| 31 | + define( 'IMAGIFY_SITE_DOMAIN', 'https://imagify.io' ); | |
| 32 | +} | |
| 32 | 33 | if ( ! defined( 'IMAGIFY_APP_DOMAIN' ) ) { |
| 33 | - define( 'IMAGIFY_APP_DOMAIN', 'https://app.imagify.io' ); | |
| 34 | + define( 'IMAGIFY_APP_DOMAIN', 'https://app.imagify.io' ); | |
| 34 | 35 | } |
| 35 | -define( 'IMAGIFY_APP_API_URL', IMAGIFY_APP_DOMAIN . '/api/' ); | |
| 36 | +define( 'IMAGIFY_APP_API_URL', IMAGIFY_APP_DOMAIN . '/api/' ); | |
| 36 | 37 | |
| 37 | -add_action( 'plugins_loaded', '_imagify_init' ); | |
| 38 | -/** | |
| 39 | - * Plugin init. | |
| 40 | - * | |
| 41 | - * @since 1.0 | |
| 42 | - */ | |
| 43 | -function _imagify_init() { | |
| 44 | - // Nothing to do during autosave. | |
| 45 | - if ( defined( 'DOING_AUTOSAVE' ) ) { | |
| 46 | - return; | |
| 47 | - } | |
| 48 | 38 | |
| 49 | - // Check for WordPress and PHP version. | |
| 50 | - if ( ! imagify_pass_requirements() ) { | |
| 51 | - return; | |
| 52 | - } | |
| 53 | - | |
| 54 | - // Init the plugin. | |
| 55 | - require_once IMAGIFY_PATH . 'inc/classes/class-imagify-plugin.php'; | |
| 56 | - | |
| 57 | - $plugin = new Imagify_Plugin( | |
| 58 | - array( | |
| 59 | - 'plugin_path' => IMAGIFY_PATH, | |
| 60 | - ) | |
| 61 | - ); | |
| 62 | - | |
| 63 | - $plugin->init(); | |
| 39 | +// Check for WordPress and PHP version. | |
| 40 | +if ( imagify_pass_requirements() ) { | |
| 41 | + require_once IMAGIFY_PATH . 'inc/main.php'; | |
| 64 | 42 | } |
| 65 | 43 | |
| 66 | 44 | /** |
| 67 | 45 | * Check if Imagify is activated on the network. |
| @@ -108,15 +86,15 @@ | ||
| 108 | 86 | |
| 109 | 87 | require_once IMAGIFY_PATH . 'inc/classes/class-imagify-requirements-check.php'; |
| 110 | 88 | |
| 111 | 89 | $requirement_checks = new Imagify_Requirements_Check( |
| 112 | - array( | |
| 90 | + [ | |
| 113 | 91 | 'plugin_name' => 'Imagify', |
| 114 | 92 | 'plugin_file' => IMAGIFY_FILE, |
| 115 | 93 | 'plugin_version' => IMAGIFY_VERSION, |
| 116 | 94 | 'wp_version' => '5.3', |
| 117 | - 'php_version' => '7.0', | |
| 118 | - ) | |
| 95 | + 'php_version' => '7.4', | |
| 96 | + ] | |
| 119 | 97 | ); |
| 120 | 98 | |
| 121 | 99 | $check = $requirement_checks->check(); |
| 122 | 100 | |
| @@ -123,27 +101,8 @@ | ||
| 123 | 101 | return $check; |
| 124 | 102 | } |
| 125 | 103 | |
| 126 | 104 | /** |
| 127 | - * Load plugin translations. | |
| 128 | - * | |
| 129 | - * @since 1.9 | |
| 130 | - * @author Grégory Viguier | |
| 131 | - */ | |
| 132 | -function imagify_load_translations() { | |
| 133 | - static $done = false; | |
| 134 | - | |
| 135 | - if ( $done ) { | |
| 136 | - return; | |
| 137 | - } | |
| 138 | - | |
| 139 | - $done = true; | |
| 140 | - | |
| 141 | - load_plugin_textdomain( 'imagify', false, dirname( plugin_basename( IMAGIFY_FILE ) ) . '/languages/' ); | |
| 142 | -} | |
| 143 | - | |
| 144 | -register_activation_hook( IMAGIFY_FILE, 'imagify_set_activation' ); | |
| 145 | -/** | |
| 146 | 105 | * Set a transient on plugin activation, it will be used later to trigger activation hooks after the plugin is loaded. |
| 147 | 106 | * The transient contains the ID of the user that activated the plugin. |
| 148 | 107 | * |
| 149 | 108 | * @since 1.9 |
| @@ -160,10 +119,10 @@ | ||
| 160 | 119 | } else { |
| 161 | 120 | set_transient( 'imagify_activation', get_current_user_id(), 30 ); |
| 162 | 121 | } |
| 163 | 122 | } |
| 123 | +register_activation_hook( IMAGIFY_FILE, 'imagify_set_activation' ); | |
| 164 | 124 | |
| 165 | -register_deactivation_hook( IMAGIFY_FILE, 'imagify_deactivation' ); | |
| 166 | 125 | /** |
| 167 | 126 | * Trigger a hook on plugin deactivation. |
| 168 | 127 | * |
| 169 | 128 | * @since 1.9 |
| @@ -173,8 +132,12 @@ | ||
| 173 | 132 | if ( ! imagify_pass_requirements() ) { |
| 174 | 133 | return; |
| 175 | 134 | } |
| 176 | 135 | |
| 136 | + // Clean up site transients. | |
| 137 | + delete_site_transient( 'imagify_check_api_version' ); | |
| 138 | + delete_site_transient( 'imagify_check_licence_1' ); | |
| 139 | + | |
| 177 | 140 | /** |
| 178 | 141 | * Imagify deactivation. |
| 179 | 142 | * |
| 180 | 143 | * @since 1.9 |
| @@ -181,4 +144,5 @@ | ||
| 181 | 144 | * @author Grégory Viguier |
| 182 | 145 | */ |
| 183 | 146 | do_action( 'imagify_deactivation' ); |
| 184 | 147 | } |
| 148 | +register_deactivation_hook( IMAGIFY_FILE, 'imagify_deactivation' ); | |