Completed
Pull Request — master (#254)
by
unknown
02:09
created
config/default.php 1 patch
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.
classes/autoptimizeBase.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -412,7 +412,7 @@
 block discarded – undo
412 412
          * First element is the filepath, second is the md5 hash of contents
413 413
          * the filepath had when it was being processed.
414 414
          * If we don't have those, we'll bail out early.
415
-        */
415
+         */
416 416
         $filepath = null;
417 417
         $filehash = null;
418 418
 
Please login to merge, or discard this patch.
php/persist-admin-notices-dismissal/persist-admin-notices-dismissal.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -29,131 +29,131 @@
 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() ) {
56
-				return;
57
-			}
58
-
59
-			wp_enqueue_script(
60
-				'dismissible-notices',
61
-				plugins_url( 'dismiss-notice.js', __FILE__ ),
62
-				array( 'jquery', 'common' ),
63
-				false,
64
-				true
65
-			);
66
-
67
-			wp_localize_script(
68
-				'dismissible-notices',
69
-				'dismissible_notice',
70
-				array(
71
-					'nonce' => wp_create_nonce( 'dismissible-notice' ),
72
-				)
73
-			);
74
-		}
75
-
76
-		/**
77
-		 * Handles Ajax request to persist notices dismissal.
78
-		 * Uses check_ajax_referer to verify nonce.
79
-		 */
80
-		public static function dismiss_admin_notice() {
81
-			$option_name        = sanitize_text_field( $_POST['option_name'] );
82
-			$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
83
-
84
-			if ( 'forever' != $dismissible_length ) {
85
-				// If $dismissible_length is not an integer default to 1
86
-				$dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
87
-				$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
88
-			}
89
-
90
-			check_ajax_referer( 'dismissible-notice', 'nonce' );
91
-			self::set_admin_notice_cache( $option_name, $dismissible_length );
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   = self::get_admin_notice_cache( $option_name );
107
-			if ( 'forever' == $db_record ) {
108
-				return false;
109
-			} elseif ( absint( $db_record ) >= time() ) {
110
-				return false;
111
-			} else {
112
-				return true;
113
-			}
114
-		}
115
-
116
-		/**
117
-		 * Returns admin notice cached timeout.
118
-		 *
119
-		 * @access public
120
-		 *
121
-		 * @param string|bool $id admin notice name or false.
122
-		 *
123
-		 * @return array|bool The timeout. False if expired.
124
-		 */
125
-		public static function get_admin_notice_cache( $id = false ) {
126
-			if ( ! $id ) {
127
-				return false;
128
-			}
129
-			$cache_key = 'pand-' . md5( $id );
130
-			$timeout   = get_site_option( $cache_key );
131
-			$timeout   = 'forever' === $timeout ? time() + 60 : $timeout;
132
-
133
-			if ( empty( $timeout ) || time() > $timeout ) {
134
-				return false;
135
-			}
136
-
137
-			return $timeout;
138
-		}
139
-
140
-		/**
141
-		 * Sets admin notice timeout in site option.
142
-		 *
143
-		 * @access public
144
-		 *
145
-		 * @param string      $id       Data Identifier.
146
-		 * @param string|bool $timeout  Timeout for admin notice.
147
-		 *
148
-		 * @return bool
149
-		 */
150
-		public static function set_admin_notice_cache( $id, $timeout ) {
151
-			$cache_key = 'pand-' . md5( $id );
152
-			update_site_option( $cache_key, $timeout );
153
-
154
-			return true;
155
-		}
156
-
157
-	}
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() ) {
56
+                return;
57
+            }
58
+
59
+            wp_enqueue_script(
60
+                'dismissible-notices',
61
+                plugins_url( 'dismiss-notice.js', __FILE__ ),
62
+                array( 'jquery', 'common' ),
63
+                false,
64
+                true
65
+            );
66
+
67
+            wp_localize_script(
68
+                'dismissible-notices',
69
+                'dismissible_notice',
70
+                array(
71
+                    'nonce' => wp_create_nonce( 'dismissible-notice' ),
72
+                )
73
+            );
74
+        }
75
+
76
+        /**
77
+         * Handles Ajax request to persist notices dismissal.
78
+         * Uses check_ajax_referer to verify nonce.
79
+         */
80
+        public static function dismiss_admin_notice() {
81
+            $option_name        = sanitize_text_field( $_POST['option_name'] );
82
+            $dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
83
+
84
+            if ( 'forever' != $dismissible_length ) {
85
+                // If $dismissible_length is not an integer default to 1
86
+                $dismissible_length = ( 0 == absint( $dismissible_length ) ) ? 1 : $dismissible_length;
87
+                $dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
88
+            }
89
+
90
+            check_ajax_referer( 'dismissible-notice', 'nonce' );
91
+            self::set_admin_notice_cache( $option_name, $dismissible_length );
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   = self::get_admin_notice_cache( $option_name );
107
+            if ( 'forever' == $db_record ) {
108
+                return false;
109
+            } elseif ( absint( $db_record ) >= time() ) {
110
+                return false;
111
+            } else {
112
+                return true;
113
+            }
114
+        }
115
+
116
+        /**
117
+         * Returns admin notice cached timeout.
118
+         *
119
+         * @access public
120
+         *
121
+         * @param string|bool $id admin notice name or false.
122
+         *
123
+         * @return array|bool The timeout. False if expired.
124
+         */
125
+        public static function get_admin_notice_cache( $id = false ) {
126
+            if ( ! $id ) {
127
+                return false;
128
+            }
129
+            $cache_key = 'pand-' . md5( $id );
130
+            $timeout   = get_site_option( $cache_key );
131
+            $timeout   = 'forever' === $timeout ? time() + 60 : $timeout;
132
+
133
+            if ( empty( $timeout ) || time() > $timeout ) {
134
+                return false;
135
+            }
136
+
137
+            return $timeout;
138
+        }
139
+
140
+        /**
141
+         * Sets admin notice timeout in site option.
142
+         *
143
+         * @access public
144
+         *
145
+         * @param string      $id       Data Identifier.
146
+         * @param string|bool $timeout  Timeout for admin notice.
147
+         *
148
+         * @return bool
149
+         */
150
+        public static function set_admin_notice_cache( $id, $timeout ) {
151
+            $cache_key = 'pand-' . md5( $id );
152
+            update_site_option( $cache_key, $timeout );
153
+
154
+            return true;
155
+        }
156
+
157
+    }
158 158
 
