Completed
Pull Request — master (#254)
by
unknown
01:50
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/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.
classes/autoptimizeOption.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -12,103 +12,103 @@
 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
-	 * Ensure that is_plugin_active_for_network function is declared.
25
-	 */
26
-	public static function maybe_include_plugin_functions() {
27
-		if( ! function_exists( 'is_plugin_active_for_network' ) ) {
28
-			include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
29
-		}
30
-	}
23
+    /**
24
+     * Ensure that is_plugin_active_for_network function is declared.
25
+     */
26
+    public static function maybe_include_plugin_functions() {
27
+        if( ! function_exists( 'is_plugin_active_for_network' ) ) {
28
+            include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
29
+        }
30
+    }
31 31
 
32
-	/**
33
-	 * Retrieves the option in standalone and multisite instances.
34
-	 * 
35
-	 * @param string $option  Name of option to retrieve. Expected to not be SQL-escaped.
36
-	 * @param mixed  $default Optional. Default value to return if the option does not exist.
37
-	 * @return mixed Value set for the option.
38
-	 */
32
+    /**
33
+     * Retrieves the option in standalone and multisite instances.
34
+     * 
35
+     * @param string $option  Name of option to retrieve. Expected to not be SQL-escaped.
36
+     * @param mixed  $default Optional. Default value to return if the option does not exist.
37
+     * @return mixed Value set for the option.
38
+     */
39 39
     public static function get_option( $option, $default = false )
40 40
     {
41
-		// Ensure that is_plugin_active_for_network function is declared.
42
-		self::maybe_include_plugin_functions();
41
+        // Ensure that is_plugin_active_for_network function is declared.
42
+        self::maybe_include_plugin_functions();
43 43
 		
44
-		// This is always a network setting.
45
-		if( 'autoptimize_enable_site_config' === $option ) {
46
-			return get_network_option( get_main_network_id(), $option );
47
-		}
44
+        // This is always a network setting.
45
+        if( 'autoptimize_enable_site_config' === $option ) {
46
+            return get_network_option( get_main_network_id(), $option );
47
+        }
48 48
 
49
-		// If the plugin is network activated and our per site setting is not on, use the network configuration.
50
-		$configuration_per_site = get_network_option( get_main_network_id(), 'autoptimize_enable_site_config' );
51
-		if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 'on' !== $configuration_per_site ) {
52
-			return get_network_option( get_main_network_id(), $option );
53
-		}
49
+        // If the plugin is network activated and our per site setting is not on, use the network configuration.
50
+        $configuration_per_site = get_network_option( get_main_network_id(), 'autoptimize_enable_site_config' );
51
+        if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 'on' !== $configuration_per_site ) {
52
+            return get_network_option( get_main_network_id(), $option );
53
+        }
54 54
 			
55
-		return get_option( $option, $default );
55
+        return get_option( $option, $default );
56 56
     }
57 57
 
58
-	/**
59
-	 * Saves the option in standalone and multisite instances.
60
-	 * 
61
-	 * @param string      $option   Option name. Expected to not be SQL-escaped.
62
-	 * @param mixed       $value    Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
63
-	 * @param string|bool $autoload Optional. Whether to load the option when WordPress starts up. For existing options,
64
-	 *                              `$autoload` can only be updated using `update_option()` if `$value` is also changed.
58
+    /**
59
+     * Saves the option in standalone and multisite instances.
60
+     * 
61
+     * @param string      $option   Option name. Expected to not be SQL-escaped.
62
+     * @param mixed       $value    Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
63
+     * @param string|bool $autoload Optional. Whether to load the option when WordPress starts up. For existing options,
64
+     *                              `$autoload` can only be updated using `update_option()` if `$value` is also changed.
65 65
      *			                    Accepts 'yes'|true to enable or 'no'|false to disable. For non-existent options,
66 66
      *				                the default value is 'yes'. Default null.
67 67
      * @return bool False if value was not updated and true if value was updated.
68
-	 */
68
+     */
69 69
     public static function update_option( $option, $value, $autoload = null )
