Completed
Push — master ( 8e7dca...6ec0d0 )
by frank
01:41
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.4.0' );
23
+define('AUTOPTIMIZE_PLUGIN_VERSION', '2.4.0');
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.
config/default.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 //Check everything exists before using it
4 4
 if(!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
5
-	$_SERVER['HTTP_ACCEPT_ENCODING'] = '';
5
+    $_SERVER['HTTP_ACCEPT_ENCODING'] = '';
6 6
 if(!isset($_SERVER['HTTP_USER_AGENT']))
7
-	$_SERVER['HTTP_USER_AGENT'] = '';
7
+    $_SERVER['HTTP_USER_AGENT'] = '';
8 8
 
9 9
 // Determine supported compression method
10 10
 $gzip = strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
@@ -15,30 +15,30 @@  discard block
 block discarded – undo
15 15
 
16 16
 // Check for buggy versions of Internet Explorer
17 17
 if (!strstr($_SERVER['HTTP_USER_AGENT'], 'Opera') &&
18
-	preg_match('/^Mozilla\/4\.0 \(compatible; MSIE ([0-9]\.[0-9])/i', $_SERVER['HTTP_USER_AGENT'], $matches))
18
+    preg_match('/^Mozilla\/4\.0 \(compatible; MSIE ([0-9]\.[0-9])/i', $_SERVER['HTTP_USER_AGENT'], $matches))
19 19
 {
20
-	$version = floatval($matches[1]);
20
+    $version = floatval($matches[1]);
21 21
 
22
-	if ($version < 6)
23
-		$encoding = 'none';
22
+    if ($version < 6)
23
+        $encoding = 'none';
24 24
 
25
-	if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1'))
26
-		$encoding = 'none';
25
+    if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1'))
26
+        $encoding = 'none';
27 27
 }
28 28
 
29 29
 //Some servers compress the output of PHP - Don't break in those cases
30 30
 if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
31
-	$encoding = 'none';
31
+    $encoding = 'none';
32 32
 
33 33
 $iscompressed = file_exists(__FILE__.'.'.$encoding);
34 34
 if($encoding != 'none' && $iscompressed == false)
35 35
 {
36
-	$flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
37
-	$code = file_get_contents(__FILE__.'.none');
38
-	$contents = gzencode($code,9,$flag);
36
+    $flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
37
+    $code = file_get_contents(__FILE__.'.none');
38
+    $contents = gzencode($code,9,$flag);
39 39
 }else{
40
-	//Get data
41
-	$contents = file_get_contents(__FILE__.'.'.$encoding);
40
+    //Get data
41
+    $contents = file_get_contents(__FILE__.'.'.$encoding);
42 42
 }
43 43
 
44 44
 // first check if we have to send 304
@@ -52,36 +52,36 @@  discard block
 block discarded – undo
52 52
 $modTimeMatch = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $modTime);
53 53
 
54 54
 if (($modTimeMatch)||($eTagMatch)) {
55
-	header('HTTP/1.1 304 Not Modified');
56
-	header('Connection: close');
55
+    header('HTTP/1.1 304 Not Modified');
56
+    header('Connection: close');
57 57
 } else {
58
-	// send all sorts of headers
59
-	$expireTime=60*60*24*355; // 1y max according to RFC
60
-	if ($encoding != 'none') {
61
-		header('Content-Encoding: '.$encoding);
62
-	}
63
-	header('Vary: Accept-Encoding');
64
-	header('Content-Length: '.strlen($contents));
65
-	header('Content-type: %%CONTENT%%; charset=utf-8');
66
-	header('Cache-Control: max-age='.$expireTime.', public, must-revalidate');
67
-	header('Cache-Control: max-age='.$expireTime.', public, immutable');
68
-	header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expireTime).' GMT');
69
-	header('ETag: ' . $eTag);
70
-	header('Last-Modified: '.gmdate('D, d M Y H:i:s', $modTime).' GMT');
58
+    // send all sorts of headers
59
+    $expireTime=60*60*24*355; // 1y max according to RFC
60
+    if ($encoding != 'none') {
61
+        header('Content-Encoding: '.$encoding);
62
+    }
63
+    header('Vary: Accept-Encoding');
64
+    header('Content-Length: '.strlen($contents));
65
+    header('Content-type: %%CONTENT%%; charset=utf-8');
66
+    header('Cache-Control: max-age='.$expireTime.', public, must-revalidate');
67
+    header('Cache-Control: max-age='.$expireTime.', public, immutable');
68
+    header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expireTime).' GMT');
69
+    header('ETag: ' . $eTag);
70
+    header('Last-Modified: '.gmdate('D, d M Y H:i:s', $modTime).' GMT');
71 71
 
72
-	// send output
73
-	echo $contents;
72
+    // send output
73
+    echo $contents;
74 74
 
