Completed
Push — master ( 0e2a5e...4bd316 )
by frank
03:12
created
autoptimize.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -16,66 +16,66 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if (!defined('ABSPATH')) {
20 20
     exit;
21 21
 }
22 22
 
23
-define( 'AUTOPTIMIZE_PLUGIN_VERSION', '2.5.1' );
23
+define('AUTOPTIMIZE_PLUGIN_VERSION', '2.5.1');
24 24
 
25 25
 // plugin_dir_path() returns the trailing slash!
26
-define( 'AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
27
-define( 'AUTOPTIMIZE_PLUGIN_FILE', __FILE__ );
26
+define('AUTOPTIMIZE_PLUGIN_DIR', plugin_dir_path(__FILE__));
27
+define('AUTOPTIMIZE_PLUGIN_FILE', __FILE__);
28 28
 
29 29
 // Bail early if attempting to run on non-supported php versions.
30
-if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
30
+if (version_compare(PHP_VERSION, '5.3', '<')) {
31 31
     function autoptimize_incompatible_admin_notice() {
32
-        echo '<div class="error"><p>' . __( 'Autoptimize requires PHP 5.3 (or higher) to function properly. Please upgrade PHP. The Plugin has been auto-deactivated.', 'autoptimize' ) . '</p></div>';
33
-        if ( isset( $_GET['activate'] ) ) {
34
-            unset( $_GET['activate'] );
32
+        echo '<div class="error"><p>'.__('Autoptimize requires PHP 5.3 (or higher) to function properly. Please upgrade PHP. The Plugin has been auto-deactivated.', 'autoptimize').'</p></div>';
33
+        if (isset($_GET['activate'])) {
34
+            unset($_GET['activate']);
35 35
         }
36 36
     }
37 37
     function autoptimize_deactivate_self() {
38
-        deactivate_plugins( plugin_basename( AUTOPTIMIZE_PLUGIN_FILE ) );
38
+        deactivate_plugins(plugin_basename(AUTOPTIMIZE_PLUGIN_FILE));
39 39
     }
40
-    add_action( 'admin_notices', 'autoptimize_incompatible_admin_notice' );
41
-    add_action( 'admin_init', 'autoptimize_deactivate_self' );
40
+    add_action('admin_notices', 'autoptimize_incompatible_admin_notice');
41
+    add_action('admin_init', 'autoptimize_deactivate_self');
42 42
     return;
43 43
 }
44 44
 
45
-function autoptimize_autoload( $class_name ) {
46
-    if ( in_array( $class_name, array( 'Minify_HTML', 'JSMin' ) ) ) {
47
-        $file     = strtolower( $class_name );
48
-        $file     = str_replace( '_', '-', $file );
49
-        $path     = dirname( __FILE__ ) . '/classes/external/php/';
50
-        $filepath = $path . $file . '.php';
51
-    } elseif ( false !== strpos( $class_name, 'Autoptimize\\tubalmartin\\CssMin' ) ) {
52
-        $file     = str_replace( 'Autoptimize\\tubalmartin\\CssMin\\', '', $class_name );
53
-        $path     = dirname( __FILE__ ) . '/classes/external/php/yui-php-cssmin-bundled/';
54
-        $filepath = $path . $file . '.php';
55
-    } elseif ( 'autoptimize' === substr( $class_name, 0, 11 ) ) {
45
+function autoptimize_autoload($class_name) {
46
+    if (in_array($class_name, array('Minify_HTML', 'JSMin'))) {
47
+        $file     = strtolower($class_name);
48
+        $file     = str_replace('_', '-', $file);
49
+        $path     = dirname(__FILE__).'/classes/external/php/';
50
+        $filepath = $path.$file.'.php';
51
+    } elseif (false !== strpos($class_name, 'Autoptimize\\tubalmartin\\CssMin')) {
52
+        $file     = str_replace('Autoptimize\\tubalmartin\\CssMin\\', '', $class_name);
53
+        $path     = dirname(__FILE__).'/classes/external/php/yui-php-cssmin-bundled/';
54
+        $filepath = $path.$file.'.php';
55
+    } elseif ('autoptimize' === substr($class_name, 0, 11)) {
56 56
         // One of our "old" classes.
57 57
         $file     = $class_name;
58
-        $path     = dirname( __FILE__ ) . '/classes/';
59
-        $filepath = $path . $file . '.php';
60
-    } elseif ( 'PAnD' === $class_name ) {
58
+        $path     = dirname(__FILE__).'/classes/';
59
+        $filepath = $path.$file.'.php';
60
+    } elseif ('PAnD' === $class_name) {
61 61
         $file     = 'persist-admin-notices-dismissal';
62
-        $path     = dirname( __FILE__ ) . '/classes/external/php/persist-admin-notices-dismissal/';
63
-        $filepath = $path . $file . '.php';
62
+        $path     = dirname(__FILE__).'/classes/external/php/persist-admin-notices-dismissal/';
63
+        $filepath = $path.$file.'.php';
64 64
     }
65 65
 
66 66
     // If we didn't match one of our rules, bail!
67
-    if ( ! isset( $filepath ) ) {
67
+    if (!isset($filepath)) {
68 68
         return;
69 69
     }
70 70
 
71 71
     require $filepath;
72 72
 }
73 73
 
74
-spl_autoload_register( 'autoptimize_autoload' );
74
+spl_autoload_register('autoptimize_autoload');
75 75
 
76 76
 // Load WP CLI command(s) on demand.
77
-if ( defined( 'WP_CLI' ) && WP_CLI ) {
78
-    require AUTOPTIMIZE_PLUGIN_DIR . 'classes/autoptimizeCLI.php';
77
+if (defined('WP_CLI') && WP_CLI) {
78
+    require AUTOPTIMIZE_PLUGIN_DIR.'classes/autoptimizeCLI.php';
79 79
 }
80 80
 
81 81
 /**
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 function autoptimize() {
87 87
     static $plugin = null;
88 88
 
89
-    if ( null === $plugin ) {
90
-        $plugin = new autoptimizeMain( AUTOPTIMIZE_PLUGIN_VERSION, AUTOPTIMIZE_PLUGIN_FILE );
89
+    if (null === $plugin) {
90
+        $plugin = new autoptimizeMain(AUTOPTIMIZE_PLUGIN_VERSION, AUTOPTIMIZE_PLUGIN_FILE);
91 91
     }
92 92
 
93 93
     return $plugin;
Please login to merge, or discard this patch.