159 159
 }
Please login to merge, or discard this patch.
classes/autoptimizeConfig.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
     {
16 16
         if ( is_admin() ) {
17 17
             // Add the admin page and settings.
18
-			if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
19
-				add_action( 'network_admin_menu', array( $this, 'addmenu' ) );
20
-			} else {
21
-				add_action( 'admin_menu', array( $this, 'addmenu' ) );
22
-			}
18
+            if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
19
+                add_action( 'network_admin_menu', array( $this, 'addmenu' ) );
20
+            } else {
21
+                add_action( 'admin_menu', array( $this, 'addmenu' ) );
22
+            }
23 23
             add_action( 'admin_init', array( $this, 'registersettings' ) );
24 24
 
25 25
             // Set meta info.
@@ -630,11 +630,11 @@  discard block
 block discarded – undo
630 630
 
631 631
     public function addmenu()
632 632
     {
633
-		if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
634
-			$hook = add_submenu_page( 'settings.php',  __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_network_options', 'autoptimize', array( $this, 'show' ) );
635
-		} else {
636
-			$hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show' ) );
637
-		}
633
+        if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
634
+            $hook = add_submenu_page( 'settings.php',  __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_network_options', 'autoptimize', array( $this, 'show' ) );
635
+        } else {
636
+            $hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show' ) );
637
+        }
638 638
 		
639 639
         add_action( 'admin_print_scripts-' . $hook, array( $this, 'autoptimize_admin_scripts' ) );
640 640
         add_action( 'admin_print_styles-' . $hook, array( $this, 'autoptimize_admin_styles' ) );
Please login to merge, or discard this patch.
classes/autoptimizeExtra.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
     public function run()
34 34
     {
35 35
         if ( is_admin() ) {
36
-			if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
37
-				add_action( 'network_admin_menu', array( $this, 'admin_menu' ) );
38
-			} else {
39
-				add_action( 'admin_menu', array( $this, 'admin_menu' ) );
40
-			}
41
-			add_action( 'admin_init', array( $this, 'registersettings' ) );
36
+            if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
37
+                add_action( 'network_admin_menu', array( $this, 'admin_menu' ) );
38
+            } else {
39
+                add_action( 'admin_menu', array( $this, 'admin_menu' ) );
40
+            }
41
+            add_action( 'admin_init', array( $this, 'registersettings' ) );
42 42
             add_filter( 'autoptimize_filter_settingsscreen_tabs', array( $this, 'add_extra_tab' ) );
43 43
         } else {
44 44
             $this->run_on_frontend();
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
         );
