Version Description
- Following requests from users, added back the option of excluding javascript elements.
Download this release
Release Info
Developer | ShortPixel |
Plugin | Speed Booster Pack |
Version | 3.1 |
Comparing to | |
See all releases |
Code changes from version 3.0 to 3.1
- css/style.dev.css +12 -1
- img/sp.png +0 -0
- inc/core.php +170 -1
- inc/settings.php +94 -1
- inc/template/notice.php +17 -0
- inc/template/options.php +153 -10
- js/jquery.sonar.js +421 -0
- nbproject/private/private.properties +6 -0
- nbproject/project.properties +7 -0
- nbproject/project.xml +9 -0
- readme.txt +42 -35
- speed-booster-pack.php +49 -6
css/style.dev.css
CHANGED
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.wrap .sb-pack .welcome-panel .welcome-panel-column:first-child {
|
2 |
display: block !important;
|
3 |
}
|
@@ -571,4 +582,4 @@
|
|
571 |
.wrap .sb-pack input.regular-text {
|
572 |
width: 45em;
|
573 |
}
|
574 |
-
}
|
1 |
+
h3.sbp-emphasize {
|
2 |
+
color: #FA5148;
|
3 |
+
}
|
4 |
+
img.sbp-sp {
|
5 |
+
float: left;
|
6 |
+
margin-right: 20px;
|
7 |
+
}
|
8 |
+
p.description-link {
|
9 |
+
margin-top: -5px;
|
10 |
+
}
|
11 |
+
|
12 |
.wrap .sb-pack .welcome-panel .welcome-panel-column:first-child {
|
13 |
display: block !important;
|
14 |
}
|
582 |
.wrap .sb-pack input.regular-text {
|
583 |
width: 45em;
|
584 |
}
|
585 |
+
}
|
img/sp.png
ADDED
Binary file
|
inc/core.php
CHANGED
@@ -13,6 +13,11 @@ if( !class_exists( 'Speed_Booster_Pack_Core' ) ) {
|
|
13 |
global $sbp_options;
|
14 |
add_action( 'wp_enqueue_scripts', array( $this, 'sbp_no_more_fontawesome'), 9999 );
|
15 |
add_action( 'wp_enqueue_scripts', array( $this, 'sbp_move_scripts_to_footer' ) );
|
|
|
|
|
|
|
|
|
|
|
16 |
add_action( 'wp_footer', array( $this, 'sbp_show_page_load_stats' ), 999 );
|
17 |
add_action( 'after_setup_theme', array( $this, 'sbp_junk_header_tags' ) );
|
18 |
add_action( 'init', array( $this, 'sbp_init') );
|
@@ -28,6 +33,11 @@ if( !class_exists( 'Speed_Booster_Pack_Core' ) ) {
|
|
28 |
$this->sbp_use_google_libraries();
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
// Defer parsing of JavaScript
|
32 |
if ( !is_admin() and isset( $sbp_options['defer_parsing'] ) ) {
|
33 |
add_filter( 'clean_url', array( $this, 'sbp_defer_parsing_of_js' ), 11, 1 );
|
@@ -215,6 +225,115 @@ function sbp_move_scripts_to_footer() {
|
|
215 |
} // END function sbp_move_scripts_to_footer
|
216 |
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
/*--------------------------------------------------------------------------------------------------------
|
220 |
Show Number of Queries and Page Load Time
|
@@ -244,6 +363,17 @@ function sbp_use_google_libraries() {
|
|
244 |
} // End function sbp_use_google_libraries()
|
245 |
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
/*--------------------------------------------------------------------------------------------------------
|
248 |
CSS Optimizer
|
249 |
---------------------------------------------------------------------------------------------------------*/
|
@@ -256,16 +386,49 @@ function sbp_css_optimizer() {
|
|
256 |
|
257 |
|
258 |
/*--------------------------------------------------------------------------------------------------------
|
259 |
-
Defer parsing of JavaScript
|
260 |
---------------------------------------------------------------------------------------------------------*/
|
261 |
|
262 |
function sbp_defer_parsing_of_js ( $url ) {
|
263 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
if ( FALSE === strpos( $url, '.js' ) ) {
|
265 |
return $url;
|
266 |
}
|
267 |
|
268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
return "$url' defer='defer";
|
270 |
|
271 |
} // END function sbp_defer_parsing_of_js
|
@@ -349,6 +512,12 @@ public function sbp_junk_header_tags() {
|
|
349 |
remove_action('wp_head', 'wp_generator');
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
} // END public function sbp_junk_header_tags
|
353 |
|
354 |
} // END class Speed_Booster_Pack_Core
|
13 |
global $sbp_options;
|
14 |
add_action( 'wp_enqueue_scripts', array( $this, 'sbp_no_more_fontawesome'), 9999 );
|
15 |
add_action( 'wp_enqueue_scripts', array( $this, 'sbp_move_scripts_to_footer' ) );
|
16 |
+
if ( !is_admin() and isset( $sbp_options['jquery_to_footer'] ) ) {
|
17 |
+
add_action( 'wp_head', array( $this, 'sbp_scripts_to_head' ) );
|
18 |
+
add_action( 'wp_print_scripts', array( $this, 'sbp_exclude_scripts' ), 100 );
|
19 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'sbp_exclude_scripts' ), 100 );
|
20 |
+
}
|
21 |
add_action( 'wp_footer', array( $this, 'sbp_show_page_load_stats' ), 999 );
|
22 |
add_action( 'after_setup_theme', array( $this, 'sbp_junk_header_tags' ) );
|
23 |
add_action( 'init', array( $this, 'sbp_init') );
|
33 |
$this->sbp_use_google_libraries();
|
34 |
}
|
35 |
|
36 |
+
// Use Google Libraries
|
37 |
+
//if ( !is_admin() and isset( $sbp_options['lazy_load'] ) ) {
|
38 |
+
// $this->sbp_lazy_load_for_images();
|
39 |
+
//}
|
40 |
+
|
41 |
// Defer parsing of JavaScript
|
42 |
if ( !is_admin() and isset( $sbp_options['defer_parsing'] ) ) {
|
43 |
add_filter( 'clean_url', array( $this, 'sbp_defer_parsing_of_js' ), 11, 1 );
|
225 |
} // END function sbp_move_scripts_to_footer
|
226 |
|
227 |
|
228 |
+
/*--------------------------------------------------------------------------------------------------------
|
229 |
+
Exclude scripts from "Move scripts to footer" option
|
230 |
+
---------------------------------------------------------------------------------------------------------*/
|
231 |
+
|
232 |
+
public function sbp_exclude_scripts() {
|
233 |
+
|
234 |
+
|
235 |
+
if ( get_option( 'sbp_js_footer_exceptions1' ) ) {
|
236 |
+
$sbp_handle1 = esc_html( get_option( 'sbp_js_footer_exceptions1' ) );
|
237 |
+
}
|
238 |
+
|
239 |
+
if ( get_option( 'sbp_js_footer_exceptions2' ) ) {
|
240 |
+
$sbp_handle2 = esc_html( get_option( 'sbp_js_footer_exceptions2' ) );
|
241 |
+
}
|
242 |
+
|
243 |
+
if ( get_option( 'sbp_js_footer_exceptions3' ) ) {
|
244 |
+
$sbp_handle3 = esc_html( get_option( 'sbp_js_footer_exceptions3' ) );
|
245 |
+
}
|
246 |
+
|
247 |
+
if ( get_option( 'sbp_js_footer_exceptions4' ) ) {
|
248 |
+
$sbp_handle4 = esc_html( get_option( 'sbp_js_footer_exceptions4' ) );
|
249 |
+
}
|
250 |
+
|
251 |
+
$sbp_enq = 'enqueued';
|
252 |
+
$sbp_reg = 'registered';
|
253 |
+
$sbp_done = 'done';
|
254 |
+
|
255 |
+
/*--------------------------------------------------------------------------------------------------------*/
|
256 |
+
|
257 |
+
if ( get_option( 'sbp_js_footer_exceptions1' ) and wp_script_is( $sbp_handle1 , $sbp_enq ) ) {
|
258 |
+
wp_dequeue_script( $sbp_handle1 );
|
259 |
+
}
|
260 |
+
|
261 |
+
if ( get_option( 'sbp_js_footer_exceptions2' ) and wp_script_is( $sbp_handle2 , $sbp_enq ) ) {
|
262 |
+
wp_dequeue_script( $sbp_handle2 );
|
263 |
+
}
|
264 |
+
|
265 |
+
if ( get_option( 'sbp_js_footer_exceptions3' ) and wp_script_is( $sbp_handle3 , $sbp_enq ) ) {
|
266 |
+
wp_dequeue_script( $sbp_handle3 );
|
267 |
+
}
|
268 |
+
|
269 |
+
if ( get_option( 'sbp_js_footer_exceptions4' ) and wp_script_is( $sbp_handle4 , $sbp_enq ) ) {
|
270 |
+
wp_dequeue_script( $sbp_handle4 );
|
271 |
+
}
|
272 |
+
|
273 |
+
/*--------------------------------------------------------------------------------------------------------*/
|
274 |
+
|
275 |
+
if ( get_option( 'sbp_js_footer_exceptions1' ) and wp_script_is( $sbp_handle1 , $sbp_reg ) ) {
|
276 |
+
wp_deregister_script( $sbp_handle1 );
|
277 |
+
}
|
278 |
+
|
279 |
+
if ( get_option( 'sbp_js_footer_exceptions2' ) and wp_script_is( $sbp_handle2 , $sbp_reg ) ) {
|
280 |
+
wp_deregister_script( $sbp_handle2 );
|
281 |
+
}
|
282 |
+
|
283 |
+
if ( get_option( 'sbp_js_footer_exceptions3' ) and wp_script_is( $sbp_handle3 , $sbp_reg ) ) {
|
284 |
+
wp_deregister_script( $sbp_handle3 );
|
285 |
+
}
|
286 |
+
|
287 |
+
if ( get_option( 'sbp_js_footer_exceptions4' ) and wp_script_is( $sbp_handle4 , $sbp_reg ) ) {
|
288 |
+
wp_deregister_script( $sbp_handle4 );
|
289 |
+
}
|
290 |
+
|
291 |
+
/*--------------------------------------------------------------------------------------------------------*/
|
292 |
+
|
293 |
+
if ( get_option( 'sbp_js_footer_exceptions1' ) and wp_script_is( $sbp_handle1 , $sbp_done ) ) {
|
294 |
+
wp_deregister_script( $sbp_handle1 );
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( get_option( 'sbp_js_footer_exceptions2' ) and wp_script_is( $sbp_handle2 , $sbp_done ) ) {
|
298 |
+
wp_deregister_script( $sbp_handle2 );
|
299 |
+
}
|
300 |
+
|
301 |
+
if ( get_option( 'sbp_js_footer_exceptions3' ) and wp_script_is( $sbp_handle3 , $sbp_done ) ) {
|
302 |
+
wp_deregister_script( $sbp_handle3 );
|
303 |
+
}
|
304 |
+
|
305 |
+
if ( get_option( 'sbp_js_footer_exceptions4' ) and wp_script_is( $sbp_handle4 , $sbp_done ) ) {
|
306 |
+
wp_deregister_script( $sbp_handle4 );
|
307 |
+
}
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
+
/*--------------------------------------------------------------------------------------------------------
|
313 |
+
Put scripts back to the head
|
314 |
+
---------------------------------------------------------------------------------------------------------*/
|
315 |
+
|
316 |
+
public function sbp_scripts_to_head() {
|
317 |
+
|
318 |
+
if ( get_option( 'sbp_head_html_script1' ) ) {
|
319 |
+
echo get_option( 'sbp_head_html_script1' ) . "\n";
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( get_option( 'sbp_head_html_script2' ) ) {
|
324 |
+
echo get_option( 'sbp_head_html_script2' ) . "\n";
|
325 |
+
}
|
326 |
+
|
327 |
+
if ( get_option( 'sbp_head_html_script3' ) ) {
|
328 |
+
echo get_option( 'sbp_head_html_script3' ) . "\n";
|
329 |
+
}
|
330 |
+
|
331 |
+
if ( get_option( 'sbp_head_html_script4' ) ) {
|
332 |
+
echo get_option( 'sbp_head_html_script4' ) . "\n";
|
333 |
+
}
|
334 |
+
|
335 |
+
}
|
336 |
+
|
337 |
|
338 |
/*--------------------------------------------------------------------------------------------------------
|
339 |
Show Number of Queries and Page Load Time
|
363 |
} // End function sbp_use_google_libraries()
|
364 |
|
365 |
|
366 |
+
/*--------------------------------------------------------------------------------------------------------
|
367 |
+
Lazy Load for images - deleted as of 3.1 (present in 2.9
|
368 |
+
---------------------------------------------------------------------------------------------------------
|
369 |
+
|
370 |
+
function sbp_lazy_load_for_images() {
|
371 |
+
|
372 |
+
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/lazy-load.php' );
|
373 |
+
|
374 |
+
} // End function sbp_lazy_load_for_images()
|
375 |
+
*/
|
376 |
+
|
377 |
/*--------------------------------------------------------------------------------------------------------
|
378 |
CSS Optimizer
|
379 |
---------------------------------------------------------------------------------------------------------*/
|
386 |
|
387 |
|
388 |
/*--------------------------------------------------------------------------------------------------------
|
389 |
+
Defer parsing of JavaScript and exclusion files
|
390 |
---------------------------------------------------------------------------------------------------------*/
|
391 |
|
392 |
function sbp_defer_parsing_of_js ( $url ) {
|
393 |
|
394 |
+
if ( get_option( 'sbp_defer_exceptions1' ) ) {
|
395 |
+
$defer_exclude1 = get_option( 'sbp_defer_exceptions1' );
|
396 |
+
}
|
397 |
+
|
398 |
+
if ( get_option( 'sbp_defer_exceptions2' ) ) {
|
399 |
+
$defer_exclude2 = get_option( 'sbp_defer_exceptions2' );
|
400 |
+
}
|
401 |
+
|
402 |
+
if ( get_option( 'sbp_defer_exceptions3' ) ) {
|
403 |
+
$defer_exclude3 = get_option( 'sbp_defer_exceptions3' );
|
404 |
+
}
|
405 |
+
|
406 |
+
if ( get_option( 'sbp_defer_exceptions4' ) ) {
|
407 |
+
$defer_exclude4 = get_option( 'sbp_defer_exceptions4' );
|
408 |
+
}
|
409 |
+
|
410 |
+
|
411 |
if ( FALSE === strpos( $url, '.js' ) ) {
|
412 |
return $url;
|
413 |
}
|
414 |
|
415 |
|
416 |
+
if ( get_option( 'sbp_defer_exceptions1' ) and strpos( $url, $defer_exclude1 ) ) {
|
417 |
+
return $url;
|
418 |
+
}
|
419 |
+
|
420 |
+
if ( get_option( 'sbp_defer_exceptions2' ) and strpos( $url, $defer_exclude2 ) ) {
|
421 |
+
return $url;
|
422 |
+
}
|
423 |
+
|
424 |
+
if ( get_option( 'sbp_defer_exceptions3' ) and strpos( $url, $defer_exclude3 ) ) {
|
425 |
+
return $url;
|
426 |
+
}
|
427 |
+
|
428 |
+
if ( get_option( 'sbp_defer_exceptions4' ) and strpos( $url, $defer_exclude4 ) ) {
|
429 |
+
return $url;
|
430 |
+
}
|
431 |
+
|
432 |
return "$url' defer='defer";
|
433 |
|
434 |
} // END function sbp_defer_parsing_of_js
|
512 |
remove_action('wp_head', 'wp_generator');
|
513 |
}
|
514 |
|
515 |
+
// Remove all feeds
|
516 |
+
if ( isset( $sbp_options['remove_all_feeds'] ) ) {
|
517 |
+
remove_action( 'wp_head', 'feed_links_extra', 3 ); // remove the feed links from the extra feeds such as category feeds
|
518 |
+
remove_action( 'wp_head', 'feed_links', 2 ); // remove the feed links from the general feeds: Post and Comment Feed
|
519 |
+
}
|
520 |
+
|
521 |
} // END public function sbp_junk_header_tags
|
522 |
|
523 |
} // END class Speed_Booster_Pack_Core
|
inc/settings.php
CHANGED
@@ -27,6 +27,21 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
27 |
register_setting( 'speed_booster_settings_group', 'sbp_css_exceptions' );
|
28 |
register_setting( 'speed_booster_settings_group', 'sbp_sanitize');
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
} // END public function admin_init
|
31 |
|
32 |
|
@@ -205,6 +220,7 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
205 |
} else {
|
206 |
$this->image_compression = 90;
|
207 |
}
|
|
|
208 |
|
209 |
// fallback for stylesheets exception handle
|
210 |
if ( get_option( 'sbp_css_exceptions' ) ) {
|
@@ -213,6 +229,83 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
213 |
$css_exceptions = '' ;
|
214 |
}
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
/*--------------------------------------------------------------------------------------------------------*/
|
218 |
|
@@ -228,4 +321,4 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
228 |
|
229 |
} // END class Speed_Booster_Pack_Options
|
230 |
|
231 |
-
} // END if(!class_exists('Speed_Booster_Pack_Options'))
|
27 |
register_setting( 'speed_booster_settings_group', 'sbp_css_exceptions' );
|
28 |
register_setting( 'speed_booster_settings_group', 'sbp_sanitize');
|
29 |
|
30 |
+
register_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions1' );
|
31 |
+
register_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions2' );
|
32 |
+
register_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions3' );
|
33 |
+
register_setting( 'speed_booster_settings_group', 'sbp_js_footer_exceptions4' );
|
34 |
+
|
35 |
+
register_setting( 'speed_booster_settings_group', 'sbp_head_html_script1' );
|
36 |
+
register_setting( 'speed_booster_settings_group', 'sbp_head_html_script2' );
|
37 |
+
register_setting( 'speed_booster_settings_group', 'sbp_head_html_script3' );
|
38 |
+
register_setting( 'speed_booster_settings_group', 'sbp_head_html_script4' );
|
39 |
+
|
40 |
+
register_setting( 'speed_booster_settings_group', 'sbp_defer_exceptions1' );
|
41 |
+
register_setting( 'speed_booster_settings_group', 'sbp_defer_exceptions2' );
|
42 |
+
register_setting( 'speed_booster_settings_group', 'sbp_defer_exceptions3' );
|
43 |
+
register_setting( 'speed_booster_settings_group', 'sbp_defer_exceptions4' );
|
44 |
+
|
45 |
} // END public function admin_init
|
46 |
|
47 |
|
220 |
} else {
|
221 |
$this->image_compression = 90;
|
222 |
}
|
223 |
+
$this->plugin_url = plugin_dir_url(dirname(__FILE__));
|
224 |
|
225 |
// fallback for stylesheets exception handle
|
226 |
if ( get_option( 'sbp_css_exceptions' ) ) {
|
229 |
$css_exceptions = '' ;
|
230 |
}
|
231 |
|
232 |
+
/*--------------------------------------------------------------------------------------------------------*/
|
233 |
+
|
234 |
+
if ( get_option( 'sbp_js_footer_exceptions1' ) ) {
|
235 |
+
$js_footer_exceptions1 = get_option( 'sbp_js_footer_exceptions1' );
|
236 |
+
} else {
|
237 |
+
$js_footer_exceptions1 = '' ;
|
238 |
+
}
|
239 |
+
|
240 |
+
if ( get_option( 'sbp_js_footer_exceptions2' ) ) {
|
241 |
+
$js_footer_exceptions2 = get_option( 'sbp_js_footer_exceptions2' );
|
242 |
+
} else {
|
243 |
+
$js_footer_exceptions2 = '' ;
|
244 |
+
}
|
245 |
+
|
246 |
+
if ( get_option( 'sbp_js_footer_exceptions3' ) ) {
|
247 |
+
$js_footer_exceptions3 = get_option( 'sbp_js_footer_exceptions3' );
|
248 |
+
} else {
|
249 |
+
$js_footer_exceptions3 = '' ;
|
250 |
+
}
|
251 |
+
|
252 |
+
if ( get_option( 'sbp_js_footer_exceptions4' ) ) {
|
253 |
+
$js_footer_exceptions4 = get_option( 'sbp_js_footer_exceptions4' );
|
254 |
+
} else {
|
255 |
+
$js_footer_exceptions4 = '' ;
|
256 |
+
}
|
257 |
+
|
258 |
+
/*--------------------------------------------------------------------------------------------------------*/
|
259 |
+
|
260 |
+
if ( get_option( 'sbp_head_html_script1' ) ) {
|
261 |
+
$sbp_html_script1 = get_option( 'sbp_head_html_script1' );
|
262 |
+
} else {
|
263 |
+
$sbp_html_script1 = '' ;
|
264 |
+
}
|
265 |
+
|
266 |
+
if ( get_option( 'sbp_head_html_script2' ) ) {
|
267 |
+
$sbp_html_script2 = get_option( 'sbp_head_html_script2' );
|
268 |
+
} else {
|
269 |
+
$sbp_html_script2 = '' ;
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( get_option( 'sbp_head_html_script3' ) ) {
|
273 |
+
$sbp_html_script3 = get_option( 'sbp_head_html_script3' );
|
274 |
+
} else {
|
275 |
+
$sbp_html_script3 = '' ;
|
276 |
+
}
|
277 |
+
|
278 |
+
if ( get_option( 'sbp_head_html_script4' ) ) {
|
279 |
+
$sbp_html_script4 = get_option( 'sbp_head_html_script4' );
|
280 |
+
} else {
|
281 |
+
$sbp_html_script4 = '' ;
|
282 |
+
}
|
283 |
+
|
284 |
+
/*--------------------------------------------------------------------------------------------------------*/
|
285 |
+
|
286 |
+
if ( get_option( 'sbp_defer_exceptions1' ) ) {
|
287 |
+
$defer_exceptions1 = get_option( 'sbp_defer_exceptions1' );
|
288 |
+
} else {
|
289 |
+
$defer_exceptions1 = '' ;
|
290 |
+
}
|
291 |
+
|
292 |
+
if ( get_option( 'sbp_defer_exceptions2' ) ) {
|
293 |
+
$defer_exceptions2 = get_option( 'sbp_defer_exceptions2' );
|
294 |
+
} else {
|
295 |
+
$defer_exceptions2 = '' ;
|
296 |
+
}
|
297 |
+
|
298 |
+
if ( get_option( 'sbp_defer_exceptions3' ) ) {
|
299 |
+
$defer_exceptions3 = get_option( 'sbp_defer_exceptions3' );
|
300 |
+
} else {
|
301 |
+
$defer_exceptions3 = '' ;
|
302 |
+
}
|
303 |
+
|
304 |
+
if ( get_option( 'sbp_defer_exceptions4' ) ) {
|
305 |
+
$defer_exceptions4 = get_option( 'sbp_defer_exceptions4' );
|
306 |
+
} else {
|
307 |
+
$defer_exceptions4 = '' ;
|
308 |
+
}
|
309 |
|
310 |
/*--------------------------------------------------------------------------------------------------------*/
|
311 |
|
321 |
|
322 |
} // END class Speed_Booster_Pack_Options
|
323 |
|
324 |
+
} // END if(!class_exists('Speed_Booster_Pack_Options'))
|
inc/template/notice.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class='notice notice-warning' id='sbp-news' style="padding-top: 7px">
|
2 |
+
<div style="float:right;"><a href="javascript:dismissNews()" class="button" style="margin-top:10px;"><?php _e('Dismiss','sb-pack');?></a></div>
|
3 |
+
<strong><?php _e('Speed Booster Pack','sb-pack');?></strong>
|
4 |
+
<p><?php printf(__('Check out the %s Plugin settings %s for new features that can make your site load faster.','sb-pack'), '<a href="options-general.php?page=sbp-options">', '</a>');?></p>
|
5 |
+
</div>
|
6 |
+
<script>
|
7 |
+
function dismissNews() {
|
8 |
+
jQuery("#sbp-news").hide();
|
9 |
+
var data = { action : 'sbp_dismiss_notices'};
|
10 |
+
jQuery.get('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response) {
|
11 |
+
data = JSON.parse(response);
|
12 |
+
if(data["Status"] == 0) {
|
13 |
+
console.log("dismissed");
|
14 |
+
}
|
15 |
+
});
|
16 |
+
}
|
17 |
+
</script>
|
inc/template/options.php
CHANGED
@@ -50,6 +50,17 @@
|
|
50 |
<label for="sbp_settings[query_strings]"><?php _e( 'Remove query strings', 'sb-pack' ); ?></label>
|
51 |
</p>
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
<p>
|
54 |
<input id="sbp_settings[font_awesome]" name="sbp_settings[font_awesome]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['font_awesome'] ) ); ?> />
|
55 |
<label for="sbp_settings[font_awesome]"><?php _e( 'Removes extra Font Awesome styles', 'sb-pack' ); ?></label>
|
@@ -77,13 +88,13 @@
|
|
77 |
</p>
|
78 |
|
79 |
<p>
|
80 |
-
<input id="sbp_settings[
|
81 |
-
<label for="sbp_settings[
|
82 |
</p>
|
83 |
|
84 |
<p>
|
85 |
-
<input id="sbp_settings[
|
86 |
-
<label for="sbp_settings[
|
87 |
</p>
|
88 |
|
89 |
</div> <!-- END welcome-panel-column -->
|
@@ -129,9 +140,130 @@
|
|
129 |
</div>
|
130 |
</div>
|
131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
<div style="display: block;" class="postbox closed" id="tiguan4">
|
134 |
-
<div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><?php _e( 'Change the default image compression level', 'sb-pack' ); ?></h3>
|
135 |
<div class="inside">
|
136 |
|
137 |
|
@@ -152,12 +284,22 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
152 |
</p>
|
153 |
|
154 |
<p class="description">
|
155 |
-
<?php _e( 'The default image compression setting in WordPress is 90%. Compressing your images further than the default will make your file sizes even smaller and will boost your site performance.', 'sb-pack' ); ?><br />
|
156 |
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
<p class="description">
|
158 |
-
<?php _e( '
|
|
|
|
|
|
|
159 |
</p>
|
160 |
-
|
161 |
</div>
|
162 |
|
163 |
</div>
|
@@ -194,7 +336,6 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
194 |
<label for="sbp_settings[sbp_is_mobile]"><?php _e( 'Disable all above CSS options on mobile devices', 'sb-pack' ); ?></label>
|
195 |
</p>
|
196 |
|
197 |
-
|
198 |
<div class="td-border-last"></div>
|
199 |
|
200 |
<h4><?php _e( 'Exclude styles from asynchronously option: ', 'sb-pack' ); ?></h4>
|
@@ -228,6 +369,8 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
228 |
<?php _e('*The list may be incomplete in some circumstances.', 'sb-pack' ); ?>
|
229 |
</p>
|
230 |
|
|
|
|
|
231 |
<div class="td-border-last"></div>
|
232 |
<h4 class="sbp-icon-information"><?php _e( 'Additional information:', 'sb-pack' ); ?></h4>
|
233 |
<p class ="description"><strong><?php _e( 'Insert all CSS styles inline to the footer: ', 'sb-pack' ); ?></strong><?php _e( 'this option will eliminate render-blocking CSS warning in Google Page Speed test. If there is something broken after activation, you need to disable this option. Please note that before enabling this sensitive option, it is strongly recommended that you also enable the "Move scripts to the footer" option.', 'sb-pack' ); ?></p>
|
@@ -299,4 +442,4 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
299 |
</div>
|
300 |
</div> <!-- END sb-pack-->
|
301 |
|
302 |
-
</div> <!-- end wrap div -->
|
50 |
<label for="sbp_settings[query_strings]"><?php _e( 'Remove query strings', 'sb-pack' ); ?></label>
|
51 |
</p>
|
52 |
|
53 |
+
<!-- <p>
|
54 |
+
<input id="sbp_settings[lazy_load]" name="sbp_settings[lazy_load]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['lazy_load'] ) ); ?> />
|
55 |
+
<label for="sbp_settings[lazy_load]"><?php _e( 'Lazy load images to improve speed', 'sb-pack' ); ?></label>
|
56 |
+
</p>
|
57 |
+
-->
|
58 |
+
|
59 |
+
<p>
|
60 |
+
<input id="sbp_settings[wml_link]" name="sbp_settings[wml_link]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['wml_link'] ) ); ?> />
|
61 |
+
<label for="sbp_settings[wml_link]"><?php _e( 'Remove Windows Manifest', 'sb-pack' ); ?></label>
|
62 |
+
</p>
|
63 |
+
|
64 |
<p>
|
65 |
<input id="sbp_settings[font_awesome]" name="sbp_settings[font_awesome]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['font_awesome'] ) ); ?> />
|
66 |
<label for="sbp_settings[font_awesome]"><?php _e( 'Removes extra Font Awesome styles', 'sb-pack' ); ?></label>
|
88 |
</p>
|
89 |
|
90 |
<p>
|
91 |
+
<input id="sbp_settings[wp_generator]" name="sbp_settings[wp_generator]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['wp_generator'] ) ); ?> />
|
92 |
+
<label for="sbp_settings[wp_generator]"><?php _e( 'Remove the WordPress Version', 'sb-pack' ); ?></label>
|
93 |
</p>
|
94 |
|
95 |
<p>
|
96 |
+
<input id="sbp_settings[remove_all_feeds]" name="sbp_settings[remove_all_feeds]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['remove_all_feeds'] ) ); ?> />
|
97 |
+
<label for="sbp_settings[remove_all_feeds]"><?php _e( 'Remove all rss feed links', 'sb-pack' ); ?></label>
|
98 |
</p>
|
99 |
|
100 |
</div> <!-- END welcome-panel-column -->
|
140 |
</div>
|
141 |
</div>
|
142 |
|
143 |
+
<div style="display: block;" class="postbox closed" id="tiguan2">
|
144 |
+
<div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><?php _e( 'Exclude scripts from being moved to the footer', 'sb-pack' ); ?></h3>
|
145 |
+
<div class="inside">
|
146 |
+
|
147 |
+
<div class="sbp-inline-wrap">
|
148 |
+
<div class="sbp-columns1">
|
149 |
+
|
150 |
+
<h4><?php _e( 'Script Handle', 'sb-pack' ); ?></h4>
|
151 |
+
|
152 |
+
<p>
|
153 |
+
<input type="text" name="sbp_js_footer_exceptions1" id="sbp_js_footer_exceptions1" value="<?php echo $js_footer_exceptions1; ?>" />
|
154 |
+
</p>
|
155 |
+
|
156 |
+
<p>
|
157 |
+
<input type="text" name="sbp_js_footer_exceptions2" id="sbp_js_footer_exceptions2" value="<?php echo $js_footer_exceptions2; ?>" />
|
158 |
+
</p>
|
159 |
+
|
160 |
+
<p>
|
161 |
+
<input type="text" name="sbp_js_footer_exceptions3" id="sbp_js_footer_exceptions3" value="<?php echo $js_footer_exceptions3; ?>" />
|
162 |
+
</p>
|
163 |
+
|
164 |
+
<p>
|
165 |
+
<input type="text" name="sbp_js_footer_exceptions4" id="sbp_js_footer_exceptions4" value="<?php echo $js_footer_exceptions4; ?>" />
|
166 |
+
</p>
|
167 |
+
|
168 |
+
|
169 |
+
</div>
|
170 |
+
|
171 |
+
<div class="sbp-columns2">
|
172 |
+
|
173 |
+
<h4><?php _e( 'Copy the HTML code of the script from your page source and add it below', 'sb-pack' ); ?></h4>
|
174 |
+
|
175 |
+
|
176 |
+
<p>
|
177 |
+
<input type="text" name="sbp_head_html_script1" id="sbp_head_html_script1" class="regular-text" value="<?php echo $sbp_html_script1; ?>" />
|
178 |
+
</p>
|
179 |
+
|
180 |
+
<p>
|
181 |
+
<input type="text" name="sbp_head_html_script2" id="sbp_head_html_script2" class="regular-text" value="<?php echo $sbp_html_script2; ?>" />
|
182 |
+
</p>
|
183 |
+
|
184 |
+
<p>
|
185 |
+
<input type="text" name="sbp_head_html_script3" id="sbp_head_html_script3" class="regular-text" value="<?php echo $sbp_html_script3; ?>" />
|
186 |
+
</p>
|
187 |
+
|
188 |
+
<p>
|
189 |
+
<input type="text" name="sbp_head_html_script4" id="sbp_head_html_script4" class="regular-text" value="<?php echo $sbp_html_script4; ?>" />
|
190 |
+
</p>
|
191 |
+
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
|
195 |
+
<p class="description">
|
196 |
+
<?php _e('Enter one js handle per text field, in the left area and the correspondent html script in the right text fields.', 'sb-pack' ); ?> <?php _e( 'Read more', 'sb-pack' ); ?> <a href="http://tiguandesign.com/docs/speed-booster/#exclude-scripts-from-being-moved-to-the-footer-50" target="_blank" title="Documentation"><?php _e( 'detailed instructions', 'sb-pack' ); ?></a> <?php _e( 'on this option on plugin documentation.', 'sb-pack' ); ?> <br /> <?php _e( 'If you want to exclude more than 4 scripts, your page score will be hit and therefore the use of "Move scripts to footer" option will become useless so you can disable it.', 'sb-pack' ); ?>
|
197 |
+
</p>
|
198 |
+
<div class="td-border-last"></div>
|
199 |
+
|
200 |
+
<p>
|
201 |
+
<h4 class="hndle"><?php _e( 'As a guidance, here is a list of script handles and script paths of each enqueued script detected by our plugin:', 'sb-pack' ); ?></h4>
|
202 |
+
</p>
|
203 |
+
|
204 |
+
<div class="sbp-all-enqueued">
|
205 |
+
|
206 |
+
<div class="sbp-div-head">
|
207 |
+
<div class="sbp-title-scripts"><?php _e('Script Handle', 'sb-pack' ); ?></div>
|
208 |
+
<div class="sbp-title-scripts"><?php _e('Script Path', 'sb-pack' ); ?></div>
|
209 |
+
</div>
|
210 |
+
|
211 |
+
<div class="sbp-inline-wrap">
|
212 |
+
|
213 |
+
<div class="sbp-columns1 sbp-width">
|
214 |
+
<?php echo get_option( 'all_theme_scripts_handle' ) ; ?>
|
215 |
+
</div>
|
216 |
+
|
217 |
+
<div class="sbp-columns2 sbp-width">
|
218 |
+
<?php echo get_option( 'all_theme_scripts_src' ) ; ?>
|
219 |
+
</div>
|
220 |
+
|
221 |
+
|
222 |
+
</div>
|
223 |
+
|
224 |
+
</div>
|
225 |
+
<p class="description">
|
226 |
+
<?php _e('*The list may be incomplete in some circumstances.', 'sb-pack' ); ?>
|
227 |
+
</p>
|
228 |
+
</div>
|
229 |
+
</div>
|
230 |
+
|
231 |
+
|
232 |
+
|
233 |
+
<div style="display: block;" class="postbox closed" id="tiguan3">
|
234 |
+
<div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><?php _e( 'Exclude scripts from being deferred', 'sb-pack' ); ?></h3>
|
235 |
+
<div class="inside">
|
236 |
+
|
237 |
+
<div class="sbp-inline-wrap">
|
238 |
+
|
239 |
+
<p>
|
240 |
+
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions1" id="sbp_defer_exceptions1" value="<?php echo $defer_exceptions1; ?>" />
|
241 |
+
</p>
|
242 |
+
|
243 |
+
<p>
|
244 |
+
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions2" id="sbp_defer_exceptions2" value="<?php echo $defer_exceptions2; ?>" />
|
245 |
+
</p>
|
246 |
+
|
247 |
+
<p>
|
248 |
+
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions3" id="sbp_defer_exceptions3" value="<?php echo $defer_exceptions3; ?>" />
|
249 |
+
</p>
|
250 |
+
|
251 |
+
<p>
|
252 |
+
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions4" id="sbp_defer_exceptions4" value="<?php echo $defer_exceptions4; ?>" />
|
253 |
+
</p>
|
254 |
+
|
255 |
+
|
256 |
+
</div>
|
257 |
+
<p class="description">
|
258 |
+
<?php _e('Enter one by text field, the final part of the js files that you want to be excluded from defer parsing option. For example: <code>jquery.min.js</code> If you want to exclude more than 4 scripts, your page score will be hit and therefore the use of "Defer parsing of javascript files" option will become useless so you can disable it', 'sb-pack' ); ?>
|
259 |
+
</p>
|
260 |
+
|
261 |
+
</div>
|
262 |
+
</div>
|
263 |
+
|
264 |
|
265 |
<div style="display: block;" class="postbox closed" id="tiguan4">
|
266 |
+
<div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle sbp-emphasize"><?php _e( 'Change the default image compression level', 'sb-pack' ); ?></h3>
|
267 |
<div class="inside">
|
268 |
|
269 |
|
284 |
</p>
|
285 |
|
286 |
<p class="description">
|
287 |
+
<?php _e( 'The default image compression setting in WordPress is 90%. Compressing your images further than the default will make your file sizes even smaller and will boost your site performance. As a reference, a lower level of compression means more performance but might induce quality loss. We recommend you choose a compression level between 50 and 75.', 'sb-pack' ); ?><br />
|
288 |
</p>
|
289 |
+
<p class="description"><strong>
|
290 |
+
<?php _e( 'Note that any changes you make will only affect new images uploaded to your site. A specialized plugin can optimize all your present images and will also optimize new ones as they are added. ', 'sb-pack' ); ?>
|
291 |
+
</strong></p>
|
292 |
+
<br>
|
293 |
+
<p class="description"><strong>
|
294 |
+
<?php _e( 'We recommend using ShortPixel Plugin to optimize your images.', 'sb-pack' ); ?>
|
295 |
+
</strong></p>
|
296 |
+
<a href="https://shortpixel.com/booster/af/KQD2XAB28044" target="_blank"><img src="<?php echo $this->plugin_url . "img/sp.png"; ?>" class="sbp-sp"/></a>
|
297 |
<p class="description">
|
298 |
+
<?php _e( 'ShortPixel is an easy to use, comprehensive, stable and frequently updated image optimization plugin supported by the friendly team that created it. Using a powerful set of specially tuned algorithms, it squeezes the most of each image striking the best balance between image size and quality. Current images can be all optimized with a single click. Newly added images are automatically resized/rescaled and optimized on the fly, in the background.', 'sb-pack' ); ?>
|
299 |
+
</p>
|
300 |
+
<p class="description-link">
|
301 |
+
<a href="https://shortpixel.com/booster/af/KQD2XAB28044" target="_blank">>> <?php _e( 'More info', 'sb-pack' ); ?></a>
|
302 |
</p>
|
|
|
303 |
</div>
|
304 |
|
305 |
</div>
|
336 |
<label for="sbp_settings[sbp_is_mobile]"><?php _e( 'Disable all above CSS options on mobile devices', 'sb-pack' ); ?></label>
|
337 |
</p>
|
338 |
|
|
|
339 |
<div class="td-border-last"></div>
|
340 |
|
341 |
<h4><?php _e( 'Exclude styles from asynchronously option: ', 'sb-pack' ); ?></h4>
|
369 |
<?php _e('*The list may be incomplete in some circumstances.', 'sb-pack' ); ?>
|
370 |
</p>
|
371 |
|
372 |
+
|
373 |
+
|
374 |
<div class="td-border-last"></div>
|
375 |
<h4 class="sbp-icon-information"><?php _e( 'Additional information:', 'sb-pack' ); ?></h4>
|
376 |
<p class ="description"><strong><?php _e( 'Insert all CSS styles inline to the footer: ', 'sb-pack' ); ?></strong><?php _e( 'this option will eliminate render-blocking CSS warning in Google Page Speed test. If there is something broken after activation, you need to disable this option. Please note that before enabling this sensitive option, it is strongly recommended that you also enable the "Move scripts to the footer" option.', 'sb-pack' ); ?></p>
|
442 |
</div>
|
443 |
</div> <!-- END sb-pack-->
|
444 |
|
445 |
+
</div> <!-- end wrap div -->
|
js/jquery.sonar.js
ADDED
@@ -0,0 +1,421 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
An elem for determining if an elem is within a certain
|
3 |
+
distance from the edge above or below the screen, and attaching
|
4 |
+
a function to execute once the elem is in view.
|
5 |
+
|
6 |
+
General Usage:
|
7 |
+
|
8 |
+
* Place the library anywhere in your JavaScript code before you
|
9 |
+
intend to call the function.
|
10 |
+
|
11 |
+
* To initialize Sonar with a different default distance, modify
|
12 |
+
the sonar = Sonar() line immediately following the Sonar
|
13 |
+
library definition. Example:
|
14 |
+
|
15 |
+
sonar=Sonar(100); // Initializes Sonar with a 100px default distance.
|
16 |
+
|
17 |
+
Note:
|
18 |
+
|
19 |
+
* The default distance is 0 pixels.
|
20 |
+
|
21 |
+
|
22 |
+
sonar.detect() Usage
|
23 |
+
|
24 |
+
* Use sonar.detect(elem, distance) to check if the
|
25 |
+
elem is within screen boundaries.
|
26 |
+
|
27 |
+
@elem - The elem you want to detect visibility.
|
28 |
+
@distance - The distance from the screen edge that should
|
29 |
+
count in the check. Uses default distance if not specified.
|
30 |
+
|
31 |
+
* Note: sonar.detect() adds a property to
|
32 |
+
ojbects called sonarElemTop. Test to ensure there
|
33 |
+
aren't any conflicts with your code. If there
|
34 |
+
are, rename sonarElemTop to something else in the code.
|
35 |
+
|
36 |
+
* sonar.detect() returns:
|
37 |
+
true if the elem is within the screen boundaries
|
38 |
+
false if th elem is out of the screen boundaries
|
39 |
+
|
40 |
+
Example:
|
41 |
+
|
42 |
+
Here's how to check if an advertisment is visible on a
|
43 |
+
page that has the id, "ad".
|
44 |
+
|
45 |
+
if (sonar.detect(document.getElementById("ad")))
|
46 |
+
{
|
47 |
+
alert('The ad is visible on screen!');
|
48 |
+
}
|
49 |
+
else
|
50 |
+
{
|
51 |
+
alert ('The ad is not on screen!);
|
52 |
+
}
|
53 |
+
|
54 |
+
sonar.add() Usage
|
55 |
+
|
56 |
+
* This method stores elems that are then polled
|
57 |
+
on user scroll by the Sonar.detect() method.
|
58 |
+
|
59 |
+
* Polling initializes once the sonar.add() method is passed
|
60 |
+
an elem with the following properties:
|
61 |
+
|
62 |
+
obj : A reference to the elem to observe until it is within
|
63 |
+
the specified distance (px).
|
64 |
+
|
65 |
+
id : An alternative to the obj parameter, an "id" can be used
|
66 |
+
to grab the elem to observe.
|
67 |
+
|
68 |
+
call: The function to call when the elem is within the
|
69 |
+
specified distance (px). The @elem argument will
|
70 |
+
include the elem that triggered the callback.
|
71 |
+
|
72 |
+
px : The specified distance to include as being visible on
|
73 |
+
screen. This property is optional (default is 0).
|
74 |
+
|
75 |
+
Example:
|
76 |
+
|
77 |
+
sonar.add(
|
78 |
+
{
|
79 |
+
obj: document.getElementById("0026-get-out-the-way"),
|
80 |
+
call: function(elem) // elem will include the elem that triggered the function.
|
81 |
+
{
|
82 |
+
swfelem.embedSWF("../player.swf", "0026-get-out-the-way", "640", "500", "9.0.0",
|
83 |
+
{}, {file: "0026-get-out-the-way.flv", fullscreen: true},
|
84 |
+
{allowfullscreen: true, allowscriptaccess: "always"});
|
85 |
+
},
|
86 |
+
px: 400
|
87 |
+
});
|
88 |
+
|
89 |
+
You can also specify an id tag to be grabbed instead of the elem:
|
90 |
+
|
91 |
+
sonar.add(
|
92 |
+
{
|
93 |
+
id: "0026-get-out-the-way",
|
94 |
+
call: function(elem) // elem will include the elem that triggered the function.
|
95 |
+
{
|
96 |
+
swfelem.embedSWF("../player.swf", "0026-get-out-the-way", "640", "500", "9.0.0",
|
97 |
+
{}, {file: "0026-get-out-the-way.flv", fullscreen: true},
|
98 |
+
{allowfullscreen: true, allowscriptaccess: "always"});
|
99 |
+
},
|
100 |
+
px: 400
|
101 |
+
});
|
102 |
+
|
103 |
+
Notes:
|
104 |
+
|
105 |
+
* Setting the body or html of your page to 100% will cause sonar to have
|
106 |
+
an invalid height calculation in Firefox. It is recommended that you
|
107 |
+
do not set this CSS property.
|
108 |
+
|
109 |
+
Example:
|
110 |
+
|
111 |
+
html, body {
|
112 |
+
height:100%; // Do not do this.
|
113 |
+
}
|
114 |
+
|
115 |
+
* If you want to set the default distance to something other
|
116 |
+
than 0, either update the property directly in the code or
|
117 |
+
you can do this:
|
118 |
+
|
119 |
+
sonar.blip.d = 100; // Where 100 = 100 pixels above and below the screen edge.
|
120 |
+
|
121 |
+
* Sleep well at night knowing Sonar automatically cleans up the
|
122 |
+
event listeners on the scroll event once all calls have executed.
|
123 |
+
|
124 |
+
Code History:
|
125 |
+
|
126 |
+
v3 :: 8/14/2009 - David Artz (david.artz@corp.aol.com)
|
127 |
+
* Fixed a bug in the polling code where splicing caused our
|
128 |
+
for loop to skip over the next iteration in the loop. This
|
129 |
+
caused some images in the poll to be detected when they
|
130 |
+
should have been.
|
131 |
+
* Re-factored Sonar to use the "Module" JavaScript library
|
132 |
+
pattern, making our private variables and functions more
|
133 |
+
private and inaccessible from the public interface.
|
134 |
+
* Updated the sonar.add() function to return true or false,
|
135 |
+
useful for determining if Sonar added the elem to the
|
136 |
+
poll or executed its callback immediately.
|
137 |
+
|
138 |
+
v2 :: 3/24/2009 - David Artz (david.artz@corp.aol.com)
|
139 |
+
* Added support for IE 8.
|
140 |
+
* Updated the way scroll top and screen height are detected, now
|
141 |
+
works in IE/FF/Safari quirks mode.
|
142 |
+
* Added null check for IE, it was polling for an elem that had recently
|
143 |
+
been spliced out of the array. Nasty.
|
144 |
+
* Modified for loop to use standard syntax. for (i in x) is known to be
|
145 |
+
buggy with JS frameworks that override arrays.
|
146 |
+
* Added sonar.b property to cache the body element (improving lookup time).
|
147 |
+
|
148 |
+
v1 :: 11/18/2008 - David Artz (david.artz@corp.aol.com)
|
149 |
+
* Officially released code for general use.
|
150 |
+
|
151 |
+
*/
|
152 |
+
|
153 |
+
(function( $, win, doc, undefined ){
|
154 |
+
|
155 |
+
$.fn.sonar = function( distance, full ){
|
156 |
+
// No callbacks, return the results from Sonar for
|
157 |
+
// the first element in the stack.
|
158 |
+
if ( typeof distance === "boolean" ) {
|
159 |
+
full = distance;
|
160 |
+
distance = undefined;
|
161 |
+
}
|
162 |
+
|
163 |
+
return $.sonar( this[0], distance, full );
|
164 |
+
};
|
165 |
+
|
166 |
+
var body = doc.body,
|
167 |
+
$win = $(win),
|
168 |
+
|
169 |
+
onScreenEvent = "scrollin",
|
170 |
+
offScreenEvent = "scrollout",
|
171 |
+
|
172 |
+
detect = function( elem, distance, full ){
|
173 |
+
|
174 |
+
if ( elem ) {
|
175 |
+
|
176 |
+
// Cache the body elem in our private global.
|
177 |
+
body || ( body = doc.body );
|
178 |
+
|
179 |
+
var parentElem = elem, // Clone the elem for use in our loop.
|
180 |
+
|
181 |
+
elemTop = 0, // The resets the calculated elem top to 0.
|
182 |
+
|
183 |
+
// Used to recalculate elem.sonarElemTop if body height changes.
|
184 |
+
bodyHeight = body.offsetHeight,
|
185 |
+
|
186 |
+
// NCZ: I don't think you need innerHeight, I believe all major browsers support clientHeight.
|
187 |
+
screenHeight = win.innerHeight || doc.documentElement.clientHeight || body.clientHeight || 0, // Height of the screen.
|
188 |
+
|
189 |
+
// NCZ: I don't think you need pageYOffset, I believe all major browsers support scrollTop.
|
190 |
+
scrollTop = doc.documentElement.scrollTop || win.pageYOffset || body.scrollTop || 0, // How far the user scrolled down.
|
191 |
+
elemHeight = elem.offsetHeight || 0; // Height of the element.
|
192 |
+
|
193 |
+
// If our custom "sonarTop" variable is undefined, or the document body
|
194 |
+
// height has changed since the last time we ran sonar.detect()...
|
195 |
+
if ( !elem.sonarElemTop || elem.sonarBodyHeight !== bodyHeight ) {
|
196 |
+
|
197 |
+
// Loop through the offsetParents to calculate it.
|
198 |
+
if ( parentElem.offsetParent ) {
|
199 |
+
do {
|
200 |
+
elemTop += parentElem.offsetTop;
|
201 |
+
}
|
202 |
+
while ( parentElem = parentElem.offsetParent );
|
203 |
+
}
|
204 |
+
|
205 |
+
// Set the custom property (sonarTop) to avoid future attempts to calculate
|
206 |
+
// the distance on this elem from the top of the page.
|
207 |
+
elem.sonarElemTop = elemTop;
|
208 |
+
|
209 |
+
// Along the same lines, store the body height when we calculated
|
210 |
+
// the elem's top.
|
211 |
+
elem.sonarBodyHeight = bodyHeight;
|
212 |
+
}
|
213 |
+
|
214 |
+
// If no distance was given, assume 0.
|
215 |
+
distance = distance === undefined ? 0 : distance;
|
216 |
+
|
217 |
+
// Dump all calculated variables.
|
218 |
+
/*
|
219 |
+
console.dir({
|
220 |
+
elem: elem,
|
221 |
+
sonarElemTop: elem.sonarElemTop,
|
222 |
+
elemHeight: elemHeight,
|
223 |
+
scrollTop: scrollTop,
|
224 |
+
screenHeight: screenHeight,
|
225 |
+
distance: distance,
|
226 |
+
full: full
|
227 |
+
});
|
228 |
+
*/
|
229 |
+
|
230 |
+
// If elem bottom is above the screen top and
|
231 |
+
// the elem top is below the screen bottom, it's false.
|
232 |
+
// If full is specified, it si subtracted or added
|
233 |
+
// as needed from the element's height.
|
234 |
+
return (!(elem.sonarElemTop + (full ? 0 : elemHeight) < scrollTop - distance) &&
|
235 |
+
!(elem.sonarElemTop + (full ? elemHeight : 0) > scrollTop + screenHeight + distance));
|
236 |
+
}
|
237 |
+
},
|
238 |
+
|
239 |
+
// Container for elems needing to be polled.
|
240 |
+
pollQueue = {},
|
241 |
+
|
242 |
+
// Indicates if scroll events are bound to the poll.
|
243 |
+
pollActive = 0,
|
244 |
+
|
245 |
+
// Used for debouncing.
|
246 |
+
pollId,
|
247 |
+
|
248 |
+
// Function that handles polling when the user scrolls.
|
249 |
+
poll = function(){
|
250 |
+
|
251 |
+
// Debouncing speed optimization. Essentially prevents
|
252 |
+
// poll requests from queue'ing up and overloading
|
253 |
+
// the scroll event listener.
|
254 |
+
pollId && clearTimeout( pollId );
|
255 |
+
pollId = setTimeout(function(){
|
256 |
+
|
257 |
+
var elem,
|
258 |
+
elems,
|
259 |
+
screenEvent,
|
260 |
+
options,
|
261 |
+
detected,
|
262 |
+
i, l;
|
263 |
+
|
264 |
+
for ( screenEvent in pollQueue ) {
|
265 |
+
|
266 |
+
elems = pollQueue[ screenEvent ];
|
267 |
+
|
268 |
+
for (i = 0, l = elems.length; i < l; i++) {
|
269 |
+
|
270 |
+
options = elems[i];
|
271 |
+
elem = options.elem;
|
272 |
+
|
273 |
+
// console.log("Polling " + elem.id);
|
274 |
+
|
275 |
+
detected = detect( elem, options.px, options.full );
|
276 |
+
|
277 |
+
// If the elem is not detected (offscreen) or detected (onscreen)
|
278 |
+
// remove the elem from the queue and fire the callback.
|
279 |
+
if ( screenEvent === offScreenEvent ? !detected : detected ) {
|
280 |
+
// // console.log(screenEvent);
|
281 |
+
if (!options.tr) {
|
282 |
+
|
283 |
+
if ( elem[ screenEvent ] ) {
|
284 |
+
// console.log("triggered:" + elem.id);
|
285 |
+
// Trigger the onscreen or offscreen event depending
|
286 |
+
// on the desired event.
|
287 |
+
$(elem).trigger( screenEvent );
|
288 |
+
|
289 |
+
options.tr = 1;
|
290 |
+
|
291 |
+
// removeSonar was called on this element, clean it up
|
292 |
+
// instead of triggering the event.
|
293 |
+
} else {
|
294 |
+
// console.log("Deleting " + elem.id);
|
295 |
+
|
296 |
+
// Remove this object from the elem poll container.
|
297 |
+
elems.splice(i, 1);
|
298 |
+
|
299 |
+
// Decrement the counter and length because we just removed
|
300 |
+
// one from it.
|
301 |
+
i--;
|
302 |
+
l--;
|
303 |
+
}
|
304 |
+
}
|
305 |
+
} else {
|
306 |
+
options.tr = 0;
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
}, 0 ); // End setTimeout performance tweak.
|
312 |
+
},
|
313 |
+
|
314 |
+
removeSonar = function( elem, screenEvent ){
|
315 |
+
// console.log("Removing " + elem.id);
|
316 |
+
elem[ screenEvent ] = 0;
|
317 |
+
},
|
318 |
+
|
319 |
+
addSonar = function( elem, options ) {
|
320 |
+
// console.log("Really adding " + elem.id);
|
321 |
+
// Prepare arguments.
|
322 |
+
var distance = options.px,
|
323 |
+
full = options.full,
|
324 |
+
screenEvent = options.evt,
|
325 |
+
parent = win, // Getting ready to accept parents: options.parent || win,
|
326 |
+
detected = detect( elem, distance, full /*, parent */ ),
|
327 |
+
triggered = 0;
|
328 |
+
|
329 |
+
elem[ screenEvent ] = 1;
|
330 |
+
|
331 |
+
// If the elem is not detected (offscreen) or detected (onscreen)
|
332 |
+
// trigger the event and fire the callback immediately.
|
333 |
+
if ( screenEvent === offScreenEvent ? !detected : detected ) {
|
334 |
+
// console.log("Triggering " + elem.id + " " + screenEvent );
|
335 |
+
// Trigger the onscreen event at the next possible cycle.
|
336 |
+
// Artz: Ask the jQuery team why I needed to do this.
|
337 |
+
setTimeout(function(){
|
338 |
+
$(elem).trigger( screenEvent === offScreenEvent ? offScreenEvent : onScreenEvent );
|
339 |
+
}, 0);
|
340 |
+
triggered = 1;
|
341 |
+
// Otherwise, add it to the polling queue.
|
342 |
+
}
|
343 |
+
|
344 |
+
// console.log("Adding " + elem.id + " to queue.");
|
345 |
+
// Push the element and its callback into the poll queue.
|
346 |
+
pollQueue[ screenEvent ].push({
|
347 |
+
elem: elem,
|
348 |
+
px: distance,
|
349 |
+
full: full,
|
350 |
+
tr: triggered/* ,
|
351 |
+
parent: parent */
|
352 |
+
});
|
353 |
+
|
354 |
+
// Activate the poll if not currently activated.
|
355 |
+
if ( !pollActive ) {
|
356 |
+
$win.bind( "scroll", poll );
|
357 |
+
pollActive = 1;
|
358 |
+
}
|
359 |
+
|
360 |
+
|
361 |
+
// Call the prepare function if there, used to
|
362 |
+
// prepare the element if we detected it.
|
363 |
+
// Artz: Not implemented yet...used to preprocess elements in same loop.
|
364 |
+
/*
|
365 |
+
if ( prepCallback ) {
|
366 |
+
prepCallback.call( elem, elem, detected );
|
367 |
+
}
|
368 |
+
*/
|
369 |
+
};
|
370 |
+
|
371 |
+
// Open sonar function up to the public.
|
372 |
+
$.sonar = detect;
|
373 |
+
|
374 |
+
pollQueue[ onScreenEvent ] = [];
|
375 |
+
$.event.special[ onScreenEvent ] = {
|
376 |
+
|
377 |
+
add: function( handleObj ) {
|
378 |
+
var data = handleObj.data || {},
|
379 |
+
elem = this;
|
380 |
+
|
381 |
+
if (!elem[onScreenEvent]){
|
382 |
+
addSonar(this, {
|
383 |
+
px: data.distance,
|
384 |
+
full: data.full,
|
385 |
+
evt: onScreenEvent /*,
|
386 |
+
parent: data.parent */
|
387 |
+
});
|
388 |
+
}
|
389 |
+
},
|
390 |
+
|
391 |
+
remove: function( handleObj ) {
|
392 |
+
removeSonar( this, onScreenEvent );
|
393 |
+
}
|
394 |
+
|
395 |
+
};
|
396 |
+
|
397 |
+
pollQueue[ offScreenEvent ] = [];
|
398 |
+
$.event.special[ offScreenEvent ] = {
|
399 |
+
|
400 |
+
add: function( handleObj ) {
|
401 |
+
|
402 |
+
var data = handleObj.data || {},
|
403 |
+
elem = this;
|
404 |
+
|
405 |
+
if (!elem[offScreenEvent]){
|
406 |
+
addSonar(elem, {
|
407 |
+
px: data.distance,
|
408 |
+
full: data.full,
|
409 |
+
evt: offScreenEvent /*,
|
410 |
+
parent: data.parent */
|
411 |
+
});
|
412 |
+
}
|
413 |
+
},
|
414 |
+
|
415 |
+
remove: function( handleObj ) {
|
416 |
+
removeSonar( this, offScreenEvent );
|
417 |
+
}
|
418 |
+
};
|
419 |
+
|
420 |
+
// console.log(pollQueue);
|
421 |
+
})( jQuery, window, document );
|
nbproject/private/private.properties
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
copy.src.files=false
|
2 |
+
copy.src.on.open=false
|
3 |
+
copy.src.target=/var/www/PhpProject1
|
4 |
+
index.file=index.php
|
5 |
+
run.as=LOCAL
|
6 |
+
url=http://localhost/SpeedBooster/
|
nbproject/project.properties
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
include.path=${php.global.include.path}
|
2 |
+
php.version=PHP_56
|
3 |
+
source.encoding=UTF-8
|
4 |
+
src.dir=.
|
5 |
+
tags.asp=false
|
6 |
+
tags.short=false
|
7 |
+
web.root=.
|
nbproject/project.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project xmlns="http://www.netbeans.org/ns/project/1">
|
3 |
+
<type>org.netbeans.modules.php.project</type>
|
4 |
+
<configuration>
|
5 |
+
<data xmlns="http://www.netbeans.org/ns/php-project/1">
|
6 |
+
<name>PhpProject1</name>
|
7 |
+
</data>
|
8 |
+
</configuration>
|
9 |
+
</project>
|
readme.txt
CHANGED
@@ -1,66 +1,70 @@
|
|
1 |
=== Speed Booster Pack ===
|
2 |
-
Contributors:
|
3 |
-
Donate link:
|
4 |
-
Tags: speed, optimization, performance, scripts to the footer, google libraries, font awesome cdn, defer parsing of javascript, remove query strings, gtmetrix, google pageSpeed, yslow, eliminate external render-blocking javascript and css, compression, async, render-blocking css
|
5 |
Requires at least: 3.6
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
-
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
Speed Booster Pack
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
* 40% of people will abandon a site that takes more than 3 seconds to load
|
24 |
-
* 80% of online consumers are less likely to return to a slow website
|
25 |
-
|
26 |
-
The following video is not about "how to get a score of 100 in Google Page Speed" but want to show the difference in points Before and After activating Speed Booster Pack plugin:
|
27 |
-
|
28 |
-
https://www.youtube.com/watch?v=u0G6pk2mX4M
|
29 |
|
30 |
= Main Plugin Features =
|
31 |
|
32 |
-
* **
|
33 |
-
* **
|
34 |
-
* **
|
35 |
* **Minify and inline all CSS styles and move them to the footer** to eliminate external render-blocking CSS and optimize CSS delivery.
|
36 |
-
* **
|
37 |
-
* **
|
38 |
-
* **
|
39 |
-
* **
|
40 |
-
* **
|
41 |
-
* **
|
42 |
-
* **
|
43 |
-
* **
|
44 |
-
* **
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
* For complete usage instructions visit [Plugin Documentation](http://tiguandesign.com/docs/speed-booster/)
|
46 |
|
|
|
47 |
|
48 |
-
|
49 |
|
|
|
50 |
|
51 |
* Image optimization options.
|
52 |
* Lazy load images to improve page load times and save bandwidth.
|
53 |
-
* Cache feature: implemented or recommended.
|
54 |
* Enable compression option.
|
55 |
* Leverage browser caching.
|
56 |
* Option to disable specific plugin actions on specific pages and posts directly via the post/page edit screen metabox.
|
57 |
* Option to keep specific scripts in the header, since there are many javascript-based plugins like sliders or social media sharing scripts, that rely on jQuery to be loaded prior to the HTML elements.
|
58 |
-
* We'll recommend a premium Multipurpose WordPress theme (under development right now) that will be 100% compatible with our plugin. The theme will be the fastest theme ever.
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
= Translators are welcome! =
|
62 |
-
* Romanian (ro_RO) - [Liviu Costache](http://tiguandesign.com/)
|
63 |
-
* Spanish (es_ES) - [Andrew Kurtis](http://www.webhostinghub.com/)
|
64 |
|
65 |
== Installation ==
|
66 |
|
@@ -76,6 +80,9 @@ Future Development:
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
79 |
= 3.0 =
|
80 |
* We removed the option of excluding javascript elements as this option falls page speed score, making this plugin almost useless. Also, these options were only for advanced users, for regular users, incorrect use these options could destabilize the entire site functionality.
|
81 |
* We also removed the lazy load images option because it was outdated and broken. We'll come up with a new and updated solution soon.
|
1 |
=== Speed Booster Pack ===
|
2 |
+
Contributors: SpeedWorks
|
3 |
+
Donate link:
|
4 |
+
Tags: speed, optimization, performance, scripts to the footer, google libraries, font awesome cdn, defer parsing of javascript, remove query strings, lazy load images, gtmetrix, google pageSpeed, yslow, eliminate external render-blocking javascript and css, compression, async, render-blocking css
|
5 |
Requires at least: 3.6
|
6 |
+
Tested up to: 4.7.2
|
7 |
+
Stable tag: 3.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
+
A light, frequently updated and easy to use plugin to make your site load faster and score higher on Google PSI.
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
**Speed Booster Pack is a lightweight, frequently updated, easy to use and well supported plugin which allows you to improve your website's loading speed.**
|
16 |
|
17 |
+
Improving your site's speed will get you a better score on major speed testing services such as [Google PageSpeed](http://developers.google.com/speed/pagespeed/insights/), [GTmetrix](http://gtmetrix.com/), [YSlow](https://developer.yahoo.com/yslow/), [Pingdom](http://tools.pingdom.com/fpt/), [Webpagetest](http://www.webpagetest.org/) and will also improve your overall site's usability. This will persuade Google and other search engines to rank your site higher in search results thus sending more traffic.
|
18 |
|
19 |
+
= Why Site Speed Is Important? =
|
20 |
|
21 |
+
Visitors usually close a website if it doesn't load in a few seconds and the slower a site loads the greater the chances are that the visitors will leave. And you don't want that to happen, do you? :-)
|
22 |
+
Speed Booster Pack is a plugin that can help you speed up your website by tweaking different options.
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
= Main Plugin Features =
|
25 |
|
26 |
+
* **Eliminate external render-blocking javascript and css** in above-the-fold content.
|
27 |
+
* **Move scripts to the footer** to improve page loading speed.
|
28 |
+
* **Load CSS asynchronously** to render your page more quickly and get a higher score on the major speed testing services.
|
29 |
* **Minify and inline all CSS styles and move them to the footer** to eliminate external render-blocking CSS and optimize CSS delivery.
|
30 |
+
* **Change image compression level** to keep file sizes smaller; Change JPG quality.
|
31 |
+
* **Load javascript files from Google Libraries** rather than serving them from your WordPress install directly, to reduce latency, increase parallelism and improve browser caching.
|
32 |
+
* **Defer parsing of javascript files** to reduce the initial load time of your page.
|
33 |
+
* **Remove query strings from static resources** to improve your speed scores.
|
34 |
+
* **Remove extra Font Awesome stylesheets** added to your theme by certain plugins, if *Font Awesome* is already used in your theme.
|
35 |
+
* **Remove junk header tags** to clean up your WordPress Header.
|
36 |
+
* **Display page loading time** in the plugin options page.
|
37 |
+
* **Display the number of executed SQL queries** in the plugin options page.
|
38 |
+
* **Display the Peak Memory Used** in the plugin options page.
|
39 |
+
* **Exclude scripts** from being moved to the footer or defered.
|
40 |
+
* **Remove RSD Link** if you are not using a Weblog Client or some 3rd party sites/programs that use the XML-RPC request formats.
|
41 |
+
* **Remove WordPress Shortlink**
|
42 |
+
* **Remove the WordPress Version** this option is added for security reasons and cleaning the header.
|
43 |
+
* **Remove all rss feed links** to cleanup your WordPress header.
|
44 |
+
|
45 |
* For complete usage instructions visit [Plugin Documentation](http://tiguandesign.com/docs/speed-booster/)
|
46 |
|
47 |
+
A short video about how Speed Booster pack can help actually increase a website's score in Google PageSpeed Insights:
|
48 |
|
49 |
+
https://www.youtube.com/watch?v=u0G6pk2mX4M
|
50 |
|
51 |
+
Future Development:
|
52 |
|
53 |
* Image optimization options.
|
54 |
* Lazy load images to improve page load times and save bandwidth.
|
|
|
55 |
* Enable compression option.
|
56 |
* Leverage browser caching.
|
57 |
* Option to disable specific plugin actions on specific pages and posts directly via the post/page edit screen metabox.
|
58 |
* Option to keep specific scripts in the header, since there are many javascript-based plugins like sliders or social media sharing scripts, that rely on jQuery to be loaded prior to the HTML elements.
|
|
|
59 |
|
60 |
+
= Recommended Plugins =
|
61 |
+
|
62 |
+
* [ShortPixel Image Compresson](https://wordpress.org/plugins/shortpixel-image-optimiser/) - An image optimization plugin that further boosts your site's speed.
|
63 |
+
* [Simple Author Box](http://wordpress.org/plugins/simple-author-box/) - A simple but cool author box with social icons.
|
64 |
+
* [Verify Ownership](http://wordpress.org/plugins/verify-ownership/) - Adds meta tag verification codes to your site.
|
65 |
+
|
66 |
+
**Keywords:** booster, performance, wp optimize, minimify, minify, lazy load, lazy loading, optimize javascript, render blocking, above the fold, Leverage browser caching, gzip compression, html minify,improve page load time, js optimizer, css optimizer, defer parsing of javascript, remove query strings, lazy load images, gtmetrix, google pageSpeed, yslow, eliminate external render-blocking javascript and css, compression, async, pingdom, webpagetest, speed up website, above-the-fold, loading speed, move scritps, autoptimize, asynchronously, change jpeg quality, image compression, change jpg quality, browser caching, query string, remove query strings, junk header, page loading, improve page loading, autooptimize, css minify, js, javascript, minimify
|
67 |
|
|
|
|
|
|
|
68 |
|
69 |
== Installation ==
|
70 |
|
80 |
|
81 |
== Changelog ==
|
82 |
|
83 |
+
= 3.1 =
|
84 |
+
* Following requests from users, added back the option of excluding javascript elements.
|
85 |
+
|
86 |
= 3.0 =
|
87 |
* We removed the option of excluding javascript elements as this option falls page speed score, making this plugin almost useless. Also, these options were only for advanced users, for regular users, incorrect use these options could destabilize the entire site functionality.
|
88 |
* We also removed the lazy load images option because it was outdated and broken. We'll come up with a new and updated solution soon.
|
speed-booster-pack.php
CHANGED
@@ -3,9 +3,9 @@
|
|
3 |
* Plugin Name: Speed Booster Pack
|
4 |
* Plugin URI: http://wordpress.org/plugins/speed-booster-pack/
|
5 |
* Description: Speed Booster Pack allows you to improve your page loading speed and get a higher score on the major speed testing services such as <a href="http://gtmetrix.com/">GTmetrix</a>, <a href="http://developers.google.com/speed/pagespeed/insights/">Google PageSpeed</a> or other speed testing tools.
|
6 |
-
* Version: 3.
|
7 |
-
* Author:
|
8 |
-
* Author URI: http://tiguandesign.com
|
9 |
* License: GPLv2
|
10 |
*/
|
11 |
|
@@ -36,9 +36,9 @@ $sbp_options = get_option( 'sbp_settings' ); // retrieve the plugin settings fro
|
|
36 |
Define some useful plugin constants
|
37 |
-----------------------------------------------------------------------------------------------------------*/
|
38 |
|
39 |
-
define( 'SPEED_BOOSTER_PACK_RELEASE_DATE', date_i18n( 'F j, Y', '
|
40 |
define( 'SPEED_BOOSTER_PACK_PATH', plugin_dir_path( __FILE__ ) ); // Defining plugin dir path
|
41 |
-
define( 'SPEED_BOOSTER_PACK_VERSION', 'v3.
|
42 |
define( 'SPEED_BOOSTER_PACK_NAME', 'Speed Booster Pack Plugin'); // Defining plugin name
|
43 |
define( 'SBP_FOOTER', 10 ); // Defining css position
|
44 |
define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
@@ -66,6 +66,9 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
66 |
// load plugin textdomain
|
67 |
add_action('plugins_loaded', array( $this, 'sbp_load_translation' ) );
|
68 |
|
|
|
|
|
|
|
69 |
// Load plugin settings page
|
70 |
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/settings.php' );
|
71 |
$Speed_Booster_Pack_Options = new Speed_Booster_Pack_Options();
|
@@ -77,6 +80,9 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
77 |
// Enqueue admin style
|
78 |
add_action( 'admin_enqueue_scripts', array( $this, 'sbp_enqueue_styles' ) );
|
79 |
|
|
|
|
|
|
|
80 |
// Render debugging information
|
81 |
add_action( 'wp_footer', array( $this, 'sbp_debugg' ), SBP_FOOTER_LAST );
|
82 |
|
@@ -96,6 +102,24 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
96 |
}
|
97 |
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
/*----------------------------------------------------------------------------------------------------------
|
100 |
Activate the plugin
|
101 |
-----------------------------------------------------------------------------------------------------------*/
|
@@ -163,7 +187,7 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
163 |
global $sbp_settings_page;
|
164 |
if ( $hook != $sbp_settings_page )
|
165 |
return;
|
166 |
-
wp_enqueue_style( 'sbp-styles', plugin_dir_url( __FILE__ ) . 'css/
|
167 |
wp_enqueue_style( 'jquery-ui', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.min.css' );
|
168 |
|
169 |
} // End function sbp_enqueue_styles
|
@@ -198,6 +222,25 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
198 |
}
|
199 |
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
/*----------------------------------------------------------------------------------------------------------
|
202 |
Add settings link on plugins page
|
203 |
-----------------------------------------------------------------------------------------------------------*/
|
3 |
* Plugin Name: Speed Booster Pack
|
4 |
* Plugin URI: http://wordpress.org/plugins/speed-booster-pack/
|
5 |
* Description: Speed Booster Pack allows you to improve your page loading speed and get a higher score on the major speed testing services such as <a href="http://gtmetrix.com/">GTmetrix</a>, <a href="http://developers.google.com/speed/pagespeed/insights/">Google PageSpeed</a> or other speed testing tools.
|
6 |
+
* Version: 3.1
|
7 |
+
* Author: SpeedWorks
|
8 |
+
* Author URI: http://tiguandesign.com/docs/speed-booster/
|
9 |
* License: GPLv2
|
10 |
*/
|
11 |
|
36 |
Define some useful plugin constants
|
37 |
-----------------------------------------------------------------------------------------------------------*/
|
38 |
|
39 |
+
define( 'SPEED_BOOSTER_PACK_RELEASE_DATE', date_i18n( 'F j, Y', strtotime('2017-05-06')) ); // Defining plugin release date
|
40 |
define( 'SPEED_BOOSTER_PACK_PATH', plugin_dir_path( __FILE__ ) ); // Defining plugin dir path
|
41 |
+
define( 'SPEED_BOOSTER_PACK_VERSION', 'v3.1'); // Defining plugin version
|
42 |
define( 'SPEED_BOOSTER_PACK_NAME', 'Speed Booster Pack Plugin'); // Defining plugin name
|
43 |
define( 'SBP_FOOTER', 10 ); // Defining css position
|
44 |
define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
66 |
// load plugin textdomain
|
67 |
add_action('plugins_loaded', array( $this, 'sbp_load_translation' ) );
|
68 |
|
69 |
+
add_action('admin_notices', array( &$this, 'sbp_display_notices'));
|
70 |
+
add_action('wp_ajax_sbp_dismiss_notices', array(&$this, 'sbp_dismiss_notices'));
|
71 |
+
|
72 |
// Load plugin settings page
|
73 |
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/settings.php' );
|
74 |
$Speed_Booster_Pack_Options = new Speed_Booster_Pack_Options();
|
80 |
// Enqueue admin style
|
81 |
add_action( 'admin_enqueue_scripts', array( $this, 'sbp_enqueue_styles' ) );
|
82 |
|
83 |
+
// Enqueue frontend scripts
|
84 |
+
//add_action( 'wp_enqueue_scripts', array( $this, 'sbp_enqueue_scripts' ) );
|
85 |
+
|
86 |
// Render debugging information
|
87 |
add_action( 'wp_footer', array( $this, 'sbp_debugg' ), SBP_FOOTER_LAST );
|
88 |
|
102 |
}
|
103 |
|
104 |
|
105 |
+
/*----------------------------------------------------------------------------------------------------------
|
106 |
+
Display/dismiss admin notices if needed
|
107 |
+
-----------------------------------------------------------------------------------------------------------*/
|
108 |
+
|
109 |
+
function sbp_display_notices() {
|
110 |
+
if(!get_option( 'sbp_news')) {
|
111 |
+
global $sbp_settings_page;
|
112 |
+
$screen = get_current_screen();
|
113 |
+
if ( $screen->id != $sbp_settings_page ) {
|
114 |
+
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/template/notice.php' );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
function sbp_dismiss_notices() {
|
120 |
+
update_option( 'sbp_news', true);
|
121 |
+
}
|
122 |
+
|
123 |
/*----------------------------------------------------------------------------------------------------------
|
124 |
Activate the plugin
|
125 |
-----------------------------------------------------------------------------------------------------------*/
|
187 |
global $sbp_settings_page;
|
188 |
if ( $hook != $sbp_settings_page )
|
189 |
return;
|
190 |
+
wp_enqueue_style( 'sbp-styles', plugin_dir_url( __FILE__ ) . 'css/style.dev.css' ); // change to style.dev.css to debug the plugin style sbp_style.min
|
191 |
wp_enqueue_style( 'jquery-ui', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.min.css' );
|
192 |
|
193 |
} // End function sbp_enqueue_styles
|
222 |
}
|
223 |
|
224 |
|
225 |
+
/*----------------------------------------------------------------------------------------------------------
|
226 |
+
Enqueue front end scripts
|
227 |
+
-----------------------------------------------------------------------------------------------------------*/
|
228 |
+
|
229 |
+
static function sbp_enqueue_scripts() {
|
230 |
+
|
231 |
+
global $sbp_options;
|
232 |
+
|
233 |
+
// if ( !is_admin() and isset( $sbp_options['lazy_load'] ) ) {
|
234 |
+
|
235 |
+
// We combined 'jquery.sonar.js' and 'lazy-load.js' (commented out below) in a single minified file to reduce the number of js files.
|
236 |
+
// wp_enqueue_script( 'sbp-lazy-load-images', plugin_dir_url( __FILE__ ) . 'js/sbp-lazy-load.min.js', array( 'jquery' ), SPEED_BOOSTER_PACK_VERSION, true );
|
237 |
+
|
238 |
+
// wp_enqueue_script( 'sbp-lazy-load-images', plugin_dir_url( __FILE__ ) . 'js/lazy-load.js', array( 'jquery', 'sbp-jquery-sonar' ), SPEED_BOOSTER_PACK_VERSION, true );
|
239 |
+
// wp_enqueue_script( 'sbp-jquery-sonar', plugin_dir_url( __FILE__ ) . 'js/jquery.sonar.js', array( 'jquery' ), SPEED_BOOSTER_PACK_VERSION, true );
|
240 |
+
// }
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
/*----------------------------------------------------------------------------------------------------------
|
245 |
Add settings link on plugins page
|
246 |
-----------------------------------------------------------------------------------------------------------*/
|