| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Image optimization service by Optimole |
| 4 | 4 | * Description: Complete handling of your website images. |
| 5 | - * Version: 3.1.0 | |
| 5 | + * Version: 4.2.13 | |
| 6 | 6 | * Author: Optimole |
| 7 | 7 | * Author URI: https://optimole.com |
| 8 | 8 | * License: GPL-2.0+ |
| 9 | 9 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| @@ -18,19 +18,19 @@ | ||
| 18 | 18 | } |
| 19 | 19 | /** |
| 20 | 20 | * Autoloader function. |
| 21 | 21 | * |
| 22 | - * @param string $class Class to load. | |
| 22 | + * @param string $class_name Class to load. | |
| 23 | 23 | */ |
| 24 | -function optml_autoload( $class ) { | |
| 24 | +function optml_autoload( $class_name ) { | |
| 25 | 25 | $prefix = 'Optml'; |
| 26 | - if ( strpos( $class, $prefix ) !== 0 ) { | |
| 26 | + if ( strpos( $class_name, $prefix ) !== 0 ) { | |
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | - foreach ( [ '/inc/', '/inc/traits/', '/inc/image_properties/', '/inc/asset_properties/', '/inc/compatibilities/', '/inc/conflicts/', '/inc/cli/' ] as $folder ) { | |
| 30 | - $file = str_replace( $prefix . '_', '', $class ); | |
| 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 | 31 | $file = strtolower( $file ); |
| 32 | - $file = dirname( __FILE__ ) . $folder . $file . '.php'; | |
| 32 | + $file = __DIR__ . $folder . $file . '.php'; | |
| 33 | 33 | if ( file_exists( $file ) ) { |
| 34 | 34 | require $file; |
| 35 | 35 | } |
| 36 | 36 | } |
| @@ -49,14 +49,27 @@ | ||
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | - * Shows a notice for sites running PHP less than 5.4. | |
| 53 | + * Shows a notice for sites running PHP less than 7.4. | |
| 54 | 54 | */ |
| 55 | 55 | function optml_php_notice() { |
| 56 | 56 | ?> |
| 57 | 57 | <div class="notice notice-error is-dismissible"> |
| 58 | - <?php echo sprintf( __( '%1$s You\'re using a PHP version lower than 5.4! %2$sOptimole%3$s requires at least %4$sPHP 5.4%5$s to function properly. Plugin has been deactivated. %6$sLearn more here%5$s. %7$s', 'optimole-wp' ), '<p>', '<b>', '</b>', '<b>', '</b>', '<a href="https://themeisle.com/blog/upgrade-wordpress-to-php-7/" target="_blank">', '</a>', '</p>' ); ?> | |
| 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 anchor tag, 6 - closing anchor tag, 7 - closing paragraph tag */ | |
| 62 | + __( '%1$sYou\'re using a PHP version lower than %2$s! %3$sOptimole%4$s requires at least %3$sPHP %2$s%4$s to function properly. Plugin has been deactivated. %5$sLearn more here%6$s. %7$s', 'optimole-wp' ), | |
| 63 | + '<p>', | |
| 64 | + '7.4', | |
| 65 | + '<b>', | |
| 66 | + '</b>', | |
| 67 | + '<a href="https://themeisle.com/blog/upgrade-wordpress-to-php-7/" target="_blank">', | |
| 68 | + '</a>', | |
| 69 | + '</p>' | |
| 70 | + ); | |
| 71 | + ?> | |
| 59 | 72 | </div> |
| 60 | 73 | <?php |
| 61 | 74 | } |
| 62 | 75 | |
| @@ -62,12 +75,12 @@ | ||
| 62 | 75 | |
| 63 | 76 | /** |
| 64 | 77 | * Initiate the Optimole plugin. |
| 65 | 78 | * |
| 66 | - * @return Optml_Main Optimole instance. | |
| 79 | + * @return Optml_Main|null Optimole instance. | |
| 67 | 80 | */ |
| 68 | 81 | function optml() { |
| 69 | - if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) { | |
| 82 | + if ( version_compare( PHP_VERSION, '7.4.0', '<' ) ) { | |
| 70 | 83 | add_action( 'admin_notices', 'optml_php_notice' ); |
| 71 | 84 | add_action( 'admin_init', 'optml_deactivate' ); |
| 72 | 85 | |
| 73 | 86 | return null; |
| @@ -72,15 +85,13 @@ | ||
| 72 | 85 | |
| 73 | 86 | return null; |
| 74 | 87 | } |
| 75 | 88 | define( 'OPTML_URL', plugin_dir_url( __FILE__ ) ); |
| 76 | - if ( ! defined( 'OPTML_JS_CDN' ) ) { | |
| 77 | - define( 'OPTML_JS_CDN', 'd5jmkjjpb7yfg.cloudfront.net' ); | |
| 78 | - } | |
| 79 | 89 | define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) ); |
| 80 | - define( 'OPTML_VERSION', '3.1.0' ); | |
| 90 | + define( 'OPTML_VERSION', '4.2.13' ); | |
| 81 | 91 | define( 'OPTML_NAMESPACE', 'optml' ); |
| 82 | 92 | define( 'OPTML_BASEFILE', __FILE__ ); |
| 93 | + define( 'OPTML_PRODUCT_SLUG', basename( OPTML_PATH ) ); | |
| 83 | 94 | // Fallback for old PHP versions when this constant is not defined. |
| 84 | 95 | if ( ! defined( 'PHP_INT_MIN' ) ) { |
| 85 | 96 | define( 'PHP_INT_MIN', - 999999 ); |
| 86 | 97 | } |
| @@ -86,8 +97,12 @@ | ||
| 86 | 97 | } |
| 87 | 98 | |
| 88 | 99 | if ( ! defined( 'OPTML_DEBUG' ) ) { |
| 89 | 100 | define( 'OPTML_DEBUG', ( defined( 'TEST_GROUND' ) && TEST_GROUND ) ? true : false ); |
| 101 | + | |
| 102 | + } | |
| 103 | + if ( ! defined( 'OPTML_DEBUG_MEDIA' ) ) { | |
| 104 | + define( 'OPTML_DEBUG_MEDIA', false ); | |
| 90 | 105 | } |
| 91 | 106 | |
| 92 | 107 | return Optml_Main::instance(); |
| 93 | 108 | } |