75
-	//And write to filesystem cache if not done yet
76
-	if($encoding != 'none' && $iscompressed == false)
77
-	{
78
-		//Write the content we sent
79
-		file_put_contents(__FILE__.'.'.$encoding,$contents);
75
+    //And write to filesystem cache if not done yet
76
+    if($encoding != 'none' && $iscompressed == false)
77
+    {
78
+        //Write the content we sent
79
+        file_put_contents(__FILE__.'.'.$encoding,$contents);
80 80
 
81
-		//And write the new content
82
-		$flag = ($encoding == 'gzip' ? FORCE_DEFLATE : FORCE_GZIP);
83
-		$ext = ($encoding == 'gzip' ? 'deflate' : 'gzip');
84
-		$contents = gzencode($code,9,$flag);
85
-		file_put_contents(__FILE__.'.'.$ext,$contents);
86
-	}
81
+        //And write the new content
82
+        $flag = ($encoding == 'gzip' ? FORCE_DEFLATE : FORCE_GZIP);
83
+        $ext = ($encoding == 'gzip' ? 'deflate' : 'gzip');
84
+        $contents = gzencode($code,9,$flag);
85
+        file_put_contents(__FILE__.'.'.$ext,$contents);
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php exit;
2 2
 
3 3
 //Check everything exists before using it
4
-if(!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
4
+if (!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
5 5
 	$_SERVER['HTTP_ACCEPT_ENCODING'] = '';
6
-if(!isset($_SERVER['HTTP_USER_AGENT']))
6
+if (!isset($_SERVER['HTTP_USER_AGENT']))
7 7
 	$_SERVER['HTTP_USER_AGENT'] = '';
8 8
 
9 9
 // Determine supported compression method
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 }
28 28
 
29 29
 //Some servers compress the output of PHP - Don't break in those cases
30
-if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
30
+if (ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
31 31
 	$encoding = 'none';
32 32
 
33 33
 $iscompressed = file_exists(__FILE__.'.'.$encoding);
34
-if($encoding != 'none' && $iscompressed == false)
34
+if ($encoding != 'none' && $iscompressed == false)
35 35
 {
36 36
 	$flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
37 37
 	$code = file_get_contents(__FILE__.'.none');
38
-	$contents = gzencode($code,9,$flag);
39
-}else{
38
+	$contents = gzencode($code, 9, $flag);
39
+} else {
40 40
 	//Get data
41 41
 	$contents = file_get_contents(__FILE__.'.'.$encoding);
42 42
 }
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
 // first check if we have to send 304
45 45
 // inspired by http://www.jonasjohn.de/snippets/php/caching.htm
46 46
 
47
-$eTag=md5($contents);
48
-$modTime=filemtime(__FILE__.'.none');
47
+$eTag = md5($contents);
48
+$modTime = filemtime(__FILE__.'.none');
49 49
 
50 50
 date_default_timezone_set("UTC");
51
-$eTagMatch = (isset($_SERVER['HTTP_IF_NONE_MATCH']) && strpos($_SERVER['HTTP_IF_NONE_MATCH'],$eTag));
51
+$eTagMatch = (isset($_SERVER['HTTP_IF_NONE_MATCH']) && strpos($_SERVER['HTTP_IF_NONE_MATCH'], $eTag));
52 52
 $modTimeMatch = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $modTime);
53 53
 
54
-if (($modTimeMatch)||($eTagMatch)) {
54
+if (($modTimeMatch) || ($eTagMatch)) {
55 55
 	header('HTTP/1.1 304 Not Modified');
56 56
 	header('Connection: close');
57 57
 } else {
58 58
 	// send all sorts of headers
59
-	$expireTime=60*60*24*355; // 1y max according to RFC
59
+	$expireTime = 60*60*24*355; // 1y max according to RFC
60 60
 	if ($encoding != 'none') {
61 61
 		header('Content-Encoding: '.$encoding);
62 62
 	}
@@ -66,22 +66,22 @@  discard block
 block discarded – undo
66 66
 	header('Cache-Control: max-age='.$expireTime.', public, must-revalidate');
67 67
 	header('Cache-Control: max-age='.$expireTime.', public, immutable');
68 68
 	header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expireTime).' GMT');
69
-	header('ETag: ' . $eTag);
69
+	header('ETag: '.$eTag);
70 70
 	header('Last-Modified: '.gmdate('D, d M Y H:i:s', $modTime).' GMT');
71 71
 
72 72
 	// send output
73 73
 	echo $contents;
74 74
 
75 75
 	//And write to filesystem cache if not done yet
76
-	if($encoding != 'none' && $iscompressed == false)
76
+	if ($encoding != 'none' && $iscompressed == false)
77 77
 	{
78 78
 		//Write the content we sent
79
-		file_put_contents(__FILE__.'.'.$encoding,$contents);
79
+		file_put_contents(__FILE__.'.'.$encoding, $contents);
80 80
 
81 81
 		//And write the new content
82 82
 		$flag = ($encoding == 'gzip' ? FORCE_DEFLATE : FORCE_GZIP);
83 83
 		$ext = ($encoding == 'gzip' ? 'deflate' : 'gzip');
84
-		$contents = gzencode($code,9,$flag);
85
-		file_put_contents(__FILE__.'.'.$ext,$contents);
84
+		$contents = gzencode($code, 9, $flag);
85
+		file_put_contents(__FILE__.'.'.$ext, $contents);
86 86
 	}
87 87
 }
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,10 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php exit;
2 2
 
3 3
 //Check everything exists before using it
4
-if(!isset($_SERVER['HTTP_ACCEPT_ENCODING']))
4
+if(!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
5 5
 	$_SERVER['HTTP_ACCEPT_ENCODING'] = '';
6
-if(!isset($_SERVER['HTTP_USER_AGENT']))
6
+}
7
+if(!isset($_SERVER['HTTP_USER_AGENT'])) {
7 8
 	$_SERVER['HTTP_USER_AGENT'] = '';
9
+}
8 10
 
9 11
 // Determine supported compression method
10 12
 $gzip = strstr($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip');
@@ -19,16 +21,19 @@  discard block
 block discarded – undo
19 21
 {
20 22
 	$version = floatval($matches[1]);
21 23
 
22
-	if ($version < 6)
23
-		$encoding = 'none';
24
+	if ($version < 6) {
25
+			$encoding = 'none';
26
+	}
24 27
 
25
-	if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1'))
26
-		$encoding = 'none';
27
-}
28
+	if ($version == 6 && !strstr($_SERVER['HTTP_USER_AGENT'], 'EV1')) {
29
+			$encoding = 'none';
30
+	}
31
+	}
28 32
 
29 33
 //Some servers compress the output of PHP - Don't break in those cases
30
-if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1)
34
+if(ini_get('output_handler') == 'ob_gzhandler' || ini_get('zlib.output_compression') == 1) {
31 35
 	$encoding = 'none';
36
+}
32 37
 
