| @@ -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: 2.5.7 | |
| 5 | + * Version: 1.0.4 | |
| 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 |
| @@ -25,40 +25,16 @@ | ||
| 25 | 25 | $prefix = 'Optml'; |
| 26 | 26 | if ( strpos( $class, $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 ); | |
| 31 | - $file = strtolower( $file ); | |
| 32 | - $file = dirname( __FILE__ ) . $folder . $file . '.php'; | |
| 33 | - if ( file_exists( $file ) ) { | |
| 34 | - require $file; | |
| 35 | - } | |
| 36 | - } | |
| 37 | -} | |
| 29 | + $file = str_replace( $prefix . '_', '', $class ); | |
| 38 | 30 | |
| 39 | -/** | |
| 40 | - * Deactivates optimole plugin. | |
| 41 | - * | |
| 42 | - * Used when the user does not have the minimum PHP required version. | |
| 43 | - * | |
| 44 | - * @since 8.1.4 | |
| 45 | - */ | |
| 46 | -function optml_deactivate() { | |
| 47 | - if ( is_plugin_active( 'optimole-wp/optimole-wp.php' ) ) { | |
| 48 | - deactivate_plugins( 'optimole-wp/optimole-wp.php' ); | |
| 31 | + $file = strtolower( $file ); | |
| 32 | + $file = dirname( __FILE__ ) . '/inc/' . $file . '.php'; | |
| 33 | + if ( file_exists( $file ) ) { | |
| 34 | + require $file; | |
| 49 | 35 | } |
| 50 | -} | |
| 51 | 36 | |
| 52 | -/** | |
| 53 | - * Shows a notice for sites running PHP less than 5.4. | |
| 54 | - */ | |
| 55 | -function optml_php_notice() { | |
| 56 | - ?> | |
| 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>' ); ?> | |
| 59 | - </div> | |
| 60 | - <?php | |
| 61 | 37 | } |
| 62 | 38 | |
| 63 | 39 | /** |
| 64 | 40 | * Initiate the Optimole plugin. |
| @@ -65,29 +41,15 @@ | ||
| 65 | 41 | * |
| 66 | 42 | * @return Optml_Main Optimole instance. |
| 67 | 43 | */ |
| 68 | 44 | function optml() { |
| 69 | - if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) { | |
| 70 | - add_action( 'admin_notices', 'optml_php_notice' ); | |
| 71 | - add_action( 'admin_init', 'optml_deactivate' ); | |
| 72 | - | |
| 73 | - return null; | |
| 74 | - } | |
| 75 | 45 | define( 'OPTML_URL', plugin_dir_url( __FILE__ ) ); |
| 76 | - if ( ! defined( 'OPTML_JS_CDN' ) ) { | |
| 77 | - define( 'OPTML_JS_CDN', 'd5jmkjjpb7yfg.cloudfront.net' ); | |
| 78 | - } | |
| 79 | 46 | define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) ); |
| 80 | - define( 'OPTML_VERSION', '2.5.7' ); | |
| 47 | + define( 'OPTML_VERSION', '1.0.4' ); | |
| 81 | 48 | define( 'OPTML_NAMESPACE', 'optml' ); |
| 82 | 49 | define( 'OPTML_BASEFILE', __FILE__ ); |
| 83 | - // Fallback for old PHP versions when this constant is not defined. | |
| 84 | - if ( ! defined( 'PHP_INT_MIN' ) ) { | |
| 85 | - define( 'PHP_INT_MIN', - 999999 ); | |
| 86 | - } | |
| 87 | - | |
| 88 | 50 | if ( ! defined( 'OPTML_DEBUG' ) ) { |
| 89 | - define( 'OPTML_DEBUG', ( defined( 'TEST_GROUND' ) && TEST_GROUND ) ? true : false ); | |
| 51 | + define( 'OPTML_DEBUG', ( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? true : false ); | |
| 90 | 52 | } |
| 91 | 53 | |
| 92 | 54 | return Optml_Main::instance(); |
| 93 | 55 | } |