343 343
     }
344 344
 	
345
-	public function registersettings() {
346
-		register_setting( 'autoptimize_extra_settings', 'autoptimize_extra_settings' );
347
-	}
345
+    public function registersettings() {
346
+        register_setting( 'autoptimize_extra_settings', 'autoptimize_extra_settings' );
347
+    }
348 348
 
349 349
     public function add_extra_tab( $in )
350 350
     {
Please login to merge, or discard this patch.
classes/autoptimizeOption.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -12,70 +12,70 @@
 block discarded – undo
12 12
  */
13 13
 class autoptimizeOption
14 14
 {
15
-	/**
16
-	 * Constructor, add filter on saving options.
17
-	 */
18
-	public function __construct()
15
+    /**
16
+     * Constructor, add filter on saving options.
17
+     */
18
+    public function __construct()
19 19
     {
20
-		add_action('init', [$this, 'check_multisite_on_saving_options']);
21
-	}
20
+        add_action('init', [$this, 'check_multisite_on_saving_options']);
21
+    }
22 22
 
23
-	/**
24
-	 * Retrieves the option in standalone and multisite instances.
25
-	 * 
26
-	 * @param string $option  Name of option to retrieve. Expected to not be SQL-escaped.
27
-	 * @param mixed  $default Optional. Default value to return if the option does not exist.
28
-	 * @return mixed Value set for the option.
29
-	 */
23
+    /**
24
+     * Retrieves the option in standalone and multisite instances.
25
+     * 
26
+     * @param string $option  Name of option to retrieve. Expected to not be SQL-escaped.
27
+     * @param mixed  $default Optional. Default value to return if the option does not exist.
28
+     * @return mixed Value set for the option.
29
+     */
30 30
     public static function get_option( $option, $default = false )
31 31
     {
32
-		if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
33
-			return get_network_option( get_main_network_id(), $option );
34
-		} else {
35
-			return get_option( $option, $default );
36
-		}
32
+        if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
33
+            return get_network_option( get_main_network_id(), $option );
34
+        } else {
35
+            return get_option( $option, $default );
36
+        }
37 37
     }
38 38
 
39
-	/**
40
-	 * Saves the option in standalone and multisite instances.
41
-	 * 
42
-	 * @param string      $option   Option name. Expected to not be SQL-escaped.
43
-	 * @param mixed       $value    Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
44
-	 * @param string|bool $autoload Optional. Whether to load the option when WordPress starts up. For existing options,
45
-	 *                              `$autoload` can only be updated using `update_option()` if `$value` is also changed.
39
+    /**
40
+     * Saves the option in standalone and multisite instances.
41
+     * 
42
+     * @param string      $option   Option name. Expected to not be SQL-escaped.
43
+     * @param mixed       $value    Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
44
+     * @param string|bool $autoload Optional. Whether to load the option when WordPress starts up. For existing options,
45
+     *                              `$autoload` can only be updated using `update_option()` if `$value` is also changed.
46 46
      *			                    Accepts 'yes'|true to enable or 'no'|false to disable. For non-existent options,
47 47
      *				                the default value is 'yes'. Default null.
48 48
      * @return bool False if value was not updated and true if value was updated.
49
-	 */
49
+     */
50 50
     public static function update_option( $option, $value, $autoload = null )
51 51
     {
52
-		if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
53
-			return update_network_option( get_main_network_id(), $option, $value );
54
-		} else {
55
-			return update_option( $option, $value, $autoload );
56
-		}
52
+        if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
53
+            return update_network_option( get_main_network_id(), $option, $value );
54
+        } else {
55
+            return update_option( $option, $value, $autoload );
56
+        }
57 57
     }
