Version Description
Download this release
Release Info
Developer | tiguan |
Plugin | Speed Booster Pack |
Version | 1.1 |
Comparing to | |
See all releases |
Version 1.1
- css/dynamic-css.php +111 -0
- css/sbp_style.min.css +1 -0
- css/style.dev.css +286 -0
- inc/core.php +173 -0
- inc/settings.php +66 -0
- inc/template/options.php +161 -0
- inc/use-google-libraries.php +441 -0
- lang/sb-pack.mo +0 -0
- lang/sb-pack.po +126 -0
- readme.txt +49 -0
- speed-booster-pack.php +150 -0
css/dynamic-css.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style type="text/css">
|
2 |
+
|
3 |
+
/*progress-bar-time*/
|
4 |
+
|
5 |
+
@-webkit-keyframes progress-bar-time {
|
6 |
+
from { }
|
7 |
+
to { width: 5<?php echo $page_time; ?>% }
|
8 |
+
}
|
9 |
+
|
10 |
+
@-moz-keyframes progress-bar-time {
|
11 |
+
from { }
|
12 |
+
to { width: 5<?php echo $page_time; ?>% }
|
13 |
+
}
|
14 |
+
|
15 |
+
@-ms-keyframes progress-bar-time {
|
16 |
+
from { }
|
17 |
+
to { width: 5<?php echo $page_time; ?>% }
|
18 |
+
}
|
19 |
+
|
20 |
+
@-o-keyframes progress-bar-time {
|
21 |
+
from { }
|
22 |
+
to { width: 5<?php echo $page_time; ?>% }
|
23 |
+
}
|
24 |
+
|
25 |
+
@keyframes progress-bar-time {
|
26 |
+
from { }
|
27 |
+
to { width: 5<?php echo $page_time; ?>% }
|
28 |
+
}
|
29 |
+
|
30 |
+
/*progress-bar-queries*/
|
31 |
+
|
32 |
+
@-webkit-keyframes progress-bar-queries {
|
33 |
+
from { }
|
34 |
+
to { width: <?php echo $page_queries; ?>% }
|
35 |
+
}
|
36 |
+
|
37 |
+
@-moz-keyframes progress-bar-queries {
|
38 |
+
from { }
|
39 |
+
to { width: <?php echo $page_queries; ?>% }
|
40 |
+
}
|
41 |
+
|
42 |
+
@-ms-keyframes progress-bar-queries {
|
43 |
+
from { }
|
44 |
+
to { width: <?php echo $page_queries; ?>% }
|
45 |
+
}
|
46 |
+
|
47 |
+
@-o-keyframes progress-bar-queries {
|
48 |
+
from { }
|
49 |
+
to { width: <?php echo $page_queries; ?>% }
|
50 |
+
}
|
51 |
+
|
52 |
+
@keyframes progress-bar-queries {
|
53 |
+
from { }
|
54 |
+
to { width: <?php echo $page_queries; ?>% }
|
55 |
+
}
|
56 |
+
|
57 |
+
<?php
|
58 |
+
|
59 |
+
if ( $page_time >=1.00 and $page_time <=2.00 ) { ?>
|
60 |
+
|
61 |
+
.wrap .sbp-progress.time > span {
|
62 |
+
background-color: #f1a165;
|
63 |
+
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #f1a165),color-stop(1, #f36d0a));
|
64 |
+
background-image: -webkit-linear-gradient(top, #f1a165, #f36d0a);
|
65 |
+
background-image: -moz-linear-gradient(top, #f1a165, #f36d0a);
|
66 |
+
background-image: -ms-linear-gradient(top, #f1a165, #f36d0a);
|
67 |
+
background-image: -o-linear-gradient(top, #f1a165, #f36d0a);
|
68 |
+
}
|
69 |
+
|
70 |
+
<?php }
|
71 |
+
|
72 |
+
if ( $page_time >=2.00 ) { ?>
|
73 |
+
.wrap .sbp-progress.time > span {
|
74 |
+
background-color: #FB8A88;
|
75 |
+
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #FB8A88),color-stop(1, #FF4136));
|
76 |
+
background-image: -webkit-linear-gradient(top, #FB8A88, #FF4136);
|
77 |
+
background-image: -moz-linear-gradient(top, #FB8A88, #FF4136);
|
78 |
+
background-image: -ms-linear-gradient(top, #FB8A88, #FF4136);
|
79 |
+
background-image: -o-linear-gradient(top, #f1a165, #f36d0a);
|
80 |
+
}
|
81 |
+
|
82 |
+
<?php }
|
83 |
+
|
84 |
+
if ( $page_queries >=100 and $page_queries <=200 ) { ?>
|
85 |
+
|
86 |
+
.wrap .sbp-progress.queries > span {
|
87 |
+
background-color: #f1a165;
|
88 |
+
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #f1a165),color-stop(1, #f36d0a));
|
89 |
+
background-image: -webkit-linear-gradient(top, #f1a165, #f36d0a);
|
90 |
+
background-image: -moz-linear-gradient(top, #f1a165, #f36d0a);
|
91 |
+
background-image: -ms-linear-gradient(top, #f1a165, #f36d0a);
|
92 |
+
background-image: -o-linear-gradient(top, #f1a165, #f36d0a);
|
93 |
+
}
|
94 |
+
|
95 |
+
<?php }
|
96 |
+
|
97 |
+
if ( $page_queries >=200 ) { ?>
|
98 |
+
.wrap .sbp-progress.queries > span {
|
99 |
+
background-color: #FB8A88;
|
100 |
+
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #FB8A88),color-stop(1, #FF4136));
|
101 |
+
background-image: -webkit-linear-gradient(top, #FB8A88, #FF4136);
|
102 |
+
background-image: -moz-linear-gradient(top, #FB8A88, #FF4136);
|
103 |
+
background-image: -ms-linear-gradient(top, #FB8A88, #FF4136);
|
104 |
+
background-image: -o-linear-gradient(top, #f1a165, #f36d0a);
|
105 |
+
}
|
106 |
+
|
107 |
+
<?php }
|
108 |
+
|
109 |
+
?>
|
110 |
+
|
111 |
+
</style>
|
css/sbp_style.min.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.wrap .sb-pack{margin-bottom:50px}.wrap .sb-pack .welcome-panel h4{margin:1.33em 0 20px}.wrap .sb-pack .sbp-title-div{height:50px;clear:both}.wrap .sb-pack .sbp-box hr{margin-left:70px}.wrap .sb-pack .sbp-1{padding-top:10px}.wrap .sb-pack .sbp-2{padding-bottom:15px}.wrap .sb-pack .sbp-3{padding-top:5px}.wrap .sb-pack .sbp-title-div .sbp-title{font-size:23px;font-weight:300;line-height:26px;padding-top:16px;padding-right:15px;display:block;float:left}.wrap .sb-pack .sbp-box{background:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,0.04);padding:15px;margin-bottom:15px;position:relative;overflow:hidden}.wrap .sb-pack .sbp-box p{margin:5px 0 5px 70px;color:#777}.wrap .sb-pack .sbp-infos{display:block;margin:0 auto;padding-left:70px;font-weight:700;color:#777}.wrap .sb-pack .sbp-infos span{color:#777;font-weight:400}.wrap .sb-pack .sbp-infos-title{font-weight:700;color:#777}.wrap .sb-pack .sbp-box-legend,.wrap .sb-pack .sbp-box-version{position:absolute;left:0;top:0;height:100%}.wrap .sb-pack .sbp-box-version{background:none repeat scroll 0 0 #80828f;padding:20px 15px}.wrap .sb-pack .sbp-box-legend{background:none repeat scroll 0 0 #fcc500;padding:15px 15px}.wrap .sb-pack .sbp-box-legend:hover{background-color:#f39c12}.wrap .sb-pack .sbp-box-version:hover{background-color:#6c6e79}.wrap .sb-pack .sbp-icon-help,.wrap .sb-pack .sbp-icon-version{color:#FFF;font-size:25px}.wrap .sb-pack .sbp-icon:before{content:"\f185";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 36px/0.7 'dashicons';vertical-align:top;color:#fa5148;padding-right:5px}.wrap .sb-pack label{display:inline-block;cursor:pointer;position:relative;padding-left:35px;font-size:16px}.wrap .sb-pack label:before{content:"\2717";font-size:16px;-webkit-font-smoothing:antialiased;text-align:center;color:#fff;display:inline-block;width:24px;height:24px;margin-right:10px;position:absolute;left:0;background:#c9d6e2;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.wrap .sb-pack input[type=checkbox]{display:none}.wrap .sb-pack input[type=checkbox]:checked+label:before{content:"\2714";background:#2dcb73;text-shadow:1px 1px 1px #148d44;font-size:16px;-webkit-font-smoothing:antialiased;color:#fff;text-align:center}.wrap .sb-pack .sbp-icon-version:before{content:"\f348";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 30px/1 'dashicons';vertical-align:top}.wrap .sb-pack .sbp-icon-help:before{content:"\f123";display:inline-block;-webkit-font-smoothing:antialiased;font:normal 30px/1 'dashicons';vertical-align:top}.wrap .sb-pack .sbp-stats{font-size:16px}.wrap .sb-pack .sbp-progress.time,.wrap .sb-pack .sbp-progress.queries{height:20px;width:80%;display:inline-block;position:relative;background-color:#f1f2f7;overflow:hidden;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.wrap .sbp-progress.time>span,.wrap .sbp-progress.queries>span{background-color:#7edba5;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(0,#7edba5),color-stop(1,#2dcb73));background-image:-webkit-linear-gradient(top,#7edba5,#2dcb73);background-image:-moz-linear-gradient(top,#7edba5,#2dcb73);background-image:-ms-linear-gradient(top,#7edba5,#2dcb73);background-image:-o-linear-gradient(top,#7edba5,#f36d0a);color:#fff;width:0;max-width:98%;float:left;display:block;height:100%;position:relative;overflow:hidden}.wrap .sb-pack .sbp-progress.time>span{-webkit-animation:progress-bar-time 2s 1 forwards;-moz-animation:progress-bar-time 2s 1 forwards;-ms-animation:progress-bar-time 2s 1 forwards;-o-animation:progress-bar-time 2s 1 forwards;animation:progress-bar-time 2s 1 forwards}.wrap .sb-pack .sbp-progress.queries>span{-webkit-animation:progress-bar-queries 2s 1 forwards;-moz-animation:progress-bar-queries 2s 1 forwards;-ms-animation:progress-bar-queries 2s 1 forwards;-o-animation:progress-bar-queries 2s 1 forwards;animation:progress-bar-queries 2s 1 forwards}.wrap .sb-pack .sbp-values{float:right;padding:0 5px;background-color:#3498db;color:#fff;width:14%;height:20px;line-height:19px;text-align:center;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.wrap .sb-pack .sbp-numbers{-webkit-animation:opacity 2s;-moz-animation:opacity 2s;-ms-animation:opacity 2s;-o-animation:opacity 2s;animation:opacity 2s;transition-delay:2s;-moz-transition-delay:2s;-webkit-transition-delay:2s;-o-transition-delay:2s}@keyframes opacity{from{opacity:0}to{opacity:1}}@-moz-keyframes opacity{from{opacity:0}to{opacity:1}}@-webkit-keyframes opacity{from{opacity:0}to{opacity:1}}@-ms-keyframes opacity{from{opacity:0}to{opacity:1}} @-o-keyframes opacity{from{opacity:0}to{opacity:1}}
|
css/style.dev.css
ADDED
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wrap .sb-pack {
|
2 |
+
margin-bottom: 50px;
|
3 |
+
}
|
4 |
+
|
5 |
+
.wrap .sb-pack .welcome-panel h4 {
|
6 |
+
margin: 1.33em 0 20px;
|
7 |
+
}
|
8 |
+
|
9 |
+
.wrap .sb-pack .sbp-title-div {
|
10 |
+
height: 50px;
|
11 |
+
clear: both;
|
12 |
+
}
|
13 |
+
|
14 |
+
.wrap .sb-pack .sbp-box hr {
|
15 |
+
margin-left: 70px;
|
16 |
+
}
|
17 |
+
|
18 |
+
.wrap .sb-pack .sbp-1 {
|
19 |
+
padding-top: 10px;
|
20 |
+
}
|
21 |
+
|
22 |
+
.wrap .sb-pack .sbp-2 {
|
23 |
+
padding-bottom: 15px;
|
24 |
+
}
|
25 |
+
|
26 |
+
.wrap .sb-pack .sbp-3 {
|
27 |
+
padding-top: 5px;
|
28 |
+
}
|
29 |
+
|
30 |
+
.wrap .sb-pack .sbp-title-div .sbp-title {
|
31 |
+
font-size: 23px;
|
32 |
+
font-weight: 300;
|
33 |
+
line-height: 26px;
|
34 |
+
padding-top: 16px;
|
35 |
+
padding-right: 15px;
|
36 |
+
display: block;
|
37 |
+
float: left;
|
38 |
+
}
|
39 |
+
|
40 |
+
.wrap .sb-pack .sbp-box {
|
41 |
+
background:#fff;
|
42 |
+
border: 1px solid #E5E5E5;
|
43 |
+
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
|
44 |
+
padding: 15px;
|
45 |
+
margin-bottom: 15px;
|
46 |
+
position: relative;
|
47 |
+
overflow: hidden;
|
48 |
+
}
|
49 |
+
|
50 |
+
.wrap .sb-pack .sbp-box p {
|
51 |
+
margin: 5px 0 5px 70px;
|
52 |
+
color: #777;
|
53 |
+
}
|
54 |
+
|
55 |
+
.wrap .sb-pack .sbp-infos {
|
56 |
+
display: block;
|
57 |
+
margin: 0 auto;
|
58 |
+
padding-left: 70px;
|
59 |
+
font-weight: 700;
|
60 |
+
color:#777;
|
61 |
+
}
|
62 |
+
|
63 |
+
.wrap .sb-pack .sbp-infos span {
|
64 |
+
color: #777;
|
65 |
+
font-weight: 400;
|
66 |
+
}
|
67 |
+
|
68 |
+
.wrap .sb-pack .sbp-infos-title {
|
69 |
+
font-weight: 700;
|
70 |
+
color: #777;
|
71 |
+
}
|
72 |
+
|
73 |
+
.wrap .sb-pack .sbp-box-legend, .wrap .sb-pack .sbp-box-version {
|
74 |
+
position: absolute;
|
75 |
+
left: 0;
|
76 |
+
top: 0;
|
77 |
+
height: 100%;
|
78 |
+
}
|
79 |
+
|
80 |
+
.wrap .sb-pack .sbp-box-version {
|
81 |
+
background: none repeat scroll 0% 0% #80828F;
|
82 |
+
padding: 20px 15px;
|
83 |
+
}
|
84 |
+
|
85 |
+
.wrap .sb-pack .sbp-box-legend {
|
86 |
+
background: none repeat scroll 0% 0% #FCC500;
|
87 |
+
padding: 15px 15px;
|
88 |
+
}
|
89 |
+
|
90 |
+
.wrap .sb-pack .sbp-box-legend:hover {
|
91 |
+
background-color: #F39C12;
|
92 |
+
}
|
93 |
+
|
94 |
+
.wrap .sb-pack .sbp-box-version:hover {
|
95 |
+
background-color: #6C6E79;
|
96 |
+
}
|
97 |
+
|
98 |
+
.wrap .sb-pack .sbp-icon-help, .wrap .sb-pack .sbp-icon-version {
|
99 |
+
color:#FFF;
|
100 |
+
font-size:25px;
|
101 |
+
}
|
102 |
+
|
103 |
+
.wrap .sb-pack .sbp-icon:before {
|
104 |
+
content: "\f185";
|
105 |
+
display: inline-block;
|
106 |
+
-webkit-font-smoothing: antialiased;
|
107 |
+
font: normal 36px/0.7 'dashicons';
|
108 |
+
vertical-align: top;
|
109 |
+
color: #FA5148;
|
110 |
+
padding-right: 5px;
|
111 |
+
}
|
112 |
+
|
113 |
+
.wrap .sb-pack label {
|
114 |
+
display: inline-block;
|
115 |
+
cursor: pointer;
|
116 |
+
position: relative;
|
117 |
+
padding-left: 35px;
|
118 |
+
font-size: 16px;
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
.wrap .sb-pack label:before {
|
123 |
+
content: "\2717";
|
124 |
+
font-size: 16px;
|
125 |
+
-webkit-font-smoothing: antialiased;
|
126 |
+
text-align: center;
|
127 |
+
color: #fff;
|
128 |
+
display: inline-block;
|
129 |
+
width: 24px;
|
130 |
+
height: 24px;
|
131 |
+
margin-right: 10px;
|
132 |
+
position: absolute;
|
133 |
+
left: 0;
|
134 |
+
background: #C9D6E2;
|
135 |
+
-webkit-border-radius: 4px;
|
136 |
+
-moz-border-radius: 4px;
|
137 |
+
border-radius: 4px;
|
138 |
+
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
139 |
+
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
140 |
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
141 |
+
}
|
142 |
+
|
143 |
+
.wrap .sb-pack input[type=checkbox] {
|
144 |
+
display: none;
|
145 |
+
}
|
146 |
+
|
147 |
+
.wrap .sb-pack input[type=checkbox]:checked + label:before {
|
148 |
+
content: "\2714";
|
149 |
+
background: #2DCB73;
|
150 |
+
text-shadow: 1px 1px 1px #148D44;
|
151 |
+
font-size: 16px;
|
152 |
+
-webkit-font-smoothing: antialiased;
|
153 |
+
color: #fff;
|
154 |
+
text-align: center;
|
155 |
+
}
|
156 |
+
|
157 |
+
.wrap .sb-pack .sbp-icon-version:before {
|
158 |
+
content: "\f348";
|
159 |
+
display: inline-block;
|
160 |
+
-webkit-font-smoothing: antialiased;
|
161 |
+
font: normal 30px/1 'dashicons';
|
162 |
+
vertical-align: top;
|
163 |
+
}
|
164 |
+
|
165 |
+
.wrap .sb-pack .sbp-icon-help:before {
|
166 |
+
content: "\f123";
|
167 |
+
display: inline-block;
|
168 |
+
-webkit-font-smoothing: antialiased;
|
169 |
+
font: normal 30px/1 'dashicons';
|
170 |
+
vertical-align: top;
|
171 |
+
}
|
172 |
+
|
173 |
+
.wrap .sb-pack .sbp-stats {
|
174 |
+
font-size: 16px;
|
175 |
+
}
|
176 |
+
|
177 |
+
/* Progress Bars
|
178 |
+
-------------------------------------------------------------- */
|
179 |
+
.wrap .sb-pack .sbp-progress.time,
|
180 |
+
.wrap .sb-pack .sbp-progress.queries {
|
181 |
+
height: 20px;
|
182 |
+
width: 80%;
|
183 |
+
display: inline-block;
|
184 |
+
position: relative;
|
185 |
+
background-color: #F1F2F7;
|
186 |
+
overflow: hidden;
|
187 |
+
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
188 |
+
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
189 |
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
190 |
+
-webkit-border-radius: 4px;
|
191 |
+
-moz-border-radius: 4px;
|
192 |
+
border-radius: 4px;
|
193 |
+
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
194 |
+
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
195 |
+
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
196 |
+
}
|
197 |
+
.wrap .sbp-progress.time > span,
|
198 |
+
.wrap .sbp-progress.queries > span {
|
199 |
+
background-color: #7EDBA5;
|
200 |
+
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #7EDBA5),color-stop(1, #2DCB73));
|
201 |
+
background-image: -webkit-linear-gradient(top, #7EDBA5, #2DCB73);
|
202 |
+
background-image: -moz-linear-gradient(top, #7EDBA5, #2DCB73);
|
203 |
+
background-image: -ms-linear-gradient(top, #7EDBA5, #2DCB73);
|
204 |
+
background-image: -o-linear-gradient(top, #7EDBA5, #f36d0a);
|
205 |
+
color:#fff;
|
206 |
+
width: 0%;
|
207 |
+
max-width: 98%;
|
208 |
+
float: left;
|
209 |
+
display: block;
|
210 |
+
height: 100%;
|
211 |
+
position: relative;
|
212 |
+
overflow: hidden;
|
213 |
+
}
|
214 |
+
|
215 |
+
.wrap .sb-pack .sbp-progress.time > span {
|
216 |
+
-webkit-animation: progress-bar-time 2s 1 forwards;
|
217 |
+
-moz-animation: progress-bar-time 2s 1 forwards;
|
218 |
+
-ms-animation: progress-bar-time 2s 1 forwards;
|
219 |
+
-o-animation: progress-bar-time 2s 1 forwards;
|
220 |
+
animation: progress-bar-time 2s 1 forwards;
|
221 |
+
|
222 |
+
}
|
223 |
+
|
224 |
+
.wrap .sb-pack .sbp-progress.queries > span {
|
225 |
+
-webkit-animation: progress-bar-queries 2s 1 forwards;
|
226 |
+
-moz-animation: progress-bar-queries 2s 1 forwards;
|
227 |
+
-ms-animation: progress-bar-queries 2s 1 forwards;
|
228 |
+
-o-animation: progress-bar-queries 2s 1 forwards;
|
229 |
+
animation: progress-bar-queries 2s 1 forwards;
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
+
.wrap .sb-pack .sbp-values {
|
234 |
+
float: right;
|
235 |
+
padding: 0 5px;
|
236 |
+
background-color: #3498DB;
|
237 |
+
color: #fff;
|
238 |
+
width: 14%;
|
239 |
+
height: 20px;
|
240 |
+
line-height: 19px;
|
241 |
+
text-align: center;
|
242 |
+
-webkit-border-radius: 4px;
|
243 |
+
-moz-border-radius: 4px;
|
244 |
+
border-radius: 4px;
|
245 |
+
}
|
246 |
+
|
247 |
+
.wrap .sb-pack .sbp-numbers {
|
248 |
+
-webkit-animation: opacity 2s; /* Safari and Chrome */
|
249 |
+
-moz-animation: opacity 2s; /* Firefox */
|
250 |
+
-ms-animation: opacity 2s; /* Internet Explorer */
|
251 |
+
-o-animation: opacity 2s; /* Opera */
|
252 |
+
animation: opacity 2s;
|
253 |
+
transition-delay: 2s;
|
254 |
+
-moz-transition-delay: 2s; /* Firefox 4 */
|
255 |
+
-webkit-transition-delay: 2s; /* Safari and Chrome */
|
256 |
+
-o-transition-delay: 2s; /* Opera */
|
257 |
+
}
|
258 |
+
|
259 |
+
@keyframes opacity {
|
260 |
+
from { opacity:0; }
|
261 |
+
to { opacity: 1; }
|
262 |
+
}
|
263 |
+
|
264 |
+
/* Firefox */
|
265 |
+
@-moz-keyframes opacity {
|
266 |
+
from { opacity:0; }
|
267 |
+
to { opacity: 1; }
|
268 |
+
}
|
269 |
+
|
270 |
+
/* Safari and Chrome */
|
271 |
+
@-webkit-keyframes opacity {
|
272 |
+
from { opacity:0; }
|
273 |
+
to { opacity: 1; }
|
274 |
+
}
|
275 |
+
|
276 |
+
/* Internet Explorer */
|
277 |
+
@-ms-keyframes opacity {
|
278 |
+
from { opacity:0; }
|
279 |
+
to { opacity: 1; }
|
280 |
+
}
|
281 |
+
|
282 |
+
/* Opera */
|
283 |
+
@-o-keyframes opacity {
|
284 |
+
from { opacity:0; }
|
285 |
+
to { opacity: 1; }
|
286 |
+
}
|
inc/core.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if( !class_exists( 'Speed_Booster_Pack_Core' ) ) {
|
4 |
+
|
5 |
+
class Speed_Booster_Pack_Core {
|
6 |
+
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
|
10 |
+
global $sbp_options;
|
11 |
+
|
12 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'sbp_move_scripts_to_footer' ) );
|
13 |
+
add_action( 'wp_footer', array( $this, 'sbp_show_page_load_stats' ), 999 );
|
14 |
+
add_action('after_setup_theme', array( $this, 'sbp_junk_header_tags' ) );
|
15 |
+
|
16 |
+
// Use Google Libraries
|
17 |
+
if ( !is_admin() and isset( $sbp_options['use_google_libs'] ) ) {
|
18 |
+
$this->sbp_use_google_libraries();
|
19 |
+
}
|
20 |
+
|
21 |
+
// Defer parsing of JavaScript
|
22 |
+
if ( !is_admin() and isset( $sbp_options['defer_parsing'] ) ) {
|
23 |
+
add_filter( 'clean_url', array( $this, 'sbp_defer_parsing_of_js' ), 11, 1 );
|
24 |
+
}
|
25 |
+
|
26 |
+
// Remove query strings from static resources
|
27 |
+
if ( !is_admin() and isset( $sbp_options['query_strings'] ) ) {
|
28 |
+
add_filter( 'script_loader_src', array( $this, 'sbp_remove_query_strings_1' ), 15, 1 );
|
29 |
+
}
|
30 |
+
|
31 |
+
if ( !is_admin() and isset( $sbp_options['query_strings'] ) ) {
|
32 |
+
add_filter( 'style_loader_src', array( $this, 'sbp_remove_query_strings_1' ), 15, 1 );
|
33 |
+
}
|
34 |
+
|
35 |
+
if ( !is_admin() and isset( $sbp_options['query_strings'] ) ) {
|
36 |
+
add_filter( 'script_loader_src', array( $this, 'sbp_remove_query_strings_2' ), 15, 1 );
|
37 |
+
}
|
38 |
+
|
39 |
+
if ( !is_admin() and isset( $sbp_options['query_strings'] ) ) {
|
40 |
+
add_filter( 'style_loader_src', array( $this, 'sbp_remove_query_strings_2' ), 15, 1 );
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( !is_admin() and isset( $sbp_options['query_strings'] ) ) {
|
44 |
+
add_filter( 'script_loader_src', array( $this, 'sbp_remove_query_strings_3' ), 15, 1 );
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( !is_admin() and isset( $sbp_options['query_strings'] ) ) {
|
48 |
+
add_filter( 'style_loader_src', array( $this, 'sbp_remove_query_strings_3' ), 15, 1 );
|
49 |
+
}
|
50 |
+
|
51 |
+
} // END public public function __construct
|
52 |
+
|
53 |
+
|
54 |
+
/*--------------------------------------------------------------------------------------------------------
|
55 |
+
Moves scripts to the footer to decrease page load times, while keeping stylesheets in the header
|
56 |
+
---------------------------------------------------------------------------------------------------------*/
|
57 |
+
|
58 |
+
function sbp_move_scripts_to_footer() {
|
59 |
+
|
60 |
+
global $sbp_options;
|
61 |
+
|
62 |
+
if ( !is_admin() and isset( $sbp_options['jquery_to_footer'] ) ) {
|
63 |
+
|
64 |
+
remove_action( 'wp_head', 'wp_print_scripts' );
|
65 |
+
remove_action( 'wp_head', 'wp_print_head_scripts', 9 );
|
66 |
+
remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
} // END function sbp_move_scripts_to_footer
|
71 |
+
|
72 |
+
|
73 |
+
/*----------------------------------------------
|
74 |
+
Show Number of Queries and Page Load Time
|
75 |
+
-----------------------------------------------*/
|
76 |
+
|
77 |
+
function sbp_show_page_load_stats() {
|
78 |
+
$timer_stop = timer_stop( 0, 2 ); // to display milliseconds instead of seconds usethe following: $timer_stop = 1000 * ( float ) timer_stop( 0, 4 );
|
79 |
+
$get_num_queries = get_num_queries();
|
80 |
+
update_option( 'sbp_page_time', $timer_stop );
|
81 |
+
update_option( 'sbp_page_queries', $get_num_queries );
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
/*----------------------------------------------
|
86 |
+
Use Google Libraries
|
87 |
+
-----------------------------------------------*/
|
88 |
+
|
89 |
+
function sbp_use_google_libraries() {
|
90 |
+
|
91 |
+
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/use-google-libraries.php' );
|
92 |
+
|
93 |
+
if ( class_exists( 'JCP_UseGoogleLibraries' ) ) {
|
94 |
+
JCP_UseGoogleLibraries::configure_plugin();
|
95 |
+
|
96 |
+
}
|
97 |
+
|
98 |
+
} // End function sbp_use_google_libraries()
|
99 |
+
|
100 |
+
|
101 |
+
/*----------------------------------------------
|
102 |
+
Defer parsing of JavaScript
|
103 |
+
-----------------------------------------------*/
|
104 |
+
|
105 |
+
function sbp_defer_parsing_of_js ( $url ) {
|
106 |
+
|
107 |
+
if ( FALSE === strpos( $url, '.js' ) ) {
|
108 |
+
return $url;
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( strpos( $url, 'jquery.js' ) ) {
|
112 |
+
return $url;
|
113 |
+
}
|
114 |
+
|
115 |
+
return "$url' defer='defer";
|
116 |
+
|
117 |
+
} // END function sbp_defer_parsing_of_js
|
118 |
+
|
119 |
+
|
120 |
+
/*----------------------------------------------
|
121 |
+
Remove query strings from static resources
|
122 |
+
-----------------------------------------------*/
|
123 |
+
|
124 |
+
function sbp_remove_query_strings_1( $src ) { // remove "?ver" string
|
125 |
+
$rqsfsr = explode( '?ver', $src );
|
126 |
+
return $rqsfsr[0];
|
127 |
+
}
|
128 |
+
|
129 |
+
function sbp_remove_query_strings_2( $src ) { // remove "&ver" string
|
130 |
+
$rqsfsr = explode( '&ver', $src );
|
131 |
+
return $rqsfsr[0];
|
132 |
+
}
|
133 |
+
|
134 |
+
function sbp_remove_query_strings_3( $src ) { // remove "?rev" string from Revolution Slider plugin
|
135 |
+
$rqsfsr = explode( '?rev', $src );
|
136 |
+
return $rqsfsr[0];
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
/*----------------------------------------------
|
141 |
+
Remove junk header tags
|
142 |
+
-----------------------------------------------*/
|
143 |
+
|
144 |
+
public function sbp_junk_header_tags() {
|
145 |
+
|
146 |
+
global $sbp_options;
|
147 |
+
|
148 |
+
// Remove RSD Link from header
|
149 |
+
if ( isset( $sbp_options['remove_rsd_link'] ) ) {
|
150 |
+
remove_action( 'wp_head', 'rsd_link' );
|
151 |
+
}
|
152 |
+
|
153 |
+
// Remove Adjacent Posts links PREV/NEXT
|
154 |
+
if ( isset( $sbp_options['remove_adjacent'] ) ) {
|
155 |
+
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
|
156 |
+
}
|
157 |
+
|
158 |
+
// Remove Windows Live Writer Manifest Link
|
159 |
+
if ( isset( $sbp_options['wml_link'] ) ) {
|
160 |
+
remove_action( 'wp_head', 'wlwmanifest_link' );
|
161 |
+
}
|
162 |
+
|
163 |
+
// Remove WordPress Shortlinks from WP Head
|
164 |
+
if ( isset( $sbp_options['remove_wsl'] ) ) {
|
165 |
+
remove_action( 'wp_head', 'wp_shortlink_wp_head' );
|
166 |
+
}
|
167 |
+
|
168 |
+
} // END public function sbp_junk_header_tags
|
169 |
+
|
170 |
+
|
171 |
+
} // END class Speed_Booster_Pack_Core
|
172 |
+
|
173 |
+
} // END if(!class_exists('Speed_Booster_Pack_Core'))
|
inc/settings.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if( !class_exists( 'Speed_Booster_Pack_Options' ) ) {
|
4 |
+
|
5 |
+
class Speed_Booster_Pack_Options {
|
6 |
+
|
7 |
+
private $sbp_options;
|
8 |
+
|
9 |
+
/*----------------------------------------------
|
10 |
+
Construct the plugin object
|
11 |
+
-----------------------------------------------*/
|
12 |
+
|
13 |
+
public function __construct() {
|
14 |
+
|
15 |
+
add_action( 'admin_init', array( $this, 'sbp_admin_init' ) );
|
16 |
+
add_action( 'admin_menu', array( $this, 'sbp_add_menu' ) );
|
17 |
+
|
18 |
+
} // END public function __construct
|
19 |
+
|
20 |
+
|
21 |
+
public function sbp_admin_init() {
|
22 |
+
|
23 |
+
register_setting( 'speed_booster_settings_group', 'sbp_settings' );
|
24 |
+
|
25 |
+
} // END public function admin_init
|
26 |
+
|
27 |
+
public function sbp_add_menu() {
|
28 |
+
|
29 |
+
// Add a page to manage the plugin's settings
|
30 |
+
global $sbp_settings_page;
|
31 |
+
$sbp_settings_page = add_options_page( 'Speed Booster Options', 'Speed Booster Pack', 'manage_options', 'sbp-options', array( $this, 'sbp_plugin_settings_page' ) );
|
32 |
+
|
33 |
+
} // END public function add_menu()
|
34 |
+
|
35 |
+
|
36 |
+
public function sbp_plugin_settings_page() {
|
37 |
+
|
38 |
+
if( !current_user_can( 'manage_options' ) ) {
|
39 |
+
wp_die(__( 'You do not have sufficient permissions to access this page.' ));
|
40 |
+
}
|
41 |
+
|
42 |
+
|
43 |
+
/*----------------------------------------------
|
44 |
+
Global Variables used on options HTML page
|
45 |
+
----------------------------------------------*/
|
46 |
+
|
47 |
+
global $sbp_options;
|
48 |
+
|
49 |
+
// Global variables used to show the front end page speed and processed queries, in plugin options page
|
50 |
+
$url = get_site_url();
|
51 |
+
$page_time = get_option( 'sbp_page_time' );
|
52 |
+
$page_queries = get_option( 'sbp_page_queries' );
|
53 |
+
$response = wp_remote_get( $url, array() );
|
54 |
+
|
55 |
+
// Render the plugin options page HTML
|
56 |
+
include( SPEED_BOOSTER_PACK_PATH . 'css/dynamic-css.php' );
|
57 |
+
|
58 |
+
// Render the plugin options page HTML
|
59 |
+
include( SPEED_BOOSTER_PACK_PATH . 'inc/template/options.php' );
|
60 |
+
|
61 |
+
} // END public function sbp_plugin_settings_page()
|
62 |
+
|
63 |
+
|
64 |
+
} // END class Speed_Booster_Pack_Options
|
65 |
+
|
66 |
+
} // END if(!class_exists('Speed_Booster_Pack_Options'))
|
inc/template/options.php
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap">
|
2 |
+
|
3 |
+
<div class="sb-pack">
|
4 |
+
|
5 |
+
<h2 class="sbp-icon"><?php echo esc_html( get_admin_page_title() ); ?></h2>
|
6 |
+
|
7 |
+
<div class="welcome-panel">
|
8 |
+
|
9 |
+
<div class="welcome-panel-content">
|
10 |
+
|
11 |
+
<form method="post" action="options.php">
|
12 |
+
|
13 |
+
<?php settings_fields( 'speed_booster_settings_group' ); ?>
|
14 |
+
|
15 |
+
<h3><?php _e( 'Speed Up Your Website!', 'sb-pack' ); ?></h3>
|
16 |
+
|
17 |
+
<div class="welcome-panel-column-container">
|
18 |
+
|
19 |
+
<div class="welcome-panel-column">
|
20 |
+
|
21 |
+
<h4><?php _e( 'Javascripts options', 'sb-pack' ); ?></h4>
|
22 |
+
|
23 |
+
<p>
|
24 |
+
<input id="sbp_settings[jquery_to_footer]" name="sbp_settings[jquery_to_footer]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['jquery_to_footer'] ) ); ?> />
|
25 |
+
<label for="sbp_settings[jquery_to_footer]"><?php _e( 'Move scripts to the footer', 'sb-pack' ); ?></label>
|
26 |
+
</p>
|
27 |
+
|
28 |
+
<p>
|
29 |
+
<input id="sbp_settings[use_google_libs]" name="sbp_settings[use_google_libs]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['use_google_libs'] ) ); ?> />
|
30 |
+
<label for="sbp_settings[use_google_libs]"><?php _e( 'Load JS from Google Libraries', 'sb-pack' ); ?></label>
|
31 |
+
</p>
|
32 |
+
|
33 |
+
<p>
|
34 |
+
<input id="sbp_settings[defer_parsing]" name="sbp_settings[defer_parsing]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['defer_parsing'] ) ); ?> />
|
35 |
+
<label for="sbp_settings[defer_parsing]"><?php _e( 'Defer parsing of javascript files', 'sb-pack' ); ?></label>
|
36 |
+
</p>
|
37 |
+
|
38 |
+
<p>
|
39 |
+
<input id="sbp_settings[query_strings]" name="sbp_settings[query_strings]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['query_strings'] ) ); ?> />
|
40 |
+
<label for="sbp_settings[query_strings]"><?php _e( 'Remove query strings from static resources', 'sb-pack' ); ?></label>
|
41 |
+
</p>
|
42 |
+
|
43 |
+
</div> <!-- END welcome-panel-column -->
|
44 |
+
|
45 |
+
|
46 |
+
<div class="welcome-panel-column">
|
47 |
+
<h4> <?php _e( 'Remove junk header tags', 'sb-pack' ); ?></h4>
|
48 |
+
|
49 |
+
<p>
|
50 |
+
<input id="sbp_settings[remove_rsd_link]" name="sbp_settings[remove_rsd_link]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['remove_rsd_link'] ) ); ?> />
|
51 |
+
<label for="sbp_settings[remove_rsd_link]"><?php _e( 'Remove RSD Link', 'sb-pack' ); ?></label>
|
52 |
+
</p>
|
53 |
+
|
54 |
+
<p>
|
55 |
+
<input id="sbp_settings[remove_wsl]" name="sbp_settings[remove_wsl]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['remove_wsl'] ) ); ?> />
|
56 |
+
<label for="sbp_settings[remove_wsl]"><?php _e( 'Remove WordPress Shortlink', 'sb-pack' ); ?></label>
|
57 |
+
</p>
|
58 |
+
|
59 |
+
<p>
|
60 |
+
<input id="sbp_settings[remove_adjacent]" name="sbp_settings[remove_adjacent]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['remove_adjacent'] ) ); ?> />
|
61 |
+
<label for="sbp_settings[remove_adjacent]"><?php _e( 'Remove Adjacent Posts Links', 'sb-pack' ); ?></label>
|
62 |
+
</p>
|
63 |
+
|
64 |
+
<p>
|
65 |
+
<input id="sbp_settings[wml_link]" name="sbp_settings[wml_link]" type="checkbox" value="1" <?php checked( 1, isset( $sbp_options['wml_link'] ) ); ?> />
|
66 |
+
<label for="sbp_settings[wml_link]"><?php _e( 'Remove Windows Live Writer Manifest', 'sb-pack' ); ?></label>
|
67 |
+
</p>
|
68 |
+
</div> <!-- END welcome-panel-column -->
|
69 |
+
|
70 |
+
|
71 |
+
<div class="welcome-panel-column welcome-panel-last">
|
72 |
+
|
73 |
+
<h4> <?php _e( 'Page Load Stats', 'sb-pack' ); ?></h4>
|
74 |
+
|
75 |
+
<span class="sbp-stats"><?php _e( 'Page loading time:', 'sb-pack' ); ?></span>
|
76 |
+
|
77 |
+
<div class="sbp-progress time">
|
78 |
+
<span></span>
|
79 |
+
</div>
|
80 |
+
|
81 |
+
<div class="sbp-values">
|
82 |
+
<div class="sbp-numbers">
|
83 |
+
<?php echo $page_time; ?> <?php _e( 's', 'sb-pack' ); ?>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<span class="sbp-stats"><?php _e( 'Number of executed queries:', 'sb-pack' ); ?></span>
|
88 |
+
|
89 |
+
<div class="sbp-progress queries">
|
90 |
+
<span></span>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<div class="sbp-values">
|
94 |
+
<div class="sbp-numbers">
|
95 |
+
<?php echo $page_queries; ?> <?php _e( 'q', 'sb-pack' ); ?>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
</div> <!-- END welcome-panel-column welcome-panel-last -->
|
100 |
+
|
101 |
+
</div> <!-- END welcome-panel-column-container -->
|
102 |
+
|
103 |
+
<?php submit_button() ?>
|
104 |
+
|
105 |
+
</form>
|
106 |
+
|
107 |
+
</div> <!-- END welcome-panel-content -->
|
108 |
+
|
109 |
+
</div> <!-- END welcome-panel -->
|
110 |
+
|
111 |
+
<!-- START docs and version areas -->
|
112 |
+
|
113 |
+
<div class="sbp-title-div">
|
114 |
+
<div class="sbp-title">
|
115 |
+
<?php _e( 'What do these settings mean?', 'sb-pack' ); ?>
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<div class="sbp-box"><!-- start sbp-box div 1 -->
|
120 |
+
|
121 |
+
<div class="sbp-box-legend">
|
122 |
+
<i class="sbp-icon-help"></i>
|
123 |
+
</div>
|
124 |
+
|
125 |
+
<p><a href="http://tiguandesign.com/docs/speed-booster/" target="_blank" title="Documentation"><?php _e( 'Read online plugin documentation', 'sb-pack' ); ?></a><?php _e( ' with guidelines to modify/enhance your website.', 'sb-pack' ); ?></p>
|
126 |
+
|
127 |
+
</div> <!-- end sbp-box div 1-->
|
128 |
+
|
129 |
+
<div class="sbp-title-div">
|
130 |
+
<div class="sbp-title">
|
131 |
+
<?php _e( 'Version Information', 'sb-pack' ); ?>
|
132 |
+
</div>
|
133 |
+
</div>
|
134 |
+
|
135 |
+
<div class="sbp-box"><!-- start sbp-box div 2 -->
|
136 |
+
|
137 |
+
<div class="sbp-box-version">
|
138 |
+
<i class="sbp-icon-version"></i>
|
139 |
+
</div>
|
140 |
+
|
141 |
+
<div class="sbp-infos">
|
142 |
+
<?php _e( 'Installed Version:', 'sb-pack' ); ?>
|
143 |
+
<span>
|
144 |
+
<?php echo SPEED_BOOSTER_PACK_VERSION; ?>
|
145 |
+
</span>
|
146 |
+
</div>
|
147 |
+
|
148 |
+
<div class="sbp-infos">
|
149 |
+
<?php _e( 'Released date:', 'sb-pack' ); ?>
|
150 |
+
<span>
|
151 |
+
<?php echo SPEED_BOOSTER_PACK_RELEASE_DATE; ?>
|
152 |
+
</span>
|
153 |
+
</div>
|
154 |
+
|
155 |
+
</div> <!-- end sbp-box div 2 -->
|
156 |
+
|
157 |
+
<!-- END docs and version areas -->
|
158 |
+
|
159 |
+
</div> <!-- END sb-pack-->
|
160 |
+
|
161 |
+
</div> <!-- end wrap div -->
|
inc/use-google-libraries.php
ADDED
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Use Google Libraries 1.5.2 => Allows your site to use common javascript libraries from Google's AJAX Libraries CDN, rather than from WordPress's own copies. */
|
3 |
+
/* http://jasonpenney.net/wordpress-plugins/use-google-libraries/ */
|
4 |
+
/* Author & copyright (c) 2008-2013 : Jason Penney (email : jpenney@jczorkmid.net ). General Public License v.2.0 */
|
5 |
+
|
6 |
+
|
7 |
+
if ( !class_exists( 'JCP_UseGoogleLibraries' ) ) {
|
8 |
+
|
9 |
+
class JCP_UseGoogleLibraries {
|
10 |
+
|
11 |
+
private static $instance;
|
12 |
+
private static $version = '1.5.2';
|
13 |
+
public static function get_instance() {
|
14 |
+
if ( !isset( self::$instance ) ) {
|
15 |
+
self::$instance = new JCP_UseGoogleLibraries();
|
16 |
+
}
|
17 |
+
return self::$instance;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Registry of script replacement rules
|
22 |
+
*
|
23 |
+
* Entries are formatted as follows:
|
24 |
+
* <code>
|
25 |
+
* 'script-handle' => array(
|
26 |
+
* 'google-lib-path',
|
27 |
+
* 'google-file-name',
|
28 |
+
* 'google-combined-into')
|
29 |
+
* </code>
|
30 |
+
*
|
31 |
+
* - 'script-handle' -- the handle used by WordPress script
|
32 |
+
* registration
|
33 |
+
* - 'google-lib-path' -- path to location on Google CDN( empty
|
34 |
+
* string if script has been combined).
|
35 |
+
* - 'google-file-name' -- file name (minus .js) on Google CDN (empty
|
36 |
+
* string if script has been combined).
|
37 |
+
* - 'google-combined-into' -- If not empty string, then the given
|
38 |
+
* handle has been combined into a file loaded by this handle.
|
39 |
+
*
|
40 |
+
* @var array
|
41 |
+
*/
|
42 |
+
protected $google_scripts;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Used internally to ensure jQuery.noconflict is executed as close to
|
46 |
+
* how core WordPress would.
|
47 |
+
*
|
48 |
+
* @var bool
|
49 |
+
*/
|
50 |
+
protected $noconflict_next;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* script id used for actual jquery script
|
54 |
+
*
|
55 |
+
* @var string
|
56 |
+
*
|
57 |
+
* @since 5.2
|
58 |
+
*/
|
59 |
+
protected $jquery_tag;
|
60 |
+
|
61 |
+
/**
|
62 |
+
* True if using a version of WordPress that allows
|
63 |
+
* `wp_register_script` to take protocol-relative URLs, otherwise False
|
64 |
+
*
|
65 |
+
* @since 1.5.2
|
66 |
+
*
|
67 |
+
* @var bool
|
68 |
+
*/
|
69 |
+
protected $protocol_relative_supported;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* transient name used when caching
|
73 |
+
*
|
74 |
+
* @var string
|
75 |
+
*/
|
76 |
+
protected static $cache_id = 'JCP_UseGoogleLibraries_cache';
|
77 |
+
|
78 |
+
/**
|
79 |
+
* transient expiration
|
80 |
+
*
|
81 |
+
* @var int
|
82 |
+
*/
|
83 |
+
protected static $cache_len = 90000; // 25 hours
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Message displayed and logged when a WP_Scripts has been created before it's time
|
87 |
+
*
|
88 |
+
* @var unknown_type
|
89 |
+
*/
|
90 |
+
protected static $script_before_init_notice =
|
91 |
+
'Another plugin has registered or enqued a script before the "init" action. Attempting to work around it.';
|
92 |
+
|
93 |
+
/**
|
94 |
+
* PHP 4 Compatible Constructor
|
95 |
+
*/
|
96 |
+
function JCP_UseGoogleLibraries() {$this->__construct();}
|
97 |
+
|
98 |
+
/**
|
99 |
+
* PHP 5 Constructor
|
100 |
+
*/
|
101 |
+
function __construct() {
|
102 |
+
$this->jquery_tag = 'jquery';
|
103 |
+
$this->google_scripts =
|
104 |
+
array(
|
105 |
+
// any extra scripts listed here not provided by WordPress
|
106 |
+
// or another plugin will not be registered. This list
|
107 |
+
// is just used to chancge where things load from.
|
108 |
+
|
109 |
+
// 'script-handle' => ( 'google-lib-path', 'google-file-name', 'google-combined-into')
|
110 |
+
/* jQuery */
|
111 |
+
'jquery' => array( 'jquery', 'jquery.min', '' ),
|
112 |
+
|
113 |
+
/* jQuery UI */
|
114 |
+
'jquery-ui-core' => array( 'jqueryui', 'jquery-ui.min', '' ),
|
115 |
+
'jquery-ui-accordion' => array( '', '', 'jquery-ui-core' ),
|
116 |
+
'jquery-ui-autocomplete' => array( '', '', 'jquery-ui-core' ), /* jQueri UI 1.8 */
|
117 |
+
'jquery-ui-button' => array( '', '', 'jquery-ui-core' ), /* jQuery UI 1.8 */
|
118 |
+
'jquery-ui-datepicker' => array( '', '', 'jquery-ui-core' ),
|
119 |
+
'jquery-ui-dialog' => array( '', '', 'jquery-ui-core' ),
|
120 |
+
'jquery-ui-draggable' => array( '', '', 'jquery-ui-core' ),
|
121 |
+
'jquery-ui-droppable' => array( '', '', 'jquery-ui-core' ),
|
122 |
+
'jquery-ui-menu' => array( '', '', 'jquery-ui-core' ),
|
123 |
+
'jquery-ui-mouse' => array( '', '', 'jquery-ui-core' ), /* jQuery UI 1.8 */
|
124 |
+
'jquery-ui-position' => array( '', '', 'jquery-ui-core' ), /* jQuery UI 1.8 */
|
125 |
+
'jquery-ui-progressbar' => array( '', '', 'jquery-ui-core' ),
|
126 |
+
'jquery-ui-resizable' => array( '', '', 'jquery-ui-core' ),
|
127 |
+
'jquery-ui-selectable' => array( '', '', 'jquery-ui-core' ),
|
128 |
+
'jquery-ui-slider' => array( '', '', 'jquery-ui-core' ),
|
129 |
+
'jquery-ui-sortable' => array( '', '', 'jquery-ui-core' ),
|
130 |
+
'jquery-ui-tabs' => array( '', '', 'jquery-ui-core' ),
|
131 |
+
'jquery-ui-widget' => array( '', '', 'jquery-ui-core' ), /* jQuery UI 1.8 */
|
132 |
+
|
133 |
+
/* jQuery Effects */
|
134 |
+
'jquery-effects-core' => array( '', '', 'jquery-ui-core' ),
|
135 |
+
'jquery-effects-blind' => array( '', '', 'jquery-ui-core' ),
|
136 |
+
'jquery-effects-bounce' => array( '', '', 'jquery-ui-core' ),
|
137 |
+
'jquery-effects-clip' => array( '', '', 'jquery-ui-core' ),
|
138 |
+
'jquery-effects-drop' => array( '', '', 'jquery-ui-core' ),
|
139 |
+
'jquery-effects-explode' => array( '', '', 'jquery-ui-core' ),
|
140 |
+
'jquery-effects-fade' => array( '', '', 'jquery-ui-core' ), /* jQuery UI 1.8 */
|
141 |
+
'jquery-effects-fold' => array( '', '', 'jquery-ui-core' ),
|
142 |
+
'jquery-effects-highlight' => array( '', '', 'jquery-ui-core' ),
|
143 |
+
'jquery-effects-pulsate' => array( '', '', 'jquery-ui-core' ),
|
144 |
+
'jquery-effects-scale' => array( '', '', 'jquery-ui-core' ),
|
145 |
+
'jquery-effects-shake' => array( '', '', 'jquery-ui-core' ),
|
146 |
+
'jquery-effects-slide' => array( '', '', 'jquery-ui-core' ),
|
147 |
+
'jquery-effects-transfer' => array( '', '', 'jquery-ui-core' ),
|
148 |
+
|
149 |
+
/* prototype */
|
150 |
+
'prototype' => array( 'prototype', 'prototype', '' ),
|
151 |
+
|
152 |
+
/* scriptaculous */
|
153 |
+
'scriptaculous-root' => array( 'scriptaculous', 'scriptaculous', '' ),
|
154 |
+
'scriptaculous-builder' => array( '', '', 'scriptaculous-root' ),
|
155 |
+
'scriptaculous-effects' => array( '', '', 'scriptaculous-root' ),
|
156 |
+
'scriptaculous-dragdrop' => array( '', '', 'scriptaculous-root' ),
|
157 |
+
'scriptaculous-controls' => array( '', '', 'scriptaculous-root' ),
|
158 |
+
'scriptaculous-slider' => array( '', '', 'scriptaculous-root' ),
|
159 |
+
'scriptaculous-sound' => array( '', '', 'scriptaculous-root' ),
|
160 |
+
|
161 |
+
/* moo tools */
|
162 |
+
'mootools' => array( 'mootools', 'mootools-yui-compressed', '' ),
|
163 |
+
|
164 |
+
/* Dojo */
|
165 |
+
'dojo' => array( 'dojo', 'dojo.xd', '' ),
|
166 |
+
|
167 |
+
/* swfobject */
|
168 |
+
'swfobject' => array( 'swfobject', 'swfobject', '' ),
|
169 |
+
|
170 |
+
/* YUI */
|
171 |
+
'yui' => array( 'yui', 'build/yuiloader/yuiloader-min', '' ),
|
172 |
+
|
173 |
+
/* Ext Core */
|
174 |
+
'ext-core' => array( 'ext-core', 'ext-core', '' )
|
175 |
+
|
176 |
+
);
|
177 |
+
$this->noconflict_next = FALSE;
|
178 |
+
// protocol-relative URLS accepted by `wp_register_scripts`
|
179 |
+
// starting with version 3.5
|
180 |
+
$this->protocol_relative_supported = version_compare( get_bloginfo( 'version' ), '3.5', '>=' );
|
181 |
+
}
|
182 |
+
|
183 |
+
static function configure_plugin() {
|
184 |
+
add_action( 'wp_default_scripts',
|
185 |
+
array( 'JCP_UseGoogleLibraries',
|
186 |
+
'replace_default_scripts_action' ),
|
187 |
+
1000 );
|
188 |
+
add_filter( 'script_loader_src',
|
189 |
+
array( "JCP_UseGoogleLibraries", "remove_ver_query_filter" ),
|
190 |
+
1000 );
|
191 |
+
add_filter( 'init', array( "JCP_UseGoogleLibraries", "setup_filter" ) );
|
192 |
+
|
193 |
+
// There's a chance some plugin has called wp_enqueue_script outside
|
194 |
+
// of any hooks, which means that this plugin's 'wp_default_scripts'
|
195 |
+
// hook will never get a chance to fire. This tries to work around
|
196 |
+
// that.
|
197 |
+
global $wp_scripts;
|
198 |
+
if ( is_a( $wp_scripts, 'WP_Scripts' ) ) {
|
199 |
+
self::debug( self::$script_before_init_notice );
|
200 |
+
$ugl = self::get_instance();
|
201 |
+
$ugl->replace_default_scripts( $wp_scripts );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Get markup to show error message in admin when $WP_Script created befor it's time
|
207 |
+
* @returns string markup for notice display
|
208 |
+
*/
|
209 |
+
static function script_before_init_admin_notice() {
|
210 |
+
echo '<div class="error fade"><p>Use Google Libraries: ' . self::$script_before_init_notice . '</p></div>';
|
211 |
+
}
|
212 |
+
|
213 |
+
static function setup_filter() {
|
214 |
+
$ugl = self::get_instance();
|
215 |
+
$ugl->setup();
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Log message if `WP_DEBUG` enabled.
|
220 |
+
*
|
221 |
+
* @since 1.5
|
222 |
+
*
|
223 |
+
* @param mixed $message string to log, or object to log via `print_r`
|
224 |
+
*/
|
225 |
+
static function debug( $message ) {
|
226 |
+
if ( WP_DEBUG !== false ) {
|
227 |
+
if ( is_array( $message ) || is_object( $message ) ) {
|
228 |
+
$message = print_r( $message, true );
|
229 |
+
}
|
230 |
+
error_log( "Use Google Libraries: " . $message );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Disables script concatination, which breaks when dependencies are not
|
236 |
+
* all loaded locally.
|
237 |
+
*/
|
238 |
+
function setup() {
|
239 |
+
global $concatenate_scripts;
|
240 |
+
$concatenate_scripts = false;
|
241 |
+
|
242 |
+
}
|
243 |
+
|
244 |
+
|
245 |
+
static function replace_default_scripts_action( &$scripts ) {
|
246 |
+
$ugl = self::get_instance();
|
247 |
+
$ugl->replace_default_scripts( $scripts );
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Collects replacement script registration data.
|
252 |
+
*
|
253 |
+
* Processes standard WordPress script registrations against list of
|
254 |
+
* scripts hosted on Google's CDN. Will exclude any scripts that
|
255 |
+
* contain '-' in the version number (used by WordPress devs to signify
|
256 |
+
* a non-standard version). Also, the new url will be queried to ensure
|
257 |
+
* it's valid (via `wp_remote_head`).
|
258 |
+
*
|
259 |
+
* @since 1.5
|
260 |
+
*
|
261 |
+
* @param object $scripts WP_Scripts object
|
262 |
+
* @return array updated script registration data
|
263 |
+
*/
|
264 |
+
function build_newscripts( &$scripts ) {
|
265 |
+
$newscripts = array();
|
266 |
+
$combine_ok = array();
|
267 |
+
|
268 |
+
// jquery may really be loaded under jquery-core
|
269 |
+
// if so, we'll adjust google_scripts here
|
270 |
+
if ( $scripts->query( 'jquery-core' ) && array_key_exists( 'jquery', $this->google_scripts ) ) {
|
271 |
+
$this->google_scripts['jquery-core'] = $this->google_scripts['jquery'];
|
272 |
+
unset($this->google_scripts['jquery']);
|
273 |
+
$this->jquery_tag = 'jquery-core';
|
274 |
+
}
|
275 |
+
|
276 |
+
foreach ( $this->google_scripts as $name => $values ) {
|
277 |
+
if ( $script = $scripts->query( $name ) ) {
|
278 |
+
$lib = $values[0];
|
279 |
+
$js = $values[1];
|
280 |
+
$combined = $values[2];
|
281 |
+
// default to requested ver
|
282 |
+
$ver = $script->ver;
|
283 |
+
|
284 |
+
if ( strpos( $ver, '-' ) !== false ) {
|
285 |
+
self::debug( "WordPress appears to be requesting a non-standard version of $name (version $ver). Using version provided by WordPress to ensure compatability." );
|
286 |
+
continue;
|
287 |
+
}
|
288 |
+
|
289 |
+
// TODO: replace with more flexible option
|
290 |
+
// quick and dirty work around for scriptaculous 1.8.0
|
291 |
+
if ( $name == 'scriptaculous-root' && $ver == '1.8.0' ) {
|
292 |
+
$ver = '1.8';
|
293 |
+
}
|
294 |
+
|
295 |
+
if ( $combined !== '' ) {
|
296 |
+
if ( ! in_array( $combined, $combine_ok ) ) {
|
297 |
+
self::debug( "Google servers not hosting combined library for $name (version $ver). Using version provided by WordPress to ensure compatability." );
|
298 |
+
continue;
|
299 |
+
}
|
300 |
+
if ( ! in_array( $combined, $script->deps ) ) {
|
301 |
+
// if this script has been combined into another script
|
302 |
+
// ensure this handle depends on the combined handle
|
303 |
+
$script->deps[] = $combined;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
// if $lib is empty, then this script does not need to be
|
308 |
+
// exlicitly loaded when using googleapis.com, but we need to keep
|
309 |
+
// it around for dependencies
|
310 |
+
if ( $lib != '' ) {
|
311 |
+
// build new URL
|
312 |
+
$url = "//ajax.googleapis.com/ajax/libs/$lib/$ver/$js.js";
|
313 |
+
if ( wp_remote_retrieve_response_code( wp_remote_head( "http:$url" ) ) !== 200 ) {
|
314 |
+
self::debug( "Google servers do not seem to be hosting requested version of $name (version $ver). Using version provided by WordPress." );
|
315 |
+
continue;
|
316 |
+
}
|
317 |
+
if ( ! $this->protocol_relative_supported ) {
|
318 |
+
$url = "http:$url";
|
319 |
+
}
|
320 |
+
$script->src = $url;
|
321 |
+
} else {
|
322 |
+
$script->src = "";
|
323 |
+
}
|
324 |
+
$newscripts[] = $script;
|
325 |
+
$combine_ok[] = $name;
|
326 |
+
}
|
327 |
+
}
|
328 |
+
return $newscripts;
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
/**
|
334 |
+
* Get new script registration data.
|
335 |
+
*
|
336 |
+
* Attempts to load script registration data from the transient cache.
|
337 |
+
* If not in cache, or if cached data is from a different version of
|
338 |
+
* either WordPress or this plug-in, then it will be rebuilt. Also
|
339 |
+
* handles forcing URLS to use SSL if site is currently loaded over
|
340 |
+
* SSL.
|
341 |
+
*
|
342 |
+
* @since 1.5
|
343 |
+
*
|
344 |
+
* @param object $scripts WP_Scripts object
|
345 |
+
* @return array updated script registration data
|
346 |
+
*/
|
347 |
+
function get_newscripts( &$scripts ) {
|
348 |
+
$wp_ver = get_bloginfo( 'version' );
|
349 |
+
if ( false === ( $cache = get_transient( self::$cache_id ) ) ) {
|
350 |
+
$cache = array();
|
351 |
+
}
|
352 |
+
if ( ( ! isset( $cache['ugl_ver'] ) ) || ( $cache['ugl_ver'] !== self::$version ) ||
|
353 |
+
( ! isset( $cache['wp_ver'] ) ) || ( $cache['wp_ver'] !== $wp_ver ) ||
|
354 |
+
( ! isset( $cache['newscripts'] ) ) ) {
|
355 |
+
$newscripts = $this->build_newscripts( $scripts );
|
356 |
+
$cache = array(
|
357 |
+
'ugl_ver' => self::$version,
|
358 |
+
'wp_ver' => $wp_ver,
|
359 |
+
'newscripts' => $newscripts,
|
360 |
+
);
|
361 |
+
set_transient( self::$cache_id, $cache, self::$cache_len );
|
362 |
+
} else {
|
363 |
+
$newscripts = $cache['newscripts'];
|
364 |
+
}
|
365 |
+
// need to handle ssl after cache load, because it may swap
|
366 |
+
// back and forth depending on the site config/usage
|
367 |
+
if ( ( ! $this->protocol_relative_supported ) && ( is_ssl() ) ) {
|
368 |
+
foreach ( $newscripts as $script ) {
|
369 |
+
$script->src = preg_replace( '/^http:/', 'https:', $script->src );
|
370 |
+
}
|
371 |
+
}
|
372 |
+
return $newscripts;
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Replace as many of the WordPress default script registrations as
|
377 |
+
* possible with ones from Google
|
378 |
+
*
|
379 |
+
* @param object $scripts WP_Scripts object.
|
380 |
+
*/
|
381 |
+
function replace_default_scripts( &$scripts ) {
|
382 |
+
$newscripts = $this->get_newscripts( $scripts );
|
383 |
+
foreach ( $newscripts as $script ) {
|
384 |
+
$olddata = $this->WP_Dependency_get_data( $scripts, $script->handle );
|
385 |
+
$scripts->remove( $script->handle );
|
386 |
+
// re-register with original ver
|
387 |
+
$scripts->add( $script->handle, $script->src, $script->deps, $script->ver );
|
388 |
+
if ( $olddata ) {
|
389 |
+
foreach ( $olddata as $data_name => $data ) {
|
390 |
+
$scripts->add_data( $script->handle, $data_name, $data );
|
391 |
+
}
|
392 |
+
}
|
393 |
+
}
|
394 |
+
}
|
395 |
+
|
396 |
+
|
397 |
+
function WP_Dependency_get_data( $dep_obj, $handle, $data_name = false ) {
|
398 |
+
|
399 |
+
if ( !method_exists( $dep_obj, 'add_data' ) )
|
400 |
+
return false;
|
401 |
+
|
402 |
+
if ( !isset( $dep_obj->registered[$handle] ) )
|
403 |
+
return false;
|
404 |
+
|
405 |
+
if ( !$data_name )
|
406 |
+
return $dep_obj->registered[$handle]->extra;
|
407 |
+
|
408 |
+
if ( !method_exists( $dep_obj, 'get_data' ) )
|
409 |
+
return $dep_obj->registered[$handle]->extra[$data_name];
|
410 |
+
|
411 |
+
return $dep_obj->get_data( $handle, $data_name );
|
412 |
+
}
|
413 |
+
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Remove 'ver' from query string for scripts loaded from Google's
|
417 |
+
* CDN
|
418 |
+
*
|
419 |
+
* @param string $src src attribute of script tag
|
420 |
+
* @return string Updated src attribute
|
421 |
+
*/
|
422 |
+
function remove_ver_query( $src ) {
|
423 |
+
if ( $this->noconflict_next ) {
|
424 |
+
$this->noconflict_next = FALSE;
|
425 |
+
echo "<script type='text/javascript'>try{jQuery.noConflict();}catch(e){};</script>\n";
|
426 |
+
}
|
427 |
+
if ( preg_match( '/ajax\.googleapis\.com\//', $src ) ) {
|
428 |
+
$src = remove_query_arg( 'ver', $src );
|
429 |
+
if ( strpos( $src, $this->google_scripts[$this->jquery_tag][1] . ".js" ) ) {
|
430 |
+
$this->noconflict_next = TRUE;
|
431 |
+
}
|
432 |
+
}
|
433 |
+
return $src;
|
434 |
+
}
|
435 |
+
|
436 |
+
static function remove_ver_query_filter( $src ) {
|
437 |
+
$ugl = self::get_instance();
|
438 |
+
return $ugl->remove_ver_query( $src );
|
439 |
+
}
|
440 |
+
}
|
441 |
+
}
|
lang/sb-pack.mo
ADDED
Binary file
|
lang/sb-pack.po
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
4 |
+
"Content-Transfer-Encoding: 8bit\n"
|
5 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
6 |
+
"Project-Id-Version: Speed Booster Pack 1.0\n"
|
7 |
+
"POT-Creation-Date: \n"
|
8 |
+
"PO-Revision-Date: \n"
|
9 |
+
"Last-Translator: Liviu Costache <tiguan@tiguandesign.com>\n"
|
10 |
+
"Language-Team: Tiguandesign <tiguan@tiguandesign.com>\n"
|
11 |
+
"MIME-Version: 1.0\n"
|
12 |
+
"Language: en\n"
|
13 |
+
"X-Generator: Poedit 1.6.5\n"
|
14 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
16 |
+
"X-Poedit-SearchPath-0: ..\n"
|
17 |
+
|
18 |
+
#. Text in echo
|
19 |
+
#: speed-booster-pack/inc/template/options.php:125
|
20 |
+
msgid " with guidelines to modify/enhance your website."
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#. Text in echo
|
24 |
+
#: speed-booster-pack/inc/template/options.php:35
|
25 |
+
msgid "Defer parsing of javascript files"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#. Text in echo
|
29 |
+
#: speed-booster-pack/inc/template/options.php:142
|
30 |
+
msgid "Installed Version:"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#. Text in echo
|
34 |
+
#: speed-booster-pack/inc/template/options.php:21
|
35 |
+
msgid "Javascripts options"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#. Text in echo
|
39 |
+
#: speed-booster-pack/inc/template/options.php:30
|
40 |
+
msgid "Load JS from Google Libraries"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#. Text in echo
|
44 |
+
#: speed-booster-pack/inc/template/options.php:25
|
45 |
+
msgid "Move scripts to the footer"
|
46 |
+
msgstr ""
|
47 |
+
|
48 |
+
#. Text in echo
|
49 |
+
#: speed-booster-pack/inc/template/options.php:87
|
50 |
+
msgid "Number of executed queries:"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#. Text in echo
|
54 |
+
#: speed-booster-pack/inc/template/options.php:73
|
55 |
+
msgid "Page Load Stats"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#. Text in echo
|
59 |
+
#: speed-booster-pack/inc/template/options.php:75
|
60 |
+
msgid "Page loading time:"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#. Text in echo
|
64 |
+
#: speed-booster-pack/inc/template/options.php:125
|
65 |
+
msgid "Read online plugin documentation"
|
66 |
+
msgstr ""
|
67 |
+
|
68 |
+
#. Text in echo
|
69 |
+
#: speed-booster-pack/inc/template/options.php:149
|
70 |
+
msgid "Released date:"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#. Text in echo
|
74 |
+
#: speed-booster-pack/inc/template/options.php:61
|
75 |
+
msgid "Remove Adjacent Posts Links"
|
76 |
+
msgstr ""
|
77 |
+
|
78 |
+
#. Text in echo
|
79 |
+
#: speed-booster-pack/inc/template/options.php:51
|
80 |
+
msgid "Remove RSD Link"
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#. Text in echo
|
84 |
+
#: speed-booster-pack/inc/template/options.php:66
|
85 |
+
msgid "Remove Windows Live Writer Manifest"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#. Text in echo
|
89 |
+
#: speed-booster-pack/inc/template/options.php:56
|
90 |
+
msgid "Remove WordPress Shortlink"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#. Text in echo
|
94 |
+
#: speed-booster-pack/inc/template/options.php:47
|
95 |
+
msgid "Remove junk header tags"
|
96 |
+
msgstr ""
|
97 |
+
|
98 |
+
#. Text in echo
|
99 |
+
#: speed-booster-pack/inc/template/options.php:40
|
100 |
+
msgid "Remove query strings from static resources"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#. Text in echo
|
104 |
+
#: speed-booster-pack/inc/template/options.php:15
|
105 |
+
msgid "Speed Up Your Website!"
|
106 |
+
msgstr ""
|
107 |
+
|
108 |
+
#. Text in echo
|
109 |
+
#: speed-booster-pack/inc/template/options.php:131
|
110 |
+
msgid "Version Information"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#. Text in echo
|
114 |
+
#: speed-booster-pack/inc/template/options.php:115
|
115 |
+
msgid "What do these settings mean?"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#. Text in echo
|
119 |
+
#: speed-booster-pack/inc/template/options.php:95
|
120 |
+
msgid "q"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#. Text in echo
|
124 |
+
#: speed-booster-pack/inc/template/options.php:83
|
125 |
+
msgid "s"
|
126 |
+
msgstr ""
|
readme.txt
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Speed Booster Pack ===
|
2 |
+
Contributors: tiguan
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EH65WAWPEYPXU
|
4 |
+
Tags: speed, optimization, performance, speed booster, scripts to the footer, Google Libraries, CDN, defer parsing of javascript, remove query strings, GTmetrix, Google PageSpeed, YSlow
|
5 |
+
Requires at least: 3.6
|
6 |
+
Tested up to: 3.9.1
|
7 |
+
Stable tag: 1.1
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Features options to improve your website performance and get a higher score on the major speed testing services.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Speed Booster Pack allows you to improve your page loading speed and get a higher score on the major speed testing services such as [GTmetrix](http://gtmetrix.com/), [Google PageSpeed](http://developers.google.com/speed/pagespeed/insights/), *YSlow* or other speed testing tools.
|
16 |
+
|
17 |
+
= Features =
|
18 |
+
|
19 |
+
* **Moves scripts to the footer** to improve page loading speed.
|
20 |
+
* **Loads javascript files from Google Libraries** rather than serving them from your WordPress install directly, to reduce latency, increase parallelism and improve caching.
|
21 |
+
* **Defers parsing of javascript files** to reduce the initial load time of your page.
|
22 |
+
* **Removes query strings from static resources** to improve your speed scores.
|
23 |
+
* **Removes junk header tags** to clean up your WordPress Header.
|
24 |
+
* **Page Load Stats** - is a brief statistic displayed in the plugin options page. It displays your homepage loading speed (in seconds) and number of processed queries.
|
25 |
+
|
26 |
+
**Page loading time** – the progress bar color will be:
|
27 |
+
|
28 |
+
* *green* if the page load takes less than a second
|
29 |
+
* *orange* when loading the page takes between 1 and 2 seconds
|
30 |
+
* *red* if the page loading takes longer than 2 seconds
|
31 |
+
|
32 |
+
**Number of executed queries** – the progress bar color will be:
|
33 |
+
|
34 |
+
* *green* if there were less than 100 queries
|
35 |
+
* *orange* if there were between 100 and 200 queries
|
36 |
+
* *red* if the page required more than 200 queries
|
37 |
+
|
38 |
+
For complete usage instructions visit [Plugin Documentation](http://tiguandesign.com/docs/speed-booster/)
|
39 |
+
|
40 |
+
== Installation ==
|
41 |
+
|
42 |
+
1. Download the plugin (.zip file) on your hard drive.
|
43 |
+
2. Unzip the zip file contents.
|
44 |
+
3. Upload the `speed-booster-pack` folder to the `/wp-content/plugins/` directory.
|
45 |
+
4. Activate the plugin through the 'Plugins' menu in WordPress.
|
46 |
+
5. A new sub menu item `Speed Booster Pack` will appear in your main Settings menu.
|
47 |
+
|
48 |
+
== Screenshots ==
|
49 |
+
1. Plugin options page, simple view (v1.0)
|
speed-booster-pack.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Speed Booster Pack
|
4 |
+
* Plugin URI: http://tiguandesign.com
|
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: 1.1
|
7 |
+
* Author: Tiguan
|
8 |
+
* Author URI: http://themeforest.net/user/Tiguan
|
9 |
+
* License: GPLv2
|
10 |
+
*/
|
11 |
+
|
12 |
+
/* Copyright 2014 Tiguan (email : themesupport [at] tiguandesign [dot] com)
|
13 |
+
|
14 |
+
This program is free software; you can redistribute it and/or modify
|
15 |
+
it under the terms of the GNU General Public License as published by
|
16 |
+
the Free Software Foundation; either version 2 of the License, or
|
17 |
+
(at your option) any later version.
|
18 |
+
|
19 |
+
This program is distributed in the hope that it will be useful,
|
20 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
+
GNU General Public License for more details.
|
23 |
+
|
24 |
+
You should have received a copy of the GNU General Public License
|
25 |
+
along with this program; if not, write to the Free Software
|
26 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
+
*/
|
28 |
+
|
29 |
+
/*----------------------------------------------
|
30 |
+
Global Variables
|
31 |
+
----------------------------------------------*/
|
32 |
+
|
33 |
+
$sbp_options = get_option( 'sbp_settings', 'checked' ); // retrieve the plugin settings from the options table
|
34 |
+
|
35 |
+
/*----------------------------------------------
|
36 |
+
Define some useful plugin constants
|
37 |
+
----------------------------------------------*/
|
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', 'v1.0'); // Defining plugin version
|
42 |
+
|
43 |
+
|
44 |
+
/*----------------------------------------------
|
45 |
+
Main Plugin Class
|
46 |
+
----------------------------------------------*/
|
47 |
+
|
48 |
+
if ( !class_exists( 'Speed_Booster_Pack' ) ) {
|
49 |
+
|
50 |
+
class Speed_Booster_Pack {
|
51 |
+
|
52 |
+
|
53 |
+
/*----------------------------------------------
|
54 |
+
Function Construct
|
55 |
+
----------------------------------------------*/
|
56 |
+
|
57 |
+
public function __construct() {
|
58 |
+
|
59 |
+
// Load plugin settings page
|
60 |
+
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/settings.php' );
|
61 |
+
$Speed_Booster_Pack_Options = new Speed_Booster_Pack_Options();
|
62 |
+
|
63 |
+
// Load main plugin functions
|
64 |
+
require_once( SPEED_BOOSTER_PACK_PATH . 'inc/core.php' );
|
65 |
+
$Speed_Booster_Pack_Core = new Speed_Booster_Pack_Core();
|
66 |
+
|
67 |
+
// load plugin textdomain
|
68 |
+
load_plugin_textdomain( 'sb-pack', false, dirname( plugin_basename( __FILE__ ) ) . '/lang' );
|
69 |
+
|
70 |
+
// Enqueue admin style
|
71 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'sbp_enqueue_styles' ) );
|
72 |
+
|
73 |
+
// Filters
|
74 |
+
$this->path = plugin_basename( __FILE__ );
|
75 |
+
add_filter( "plugin_action_links_$this->path", array( $this, 'sbp_settings_link' ) );
|
76 |
+
|
77 |
+
} // END public function __construct
|
78 |
+
|
79 |
+
|
80 |
+
/*----------------------------------------------
|
81 |
+
Activate the plugin
|
82 |
+
----------------------------------------------*/
|
83 |
+
|
84 |
+
public static function activate() {
|
85 |
+
|
86 |
+
$timer_stop = timer_stop( 0, 2 );
|
87 |
+
$get_num_queries = get_num_queries();
|
88 |
+
|
89 |
+
if (get_option('sbp_page_time') == '') {
|
90 |
+
update_option( 'sbp_page_time', $timer_stop );
|
91 |
+
}
|
92 |
+
|
93 |
+
if (get_option('sbp_page_queries') == '') {
|
94 |
+
update_option( 'sbp_page_queries', $get_num_queries );
|
95 |
+
}
|
96 |
+
|
97 |
+
} // END public static function activate
|
98 |
+
|
99 |
+
|
100 |
+
/*----------------------------------------------
|
101 |
+
Deactivate the plugin
|
102 |
+
----------------------------------------------*/
|
103 |
+
|
104 |
+
public static function deactivate() {
|
105 |
+
// Nothing to do yet
|
106 |
+
} // END public static function deactivate
|
107 |
+
|
108 |
+
|
109 |
+
/*----------------------------------------------
|
110 |
+
CSS style of the plugin options page
|
111 |
+
----------------------------------------------*/
|
112 |
+
|
113 |
+
function sbp_enqueue_styles( $hook ) {
|
114 |
+
|
115 |
+
// load stylesheet only on plugin options page
|
116 |
+
global $sbp_settings_page;
|
117 |
+
if ( $hook != $sbp_settings_page )
|
118 |
+
return;
|
119 |
+
wp_enqueue_style( 'sbp-styles', plugin_dir_url( __FILE__ ) . 'css/sbp_style.min.css' ); // change to style.dev.css to debug your plugin style
|
120 |
+
|
121 |
+
} // End function sbp_enqueue_styles
|
122 |
+
|
123 |
+
|
124 |
+
/*----------------------------------------------
|
125 |
+
Add settings link on plugins page
|
126 |
+
----------------------------------------------*/
|
127 |
+
|
128 |
+
function sbp_settings_link( $links ) {
|
129 |
+
|
130 |
+
$settings_link = '<a href="options-general.php?page=sbp-options">Settings</a>';
|
131 |
+
array_unshift( $links, $settings_link );
|
132 |
+
return $links;
|
133 |
+
|
134 |
+
} // End function sbp_settings_link
|
135 |
+
|
136 |
+
|
137 |
+
} // End class Speed_Booster_Pack
|
138 |
+
|
139 |
+
} // End if (!class_exists("Speed_Booster_Pack")) (1)
|
140 |
+
|
141 |
+
if( class_exists( 'Speed_Booster_Pack' ) ) {
|
142 |
+
|
143 |
+
// Installation and uninstallation hooks
|
144 |
+
register_activation_hook( __FILE__, array( 'Speed_Booster_Pack', 'activate' ) );
|
145 |
+
register_deactivation_hook( __FILE__, array( 'Speed_Booster_Pack', 'deactivate' ) );
|
146 |
+
|
147 |
+
// instantiate the plugin class
|
148 |
+
$speed_booster_pack = new Speed_Booster_Pack();
|
149 |
+
|
150 |
+
} // End if (!class_exists("Speed_Booster_Pack")) (2)
|