@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | global $ao_ccss_unloadccss; |
20 | 20 | |
21 | 21 | // In case domain is not set yet (done in cron.php). |
22 | - if ( empty( $ao_ccss_domain ) ) { |
|
22 | + if (empty($ao_ccss_domain)) { |
|
23 | 23 | $ao_ccss_domain = get_site_url(); |
24 | 24 | } |
25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | ?> |
29 | 29 | <ul id="adv-panel"> |
30 | 30 | <li class="itemDetail"> |
31 | - <h2 class="itemTitle fleft"><?php _e( 'Advanced Settings', 'autoptimize' ); ?></h2> |
|
31 | + <h2 class="itemTitle fleft"><?php _e('Advanced Settings', 'autoptimize'); ?></h2> |
|
32 | 32 | <button type="button" class="toggle-btn"> |
33 | 33 | <span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span> |
34 | 34 | </button> |
@@ -36,114 +36,114 @@ discard block |
||
36 | 36 | <table id="key" class="form-table"> |
37 | 37 | <tr> |
38 | 38 | <th scope="row"> |
39 | - <?php _e( 'Viewport Size', 'autoptimize' ); ?> |
|
39 | + <?php _e('Viewport Size', 'autoptimize'); ?> |
|
40 | 40 | </th> |
41 | 41 | <td> |
42 | - <label for="autoptimize_ccss_vw"><?php _e( 'Width', 'autoptimize' ); ?>:</label> <input type="number" id="autoptimize_ccss_vw" name="autoptimize_ccss_viewport[w]" min="800" max="4096" placeholder="1400" value="<?php echo $viewport['w']; ?>" /> |
|
43 | - <label for="autoptimize_ccss_vh"><?php _e( 'Height', 'autoptimize' ); ?>:</label> <input type="number" id="autoptimize_ccss_vh" name="autoptimize_ccss_viewport[h]" min="600" max="2160" placeholder="1080" value="<?php echo $viewport['h']; ?>" /> |
|
42 | + <label for="autoptimize_ccss_vw"><?php _e('Width', 'autoptimize'); ?>:</label> <input type="number" id="autoptimize_ccss_vw" name="autoptimize_ccss_viewport[w]" min="800" max="4096" placeholder="1400" value="<?php echo $viewport['w']; ?>" /> |
|
43 | + <label for="autoptimize_ccss_vh"><?php _e('Height', 'autoptimize'); ?>:</label> <input type="number" id="autoptimize_ccss_vh" name="autoptimize_ccss_viewport[h]" min="600" max="2160" placeholder="1080" value="<?php echo $viewport['h']; ?>" /> |
|
44 | 44 | <p class="notes"> |
45 | - <?php _e( '<a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> default viewport size is 1400x1080 pixels (width x height). You can change this size by typing a desired width and height values above. Allowed value ranges are from 800 to 4096 for width and from 600 to 2160 for height.', 'autoptimize' ); ?> |
|
45 | + <?php _e('<a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> default viewport size is 1400x1080 pixels (width x height). You can change this size by typing a desired width and height values above. Allowed value ranges are from 800 to 4096 for width and from 600 to 2160 for height.', 'autoptimize'); ?> |
|
46 | 46 | </p> |
47 | 47 | </td> |
48 | 48 | </tr> |
49 | 49 | <tr> |
50 | 50 | <th scope="row"> |
51 | - <?php _e( 'Force Include CSS selectors', 'autoptimize' ); ?> |
|
51 | + <?php _e('Force Include CSS selectors', 'autoptimize'); ?> |
|
52 | 52 | </th> |
53 | 53 | <td> |
54 | - <textarea id="autoptimize_ccss_finclude" name="autoptimize_ccss_finclude" rows='3' maxlenght='500' style="width:100%;" placeholder="<?php _e( '.button-special,//#footer', 'autoptimize' ); ?>"><?php echo trim( strip_tags( $ao_ccss_finclude ) ); ?></textarea> |
|
54 | + <textarea id="autoptimize_ccss_finclude" name="autoptimize_ccss_finclude" rows='3' maxlenght='500' style="width:100%;" placeholder="<?php _e('.button-special,//#footer', 'autoptimize'); ?>"><?php echo trim(strip_tags($ao_ccss_finclude)); ?></textarea> |
|
55 | 55 | <p class="notes"> |
56 | - <?php _e( 'Force include CSS selectors can be used to style dynamic content that is not part of the HTML that is seen during the Critical CSS generation. To use this feature, add comma separated values with both simple strings and/or regular expressions to match the desired selectors. Regular expressions must be preceeded by two forward slashes. For instance: <code>.button-special,//#footer</code>. In this example <code>.button-special</code> will match <code>.button-special</code> selector only, while <code>//#footer</code> will match <code>#footer</code>, <code>#footer-address</code> and <code>#footer-phone</code> selectors in case they exist.<br />Do take into account that changing this setting will only affect new/ updated rules, so you might want to remove old rules and clear your page cache to expedite the forceIncludes becoming used.', 'autoptimize' ); ?> |
|
56 | + <?php _e('Force include CSS selectors can be used to style dynamic content that is not part of the HTML that is seen during the Critical CSS generation. To use this feature, add comma separated values with both simple strings and/or regular expressions to match the desired selectors. Regular expressions must be preceeded by two forward slashes. For instance: <code>.button-special,//#footer</code>. In this example <code>.button-special</code> will match <code>.button-special</code> selector only, while <code>//#footer</code> will match <code>#footer</code>, <code>#footer-address</code> and <code>#footer-phone</code> selectors in case they exist.<br />Do take into account that changing this setting will only affect new/ updated rules, so you might want to remove old rules and clear your page cache to expedite the forceIncludes becoming used.', 'autoptimize'); ?> |
|
57 | 57 | </p> |
58 | 58 | </td> |
59 | 59 | </tr> |
60 | 60 | <tr> |
61 | 61 | <th scope="row"> |
62 | - <?php _e( 'Queue processing time limit', 'autoptimize' ); ?> |
|
62 | + <?php _e('Queue processing time limit', 'autoptimize'); ?> |
|
63 | 63 | </th> |
64 | 64 | <td> |
65 | 65 | <input type="number" id="autoptimize_ccss_rtimelimit" name="autoptimize_ccss_rtimelimit" min="0" max="240" placeholder="0" value="<?php echo $ao_ccss_rtimelimit; ?>" /> |
66 | 66 | <p class="notes"> |
67 | - <?php _e( 'The cronned queue processing is an asynchronous process triggerd by (WordPress) cron. To avoid this process from running too long and potentially getting killed, you can set the number of seconds here, 0 means no limit.', 'autoptimize' ); ?> |
|
67 | + <?php _e('The cronned queue processing is an asynchronous process triggerd by (WordPress) cron. To avoid this process from running too long and potentially getting killed, you can set the number of seconds here, 0 means no limit.', 'autoptimize'); ?> |
|
68 | 68 | </p> |
69 | 69 | </td> |
70 | 70 | </tr> |
71 | 71 | <tr> |
72 | 72 | <th scope="row"> |
73 | - <?php _e( 'Fetch Original CSS', 'autoptimize' ); ?> |
|
73 | + <?php _e('Fetch Original CSS', 'autoptimize'); ?> |
|
74 | 74 | </th> |
75 | 75 | <td> |
76 | - <input type="checkbox" id="autoptimize_ccss_noptimize" name="autoptimize_ccss_noptimize" value="1" <?php checked( 1 == $ao_ccss_noptimize ); ?>> |
|
76 | + <input type="checkbox" id="autoptimize_ccss_noptimize" name="autoptimize_ccss_noptimize" value="1" <?php checked(1 == $ao_ccss_noptimize); ?>> |
|
77 | 77 | <p class="notes"> |
78 | - <?php _e( 'In some (rare) cases the generation of critical CSS works better with the original CSS instead of the Autoptimized one, this option enables that behavior.', 'autoptimize' ); ?> |
|
78 | + <?php _e('In some (rare) cases the generation of critical CSS works better with the original CSS instead of the Autoptimized one, this option enables that behavior.', 'autoptimize'); ?> |
|
79 | 79 | </p> |
80 | 80 | </td> |
81 | 81 | </tr> |
82 | 82 | <tr> |
83 | 83 | <th scope="row"> |
84 | - <?php _e( 'Add CCSS for logged in users?', 'autoptimize' ); ?> |
|
84 | + <?php _e('Add CCSS for logged in users?', 'autoptimize'); ?> |
|
85 | 85 | </th> |
86 | 86 | <td> |
87 | - <input type="checkbox" id="autoptimize_ccss_loggedin" name="autoptimize_ccss_loggedin" value="1" <?php checked( 1 == $ao_ccss_loggedin ); ?>> |
|
87 | + <input type="checkbox" id="autoptimize_ccss_loggedin" name="autoptimize_ccss_loggedin" value="1" <?php checked(1 == $ao_ccss_loggedin); ?>> |
|
88 | 88 | <p class="notes"> |
89 | - <?php _e( 'Critical CSS is generated by criticalcss.com from your pages as seen by an "anonymous visitor". Disable this option if you don\'t want the "visitor" critical CSS to be used for logged in users.', 'autoptimize' ); ?> |
|
89 | + <?php _e('Critical CSS is generated by criticalcss.com from your pages as seen by an "anonymous visitor". Disable this option if you don\'t want the "visitor" critical CSS to be used for logged in users.', 'autoptimize'); ?> |
|
90 | 90 | </p> |
91 | 91 | </td> |
92 | 92 | </tr> |
93 | 93 | <tr> |
94 | 94 | <th scope="row"> |
95 | - <?php _e( 'Force path-based rules to be generated for pages?', 'autoptimize' ); ?> |
|
95 | + <?php _e('Force path-based rules to be generated for pages?', 'autoptimize'); ?> |
|
96 | 96 | </th> |
97 | 97 | <td> |
98 | - <input type="checkbox" id="autoptimize_ccss_forcepath" name="autoptimize_ccss_forcepath" value="1" <?php checked( 1 == $ao_ccss_forcepath ); ?>> |
|
98 | + <input type="checkbox" id="autoptimize_ccss_forcepath" name="autoptimize_ccss_forcepath" value="1" <?php checked(1 == $ao_ccss_forcepath); ?>> |
|
99 | 99 | <p class="notes"> |
100 | - <?php _e( 'By default for each page a separate rule is generated. If your pages have (semi-)identical above the fold look and feel and you want to keep the rules lean, you can disable that so one rule is created to all pages.', 'autoptimize' ); ?> |
|
100 | + <?php _e('By default for each page a separate rule is generated. If your pages have (semi-)identical above the fold look and feel and you want to keep the rules lean, you can disable that so one rule is created to all pages.', 'autoptimize'); ?> |
|
101 | 101 | </p> |
102 | 102 | </td> |
103 | 103 | </tr> |
104 | 104 | <tr> |
105 | 105 | <th scope="row"> |
106 | - <?php _e( 'Defer jQuery and other non-aggregated JS-files?', 'autoptimize' ); ?> |
|
106 | + <?php _e('Defer jQuery and other non-aggregated JS-files?', 'autoptimize'); ?> |
|
107 | 107 | </th> |
108 | 108 | <td> |
109 | - <input type="checkbox" id="autoptimize_ccss_deferjquery" name="autoptimize_ccss_deferjquery" value="1" <?php checked( 1 == $ao_ccss_deferjquery ); ?>> |
|
109 | + <input type="checkbox" id="autoptimize_ccss_deferjquery" name="autoptimize_ccss_deferjquery" value="1" <?php checked(1 == $ao_ccss_deferjquery); ?>> |
|
110 | 110 | <p class="notes"> |
111 | - <?php _e( 'Defer all non-aggregated JS, including jQuery and inline JS to fix remaining render-blocking issues. Make sure to test your site thoroughly when activating this option!', 'autoptimize' ); ?> |
|
111 | + <?php _e('Defer all non-aggregated JS, including jQuery and inline JS to fix remaining render-blocking issues. Make sure to test your site thoroughly when activating this option!', 'autoptimize'); ?> |
|
112 | 112 | </p> |
113 | 113 | </td> |
114 | 114 | </tr> |
115 | 115 | <tr> |
116 | 116 | <th scope="row"> |
117 | - <?php _e( 'Unload critical CSS after page load?', 'autoptimize' ); ?> |
|
117 | + <?php _e('Unload critical CSS after page load?', 'autoptimize'); ?> |
|
118 | 118 | </th> |
119 | 119 | <td> |
120 | - <input type="checkbox" id="autoptimize_ccss_unloadccss" name="autoptimize_ccss_unloadccss" value="1" <?php checked( 1 == $ao_ccss_unloadccss ); ?>> |
|
120 | + <input type="checkbox" id="autoptimize_ccss_unloadccss" name="autoptimize_ccss_unloadccss" value="1" <?php checked(1 == $ao_ccss_unloadccss); ?>> |
|
121 | 121 | <p class="notes"> |
122 | - <?php _e( 'In rare cases the critical CSS needs to be removed once the full CSS loads, this option makes it so!', 'autoptimize' ); ?> |
|
122 | + <?php _e('In rare cases the critical CSS needs to be removed once the full CSS loads, this option makes it so!', 'autoptimize'); ?> |
|
123 | 123 | </p> |
124 | 124 | </td> |
125 | 125 | </tr> |
126 | 126 | <tr> |
127 | 127 | <th scope="row"> |
128 | - <?php _e( 'Bound domain', 'autoptimize' ); ?> |
|
128 | + <?php _e('Bound domain', 'autoptimize'); ?> |
|
129 | 129 | </th> |
130 | 130 | <td> |
131 | - <input type="text" id="autoptimize_ccss_domain" name="autoptimize_ccss_domain" style="width:100%;" placeholder="<?php _e( 'Don\'t leave this empty, put e.g. https://example.net/ or simply \'none\' to disable domain binding.', 'autoptimize' ); ?>" value="<?php echo trim( strip_tags( $ao_ccss_domain ) ); ?>"> |
|
131 | + <input type="text" id="autoptimize_ccss_domain" name="autoptimize_ccss_domain" style="width:100%;" placeholder="<?php _e('Don\'t leave this empty, put e.g. https://example.net/ or simply \'none\' to disable domain binding.', 'autoptimize'); ?>" value="<?php echo trim(strip_tags($ao_ccss_domain)); ?>"> |
|
132 | 132 | <p class="notes"> |
133 | - <?php _e( 'Only requests from this domain will be sent for Critical CSS generation (pricing is per domain/ month).', 'autoptimize' ); ?> |
|
133 | + <?php _e('Only requests from this domain will be sent for Critical CSS generation (pricing is per domain/ month).', 'autoptimize'); ?> |
|
134 | 134 | </p> |
135 | 135 | </td> |
136 | 136 | </tr> |
137 | 137 | <tr> |
138 | 138 | <th scope="row"> |
139 | - <?php _e( 'Debug Mode', 'autoptimize' ); ?> |
|
139 | + <?php _e('Debug Mode', 'autoptimize'); ?> |
|
140 | 140 | </th> |
141 | 141 | <td> |
142 | - <input type="checkbox" id="autoptimize_ccss_debug" name="autoptimize_ccss_debug" value="1" <?php checked( 1 == $ao_ccss_debug ); ?>> |
|
142 | + <input type="checkbox" id="autoptimize_ccss_debug" name="autoptimize_ccss_debug" value="1" <?php checked(1 == $ao_ccss_debug); ?>> |
|
143 | 143 | <p class="notes"> |
144 | 144 | <?php |
145 | - _e( '<strong>CAUTION! Only use debug mode on production/live environments for ad-hoc troubleshooting and remember to turn it back off after</strong>, as this generates a lot of log-data.<br />Check the box above to enable Autoptimize CriticalCSS Power-Up debug mode. It provides debug facilities in this screen, to the browser console and to this file: ', 'autoptimize' ); |
|
146 | - echo '<code>' . AO_CCSS_LOG . '</code>'; |
|
145 | + _e('<strong>CAUTION! Only use debug mode on production/live environments for ad-hoc troubleshooting and remember to turn it back off after</strong>, as this generates a lot of log-data.<br />Check the box above to enable Autoptimize CriticalCSS Power-Up debug mode. It provides debug facilities in this screen, to the browser console and to this file: ', 'autoptimize'); |
|
146 | + echo '<code>'.AO_CCSS_LOG.'</code>'; |
|
147 | 147 | ?> |
148 | 148 | </p> |
149 | 149 | </td> |
@@ -12,27 +12,27 @@ discard block |
||
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 |
||
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> |
@@ -13,12 +13,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 --> |