Version Description
- 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.
- 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.
Download this release
Release Info
Developer | ShortPixel |
Plugin | Speed Booster Pack |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.9 to 3.0
- css/style.dev.css +1 -12
- img/sp.png +0 -0
- inc/core.php +1 -170
- inc/lazy-load.php +0 -52
- inc/settings.php +1 -94
- inc/template/notice.php +0 -17
- inc/template/options.php +6 -148
- js/jquery.sonar.js +0 -421
- js/lazy-load.js +0 -30
- js/sbp-lazy-load.min.js +0 -1
- nbproject/private/private.properties +0 -6
- nbproject/project.properties +0 -7
- nbproject/project.xml +0 -9
- readme.txt +20 -14
- speed-booster-pack.php +4 -47
css/style.dev.css
CHANGED
@@ -1,14 +1,3 @@
|
|
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,4 +571,4 @@ p.description-link {
|
|
582 |
.wrap .sb-pack input.regular-text {
|
583 |
width: 45em;
|
584 |
}
|
585 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.wrap .sb-pack .welcome-panel .welcome-panel-column:first-child {
|
2 |
display: block !important;
|
3 |
}
|
571 |
.wrap .sb-pack input.regular-text {
|
572 |
width: 45em;
|
573 |
}
|
574 |
+
}
|
img/sp.png
DELETED
Binary file
|
inc/core.php
CHANGED
@@ -13,11 +13,6 @@ 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 |
-
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,11 +28,6 @@ if( !class_exists( 'Speed_Booster_Pack_Core' ) ) {
|
|
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,115 +215,6 @@ function sbp_move_scripts_to_footer() {
|
|
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,17 +244,6 @@ function sbp_use_google_libraries() {
|
|
363 |
} // End function sbp_use_google_libraries()
|
364 |
|
365 |
|
366 |
-
/*--------------------------------------------------------------------------------------------------------
|
367 |
-
Lazy Load for images
|
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,49 +256,16 @@ function sbp_css_optimizer() {
|
|
386 |
|
387 |
|
388 |
/*--------------------------------------------------------------------------------------------------------
|
389 |
-
Defer parsing of JavaScript
|
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,12 +349,6 @@ public function sbp_junk_header_tags() {
|
|
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
|
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 |
$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 |
} // END function sbp_move_scripts_to_footer
|
216 |
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
|
219 |
/*--------------------------------------------------------------------------------------------------------
|
220 |
Show Number of Queries and Page Load Time
|
244 |
} // End function sbp_use_google_libraries()
|
245 |
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
/*--------------------------------------------------------------------------------------------------------
|
248 |
CSS Optimizer
|
249 |
---------------------------------------------------------------------------------------------------------*/
|
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 |
remove_action('wp_head', 'wp_generator');
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
} // END public function sbp_junk_header_tags
|
353 |
|
354 |
} // END class Speed_Booster_Pack_Core
|
inc/lazy-load.php
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* Lazy Load v. 0.5 => Lazy load images to improve page load times. Uses jQuery.sonar to only load an image when it's visible in the viewport.
|
3 |
-
* http://wordpress.org/plugins/lazy-load/
|
4 |
-
* Author & copyright WordPress.com VIP team, TechCrunch 2011 Redesign team, and Jake Goldman (10up LLC).
|
5 |
-
* Uses jQuery.sonar by Dave Artz (AOL): http://www.artzstudio.com/files/jquery-boston-2010/jquery.sonar/
|
6 |
-
* License: GPL2 */
|
7 |
-
|
8 |
-
if ( ! class_exists( 'Speed_Booster_Pack_Lazy_Load' ) ) :
|
9 |
-
|
10 |
-
class Speed_Booster_Pack_Lazy_Load {
|
11 |
-
|
12 |
-
static function init() {
|
13 |
-
if ( is_admin() )
|
14 |
-
return;
|
15 |
-
|
16 |
-
add_filter( 'the_content', array( __CLASS__, 'add_sbp_image_placeholders' ), 99 ); // run this later, so other content filters have run, including image_add_wh on WP.com
|
17 |
-
add_filter( 'post_thumbnail_html', array( __CLASS__, 'add_sbp_image_placeholders' ), 11 );
|
18 |
-
add_filter( 'get_avatar', array( __CLASS__, 'add_sbp_image_placeholders' ), 11 );
|
19 |
-
}
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
static function add_sbp_image_placeholders( $content ) {
|
24 |
-
// Don't lazyload for feeds, previews, mobile
|
25 |
-
if( is_feed() || is_preview() || ( function_exists( 'wp_is_mobile' ) && wp_is_mobile() ) )
|
26 |
-
return $content;
|
27 |
-
|
28 |
-
// Don't lazy-load if the content has already been run through previously
|
29 |
-
if ( false !== strpos( $content, 'data-lazy-src' ) )
|
30 |
-
return $content;
|
31 |
-
|
32 |
-
// In case you want to change the placeholder image
|
33 |
-
$sbp_placeholder_image = apply_filters( 'lazyload_images_placeholder_image', self::get_url( 'images/1x1.trans.gif' ) );
|
34 |
-
|
35 |
-
// This is a pretty simple regex, but it works
|
36 |
-
$content = preg_replace( '#<img([^>]+?)src=[\'"]?([^\'"\s>]+)[\'"]?([^>]*)>#', sprintf( '<img${1}src="%s" data-lazy-src="${2}"${3}><noscript><img${1}src="${2}"${3}></noscript>', $sbp_placeholder_image ), $content );
|
37 |
-
|
38 |
-
return $content;
|
39 |
-
}
|
40 |
-
|
41 |
-
static function get_url( $path = '' ) {
|
42 |
-
return plugins_url( ltrim( $path, '/' ), __FILE__ );
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
function sbp_lazyload_images_add_placeholders( $content ) {
|
47 |
-
return Speed_Booster_Pack_Lazy_Load::add_sbp_image_placeholders( $content );
|
48 |
-
}
|
49 |
-
|
50 |
-
Speed_Booster_Pack_Lazy_Load::init();
|
51 |
-
|
52 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/settings.php
CHANGED
@@ -27,21 +27,6 @@ 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,7 +205,6 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
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,83 +213,6 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
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,4 +228,4 @@ if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
|
321 |
|
322 |
} // END class Speed_Booster_Pack_Options
|
323 |
|
324 |
-
} // 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 |
} // END public function admin_init
|
31 |
|
32 |
|
205 |
} else {
|
206 |
$this->image_compression = 90;
|
207 |
}
|
|
|
208 |
|
209 |
// fallback for stylesheets exception handle
|
210 |
if ( get_option( 'sbp_css_exceptions' ) ) {
|
213 |
$css_exceptions = '' ;
|
214 |
}
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
/*--------------------------------------------------------------------------------------------------------*/
|
218 |
|
228 |
|
229 |
} // END class Speed_Booster_Pack_Options
|
230 |
|
231 |
+
} // END if(!class_exists('Speed_Booster_Pack_Options'))
|
inc/template/notice.php
DELETED
@@ -1,17 +0,0 @@
|
|
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,11 +50,6 @@
|
|
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 |
<p>
|
59 |
<input id="sbp_settings[font_awesome]" name="sbp_settings[font_awesome]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['font_awesome'] ) ); ?> />
|
60 |
<label for="sbp_settings[font_awesome]"><?php _e( 'Removes extra Font Awesome styles', 'sb-pack' ); ?></label>
|
@@ -91,11 +86,6 @@
|
|
91 |
<label for="sbp_settings[wp_generator]"><?php _e( 'Remove the WordPress Version', 'sb-pack' ); ?></label>
|
92 |
</p>
|
93 |
|
94 |
-
<p>
|
95 |
-
<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'] ) ); ?> />
|
96 |
-
<label for="sbp_settings[remove_all_feeds]"><?php _e( 'Remove all rss feed links', 'sb-pack' ); ?></label>
|
97 |
-
</p>
|
98 |
-
|
99 |
</div> <!-- END welcome-panel-column -->
|
100 |
|
101 |
|
@@ -139,130 +129,9 @@
|
|
139 |
</div>
|
140 |
</div>
|
141 |
|
142 |
-
<div style="display: block;" class="postbox closed" id="tiguan2">
|
143 |
-
<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>
|
144 |
-
<div class="inside">
|
145 |
-
|
146 |
-
<div class="sbp-inline-wrap">
|
147 |
-
<div class="sbp-columns1">
|
148 |
-
|
149 |
-
<h4><?php _e( 'Script Handle', 'sb-pack' ); ?></h4>
|
150 |
-
|
151 |
-
<p>
|
152 |
-
<input type="text" name="sbp_js_footer_exceptions1" id="sbp_js_footer_exceptions1" value="<?php echo $js_footer_exceptions1; ?>" />
|
153 |
-
</p>
|
154 |
-
|
155 |
-
<p>
|
156 |
-
<input type="text" name="sbp_js_footer_exceptions2" id="sbp_js_footer_exceptions2" value="<?php echo $js_footer_exceptions2; ?>" />
|
157 |
-
</p>
|
158 |
-
|
159 |
-
<p>
|
160 |
-
<input type="text" name="sbp_js_footer_exceptions3" id="sbp_js_footer_exceptions3" value="<?php echo $js_footer_exceptions3; ?>" />
|
161 |
-
</p>
|
162 |
-
|
163 |
-
<p>
|
164 |
-
<input type="text" name="sbp_js_footer_exceptions4" id="sbp_js_footer_exceptions4" value="<?php echo $js_footer_exceptions4; ?>" />
|
165 |
-
</p>
|
166 |
-
|
167 |
-
|
168 |
-
</div>
|
169 |
-
|
170 |
-
<div class="sbp-columns2">
|
171 |
-
|
172 |
-
<h4><?php _e( 'Copy the HTML code of the script from your page source and add it below', 'sb-pack' ); ?></h4>
|
173 |
-
|
174 |
-
|
175 |
-
<p>
|
176 |
-
<input type="text" name="sbp_head_html_script1" id="sbp_head_html_script1" class="regular-text" value="<?php echo $sbp_html_script1; ?>" />
|
177 |
-
</p>
|
178 |
-
|
179 |
-
<p>
|
180 |
-
<input type="text" name="sbp_head_html_script2" id="sbp_head_html_script2" class="regular-text" value="<?php echo $sbp_html_script2; ?>" />
|
181 |
-
</p>
|
182 |
-
|
183 |
-
<p>
|
184 |
-
<input type="text" name="sbp_head_html_script3" id="sbp_head_html_script3" class="regular-text" value="<?php echo $sbp_html_script3; ?>" />
|
185 |
-
</p>
|
186 |
-
|
187 |
-
<p>
|
188 |
-
<input type="text" name="sbp_head_html_script4" id="sbp_head_html_script4" class="regular-text" value="<?php echo $sbp_html_script4; ?>" />
|
189 |
-
</p>
|
190 |
-
|
191 |
-
</div>
|
192 |
-
</div>
|
193 |
-
|
194 |
-
<p class="description">
|
195 |
-
<?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' ); ?>
|
196 |
-
</p>
|
197 |
-
<div class="td-border-last"></div>
|
198 |
-
|
199 |
-
<p>
|
200 |
-
<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>
|
201 |
-
</p>
|
202 |
-
|
203 |
-
<div class="sbp-all-enqueued">
|
204 |
-
|
205 |
-
<div class="sbp-div-head">
|
206 |
-
<div class="sbp-title-scripts"><?php _e('Script Handle', 'sb-pack' ); ?></div>
|
207 |
-
<div class="sbp-title-scripts"><?php _e('Script Path', 'sb-pack' ); ?></div>
|
208 |
-
</div>
|
209 |
-
|
210 |
-
<div class="sbp-inline-wrap">
|
211 |
-
|
212 |
-
<div class="sbp-columns1 sbp-width">
|
213 |
-
<?php echo get_option( 'all_theme_scripts_handle' ) ; ?>
|
214 |
-
</div>
|
215 |
-
|
216 |
-
<div class="sbp-columns2 sbp-width">
|
217 |
-
<?php echo get_option( 'all_theme_scripts_src' ) ; ?>
|
218 |
-
</div>
|
219 |
-
|
220 |
-
|
221 |
-
</div>
|
222 |
-
|
223 |
-
</div>
|
224 |
-
<p class="description">
|
225 |
-
<?php _e('*The list may be incomplete in some circumstances.', 'sb-pack' ); ?>
|
226 |
-
</p>
|
227 |
-
</div>
|
228 |
-
</div>
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
<div style="display: block;" class="postbox closed" id="tiguan3">
|
233 |
-
<div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle"><?php _e( 'Exclude scripts from being deferred', 'sb-pack' ); ?></h3>
|
234 |
-
<div class="inside">
|
235 |
-
|
236 |
-
<div class="sbp-inline-wrap">
|
237 |
-
|
238 |
-
<p>
|
239 |
-
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions1" id="sbp_defer_exceptions1" value="<?php echo $defer_exceptions1; ?>" />
|
240 |
-
</p>
|
241 |
-
|
242 |
-
<p>
|
243 |
-
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions2" id="sbp_defer_exceptions2" value="<?php echo $defer_exceptions2; ?>" />
|
244 |
-
</p>
|
245 |
-
|
246 |
-
<p>
|
247 |
-
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions3" id="sbp_defer_exceptions3" value="<?php echo $defer_exceptions3; ?>" />
|
248 |
-
</p>
|
249 |
-
|
250 |
-
<p>
|
251 |
-
<input type="text" class="sbp-more-width" name="sbp_defer_exceptions4" id="sbp_defer_exceptions4" value="<?php echo $defer_exceptions4; ?>" />
|
252 |
-
</p>
|
253 |
-
|
254 |
-
|
255 |
-
</div>
|
256 |
-
<p class="description">
|
257 |
-
<?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' ); ?>
|
258 |
-
</p>
|
259 |
-
|
260 |
-
</div>
|
261 |
-
</div>
|
262 |
-
|
263 |
|
264 |
<div style="display: block;" class="postbox closed" id="tiguan4">
|
265 |
-
<div title="Click to toggle" class="handlediv"><br></div><h3 class="hndle
|
266 |
<div class="inside">
|
267 |
|
268 |
|
@@ -283,22 +152,12 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
283 |
</p>
|
284 |
|
285 |
<p class="description">
|
286 |
-
<?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.
|
287 |
</p>
|
288 |
-
<p class="description"><strong>
|
289 |
-
<?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' ); ?>
|
290 |
-
</strong></p>
|
291 |
-
<br>
|
292 |
-
<p class="description"><strong>
|
293 |
-
<?php _e( 'We recommend using ShortPixel Plugin to optimize your images.', 'sb-pack' ); ?>
|
294 |
-
</strong></p>
|
295 |
-
<a href="https://shortpixel.com/booster/af/KQD2XAB28044" target="_blank"><img src="<?php echo $this->plugin_url . "img/sp.png"; ?>" class="sbp-sp"/></a>
|
296 |
<p class="description">
|
297 |
-
|
298 |
-
</p>
|
299 |
-
<p class="description-link">
|
300 |
-
<a href="https://shortpixel.com/booster/af/KQD2XAB28044" target="_blank">>> <?php _e( 'More info', 'sb-pack' ); ?></a>
|
301 |
</p>
|
|
|
302 |
</div>
|
303 |
|
304 |
</div>
|
@@ -335,6 +194,7 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
335 |
<label for="sbp_settings[sbp_is_mobile]"><?php _e( 'Disable all above CSS options on mobile devices', 'sb-pack' ); ?></label>
|
336 |
</p>
|
337 |
|
|
|
338 |
<div class="td-border-last"></div>
|
339 |
|
340 |
<h4><?php _e( 'Exclude styles from asynchronously option: ', 'sb-pack' ); ?></h4>
|
@@ -368,8 +228,6 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
368 |
<?php _e('*The list may be incomplete in some circumstances.', 'sb-pack' ); ?>
|
369 |
</p>
|
370 |
|
371 |
-
|
372 |
-
|
373 |
<div class="td-border-last"></div>
|
374 |
<h4 class="sbp-icon-information"><?php _e( 'Additional information:', 'sb-pack' ); ?></h4>
|
375 |
<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>
|
@@ -441,4 +299,4 @@ var jpegCompression = '<?php echo $this->image_compression; ?>';
|
|
441 |
</div>
|
442 |
</div> <!-- END sb-pack-->
|
443 |
|
444 |
-
</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[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>
|
86 |
<label for="sbp_settings[wp_generator]"><?php _e( 'Remove the WordPress Version', 'sb-pack' ); ?></label>
|
87 |
</p>
|
88 |
|
|
|
|
|
|
|
|
|
|
|
89 |
</div> <!-- END welcome-panel-column -->
|
90 |
|
91 |
|
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 |
</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( 'Note that any changes you make will only affect new images uploaded to your site. If you want to update all of your images with the new sizes, install and run the Force Regenerate Thumbnails plugin. As a reference, a lower level of compression means more performance. We recommend you choose a compression level between 50 and 75.', 'sb-pack' ); ?>
|
|
|
|
|
|
|
159 |
</p>
|
160 |
+
|
161 |
</div>
|
162 |
|
163 |
</div>
|
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 |
<?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 |
</div>
|
300 |
</div> <!-- END sb-pack-->
|
301 |
|
302 |
+
</div> <!-- end wrap div -->
|
js/jquery.sonar.js
DELETED
@@ -1,421 +0,0 @@
|
|
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 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/lazy-load.js
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
(function($) {
|
2 |
-
lazy_load_init();
|
3 |
-
$( 'body' ).bind( 'post-load', lazy_load_init ); // Work with WP.com infinite scroll
|
4 |
-
|
5 |
-
function lazy_load_init() {
|
6 |
-
$( 'img[data-lazy-src]' ).bind( 'scrollin', { distance: 200 }, function() {
|
7 |
-
sbp_lazy_load_init( this );
|
8 |
-
});
|
9 |
-
|
10 |
-
// We need to force load gallery images in Jetpack Carousel and give up lazy-loading otherwise images don't show up correctly
|
11 |
-
$( '[data-carousel-extra]' ).each( function() {
|
12 |
-
$( this ).find( 'img[data-lazy-src]' ).each( function() {
|
13 |
-
sbp_lazy_load_init( this );
|
14 |
-
} );
|
15 |
-
} );
|
16 |
-
}
|
17 |
-
|
18 |
-
function sbp_lazy_load_init( img ) {
|
19 |
-
var $img = jQuery( img ),
|
20 |
-
src = $img.attr( 'data-lazy-src' );
|
21 |
-
|
22 |
-
$img.unbind( 'scrollin' ) // remove event binding
|
23 |
-
.hide()
|
24 |
-
.removeAttr( 'data-lazy-src' )
|
25 |
-
.attr( 'data-lazy-loaded', 'true' );
|
26 |
-
|
27 |
-
img.src = src;
|
28 |
-
$img.fadeIn();
|
29 |
-
}
|
30 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/sbp-lazy-load.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(e,t,n,r){e.fn.sonar=function(t,n){if(typeof t==="boolean"){n=t;t=r}return e.sonar(this[0],t,n)};var i=n.body,s=e(t),o="scrollin",u="scrollout",a=function(e,s,o){if(e){i||(i=n.body);var u=e,a=0,f=i.offsetHeight,l=t.innerHeight||n.documentElement.clientHeight||i.clientHeight||0,c=n.documentElement.scrollTop||t.pageYOffset||i.scrollTop||0,h=e.offsetHeight||0;if(!e.sonarElemTop||e.sonarBodyHeight!==f){if(u.offsetParent){do{a+=u.offsetTop}while(u=u.offsetParent)}e.sonarElemTop=a;e.sonarBodyHeight=f}s=s===r?0:s;return!(e.sonarElemTop+(o?0:h)<c-s)&&!(e.sonarElemTop+(o?h:0)>c+l+s)}},f={},l=0,c,h=function(){c&&clearTimeout(c);c=setTimeout(function(){var t,n,r,i,s,o,l;for(r in f){n=f[r];for(o=0,l=n.length;o<l;o++){i=n[o];t=i.elem;s=a(t,i.px,i.full);if(r===u?!s:s){if(!i.tr){if(t[r]){e(t).trigger(r);i.tr=1}else{n.splice(o,1);o--;l--}}}else{i.tr=0}}}},0)},p=function(e,t){e[t]=0},d=function(n,r){var i=r.px,c=r.full,p=r.evt,d=t,v=a(n,i,c),m=0;n[p]=1;if(p===u?!v:v){setTimeout(function(){e(n).trigger(p===u?u:o)},0);m=1}f[p].push({elem:n,px:i,full:c,tr:m});if(!l){s.bind("scroll",h);l=1}};e.sonar=a;f[o]=[];e.event.special[o]={add:function(e){var t=e.data||{},n=this;if(!n[o]){d(this,{px:t.distance,full:t.full,evt:o})}},remove:function(e){p(this,o)}};f[u]=[];e.event.special[u]={add:function(e){var t=e.data||{},n=this;if(!n[u]){d(n,{px:t.distance,full:t.full,evt:u})}},remove:function(e){p(this,u)}}})(jQuery,window,document);(function(e){function t(){e("img[data-lazy-src]").bind("scrollin",{distance:200},function(){n(this)});e("[data-carousel-extra]").each(function(){e(this).find("img[data-lazy-src]").each(function(){n(this)})})}function n(e){var t=jQuery(e),n=t.attr("data-lazy-src");t.unbind("scrollin").hide().removeAttr("data-lazy-src").attr("data-lazy-loaded","true");e.src=n;t.fadeIn()}t();e("body").bind("post-load",t)})(jQuery)
|
|
nbproject/private/private.properties
DELETED
@@ -1,6 +0,0 @@
|
|
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
DELETED
@@ -1,7 +0,0 @@
|
|
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
DELETED
@@ -1,9 +0,0 @@
|
|
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,10 +1,10 @@
|
|
1 |
=== Speed Booster Pack ===
|
2 |
-
Contributors:
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EH65WAWPEYPXU
|
4 |
-
Tags: speed, optimization, performance, scripts to the footer, google libraries, font awesome cdn, defer parsing of javascript, remove query strings,
|
5 |
Requires at least: 3.6
|
6 |
-
Tested up to: 4.7.
|
7 |
-
Stable tag:
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -33,7 +33,6 @@ https://www.youtube.com/watch?v=u0G6pk2mX4M
|
|
33 |
* **Moves scripts to the footer** to improve page loading speed.
|
34 |
* **Loads CSS asynchronously** to render your page more quickly and get a higher score on the major speed testing services.
|
35 |
* **Minify and inline all CSS styles and move them to the footer** to eliminate external render-blocking CSS and optimize CSS delivery.
|
36 |
-
* **Lazy loads images** to improve page load times and save bandwidth.
|
37 |
* **Changes image compression level** to keep file sizes smaller.
|
38 |
* **Loads javascript files from Google Libraries** rather than serving them from your WordPress install directly, to reduce latency, increase parallelism and improve caching.
|
39 |
* **Defers parsing of javascript files** to reduce the initial load time of your page.
|
@@ -41,18 +40,23 @@ https://www.youtube.com/watch?v=u0G6pk2mX4M
|
|
41 |
* **Removes extra Font Awesome stylesheets** added to your theme by certain plugins, if *Font Awesome* is already used in your theme.
|
42 |
* **Removes junk header tags** to clean up your WordPress Header.
|
43 |
* **Displays page loading time** in the plugin options page.
|
44 |
-
* **Displays the number of executed queries** in the
|
45 |
* **Displays the Peak Memory Used** in the plugin options page.
|
46 |
-
|
47 |
* For complete usage instructions visit [Plugin Documentation](http://tiguandesign.com/docs/speed-booster/)
|
48 |
-
* Check out our [Premium Themes](http://tiguandesign.com/category/premium-wordpress-themes/) that use our Speed Booster Pack plugin
|
49 |
|
50 |
-
= Recommended Plugins =
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
-
* [Simple Author Box](http://wordpress.org/plugins/simple-author-box/) - A simple but cool author box with social icons.
|
55 |
-
* [Verify Ownership](http://wordpress.org/plugins/verify-ownership/) - Adds meta tag verification codes to your site.
|
56 |
|
57 |
= Translators are welcome! =
|
58 |
* Romanian (ro_RO) - [Liviu Costache](http://tiguandesign.com/)
|
@@ -72,6 +76,10 @@ The following are other recommended plugins by the author of Speed Booster Pack:
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
75 |
= 2.9 =
|
76 |
* Added a new recommended features that can make your site load faster
|
77 |
|
@@ -172,6 +180,4 @@ Page Load Stats is a brief statistic displayed in the plugin options page. It di
|
|
172 |
== Credits ==
|
173 |
|
174 |
* Thanks to [Jason Penney](http://jasonpenney.net/) for Google Libraries feature.
|
175 |
-
* Credits for Lazy Load feature belongs to: WordPress.com VIP team at Automattic, the TechCrunch 2011 Redesign team, and Jake Goldman (10up LLC).
|
176 |
* CSS option was implemented from Async JS and CSS plugin and updated to our plugin.
|
177 |
-
* The plugin uses [jQuery.sonar](http://www.artzstudio.com/files/jquery-boston-2010/jquery.sonar/) by Dave Artz (AOL).
|
1 |
=== Speed Booster Pack ===
|
2 |
+
Contributors: ShortPixel
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EH65WAWPEYPXU
|
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.3
|
7 |
+
Stable tag: 3.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
33 |
* **Moves scripts to the footer** to improve page loading speed.
|
34 |
* **Loads CSS asynchronously** to render your page more quickly and get a higher score on the major speed testing services.
|
35 |
* **Minify and inline all CSS styles and move them to the footer** to eliminate external render-blocking CSS and optimize CSS delivery.
|
|
|
36 |
* **Changes image compression level** to keep file sizes smaller.
|
37 |
* **Loads javascript files from Google Libraries** rather than serving them from your WordPress install directly, to reduce latency, increase parallelism and improve caching.
|
38 |
* **Defers parsing of javascript files** to reduce the initial load time of your page.
|
40 |
* **Removes extra Font Awesome stylesheets** added to your theme by certain plugins, if *Font Awesome* is already used in your theme.
|
41 |
* **Removes junk header tags** to clean up your WordPress Header.
|
42 |
* **Displays page loading time** in the plugin options page.
|
43 |
+
* **Displays the number of executed queries** in the options page.
|
44 |
* **Displays the Peak Memory Used** in the plugin options page.
|
|
|
45 |
* For complete usage instructions visit [Plugin Documentation](http://tiguandesign.com/docs/speed-booster/)
|
|
|
46 |
|
|
|
47 |
|
48 |
+
Future Development:
|
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/)
|
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.
|
82 |
+
|
83 |
= 2.9 =
|
84 |
* Added a new recommended features that can make your site load faster
|
85 |
|
180 |
== Credits ==
|
181 |
|
182 |
* Thanks to [Jason Penney](http://jasonpenney.net/) for Google Libraries feature.
|
|
|
183 |
* CSS option was implemented from Async JS and CSS plugin and updated to our plugin.
|
|
speed-booster-pack.php
CHANGED
@@ -3,8 +3,8 @@
|
|
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:
|
7 |
-
* Author:
|
8 |
* Author URI: http://tiguandesign.com
|
9 |
* License: GPLv2
|
10 |
*/
|
@@ -38,7 +38,7 @@ $sbp_options = get_option( 'sbp_settings' ); // retrieve the plugin settings fro
|
|
38 |
|
39 |
define( 'SPEED_BOOSTER_PACK_RELEASE_DATE', date_i18n( 'F j, Y', '1400569200' ) ); // Defining plugin release date
|
40 |
define( 'SPEED_BOOSTER_PACK_PATH', plugin_dir_path( __FILE__ ) ); // Defining plugin dir path
|
41 |
-
define( 'SPEED_BOOSTER_PACK_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,9 +66,6 @@ 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,9 +77,6 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
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,24 +96,6 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
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,7 +163,7 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
187 |
global $sbp_settings_page;
|
188 |
if ( $hook != $sbp_settings_page )
|
189 |
return;
|
190 |
-
wp_enqueue_style( 'sbp-styles', plugin_dir_url( __FILE__ ) . 'css/
|
191 |
wp_enqueue_style( 'jquery-ui', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.min.css' );
|
192 |
|
193 |
} // End function sbp_enqueue_styles
|
@@ -222,25 +198,6 @@ define( 'SBP_FOOTER_LAST', 99999 ); // Defining css last position
|
|
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 |
-----------------------------------------------------------------------------------------------------------*/
|
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.0
|
7 |
+
* Author: ShortPixel
|
8 |
* Author URI: http://tiguandesign.com
|
9 |
* License: GPLv2
|
10 |
*/
|
38 |
|
39 |
define( 'SPEED_BOOSTER_PACK_RELEASE_DATE', date_i18n( 'F j, Y', '1400569200' ) ); // 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.0'); // 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 |
// 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 |
// 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 |
}
|
97 |
|
98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
/*----------------------------------------------------------------------------------------------------------
|
100 |
Activate the plugin
|
101 |
-----------------------------------------------------------------------------------------------------------*/
|
163 |
global $sbp_settings_page;
|
164 |
if ( $hook != $sbp_settings_page )
|
165 |
return;
|
166 |
+
wp_enqueue_style( 'sbp-styles', plugin_dir_url( __FILE__ ) . 'css/sbp_style.min.css' ); // change to style.dev.css to debug the plugin style
|
167 |
wp_enqueue_style( 'jquery-ui', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.min.css' );
|
168 |
|
169 |
} // End function sbp_enqueue_styles
|
198 |
}
|
199 |
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
/*----------------------------------------------------------------------------------------------------------
|
202 |
Add settings link on plugins page
|
203 |
-----------------------------------------------------------------------------------------------------------*/
|