Completed
Push — master ( 471c26...e80620 )
by frank
01:49
created
classes/critcss-inc/admin_settings_key.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,27 +12,27 @@  discard block
 block discarded – undo
12 12
  * @param string $message      Message.
13 13
  * @param string $color        Color to highlight message in.
14 14
  */
15
-function ao_ccss_render_key( $key, $status, $status_msg, $message, $color ) {
16
-    if ( defined( 'AUTOPTIMIZE_CRITICALCSS_API_KEY' ) ) {
17
-        $key = __( 'API key provided by your host/ WordPress administrator, no need to enter anything here. In case of problems with the API key, contact your host/ WordPress administrator.', 'autoptimize' );
15
+function ao_ccss_render_key($key, $status, $status_msg, $message, $color) {
16
+    if (defined('AUTOPTIMIZE_CRITICALCSS_API_KEY')) {
17
+        $key = __('API key provided by your host/ WordPress administrator, no need to enter anything here. In case of problems with the API key, contact your host/ WordPress administrator.', 'autoptimize');
18 18
     }
19 19
     ?>
20 20
     <ul id="key-panel">
21 21
         <li class="itemDetail">
22
-            <h2 class="itemTitle fleft"><?php _e( 'API Key', 'autoptimize' ); ?>: <span style="color:<?php echo $color; ?>;"><?php echo $status_msg; ?></span></h2>
22
+            <h2 class="itemTitle fleft"><?php _e('API Key', 'autoptimize'); ?>: <span style="color:<?php echo $color; ?>;"><?php echo $status_msg; ?></span></h2>
23 23
             <button type="button" class="toggle-btn">
24
-                <?php if ( 'valid' != $status ) { ?>
24
+                <?php if ('valid' != $status) { ?>
25 25
                     <span class="toggle-indicator dashicons dashicons-arrow-up"></span>
26 26
                 <?php } else { ?>
27 27
                     <span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
28 28
                 <?php } ?>
29 29
             </button>
30
-            <?php if ( 'valid' != $status ) { ?>
30
+            <?php if ('valid' != $status) { ?>
31 31
                 <div class="collapsible">
32 32
             <?php } else { ?>
33 33
                 <div class="collapsible hidden">
34 34
             <?php } ?>
35
-            <?php if ( 'valid' != $status ) { ?>
35
+            <?php if ('valid' != $status) { ?>
36 36
                 <div style="clear:both;padding:2px 10px;border-left:solid;border-left-width:5px;border-left-color:<?php echo $color; ?>;background-color:white;">
37 37
                     <p><?php echo $message; ?></p>
38 38
                 </div>
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
                 <table id="key" class="form-table">
41 41
                     <tr>
42 42
                         <th scope="row">
43
-                            <?php _e( 'Your API Key', 'autoptimize' ); ?>
43
+                            <?php _e('Your API Key', 'autoptimize'); ?>
44 44
                         </th>
45 45
                         <td>
46
-                            <textarea id="autoptimize_ccss_key" name="autoptimize_ccss_key" rows='3' style="width:100%;" placeholder="<?php _e( 'Please enter your criticalcss.com API key here.', 'autoptimize' ); ?>"><?php echo trim( esc_textarea( $key ) ); ?></textarea>
46
+                            <textarea id="autoptimize_ccss_key" name="autoptimize_ccss_key" rows='3' style="width:100%;" placeholder="<?php _e('Please enter your criticalcss.com API key here.', 'autoptimize'); ?>"><?php echo trim(esc_textarea($key)); ?></textarea>
47 47
                             <p class="notes">
48
-                                <?php _e( 'Enter your <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> API key above. The key is revalidated every time a new job is sent to it.<br />To obtain your API key, go to <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> > Account > API Keys.<br />Requests to generate a critical CSS via the API are priced at £5 per domain per month.<br /><strong>Not sure yet? With the <a href="https://criticalcss.com/faq/?aff=1#trial" target="_blank">30 day money back guarantee</a>, you have nothing to lose!</strong>', 'autoptimize' ); ?>
48
+                                <?php _e('Enter your <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> API key above. The key is revalidated every time a new job is sent to it.<br />To obtain your API key, go to <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> > Account > API Keys.<br />Requests to generate a critical CSS via the API are priced at £5 per domain per month.<br /><strong>Not sure yet? With the <a href="https://criticalcss.com/faq/?aff=1#trial" target="_blank">30 day money back guarantee</a>, you have nothing to lose!</strong>', 'autoptimize'); ?>
49 49
                             </p>
50 50
                         </td>
51 51
                     </tr>
Please login to merge, or discard this patch.
classes/critcss-inc/admin_settings_rules.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
 ?>
14 14
     <ul id="rules-panel">
15 15
         <li class="itemDetail">
16
-            <h2 class="itemTitle"><?php _e( 'Rules', 'autoptimize' ); ?></h2>
16
+            <h2 class="itemTitle"><?php _e('Rules', 'autoptimize'); ?></h2>
17 17
 
18 18
             <!-- BEGIN Rule dialogs -->
19 19
             <!-- Unsaved dialog -->
20 20
             <div id="unSavedWarning" class="hidden updated settings-error notice notice-warning is-dismissible">
21
-                <p><?php _e( "<strong>Rules or Queue changed!</strong> Don't forget to save your changes!", 'autoptimize' ); ?></p>
21
+                <p><?php _e("<strong>Rules or Queue changed!</strong> Don't forget to save your changes!", 'autoptimize'); ?></p>
22 22
             </div>
23 23
 
24 24
             <!-- Create/edit rule dialog -->
@@ -26,97 +26,97 @@  discard block
 block discarded – undo
26 26
                 <table class="form-table rules">
27 27
                     <tr id="critcss_addedit_type_wrapper">
28 28
                         <th scope="row">
29
-                            <?php _e( 'Rule Type', 'autoptimize' ); ?>
29
+                            <?php _e('Rule Type', 'autoptimize'); ?>
30 30
                         </th>
31 31
                         <td>
32 32
                             <select id="critcss_addedit_type" style="width:100%;">
33
-                                <option value="paths"><?php _e( 'Path', 'autoptimize' ); ?></option>
34
-                                <option value="types"><?php _e( 'Conditional Tag', 'autoptimize' ); ?></option>
33
+                                <option value="paths"><?php _e('Path', 'autoptimize'); ?></option>
34
+                                <option value="types"><?php _e('Conditional Tag', 'autoptimize'); ?></option>
35 35
                             </select>
36 36
                         </td>
37 37
                     </tr>
38 38
                     <tr id="critcss_addedit_path_wrapper">
39 39
                         <th scope="row">
40
-                            <?php _e( 'String in Path', 'autoptimize' ); ?>
40
+                            <?php _e('String in Path', 'autoptimize'); ?>
41 41
                         </th>
42 42
                         <td>
43
-                            <input type="text" id="critcss_addedit_path" placeholder="<?php _e( "Enter a part of the URL that identifies the page(s) you're targetting.", 'autoptimize' ); ?>" style="width:100%;" value="">
43
+                            <input type="text" id="critcss_addedit_path" placeholder="<?php _e("Enter a part of the URL that identifies the page(s) you're targetting.", 'autoptimize'); ?>" style="width:100%;" value="">
44 44
                         </td>
45 45
                     </tr>
46 46
                     <tr id="critcss_addedit_pagetype_wrapper">
47 47
                         <th scope="row">
48
-                            <?php _e( 'Conditional Tag, Custom Post Type or Page Template', 'autoptimize' ); ?>
48
+                            <?php _e('Conditional Tag, Custom Post Type or Page Template', 'autoptimize'); ?>
49 49
                         </th>
50 50
                         <td>
51 51
                             <select id="critcss_addedit_pagetype" style="width:100%;">
52
-                                <option value="" disabled selected><?php _e( 'Select from the list below...', 'autoptimize' ); ?></option>
53
-                                <optgroup label="<?php _e( 'Standard Conditional Tags', 'autoptimize' ); ?>">
52
+                                <option value="" disabled selected><?php _e('Select from the list below...', 'autoptimize'); ?></option>
53
+                                <optgroup label="<?php _e('Standard Conditional Tags', 'autoptimize'); ?>">
54 54
                                     <?php
55 55
                                     // Render grouped simple conditional tags.
56
-                                    foreach ( $ao_ccss_types as $ctag ) {
57
-                                        $optgrp = substr( $ctag, 0, 3 );
58
-                                        if ( substr( $ctag, 0, 3 ) === 'is_' ) {
59
-                                            echo '<option value="' . $ctag . '">' . $ctag . '</option>';
56
+                                    foreach ($ao_ccss_types as $ctag) {
57
+                                        $optgrp = substr($ctag, 0, 3);
58
+                                        if (substr($ctag, 0, 3) === 'is_') {
59
+                                            echo '<option value="'.$ctag.'">'.$ctag.'</option>';
60 60
                                         }
61
-                                        $prevgrp = substr( $ctag, 0, 3 );
61
+                                        $prevgrp = substr($ctag, 0, 3);
62 62
                                     }
63 63
 
64 64
                                     // Render grouped custom post types, templates and specific conditional tags.
65
-                                    foreach ( $ao_ccss_types as $type ) {
66
-                                        $optgrp = substr( $type, 0, 3 );
65
+                                    foreach ($ao_ccss_types as $type) {
66
+                                        $optgrp = substr($type, 0, 3);
67 67
 
68 68
                                         // Option groups labels.
69
-                                        if ( $optgrp !== $prevgrp && 'is_' !== $optgrp ) {
69
+                                        if ($optgrp !== $prevgrp && 'is_' !== $optgrp) {
70 70
                                             ?>
71 71
                                             </optgroup>
72 72
                                             <?php
73
-                                            if ( substr( $type, 0, 12 ) === 'custom_post_' ) {
73
+                                            if (substr($type, 0, 12) === 'custom_post_') {
74 74
                                                 ?>
75
-                                                <optgroup label="<?php _e( 'Custom Post Types', 'autoptimize' ); ?>">
75
+                                                <optgroup label="<?php _e('Custom Post Types', 'autoptimize'); ?>">
76 76
                                                 <?php
77
-                                            } elseif ( substr( $type, 0, 9 ) === 'template_' ) {
77
+                                            } elseif (substr($type, 0, 9) === 'template_') {
78 78
                                                 ?>
79
-                                                <optgroup label="<?php _e( 'Page Templates', 'autoptimize' ); ?>">
79
+                                                <optgroup label="<?php _e('Page Templates', 'autoptimize'); ?>">
80 80
                                                 <?php
81
-                                            } elseif ( substr( $type, 0, 4 ) === 'bbp_' ) {
81
+                                            } elseif (substr($type, 0, 4) === 'bbp_') {
82 82
                                                 ?>
83
-                                                <optgroup label="<?php _e( 'BBPress Conditional Tags', 'autoptimize' ); ?>">
83
+                                                <optgroup label="<?php _e('BBPress Conditional Tags', 'autoptimize'); ?>">
84 84
                                                 <?php
85
-                                            } elseif ( substr( $type, 0, 3 ) === 'bp_' ) {
85
+                                            } elseif (substr($type, 0, 3) === 'bp_') {
86 86
                                                 ?>
87
-                                                <optgroup label="<?php _e( 'BuddyPress Conditional Tags', 'autoptimize' ); ?>">
87
+                                                <optgroup label="<?php _e('BuddyPress Conditional Tags', 'autoptimize'); ?>">
88 88
                                                 <?php
89
-                                            } elseif ( substr( $type, 0, 4 ) === 'edd_' ) {
89
+                                            } elseif (substr($type, 0, 4) === 'edd_') {
90 90
                                                 ?>
91
-                                                <optgroup label="<?php _e( 'Easy Digital Downloads Conditional Tags', 'autoptimize' ); ?>">
91
+                                                <optgroup label="<?php _e('Easy Digital Downloads Conditional Tags', 'autoptimize'); ?>">
92 92
                                                 <?php
93
-                                            } elseif ( substr( $type, 0, 4 ) === 'woo_' ) {
93
+                                            } elseif (substr($type, 0, 4) === 'woo_') {
94 94
                                                 ?>
95
-                                                <optgroup label="<?php _e( 'WooCommerce Conditional Tags', 'autoptimize' ); ?>">
95
+                                                <optgroup label="<?php _e('WooCommerce Conditional Tags', 'autoptimize'); ?>">
96 96
                                                 <?php
97 97
                                             }
98 98
                                         }
99 99
 
100 100
                                         // Options.
101
-                                        if ( 'is_' !== $optgrp ) {
101
+                                        if ('is_' !== $optgrp) {
102 102
                                             // Remove prefix from custom post types, templates and some specific conditional tags.
103
-                                            if ( substr( $type, 0, 12 ) === 'custom_post_' ) {
104
-                                                $_type = str_replace( 'custom_post_', '', $type );
105
-                                            } elseif ( substr( $type, 0, 9 ) === 'template_' ) {
106
-                                                $_type = str_replace( 'template_', '', $type );
107
-                                            } elseif ( 'bbp_is_bbpress' == $type ) {
108
-                                                $_type = str_replace( 'bbp_', '', $type );
109
-                                            } elseif ( 'bp_is_buddypress' == $type ) {
110
-                                                $_type = str_replace( 'bp_', '', $type );
111
-                                            } elseif ( substr( $type, 0, 4 ) === 'woo_' ) {
112
-                                                $_type = str_replace( 'woo_', '', $type );
113
-                                            } elseif ( substr( $type, 0, 4 ) === 'edd_' ) {
114
-                                                $_type = str_replace( 'edd_', '', $type );
103
+                                            if (substr($type, 0, 12) === 'custom_post_') {
104
+                                                $_type = str_replace('custom_post_', '', $type);
105
+                                            } elseif (substr($type, 0, 9) === 'template_') {
106
+                                                $_type = str_replace('template_', '', $type);
107
+                                            } elseif ('bbp_is_bbpress' == $type) {
108
+                                                $_type = str_replace('bbp_', '', $type);
109
+                                            } elseif ('bp_is_buddypress' == $type) {
110
+                                                $_type = str_replace('bp_', '', $type);
111
+                                            } elseif (substr($type, 0, 4) === 'woo_') {
112
+                                                $_type = str_replace('woo_', '', $type);
113
+                                            } elseif (substr($type, 0, 4) === 'edd_') {
114
+                                                $_type = str_replace('edd_', '', $type);
115 115
                                             } else {
116 116
                                                 $_type = $type;
117 117
                                             }
118 118
 
119
-                                            echo '<option value="' . $type . '">' . $_type . '</option>';
119
+                                            echo '<option value="'.$type.'">'.$_type.'</option>';
120 120
                                             $prevgrp = $optgrp;
121 121
                                         }
122 122
                                     }
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
                     </tr>
128 128
                     <tr>
129 129
                         <th scope="row">
130
-                            <?php _e( 'Custom Critical CSS', 'autoptimize' ); ?>
130
+                            <?php _e('Custom Critical CSS', 'autoptimize'); ?>
131 131
                         </th>
132 132
                         <td>
133
-                            <textarea id="critcss_addedit_css" rows="13" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste your specific critical CSS here and hit submit to save.', 'autoptimize' ); ?>"></textarea>
133
+                            <textarea id="critcss_addedit_css" rows="13" cols="10" style="width:100%;" placeholder="<?php _e('Paste your specific critical CSS here and hit submit to save.', 'autoptimize'); ?>"></textarea>
134 134
                             <input type="hidden" id="critcss_addedit_file">
135 135
                             <input type="hidden" id="critcss_addedit_id">
136 136
                         </td>
@@ -139,23 +139,23 @@  discard block
 block discarded – undo
139 139
             </div>
140 140
 
141 141
             <!-- Remove dialog -->
142
-            <div id="confirm-rm" title="<?php _e( 'Delete Rule', 'autoptimize' ); ?>" class="hidden">
143
-                <p><?php _e( 'This Critical CSS rule will be deleted immediately and cannot be recovered.<br /><br /><strong>Are you sure?</strong>', 'autoptimize' ); ?></p>
142
+            <div id="confirm-rm" title="<?php _e('Delete Rule', 'autoptimize'); ?>" class="hidden">
143
+                <p><?php _e('This Critical CSS rule will be deleted immediately and cannot be recovered.<br /><br /><strong>Are you sure?</strong>', 'autoptimize'); ?></p>
144 144
             </div>
145 145
 
146 146
             <!-- Remove All dialog -->
147
-            <div id="confirm-rm-all" title="<?php _e( 'Delete all Rules and Jobs', 'autoptimize' ); ?>" class="hidden">
148
-                <p><?php _e( 'All Critical CSS rules will be deleted immediately and cannot be recovered.<br /><br /><strong>Are you sure?</strong>', 'autoptimize' ); ?></p>
147
+            <div id="confirm-rm-all" title="<?php _e('Delete all Rules and Jobs', 'autoptimize'); ?>" class="hidden">
148
+                <p><?php _e('All Critical CSS rules will be deleted immediately and cannot be recovered.<br /><br /><strong>Are you sure?</strong>', 'autoptimize'); ?></p>
149 149
             </div>
150 150
 
151 151
             <!-- Add/edit default critical CSS dialog -->
152 152
             <div id="default_critcss_wrapper" class="hidden">
153
-                <textarea id="dummyDefault" rows="19" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste your MINIFIED default critical CSS here and hit submit to save. This is the critical CSS to be used for every page NOT MATCHING any rule.', 'autoptimize' ); ?>"></textarea>
153
+                <textarea id="dummyDefault" rows="19" cols="10" style="width:100%;" placeholder="<?php _e('Paste your MINIFIED default critical CSS here and hit submit to save. This is the critical CSS to be used for every page NOT MATCHING any rule.', 'autoptimize'); ?>"></textarea>
154 154
             </div>
155 155
 
156 156
             <!-- Add/edit additional critical CSS dialog -->
157 157
             <div id="additional_critcss_wrapper" class="hidden">
158
-                <textarea id="dummyAdditional" rows="19" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste your MINIFIED additional critical CSS here and hit submit to save. This is the CSS to be added AT THE END of every critical CSS provided by a matching rule, or the default one.', 'autoptimize' ); ?>"></textarea>
158
+                <textarea id="dummyAdditional" rows="19" cols="10" style="width:100%;" placeholder="<?php _e('Paste your MINIFIED additional critical CSS here and hit submit to save. This is the CSS to be added AT THE END of every critical CSS provided by a matching rule, or the default one.', 'autoptimize'); ?>"></textarea>
159 159
             </div>
160 160
 
161 161
             <!-- Wrapper for in screen notices -->
@@ -165,38 +165,38 @@  discard block
 block discarded – undo
165 165
             <!-- BEGIN Rules UI -->
166 166
             <div class="howto">
167 167
                 <div class="title-wrap">
168
-                    <h4 class="title"><?php _e( 'How To Use Autoptimize CriticalCSS Power-Up Rules', 'autoptimize' ); ?></h4>
169
-                    <p class="subtitle"><?php _e( 'Click the side arrow to toggle instructions', 'autoptimize' ); ?></p>
168
+                    <h4 class="title"><?php _e('How To Use Autoptimize CriticalCSS Power-Up Rules', 'autoptimize'); ?></h4>
169
+                    <p class="subtitle"><?php _e('Click the side arrow to toggle instructions', 'autoptimize'); ?></p>
170 170
                 </div>
171 171
                 <button type="button" class="toggle-btn">
172 172
                     <span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
173 173
                 </button>
174 174
                 <div class="howto-wrap hidden">
175
-                <p><?php _e( "TL;DR:<br />Critical CSS files from <span class='badge auto'>AUTO</span> <strong>rules are updated automatically</strong> while from <span class='badge manual'>MANUAL</span> <strong>rules are not.</strong>", 'autoptimize' ); ?></p>
175
+                <p><?php _e("TL;DR:<br />Critical CSS files from <span class='badge auto'>AUTO</span> <strong>rules are updated automatically</strong> while from <span class='badge manual'>MANUAL</span> <strong>rules are not.</strong>", 'autoptimize'); ?></p>
176 176
                     <ol>
177
-                        <li><?php _e( 'When a valid <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> API key is in place, Autoptimize CriticalCSS Power-Up starts to operate <strong>automatically</strong>.', 'autoptimize' ); ?></li>
178
-                        <li><?php _e( 'Upon a request to any of the frontend pages made by a <strong>not logged in user</strong>, it will <strong>asynchronously</strong> fetch and update the critical CSS from <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for conditional tags you have on your site (e.g. is_page, is_single, is_archive etc.)', 'autoptimize' ); ?></li>
179
-                        <li><?php _e( 'These requests also creates an <span class="badge auto">AUTO</span> rule for you. The critical CSS files from <span class="badge auto">AUTO</span> <strong>rules are updated automatically</strong> when a CSS file in your theme or frontend plugins changes.', 'autoptimize' ); ?></li>
180
-                        <li><?php _e( 'If you want to make any fine tunning in the critical CSS file of an <span class="badge auto">AUTO</span> rule, click on "Edit" button of that rule, change what you need, submit and save it. The rule you\'ve just edited becomes a <span class="badge manual">MANUAL</span> rule then.', 'autoptimize' ); ?></li>
181
-                        <li><?php _e( 'You can create <span class="badge manual">MANUAL</span> rules for specific page paths (URL). Longer, more specific paths have higher priority over shorter ones, which in turn have higher priority over <span class="badge auto">AUTO</span> rules. Also, critical CSS files from <span class="badge manual">MANUAL</span> <strong>rules are NEVER updated automatically.</strong>', 'autoptimize' ); ?></li>
182
-                        <li><?php _e( 'You can also create an <span class="badge auto">AUTO</span> rule for a path by leaving its critical CSS content empty. The critical CSS for that path will be automatically fetched from <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for you and updated whenever it changes.', 'autoptimize' ); ?></li>
183
-                        <li><?php _e( "If you see an <span class='badge auto'>AUTO</span> rule with a <span class='badge review'>R</span> besides it (R is after REVIEW), it means that the fetched critical CSS for that rule is not 100% guaranteed to work according to <a href='https://criticalcss.com/?aff=1' target='_blank'>criticalcss.com</a> analysis. It's advised that you edit and review that rule to make any required adjustments.", 'autoptimize' ); ?></li>
184
-                        <li><?php _e( 'At any time you can delete an <span class="badge auto">AUTO</span> or <span class="badge manual">MANUAL</span> rule by cliking on "Remove" button of the desired rule and saving your changes.', 'autoptimize' ); ?></li>
177
+                        <li><?php _e('When a valid <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> API key is in place, Autoptimize CriticalCSS Power-Up starts to operate <strong>automatically</strong>.', 'autoptimize'); ?></li>
178
+                        <li><?php _e('Upon a request to any of the frontend pages made by a <strong>not logged in user</strong>, it will <strong>asynchronously</strong> fetch and update the critical CSS from <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for conditional tags you have on your site (e.g. is_page, is_single, is_archive etc.)', 'autoptimize'); ?></li>
179
+                        <li><?php _e('These requests also creates an <span class="badge auto">AUTO</span> rule for you. The critical CSS files from <span class="badge auto">AUTO</span> <strong>rules are updated automatically</strong> when a CSS file in your theme or frontend plugins changes.', 'autoptimize'); ?></li>
180
+                        <li><?php _e('If you want to make any fine tunning in the critical CSS file of an <span class="badge auto">AUTO</span> rule, click on "Edit" button of that rule, change what you need, submit and save it. The rule you\'ve just edited becomes a <span class="badge manual">MANUAL</span> rule then.', 'autoptimize'); ?></li>
181
+                        <li><?php _e('You can create <span class="badge manual">MANUAL</span> rules for specific page paths (URL). Longer, more specific paths have higher priority over shorter ones, which in turn have higher priority over <span class="badge auto">AUTO</span> rules. Also, critical CSS files from <span class="badge manual">MANUAL</span> <strong>rules are NEVER updated automatically.</strong>', 'autoptimize'); ?></li>
182
+                        <li><?php _e('You can also create an <span class="badge auto">AUTO</span> rule for a path by leaving its critical CSS content empty. The critical CSS for that path will be automatically fetched from <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for you and updated whenever it changes.', 'autoptimize'); ?></li>
183
+                        <li><?php _e("If you see an <span class='badge auto'>AUTO</span> rule with a <span class='badge review'>R</span> besides it (R is after REVIEW), it means that the fetched critical CSS for that rule is not 100% guaranteed to work according to <a href='https://criticalcss.com/?aff=1' target='_blank'>criticalcss.com</a> analysis. It's advised that you edit and review that rule to make any required adjustments.", 'autoptimize'); ?></li>
184
+                        <li><?php _e('At any time you can delete an <span class="badge auto">AUTO</span> or <span class="badge manual">MANUAL</span> rule by cliking on "Remove" button of the desired rule and saving your changes.', 'autoptimize'); ?></li>
185 185
                     </ol>
186 186
                 </div>
187 187
             </div>
188
-            <textarea id="autoptimize_css_defer_inline" name="autoptimize_css_defer_inline" rows="19" cols="10" style="width:100%;"><?php echo autoptimizeStyles::sanitize_css( get_option( 'autoptimize_css_defer_inline', '' ) ); ?></textarea>
189
-            <textarea id="autoptimize_ccss_additional" name="autoptimize_ccss_additional" rows="19" cols="10" style="width:100%;"><?php echo autoptimizeStyles::sanitize_css( get_option( 'autoptimize_ccss_additional', '' ) ); ?></textarea>
188
+            <textarea id="autoptimize_css_defer_inline" name="autoptimize_css_defer_inline" rows="19" cols="10" style="width:100%;"><?php echo autoptimizeStyles::sanitize_css(get_option('autoptimize_css_defer_inline', '')); ?></textarea>
189
+            <textarea id="autoptimize_ccss_additional" name="autoptimize_ccss_additional" rows="19" cols="10" style="width:100%;"><?php echo autoptimizeStyles::sanitize_css(get_option('autoptimize_ccss_additional', '')); ?></textarea>
190 190
             <table class="rules-list" cellspacing="0"><tbody id="rules-list"></tbody></table>
191
-            <input class="hidden" type="text" id="critCssOrigin" name="autoptimize_ccss_rules" value='<?php echo ( json_encode( $ao_ccss_rules, JSON_FORCE_OBJECT ) ); ?>'>
191
+            <input class="hidden" type="text" id="critCssOrigin" name="autoptimize_ccss_rules" value='<?php echo (json_encode($ao_ccss_rules, JSON_FORCE_OBJECT)); ?>'>
192 192
             <div class="submit rules-btn">
193 193
                 <div class="alignleft">
194
-                    <span id="addCritCssButton" class="button-secondary"><?php _e( 'Add New Rule', 'autoptimize' ); ?></span>
195
-                    <span id="editDefaultButton" class="button-secondary"><?php _e( 'Edit Default Rule CSS', 'autoptimize' ); ?></span>
196
-                    <span id="editAdditionalButton" class="button-secondary"><?php _e( 'Add CSS To All Rules', 'autoptimize' ); ?></span>
194
+                    <span id="addCritCssButton" class="button-secondary"><?php _e('Add New Rule', 'autoptimize'); ?></span>
195
+                    <span id="editDefaultButton" class="button-secondary"><?php _e('Edit Default Rule CSS', 'autoptimize'); ?></span>
196
+                    <span id="editAdditionalButton" class="button-secondary"><?php _e('Add CSS To All Rules', 'autoptimize'); ?></span>
197 197
                 </div>
198 198
                 <div class="alignright">
199
-                    <span id="removeAllRules" class="button-secondary" style="color:red;"><?php _e( 'Remove all rules', 'autoptimize' ); ?></span>
199
+                    <span id="removeAllRules" class="button-secondary" style="color:red;"><?php _e('Remove all rules', 'autoptimize'); ?></span>
200 200
                 </div>
201 201
             </div>
202 202
             <!-- END Rules UI -->
Please login to merge, or discard this patch.
classes/autoptimizeConfig.php 1 patch
Spacing   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Main configuration logic.
4 4
  */
5 5
 
6
-if ( ! defined( 'ABSPATH' ) ) {
6
+if (!defined('ABSPATH')) {
7 7
     exit;
8 8
 }
9 9
 
@@ -35,33 +35,33 @@  discard block
 block discarded – undo
35 35
      */
36 36
     private function __construct()
37 37
     {
38
-        if ( is_admin() ) {
38
+        if (is_admin()) {
39 39
             // Add the admin page and settings.
40
-            if ( autoptimizeOptionWrapper::is_ao_active_for_network() ) {
41
-                add_action( 'network_admin_menu', array( $this, 'addmenu' ) );
40
+            if (autoptimizeOptionWrapper::is_ao_active_for_network()) {
41
+                add_action('network_admin_menu', array($this, 'addmenu'));
42 42
             }
43 43
 
44
-            add_action( 'admin_menu', array( $this, 'addmenu' ) );
45
-            add_action( 'admin_init', array( $this, 'registersettings' ) );
46
-            add_action( 'admin_init', array( 'PAnD', 'init' ) );
44
+            add_action('admin_menu', array($this, 'addmenu'));
45
+            add_action('admin_init', array($this, 'registersettings'));
46
+            add_action('admin_init', array('PAnD', 'init'));
47 47
 
48 48
             // Set meta info.
49
-            if ( function_exists( 'plugin_row_meta' ) ) {
49
+            if (function_exists('plugin_row_meta')) {
50 50
                 // 2.8 and higher.
51
-                add_filter( 'plugin_row_meta', array( $this, 'setmeta' ), 10, 2 );
52
-            } elseif ( function_exists( 'post_class' ) ) {
51
+                add_filter('plugin_row_meta', array($this, 'setmeta'), 10, 2);
52
+            } elseif (function_exists('post_class')) {
53 53
                 // 2.7 and lower.
54
-                $plugin = plugin_basename( AUTOPTIMIZE_PLUGIN_DIR . 'autoptimize.php' );
55
-                add_filter( 'plugin_action_links_' . $plugin, array( $this, 'setmeta' ) );
54
+                $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php');
55
+                add_filter('plugin_action_links_'.$plugin, array($this, 'setmeta'));
56 56
             }
57 57
 
58 58
             // Clean cache?
59
-            if ( autoptimizeOptionWrapper::get_option( 'autoptimize_cache_clean' ) ) {
59
+            if (autoptimizeOptionWrapper::get_option('autoptimize_cache_clean')) {
60 60
                 autoptimizeCache::clearall();
61
-                autoptimizeOptionWrapper::update_option( 'autoptimize_cache_clean', 0 );
61
+                autoptimizeOptionWrapper::update_option('autoptimize_cache_clean', 0);
62 62
             }
63 63
 
64
-            $this->settings_screen_do_remote_http = apply_filters( 'autoptimize_settingsscreen_remotehttp', $this->settings_screen_do_remote_http );
64
+            $this->settings_screen_do_remote_http = apply_filters('autoptimize_settingsscreen_remotehttp', $this->settings_screen_do_remote_http);
65 65
         }
66 66
 
67 67
         // Adds the Autoptimize Toolbar to the Admin bar.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     static public function instance()
78 78
     {
79 79
         // Only one instance.
80
-        if ( null === self::$instance ) {
80
+        if (null === self::$instance) {
81 81
             self::$instance = new autoptimizeConfig();
82 82
         }
83 83
 
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
     public function show_network_message() {
88 88
         ?>
89 89
         <div class="wrap">
90
-            <h1><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1>
90
+            <h1><?php _e('Autoptimize Settings', 'autoptimize'); ?></h1>
91 91
             <?php echo $this->ao_admin_tabs(); ?>
92
-            <p style="font-size:120%;"><?php echo apply_filters( 'autoptimize_filter_settingsscreen_multisite_network_message', __( 'Autoptimize is enabled and configured on a WordPress network level. Please contact your network administrator if you need Autoptimize settings changed.', 'autoptimize' ) ); ?></p>
92
+            <p style="font-size:120%;"><?php echo apply_filters('autoptimize_filter_settingsscreen_multisite_network_message', __('Autoptimize is enabled and configured on a WordPress network level. Please contact your network administrator if you need Autoptimize settings changed.', 'autoptimize')); ?></p>
93 93
         </div>
94 94
         <?php
95 95
     }
@@ -184,32 +184,32 @@  discard block
 block discarded – undo
184 184
 <div class="wrap">
185 185
 
186 186
 <!-- Temporary nudge to disable aoccss power-up. -->
187
-<?php if ( autoptimizeUtils::is_plugin_active( 'autoptimize-criticalcss/ao_criticss_aas.php' ) ) { ?>
187
+<?php if (autoptimizeUtils::is_plugin_active('autoptimize-criticalcss/ao_criticss_aas.php')) { ?>
188 188
     <div class="notice-info notice"><p>
189
-        <?php _e( 'Autoptimize now includes the criticalcss.com integration that was previously part of the separate power-up. If you want you can simply disable the power-up and Autoptimize will take over immediately.', 'autoptimize' ); ?>
189
+        <?php _e('Autoptimize now includes the criticalcss.com integration that was previously part of the separate power-up. If you want you can simply disable the power-up and Autoptimize will take over immediately.', 'autoptimize'); ?>
190 190
     </p></div>
191 191
 <?php } ?>
192 192
 
193 193
 <div id="autoptimize_main">
194
-    <h1 id="ao_title"><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?></h1>
194
+    <h1 id="ao_title"><?php _e('Autoptimize Settings', 'autoptimize'); ?></h1>
195 195
     <?php echo $this->ao_admin_tabs(); ?>
196 196
 
197
-<form method="post" action="<?php echo admin_url( 'options.php' ); ?>">
198
-<?php settings_fields( 'autoptimize' ); ?>
197
+<form method="post" action="<?php echo admin_url('options.php'); ?>">
198
+<?php settings_fields('autoptimize'); ?>
199 199
 
200 200
 <ul>
201 201
 
202 202
 <?php
203 203
 // Only show enable site configuration in network site option.
204
-if ( is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network() ) {
204
+if (is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network()) {
205 205
 ?>
206 206
     <li class="itemDetail multiSite">
207
-        <h2 class="itemTitle"><?php _e( 'Multisite Options', 'autoptimize' ); ?></h2>
207
+        <h2 class="itemTitle"><?php _e('Multisite Options', 'autoptimize'); ?></h2>
208 208
         <table class="form-table">
209 209
             <tr valign="top">
210
-                <th scope="row"><?php _e( 'Enable site configuration?', 'autoptimize' ); ?></th>
211
-                <td><label class="cb_label"><input type="checkbox" id="autoptimize_enable_site_config" name="autoptimize_enable_site_config" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_enable_site_config' ) ? 'checked="checked" ' : ''; ?>/>
212
-                <?php _e( 'Enable Autoptimize configuration per site.', 'autoptimize' ); ?></label></td>
210
+                <th scope="row"><?php _e('Enable site configuration?', 'autoptimize'); ?></th>
211
+                <td><label class="cb_label"><input type="checkbox" id="autoptimize_enable_site_config" name="autoptimize_enable_site_config" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_enable_site_config') ? 'checked="checked" ' : ''; ?>/>
212
+                <?php _e('Enable Autoptimize configuration per site.', 'autoptimize'); ?></label></td>
213 213
             </tr>
214 214
         </table>
215 215
     </li>
@@ -218,120 +218,120 @@  discard block
 block discarded – undo
218 218
 <?php } ?>    
219 219
 
220 220
 <li class="itemDetail">
221
-<h2 class="itemTitle"><?php _e( 'JavaScript Options', 'autoptimize' ); ?></h2>
221
+<h2 class="itemTitle"><?php _e('JavaScript Options', 'autoptimize'); ?></h2>
222 222
 <table class="form-table">
223 223
 <tr valign="top">
224
-<th scope="row"><?php _e( 'Optimize JavaScript Code?', 'autoptimize' ); ?></th>
225
-<td><input type="checkbox" id="autoptimize_js" name="autoptimize_js" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js' ) ? 'checked="checked" ' : ''; ?>/></td>
224
+<th scope="row"><?php _e('Optimize JavaScript Code?', 'autoptimize'); ?></th>
225
+<td><input type="checkbox" id="autoptimize_js" name="autoptimize_js" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_js') ? 'checked="checked" ' : ''; ?>/></td>
226 226
 </tr>
227 227
 <tr valign="top" class="js_sub js_aggregate_master">
228
-<th scope="row"><?php _e( 'Aggregate JS-files?', 'autoptimize' ); ?></th>
229
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_aggregate" name="autoptimize_js_aggregate" <?php echo $conf->get( 'autoptimize_js_aggregate' ) ? 'checked="checked" ' : ''; ?>/>
230
-<?php _e( 'Aggregate all linked JS-files to have them loaded non-render blocking? If this option is off, the individual JS-files will remain in place but will be minified.', 'autoptimize' ); ?></label></td>
228
+<th scope="row"><?php _e('Aggregate JS-files?', 'autoptimize'); ?></th>
229
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_aggregate" name="autoptimize_js_aggregate" <?php echo $conf->get('autoptimize_js_aggregate') ? 'checked="checked" ' : ''; ?>/>
230
+<?php _e('Aggregate all linked JS-files to have them loaded non-render blocking? If this option is off, the individual JS-files will remain in place but will be minified.', 'autoptimize'); ?></label></td>
231 231
 </tr>
232 232
 <tr valign="top" class="js_sub js_not_aggregate">
233
-<th scope="row"><?php _e( 'Do not aggregate but defer?', 'autoptimize' ); ?></th>
234
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_defer_not_aggregate" name="autoptimize_js_defer_not_aggregate" <?php echo $conf->get( 'autoptimize_js_defer_not_aggregate' ) ? 'checked="checked" ' : ''; ?>/>
235
-<?php _e( 'When JS is not aggregated, all linked JS-files can be deferred instead, making them non-render-blocking.', 'autoptimize' ); ?></label></td>
233
+<th scope="row"><?php _e('Do not aggregate but defer?', 'autoptimize'); ?></th>
234
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_js_defer_not_aggregate" name="autoptimize_js_defer_not_aggregate" <?php echo $conf->get('autoptimize_js_defer_not_aggregate') ? 'checked="checked" ' : ''; ?>/>
235
+<?php _e('When JS is not aggregated, all linked JS-files can be deferred instead, making them non-render-blocking.', 'autoptimize'); ?></label></td>
236 236
 </tr>
237 237
 <tr valign="top" class="js_sub js_aggregate">
238
-<th scope="row"><?php _e( 'Also aggregate inline JS?', 'autoptimize' ); ?></th>
239
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_include_inline" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js_include_inline' ) ? 'checked="checked" ' : ''; ?>/>
240
-<?php _e( 'Let Autoptimize also extract JS from the HTML. <strong>Warning</strong>: this can make Autoptimize\'s cache size grow quickly, so only enable this if you know what you\'re doing.', 'autoptimize' ); ?></label></td>
238
+<th scope="row"><?php _e('Also aggregate inline JS?', 'autoptimize'); ?></th>
239
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_include_inline" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_js_include_inline') ? 'checked="checked" ' : ''; ?>/>
240
+<?php _e('Let Autoptimize also extract JS from the HTML. <strong>Warning</strong>: this can make Autoptimize\'s cache size grow quickly, so only enable this if you know what you\'re doing.', 'autoptimize'); ?></label></td>
241 241
 </tr>
242 242
 <tr valign="top" class="js_sub js_aggregate">
243
-<th scope="row"><?php _e( 'Force JavaScript in &lt;head&gt;?', 'autoptimize' ); ?></th>
244
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_forcehead" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js_forcehead' ) ? 'checked="checked" ' : ''; ?>/>
245
-<?php _e( 'Load JavaScript early, this can potentially fix some JS-errors, but makes the JS render blocking.', 'autoptimize' ); ?></label></td>
243
+<th scope="row"><?php _e('Force JavaScript in &lt;head&gt;?', 'autoptimize'); ?></th>
244
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_forcehead" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_js_forcehead') ? 'checked="checked" ' : ''; ?>/>
245
+<?php _e('Load JavaScript early, this can potentially fix some JS-errors, but makes the JS render blocking.', 'autoptimize'); ?></label></td>
246 246
 </tr>
247
-<?php if ( autoptimizeOptionWrapper::get_option( 'autoptimize_js_justhead' ) ) { ?>
247
+<?php if (autoptimizeOptionWrapper::get_option('autoptimize_js_justhead')) { ?>
248 248
 <tr valign="top" class="js_sub js_aggregate">
249 249
 <th scope="row">
250 250
 <?php
251
-    _e( 'Look for scripts only in &lt;head&gt;?', 'autoptimize' );
252
-    echo ' <i>' . __( '(deprecated)', 'autoptimize' ) . '</i>';
251
+    _e('Look for scripts only in &lt;head&gt;?', 'autoptimize');
252
+    echo ' <i>'.__('(deprecated)', 'autoptimize').'</i>';
253 253
 ?>
254 254
 </th>
255
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_justhead" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js_justhead' ) ? 'checked="checked" ' : ''; ?>/>
256
-<?php _e( 'Mostly useful in combination with previous option when using jQuery-based templates, but might help keeping cache size under control.', 'autoptimize' ); ?></label></td>
255
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_justhead" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_js_justhead') ? 'checked="checked" ' : ''; ?>/>
256
+<?php _e('Mostly useful in combination with previous option when using jQuery-based templates, but might help keeping cache size under control.', 'autoptimize'); ?></label></td>
257 257
 </tr>
258 258
 <?php } ?>
259 259
 <tr valign="top" class="js_sub">
260
-<th scope="row"><?php _e( 'Exclude scripts from Autoptimize:', 'autoptimize' ); ?></th>
261
-<td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo esc_attr( autoptimizeOptionWrapper::get_option( 'autoptimize_js_exclude', 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, js/jquery/jquery.min.js' ) ); ?>"/><br />
260
+<th scope="row"><?php _e('Exclude scripts from Autoptimize:', 'autoptimize'); ?></th>
261
+<td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo esc_attr(autoptimizeOptionWrapper::get_option('autoptimize_js_exclude', 'wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js, js/jquery/jquery.min.js')); ?>"/><br />
262 262
 <?php
263
-echo __( 'A comma-separated list of scripts you want to exclude from being optimized, for example \'whatever.js, another.js\' (without the quotes) to exclude those scripts from being aggregated by Autoptimize.', 'autoptimize' ) . ' ' . __( 'Important: excluded non-minified files are still minified by Autoptimize unless that option under "misc" is disabled.', 'autoptimize' );
263
+echo __('A comma-separated list of scripts you want to exclude from being optimized, for example \'whatever.js, another.js\' (without the quotes) to exclude those scripts from being aggregated by Autoptimize.', 'autoptimize').' '.__('Important: excluded non-minified files are still minified by Autoptimize unless that option under "misc" is disabled.', 'autoptimize');
264 264
 ?>
265 265
 </label></td>
266 266
 </tr>
267 267
 <tr valign="top" class="js_sub js_aggregate">
268
-<th scope="row"><?php _e( 'Add try-catch wrapping?', 'autoptimize' ); ?></th>
269
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_js_trycatch' ) ? 'checked="checked" ' : ''; ?>/>
270
-<?php _e( 'If your scripts break because of a JS-error, you might want to try this.', 'autoptimize' ); ?></label></td>
268
+<th scope="row"><?php _e('Add try-catch wrapping?', 'autoptimize'); ?></th>
269
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_js_trycatch') ? 'checked="checked" ' : ''; ?>/>
270
+<?php _e('If your scripts break because of a JS-error, you might want to try this.', 'autoptimize'); ?></label></td>
271 271
 </tr>
272 272
 </table>
273 273
 </li>
274 274
 
275 275
 <li class="itemDetail">
276
-<h2 class="itemTitle"><?php _e( 'CSS Options', 'autoptimize' ); ?></h2>
276
+<h2 class="itemTitle"><?php _e('CSS Options', 'autoptimize'); ?></h2>
277 277
 <table class="form-table">
278 278
 <tr valign="top">
279
-<th scope="row"><?php _e( 'Optimize CSS Code?', 'autoptimize' ); ?></th>
280
-<td><input type="checkbox" id="autoptimize_css" name="autoptimize_css" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css' ) ? 'checked="checked" ' : ''; ?>/></td>
279
+<th scope="row"><?php _e('Optimize CSS Code?', 'autoptimize'); ?></th>
280
+<td><input type="checkbox" id="autoptimize_css" name="autoptimize_css" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_css') ? 'checked="checked" ' : ''; ?>/></td>
281 281
 </tr>
282 282
 <tr class="css_sub" valign="top">
283
-<th scope="row"><?php _e( 'Aggregate CSS-files?', 'autoptimize' ); ?></th>
284
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_aggregate" name="autoptimize_css_aggregate" <?php echo $conf->get( 'autoptimize_css_aggregate' ) ? 'checked="checked" ' : ''; ?>/>
285
-<?php _e( 'Aggregate all linked CSS-files? If this option is off, the individual CSS-files will remain in place but will be minified.', 'autoptimize' ); ?></label></td>
283
+<th scope="row"><?php _e('Aggregate CSS-files?', 'autoptimize'); ?></th>
284
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_aggregate" name="autoptimize_css_aggregate" <?php echo $conf->get('autoptimize_css_aggregate') ? 'checked="checked" ' : ''; ?>/>
285
+<?php _e('Aggregate all linked CSS-files? If this option is off, the individual CSS-files will remain in place but will be minified.', 'autoptimize'); ?></label></td>
286 286
 </tr>
287 287
 <tr valign="top" class="css_sub css_aggregate">
288
-<th scope="row"><?php _e( 'Also aggregate inline CSS?', 'autoptimize' ); ?></th>
289
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_include_inline" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_include_inline', '1' ) ? 'checked="checked" ' : ''; ?>/>
290
-<?php _e( 'Check this option for Autoptimize to also aggregate CSS in the HTML.', 'autoptimize' ); ?></label></td>
288
+<th scope="row"><?php _e('Also aggregate inline CSS?', 'autoptimize'); ?></th>
289
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_include_inline" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_css_include_inline', '1') ? 'checked="checked" ' : ''; ?>/>
290
+<?php _e('Check this option for Autoptimize to also aggregate CSS in the HTML.', 'autoptimize'); ?></label></td>
291 291
 </tr>
292 292
 <tr class="css_sub css_aggregate" valign="top">
293
-<th scope="row"><?php _e( 'Generate data: URIs for images?', 'autoptimize' ); ?></th>
294
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_datauris" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_datauris' ) ? 'checked="checked" ' : ''; ?>/>
295
-<?php _e( 'Enable this to include small background-images in the CSS itself instead of as separate downloads.', 'autoptimize' ); ?></label></td>
293
+<th scope="row"><?php _e('Generate data: URIs for images?', 'autoptimize'); ?></th>
294
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_datauris" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_css_datauris') ? 'checked="checked" ' : ''; ?>/>
295
+<?php _e('Enable this to include small background-images in the CSS itself instead of as separate downloads.', 'autoptimize'); ?></label></td>
296 296
 </tr>
297
-<?php if ( autoptimizeOptionWrapper::get_option( 'autoptimize_css_justhead' ) ) { ?>
297
+<?php if (autoptimizeOptionWrapper::get_option('autoptimize_css_justhead')) { ?>
298 298
 <tr valign="top" class="css_sub css_aggregate">
299 299
 <th scope="row">
300 300
 <?php
301
-_e( 'Look for styles only in &lt;head&gt;?', 'autoptimize' );
302
-echo ' <i>' . __( '(deprecated)', 'autoptimize' ) . '</i>';
301
+_e('Look for styles only in &lt;head&gt;?', 'autoptimize');
302
+echo ' <i>'.__('(deprecated)', 'autoptimize').'</i>';
303 303
 ?>
304 304
 </th>
305
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_justhead" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_justhead' ) ? 'checked="checked" ' : ''; ?>/>
306
-<?php _e( 'Don\'t autoptimize CSS outside the head-section. If the cache gets big, you might want to enable this.', 'autoptimize' ); ?></label></td>
305
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_justhead" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_css_justhead') ? 'checked="checked" ' : ''; ?>/>
306
+<?php _e('Don\'t autoptimize CSS outside the head-section. If the cache gets big, you might want to enable this.', 'autoptimize'); ?></label></td>
307 307
 </tr>
308 308
 <?php } ?>
309 309
 <tr valign="top" class="css_sub">
310
-<th scope="row"><?php _e( 'Inline and Defer CSS?', 'autoptimize' ); ?></th>
311
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer' ) ? 'checked="checked" ' : ''; ?>/>
310
+<th scope="row"><?php _e('Inline and Defer CSS?', 'autoptimize'); ?></th>
311
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_css_defer') ? 'checked="checked" ' : ''; ?>/>
312 312
 <?php
313
-_e( 'Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="https://wordpress.org/plugins/autoptimize/faq/" target="_blank">Check the FAQ</a> for more info.', 'autoptimize' );
313
+_e('Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="https://wordpress.org/plugins/autoptimize/faq/" target="_blank">Check the FAQ</a> for more info.', 'autoptimize');
314 314
 echo ' ';
315
-$critcss_settings_url = get_admin_url( null, 'options-general.php?page=ao_critcss' );
315
+$critcss_settings_url = get_admin_url(null, 'options-general.php?page=ao_critcss');
316 316
 // translators: links "autoptimize critical CSS" tab.
317
-echo sprintf( __( 'This can be fully automated for different types of pages on the %s tab.', 'autoptimize' ), '<a href="' . $critcss_settings_url . '">CriticalCSS</a>' );
317
+echo sprintf(__('This can be fully automated for different types of pages on the %s tab.', 'autoptimize'), '<a href="'.$critcss_settings_url.'">CriticalCSS</a>');
318 318
 ?>
319 319
 </label></td>
320 320
 </tr>
321 321
 <tr valign="top" class="css_sub" id="autoptimize_css_defer_inline">
322 322
 <th scope="row"></th>
323
-<td><label><textarea rows="10" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste the above the fold CSS here. You can leave this empty when using the automated Critical CSS integration.', 'autoptimize' ); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeStyles::sanitize_css( autoptimizeOptionWrapper::get_option( 'autoptimize_css_defer_inline' ) ); ?></textarea></label></td>
323
+<td><label><textarea rows="10" cols="10" style="width:100%;" placeholder="<?php _e('Paste the above the fold CSS here. You can leave this empty when using the automated Critical CSS integration.', 'autoptimize'); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeStyles::sanitize_css(autoptimizeOptionWrapper::get_option('autoptimize_css_defer_inline')); ?></textarea></label></td>
324 324
 </tr>
325 325
 <tr valign="top" class="css_sub css_aggregate">
326
-<th scope="row"><?php _e( 'Inline all CSS?', 'autoptimize' ); ?></th>
327
-<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_inline" name="autoptimize_css_inline" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_css_inline' ) ? 'checked="checked" ' : ''; ?>/>
328
-<?php _e( 'Inlining all CSS is an easy way to stop the CSS from being render-blocking, but is generally not recommended because the size of the HTML increases significantly. Additionally it might push meta-tags down to a position where e.g. Facebook and Whatsapp will not find them any more, breaking thumbnails when sharing.', 'autoptimize' ); ?></label></td>
326
+<th scope="row"><?php _e('Inline all CSS?', 'autoptimize'); ?></th>
327
+<td><label class="cb_label"><input type="checkbox" id="autoptimize_css_inline" name="autoptimize_css_inline" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_css_inline') ? 'checked="checked" ' : ''; ?>/>
328
+<?php _e('Inlining all CSS is an easy way to stop the CSS from being render-blocking, but is generally not recommended because the size of the HTML increases significantly. Additionally it might push meta-tags down to a position where e.g. Facebook and Whatsapp will not find them any more, breaking thumbnails when sharing.', 'autoptimize'); ?></label></td>
329 329
 </tr>
330 330
 <tr valign="top" class="css_sub">
331
-<th scope="row"><?php _e( 'Exclude CSS from Autoptimize:', 'autoptimize' ); ?></th>
332
-<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo esc_attr( autoptimizeOptionWrapper::get_option( 'autoptimize_css_exclude', 'wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css' ) ); ?>"/><br />
331
+<th scope="row"><?php _e('Exclude CSS from Autoptimize:', 'autoptimize'); ?></th>
332
+<td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo esc_attr(autoptimizeOptionWrapper::get_option('autoptimize_css_exclude', 'wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css')); ?>"/><br />
333 333
 <?php
334
-echo __( 'A comma-separated list of CSS you want to exclude from being optimized.', 'autoptimize' ) . ' ' . __( 'Important: excluded non-minified files are still minified by Autoptimize unless that option under "misc" is disabled.', 'autoptimize' );
334
+echo __('A comma-separated list of CSS you want to exclude from being optimized.', 'autoptimize').' '.__('Important: excluded non-minified files are still minified by Autoptimize unless that option under "misc" is disabled.', 'autoptimize');
335 335
 ?>
336 336
 </label></td>
337 337
 </tr>
@@ -339,55 +339,55 @@  discard block
 block discarded – undo
339 339
 </li>
340 340
 
341 341
 <li class="itemDetail">
342
-<h2 class="itemTitle"><?php _e( 'HTML Options', 'autoptimize' ); ?></h2>
342
+<h2 class="itemTitle"><?php _e('HTML Options', 'autoptimize'); ?></h2>
343 343
 <table class="form-table">
344 344
 <tr valign="top">
345
-<th scope="row"><?php _e( 'Optimize HTML Code?', 'autoptimize' ); ?></th>
346
-<td><input type="checkbox" id="autoptimize_html" name="autoptimize_html" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_html' ) ? 'checked="checked" ' : ''; ?>/></td>
345
+<th scope="row"><?php _e('Optimize HTML Code?', 'autoptimize'); ?></th>
346
+<td><input type="checkbox" id="autoptimize_html" name="autoptimize_html" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_html') ? 'checked="checked" ' : ''; ?>/></td>
347 347
 </tr>
348 348
 <tr class="html_sub" valign="top">
349
-<th scope="row"><?php _e( 'Keep HTML comments?', 'autoptimize' ); ?></th>
350
-<td><label class="cb_label"><input type="checkbox" name="autoptimize_html_keepcomments" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_html_keepcomments' ) ? 'checked="checked" ' : ''; ?>/>
351
-<?php _e( 'Enable this if you want HTML comments to remain in the page.', 'autoptimize' ); ?></label></td>
349
+<th scope="row"><?php _e('Keep HTML comments?', 'autoptimize'); ?></th>
350
+<td><label class="cb_label"><input type="checkbox" name="autoptimize_html_keepcomments" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_html_keepcomments') ? 'checked="checked" ' : ''; ?>/>
351
+<?php _e('Enable this if you want HTML comments to remain in the page.', 'autoptimize'); ?></label></td>
352 352
 </tr>
353 353
 </table>
354 354
 </li>
355 355
 
356 356
 <li class="itemDetail">
357
-<h2 class="itemTitle"><?php _e( 'CDN Options', 'autoptimize' ); ?></h2>
357
+<h2 class="itemTitle"><?php _e('CDN Options', 'autoptimize'); ?></h2>
358 358
 <table class="form-table">
359 359
 <tr valign="top">
360
-<th scope="row"><?php _e( 'CDN Base URL', 'autoptimize' ); ?></th>
361
-<td><label><input id="cdn_url" type="text" name="autoptimize_cdn_url" pattern="^(https?:)?\/\/([\da-z\.-]+)\.([\da-z\.]{2,6})([\/\w \.-]*)*(:\d{2,5})?\/?$" style="width:100%" value="<?php echo esc_url( autoptimizeOptionWrapper::get_option( 'autoptimize_cdn_url', '' ), array( 'http', 'https' ) ); ?>" /><br />
362
-<?php _e( 'Enter your CDN root URL to enable CDN for Autoptimized files. The URL can be http, https or protocol-relative (e.g. <code>//cdn.example.com/</code>). This is not needed for Cloudflare.', 'autoptimize' ); ?></label></td>
360
+<th scope="row"><?php _e('CDN Base URL', 'autoptimize'); ?></th>
361
+<td><label><input id="cdn_url" type="text" name="autoptimize_cdn_url" pattern="^(https?:)?\/\/([\da-z\.-]+)\.([\da-z\.]{2,6})([\/\w \.-]*)*(:\d{2,5})?\/?$" style="width:100%" value="<?php echo esc_url(autoptimizeOptionWrapper::get_option('autoptimize_cdn_url', ''), array('http', 'https')); ?>" /><br />
362
+<?php _e('Enter your CDN root URL to enable CDN for Autoptimized files. The URL can be http, https or protocol-relative (e.g. <code>//cdn.example.com/</code>). This is not needed for Cloudflare.', 'autoptimize'); ?></label></td>
363 363
 </tr>
364 364
 </table>
365 365
 </li>
366 366
 
367 367
 <li class="itemDetail">
368
-<h2 class="itemTitle"><?php _e( 'Cache Info', 'autoptimize' ); ?></h2>
368
+<h2 class="itemTitle"><?php _e('Cache Info', 'autoptimize'); ?></h2>
369 369
 <table class="form-table" >
370 370
 <tr valign="top" >
371
-<th scope="row"><?php _e( 'Cache folder', 'autoptimize' ); ?></th>
372
-<td><?php echo htmlentities( AUTOPTIMIZE_CACHE_DIR ); ?></td>
371
+<th scope="row"><?php _e('Cache folder', 'autoptimize'); ?></th>
372
+<td><?php echo htmlentities(AUTOPTIMIZE_CACHE_DIR); ?></td>
373 373
 </tr>
374 374
 <tr valign="top" >
375
-<th scope="row"><?php _e( 'Can we write?', 'autoptimize' ); ?></th>
376
-<td><?php echo ( autoptimizeCache::cacheavail() ? __( 'Yes', 'autoptimize' ) : __( 'No', 'autoptimize' ) ); ?></td>
375
+<th scope="row"><?php _e('Can we write?', 'autoptimize'); ?></th>
376
+<td><?php echo (autoptimizeCache::cacheavail() ? __('Yes', 'autoptimize') : __('No', 'autoptimize')); ?></td>
377 377
 </tr>
378 378
 <tr valign="top" >
379
-<th scope="row"><?php _e( 'Cached styles and scripts', 'autoptimize' ); ?></th>
379
+<th scope="row"><?php _e('Cached styles and scripts', 'autoptimize'); ?></th>
380 380
 <td>
381 381
     <?php
382 382
     $ao_stat_arr = autoptimizeCache::stats();
383
-    if ( ! empty( $ao_stat_arr ) && is_array( $ao_stat_arr ) ) {
384
-        $ao_cache_size = size_format( $ao_stat_arr[1], 2 );
383
+    if (!empty($ao_stat_arr) && is_array($ao_stat_arr)) {
384
+        $ao_cache_size = size_format($ao_stat_arr[1], 2);
385 385
         $details       = '';
386
-        if ( $ao_cache_size > 0 ) {
387
-            $details = ', ~' . $ao_cache_size . ' total';
386
+        if ($ao_cache_size > 0) {
387
+            $details = ', ~'.$ao_cache_size.' total';
388 388
         }
389 389
         // translators: Kilobytes + timestamp shown.
390
-        printf( __( '%1$s files, totalling %2$s (calculated at %3$s)', 'autoptimize' ), $ao_stat_arr[0], $ao_cache_size, date( 'H:i e', $ao_stat_arr[2] ) );
390
+        printf(__('%1$s files, totalling %2$s (calculated at %3$s)', 'autoptimize'), $ao_stat_arr[0], $ao_cache_size, date('H:i e', $ao_stat_arr[2]));
391 391
     }
392 392
     ?>
393 393
 </td>
@@ -396,41 +396,41 @@  discard block
 block discarded – undo
396 396
 </li>
397 397
 
398 398
 <li class="itemDetail">
399
-<h2 class="itemTitle"><?php _e( 'Misc Options', 'autoptimize' ); ?></h2>
399
+<h2 class="itemTitle"><?php _e('Misc Options', 'autoptimize'); ?></h2>
400 400
 <table class="form-table">
401 401
     <tr valign="top" >
402
-    <th scope="row"><?php _e( 'Save aggregated script/css as static files?', 'autoptimize' ); ?></th>
403
-    <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_nogzip" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_cache_nogzip', '1' ) ? 'checked="checked" ' : ''; ?>/>
404
-    <?php _e( 'By default files saved are static css/js, uncheck this option if your webserver doesn\'t properly handle the compression and expiry.', 'autoptimize' ); ?></label></td>
402
+    <th scope="row"><?php _e('Save aggregated script/css as static files?', 'autoptimize'); ?></th>
403
+    <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_nogzip" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_cache_nogzip', '1') ? 'checked="checked" ' : ''; ?>/>
404
+    <?php _e('By default files saved are static css/js, uncheck this option if your webserver doesn\'t properly handle the compression and expiry.', 'autoptimize'); ?></label></td>
405 405
     </tr>
406 406
     <?php
407 407
     $_min_excl_class = '';
408
-    if ( ! $conf->get( 'autoptimize_css_aggregate' ) && ! $conf->get( 'autoptimize_js_aggregate' ) ) {
408
+    if (!$conf->get('autoptimize_css_aggregate') && !$conf->get('autoptimize_js_aggregate')) {
409 409
         $_min_excl_class = 'hidden';
410 410
     }
411 411
     ?>
412 412
     <tr valign="top" id="min_excl_row" class="<?php echo $_min_excl_class; ?>">
413
-        <th scope="row"><?php _e( 'Minify excluded CSS and JS files?', 'autoptimize' ); ?></th>
414
-        <td><label class="cb_label"><input type="checkbox" name="autoptimize_minify_excluded" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_minify_excluded', '1' ) ? 'checked="checked" ' : ''; ?>/>
415
-        <?php _e( 'When aggregating JS or CSS, excluded files that are not minified (based on filename) are by default minified by Autoptimize despite being excluded. Uncheck this option if anything breaks despite excluding.', 'autoptimize' ); ?></label></td>
413
+        <th scope="row"><?php _e('Minify excluded CSS and JS files?', 'autoptimize'); ?></th>
414
+        <td><label class="cb_label"><input type="checkbox" name="autoptimize_minify_excluded" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_minify_excluded', '1') ? 'checked="checked" ' : ''; ?>/>
415
+        <?php _e('When aggregating JS or CSS, excluded files that are not minified (based on filename) are by default minified by Autoptimize despite being excluded. Uncheck this option if anything breaks despite excluding.', 'autoptimize'); ?></label></td>
416 416
     </tr>
417 417
     <tr valign="top">
418
-        <th scope="row"><?php _e( 'Enable 404 fallbacks?', 'autoptimize' ); ?></th>
419
-        <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_fallback" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_cache_fallback', '1' ) ? 'checked="checked" ' : ''; ?>/>
420
-        <?php _e( 'Sometimes Autoptimized JS/ CSS is referenced in cached HTML but is already removed, resulting in broken sites. With this option on, Autoptimize will try to redirect those not-found files to "fallback"-versions, keeping the page/ site somewhat intact. In some cases this will require extra web-server level configuration to ensure <code>wp-content/autoptimize_404_handler.php</code> is set to handle 404\'s in <code>wp-content/cache/autoptimize</code>.', 'autoptimize' ); ?></label></td>
418
+        <th scope="row"><?php _e('Enable 404 fallbacks?', 'autoptimize'); ?></th>
419
+        <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_fallback" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_cache_fallback', '1') ? 'checked="checked" ' : ''; ?>/>
420
+        <?php _e('Sometimes Autoptimized JS/ CSS is referenced in cached HTML but is already removed, resulting in broken sites. With this option on, Autoptimize will try to redirect those not-found files to "fallback"-versions, keeping the page/ site somewhat intact. In some cases this will require extra web-server level configuration to ensure <code>wp-content/autoptimize_404_handler.php</code> is set to handle 404\'s in <code>wp-content/cache/autoptimize</code>.', 'autoptimize'); ?></label></td>
421 421
     </tr>
422 422
     <tr valign="top">
423
-    <th scope="row"><?php _e( 'Also optimize for logged in editors/ administrators?', 'autoptimize' ); ?></th>
424
-    <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_logged" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_optimize_logged', '1' ) ? 'checked="checked" ' : ''; ?>/>
425
-    <?php _e( 'By default Autoptimize is also active for logged on editors/ administrators, uncheck this option if you don\'t want Autoptimize to optimize when logged in e.g. to use a pagebuilder.', 'autoptimize' ); ?></label></td>
423
+    <th scope="row"><?php _e('Also optimize for logged in editors/ administrators?', 'autoptimize'); ?></th>
424
+    <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_logged" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_optimize_logged', '1') ? 'checked="checked" ' : ''; ?>/>
425
+    <?php _e('By default Autoptimize is also active for logged on editors/ administrators, uncheck this option if you don\'t want Autoptimize to optimize when logged in e.g. to use a pagebuilder.', 'autoptimize'); ?></label></td>
426 426
     </tr>
427 427
     <?php
428
-    if ( function_exists( 'is_checkout' ) || function_exists( 'is_cart' ) || function_exists( 'edd_is_checkout' ) || function_exists( 'wpsc_is_cart' ) || function_exists( 'wpsc_is_checkout' ) ) {
428
+    if (function_exists('is_checkout') || function_exists('is_cart') || function_exists('edd_is_checkout') || function_exists('wpsc_is_cart') || function_exists('wpsc_is_checkout')) {
429 429
     ?>
430 430
     <tr valign="top" >
431
-        <th scope="row"><?php _e( 'Also optimize shop cart/ checkout?', 'autoptimize' ); ?></th>
432
-        <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_checkout" <?php echo autoptimizeOptionWrapper::get_option( 'autoptimize_optimize_checkout', '0' ) ? 'checked="checked" ' : ''; ?>/>
433
-            <?php _e( 'By default Autoptimize is also active on your shop\'s cart/ checkout, uncheck not to optimize those.', 'autoptimize' ); ?></label>
431
+        <th scope="row"><?php _e('Also optimize shop cart/ checkout?', 'autoptimize'); ?></th>
432
+        <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_checkout" <?php echo autoptimizeOptionWrapper::get_option('autoptimize_optimize_checkout', '0') ? 'checked="checked" ' : ''; ?>/>
433
+            <?php _e('By default Autoptimize is also active on your shop\'s cart/ checkout, uncheck not to optimize those.', 'autoptimize'); ?></label>
434 434
         </td>
435 435
     </tr>
436 436
     <?php } ?>
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 </ul>
441 441
 
442 442
 <p class="submit">
443
-<input type="submit" class="button-secondary" value="<?php _e( 'Save Changes', 'autoptimize' ); ?>" />
444
-<input type="submit" class="button-primary" name="autoptimize_cache_clean" value="<?php _e( 'Save Changes and Empty Cache', 'autoptimize' ); ?>" />
443
+<input type="submit" class="button-secondary" value="<?php _e('Save Changes', 'autoptimize'); ?>" />
444
+<input type="submit" class="button-primary" name="autoptimize_cache_clean" value="<?php _e('Save Changes and Empty Cache', 'autoptimize'); ?>" />
445 445
 </p>
446 446
 
447 447
 </form>
@@ -450,46 +450,46 @@  discard block
 block discarded – undo
450 450
     <div class="autoptimize_banner hidden">
451 451
     <ul>
452 452
     <?php
453
-    if ( $this->settings_screen_do_remote_http ) {
454
-        $ao_banner = get_transient( 'autoptimize_banner' );
455
-        if ( empty( $ao_banner ) ) {
456
-            $banner_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver=' . AUTOPTIMIZE_PLUGIN_VERSION );
457
-            if ( ! is_wp_error( $banner_resp ) ) {
458
-                if ( '200' == wp_remote_retrieve_response_code( $banner_resp ) ) {
459
-                    $ao_banner = wp_kses_post( wp_remote_retrieve_body( $banner_resp ) );
460
-                    set_transient( 'autoptimize_banner', $ao_banner, WEEK_IN_SECONDS );
453
+    if ($this->settings_screen_do_remote_http) {
454
+        $ao_banner = get_transient('autoptimize_banner');
455
+        if (empty($ao_banner)) {
456
+            $banner_resp = wp_remote_get('https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver='.AUTOPTIMIZE_PLUGIN_VERSION);
457
+            if (!is_wp_error($banner_resp)) {
458
+                if ('200' == wp_remote_retrieve_response_code($banner_resp)) {
459
+                    $ao_banner = wp_kses_post(wp_remote_retrieve_body($banner_resp));
460
+                    set_transient('autoptimize_banner', $ao_banner, WEEK_IN_SECONDS);
461 461
                 }
462 462
             }
463 463
         }
464 464
         echo $ao_banner;
465 465
     }
466 466
     ?>
467
-        <li><?php _e( "Need help? <a href='https://wordpress.org/plugins/autoptimize/faq/'>Check out the FAQ here</a>.", 'autoptimize' ); ?></li>
468
-        <li><?php _e( 'Happy with Autoptimize?', 'autoptimize' ); ?><br /><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=optimizingmatters"><?php _e( 'Try my other plugins!', 'autoptimize' ); ?></a></li>
467
+        <li><?php _e("Need help? <a href='https://wordpress.org/plugins/autoptimize/faq/'>Check out the FAQ here</a>.", 'autoptimize'); ?></li>
468
+        <li><?php _e('Happy with Autoptimize?', 'autoptimize'); ?><br /><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=optimizingmatters"><?php _e('Try my other plugins!', 'autoptimize'); ?></a></li>
469 469
     </ul>
470 470
     </div>
471 471
     <div style="margin-left:10px;margin-top:-5px;">
472 472
         <h2>
473
-            <?php _e( 'futtta about', 'autoptimize' ); ?>
473
+            <?php _e('futtta about', 'autoptimize'); ?>
474 474
             <select id="feed_dropdown" >
475
-                <option value="1"><?php _e( 'Autoptimize', 'autoptimize' ); ?></option>
476
-                <option value="2"><?php _e( 'WordPress', 'autoptimize' ); ?></option>
477
-                <option value="3"><?php _e( 'Web Technology', 'autoptimize' ); ?></option>
475
+                <option value="1"><?php _e('Autoptimize', 'autoptimize'); ?></option>
476
+                <option value="2"><?php _e('WordPress', 'autoptimize'); ?></option>
477
+                <option value="3"><?php _e('Web Technology', 'autoptimize'); ?></option>
478 478
             </select>
479 479
         </h2>
480 480
         <div id="futtta_feed">
481 481
             <div id="autoptimizefeed">
482
-                <?php $this->get_futtta_feeds( 'http://feeds.feedburner.com/futtta_autoptimize' ); ?>
482
+                <?php $this->get_futtta_feeds('http://feeds.feedburner.com/futtta_autoptimize'); ?>
483 483
             </div>
484 484
             <div id="wordpressfeed">
485
-                <?php $this->get_futtta_feeds( 'http://feeds.feedburner.com/futtta_wordpress' ); ?>
485
+                <?php $this->get_futtta_feeds('http://feeds.feedburner.com/futtta_wordpress'); ?>
486 486
             </div>
487 487
             <div id="webtechfeed">
488
-                <?php $this->get_futtta_feeds( 'http://feeds.feedburner.com/futtta_webtech' ); ?>
488
+                <?php $this->get_futtta_feeds('http://feeds.feedburner.com/futtta_webtech'); ?>
489 489
             </div>
490 490
         </div>
491 491
     </div>
492
-    <div style="float:right;margin:50px 15px;"><a href="https://blog.futtta.be/2013/10/21/do-not-donate-to-me/" target="_blank"><img width="100px" height="85px" src="<?php echo plugins_url() . '/' . plugin_basename( dirname( __FILE__ ) ) . '/external/do_not_donate_smallest.png'; ?>" title="<?php _e( 'Do not donate for this plugin!', 'autoptimize' ); ?>"></a></div>
492
+    <div style="float:right;margin:50px 15px;"><a href="https://blog.futtta.be/2013/10/21/do-not-donate-to-me/" target="_blank"><img width="100px" height="85px" src="<?php echo plugins_url().'/'.plugin_basename(dirname(__FILE__)).'/external/do_not_donate_smallest.png'; ?>" title="<?php _e('Do not donate for this plugin!', 'autoptimize'); ?>"></a></div>
493 493
 </div>
494 494
 
495 495
 <script type="text/javascript">
@@ -655,82 +655,82 @@  discard block
 block discarded – undo
655 655
 
656 656
     public function addmenu()
657 657
     {
658
-        if ( is_multisite() && is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network() ) {
658
+        if (is_multisite() && is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network()) {
659 659
             // multisite, network admin, ao network activated: add normal settings page at network level.
660
-            $hook = add_submenu_page( 'settings.php', __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_network_options', 'autoptimize', array( $this, 'show_config' ) );
661
-        } elseif ( is_multisite() && ! is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network() && 'on' !== autoptimizeOptionWrapper::get_option( 'autoptimize_enable_site_config' ) ) {
660
+            $hook = add_submenu_page('settings.php', __('Autoptimize Options', 'autoptimize'), 'Autoptimize', 'manage_network_options', 'autoptimize', array($this, 'show_config'));
661
+        } elseif (is_multisite() && !is_network_admin() && autoptimizeOptionWrapper::is_ao_active_for_network() && 'on' !== autoptimizeOptionWrapper::get_option('autoptimize_enable_site_config')) {
662 662
             // multisite, ao network activated, not network admin so site specific settings, but "autoptimize_enable_site_config" is off: show "sorry, ask network admin" message iso options.
663
-            $hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show_network_message' ) );
663
+            $hook = add_options_page(__('Autoptimize Options', 'autoptimize'), 'Autoptimize', 'manage_options', 'autoptimize', array($this, 'show_network_message'));
664 664
         } else {
665 665
             // default: show normal options page if not multisite, if multisite but not network activated, if multisite and network activated and "autoptimize_enable_site_config" is on.
666
-            $hook = add_options_page( __( 'Autoptimize Options', 'autoptimize' ), 'Autoptimize', 'manage_options', 'autoptimize', array( $this, 'show_config' ) );
666
+            $hook = add_options_page(__('Autoptimize Options', 'autoptimize'), 'Autoptimize', 'manage_options', 'autoptimize', array($this, 'show_config'));
667 667
         }
668 668
 
669
-        add_action( 'admin_print_scripts-' . $hook, array( $this, 'autoptimize_admin_scripts' ) );
670
-        add_action( 'admin_print_styles-' . $hook, array( $this, 'autoptimize_admin_styles' ) );
669
+        add_action('admin_print_scripts-'.$hook, array($this, 'autoptimize_admin_scripts'));
670
+        add_action('admin_print_styles-'.$hook, array($this, 'autoptimize_admin_styles'));
671 671
     }
672 672
 
673 673
     public function autoptimize_admin_scripts()
674 674
     {
675
-        wp_enqueue_script( 'jqcookie', plugins_url( '/external/js/jquery.cookie.min.js', __FILE__ ), array( 'jquery' ), null, true );
676
-        wp_enqueue_script( 'unslider', plugins_url( '/external/js/unslider-min.js', __FILE__ ), array( 'jquery' ), null, true );
675
+        wp_enqueue_script('jqcookie', plugins_url('/external/js/jquery.cookie.min.js', __FILE__), array('jquery'), null, true);
676
+        wp_enqueue_script('unslider', plugins_url('/external/js/unslider-min.js', __FILE__), array('jquery'), null, true);
677 677
     }
678 678
 
679 679
     public function autoptimize_admin_styles()
680 680
     {
681
-        wp_enqueue_style( 'unslider', plugins_url( '/external/js/unslider.css', __FILE__ ) );
682
-        wp_enqueue_style( 'unslider-dots', plugins_url( '/external/js/unslider-dots.css', __FILE__ ) );
681
+        wp_enqueue_style('unslider', plugins_url('/external/js/unslider.css', __FILE__));
682
+        wp_enqueue_style('unslider-dots', plugins_url('/external/js/unslider-dots.css', __FILE__));
683 683
     }
684 684
 
685 685
     public function registersettings() {
686
-        register_setting( 'autoptimize', 'autoptimize_html' );
687
-        register_setting( 'autoptimize', 'autoptimize_html_keepcomments' );
688
-        register_setting( 'autoptimize', 'autoptimize_enable_site_config' );
689
-        register_setting( 'autoptimize', 'autoptimize_js' );
690
-        register_setting( 'autoptimize', 'autoptimize_js_aggregate' );
691
-        register_setting( 'autoptimize', 'autoptimize_js_defer_not_aggregate' );
692
-        register_setting( 'autoptimize', 'autoptimize_js_exclude' );
693
-        register_setting( 'autoptimize', 'autoptimize_js_trycatch' );
694
-        register_setting( 'autoptimize', 'autoptimize_js_justhead' );
695
-        register_setting( 'autoptimize', 'autoptimize_js_forcehead' );
696
-        register_setting( 'autoptimize', 'autoptimize_js_include_inline' );
697
-        register_setting( 'autoptimize', 'autoptimize_css' );
698
-        register_setting( 'autoptimize', 'autoptimize_css_aggregate' );
699
-        register_setting( 'autoptimize', 'autoptimize_css_exclude' );
700
-        register_setting( 'autoptimize', 'autoptimize_css_justhead' );
701
-        register_setting( 'autoptimize', 'autoptimize_css_datauris' );
702
-        register_setting( 'autoptimize', 'autoptimize_css_defer' );
703
-        register_setting( 'autoptimize', 'autoptimize_css_defer_inline' );
704
-        register_setting( 'autoptimize', 'autoptimize_css_inline' );
705
-        register_setting( 'autoptimize', 'autoptimize_css_include_inline' );
706
-        register_setting( 'autoptimize', 'autoptimize_cdn_url' );
707
-        register_setting( 'autoptimize', 'autoptimize_cache_clean' );
708
-        register_setting( 'autoptimize', 'autoptimize_cache_nogzip' );
709
-        register_setting( 'autoptimize', 'autoptimize_optimize_logged' );
710
-        register_setting( 'autoptimize', 'autoptimize_optimize_checkout' );
711
-        register_setting( 'autoptimize', 'autoptimize_minify_excluded' );
712
-        register_setting( 'autoptimize', 'autoptimize_cache_fallback' );
686
+        register_setting('autoptimize', 'autoptimize_html');
687
+        register_setting('autoptimize', 'autoptimize_html_keepcomments');
688
+        register_setting('autoptimize', 'autoptimize_enable_site_config');
689
+        register_setting('autoptimize', 'autoptimize_js');
690
+        register_setting('autoptimize', 'autoptimize_js_aggregate');
691
+        register_setting('autoptimize', 'autoptimize_js_defer_not_aggregate');
692
+        register_setting('autoptimize', 'autoptimize_js_exclude');
693
+        register_setting('autoptimize', 'autoptimize_js_trycatch');
694
+        register_setting('autoptimize', 'autoptimize_js_justhead');
695
+        register_setting('autoptimize', 'autoptimize_js_forcehead');
696
+        register_setting('autoptimize', 'autoptimize_js_include_inline');
697
+        register_setting('autoptimize', 'autoptimize_css');
698
+        register_setting('autoptimize', 'autoptimize_css_aggregate');
699
+        register_setting('autoptimize', 'autoptimize_css_exclude');
700
+        register_setting('autoptimize', 'autoptimize_css_justhead');
701
+        register_setting('autoptimize', 'autoptimize_css_datauris');
702
+        register_setting('autoptimize', 'autoptimize_css_defer');
703
+        register_setting('autoptimize', 'autoptimize_css_defer_inline');
704
+        register_setting('autoptimize', 'autoptimize_css_inline');
705
+        register_setting('autoptimize', 'autoptimize_css_include_inline');
706
+        register_setting('autoptimize', 'autoptimize_cdn_url');
707
+        register_setting('autoptimize', 'autoptimize_cache_clean');
708
+        register_setting('autoptimize', 'autoptimize_cache_nogzip');
709
+        register_setting('autoptimize', 'autoptimize_optimize_logged');
710
+        register_setting('autoptimize', 'autoptimize_optimize_checkout');
711
+        register_setting('autoptimize', 'autoptimize_minify_excluded');
712
+        register_setting('autoptimize', 'autoptimize_cache_fallback');
713 713
     }
714 714
 
715
-    public function setmeta( $links, $file = null )
715
+    public function setmeta($links, $file = null)
716 716
     {
717 717
         // Inspired on http://wpengineer.com/meta-links-for-wordpress-plugins/.
718 718
         // Do it only once - saves time.
719 719
         static $plugin;
720
-        if ( empty( $plugin ) ) {
721
-            $plugin = plugin_basename( AUTOPTIMIZE_PLUGIN_DIR . 'autoptimize.php' );
720
+        if (empty($plugin)) {
721
+            $plugin = plugin_basename(AUTOPTIMIZE_PLUGIN_DIR.'autoptimize.php');
722 722
         }
723 723
 
724
-        if ( null === $file ) {
724
+        if (null === $file) {
725 725
             // 2.7 and lower.
726
-            $settings_link = sprintf( '<a href="options-general.php?page=autoptimize">%s</a>', __( 'Settings' ) );
727
-            array_unshift( $links, $settings_link );
726
+            $settings_link = sprintf('<a href="options-general.php?page=autoptimize">%s</a>', __('Settings'));
727
+            array_unshift($links, $settings_link);
728 728
         } else {
729 729
             // 2.8 and higher.
730 730
             // If it's us, add the link.
731
-            if ( $file === $plugin ) {
732
-                $newlink = array( sprintf( '<a href="options-general.php?page=autoptimize">%s</a>', __( 'Settings' ) ) );
733
-                $links   = array_merge( $links, $newlink );
731
+            if ($file === $plugin) {
732
+                $newlink = array(sprintf('<a href="options-general.php?page=autoptimize">%s</a>', __('Settings')));
733
+                $links   = array_merge($links, $newlink);
734 734
             }
735 735
         }
736 736
 
@@ -807,8 +807,8 @@  discard block
 block discarded – undo
807 807
             'autoptimize_imgopt_select_field_2'   => '2', // quality glossy.
808 808
             'autoptimize_imgopt_checkbox_field_3' => '0', // lazy load off.
809 809
             'autoptimize_imgopt_checkbox_field_4' => '0', // webp off (might be removed).
810
-            'autoptimize_imgopt_text_field_5'     => '',  // lazy load exclusions empty.
811
-            'autoptimize_imgopt_text_field_6'     => '',  // optimization exclusions empty.
810
+            'autoptimize_imgopt_text_field_5'     => '', // lazy load exclusions empty.
811
+            'autoptimize_imgopt_text_field_6'     => '', // optimization exclusions empty.
812 812
             'autoptimize_imgopt_number_field_7'   => '0', // lazy load from nth image (0 = lazyload all).
813 813
         );
814 814
         return $defaults;
@@ -821,58 +821,58 @@  discard block
 block discarded – undo
821 821
      *
822 822
      * @return string
823 823
      */
824
-    public static function get_ao_css_preload_onload( $media = 'all' )
824
+    public static function get_ao_css_preload_onload($media = 'all')
825 825
     {
826
-        $preload_onload = apply_filters( 'autoptimize_filter_css_preload_onload', "this.onload=null;this.media='" . $media . "';" );
826
+        $preload_onload = apply_filters('autoptimize_filter_css_preload_onload', "this.onload=null;this.media='".$media."';");
827 827
         return $preload_onload;
828 828
     }
829 829
 
830
-    public function get( $key )
830
+    public function get($key)
831 831
     {
832
-        if ( ! is_array( $this->config ) ) {
832
+        if (!is_array($this->config)) {
833 833
             // Default config.
834 834
             $config = self::get_defaults();
835 835
 
836 836
             // Override with user settings.
837
-            foreach ( array_keys( $config ) as $name ) {
838
-                $conf = autoptimizeOptionWrapper::get_option( $name );
839
-                if ( false !== $conf ) {
837
+            foreach (array_keys($config) as $name) {
838
+                $conf = autoptimizeOptionWrapper::get_option($name);
839
+                if (false !== $conf) {
840 840
                     // It was set before!
841
-                    $config[ $name ] = $conf;
841
+                    $config[$name] = $conf;
842 842
                 }
843 843
             }
844 844
 
845 845
             // Save for next call.
846
-            $this->config = apply_filters( 'autoptimize_filter_get_config', $config );
846
+            $this->config = apply_filters('autoptimize_filter_get_config', $config);
847 847
         }
848 848
 
849
-        if ( isset( $this->config[ $key ] ) ) {
850
-            return $this->config[ $key ];
849
+        if (isset($this->config[$key])) {
850
+            return $this->config[$key];
851 851
         }
852 852
 
853 853
         return false;
854 854
     }
855 855
 
856
-    private function get_futtta_feeds( $url ) {
857
-        if ( $this->settings_screen_do_remote_http ) {
858
-            $rss      = fetch_feed( $url );
856
+    private function get_futtta_feeds($url) {
857
+        if ($this->settings_screen_do_remote_http) {
858
+            $rss      = fetch_feed($url);
859 859
             $maxitems = 0;
860 860
 
861
-            if ( ! is_wp_error( $rss ) ) {
862
-                $maxitems  = $rss->get_item_quantity( 7 );
863
-                $rss_items = $rss->get_items( 0, $maxitems );
861
+            if (!is_wp_error($rss)) {
862
+                $maxitems  = $rss->get_item_quantity(7);
863
+                $rss_items = $rss->get_items(0, $maxitems);
864 864
             }
865 865
             ?>
866 866
             <ul>
867
-                <?php if ( 0 == $maxitems ) : ?>
868
-                    <li><?php _e( 'No items', 'autoptimize' ); ?></li>
867
+                <?php if (0 == $maxitems) : ?>
868
+                    <li><?php _e('No items', 'autoptimize'); ?></li>
869 869
                 <?php else : ?>
870
-                    <?php foreach ( $rss_items as $item ) : ?>
870
+                    <?php foreach ($rss_items as $item) : ?>
871 871
                         <li>
872
-                            <a href="<?php echo esc_url( $item->get_permalink() ); ?>"
872
+                            <a href="<?php echo esc_url($item->get_permalink()); ?>"
873 873
                                 <?php // translators: the variable contains a date. ?>
874
-                                title="<?php printf( __( 'Posted %s', 'autoptimize' ), $item->get_date( 'j F Y | g:i a' ) ); ?>">
875
-                                <?php echo esc_html( $item->get_title() ); ?>
874
+                                title="<?php printf(__('Posted %s', 'autoptimize'), $item->get_date('j F Y | g:i a')); ?>">
875
+                                <?php echo esc_html($item->get_title()); ?>
876 876
                             </a>
877 877
                         </li>
878 878
                     <?php endforeach; ?>
@@ -885,23 +885,23 @@  discard block
 block discarded – undo
885 885
     static function ao_admin_tabs()
886 886
     {
887 887
         // based on http://wordpress.stackexchange.com/a/58826 .
888
-        $tabs        = apply_filters( 'autoptimize_filter_settingsscreen_tabs', array( 'autoptimize' => __( 'JS, CSS  &amp; HTML', 'autoptimize' ) ) );
888
+        $tabs        = apply_filters('autoptimize_filter_settingsscreen_tabs', array('autoptimize' => __('JS, CSS  &amp; HTML', 'autoptimize')));
889 889
         $tab_content = '';
890
-        $tabs_count  = count( $tabs );
891
-        if ( $tabs_count > 1 ) {
892
-            if ( isset( $_GET['page'] ) ) {
890
+        $tabs_count  = count($tabs);
891
+        if ($tabs_count > 1) {
892
+            if (isset($_GET['page'])) {
893 893
                 $current_id = $_GET['page'];
894 894
             } else {
895 895
                 $current_id = 'autoptimize';
896 896
             }
897 897
             $tab_content .= '<h2 class="nav-tab-wrapper">';
898
-            foreach ( $tabs as $tab_id => $tab_name ) {
899
-                if ( $current_id == $tab_id ) {
898
+            foreach ($tabs as $tab_id => $tab_name) {
899
+                if ($current_id == $tab_id) {
900 900
                     $class = ' nav-tab-active';
901 901
                 } else {
902 902
                     $class = '';
903 903
                 }
904
-                $tab_content .= '<a class="nav-tab' . $class . '" href="?page=' . $tab_id . '">' . $tab_name . '</a>';
904
+                $tab_content .= '<a class="nav-tab'.$class.'" href="?page='.$tab_id.'">'.$tab_name.'</a>';
905 905
             }
906 906
             $tab_content .= '</h2>';
907 907
         } else {
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
      */
919 919
     public static function is_admin_and_not_ajax()
920 920
     {
921
-        return ( is_admin() && ! self::doing_ajax() );
921
+        return (is_admin() && !self::doing_ajax());
922 922
     }
923 923
 
924 924
     /**
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
      */
929 929
     protected static function doing_ajax()
930 930
     {
931
-        if ( function_exists( 'wp_doing_ajax' ) ) {
931
+        if (function_exists('wp_doing_ajax')) {
932 932
             return wp_doing_ajax();
933 933
         }
934
-        return ( defined( 'DOING_AJAX' ) && DOING_AJAX );
934
+        return (defined('DOING_AJAX') && DOING_AJAX);
935 935
     }
936 936
 
937 937
     /**
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
      * @return bool
941 941
      */
942 942
     public static function should_show_menu_tabs() {
943
-        if ( ! is_multisite() || is_network_admin() || 'on' === autoptimizeOptionWrapper::get_option( 'autoptimize_enable_site_config' ) ) {
943
+        if (!is_multisite() || is_network_admin() || 'on' === autoptimizeOptionWrapper::get_option('autoptimize_enable_site_config')) {
944 944
             return true;
945 945
         } else {
946 946
             return false;
Please login to merge, or discard this patch.