| @@ -1,15 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Autoptimize |
| 4 | - * Plugin URI: https://autoptimize.com/ | |
| 4 | + * Plugin URI: https://autoptimize.com/pro/ | |
| 5 | 5 | * Description: Makes your site faster by optimizing CSS, JS, Images, Google fonts and more. |
| 6 | - * Version: 2.7.2 | |
| 6 | + * Version: 3.1.16 | |
| 7 | 7 | * Author: Frank Goossens (futtta) |
| 8 | - * Author URI: https://autoptimize.com/ | |
| 8 | + * Author URI: https://autoptimize.com/pro/ | |
| 9 | 9 | * Text Domain: autoptimize |
| 10 | + * License: GPLv2 | |
| 10 | 11 | * Released under the GNU General Public License (GPL) |
| 11 | - * http://www.gnu.org/licenses/gpl.txt | |
| 12 | + * https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt | |
| 12 | 13 | */ |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | 16 | * Autoptimize main plugin file. |
| @@ -19,9 +20,9 @@ | ||
| 19 | 20 | if ( ! defined( 'ABSPATH' ) ) { |
| 20 | 21 | exit; |
| 21 | 22 | } |
| 22 | 23 | |
| 23 | -define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.7.2' ); | |
| 24 | +define( 'AUTOPTIMIZE_PLUGIN_VERSION', '3.1.16' ); | |
| 24 | 25 | |
| 25 | 26 | // plugin_dir_path() returns the trailing slash! |
| 26 | 27 | define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 27 | 28 | define( 'AUTOPTIMIZE_PLUGIN_FILE', __FILE__ ); |
| @@ -28,9 +29,9 @@ | ||
| 28 | 29 | |
| 29 | 30 | // Bail early if attempting to run on non-supported php versions. |
| 30 | 31 | if ( version_compare( PHP_VERSION, '5.6', '<' ) ) { |
| 31 | 32 | function autoptimize_incompatible_admin_notice() { |
| 32 | - echo '<div class="error"><p>' . __( 'Autoptimize requires PHP 5.6 (or higher) to function properly. Please upgrade PHP. The Plugin has been auto-deactivated.', 'autoptimize' ) . '</p></div>'; | |
| 33 | + echo '<div class="error"><p>' . esc_html__( 'Autoptimize requires PHP 5.6 (or higher) to function properly. Please upgrade PHP. The Plugin has been auto-deactivated.', 'autoptimize' ) . '</p></div>'; | |
| 33 | 34 | if ( isset( $_GET['activate'] ) ) { |
| 34 | 35 | unset( $_GET['activate'] ); |
| 35 | 36 | } |
| 36 | 37 | } |
| @@ -42,9 +43,9 @@ | ||
| 42 | 43 | return; |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | function autoptimize_autoload( $class_name ) { |
| 46 | - if ( in_array( $class_name, array( 'Minify_HTML', 'JSMin' ) ) ) { | |
| 47 | + if ( in_array( $class_name, array( 'AO_Minify_HTML', 'JSMin' ) ) ) { | |
| 47 | 48 | $file = strtolower( $class_name ); |
| 48 | 49 | $file = str_replace( '_', '-', $file ); |
| 49 | 50 | $path = dirname( __FILE__ ) . '/classes/external/php/'; |
| 50 | 51 | $filepath = $path . $file . '.php'; |
| @@ -63,9 +64,9 @@ | ||
| 63 | 64 | $filepath = $path . $file . '.php'; |
| 64 | 65 | } |
| 65 | 66 | |
| 66 | 67 | // If we didn't match one of our rules, bail! |
| 67 | - if ( ! isset( $filepath ) ) { | |
| 68 | + if ( ! isset( $filepath ) || ! is_readable( $filepath ) ) { | |
| 68 | 69 | return; |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | require $filepath; |
| @@ -75,8 +76,13 @@ | ||
| 75 | 76 | |
| 76 | 77 | // Load WP CLI command(s) on demand. |
| 77 | 78 | if ( defined( 'WP_CLI' ) && WP_CLI ) { |
| 78 | 79 | require AUTOPTIMIZE_PLUGIN_DIR . 'classes/autoptimizeCLI.php'; |
| 80 | +} | |
| 81 | + | |
| 82 | +// filter to disable AO both on front- and backend. | |
| 83 | +if ( apply_filters( 'autoptimize_filter_disable_plugin', false ) ) { | |
| 84 | + return; | |
| 79 | 85 | } |
| 80 | 86 | |
| 81 | 87 | /** |
| 82 | 88 | * Retrieve the instance of the main plugin class. |