| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* |
| 5 |
* @link https://webdeclic.com/ |
| 6 |
* @since 1.0.0 |
| 7 |
* @package Quickwebp |
| 8 |
* |
| 9 |
* @wordpress-plugin |
| 10 |
* Plugin Name: QuickWebP - Compress / Optimize Images & Convert WebP | SEO Friendly |
| 11 |
* Plugin URI: https://webdeclic.com/projets/creation-de-lextension-wordpress-quickwebp/ |
| 12 |
* Description: QuickWebP is an image compression and optimization plugin for WordPress that automatically converts images to WebP when they are uploaded to the media library. It also optimizes the image to improve your site’s performance. |
| 13 |
* Version: 3.2.4 |
| 14 |
* Author: Webdeclic |
| 15 |
* Requires PHP: 7.4 |
| 16 |
* Author URI: https://webdeclic.com/ |
| 17 |
* License: GPL-2.0+ |
| 18 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt |
| 19 |
* Text Domain: quickwebp |
| 20 |
* Domain Path: /languages |
| 21 |
*/ |
| 22 |
|
| 23 |
// If this file is called directly, abort. |
| 24 |
if ( ! defined( 'WPINC' ) ) { |
| 25 |
die; |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Check if your are in local or production environment |
| 30 |
*/ |
| 31 |
$is_local = isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1'); |
| 32 |
|
| 33 |
/** |
| 34 |
* If you are in local environment, you can use the version number as a timestamp for better cache management in your browser |
| 35 |
*/ |
| 36 |
$version = get_file_data( __FILE__, array( 'Version' => 'Version' ), false )['Version']; |
| 37 |
|
| 38 |
/** |
| 39 |
* Currently plugin version. |
| 40 |
* Start at version 1.0.0 and use SemVer - https://semver.org |
| 41 |
* Rename this for your plugin and update it as you release new versions. |
| 42 |
*/ |
| 43 |
define( 'QUICKWEBP_VERSION', $version ); |
| 44 |
|
| 45 |
/** |
| 46 |
* You can use this const for check if you are in local environment |
| 47 |
*/ |
| 48 |
define( 'QUICKWEBP_DEV_MOD', $is_local ); |
| 49 |
|
| 50 |
/** |
| 51 |
* Plugin Name text domain for internationalization. |
| 52 |
*/ |
| 53 |
define( 'QUICKWEBP_TEXT_DOMAIN', 'quickwebp' ); |
| 54 |
|
| 55 |
/** |
| 56 |
* Plugin Name Path for plugin includes. |
| 57 |
*/ |
| 58 |
define( 'QUICKWEBP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 59 |
|
| 60 |
/** |
| 61 |
* Plugin Name URL for plugin sources (css, js, images etc...). |
| 62 |
*/ |
| 63 |
define( 'QUICKWEBP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 64 |
|
| 65 |
/** |
| 66 |
* The code that runs during plugin activation. |
| 67 |
* This action is documented in includes/class-quickwebp-activator.php |
| 68 |
*/ |
| 69 |
function activate_quickwebp() { |
| 70 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-quickwebp-activator.php'; |
| 71 |
Quickwebp_Activator::activate(); |
| 72 |
} |
| 73 |
|
| 74 |
/** |
| 75 |
* The code that runs during plugin deactivation. |
| 76 |
* This action is documented in includes/class-quickwebp-deactivator.php |
| 77 |
*/ |
| 78 |
function deactivate_quickwebp() { |
| 79 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-quickwebp-deactivator.php'; |
| 80 |
Quickwebp_Deactivator::deactivate(); |
| 81 |
} |
| 82 |
|
| 83 |
register_activation_hook( __FILE__, 'activate_quickwebp' ); |
| 84 |
register_deactivation_hook( __FILE__, 'deactivate_quickwebp' ); |
| 85 |
|
| 86 |
/** |
| 87 |
* The core plugin class that is used to define internationalization, |
| 88 |
* admin-specific hooks, and public-facing site hooks. |
| 89 |
*/ |
| 90 |
require plugin_dir_path( __FILE__ ) . 'includes/class-quickwebp.php'; |
| 91 |
|
| 92 |
/** |
| 93 |
* Begins execution of the plugin. |
| 94 |
* |
| 95 |
* Since everything within the plugin is registered via hooks, |
| 96 |
* then kicking off the plugin from this point in the file does |
| 97 |
* not affect the page life cycle. |
| 98 |
* |
| 99 |
* @since 1.0.0 |
| 100 |
*/ |
| 101 |
function run_quickwebp() { |
| 102 |
|
| 103 |
if ( ! version_compare( PHP_VERSION, '7.4', '>=' ) ) { |
| 104 |
|
| 105 |
add_action( 'admin_notices', function() { |
| 106 |
?> |
| 107 |
<div class="notice notice-error"> |
| 108 |
<p><?php _e( "Oops! QuickWebP isn't running because PHP is outdated. Update to PHP version 7.4", QUICKWEBP_TEXT_DOMAIN ); ?></p> |
| 109 |
</div> |
| 110 |
<?php |
| 111 |
}); |
| 112 |
|
| 113 |
} else { |
| 114 |
|
| 115 |
$plugin = new Quickwebp(); |
| 116 |
$plugin->run(); |
| 117 |
} |
| 118 |
|
| 119 |
} |
| 120 |
run_quickwebp(); |
| 121 |
|