70 70
     {
71 71
 		
72
-		// Ensure that is_plugin_active_for_network function is declared.
73
-		self::maybe_include_plugin_functions();
74
-		$blog_id = get_current_blog_id();
72
+        // Ensure that is_plugin_active_for_network function is declared.
73
+        self::maybe_include_plugin_functions();
74
+        $blog_id = get_current_blog_id();
75 75
 		
76
-		if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) {
77
-			return update_network_option( get_main_network_id(), $option, $value );
78
-		} else {
79
-			return update_option( $option, $value, $autoload );
80
-		}
76
+        if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) {
77
+            return update_network_option( get_main_network_id(), $option, $value );
78
+        } else {
79
+            return update_option( $option, $value, $autoload );
80
+        }
81 81
     }
82 82
 
83
-	/**
84
-	 * Use the pre_update_option filter to check if the option to be saved if from autoptimize and
85
-	 * in that case, take care of multisite case.
86
-	 */
87
-	public static function check_multisite_on_saving_options()
83
+    /**
84
+     * Use the pre_update_option filter to check if the option to be saved if from autoptimize and
85
+     * in that case, take care of multisite case.
86
+     */
87
+    public static function check_multisite_on_saving_options()
88 88
     {
89
-		// Ensure that is_plugin_active_for_network function is declared.
90
-		self::maybe_include_plugin_functions();
91
-		$blog_id = get_current_blog_id();
89
+        // Ensure that is_plugin_active_for_network function is declared.
90
+        self::maybe_include_plugin_functions();
91
+        $blog_id = get_current_blog_id();
92 92
 		
93
-		if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) {
94
-			add_filter( 'pre_update_option', [$this, 'update_autoptimize_option_on_network'], 10, 3 );
95
-		}
96
-	}
93
+        if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) {
94
+            add_filter( 'pre_update_option', [$this, 'update_autoptimize_option_on_network'], 10, 3 );
95
+        }
96
+    }
97 97
 
98
-	public static function update_autoptimize_option_on_network( $value, $option, $old_value ) {
99
-		if( strpos( $option, 'autoptimize_' ) === 0 ) {
98
+    public static function update_autoptimize_option_on_network( $value, $option, $old_value ) {
99
+        if( strpos( $option, 'autoptimize_' ) === 0 ) {
100 100
 			
101
-			// Ensure that is_plugin_active_for_network function is declared.
102
-			self::maybe_include_plugin_functions();
103
-			$blog_id = get_current_blog_id();
101
+            // Ensure that is_plugin_active_for_network function is declared.
102
+            self::maybe_include_plugin_functions();
103
+            $blog_id = get_current_blog_id();
104 104
 		
105
-			if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) {
106
-				 update_network_option( get_main_network_id(), $option, $value );
107
-				 // Return old value, to stop update_option logic.
108
-				 return $old_value;
109
-			}
110
-		}
111
-		return $value;
112
-	}
105
+            if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) {
106
+                    update_network_option( get_main_network_id(), $option, $value );
107
+                    // Return old value, to stop update_option logic.
108
+                    return $old_value;
109
+            }
110
+        }
111
+        return $value;
112
+    }
113 113
 }
114 114
 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_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_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();
@@ -877,9 +877,9 @@  discard block
 block discarded – undo
877 877
         );
878 878
     }
879 879
 	
880
-	public function registersettings() {
881
-		register_setting( 'autoptimize_imgopt_settings', 'autoptimize_imgopt_settings' );
882
-	}
880
+    public function registersettings() {
881
+        register_setting( 'autoptimize_imgopt_settings', 'autoptimize_imgopt_settings' );
882
+    }
883 883
 
884 884
     public function add_imgopt_tab( $in )