33 38
 $iscompressed = file_exists(__FILE__.'.'.$encoding);
34 39
 if($encoding != 'none' && $iscompressed == false)
@@ -36,7 +41,7 @@  discard block
 block discarded – undo
36 41
 	$flag = ($encoding == 'gzip' ? FORCE_GZIP : FORCE_DEFLATE);
37 42
 	$code = file_get_contents(__FILE__.'.none');
38 43
 	$contents = gzencode($code,9,$flag);
39
-}else{
44
+} else{
40 45
 	//Get data
41 46
 	$contents = file_get_contents(__FILE__.'.'.$encoding);
42 47
 }
Please login to merge, or discard this patch.
php/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php 3 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -29,91 +29,91 @@
 block discarded – undo
29 29
  * Exit if called directly.
30 30
  */
31 31
 if ( ! defined( 'ABSPATH' ) ) {
32
-	die;
32
+    die;
33 33
 }
34 34
 
35 35
 if ( ! class_exists( 'PAnD' ) ) {
36 36
 
37
-	/**
38
-	 * Class PAnD
39
-	 */
40
-	class PAnD {
41
-
42
-		/**
43
-		 * Init hooks.
44
-		 */
45
-		public static function init() {
46
-			add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) );
47
-			add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) );
48
-		}
49
-
50
-		/**
51
-		 * Enqueue javascript and variables.
52
-		 */
53
-		public static function load_script() {
54
-
55
-		    if(is_customize_preview()) return;
56
-
57
-			wp_enqueue_script(
58
-				'dismissible-notices',
59
-				plugins_url( 'dismiss-notice.js', __FILE__ ),
60
-				array( 'jquery', 'common' ),
61
-				false,
62
-				true
63
-			);
64
-
65
-			wp_localize_script(
66
-				'dismissible-notices',
67
-				'dismissible_notice',
68
-				array(
69
-					'nonce' => wp_create_nonce( 'dismissible-notice' ),
70
-				)
71
-			);
72
-		}
73
-
74
-		/**
75
-		 * Handles Ajax request to persist notices dismissal.
76
-		 * Uses check_ajax_referer to verify nonce.
77
-		 */
78
-		public static function dismiss_admin_notice() {
79
-			$option_name        = sanitize_text_field( $_POST['option_name'] );
80
-			$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
81
-			$transient          = 0;
82
-
83
-			if ( 'forever' != $dismissible_length ) {
84
-				// If $dismissible_length is not an integer default to 1
85
-				$dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
86
-				$transient          = absint( $dismissible_length ) * DAY_IN_SECONDS;
87
-				$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
88
-			}
89
-
90
-			check_ajax_referer( 'dismissible-notice', 'nonce' );
91
-			set_site_transient( $option_name, $dismissible_length, $transient );
92
-			wp_die();
93
-		}
94
-
95
-		/**
96
-		 * Is admin notice active?
97
-		 *
98
-		 * @param string $arg data-dismissible content of notice.
99
-		 *
100
-		 * @return bool
101
-		 */
102
-		public static function is_admin_notice_active( $arg ) {
103
-			$array       = explode( '-', $arg );
104
-			$length      = array_pop( $array );
105
-			$option_name = implode( '-', $array );
106
-			$db_record   = get_site_transient( $option_name );
107
-
108
-			if ( 'forever' == $db_record ) {
109
-				return false;
110
-			} elseif ( absint( $db_record ) >= time() ) {
111
-				return false;
112
-			} else {
113
-				return true;
114
-			}
115
-		}
116
-
117
-	}
37
+    /**
38
+     * Class PAnD
39
+     */
40
+    class PAnD {
41
+
42
+        /**
43
+         * Init hooks.
44
+         */
45
+        public static function init() {
46
+            add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) );
47
+            add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) );
48
+        }
49
+
50
+        /**
51
+         * Enqueue javascript and variables.
52
+         */
53
+        public static function load_script() {
54
+
55
+            if(is_customize_preview()) return;
56
+
57
+            wp_enqueue_script(
58
+                'dismissible-notices',
59
+                plugins_url( 'dismiss-notice.js', __FILE__ ),
60
+                array( 'jquery', 'common' ),
61
+                false,
62
+                true
63
+            );
64
+
65
+            wp_localize_script(
66
+                'dismissible-notices',
67
+                'dismissible_notice',
68
+                array(
69
+                    'nonce' => wp_create_nonce( 'dismissible-notice' ),
70
+                )
71
+            );
72
+        }
73
+
74
+        /**
75
+         * Handles Ajax request to persist notices dismissal.
76
+         * Uses check_ajax_referer to verify nonce.
77
+         */
78
+        public static function dismiss_admin_notice() {
79
+            $option_name        = sanitize_text_field( $_POST['option_name'] );
80
+            $dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
81
+            $transient          = 0;
82
+
83
+            if ( 'forever' != $dismissible_length ) {
84
+                // If $dismissible_length is not an integer default to 1
85
+                $dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
86
+                $transient          = absint( $dismissible_length ) * DAY_IN_SECONDS;
87
+                $dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
88
+            }
89
+
90
+            check_ajax_referer( 'dismissible-notice', 'nonce' );
91
+            set_site_transient( $option_name, $dismissible_length, $transient );
92
+            wp_die();
93
+        }
94
+
95
+        /**
96
+         * Is admin notice active?
97
+         *
98
+         * @param string $arg data-dismissible content of notice.
99
+         *
100
+         * @return bool
101
+         */
102
+        public static function is_admin_notice_active( $arg ) {
103
+            $array       = explode( '-', $arg );
104
+            $length      = array_pop( $array );
105
+            $option_name = implode( '-', $array );
106
+            $db_record   = get_site_transient( $option_name );
107
+
108
+            if ( 'forever' == $db_record ) {
109
+                return false;
110
+            } elseif ( absint( $db_record ) >= time() ) {
111
+                return false;
112
+            } else {
113
+                return true;
114
+            }
115
+        }
116
+
117
+    }
118 118
 
