Conditions | 45 |
Paths | 7680 |
Total Lines | 585 |
Lines | 19 |
Ratio | 3.25 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
69 | public function show() |
||
70 | { |
||
71 | $conf = self::instance(); |
||
72 | ?> |
||
73 | <style> |
||
74 | /* title and button */ |
||
75 | #ao_title_and_button:after {content:''; display:block; clear:both;} |
||
76 | #ao_adv_button{float:right;} |
||
77 | #ao_hide_adv:before, #ao_show_adv:before { |
||
78 | display: inline-block; |
||
79 | float: left; |
||
80 | height: 20px; |
||
81 | width: 35px; |
||
82 | background: none; |
||
83 | color: #b4b9be; |
||
84 | font: normal 20px/26px dashicons; |
||
85 | letter-spacing: -4px; |
||
86 | text-align: left; |
||
87 | speak: none; |
||
88 | -webkit-font-smoothing: antialiased; |
||
89 | -moz-osx-font-smoothing: grayscale; |
||
90 | } |
||
91 | #ao_hide_adv:before { |
||
92 | content: "\f108 \f142"; |
||
93 | } |
||
94 | #ao_show_adv:before { |
||
95 | content: "\f108 \f140"; |
||
96 | } |
||
97 | |||
98 | /* animate "show adv" button */ |
||
99 | #ao_show_adv { animation: watchmenow 3s linear 5s 10; } |
||
100 | #ao_show_adv:hover { animation: none; } |
||
101 | @keyframes watchmenow { |
||
102 | 0% { box-shadow: unset; } |
||
103 | 100% { box-shadow: 0px 0px 20px yellow; } |
||
104 | } |
||
105 | |||
106 | /* form */ |
||
107 | .itemDetail { |
||
108 | background: #fff; |
||
109 | border: 1px solid #ccc; |
||
110 | padding: 15px; |
||
111 | margin: 15px 10px 10px 0; |
||
112 | } |
||
113 | .itemTitle { |
||
114 | margin-top: 0; |
||
115 | } |
||
116 | |||
117 | input[type=url]:invalid {color: red; border-color:red;} .form-table th{font-weight:normal;} |
||
118 | #autoptimize_main .cb_label {display: block; padding-left: 25px; text-indent: -25px;} |
||
119 | |||
120 | /* rss block */ |
||
121 | #futtta_feed ul{list-style:outside;} |
||
122 | #futtta_feed {font-size:medium; margin:0px 20px;} |
||
123 | |||
124 | /* banner + unslider */ |
||
125 | .autoptimize_banner { |
||
126 | margin: 0 38px; |
||
127 | padding-bottom: 5px; |
||
128 | } |
||
129 | .autoptimize_banner ul li { |
||
130 | font-size:medium; |
||
131 | text-align:center; |
||
132 | } |
||
133 | .unslider { |
||
134 | position:relative; |
||
135 | } |
||
136 | .unslider-arrow { |
||
137 | display: block; |
||
138 | left: unset; |
||
139 | margin-top: -35px; |
||
140 | margin-left: 7px; |
||
141 | margin-right: 7px; |
||
142 | border-radius: 32px; |
||
143 | background: rgba(0, 0, 0, 0.10) no-repeat 50% 50%; |
||
144 | color: rgba(255, 255, 255, 0.8); |
||
145 | font: normal 20px/1 dashicons; |
||
146 | speak: none; |
||
147 | padding: 3px 2px 3px 4px; |
||
148 | -webkit-font-smoothing: antialiased; |
||
149 | -moz-osx-font-smoothing: grayscale; |
||
150 | } |
||
151 | .unslider-arrow:hover { |
||
152 | background-color: rgba(0, 0, 0, 0.20); |
||
153 | color: #FFF; |
||
154 | } |
||
155 | .unslider-arrow.prev { |
||
156 | padding: 3px 4px 3px 2px; |
||
157 | } |
||
158 | .unslider-arrow.next { |
||
159 | right: 0px; |
||
160 | } |
||
161 | .unslider-arrow.prev::before { |
||
162 | content: "\f341"; |
||
163 | } |
||
164 | .unslider-arrow.next::before { |
||
165 | content: "\f345"; |
||
166 | } |
||
167 | |||
168 | /* responsive stuff: hide admin-feed on smaller screens */ |
||
169 | @media (min-width: 961px) { |
||
170 | #autoptimize_main {float:left;width:69%;} |
||
171 | #autoptimize_admin_feed{float:right;width:30%;display:block !important;} |
||
172 | } |
||
173 | @media (max-width: 960px) { |
||
174 | #autoptimize_main {width:100%;} |
||
175 | #autoptimize_admin_feed {width:0%;display:none !important;} |
||
176 | } |
||
177 | @media (max-width: 782px) { |
||
178 | #ao_hide_adv span, #ao_show_adv span {display: none;} |
||
179 | #ao_hide_adv,#ao_show_adv {height: 34px;padding: 4px 12px 8px 8px;} |
||
180 | #ao_hide_adv:before,#ao_show_adv:before {font-size: 25px;} |
||
181 | #autoptimize_main input[type="checkbox"] {margin-left: 10px;} |
||
182 | #autoptimize_main .cb_label {display: block; padding-left: 45px; text-indent: -45px;} |
||
183 | } |
||
184 | </style> |
||
185 | |||
186 | <div class="wrap"> |
||
187 | |||
188 | <?php if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { ?> |
||
189 | <div class="notice-error notice"><?php echo '<p>' . sprintf( __( '<strong>You are using a very old version of PHP</strong> (5.2.x or older) which has <a href=%s>serious security and performance issues</a>. Support for PHP 5.5 and below will be removed in one of the next AO released, please ask your hoster to provide you with an upgrade path to 7.x.', 'autoptimize' ), '"http://blog.futtta.be/2016/03/15/why-would-you-still-be-on-php-5-2/" target="_blank"' ) . '</p>'; ?></div> |
||
190 | <?php } ?> |
||
191 | |||
192 | <?php if ( defined( 'AUTOPTIMIZE_LEGACY_MINIFIERS' ) ) { ?> |
||
193 | <div class="notice-error notice"><p> |
||
194 | <?php _e( "You are using the (no longer supported) AUTOPTIMIZE_LEGACY_MINIFIERS constant. Ensure your site is working properly and remove the constant, it doesn't do anything any more.", 'autoptimize' ); ?> |
||
195 | </p></div> |
||
196 | <?php } ?> |
||
197 | |||
198 | <div id="autoptimize_main"> |
||
199 | <div id="ao_title_and_button"> |
||
200 | <h1 id="ao_title"><?php _e( 'Autoptimize Settings', 'autoptimize' ); ?> |
||
201 | <span id="ao_adv_button"> |
||
202 | <?php if ( autoptimizeOption::get_option( 'autoptimize_show_adv', '1' ) == '1' ) { ?> |
||
203 | <a href="javascript:void(0);" id="ao_show_adv" class="button" style="display:none;"><span><?php _e("Show advanced settings","autoptimize") ?></span></a> |
||
204 | <a href="javascript:void(0);" id="ao_hide_adv" class="button"><span><?php _e("Hide advanced settings","autoptimize") ?></span></a> |
||
205 | <style>tr.ao_adv{display:table-row;} li.ao_adv{display:list-item;}</style> |
||
206 | <?php $hiddenClass = ''; ?> |
||
207 | <?php } else { ?> |
||
208 | <a href="javascript:void(0);" id="ao_show_adv" class="button"><span><?php _e("Show advanced settings","autoptimize") ?></span></a> |
||
209 | <a href="javascript:void(0);" id="ao_hide_adv" class="button" style="display:none;"><span><?php _e("Hide advanced settings","autoptimize") ?></span></a> |
||
210 | <?php $hiddenClass = 'hidden '; ?> |
||
211 | <?php } ?> |
||
212 | </span> |
||
213 | </h1> |
||
214 | </div> |
||
215 | |||
216 | <?php echo $this->ao_admin_tabs(); ?> |
||
217 | |||
218 | <form method="post" action="<?php echo admin_url( 'options.php' ); ?>"> |
||
219 | <?php settings_fields( 'autoptimize' ); ?> |
||
220 | |||
221 | <ul> |
||
222 | |||
223 | <?php |
||
224 | // Only show enable site configuration in network site option. |
||
225 | $blog_id = get_current_blog_id(); |
||
226 | if( is_plugin_active_for_network( 'autoptimize/autoptimize.php' ) && 1 === $blog_id ) { |
||
227 | ?> |
||
228 | <li class="itemDetail"> |
||
229 | <h2 class="itemTitle"><?php _e('Multisite Options','autoptimize'); ?></h2> |
||
230 | <table class="form-table"> |
||
231 | <tr valign="top"> |
||
232 | <th scope="row"><?php _e('Enable site configuration?','autoptimize'); ?></th> |
||
233 | <td><label class="cb_label"><input type="checkbox" id="autoptimize_enable_site_config" name="autoptimize_enable_site_config" <?php echo autoptimizeOption::get_option('autoptimize_enable_site_config')?'checked="checked" ':''; ?>/> |
||
234 | <?php _e('Enable Autoptimize configuration per site.','autoptimize'); ?></label></td> |
||
235 | </tr> |
||
236 | </table> |
||
237 | </li> |
||
238 | <?php } ?> |
||
239 | |||
240 | <li class="itemDetail"> |
||
241 | <h2 class="itemTitle"><?php _e('JavaScript Options','autoptimize'); ?></h2> |
||
242 | <table class="form-table"> |
||
243 | <tr valign="top"> |
||
244 | <th scope="row"><?php _e('Optimize JavaScript Code?','autoptimize'); ?></th> |
||
245 | <td><input type="checkbox" id="autoptimize_js" name="autoptimize_js" <?php echo autoptimizeOption::get_option('autoptimize_js')?'checked="checked" ':''; ?>/></td> |
||
246 | </tr> |
||
247 | <tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv"> |
||
248 | <th scope="row"><?php _e( 'Aggregate JS-files?', 'autoptimize' ); ?></th> |
||
249 | <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" ':''; ?>/> |
||
250 | <?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> |
||
251 | </tr> |
||
252 | <tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate"> |
||
253 | <th scope="row"><?php _e('Also aggregate inline JS?','autoptimize'); ?></th> |
||
254 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_js_include_inline" <?php echo autoptimizeOption::get_option('autoptimize_js_include_inline')?'checked="checked" ':''; ?>/> |
||
255 | <?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> |
||
256 | </tr> |
||
257 | <tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate"> |
||
258 | <th scope="row"><?php _e('Force JavaScript in <head>?','autoptimize'); ?></th> |
||
259 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_js_forcehead" <?php echo autoptimizeOption::get_option('autoptimize_js_forcehead')?'checked="checked" ':''; ?>/> |
||
260 | <?php _e('Load JavaScript early, this can potentially fix some JS-errors, but makes the JS render blocking.','autoptimize'); ?></label></td> |
||
261 | </tr> |
||
262 | View Code Duplication | <?php if (autoptimizeOption::get_option('autoptimize_js_justhead')) { ?> |
|
263 | <tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate"> |
||
264 | <th scope="row"><?php _e('Look for scripts only in <head>?','autoptimize'); echo ' <i>'. __('(deprecated)','autoptimize') . '</i>'; ?></th> |
||
265 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_js_justhead" <?php echo autoptimizeOption::get_option('autoptimize_js_justhead')?'checked="checked" ':''; ?>/> |
||
266 | <?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> |
||
267 | </tr> |
||
268 | <?php } ?> |
||
269 | <tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv"> |
||
270 | <th scope="row"><?php _e('Exclude scripts from Autoptimize:','autoptimize'); ?></th> |
||
271 | <td><label><input type="text" style="width:100%;" name="autoptimize_js_exclude" value="<?php echo autoptimizeOption::get_option('autoptimize_js_exclude',"wp-includes/js/dist/, wp-includes/js/tinymce/, js/jquery/jquery.js"); ?>"/><br /> |
||
272 | <?php _e('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'); ?></label></td> |
||
273 | </tr> |
||
274 | <tr valign="top" class="<?php echo $hiddenClass;?>js_sub ao_adv js_aggregate"> |
||
275 | <th scope="row"><?php _e('Add try-catch wrapping?','autoptimize'); ?></th> |
||
276 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_js_trycatch" <?php echo autoptimizeOption::get_option('autoptimize_js_trycatch')?'checked="checked" ':''; ?>/> |
||
277 | <?php _e('If your scripts break because of a JS-error, you might want to try this.','autoptimize'); ?></label></td> |
||
278 | </tr> |
||
279 | </table> |
||
280 | </li> |
||
281 | |||
282 | <li class="itemDetail"> |
||
283 | <h2 class="itemTitle"><?php _e('CSS Options','autoptimize'); ?></h2> |
||
284 | <table class="form-table"> |
||
285 | <tr valign="top"> |
||
286 | <th scope="row"><?php _e('Optimize CSS Code?','autoptimize'); ?></th> |
||
287 | <td><input type="checkbox" id="autoptimize_css" name="autoptimize_css" <?php echo autoptimizeOption::get_option('autoptimize_css')?'checked="checked" ':''; ?>/></td> |
||
288 | </tr> |
||
289 | <tr class="<?php echo $hiddenClass;?>css_sub ao_adv" valign="top"> |
||
290 | <th scope="row"><?php _e( 'Aggregate CSS-files?', 'autoptimize' ); ?></th> |
||
291 | <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" ' : ''; ?>/> |
||
292 | <?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> |
||
293 | </tr> |
||
294 | <tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv css_aggregate"> |
||
295 | <th scope="row"><?php _e('Also aggregate inline CSS?','autoptimize'); ?></th> |
||
296 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_css_include_inline" <?php echo autoptimizeOption::get_option('autoptimize_css_include_inline','1')?'checked="checked" ':''; ?>/> |
||
297 | <?php _e('Check this option for Autoptimize to also aggregate CSS in the HTML.','autoptimize'); ?></label></td> |
||
298 | </tr> |
||
299 | <tr class="<?php echo $hiddenClass;?>css_sub ao_adv css_aggregate" valign="top"> |
||
300 | <th scope="row"><?php _e('Generate data: URIs for images?','autoptimize'); ?></th> |
||
301 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_css_datauris" <?php echo autoptimizeOption::get_option('autoptimize_css_datauris')?'checked="checked" ':''; ?>/> |
||
302 | <?php _e('Enable this to include small background-images in the CSS itself instead of as separate downloads.','autoptimize'); ?></label></td> |
||
303 | </tr> |
||
304 | View Code Duplication | <?php if (autoptimizeOption::get_option('autoptimize_css_justhead')) { ?> |
|
305 | <tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv css_aggregate"> |
||
306 | <th scope="row"><?php _e('Look for styles only in <head>?','autoptimize'); echo ' <i>'. __('(deprecated)','autoptimize') . '</i>'; ?></th> |
||
307 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_css_justhead" <?php echo autoptimizeOption::get_option('autoptimize_css_justhead')?'checked="checked" ':''; ?>/> |
||
308 | <?php _e('Don\'t autoptimize CSS outside the head-section. If the cache gets big, you might want to enable this.','autoptimize'); ?></label></td> |
||
309 | </tr> |
||
310 | <?php } ?> |
||
311 | <tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv"> |
||
312 | <th scope="row"><?php _e('Inline and Defer CSS?','autoptimize'); ?></th> |
||
313 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_css_defer" id="autoptimize_css_defer" <?php echo autoptimizeOption::get_option('autoptimize_css_defer')?'checked="checked" ':''; ?>/> |
||
314 | <?php |
||
315 | _e( 'Inline "above the fold CSS" while loading the main autoptimized CSS only after page load. <a href="http://wordpress.org/plugins/autoptimize/faq/" target="_blank">Check the FAQ</a> for more info.', 'autoptimize' ); |
||
316 | View Code Duplication | if ( function_exists( 'is_plugin_active' ) && ! is_plugin_active( 'autoptimize-criticalcss/ao_criticss_aas.php' ) ) { |
|
317 | echo ' '; |
||
318 | $critcss_install_url = network_admin_url() . 'plugin-install.php?s=autoptimize+criticalcss&tab=search&type=term'; |
||
319 | echo sprintf( __( 'This can be fully automated for different types of pages with the %s.', 'autoptimize' ), '<a href="'.$critcss_install_url.'">Autoptimize CriticalCSS Power-Up</a>' ); |
||
320 | } |
||
321 | ?> |
||
322 | </label></td> |
||
323 | </tr> |
||
324 | <tr valign="top" class="<?php echo $hiddenClass;?>css_sub ao_adv" id="autoptimize_css_defer_inline"> |
||
325 | <th scope="row"></th> |
||
326 | <td><label><textarea rows="10" cols="10" style="width:100%;" placeholder="<?php _e('Paste the above the fold CSS here.','autoptimize'); ?>" name="autoptimize_css_defer_inline"><?php echo autoptimizeOption::get_option('autoptimize_css_defer_inline'); ?></textarea></label></td> |
||
327 | </tr> |
||
328 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv css_sub css_aggregate"> |
||
329 | <th scope="row"><?php _e('Inline all CSS?','autoptimize'); ?></th> |
||
330 | <td><label class="cb_label"><input type="checkbox" id="autoptimize_css_inline" name="autoptimize_css_inline" <?php echo autoptimizeOption::get_option('autoptimize_css_inline')?'checked="checked" ':''; ?>/> |
||
331 | <?php _e('Inlining all CSS can improve performance for sites with a low pageviews/ visitor-rate, but may slow down performance otherwise.','autoptimize'); ?></label></td> |
||
332 | </tr> |
||
333 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv css_sub"> |
||
334 | <th scope="row"><?php _e('Exclude CSS from Autoptimize:','autoptimize'); ?></th> |
||
335 | <td><label><input type="text" style="width:100%;" name="autoptimize_css_exclude" value="<?php echo autoptimizeOption::get_option('autoptimize_css_exclude','wp-content/cache/, wp-content/uploads/, admin-bar.min.css, dashicons.min.css'); ?>"/><br /> |
||
336 | <?php _e('A comma-separated list of CSS you want to exclude from being optimized.','autoptimize'); ?></label></td> |
||
337 | </tr> |
||
338 | </table> |
||
339 | </li> |
||
340 | |||
341 | <li class="itemDetail"> |
||
342 | <h2 class="itemTitle"><?php _e('HTML Options','autoptimize'); ?></h2> |
||
343 | <table class="form-table"> |
||
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 autoptimizeOption::get_option('autoptimize_html')?'checked="checked" ':''; ?>/></td> |
||
347 | </tr> |
||
348 | <tr class="<?php echo $hiddenClass;?>html_sub ao_adv" 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 autoptimizeOption::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 | </tr> |
||
353 | </table> |
||
354 | </li> |
||
355 | |||
356 | <li class="itemDetail"> |
||
357 | <h2 class="itemTitle"><?php _e('CDN Options','autoptimize'); ?></h2> |
||
358 | <table class="form-table"> |
||
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(autoptimizeOption::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 | </tr> |
||
364 | </table> |
||
365 | </li> |
||
366 | |||
367 | <li class="<?php echo $hiddenClass;?>itemDetail ao_adv"> |
||
368 | <h2 class="itemTitle"><?php _e('Cache Info','autoptimize'); ?></h2> |
||
369 | <table class="form-table" > |
||
370 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv"> |
||
371 | <th scope="row"><?php _e('Cache folder','autoptimize'); ?></th> |
||
372 | <td><?php echo htmlentities(AUTOPTIMIZE_CACHE_DIR); ?></td> |
||
373 | </tr> |
||
374 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv"> |
||
375 | <th scope="row"><?php _e('Can we write?','autoptimize'); ?></th> |
||
376 | <td><?php echo (autoptimizeCache::cacheavail() ? __('Yes','autoptimize') : __('No','autoptimize')); ?></td> |
||
377 | </tr> |
||
378 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv"> |
||
379 | <th scope="row"><?php _e('Cached styles and scripts','autoptimize'); ?></th> |
||
380 | <td><?php |
||
381 | $AOstatArr = autoptimizeCache::stats(); |
||
382 | if ( ! empty( $AOstatArr ) && is_array( $AOstatArr ) ) { |
||
383 | $AOcacheSize = size_format( $AOstatArr[1], 2 ); |
||
384 | $details = ''; |
||
385 | if ( $AOcacheSize > 0 ) { |
||
386 | $details = ', ~' . $AOcacheSize . ' total'; |
||
387 | } |
||
388 | printf( __( '%1$s files, totalling %2$s Kbytes (calculated at %3$s)', 'autoptimize' ), $AOstatArr[0], $AOcacheSize, date( 'H:i e', $AOstatArr[2] ) ); |
||
389 | } |
||
390 | ?></td> |
||
391 | </tr> |
||
392 | </table> |
||
393 | </li> |
||
394 | |||
395 | <li class="<?php echo $hiddenClass;?>itemDetail ao_adv"> |
||
396 | <h2 class="itemTitle"><?php _e('Misc Options','autoptimize'); ?></h2> |
||
397 | <table class="form-table"> |
||
398 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv"> |
||
399 | <th scope="row"><?php _e('Save aggregated script/css as static files?','autoptimize'); ?></th> |
||
400 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_cache_nogzip" <?php echo autoptimizeOption::get_option('autoptimize_cache_nogzip','1')?'checked="checked" ':''; ?>/> |
||
401 | <?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 | </tr> |
||
403 | <?php |
||
404 | $_min_excl_class = 'ao_adv'; |
||
405 | if ( !$conf->get( 'autoptimize_css_aggregate' ) && !$conf->get( 'autoptimize_js_aggregate' ) ) { |
||
406 | $_min_excl_class = ' hidden'; |
||
407 | } |
||
408 | ?> |
||
409 | <tr valign="top" id="min_excl_row" class="<?php echo $hiddenClass.$_min_excl_class; ?>"> |
||
410 | <th scope="row"><?php _e('Minify excluded CSS and JS files?','autoptimize'); ?></th> |
||
411 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_minify_excluded" <?php echo autoptimizeOption::get_option('autoptimize_minify_excluded','1')?'checked="checked" ':''; ?>/> |
||
412 | <?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 | </tr> |
||
414 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv"> |
||
415 | <th scope="row"><?php _e('Also optimize for logged in users?','autoptimize'); ?></th> |
||
416 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_logged" <?php echo autoptimizeOption::get_option('autoptimize_optimize_logged','1')?'checked="checked" ':''; ?>/> |
||
417 | <?php _e('By default Autoptimize is also active for logged on users, uncheck not to optimize when logged in e.g. to use a pagebuilder.','autoptimize'); ?></label></td> |
||
418 | </tr> |
||
419 | <?php |
||
420 | if ( function_exists("is_checkout") || function_exists("is_cart") || function_exists("edd_is_checkout") || function_exists("wpsc_is_cart") || function_exists("wpsc_is_checkout") ) { |
||
421 | ?> |
||
422 | <tr valign="top" class="<?php echo $hiddenClass;?>ao_adv"> |
||
423 | <th scope="row"><?php _e('Also optimize shop cart/ checkout?','autoptimize'); ?></th> |
||
424 | <td><label class="cb_label"><input type="checkbox" name="autoptimize_optimize_checkout" <?php echo autoptimizeOption::get_option('autoptimize_optimize_checkout','1')?'checked="checked" ':''; ?>/> |
||
425 | <?php _e('By default Autoptimize is also active on your shop\'s cart/ checkout, uncheck not to optimize those.','autoptimize'); ?></label> |
||
426 | </td> |
||
427 | </tr> |
||
428 | <?php } ?> |
||
429 | </table> |
||
430 | </li> |
||
431 | |||
432 | </ul> |
||
433 | |||
434 | <input type="hidden" id="autoptimize_show_adv" name="autoptimize_show_adv" value="<?php echo autoptimizeOption::get_option('autoptimize_show_adv','1'); ?>"> |
||
435 | |||
436 | <p class="submit"> |
||
437 | <input type="submit" class="button-secondary" value="<?php _e('Save Changes','autoptimize') ?>" /> |
||
438 | <input type="submit" class="button-primary" name="autoptimize_cache_clean" value="<?php _e('Save Changes and Empty Cache','autoptimize') ?>" /> |
||
439 | </p> |
||
440 | |||
441 | </form> |
||
442 | </div> |
||
443 | <div id="autoptimize_admin_feed" class="hidden"> |
||
444 | <div class="autoptimize_banner hidden"> |
||
445 | <ul> |
||
446 | <?php |
||
447 | if ( $this->settings_screen_do_remote_http ) { |
||
448 | $AO_banner = get_transient( 'autoptimize_banner' ); |
||
449 | if ( empty( $AO_banner ) ) { |
||
450 | $banner_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_news.html?ao_ver='.AUTOPTIMIZE_PLUGIN_VERSION ); |
||
451 | if ( ! is_wp_error( $banner_resp ) ) { |
||
452 | if ( '200' == wp_remote_retrieve_response_code( $banner_resp ) ) { |
||
453 | $AO_banner = wp_kses_post( wp_remote_retrieve_body( $banner_resp ) ); |
||
454 | set_transient('autoptimize_banner', $AO_banner, DAY_IN_SECONDS); |
||
455 | } |
||
456 | } |
||
457 | } |
||
458 | echo $AO_banner; |
||
459 | } |
||
460 | ?> |
||
461 | <li><?php _e("Need help? <a href='https://wordpress.org/plugins/autoptimize/faq/'>Check out the FAQ here</a>.","autoptimize"); ?></li> |
||
462 | <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> |
||
463 | </ul> |
||
464 | </div> |
||
465 | <div style="margin-left:10px;margin-top:-5px;"> |
||
466 | <h2> |
||
467 | <?php _e("futtta about","autoptimize") ?> |
||
468 | <select id="feed_dropdown" > |
||
469 | <option value="1"><?php _e("Autoptimize","autoptimize") ?></option> |
||
470 | <option value="2"><?php _e("WordPress","autoptimize") ?></option> |
||
471 | <option value="3"><?php _e("Web Technology","autoptimize") ?></option> |
||
472 | </select> |
||
473 | </h2> |
||
474 | <div id="futtta_feed"> |
||
475 | <div id="autoptimizefeed"> |
||
476 | <?php $this->getFutttaFeeds("http://feeds.feedburner.com/futtta_autoptimize"); ?> |
||
477 | </div> |
||
478 | <div id="wordpressfeed"> |
||
479 | <?php $this->getFutttaFeeds("http://feeds.feedburner.com/futtta_wordpress"); ?> |
||
480 | </div> |
||
481 | <div id="webtechfeed"> |
||
482 | <?php $this->getFutttaFeeds("http://feeds.feedburner.com/futtta_webtech"); ?> |
||
483 | </div> |
||
484 | </div> |
||
485 | </div> |
||
486 | <div style="float:right;margin:50px 15px;"><a href="http://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> |
||
487 | </div> |
||
488 | |||
489 | <script type="text/javascript"> |
||
490 | var feed = new Array; |
||
491 | feed[1]="autoptimizefeed"; |
||
492 | feed[2]="wordpressfeed"; |
||
493 | feed[3]="webtechfeed"; |
||
494 | cookiename="autoptimize_feed"; |
||
495 | |||
496 | jQuery(document).ready(function() { |
||
497 | check_ini_state(); |
||
498 | |||
499 | jQuery('#autoptimize_admin_feed').fadeTo("slow",1).show(); |
||
500 | jQuery('.autoptimize_banner').unslider({autoplay:true, delay:3500, infinite: false, arrows:{prev:'<a class="unslider-arrow prev"></a>', next:'<a class="unslider-arrow next"></a>'}}).fadeTo("slow",1).show(); |
||
501 | |||
502 | jQuery( "#feed_dropdown" ).change(function() { |
||
503 | jQuery("#futtta_feed").fadeTo(0,0); |
||
504 | jQuery("#futtta_feed").fadeTo("slow",1); |
||
505 | }); |
||
506 | |||
507 | jQuery( "#ao_show_adv" ).click(function() { |
||
508 | jQuery( "#ao_show_adv" ).hide(); |
||
509 | jQuery( "#ao_hide_adv" ).show(); |
||
510 | jQuery( ".ao_adv" ).removeClass("hidden"); |
||
511 | jQuery( ".ao_adv" ).show("slow"); |
||
512 | if (jQuery("#autoptimize_css").attr('checked')) { |
||
513 | jQuery(".css_sub:visible").fadeTo("fast",1); |
||
514 | if (!jQuery("#autoptimize_css_defer").attr('checked')) { |
||
515 | jQuery("#autoptimize_css_defer_inline").hide(); |
||
516 | } |
||
517 | } |
||
518 | if (jQuery("#autoptimize_js").attr('checked')) { |
||
519 | jQuery(".js_sub:visible").fadeTo("fast",1); |
||
520 | } |
||
521 | check_ini_state(); |
||
522 | jQuery( "input#autoptimize_show_adv" ).val("1"); |
||
523 | }); |
||
524 | |||
525 | jQuery( "#ao_hide_adv" ).click(function() { |
||
526 | jQuery( "#ao_hide_adv" ).hide(); |
||
527 | jQuery( "#ao_show_adv" ).show(); |
||
528 | jQuery( ".ao_adv" ).hide("slow"); |
||
529 | jQuery( ".ao_adv" ).addClass("hidden"); |
||
530 | if (!jQuery("#autoptimize_css").attr('checked')) { |
||
531 | jQuery(".css_sub:visible").fadeTo("fast",.33); |
||
532 | } |
||
533 | if (!jQuery("#autoptimize_js").attr('checked')) { |
||
534 | jQuery(".js_sub:visible").fadeTo("fast",.33); |
||
535 | } |
||
536 | check_ini_state(); |
||
537 | jQuery( "input#autoptimize_show_adv" ).val("0"); |
||
538 | }); |
||
539 | |||
540 | jQuery( "#autoptimize_html" ).change(function() { |
||
541 | if (this.checked) { |
||
542 | jQuery(".html_sub:visible").fadeTo("fast",1); |
||
543 | } else { |
||
544 | jQuery(".html_sub:visible").fadeTo("fast",.33); |
||
545 | } |
||
546 | }); |
||
547 | |||
548 | jQuery( "#autoptimize_js" ).change(function() { |
||
549 | if (this.checked) { |
||
550 | jQuery(".js_sub:visible").fadeTo("fast",1); |
||
551 | } else { |
||
552 | jQuery(".js_sub:visible").fadeTo("fast",.33); |
||
553 | } |
||
554 | }); |
||
555 | |||
556 | jQuery( "#autoptimize_js_aggregate" ).change(function() { |
||
557 | if (this.checked && jQuery("#autoptimize_js").attr('checked')) { |
||
558 | jQuery(".js_aggregate:visible").fadeTo("fast",1); |
||
559 | jQuery( "#min_excl_row" ).show(); |
||
560 | } else { |
||
561 | jQuery(".js_aggregate:visible").fadeTo("fast",.33); |
||
562 | if ( jQuery( "#autoptimize_css_aggregate" ).prop('checked') == false ) { |
||
563 | jQuery( "#min_excl_row" ).hide(); |
||
564 | } |
||
565 | } |
||
566 | }); |
||
567 | |||
568 | jQuery( "#autoptimize_css" ).change(function() { |
||
569 | if (this.checked) { |
||
570 | jQuery(".css_sub:visible").fadeTo("fast",1); |
||
571 | } else { |
||
572 | jQuery(".css_sub:visible").fadeTo("fast",.33); |
||
573 | } |
||
574 | }); |
||
575 | |||
576 | jQuery( "#autoptimize_css_aggregate" ).change(function() { |
||
577 | if (this.checked && jQuery("#autoptimize_css").attr('checked')) { |
||
578 | jQuery(".css_aggregate:visible").fadeTo("fast",1); |
||
579 | jQuery( "#min_excl_row" ).show(); |
||
580 | } else { |
||
581 | jQuery(".css_aggregate:visible").fadeTo("fast",.33); |
||
582 | if ( jQuery( "#autoptimize_js_aggregate" ).prop('checked') == false ) { |
||
583 | jQuery( "#min_excl_row" ).hide(); |
||
584 | } |
||
585 | } |
||
586 | }); |
||
587 | |||
588 | jQuery( "#autoptimize_css_inline" ).change(function() { |
||
589 | if (this.checked) { |
||
590 | jQuery("#autoptimize_css_defer").prop("checked",false); |
||
591 | jQuery("#autoptimize_css_defer_inline").hide("slow"); |
||
592 | } |
||
593 | }); |
||
594 | |||
595 | jQuery( "#autoptimize_css_defer" ).change(function() { |
||
596 | if (this.checked) { |
||
597 | jQuery("#autoptimize_css_inline").prop("checked",false); |
||
598 | jQuery("#autoptimize_css_defer_inline").show("slow"); |
||
599 | } else { |
||
600 | jQuery("#autoptimize_css_defer_inline").hide("slow"); |
||
601 | } |
||
602 | }); |
||
603 | |||
604 | jQuery("#feed_dropdown").change(function() { show_feed(jQuery("#feed_dropdown").val()) }); |
||
605 | feedid=jQuery.cookie(cookiename); |
||
606 | if(typeof(feedid) !== "string") feedid=1; |
||
607 | show_feed(feedid); |
||
608 | }) |
||
609 | |||
610 | // validate cdn_url. |
||
611 | var cdn_url=document.getElementById("cdn_url"); |
||
612 | cdn_url_baseCSS=cdn_url.style.cssText; |
||
613 | if ("validity" in cdn_url) { |
||
614 | jQuery("#cdn_url").focusout(function (event) { |
||
615 | if (cdn_url.validity.valid) { |
||
616 | cdn_url.style.cssText=cdn_url_baseCSS; |
||
617 | } else { |
||
618 | cdn_url.style.cssText=cdn_url_baseCSS+"border:1px solid #f00;color:#f00;box-shadow: 0 0 2px #f00;"; |
||
619 | }}); |
||
620 | } |
||
621 | |||
622 | function check_ini_state() { |
||
623 | if (!jQuery("#autoptimize_css_defer").attr('checked')) { |
||
624 | jQuery("#autoptimize_css_defer_inline").hide(); |
||
625 | } |
||
626 | if (!jQuery("#autoptimize_html").attr('checked')) { |
||
627 | jQuery(".html_sub:visible").fadeTo('fast',.33); |
||
628 | } |
||
629 | if (!jQuery("#autoptimize_css").attr('checked')) { |
||
630 | jQuery(".css_sub:visible").fadeTo('fast',.33); |
||
631 | } |
||
632 | if (!jQuery("#autoptimize_css_aggregate").attr('checked')) { |
||
633 | jQuery(".css_aggregate:visible").fadeTo('fast',.33); |
||
634 | } |
||
635 | if (!jQuery("#autoptimize_js").attr('checked')) { |
||
636 | jQuery(".js_sub:visible").fadeTo('fast',.33); |
||
637 | } |
||
638 | if (!jQuery("#autoptimize_js_aggregate").attr('checked')) { |
||
639 | jQuery(".js_aggregate:visible").fadeTo('fast',.33); |
||
640 | } |
||
641 | } |
||
642 | |||
643 | function show_feed(id) { |
||
644 | jQuery('#futtta_feed').children().hide(); |
||
645 | jQuery('#'+feed[id]).show(); |
||
646 | jQuery("#feed_dropdown").val(id); |
||
647 | jQuery.cookie(cookiename,id,{ expires: 365 }); |
||
648 | } |
||
649 | </script> |
||
650 | </div> |
||
651 | |||
652 | <?php |
||
653 | } |
||
654 | |||
935 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.