885 885
     {
Please login to merge, or discard this patch.
classes/autoptimizeMain.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -492,7 +492,7 @@
 block discarded – undo
492 492
             'autoptimize_css_exclude',
493 493
             'autoptimize_html',
494 494
             'autoptimize_html_keepcomments',
495
-			'autoptimize_enable_site_config',
495
+            'autoptimize_enable_site_config',
496 496
             'autoptimize_js',
497 497
             'autoptimize_js_aggregate',
498 498
             'autoptimize_js_exclude',
Please login to merge, or discard this patch.
classes/autoptimizeConfig.php 1 patch
Indentation   +17 added lines, -17 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_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
19
-				add_action( 'network_admin_menu', array( $this, 'addmenu' ) );
20
-			}
18
+            if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
19
+                add_action( 'network_admin_menu', array( $this, 'addmenu' ) );
20
+            }
21 21
 
22
-			add_action( 'admin_menu', array( $this, 'addmenu' ) );
22
+            add_action( 'admin_menu', array( $this, 'addmenu' ) );
23 23
             add_action( 'admin_init', array( $this, 'registersettings' ) );
24 24
 
25 25
             // Set meta info.
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
         return self::$instance;
60 60
     }
61 61
 
62
-	public function show_message() {
63
-		?>
62
+    public function show_message() {
63
+        ?>
64 64
 			<h1>Autoptimize enabled in network</h1>
65 65
 			<p>If you want to enable per site configutation for Autoptimize, please contact your network administrator.</p>
66 66
 		<?php
67
-	}
67
+    }
68 68
 
69 69
     public function show()
70 70
     {
@@ -654,14 +654,14 @@  discard block
 block discarded – undo
654 654
 
655 655
     public function addmenu()
656 656
     {
657
-		if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
658
-			$hook = add_submenu_page( 'settings.php',  __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_network_options', 'autoptimize', array( $this, 'show' ) );
659
-		}
660
-		if ( ! is_multisite() || 'on' === autoptimizeOption::get_option('autoptimize_enable_site_config') ) {
661
-			$hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show' ) );
662
-		} else {
663
-			$hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show_message' ) );
664
-		}
657
+        if ( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) ) {
658
+            $hook = add_submenu_page( 'settings.php',  __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_network_options', 'autoptimize', array( $this, 'show' ) );
659
+        }
660
+        if ( ! is_multisite() || 'on' === autoptimizeOption::get_option('autoptimize_enable_site_config') ) {
661
+            $hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show' ) );
662
+        } else {
663
+            $hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show_message' ) );
664
+        }
665 665
 
666 666
         add_action( 'admin_print_scripts-' . $hook, array( $this, 'autoptimize_admin_scripts' ) );
667 667
         add_action( 'admin_print_styles-' . $hook, array( $this, 'autoptimize_admin_styles' ) );
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
     public function registersettings() {
683 683
         register_setting( 'autoptimize', 'autoptimize_html' );
684 684
         register_setting( 'autoptimize', 'autoptimize_html_keepcomments' );
685
-		register_setting( 'autoptimize', 'autoptimize_enable_site_config' );
685
+        register_setting( 'autoptimize', 'autoptimize_enable_site_config' );
686 686
         register_setting( 'autoptimize', 'autoptimize_js' );
687 687
         register_setting( 'autoptimize', 'autoptimize_js_aggregate' );
688 688
         register_setting( 'autoptimize', 'autoptimize_js_exclude' );
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
         static $config = array(
742 742
             'autoptimize_html' => 0,
743 743
             'autoptimize_html_keepcomments' => 0,
744
-			'autoptimize_enable_site_config' => 0,
744
+            'autoptimize_enable_site_config' => 0,
745 745
             'autoptimize_js' => 0,
746 746
             'autoptimize_js_aggregate' => 1,
747 747
             'autoptimize_js_exclude' => 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js',
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_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_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.