119 119
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 /**
29 29
  * Exit if called directly.
30 30
  */
31
-if ( ! defined( 'ABSPATH' ) ) {
31
+if (!defined('ABSPATH')) {
32 32
 	die;
33 33
 }
34 34
 
35
-if ( ! class_exists( 'PAnD' ) ) {
35
+if (!class_exists('PAnD')) {
36 36
 
37 37
 	/**
38 38
 	 * Class PAnD
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 		 * Init hooks.
44 44
 		 */
45 45
 		public static function init() {
46
-			add_action( 'admin_enqueue_scripts', array( __CLASS__, 'load_script' ) );
47
-			add_action( 'wp_ajax_dismiss_admin_notice', array( __CLASS__, 'dismiss_admin_notice' ) );
46
+			add_action('admin_enqueue_scripts', array(__CLASS__, 'load_script'));
47
+			add_action('wp_ajax_dismiss_admin_notice', array(__CLASS__, 'dismiss_admin_notice'));
48 48
 		}
49 49
 
50 50
 		/**
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 		 */
53 53
 		public static function load_script() {
54 54
 
55
-		    if(is_customize_preview()) return;
55
+		    if (is_customize_preview()) return;
56 56
 
57 57
 			wp_enqueue_script(
58 58
 				'dismissible-notices',
59
-				plugins_url( 'dismiss-notice.js', __FILE__ ),
60
-				array( 'jquery', 'common' ),
59
+				plugins_url('dismiss-notice.js', __FILE__),
60
+				array('jquery', 'common'),
61 61
 				false,
62 62
 				true
63 63
 			);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 				'dismissible-notices',
67 67
 				'dismissible_notice',
68 68
 				array(
69
-					'nonce' => wp_create_nonce( 'dismissible-notice' ),
69
+					'nonce' => wp_create_nonce('dismissible-notice'),
70 70
 				)
71 71
 			);
72 72
 		}
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 		 * Uses check_ajax_referer to verify nonce.
77 77
 		 */
78 78
 		public static function dismiss_admin_notice() {
79
-			$option_name        = sanitize_text_field( $_POST['option_name'] );
80
-			$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
79
+			$option_name        = sanitize_text_field($_POST['option_name']);
80
+			$dismissible_length = sanitize_text_field($_POST['dismissible_length']);
81 81
 			$transient          = 0;
82 82
 
83
-			if ( 'forever' != $dismissible_length ) {
83
+			if ('forever' != $dismissible_length) {
84 84
 				// If $dismissible_length is not an integer default to 1
85
-				$dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
86
-				$transient          = absint( $dismissible_length ) * DAY_IN_SECONDS;
87
-				$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
85
+				$dismissible_length = (0 == absint($dismissible_length)) ? 1 : $dismissible_length;
86
+				$transient          = absint($dismissible_length)*DAY_IN_SECONDS;
87
+				$dismissible_length = strtotime(absint($dismissible_length).' days');
88 88
 			}
89 89
 
90
-			check_ajax_referer( 'dismissible-notice', 'nonce' );
91
-			set_site_transient( $option_name, $dismissible_length, $transient );
90
+			check_ajax_referer('dismissible-notice', 'nonce');
91
+			set_site_transient($option_name, $dismissible_length, $transient);
92 92
 			wp_die();
93 93
 		}
94 94
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @return bool
101 101
 		 */
102
-		public static function is_admin_notice_active( $arg ) {
103
-			$array       = explode( '-', $arg );
104
-			$length      = array_pop( $array );
105
-			$option_name = implode( '-', $array );
106
-			$db_record   = get_site_transient( $option_name );
102
+		public static function is_admin_notice_active($arg) {
103
+			$array       = explode('-', $arg);
104
+			$length      = array_pop($array);
105
+			$option_name = implode('-', $array);
106
+			$db_record   = get_site_transient($option_name);
107 107
 
108
-			if ( 'forever' == $db_record ) {
108
+			if ('forever' == $db_record) {
109 109
 				return false;
110
-			} elseif ( absint( $db_record ) >= time() ) {
110
+			} elseif (absint($db_record) >= time()) {
111 111
 				return false;
112 112
 			} else {
113 113
 				return true;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@
 block discarded – undo
52 52
 		 */
53 53
 		public static function load_script() {
54 54
 
55
-		    if(is_customize_preview()) return;
55
+		    if(is_customize_preview()) {
56
+		        return;
57
+		    }
56 58
 
57 59
 			wp_enqueue_script(
58 60
 				'dismissible-notices',
Please login to merge, or discard this patch.
classes/external/php/yui-php-cssmin-bundled/Utils.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
         $l = floatval(str_replace('%', '', $hslValues[2]));
39 39
 
40 40
         // Wrap and clamp, then fraction!
41
-        $h = ((($h % 360) + 360) % 360) / 360;
42
-        $s = self::clampNumber($s, 0, 100) / 100;
43
-        $l = self::clampNumber($l, 0, 100) / 100;
41
+        $h = ((($h%360) + 360)%360)/360;
42
+        $s = self::clampNumber($s, 0, 100)/100;
43
+        $l = self::clampNumber($l, 0, 100)/100;
44 44
 
45 45
         if ($s == 0) {
46
-            $r = $g = $b = self::roundNumber(255 * $l);
46
+            $r = $g = $b = self::roundNumber(255*$l);
47 47
         } else {
48
-            $v2 = $l < 0.5 ? $l * (1 + $s) : ($l + $s) - ($s * $l);
49
-            $v1 = (2 * $l) - $v2;
50
-            $r = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h + (1/3)));
51
-            $g = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h));
52
-            $b = self::roundNumber(255 * self::hueToRgb($v1, $v2, $h - (1/3)));
48
+            $v2 = $l < 0.5 ? $l*(1 + $s) : ($l + $s) - ($s*$l);
49
+            $v1 = (2*$l) - $v2;
50
+            $r = self::roundNumber(255*self::hueToRgb($v1, $v2, $h + (1/3)));
51
+            $g = self::roundNumber(255*self::hueToRgb($v1, $v2, $h));
52
+            $b = self::roundNumber(255*self::hueToRgb($v1, $v2, $h - (1/3)));
53 53
         }
54 54
 
55 55
         return array($r, $g, $b);
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $vh = $vh < 0 ? $vh + 1 : ($vh > 1 ? $vh - 1 : $vh);
68 68
 
69
-        if ($vh * 6 < 1) {
70
-            return $v1 + ($v2 - $v1) * 6 * $vh;
69
+        if ($vh*6 < 1) {
70
+            return $v1 + ($v2 - $v1)*6*$vh;
71 71
         }
72 72
 
73
-        if ($vh * 2 < 1) {
73
+        if ($vh*2 < 1) {
74 74
             return $v2;
75 75
         }
76 76
 
77
-        if ($vh * 3 < 2) {
78
-            return $v1 + ($v2 - $v1) * ((2 / 3) - $vh) * 6;
77
+        if ($vh*3 < 2) {
78
+            return $v1 + ($v2 - $v1)*((2/3) - $vh)*6;
79 79
         }
80 80
 
81 81
         return $v1;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
             switch ($letter) {
95 95
                 case 'M':
96 96
                 case 'm':
97
-                    return (int) $size * 1048576;
97
+                    return (int) $size*1048576;
98 98
                 case 'K':
99 99
                 case 'k':
100
-                    return (int) $size * 1024;
100
+                    return (int) $size*1024;
101 101
                 case 'G':
102 102
                 case 'g':
103
-                    return (int) $size * 1073741824;
103
+                    return (int) $size*1073741824;
104 104
             }
105 105
         }
106 106
         return (int) $size;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     public static function rgbPercentageToRgbInteger($rgbPercentage)
115 115
     {
116 116
         if (strpos($rgbPercentage, '%') !== false) {
117
-            $rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage)) * 2.55);
117
+            $rgbPercentage = self::roundNumber(floatval(str_replace('%', '', $rgbPercentage))*2.55);
118 118
         }
119 119
 
120 120
         return intval($rgbPercentage, 10);
Please login to merge, or discard this patch.
classes/external/php/jsmin.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     protected $inputLength = 0;
71 71
     protected $lookAhead   = null;
72 72
     protected $output      = '';
73
-    protected $lastByteOut  = '';
73
+    protected $lastByteOut = '';
74 74
     protected $keptComment = '';
75 75
 
76 76
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         }
107 107
 
108 108
         $mbIntEnc = null;
109
-        if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
109
+        if (function_exists('mb_strlen') && ((int) ini_get('mbstring.func_overload') & 2)) {
110 110
             $mbIntEnc = mb_internal_encoding();
111 111
             mb_internal_encoding('8bit');
112 112
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                         && ($this->b === $this->lastByteOut)) {
129 129
                     // Don't delete this space. If we do, the addition/subtraction
130 130
                     // could be parsed as a post-increment
131
-                } elseif (! $this->isAlphaNum($this->b)) {
131
+                } elseif (!$this->isAlphaNum($this->b)) {
132 132
                     $command = self::ACTION_DELETE_A;
133 133
                 }
134 134
             } elseif ($this->a === "\n") {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
                     // otherwise mb_strpos will give WARNING
140 140
                 } elseif ($this->b === null
141 141
                           || (false === strpos('{[(+-!~', $this->b)
142
-                              && ! $this->isAlphaNum($this->b))) {
142
+                              && !$this->isAlphaNum($this->b))) {
143 143
                     $command = self::ACTION_DELETE_A;
144 144
                 }
145
-            } elseif (! $this->isAlphaNum($this->a)) {
145
+            } elseif (!$this->isAlphaNum($this->a)) {
146 146
                 if ($this->b === ' '
147 147
                     || ($this->b === "\n"
148 148
                         && (false === strpos('}])+-"\'', $this->a)))) {
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 $this->a = $this->b;
199 199
                 if ($this->a === "'" || $this->a === '"') { // string literal
200 200
                     $str = $this->a; // in case needed for exception
201
-                    for(;;) {
201
+                    for (;;) {
202 202
                         $this->output .= $this->a;
203 203
                         $this->lastByteOut = $this->a;
204 204
 
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
             case self::ACTION_DELETE_A_B: // 3
227 227
                 $this->b = $this->next();
228 228
                 if ($this->b === '/' && $this->isRegexpLiteral()) {
229
-                    $this->output .= $this->a . $this->b;
229
+                    $this->output .= $this->a.$this->b;
230 230
                     $pattern = '/'; // keep entire pattern in case we need to report it in the exception
231
-                    for(;;) {
231
+                    for (;;) {
232 232
                         $this->a = $this->get();
233 233
                         $pattern .= $this->a;
234 234
                         if ($this->a === '[') {
235
-                            for(;;) {
235
+                            for (;;) {
236 236
                                 $this->output .= $this->a;
237 237
                                 $this->a = $this->get();
238 238
                                 $pattern .= $this->a;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                                 if ($this->isEOF($this->a)) {
248 248
                                     throw new JSMin_UnterminatedRegExpException(
249 249
                                         "JSMin: Unterminated set in RegExp at byte "
250
-                                            . $this->inputIndex .": {$pattern}");
250
+                                            . $this->inputIndex.": {$pattern}");
251 251
                                 }
252 252
                             }
253 253
                         }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 
293 293
         // if the "/" follows a keyword, it must be a regexp, otherwise it's best to assume division
294 294
 
295
-        $subject = $this->output . trim($this->a);
295
+        $subject = $this->output.trim($this->a);
296 296
         if (!preg_match('/(?:case|else|in|return|typeof)$/', $subject, $m)) {
297 297
             // not a keyword
298 298
             return false;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
     {
404 404
         $this->get();
405 405
         $comment = '';
406
-        for(;;) {
406
+        for (;;) {
407 407
             $get = $this->get();
408 408
             if ($get === '*') {
409 409
                 if ($this->peek() === '/') { // end of comment reached
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
                             // don't prepend a newline if two comments right after one another
415 415
                             $this->keptComment = "\n";
416 416
                         }
417
-                        $this->keptComment .= "/*!" . substr($comment, 1) . "*/\n";
417
+                        $this->keptComment .= "/*!".substr($comment, 1)."*/\n";
418 418
                     } else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
419 419
                         // IE conditional
420 420
                         $this->keptComment .= "/*{$comment}*/";
Please login to merge, or discard this patch.
classes/external/php/minify-html.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $this->_html = str_replace("\r\n", "\n", trim($html));
72 72
         if (isset($options['xhtml'])) {
73
-            $this->_isXhtml = (bool)$options['xhtml'];
73
+            $this->_isXhtml = (bool) $options['xhtml'];
74 74
         }
75 75
         if (isset($options['cssMinifier'])) {
76 76
             $this->_cssMinifier = $options['cssMinifier'];
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML'));
96 96
         }
97 97
 
98
-        $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']);
98
+        $this->_replacementHash = 'MINIFYHTML'.md5($_SERVER['REQUEST_TIME']);
99 99
         $this->_placeholders = array();
100 100
 
101 101
         // replace SCRIPTs (and minify) with placeholders
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             ,$this->_html);
112 112
 
113 113
         // remove HTML comments (not containing IE conditional comments).
114
-        if  ($this->_keepComments == false) {
114
+        if ($this->_keepComments == false) {
115 115
             $this->_html = preg_replace_callback(
116 116
                 '/<!--([\\s\\S]*?)-->/'
117 117
                 ,array($this, '_commentCB')
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
     protected function _reservePlace($content)
175 175
     {
176
-        $placeholder = '%' . $this->_replacementHash . count($this->_placeholders) . '%';
176
+        $placeholder = '%'.$this->_replacementHash.count($this->_placeholders).'%';
177 177
         $this->_placeholders[$placeholder] = $content;
178 178
         return $placeholder;
179 179
     }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     protected function _outsideTagCB($m)
189 189
     {
190
-        return '>' . preg_replace('/^\\s+|\\s+$/', ' ', $m[1]) . '<';
190
+        return '>'.preg_replace('/^\\s+|\\s+$/', ' ', $m[1]).'<';
191 191
     }
192 192
 
193 193
     protected function _removePreCB($m)
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     protected function _removeCdata($str)
260 260
     {
261 261
         return (false !== strpos($str, '<![CDATA['))
262
-            ? str_replace(array('/* <![CDATA[ */','/* ]]> */','/*<![CDATA[*/','/*]]>*/','<![CDATA[', ']]>'), '', $str)
262
+            ? str_replace(array('/* <![CDATA[ */', '/* ]]> */', '/*<![CDATA[*/', '/*]]>*/', '<![CDATA[', ']]>'), '', $str)
263 263
             : $str;
264 264
     }
265 265
 
Please login to merge, or discard this patch.
classes/autoptimizeCLI.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
  * WP-CLI commands for Autoptimize.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
     exit;
8 8
 }
9 9
 
10 10
 // This is a WP-CLI command, so bail if it's not available.
11
-if ( ! defined( 'WP_CLI' ) ) {
11
+if (!defined('WP_CLI')) {
12 12
     return;
13 13
 }
14 14
 
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return void
26 26
      */
27
-    public function clear( $args, $args_assoc ) {
28
-        WP_CLI::line( esc_html__( 'Flushing the cache...', 'autoptimize' ) );
27
+    public function clear($args, $args_assoc) {
28
+        WP_CLI::line(esc_html__('Flushing the cache...', 'autoptimize'));
29 29
         autoptimizeCache::clearall();
30
-        WP_CLI::success( esc_html__( 'Cache flushed.', 'autoptimize' ) );
30
+        WP_CLI::success(esc_html__('Cache flushed.', 'autoptimize'));
31 31
     }
32 32
 }
33 33
 
34
-WP_CLI::add_command( 'autoptimize', 'autoptimizeCLI' );
34
+WP_CLI::add_command('autoptimize', 'autoptimizeCLI');
Please login to merge, or discard this patch.
classes/autoptimizePartners.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * addons and/or affiliate services.
5 5
  */
6 6
 
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if (!defined('ABSPATH')) {
8 8
     exit;
9 9
 }
10 10
 
@@ -17,64 +17,64 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function run()
19 19
     {
20
-        if ( $this->enabled() ) {
21
-            add_filter( 'autoptimize_filter_settingsscreen_tabs', array( $this, 'add_partner_tabs' ), 10, 1 );
20
+        if ($this->enabled()) {
21
+            add_filter('autoptimize_filter_settingsscreen_tabs', array($this, 'add_partner_tabs'), 10, 1);
22 22
         }
23
-        add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
23
+        add_action('admin_menu', array($this, 'add_admin_menu'));
24 24
     }
25 25
 
26 26
     protected function enabled()
27 27
     {
28
-        return apply_filters( 'autoptimize_filter_show_partner_tabs', true );
28
+        return apply_filters('autoptimize_filter_show_partner_tabs', true);
29 29
     }
30 30
 
31
-    public function add_partner_tabs( $in )
31
+    public function add_partner_tabs($in)
32 32
     {
33
-        $in = array_merge( $in, array(
34
-            'ao_partners' => __( 'Optimize More!', 'autoptimize' ),
35
-        ) );
33
+        $in = array_merge($in, array(
34
+            'ao_partners' => __('Optimize More!', 'autoptimize'),
35
+        ));
36 36
 
37 37
         return $in;
38 38
     }
39 39
 
40 40
     public function add_admin_menu()
41 41
     {
42
-        if ( $this->enabled() ) {
43
-            add_submenu_page( null, 'AO partner', 'AO partner', 'manage_options', 'ao_partners', array( $this, 'ao_partners_page' ) );
42
+        if ($this->enabled()) {
43
+            add_submenu_page(null, 'AO partner', 'AO partner', 'manage_options', 'ao_partners', array($this, 'ao_partners_page'));
44 44
         }
45 45
     }
46 46
 
47 47
     protected function get_ao_partner_feed_markup()
48 48
     {
49
-        $no_feed_text = __( 'Have a look at <a href="http://optimizingmatters.com/">optimizingmatters.com</a> for Autoptimize power-ups!', 'autoptimize' );
49
+        $no_feed_text = __('Have a look at <a href="http://optimizingmatters.com/">optimizingmatters.com</a> for Autoptimize power-ups!', 'autoptimize');
50 50
         $output       = '';
51
-        if ( apply_filters( 'autoptimize_settingsscreen_remotehttp', true ) ) {
52
-            $rss      = fetch_feed( 'http://feeds.feedburner.com/OptimizingMattersDownloads' );
51
+        if (apply_filters('autoptimize_settingsscreen_remotehttp', true)) {
52
+            $rss      = fetch_feed('http://feeds.feedburner.com/OptimizingMattersDownloads');
53 53
             $maxitems = 0;
54 54
 
55
-            if ( ! is_wp_error( $rss ) ) {
56
-                $maxitems  = $rss->get_item_quantity( 20 );
57
-                $rss_items = $rss->get_items( 0, $maxitems );
55
+            if (!is_wp_error($rss)) {
56
+                $maxitems  = $rss->get_item_quantity(20);
57
+                $rss_items = $rss->get_items(0, $maxitems);
58 58
             }
59 59
 
60
-            if ( 0 == $maxitems ) {
60
+            if (0 == $maxitems) {
61 61
                 $output .= $no_feed_text;
62 62
             } else {
63 63
                 $output .= '<ul>';
64
-                foreach ( $rss_items as $item ) {
65
-                    $item_url  = esc_url( $item->get_permalink() );
64
+                foreach ($rss_items as $item) {
65
+                    $item_url  = esc_url($item->get_permalink());
66 66
                     $enclosure = $item->get_enclosure();
67 67
 
68 68
                     $output .= '<li class="itemDetail">';
69
-                    $output .= '<h3 class="itemTitle"><a href="' . $item_url . '" target="_blank">' . esc_html( $item->get_title() ) . '</a></h3>';
69
+                    $output .= '<h3 class="itemTitle"><a href="'.$item_url.'" target="_blank">'.esc_html($item->get_title()).'</a></h3>';
70 70
 
71
-                    if ( $enclosure && ( false !== strpos( $enclosure->get_type(), 'image' ) ) ) {
72
-                        $img_url = esc_url( $enclosure->get_link() );
73
-                        $output .= '<div class="itemImage"><a href="' . $item_url . '" target="_blank"><img src="' . $img_url . '"></a></div>';
71
+                    if ($enclosure && (false !== strpos($enclosure->get_type(), 'image'))) {
72
+                        $img_url = esc_url($enclosure->get_link());
73
+                        $output .= '<div class="itemImage"><a href="'.$item_url.'" target="_blank"><img src="'.$img_url.'"></a></div>';
74 74
                     }
75 75
 
76
-                    $output .= '<div class="itemDescription">' . wp_kses_post( $item->get_description() ) . '</div>';
77
-                    $output .= '<div class="itemButtonRow"><div class="itemButton button-secondary"><a href="' . $item_url . '" target="_blank">' . __( 'More info', 'autoptimize' ) . '</a></div></div>';
76
+                    $output .= '<div class="itemDescription">'.wp_kses_post($item->get_description()).'</div>';
77
+                    $output .= '<div class="itemButtonRow"><div class="itemButton button-secondary"><a href="'.$item_url.'" target="_blank">'.__('More info', 'autoptimize').'</a></div></div>';
78 78
                     $output .= '</li>';
79 79
                 }
80 80
                 $output .= '</ul>';
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     }
134 134
     </style>
135 135
     <div class="wrap">
136
-        <h1><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1>
136
+        <h1><?php _e('Autoptimize Settings', 'autoptimize'); ?></h1>
137 137
         <?php echo autoptimizeConfig::ao_admin_tabs(); ?>
138
-        <?php echo '<h2>' . __( "These Autoptimize power-ups and related services will improve your site's performance even more!", 'autoptimize' ) . '</h2>'; ?>
138
+        <?php echo '<h2>'.__("These Autoptimize power-ups and related services will improve your site's performance even more!", 'autoptimize').'</h2>'; ?>
139 139
         <div>
140 140
             <?php echo $this->get_ao_partner_feed_markup(); ?>
141 141
         </div>
Please login to merge, or discard this patch.
classes/autoptimizeCSSmin.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Thin wrapper around css minifiers to avoid rewriting a bunch of existing code.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
     exit;
8 8
 }
9 9
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @param bool $raise_limits Whether to raise memory limits or not. Default true.
23 23
      */
24
-    public function __construct( $raise_limits = true )
24
+    public function __construct($raise_limits = true)
25 25
     {
26
-        $this->minifier = new Autoptimize\tubalmartin\CssMin\Minifier( $raise_limits );
26
+        $this->minifier = new Autoptimize\tubalmartin\CssMin\Minifier($raise_limits);
27 27
     }
28 28
 
29 29
     /**
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return string
36 36
      */
37
-    public function run( $css )
37
+    public function run($css)
38 38
     {
39
-        $result = $this->minifier->run( $css );
39
+        $result = $this->minifier->run($css);
40 40
 
41 41
         return $result;
42 42
     }
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return string
50 50
      */
51
-    public static function minify( $css )
51
+    public static function minify($css)
52 52
     {
53 53
         $minifier = new self();
54 54
 
55
-        return $minifier->run( $css );
55
+        return $minifier->run($css);
56 56
     }
57 57
 }
Please login to merge, or discard this patch.