webp-uploads
Last commit date
can-load.php
2 years ago
fallback.js
3 years ago
helper.php
3 years ago
hooks.php
2 years ago
image-edit.php
2 years ago
load.php
2 years ago
readme.txt
2 years ago
rest-api.php
3 years ago
settings.php
3 years ago
load.php
49 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: WebP Uploads |
| 4 | * Plugin URI: https://github.com/WordPress/performance/tree/trunk/modules/images/webp-uploads |
| 5 | * Description: Creates WebP versions for new JPEG image uploads if supported by the server. |
| 6 | * Requires at least: 6.1 |
| 7 | * Requires PHP: 5.6 |
| 8 | * Version: 1.0.1 |
| 9 | * Author: WordPress Performance Team |
| 10 | * Author URI: https://make.wordpress.org/performance/ |
| 11 | * License: GPLv2 or later |
| 12 | * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 13 | * Text Domain: webp-uploads |
| 14 | * |
| 15 | * @package webp-uploads |
| 16 | */ |
| 17 | |
| 18 | // Define the constant. |
| 19 | if ( defined( 'WEBP_UPLOADS_VERSION' ) ) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | define( 'WEBP_UPLOADS_VERSION', '1.0.1' ); |
| 24 | |
| 25 | // Do not load the code if it is already loaded through another means. |
| 26 | if ( function_exists( 'webp_uploads_create_sources_property' ) ) { |
| 27 | return; |
| 28 | } |
| 29 | |
| 30 | // Do not load the code and show an admin notice instead if conditions are not met. |
| 31 | if ( ! require __DIR__ . '/can-load.php' ) { |
| 32 | add_action( |
| 33 | 'admin_notices', |
| 34 | static function() { |
| 35 | printf( |
| 36 | '<div class="notice notice-error"><p>%s</p></div>', |
| 37 | esc_html__( 'The WebP Uploads feature cannot be loaded from within the plugin since it is already merged into WordPress core.', 'webp-uploads' ) |
| 38 | ); |
| 39 | } |
| 40 | ); |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | require_once __DIR__ . '/helper.php'; |
| 45 | require_once __DIR__ . '/rest-api.php'; |
| 46 | require_once __DIR__ . '/image-edit.php'; |
| 47 | require_once __DIR__ . '/settings.php'; |
| 48 | require_once __DIR__ . '/hooks.php'; |
| 49 |