Version Description
Download this release
Release Info
Developer | dipakcg |
Plugin | WP Performance Score Booster |
Version | 1.2.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 1.2.2
languages/wp-performance-score-booster-en_US.mo
ADDED
Binary file
|
languages/wp-performance-score-booster-en_US.po
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WP Performance Score Booster v1.2.2\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2014-12-25 13:04:10+0000\n"
|
7 |
+
"Last-Translator: username <me@dipakgajjar.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: CSL v1.x\n"
|
14 |
+
"X-Poedit-Language: English\n"
|
15 |
+
"X-Poedit-Country: UNITED STATES\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
18 |
+
"X-Poedit-Basepath: ../\n"
|
19 |
+
"X-Poedit-Bookmarks: \n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Textdomain-Support: yes"
|
22 |
+
|
23 |
+
#: wp-performance-score-booster.php:176
|
24 |
+
#: wp-performance-score-booster.php:257
|
25 |
+
#@ wp-performance-score-booster
|
26 |
+
msgid "WP Performance Score Booster Settings"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: wp-performance-score-booster.php:180
|
30 |
+
#@ default
|
31 |
+
msgid "You do not have sufficient permissions to access this page."
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: wp-performance-score-booster.php:211
|
35 |
+
#@ wp-performance-score-booster
|
36 |
+
msgid "Settings Saved."
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: wp-performance-score-booster.php:218
|
40 |
+
#@ wp-performance-score-booster
|
41 |
+
msgid "Remove query strings from static content"
|
42 |
+
msgstr ""
|
43 |
+
|
44 |
+
#: wp-performance-score-booster.php:222
|
45 |
+
#: wp-performance-score-booster.php:225
|
46 |
+
#@ wp-performance-score-booster
|
47 |
+
msgid "Enable GZIP compression (compress text, html, javascript, css, xml and so on)"
|
48 |
+
msgstr ""
|
49 |
+
|
50 |
+
#: wp-performance-score-booster.php:225
|
51 |
+
#@ wp-performance-score-booster
|
52 |
+
msgid "Your web server does not support GZIP compression. Contact your hosting provider to enable it."
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: wp-performance-score-booster.php:229
|
56 |
+
#@ wp-performance-score-booster
|
57 |
+
msgid "Set expire caching (Leverage Browser Caching)"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: wp-performance-score-booster.php:231
|
61 |
+
#@ wp-performance-score-booster
|
62 |
+
msgid "Save Changes"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: wp-performance-score-booster.php:237
|
66 |
+
#@ wp-performance-score-booster
|
67 |
+
msgid "Support this plugin and donate"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#: wp-performance-score-booster.php:238
|
71 |
+
#@ wp-performance-score-booster
|
72 |
+
msgid "Rate this plugin on WordPress.org"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: wp-performance-score-booster.php:239
|
76 |
+
#@ wp-performance-score-booster
|
77 |
+
msgid "Get support on on WordPress.org"
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#: wp-performance-score-booster.php:240
|
81 |
+
#@ wp-performance-score-booster
|
82 |
+
msgid "Contribute development on GitHub"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: wp-performance-score-booster.php:241
|
86 |
+
#@ wp-performance-score-booster
|
87 |
+
msgid "Get my other plugins"
|
88 |
+
msgstr ""
|
89 |
+
|
90 |
+
#: wp-performance-score-booster.php:244
|
91 |
+
#@ wp-performance-score-booster
|
92 |
+
msgid "Version:"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: wp-performance-score-booster.php:257
|
96 |
+
#@ wp-performance-score-booster
|
97 |
+
msgid "WP Performance Score Booster"
|
98 |
+
msgstr ""
|
99 |
+
|
languages/wp-performance-score-booster.pot
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2014 WP Performance Score Booster
|
2 |
+
# This file is distributed under the same license as the WP Performance Score Booster package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WP Performance Score Booster 1.2.2\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-performance-score-booster\n"
|
7 |
+
"POT-Creation-Date: 2014-12-25 11:29:38+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: Dipak C. Gajjar <me@dipakgajjar.com>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: wp-performance-score-booster.php:143
|
16 |
+
msgid "You do not have sufficient permissions to access this page."
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: wp-performance-score-booster.php:194
|
20 |
+
msgid "Save Changes"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#. Plugin Name of the plugin/theme
|
24 |
+
msgid "WP Performance Score Booster"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#. Plugin URI of the plugin/theme
|
28 |
+
msgid "https://github.com/dipakcg/wp-performance-score-booster"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#. Description of the plugin/theme
|
32 |
+
msgid ""
|
33 |
+
"Speed-up page load times and improve website scores in services like "
|
34 |
+
"PageSpeed, YSlow, Pingdom and GTmetrix."
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#. Author of the plugin/theme
|
38 |
+
msgid "Dipak C. Gajjar"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#. Author URI of the plugin/theme
|
42 |
+
msgid "http://www.dipakgajjar.com/"
|
43 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: performance, speed, time, query, strings, gzip, compression, caching, boos
|
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.1
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -42,6 +42,9 @@ Pretty much, yeah.
|
|
42 |
1. Admin Settings
|
43 |
|
44 |
== Changelog ==
|
|
|
|
|
|
|
45 |
= 1.2.1, Nov 17, 2014 =
|
46 |
* Removed (temporarily) feature to enqueue scripts to footer
|
47 |
|
4 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.1
|
7 |
+
Stable tag: 1.2.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
42 |
1. Admin Settings
|
43 |
|
44 |
== Changelog ==
|
45 |
+
= 1.2.2, Dec 27, 2014 =
|
46 |
+
* Added support for language translations
|
47 |
+
|
48 |
= 1.2.1, Nov 17, 2014 =
|
49 |
* Removed (temporarily) feature to enqueue scripts to footer
|
50 |
|
wp-performance-score-booster.php
CHANGED
@@ -3,20 +3,35 @@
|
|
3 |
Plugin Name: WP Performance Score Booster
|
4 |
Plugin URI: https://github.com/dipakcg/wp-performance-score-booster
|
5 |
Description: Speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
|
|
|
6 |
Author: Dipak C. Gajjar
|
7 |
-
|
8 |
-
|
9 |
*/
|
10 |
|
11 |
-
// Define plugin version for future releases
|
12 |
if (!defined('WPPSB_PLUGIN_VERSION')) {
|
13 |
define('WPPSB_PLUGIN_VERSION', 'wppsb_plugin_version');
|
14 |
}
|
15 |
if (!defined('WPPSB_PLUGIN_VERSION_NUM')) {
|
16 |
-
define('WPPSB_PLUGIN_VERSION_NUM', '1.2.
|
17 |
}
|
18 |
update_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
// Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
|
21 |
add_action( 'admin_init', 'wppsb_add_stylesheet' );
|
22 |
function wppsb_add_stylesheet() {
|
@@ -27,44 +42,12 @@ function wppsb_add_stylesheet() {
|
|
27 |
|
28 |
// Remove query strings from static content
|
29 |
function wppsb_remove_query_strings_q( $src ) {
|
30 |
-
$
|
31 |
-
return $
|
32 |
}
|
33 |
function wppsb_remove_query_strings_emp( $src ) {
|
34 |
-
$
|
35 |
-
return $
|
36 |
-
}
|
37 |
-
|
38 |
-
// If 'Remove query strings" checkbox ticked, add filter otherwise remove filter
|
39 |
-
if (get_option('wppsb_remove_query_strings') == 'on') {
|
40 |
-
add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
|
41 |
-
add_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
|
42 |
-
add_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
|
43 |
-
add_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
|
44 |
-
}
|
45 |
-
else {
|
46 |
-
remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q');
|
47 |
-
remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
|
48 |
-
remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp');
|
49 |
-
remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp');
|
50 |
-
}
|
51 |
-
|
52 |
-
// If 'Enable GZIP" checkbox ticked, add filter otherwise remove filter
|
53 |
-
if (get_option('wppsb_enable_gzip') == 'on') {
|
54 |
-
add_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
|
55 |
-
add_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
|
56 |
-
}
|
57 |
-
else {
|
58 |
-
remove_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
|
59 |
-
remove_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
|
60 |
-
}
|
61 |
-
|
62 |
-
// If 'Expire caching" checkbox ticked, add filter otherwise remove filter
|
63 |
-
if (get_option('wppsb_expire_caching') == 'on') {
|
64 |
-
add_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
|
65 |
-
}
|
66 |
-
else {
|
67 |
-
remove_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
|
68 |
}
|
69 |
|
70 |
// Enable GZIP Compression
|
@@ -130,13 +113,27 @@ EOD;
|
|
130 |
return $vary_accept_encoding_header . $rules;
|
131 |
}
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
function wppsb_admin_options() {
|
134 |
?>
|
135 |
<div class="wrap">
|
136 |
<table width="100%" border="0">
|
137 |
<tr>
|
138 |
<td width="75%">
|
139 |
-
<h2><?php echo '<img src="' . plugins_url( 'assets/images/wppsb-icon-24x24.png' , __FILE__ ) . '" > '; ?> WP Performance Score Booster Settings
|
140 |
<hr />
|
141 |
<?php
|
142 |
if ( !current_user_can( 'manage_options' ) ) {
|
@@ -167,44 +164,62 @@ function wppsb_admin_options() {
|
|
167 |
update_option( $enable_gzip, $enable_gzip_val );
|
168 |
update_option( $expire_caching, $expire_caching_val );
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
flush_rewrite_rules();
|
171 |
|
172 |
// Put the settings updated message on the screen
|
173 |
?>
|
174 |
-
<div class="updated"><p><strong
|
175 |
<?php
|
176 |
}
|
177 |
?>
|
178 |
<form method="post" name="options_form">
|
179 |
<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
|
180 |
<p>
|
181 |
-
<input type="checkbox" name="<?php echo $remove_query_strings; ?>" <?php checked( $remove_query_strings_val == 'on',true); ?> /> <span class="wppsb_settings"> Remove query strings from static content </span>
|
182 |
</p>
|
183 |
<p>
|
184 |
<?php if (function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) { ?>
|
185 |
-
<input type="checkbox" name="<?php echo $enable_gzip; ?>" <?php checked( $enable_gzip_val == 'on',true); ?> /> <span class="wppsb_settings"> Enable GZIP compression (compress text, html, javascript, css, xml and so on)</span>
|
186 |
<?php }
|
187 |
else { ?>
|
188 |
-
<input type="checkbox" name="<?php echo $enable_gzip; ?>" disabled="true" <?php checked( $enable_gzip_val == 'on',true); ?> /> <span class="wppsb_settings"> Enable GZIP compression (compress text, html, javascript, css, xml and so on)</span> <br /> <span class="wppsb_settings" style="margin-left:30px; color:RED;">Your web server does not support GZIP compression. Contact your hosting provider to enable it
|
189 |
<?php } ?>
|
190 |
</p>
|
191 |
<p>
|
192 |
-
<input type="checkbox" name="<?php echo $expire_caching; ?>" <?php checked( $expire_caching_val == 'on',true); ?> /> <span class="wppsb_settings"> Set expire caching (Leverage Browser Caching) </span>
|
193 |
</p>
|
194 |
-
<p><input type="submit" value="<?php esc_attr_e('Save Changes') ?>" class="button button-primary" name="submit" /></p>
|
195 |
</form>
|
196 |
</td>
|
197 |
<td style="text-align: left;">
|
198 |
<div class="wppsb_admin_dev_sidebar_div">
|
199 |
<img src="http://www.gravatar.com/avatar/38b380cf488d8f8c4007cf2015dc16ac.jpg" width="100px" height="100px" /> <br />
|
200 |
-
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-support-this-16x16.png' , __FILE__ ) . '" > '; ?> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38" target="_blank"> Support this plugin and donate </a> </span>
|
201 |
-
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-rate-this-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://wordpress.org/support/view/plugin-reviews/wp-performance-score-booster" target="_blank"> Rate this plugin on WordPress.org </a> </span>
|
202 |
-
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-wordpress-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://wordpress.org/support/plugin/wp-performance-score-booster" target="_blank"> Get support on on WordPress.org </a> </span>
|
203 |
-
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-github-16x16.png' , __FILE__ ) . '" > '; ?> <a href="https://github.com/dipakcg/wp-performance-score-booster" target="_blank"> Contribute development on GitHub </a> </span>
|
204 |
-
|
205 |
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-twitter-16x16.png' , __FILE__ ) . '" > '; ?>Follow me on Twitter: <a href="https://twitter.com/dipakcgajjar" target="_blank">@dipakcgajjar</a> </span>
|
206 |
<br />
|
207 |
-
<span class="wppsb_admin_dev_sidebar" style="float: right;"> Version: <strong> <?php echo get_option('wppsb_plugin_version'); ?> </strong> </span>
|
208 |
</div>
|
209 |
</td>
|
210 |
</tr>
|
@@ -216,8 +231,7 @@ function wppsb_admin_options() {
|
|
216 |
// Register admin menu
|
217 |
add_action( 'admin_menu', 'wppsb_add_admin_menu' );
|
218 |
function wppsb_add_admin_menu() {
|
219 |
-
|
220 |
-
add_menu_page( 'WP Performance Score Booster Settings', 'WP Performance Score Booster', 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options', plugins_url('assets/images/wppsb-icon-24x24.png', __FILE__) );
|
221 |
}
|
222 |
|
223 |
// Add header
|
@@ -225,8 +239,9 @@ function wppsb_add_header() {
|
|
225 |
// Get the plugin version from options (in the database)
|
226 |
$wppsb_plugin_version = get_option('wppsb_plugin_version');
|
227 |
$head_comment = <<<EOD
|
228 |
-
<!-- Performance scores of this site is tuned by WP Performance Score Booster plugin v$wppsb_plugin_version - http://wordpress.org/plugins/wp-performance-score-booster
|
229 |
EOD;
|
|
|
230 |
print ($head_comment);
|
231 |
}
|
232 |
add_action('wp_head', 'wppsb_add_header', 1);
|
@@ -259,16 +274,6 @@ register_activation_hook( __FILE__, 'wppsb_activate_plugin' );
|
|
259 |
|
260 |
// Remove filters/functions on plugin deactivation
|
261 |
function wppsb_deactivate_plugin() {
|
262 |
-
// Remove filters on plugin deactivate
|
263 |
-
remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q' );
|
264 |
-
remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
|
265 |
-
remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp');
|
266 |
-
remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp');
|
267 |
-
remove_filter( 'mod_rewrite_rules', 'wppsb_enable_gzip_filter');
|
268 |
-
remove_filter( 'mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
|
269 |
-
remove_filter( 'mod_rewrite_rules', 'wppsb_expire_caching_filter');
|
270 |
-
|
271 |
-
// Delete plugin version options value in the database
|
272 |
delete_option( 'wppsb_plugin_version' );
|
273 |
|
274 |
flush_rewrite_rules();
|
3 |
Plugin Name: WP Performance Score Booster
|
4 |
Plugin URI: https://github.com/dipakcg/wp-performance-score-booster
|
5 |
Description: Speed-up page load times and improve website scores in services like PageSpeed, YSlow, Pingdom and GTmetrix.
|
6 |
+
Version: 1.2.2
|
7 |
Author: Dipak C. Gajjar
|
8 |
+
Author URI: http://dipakgajjar.com
|
9 |
+
Text Domain: wp-performance-score-booster
|
10 |
*/
|
11 |
|
12 |
+
// Define plugin version for future releases
|
13 |
if (!defined('WPPSB_PLUGIN_VERSION')) {
|
14 |
define('WPPSB_PLUGIN_VERSION', 'wppsb_plugin_version');
|
15 |
}
|
16 |
if (!defined('WPPSB_PLUGIN_VERSION_NUM')) {
|
17 |
+
define('WPPSB_PLUGIN_VERSION_NUM', '1.2.2');
|
18 |
}
|
19 |
update_option(WPPSB_PLUGIN_VERSION, WPPSB_PLUGIN_VERSION_NUM);
|
20 |
|
21 |
+
// Load plugin textdomain for language trnaslation
|
22 |
+
function wppsb_load_plugin_textdomain() {
|
23 |
+
|
24 |
+
$domain = 'wp-performance-score-booster';
|
25 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
26 |
+
|
27 |
+
// wp-content/languages/plugin-name/plugin-name-de_DE.mo
|
28 |
+
load_textdomain( $domain, trailingslashit( WP_LANG_DIR ) . $domain . '/' . $domain . '-' . $locale . '.mo' );
|
29 |
+
// wp-content/plugins/plugin-name/languages/plugin-name-de_DE.mo
|
30 |
+
load_plugin_textdomain( $domain, FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
|
31 |
+
|
32 |
+
}
|
33 |
+
add_action( 'init', 'wppsb_load_plugin_textdomain' );
|
34 |
+
|
35 |
// Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
|
36 |
add_action( 'admin_init', 'wppsb_add_stylesheet' );
|
37 |
function wppsb_add_stylesheet() {
|
42 |
|
43 |
// Remove query strings from static content
|
44 |
function wppsb_remove_query_strings_q( $src ) {
|
45 |
+
$str_parts = explode( '?ver', $src );
|
46 |
+
return $str_parts[0];
|
47 |
}
|
48 |
function wppsb_remove_query_strings_emp( $src ) {
|
49 |
+
$str_parts = explode( '&ver', $src );
|
50 |
+
return $str_parts[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
|
53 |
// Enable GZIP Compression
|
113 |
return $vary_accept_encoding_header . $rules;
|
114 |
}
|
115 |
|
116 |
+
// If 'Remove query strings" checkbox ticked, add filter otherwise remove filter
|
117 |
+
if (get_option('wppsb_remove_query_strings') == 'on') {
|
118 |
+
add_filter( 'script_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
|
119 |
+
add_filter( 'style_loader_src', 'wppsb_remove_query_strings_q', 15, 1 );
|
120 |
+
add_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
|
121 |
+
add_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp', 15, 1 );
|
122 |
+
}
|
123 |
+
else {
|
124 |
+
remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_q');
|
125 |
+
remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_q');
|
126 |
+
remove_filter( 'script_loader_src', 'wppsb_remove_query_strings_emp');
|
127 |
+
remove_filter( 'style_loader_src', 'wppsb_remove_query_strings_emp');
|
128 |
+
}
|
129 |
+
|
130 |
function wppsb_admin_options() {
|
131 |
?>
|
132 |
<div class="wrap">
|
133 |
<table width="100%" border="0">
|
134 |
<tr>
|
135 |
<td width="75%">
|
136 |
+
<h2><?php echo '<img src="' . plugins_url( 'assets/images/wppsb-icon-24x24.png' , __FILE__ ) . '" > '; ?> <?php _e('WP Performance Score Booster Settings', 'wp-performance-score-booster'); ?></h2>
|
137 |
<hr />
|
138 |
<?php
|
139 |
if ( !current_user_can( 'manage_options' ) ) {
|
164 |
update_option( $enable_gzip, $enable_gzip_val );
|
165 |
update_option( $expire_caching, $expire_caching_val );
|
166 |
|
167 |
+
// If 'Enable GZIP" checkbox ticked, add filter otherwise remove filter
|
168 |
+
if ($enable_gzip_val == 'on') {
|
169 |
+
add_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
|
170 |
+
add_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
|
171 |
+
}
|
172 |
+
else {
|
173 |
+
remove_filter('mod_rewrite_rules', 'wppsb_enable_gzip_filter');
|
174 |
+
remove_filter('mod_rewrite_rules', 'wppsb_vary_accept_encoding_filter');
|
175 |
+
}
|
176 |
+
|
177 |
+
// If 'Expire caching" checkbox ticked, add filter otherwise remove filter
|
178 |
+
if ($expire_caching_val == 'on') {
|
179 |
+
add_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
|
180 |
+
}
|
181 |
+
else {
|
182 |
+
remove_filter('mod_rewrite_rules', 'wppsb_expire_caching_filter');
|
183 |
+
}
|
184 |
+
|
185 |
flush_rewrite_rules();
|
186 |
|
187 |
// Put the settings updated message on the screen
|
188 |
?>
|
189 |
+
<div class="updated"><p><strong><?php _e('Settings Saved.', 'wp-performance-score-booster'); ?></strong></p></div>
|
190 |
<?php
|
191 |
}
|
192 |
?>
|
193 |
<form method="post" name="options_form">
|
194 |
<input type="hidden" name="<?php echo $hidden_field_name; ?>" value="Y">
|
195 |
<p>
|
196 |
+
<input type="checkbox" name="<?php echo $remove_query_strings; ?>" <?php checked( $remove_query_strings_val == 'on',true); ?> /> <span class="wppsb_settings"> <?php _e('Remove query strings from static content', 'wp-performance-score-booster'); ?> </span>
|
197 |
</p>
|
198 |
<p>
|
199 |
<?php if (function_exists('ob_gzhandler') || ini_get('zlib.output_compression')) { ?>
|
200 |
+
<input type="checkbox" name="<?php echo $enable_gzip; ?>" <?php checked( $enable_gzip_val == 'on',true); ?> /> <span class="wppsb_settings"> <?php _e('Enable GZIP compression (compress text, html, javascript, css, xml and so on)', 'wp-performance-score-booster'); ?> </span>
|
201 |
<?php }
|
202 |
else { ?>
|
203 |
+
<input type="checkbox" name="<?php echo $enable_gzip; ?>" disabled="true" <?php checked( $enable_gzip_val == 'on',true); ?> /> <span class="wppsb_settings"> <?php _e('Enable GZIP compression (compress text, html, javascript, css, xml and so on)', 'wp-performance-score-booster'); ?> </span> <br /> <span class="wppsb_settings" style="margin-left:30px; color:RED;"> <?php _e('Your web server does not support GZIP compression. Contact your hosting provider to enable it.', 'wp-performance-score-booster'); ?> </span>
|
204 |
<?php } ?>
|
205 |
</p>
|
206 |
<p>
|
207 |
+
<input type="checkbox" name="<?php echo $expire_caching; ?>" <?php checked( $expire_caching_val == 'on',true); ?> /> <span class="wppsb_settings"> <?php _e('Set expire caching (Leverage Browser Caching)', 'wp-performance-score-booster'); ?> </span>
|
208 |
</p>
|
209 |
+
<p><input type="submit" value="<?php esc_attr_e('Save Changes', 'wp-performance-score-booster'); ?>" class="button button-primary" name="submit" /></p>
|
210 |
</form>
|
211 |
</td>
|
212 |
<td style="text-align: left;">
|
213 |
<div class="wppsb_admin_dev_sidebar_div">
|
214 |
<img src="http://www.gravatar.com/avatar/38b380cf488d8f8c4007cf2015dc16ac.jpg" width="100px" height="100px" /> <br />
|
215 |
+
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-support-this-16x16.png' , __FILE__ ) . '" > '; ?> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3S8BRPLWLNQ38" target="_blank"> <?php _e('Support this plugin and donate', 'wp-performance-score-booster'); ?> </a> </span>
|
216 |
+
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-rate-this-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://wordpress.org/support/view/plugin-reviews/wp-performance-score-booster" target="_blank"> <?php _e('Rate this plugin on WordPress.org', 'wp-performance-score-booster'); ?> </a> </span>
|
217 |
+
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-wordpress-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://wordpress.org/support/plugin/wp-performance-score-booster" target="_blank"> <?php _e('Get support on on WordPress.org', 'wp-performance-score-booster'); ?> </a> </span>
|
218 |
+
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-github-16x16.png' , __FILE__ ) . '" > '; ?> <a href="https://github.com/dipakcg/wp-performance-score-booster" target="_blank"> <?php _e('Contribute development on GitHub', 'wp-performance-score-booster'); ?> </a> </span>
|
219 |
+
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-other-plugins-16x16.png' , __FILE__ ) . '" > '; ?> <a href="http://profiles.wordpress.org/dipakcg#content-plugins" target="_blank"> <?php _e('Get my other plugins', 'wp-performance-score-booster'); ?> </a> </span>
|
220 |
<span class="wppsb_admin_dev_sidebar"> <?php echo '<img src="' . plugins_url( 'assets/images/wppsb-twitter-16x16.png' , __FILE__ ) . '" > '; ?>Follow me on Twitter: <a href="https://twitter.com/dipakcgajjar" target="_blank">@dipakcgajjar</a> </span>
|
221 |
<br />
|
222 |
+
<span class="wppsb_admin_dev_sidebar" style="float: right;"> <?php _e('Version:', 'wp-performance-score-booster'); ?> <strong> <?php echo get_option('wppsb_plugin_version'); ?> </strong> </span>
|
223 |
</div>
|
224 |
</td>
|
225 |
</tr>
|
231 |
// Register admin menu
|
232 |
add_action( 'admin_menu', 'wppsb_add_admin_menu' );
|
233 |
function wppsb_add_admin_menu() {
|
234 |
+
add_menu_page( __('WP Performance Score Booster Settings', 'wp-performance-score-booster'), __('WP Performance Score Booster', 'wp-performance-score-booster'), 'manage_options', 'wp-performance-score-booster', 'wppsb_admin_options', plugins_url('assets/images/wppsb-icon-24x24.png', __FILE__) );
|
|
|
235 |
}
|
236 |
|
237 |
// Add header
|
239 |
// Get the plugin version from options (in the database)
|
240 |
$wppsb_plugin_version = get_option('wppsb_plugin_version');
|
241 |
$head_comment = <<<EOD
|
242 |
+
<!-- Performance scores of this site is tuned by WP Performance Score Booster plugin v$wppsb_plugin_version - http://wordpress.org/plugins/wp-performance-score-booster -->
|
243 |
EOD;
|
244 |
+
$head_comment = $head_comment . PHP_EOL;
|
245 |
print ($head_comment);
|
246 |
}
|
247 |
add_action('wp_head', 'wppsb_add_header', 1);
|
274 |
|
275 |
// Remove filters/functions on plugin deactivation
|
276 |
function wppsb_deactivate_plugin() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
delete_option( 'wppsb_plugin_version' );
|
278 |
|
279 |
flush_rewrite_rules();
|