58 58
 
59
-	/**
60
-	 * Use the pre_update_option filter to check if the option to be saved if from autoptimize and
61
-	 * in that case, take care of multisite case.
62
-	 */
63
-	public static function check_multisite_on_saving_options()
59
+    /**
60
+     * Use the pre_update_option filter to check if the option to be saved if from autoptimize and
61
+     * in that case, take care of multisite case.
62
+     */
63
+    public static function check_multisite_on_saving_options()
64 64
     {
65
-		if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
66
-			add_filter( 'pre_update_option', [$this, 'update_autoptimize_option_on_network'], 10, 3 );
67
-		}
68
-	}
65
+        if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
66
+            add_filter( 'pre_update_option', [$this, 'update_autoptimize_option_on_network'], 10, 3 );
67
+        }
68
+    }
69 69
 
70
-	public static function update_autoptimize_option_on_network( $value, $option, $old_value ) {
71
-		if( strpos( $option, 'autoptimize_' ) === 0 ) {
72
-			if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
73
-				 update_network_option( get_main_network_id(), $option, $value );
74
-				 // Return old value, to stop update_option logic.
75
-				 return $old_value;
76
-			}
77
-		}
78
-		return $value;
79
-	}
70
+    public static function update_autoptimize_option_on_network( $value, $option, $old_value ) {
71
+        if( strpos( $option, 'autoptimize_' ) === 0 ) {
72
+            if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
73
+                    update_network_option( get_main_network_id(), $option, $value );
74
+                    // Return old value, to stop update_option logic.
75
+                    return $old_value;
76
+            }
77
+        }
78
+        return $value;
79
+    }
80 80
 }
81 81
 new autoptimizeOption();
Please login to merge, or discard this patch.
classes/autoptimizeImages.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
     public function run()
98 98
     {
99 99
         if ( is_admin() ) {
100
-			if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
101
-				add_action( 'network_admin_menu', array( $this, 'imgopt_admin_menu' ) );
102
-			} else {
103
-				add_action( 'admin_menu', array( $this, 'imgopt_admin_menu' ) );
104
-			}
105
-			add_action( 'admin_init', array( $this, 'registersettings' ) );
100
+            if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
101
+                add_action( 'network_admin_menu', array( $this, 'imgopt_admin_menu' ) );
102
+            } else {
103
+                add_action( 'admin_menu', array( $this, 'imgopt_admin_menu' ) );
104
+            }
105
+            add_action( 'admin_init', array( $this, 'registersettings' ) );
106 106
             add_filter( 'autoptimize_filter_settingsscreen_tabs', array( $this, 'add_imgopt_tab' ), 9 );
107 107
         } else {
108 108
             $this->run_on_frontend();
@@ -875,9 +875,9 @@  discard block
 block discarded – undo
875 875
         );
876 876
     }
877 877
 	
878
-	public function registersettings() {
879
-		register_setting( 'autoptimize_imgopt_settings', 'autoptimize_imgopt_settings' );
880
-	}
878
+    public function registersettings() {
879
+        register_setting( 'autoptimize_imgopt_settings', 'autoptimize_imgopt_settings' );
880
+    }
881 881
 
882 882
     public function add_imgopt_tab( $in )
883 883
     {
Please login to merge, or discard this patch.
classes/autoptimizePartners.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@
 block discarded – undo
20 20
         if ( $this->enabled() ) {
21 21
             add_filter( 'autoptimize_filter_settingsscreen_tabs', array( $this, 'add_partner_tabs' ), 10, 1 );
22 22
         }
23
-		if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
24
-			add_action( 'network_admin_menu', array( $this, 'add_admin_menu' ) );
25
-		} else {
26
-			add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
27
-		}
23
+        if ( is_multisite() && is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
24
+            add_action( 'network_admin_menu', array( $this, 'add_admin_menu' ) );
25
+        } else {
26
+            add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
27
+        }
28 28
     }
29 29
 
30 30
     protected function enabled()
Please login to merge, or discard this patch.