Version Description
- Add support for XML sitemaps of type text/xml
- Bugfix some error messages not appearing when they should
- Add additional nonce checks for Cross-Site Request Forgery (CSRF) protection
Download this release
Release Info
Developer | mattkeys |
Plugin | Google Pagespeed Insights |
Version | 4.0.7 |
Comparing to | |
See all releases |
Code changes from version 4.0.6 to 4.0.7
- classes/class-GPI-Actions.php +53 -4
- classes/class-GPI-Activation.php +2 -0
- classes/class-GPI-Admin.php +4 -4
- classes/class-GPI-Core.php +8 -2
- documentation/assets/blueprint-css/plugins/fancy-type/screen.css +71 -71
- google-pagespeed-insights.php +2 -2
- readme.txt +12 -2
- templates/parts/messages.php +19 -10
classes/class-GPI-Actions.php
CHANGED
@@ -122,7 +122,12 @@ class GPI_Actions
|
|
122 |
}
|
123 |
|
124 |
if ( $action_message ) {
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'id', 'gpi_page_report', 'single-recheck', 'strategy' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
|
@@ -131,6 +136,10 @@ class GPI_Actions
|
|
131 |
|
132 |
private function start_scan()
|
133 |
{
|
|
|
|
|
|
|
|
|
134 |
$recheck = isset( $_GET['recheck_all_pages'] ) ? true : false;
|
135 |
do_action( 'run_gpi', $recheck );
|
136 |
|
@@ -139,6 +148,10 @@ class GPI_Actions
|
|
139 |
|
140 |
private function abort_scan()
|
141 |
{
|
|
|
|
|
|
|
|
|
142 |
add_option( 'gpi_abort_scan', true, '', false );
|
143 |
|
144 |
return __( 'Scan abort request received. Please allow a moment for the in-progress page report to complete before the abort request can take effect.', 'gpagespeedi' );
|
@@ -199,6 +212,7 @@ class GPI_Actions
|
|
199 |
'api_restriction' => false,
|
200 |
'new_ignored_items' => false,
|
201 |
'backend_error' => false,
|
|
|
202 |
'log_api_errors' => isset( $_POST['log_api_errors'] ) ? true : false,
|
203 |
'new_activation_message' => false,
|
204 |
'heartbeat' => isset( $_POST['heartbeat'] ) ? sanitize_text_field( $_POST['heartbeat'] ) : 'standard',
|
@@ -592,6 +606,13 @@ class GPI_Actions
|
|
592 |
|
593 |
private function add_custom_urls_bulk()
|
594 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
595 |
$urls_to_store = array();
|
596 |
$already_exist = array();
|
597 |
$inserted_urls = 0;
|
@@ -607,15 +628,25 @@ class GPI_Actions
|
|
607 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
608 |
}
|
609 |
|
610 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
611 |
$movefile = wp_handle_upload( $_FILES['xml_sitemap'], $upload_overrides );
|
612 |
|
|
|
|
|
|
|
613 |
if ( isset( $movefile['file'] ) ) {
|
614 |
-
if ( $movefile['type'] != 'application/xml' ) {
|
615 |
unlink( $movefile['file'] );
|
616 |
return array(
|
617 |
'type' => 'error',
|
618 |
-
'message' => __( 'File type must be "
|
619 |
);
|
620 |
}
|
621 |
} else if ( isset( $movefile['error'] ) ) {
|
@@ -703,6 +734,10 @@ class GPI_Actions
|
|
703 |
|
704 |
private function delete_page()
|
705 |
{
|
|
|
|
|
|
|
|
|
706 |
if ( is_array( $this->bulk_pages ) && ! empty( $this->bulk_pages ) ) {
|
707 |
$delete_array_count = count( $this->bulk_pages );
|
708 |
|
@@ -755,6 +790,20 @@ class GPI_Actions
|
|
755 |
// Delete from custom urls
|
756 |
$wpdb->delete( $this->gpi_custom_urls, array( 'ID' => $custom_id ), array( '%d' ) );
|
757 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
758 |
}
|
759 |
|
760 |
add_action( 'plugins_loaded', array( new GPI_Actions, 'init' ) );
|
122 |
}
|
123 |
|
124 |
if ( $action_message ) {
|
125 |
+
if ( is_array( $action_message ) ) {
|
126 |
+
$action_message = array_map( 'sanitize_text_field', $action_message );
|
127 |
+
} else {
|
128 |
+
$action_message = sanitize_text_field( $action_message );
|
129 |
+
}
|
130 |
+
do_action( 'gpi_update_option', 'action_message', $action_message, 'gpagespeedi_ui_options' );
|
131 |
}
|
132 |
|
133 |
wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'action', 'id', 'gpi_page_report', 'single-recheck', 'strategy' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
|
136 |
|
137 |
private function start_scan()
|
138 |
{
|
139 |
+
if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'gpi-start-scan' ) ) {
|
140 |
+
return;
|
141 |
+
}
|
142 |
+
|
143 |
$recheck = isset( $_GET['recheck_all_pages'] ) ? true : false;
|
144 |
do_action( 'run_gpi', $recheck );
|
145 |
|
148 |
|
149 |
private function abort_scan()
|
150 |
{
|
151 |
+
if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'gpi-abort-scan' ) ) {
|
152 |
+
return;
|
153 |
+
}
|
154 |
+
|
155 |
add_option( 'gpi_abort_scan', true, '', false );
|
156 |
|
157 |
return __( 'Scan abort request received. Please allow a moment for the in-progress page report to complete before the abort request can take effect.', 'gpagespeedi' );
|
212 |
'api_restriction' => false,
|
213 |
'new_ignored_items' => false,
|
214 |
'backend_error' => false,
|
215 |
+
'check_logs' => false,
|
216 |
'log_api_errors' => isset( $_POST['log_api_errors'] ) ? true : false,
|
217 |
'new_activation_message' => false,
|
218 |
'heartbeat' => isset( $_POST['heartbeat'] ) ? sanitize_text_field( $_POST['heartbeat'] ) : 'standard',
|
606 |
|
607 |
private function add_custom_urls_bulk()
|
608 |
{
|
609 |
+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'gpi-add-custom-urls' ) ) {
|
610 |
+
return array(
|
611 |
+
'type' => 'error',
|
612 |
+
'message' => __( 'Invalid Nonce. Please refresh the page and try again.', 'gpagespeedi' )
|
613 |
+
);
|
614 |
+
}
|
615 |
+
|
616 |
$urls_to_store = array();
|
617 |
$already_exist = array();
|
618 |
$inserted_urls = 0;
|
628 |
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
629 |
}
|
630 |
|
631 |
+
if ( isset( $_FILES['xml_sitemap']['type'] ) && 'text/xml' == $_FILES['xml_sitemap']['type'] ) {
|
632 |
+
add_filter( 'upload_mimes', [ $this, 'allow_textxml_mime' ], 10 );
|
633 |
+
$upload_overrides = array( 'test_form' => false, 'mimes' => array( 'xml' => 'text/xml' ) );
|
634 |
+
} else {
|
635 |
+
add_filter( 'upload_mimes', [ $this, 'allow_appxml_mime' ], 10 );
|
636 |
+
$upload_overrides = array( 'test_form' => false, 'mimes' => array( 'xml' => 'application/xml' ) );
|
637 |
+
}
|
638 |
+
|
639 |
$movefile = wp_handle_upload( $_FILES['xml_sitemap'], $upload_overrides );
|
640 |
|
641 |
+
remove_filter( 'upload_mimes', [ $this, 'allow_textxml_mime' ], 10 );
|
642 |
+
remove_filter( 'upload_mimes', [ $this, 'allow_appxml_mime' ], 10 );
|
643 |
+
|
644 |
if ( isset( $movefile['file'] ) ) {
|
645 |
+
if ( $movefile['type'] != 'text/xml' && $movefile['type'] != 'application/xml' ) {
|
646 |
unlink( $movefile['file'] );
|
647 |
return array(
|
648 |
'type' => 'error',
|
649 |
+
'message' => __( 'File mime type must be "application/xml" or "text/xml"', 'gpagespeedi' )
|
650 |
);
|
651 |
}
|
652 |
} else if ( isset( $movefile['error'] ) ) {
|
734 |
|
735 |
private function delete_page()
|
736 |
{
|
737 |
+
if ( ! isset( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-gpi_page_reports' ) ) {
|
738 |
+
return;
|
739 |
+
}
|
740 |
+
|
741 |
if ( is_array( $this->bulk_pages ) && ! empty( $this->bulk_pages ) ) {
|
742 |
$delete_array_count = count( $this->bulk_pages );
|
743 |
|
790 |
// Delete from custom urls
|
791 |
$wpdb->delete( $this->gpi_custom_urls, array( 'ID' => $custom_id ), array( '%d' ) );
|
792 |
}
|
793 |
+
|
794 |
+
public function allow_textxml_mime( $mimes )
|
795 |
+
{
|
796 |
+
$mimes['xml'] = 'text/xml';
|
797 |
+
|
798 |
+
return $mimes;
|
799 |
+
}
|
800 |
+
|
801 |
+
public function allow_appxml_mime( $mimes )
|
802 |
+
{
|
803 |
+
$mimes['xml'] = 'application/xml';
|
804 |
+
|
805 |
+
return $mimes;
|
806 |
+
}
|
807 |
}
|
808 |
|
809 |
add_action( 'plugins_loaded', array( new GPI_Actions, 'init' ) );
|
classes/class-GPI-Activation.php
CHANGED
@@ -56,6 +56,7 @@ class GPI_Activation
|
|
56 |
'api_restriction' => isset( $gpagespeedi_options['api_restriction'] ) ? 1 : 0,
|
57 |
'new_ignored_items' => isset( $gpagespeedi_options['new_ignored_items'] ) ? 1 : 0,
|
58 |
'backend_error' => isset( $gpagespeedi_options['backend_error'] ) ? 1 : 0,
|
|
|
59 |
'log_api_errors' => isset( $gpagespeedi_options['log_api_errors'] ) ? 1 : 0,
|
60 |
'new_activation_message' => false,
|
61 |
'heartbeat' => isset( $gpagespeedi_options['heartbeat'] ) ? sanitize_text_field( $gpagespeedi_options['heartbeat'] ) : 'fast',
|
@@ -98,6 +99,7 @@ class GPI_Activation
|
|
98 |
'api_restriction' => false, // True if API reports that it cannot check pages from this IP/Hostname
|
99 |
'new_ignored_items' => false, // true if new pages have been added to 'ignore' due to a bad request
|
100 |
'backend_error' => false, // true if a 'backendErorr' is returned from the API
|
|
|
101 |
'log_api_errors' => false, // log uncaught API exceptions to txt files in FTP root
|
102 |
'new_activation_message' => true, // display welcome messsage on first-time activation of plugin
|
103 |
'heartbeat' => 'standard', // Heartbeat refresh interval: fast, slow, standard, or disabled
|
56 |
'api_restriction' => isset( $gpagespeedi_options['api_restriction'] ) ? 1 : 0,
|
57 |
'new_ignored_items' => isset( $gpagespeedi_options['new_ignored_items'] ) ? 1 : 0,
|
58 |
'backend_error' => isset( $gpagespeedi_options['backend_error'] ) ? 1 : 0,
|
59 |
+
'check_logs' => isset( $gpagespeedi_options['check_logs'] ) ? 1 : 0,
|
60 |
'log_api_errors' => isset( $gpagespeedi_options['log_api_errors'] ) ? 1 : 0,
|
61 |
'new_activation_message' => false,
|
62 |
'heartbeat' => isset( $gpagespeedi_options['heartbeat'] ) ? sanitize_text_field( $gpagespeedi_options['heartbeat'] ) : 'fast',
|
99 |
'api_restriction' => false, // True if API reports that it cannot check pages from this IP/Hostname
|
100 |
'new_ignored_items' => false, // true if new pages have been added to 'ignore' due to a bad request
|
101 |
'backend_error' => false, // true if a 'backendErorr' is returned from the API
|
102 |
+
'check_logs' => false, // true if a 'badRequest' is returned from the API
|
103 |
'log_api_errors' => false, // log uncaught API exceptions to txt files in FTP root
|
104 |
'new_activation_message' => true, // display welcome messsage on first-time activation of plugin
|
105 |
'heartbeat' => 'standard', // Heartbeat refresh interval: fast, slow, standard, or disabled
|
classes/class-GPI-Admin.php
CHANGED
@@ -152,11 +152,11 @@ class GPI_Admin
|
|
152 |
if ( ! get_option( 'gpi_abort_scan' ) ) :
|
153 |
if ( isset( $_GET['page_id'] ) ) :
|
154 |
?>
|
155 |
-
<a href="<?php echo
|
156 |
<?php
|
157 |
else :
|
158 |
?>
|
159 |
-
<a href="<?php echo
|
160 |
<?php
|
161 |
endif;
|
162 |
else :
|
@@ -167,11 +167,11 @@ class GPI_Admin
|
|
167 |
elseif ( $this->gpi_options['google_developer_key'] ) :
|
168 |
if ( isset( $_GET['page_id'] ) ) :
|
169 |
?>
|
170 |
-
<a id="start_scan" href="<?php echo
|
171 |
<?php
|
172 |
else :
|
173 |
?>
|
174 |
-
<a id="start_scan" href="<?php echo
|
175 |
<?php
|
176 |
endif;
|
177 |
?>
|
152 |
if ( ! get_option( 'gpi_abort_scan' ) ) :
|
153 |
if ( isset( $_GET['page_id'] ) ) :
|
154 |
?>
|
155 |
+
<a href="<?php echo wp_nonce_url( '?page=google-pagespeed-insights&render=' . $admin_page . '&page_id=' . intval( $_GET['page_id'] ) . '&action=abort-scan', 'gpi-abort-scan' ); ?>" class="button-gpi abort"><?php esc_html_e( 'Abort Current Scan', 'gpagespeedi' ); ?></a>
|
156 |
<?php
|
157 |
else :
|
158 |
?>
|
159 |
+
<a href="<?php echo wp_nonce_url( '?page=google-pagespeed-insights&render=' . $admin_page . '&action=abort-scan', 'gpi-abort-scan' ); ?>" class="button-gpi abort"><?php esc_html_e( 'Abort Current Scan', 'gpagespeedi' ); ?></a>
|
160 |
<?php
|
161 |
endif;
|
162 |
else :
|
167 |
elseif ( $this->gpi_options['google_developer_key'] ) :
|
168 |
if ( isset( $_GET['page_id'] ) ) :
|
169 |
?>
|
170 |
+
<a id="start_scan" href="<?php echo wp_nonce_url( '?page=google-pagespeed-insights&render=' . $admin_page . '&page_id=' . intval( $_GET['page_id'] ) . '&action=start-scan', 'gpi-start-scan' ); ?>" class="button-gpi run"><?php esc_html_e( 'Start Reporting', 'gpagespeedi' ); ?></a>
|
171 |
<?php
|
172 |
else :
|
173 |
?>
|
174 |
+
<a id="start_scan" href="<?php echo wp_nonce_url( '?page=google-pagespeed-insights&render=' . $admin_page . '&action=start-scan', 'gpi-start-scan' ); ?>" class="button-gpi run"><?php esc_html_e( 'Start Reporting', 'gpagespeedi' ); ?></a>
|
175 |
<?php
|
176 |
endif;
|
177 |
?>
|
classes/class-GPI-Core.php
CHANGED
@@ -212,7 +212,9 @@ class GPI_Core
|
|
212 |
// Set last run finished to false, we will change this to true if this process finishes before max execution time.
|
213 |
$this->update_option( 'last_run_finished', false, 'gpagespeedi_options' );
|
214 |
|
215 |
-
// Clear Pagespeed Disabled and API Restriction warnings
|
|
|
|
|
216 |
$this->update_option( 'pagespeed_disabled', false, 'gpagespeedi_options' );
|
217 |
$this->update_option( 'api_restriction', false, 'gpagespeedi_options' );
|
218 |
|
@@ -690,6 +692,11 @@ class GPI_Core
|
|
690 |
$this->update_option( 'bad_api_key', true, 'gpagespeedi_options' );
|
691 |
$error_type = 'fatal';
|
692 |
|
|
|
|
|
|
|
|
|
|
|
693 |
} else if ( isset( $errors[0]->reason ) && $errors[0]->reason == 'accessNotConfigured' ) {
|
694 |
|
695 |
$this->update_option( 'pagespeed_disabled', true, 'gpagespeedi_options' );
|
@@ -717,7 +724,6 @@ class GPI_Core
|
|
717 |
} else if ( $result['responseCode'] == '500' ) {
|
718 |
|
719 |
$this->save_bad_request( $url_group_type, $where_column, $object_id, $object_url );
|
720 |
-
|
721 |
}
|
722 |
|
723 |
if ( (bool) $this->gpi_options['log_api_errors'] ) {
|
212 |
// Set last run finished to false, we will change this to true if this process finishes before max execution time.
|
213 |
$this->update_option( 'last_run_finished', false, 'gpagespeedi_options' );
|
214 |
|
215 |
+
// Clear Bad API Key, Pagespeed Disabled, and API Restriction warnings
|
216 |
+
$this->update_option( 'check_logs', false, 'gpagespeedi_options' );
|
217 |
+
$this->update_option( 'bad_api_key', false, 'gpagespeedi_options' );
|
218 |
$this->update_option( 'pagespeed_disabled', false, 'gpagespeedi_options' );
|
219 |
$this->update_option( 'api_restriction', false, 'gpagespeedi_options' );
|
220 |
|
692 |
$this->update_option( 'bad_api_key', true, 'gpagespeedi_options' );
|
693 |
$error_type = 'fatal';
|
694 |
|
695 |
+
} else if ( isset( $errors[0]->reason ) && $errors[0]->reason == 'badRequest' ) {
|
696 |
+
|
697 |
+
$this->update_option( 'check_logs', true, 'gpagespeedi_options' );
|
698 |
+
$error_type = 'fatal';
|
699 |
+
|
700 |
} else if ( isset( $errors[0]->reason ) && $errors[0]->reason == 'accessNotConfigured' ) {
|
701 |
|
702 |
$this->update_option( 'pagespeed_disabled', true, 'gpagespeedi_options' );
|
724 |
} else if ( $result['responseCode'] == '500' ) {
|
725 |
|
726 |
$this->save_bad_request( $url_group_type, $where_column, $object_id, $object_url );
|
|
|
727 |
}
|
728 |
|
729 |
if ( (bool) $this->gpi_options['log_api_errors'] ) {
|
documentation/assets/blueprint-css/plugins/fancy-type/screen.css
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
/* --------------------------------------------------------------
|
2 |
-
|
3 |
-
fancy-type.css
|
4 |
-
* Lots of pretty advanced classes for manipulating text.
|
5 |
-
|
6 |
-
See the Readme file in this folder for additional instructions.
|
7 |
-
|
8 |
-
-------------------------------------------------------------- */
|
9 |
-
|
10 |
-
/* Indentation instead of line shifts for sibling paragraphs. */
|
11 |
-
/* p + p { text-indent:2em; margin-top:-1.5em; } */
|
12 |
-
form p + p { text-indent: 0; } /* Don't want this in forms. */
|
13 |
-
|
14 |
-
|
15 |
-
/* For great looking type, use this code instead of asdf:
|
16 |
-
<span class="alt">asdf</span>
|
17 |
-
Best used on prepositions and ampersands. */
|
18 |
-
|
19 |
-
.alt {
|
20 |
-
color: #666;
|
21 |
-
font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif;
|
22 |
-
font-style: italic;
|
23 |
-
font-weight: normal;
|
24 |
-
}
|
25 |
-
|
26 |
-
|
27 |
-
/* For great looking quote marks in titles, replace "asdf" with:
|
28 |
-
<span class="dquo">“</span>asdf”
|
29 |
-
(That is, when the title starts with a quote mark).
|
30 |
-
(You may have to change this value depending on your font size). */
|
31 |
-
|
32 |
-
.dquo { margin-left: -.5em; }
|
33 |
-
|
34 |
-
|
35 |
-
/* Reduced size type with incremental leading
|
36 |
-
(http://www.markboulton.co.uk/journal/comments/incremental_leading/)
|
37 |
-
|
38 |
-
This could be used for side notes. For smaller type, you don't necessarily want to
|
39 |
-
follow the 1.5x vertical rhythm -- the line-height is too much.
|
40 |
-
|
41 |
-
Using this class, it reduces your font size and line-height so that for
|
42 |
-
every four lines of normal sized type, there is five lines of the sidenote. eg:
|
43 |
-
|
44 |
-
New type size in em's:
|
45 |
-
10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems)
|
46 |
-
|
47 |
-
New line-height value:
|
48 |
-
12px x 1.5 = 18px (old line-height)
|
49 |
-
18px x 4 = 72px
|
50 |
-
72px / 5 = 14.4px (new line height)
|
51 |
-
14.4px / 10px = 1.44 (new line height in em's) */
|
52 |
-
|
53 |
-
p.incr, .incr p {
|
54 |
-
font-size: 10px;
|
55 |
-
line-height: 1.44em;
|
56 |
-
margin-bottom: 1.5em;
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
/* Surround uppercase words and abbreviations with this class.
|
61 |
-
Based on work by Jørgen Arnor Gårdsø Lom [http://twistedintellect.com/] */
|
62 |
-
|
63 |
-
.caps {
|
64 |
-
font-variant: small-caps;
|
65 |
-
letter-spacing: 1px;
|
66 |
-
text-transform: lowercase;
|
67 |
-
font-size:1.2em;
|
68 |
-
line-height:1%;
|
69 |
-
font-weight:bold;
|
70 |
-
padding:0 2px;
|
71 |
-
}
|
1 |
+
/* --------------------------------------------------------------
|
2 |
+
|
3 |
+
fancy-type.css
|
4 |
+
* Lots of pretty advanced classes for manipulating text.
|
5 |
+
|
6 |
+
See the Readme file in this folder for additional instructions.
|
7 |
+
|
8 |
+
-------------------------------------------------------------- */
|
9 |
+
|
10 |
+
/* Indentation instead of line shifts for sibling paragraphs. */
|
11 |
+
/* p + p { text-indent:2em; margin-top:-1.5em; } */
|
12 |
+
form p + p { text-indent: 0; } /* Don't want this in forms. */
|
13 |
+
|
14 |
+
|
15 |
+
/* For great looking type, use this code instead of asdf:
|
16 |
+
<span class="alt">asdf</span>
|
17 |
+
Best used on prepositions and ampersands. */
|
18 |
+
|
19 |
+
.alt {
|
20 |
+
color: #666;
|
21 |
+
font-family: "Warnock Pro", "Goudy Old Style","Palatino","Book Antiqua", Georgia, serif;
|
22 |
+
font-style: italic;
|
23 |
+
font-weight: normal;
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
/* For great looking quote marks in titles, replace "asdf" with:
|
28 |
+
<span class="dquo">“</span>asdf”
|
29 |
+
(That is, when the title starts with a quote mark).
|
30 |
+
(You may have to change this value depending on your font size). */
|
31 |
+
|
32 |
+
.dquo { margin-left: -.5em; }
|
33 |
+
|
34 |
+
|
35 |
+
/* Reduced size type with incremental leading
|
36 |
+
(http://www.markboulton.co.uk/journal/comments/incremental_leading/)
|
37 |
+
|
38 |
+
This could be used for side notes. For smaller type, you don't necessarily want to
|
39 |
+
follow the 1.5x vertical rhythm -- the line-height is too much.
|
40 |
+
|
41 |
+
Using this class, it reduces your font size and line-height so that for
|
42 |
+
every four lines of normal sized type, there is five lines of the sidenote. eg:
|
43 |
+
|
44 |
+
New type size in em's:
|
45 |
+
10px (wanted side note size) / 12px (existing base size) = 0.8333 (new type size in ems)
|
46 |
+
|
47 |
+
New line-height value:
|
48 |
+
12px x 1.5 = 18px (old line-height)
|
49 |
+
18px x 4 = 72px
|
50 |
+
72px / 5 = 14.4px (new line height)
|
51 |
+
14.4px / 10px = 1.44 (new line height in em's) */
|
52 |
+
|
53 |
+
p.incr, .incr p {
|
54 |
+
font-size: 10px;
|
55 |
+
line-height: 1.44em;
|
56 |
+
margin-bottom: 1.5em;
|
57 |
+
}
|
58 |
+
|
59 |
+
|
60 |
+
/* Surround uppercase words and abbreviations with this class.
|
61 |
+
Based on work by Jørgen Arnor Gårdsø Lom [http://twistedintellect.com/] */
|
62 |
+
|
63 |
+
.caps {
|
64 |
+
font-variant: small-caps;
|
65 |
+
letter-spacing: 1px;
|
66 |
+
text-transform: lowercase;
|
67 |
+
font-size:1.2em;
|
68 |
+
line-height:1%;
|
69 |
+
font-weight:bold;
|
70 |
+
padding:0 2px;
|
71 |
+
}
|
google-pagespeed-insights.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Insights from Google PageSpeed
|
|
4 |
Plugin URI: http://mattkeys.me
|
5 |
Description: Get insights from the Google Pagespeed API right in your WordPress dashboard
|
6 |
Author: Matt Keys
|
7 |
-
Version: 4.0.
|
8 |
Author URI: http://mattkeys.me
|
9 |
*/
|
10 |
|
@@ -45,7 +45,7 @@ if ( ! defined( 'GPI_BASENAME' ) ) {
|
|
45 |
|
46 |
// Internal version number
|
47 |
if ( ! defined( 'GPI_VERSION' ) ) {
|
48 |
-
define( 'GPI_VERSION', '4.0.
|
49 |
}
|
50 |
|
51 |
if ( is_admin() ) {
|
4 |
Plugin URI: http://mattkeys.me
|
5 |
Description: Get insights from the Google Pagespeed API right in your WordPress dashboard
|
6 |
Author: Matt Keys
|
7 |
+
Version: 4.0.7
|
8 |
Author URI: http://mattkeys.me
|
9 |
*/
|
10 |
|
45 |
|
46 |
// Internal version number
|
47 |
if ( ! defined( 'GPI_VERSION' ) ) {
|
48 |
+
define( 'GPI_VERSION', '4.0.7' );
|
49 |
}
|
50 |
|
51 |
if ( is_admin() ) {
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: mattkeys
|
3 |
Tags: SEO, performance, speed, page speed, search engine optimization, pagespeed, google page speed, pagespeed insights, google pagespeed insights
|
4 |
Requires at least: 3.6
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 4.0.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -136,6 +136,11 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
|
|
139 |
= 4.0.6 =
|
140 |
* Additional validating, sanitizing, and escaping the plugin codebase
|
141 |
|
@@ -238,6 +243,11 @@ Google Pagespeed Insights requires a Google API Key. Keys are free and can be ob
|
|
238 |
|
239 |
== Upgrade Notice ==
|
240 |
|
|
|
|
|
|
|
|
|
|
|
241 |
= 4.0.6 =
|
242 |
* Additional validating, sanitizing, and escaping the plugin codebase
|
243 |
|
2 |
Contributors: mattkeys
|
3 |
Tags: SEO, performance, speed, page speed, search engine optimization, pagespeed, google page speed, pagespeed insights, google pagespeed insights
|
4 |
Requires at least: 3.6
|
5 |
+
Tested up to: 6.0
|
6 |
+
Stable tag: 4.0.7
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
136 |
|
137 |
== Changelog ==
|
138 |
|
139 |
+
= 4.0.7 =
|
140 |
+
* Add support for XML sitemaps of type text/xml
|
141 |
+
* Bugfix some error messages not appearing when they should
|
142 |
+
* Add additional nonce checks for Cross-Site Request Forgery (CSRF) protection
|
143 |
+
|
144 |
= 4.0.6 =
|
145 |
* Additional validating, sanitizing, and escaping the plugin codebase
|
146 |
|
243 |
|
244 |
== Upgrade Notice ==
|
245 |
|
246 |
+
= 4.0.7 =
|
247 |
+
* Add support for XML sitemaps of type text/xml
|
248 |
+
* Bugfix some error messages not appearing when they should
|
249 |
+
* Add additional nonce checks for Cross-Site Request Forgery (CSRF) protection
|
250 |
+
|
251 |
= 4.0.6 =
|
252 |
* Additional validating, sanitizing, and escaping the plugin codebase
|
253 |
|
templates/parts/messages.php
CHANGED
@@ -33,22 +33,22 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
33 |
<?php endif; ?>
|
34 |
<?php if ( '' == $this->gpi_options['google_developer_key'] && 'options' != $admin_page ) : ?>
|
35 |
<div id="message" class="error">
|
36 |
-
<p><strong><?php esc_html_e( 'You must enter your Google API key to use this plugin! Enter your API key in the', 'gpagespeedi' ); ?> <a href="?page=google-pagespeed-insights&render=options"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong>.</p>
|
37 |
</div>
|
38 |
<?php endif; ?>
|
39 |
<?php if ( (bool) $this->gpi_options['bad_api_key'] && 'options' != $admin_page ) : ?>
|
40 |
<div id="message" class="error">
|
41 |
-
<p><strong><?php esc_html_e( 'The Google Pagespeed API Key you entered appears to be invalid. Please update your API key in the', 'gpagespeedi' ); ?> <a href="?page=google-pagespeed-insights&render=options"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong>.</p>
|
42 |
</div>
|
43 |
<?php endif; ?>
|
44 |
<?php if ( (bool) $this->gpi_options['pagespeed_disabled'] && 'options' != $admin_page ) : ?>
|
45 |
<div id="message" class="error">
|
46 |
-
<p><strong><?php esc_html_e( 'The "PageSpeed Insights API" service is not enabled. To enable it, please visit the', 'gpagespeedi' ); ?> <a href="https://console.developers.google.com/" target="_blank"><?php esc_html_e( 'Google API Console', 'gpagespeedi' ); ?></a></strong>.</p>
|
47 |
</div>
|
48 |
<?php endif; ?>
|
49 |
<?php if ( (bool) $this->gpi_options['api_restriction'] ) : ?>
|
50 |
<div id="message" class="error">
|
51 |
-
<p><strong><?php esc_html_e( 'This referrer or IP address is restricted from using your API Key. To change your API Key restrictions, please visit the', 'gpagespeedi' ); ?> <a href="https://console.developers.google.com/" target="_blank"><?php esc_html_e( 'Google API Console', 'gpagespeedi' ); ?></a></strong>.</p>
|
52 |
</div>
|
53 |
<?php endif; ?>
|
54 |
<?php if ( $action_message = $this->gpi_ui_options['action_message'] ) :
|
@@ -69,17 +69,26 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
69 |
<?php endif; ?>
|
70 |
<?php if ( isset( $_GET['render'] ) && 'logs' == $_GET['render'] && ! (bool) $this->gpi_options['log_api_errors'] ) : ?>
|
71 |
<div id="message" class="error">
|
72 |
-
<p><strong><?php esc_html_e( 'API error logging is disabled. Enable "Log API Exceptions" to record new errors.', 'gpagespeedi' ); ?> <a href="?page=google-pagespeed-insights&render=options"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong></p>
|
73 |
</div>
|
74 |
<?php endif; ?>
|
75 |
<?php if ( (bool) $this->gpi_options['new_ignored_items'] ) : ?>
|
76 |
<div id="message" class="notice notice-error is-dismissible">
|
77 |
-
<p><strong><?php esc_html_e( 'One or more URLs could not be reached by Google Pagespeed Insights and have automatically been added to the', 'gpagespeedi' ); ?> <a href="?page=google-pagespeed-insights&render=ignored-urls"><?php esc_html_e( 'Ignored URLs', 'gpagespeedi' ); ?></a></strong>.</p>
|
78 |
</div>
|
79 |
<?php endif; ?>
|
80 |
<?php if ( (bool) $this->gpi_options['backend_error'] ) : ?>
|
81 |
<div id="message" class="error">
|
82 |
-
<p><strong><?php echo wp_kses_data( __( 'An error has been encountered while checking one or more URLs. Possible causes: <br /><br />Daily API Limit Exceeded <a href="https://console.developers.google.com/" target="_blank">Check API Usage</a> <br />API Key user limit exceeded <a href="https://console.developers.google.com/" target="_blank">Check API Usage</a> <br />the URL is not publicly accessible or is bad. <br /><br />The URL(s) have been added to the', 'gpagespeedi' ) ); ?> <a href="?page=google-pagespeed-insights&render=ignored-urls"><?php esc_html_e( 'Ignored URLs', 'gpagespeedi' ); ?></a></strong></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
</div>
|
84 |
<?php endif; ?>
|
85 |
<?php if ( $worker_status = apply_filters( 'gpi_check_status', false ) ) : ?>
|
@@ -87,7 +96,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
87 |
<?php if ( 'disabled' != $this->gpi_options['heartbeat'] ) : ?>
|
88 |
<span>
|
89 |
<p id="gpi_status_abort" style="font-size: 13px; display: none;"><?php esc_html_e( 'Google Pagespeed has successfully stopped checking pages due to a user requested abort.', 'gpagespeedi' ); ?></p>
|
90 |
-
<p id="gpi_status_finished" style="font-size: 13px; display: none;"><?php esc_html_e( 'Google Pagespeed has finished checking pagespeed scores.', 'gpagespeedi' );?> <a href="?page=google-pagespeed-insights&render=report-list"><?php esc_html_e( 'See new results', 'gpagespeedi' ); ?>.</a></p>
|
91 |
<p id="gpi_status_ajax" class="ellipsis" style="font-size: 13px;"><?php esc_html_e( 'Google Pagespeed is running in the background ', 'gpagespeedi' ); ?></p>
|
92 |
</span>
|
93 |
<?php else : ?>
|
@@ -104,9 +113,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
104 |
<?php if ( ! $worker_status && ! (bool) $this->gpi_options['last_run_finished'] ) : ?>
|
105 |
<div id="message" class="error">
|
106 |
<?php if ( apply_filters( 'gpi_set_time_limit_disabled', false ) ) : ?>
|
107 |
-
<p><strong><?php esc_html_e( 'The last pagespeed report scan failed to finish successfully. We have detected that your server may not allow the maximum execution time to be overridden by this plugin. If you continue to experience problems with pagespeed report scans failing to complete, try setting the Maximum Script Run Time in the Advanced Configuration section on the', 'gpagespeedi' ); ?> <a href="?page=google-pagespeed-insights&render=options"><?php esc_html_e( 'Options Page', 'gpagespeedi' ); ?></a></strong>.</p>
|
108 |
<?php else : ?>
|
109 |
-
<p><strong><?php esc_html_e( 'The last pagespeed report scan failed to finish successfully. If you continue to experience problems with pagespeed report scans failing to complete, try increasing the Maximum Execution Time, or setting the Maximum Script Run Time in the Advanced Configuration section on the', 'gpagespeedi' ); ?> <a href="?page=google-pagespeed-insights&render=options"><?php esc_html_e( 'Options Page', 'gpagespeedi' ); ?></a></strong>.</p>
|
110 |
<?php endif; ?>
|
111 |
</div>
|
112 |
<?php endif; ?>
|
33 |
<?php endif; ?>
|
34 |
<?php if ( '' == $this->gpi_options['google_developer_key'] && 'options' != $admin_page ) : ?>
|
35 |
<div id="message" class="error">
|
36 |
+
<p><strong><?php esc_html_e( 'You must enter your Google API key to use this plugin! Enter your API key in the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=options' ); ?>"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong>.</p>
|
37 |
</div>
|
38 |
<?php endif; ?>
|
39 |
<?php if ( (bool) $this->gpi_options['bad_api_key'] && 'options' != $admin_page ) : ?>
|
40 |
<div id="message" class="error">
|
41 |
+
<p><strong><?php esc_html_e( 'The Google Pagespeed API Key you entered appears to be invalid. Please update your API key in the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=options' ); ?>"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong>.</p>
|
42 |
</div>
|
43 |
<?php endif; ?>
|
44 |
<?php if ( (bool) $this->gpi_options['pagespeed_disabled'] && 'options' != $admin_page ) : ?>
|
45 |
<div id="message" class="error">
|
46 |
+
<p><strong><?php esc_html_e( 'The "PageSpeed Insights API" service is not enabled. To enable it, please visit the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( 'https://console.developers.google.com/' ); ?>" target="_blank"><?php esc_html_e( 'Google API Console', 'gpagespeedi' ); ?></a></strong>.</p>
|
47 |
</div>
|
48 |
<?php endif; ?>
|
49 |
<?php if ( (bool) $this->gpi_options['api_restriction'] ) : ?>
|
50 |
<div id="message" class="error">
|
51 |
+
<p><strong><?php esc_html_e( 'This referrer or IP address is restricted from using your API Key. To change your API Key restrictions, please visit the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( 'https://console.developers.google.com/' ); ?>" target="_blank"><?php esc_html_e( 'Google API Console', 'gpagespeedi' ); ?></a></strong>.</p>
|
52 |
</div>
|
53 |
<?php endif; ?>
|
54 |
<?php if ( $action_message = $this->gpi_ui_options['action_message'] ) :
|
69 |
<?php endif; ?>
|
70 |
<?php if ( isset( $_GET['render'] ) && 'logs' == $_GET['render'] && ! (bool) $this->gpi_options['log_api_errors'] ) : ?>
|
71 |
<div id="message" class="error">
|
72 |
+
<p><strong><?php esc_html_e( 'API error logging is disabled. Enable "Log API Exceptions" to record new errors.', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=options' ); ?>"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong></p>
|
73 |
</div>
|
74 |
<?php endif; ?>
|
75 |
<?php if ( (bool) $this->gpi_options['new_ignored_items'] ) : ?>
|
76 |
<div id="message" class="notice notice-error is-dismissible">
|
77 |
+
<p><strong><?php esc_html_e( 'One or more URLs could not be reached by Google Pagespeed Insights and have automatically been added to the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=ignored-urls' ); ?>"><?php esc_html_e( 'Ignored URLs', 'gpagespeedi' ); ?></a></strong>.</p>
|
78 |
</div>
|
79 |
<?php endif; ?>
|
80 |
<?php if ( (bool) $this->gpi_options['backend_error'] ) : ?>
|
81 |
<div id="message" class="error">
|
82 |
+
<p><strong><?php echo wp_kses_data( __( 'An error has been encountered while checking one or more URLs. Possible causes: <br /><br />Daily API Limit Exceeded <a href="https://console.developers.google.com/" target="_blank">Check API Usage</a> <br />API Key user limit exceeded <a href="https://console.developers.google.com/" target="_blank">Check API Usage</a> <br />the URL is not publicly accessible or is bad. <br /><br />The URL(s) have been added to the', 'gpagespeedi' ) ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=ignored-urls' ); ?>"><?php esc_html_e( 'Ignored URLs', 'gpagespeedi' ); ?></a></strong></p>
|
83 |
+
</div>
|
84 |
+
<?php endif; ?>
|
85 |
+
<?php if ( (bool) $this->gpi_options['check_logs'] ) : ?>
|
86 |
+
<div id="message" class="error">
|
87 |
+
<?php if ( (bool) $this->gpi_options['log_api_errors'] ) : ?>
|
88 |
+
<p><strong><?php echo wp_kses_data( __( 'An error has been encountered with the Google Pagespeed API.', 'gpagespeedi' ) ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=logs' ); ?>"><?php esc_html_e( 'View the API Exception Logs', 'gpagespeedi' ); ?></a></strong></p>
|
89 |
+
<?php else : ?>
|
90 |
+
<p><strong><?php echo wp_kses_data( __( 'An error has been encountered with the Google Pagespeed API. Please enable "Log API Exceptions" under "Advanced Configuration" on the options page, then try scanning URLs again. API errors are stored in the logs for up to 7 days.', 'gpagespeedi' ) ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=options' ); ?>"><?php esc_html_e( 'Options', 'gpagespeedi' ); ?></a></strong></p>
|
91 |
+
<?php endif; ?>
|
92 |
</div>
|
93 |
<?php endif; ?>
|
94 |
<?php if ( $worker_status = apply_filters( 'gpi_check_status', false ) ) : ?>
|
96 |
<?php if ( 'disabled' != $this->gpi_options['heartbeat'] ) : ?>
|
97 |
<span>
|
98 |
<p id="gpi_status_abort" style="font-size: 13px; display: none;"><?php esc_html_e( 'Google Pagespeed has successfully stopped checking pages due to a user requested abort.', 'gpagespeedi' ); ?></p>
|
99 |
+
<p id="gpi_status_finished" style="font-size: 13px; display: none;"><?php esc_html_e( 'Google Pagespeed has finished checking pagespeed scores.', 'gpagespeedi' );?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=report-list' ); ?>"><?php esc_html_e( 'See new results', 'gpagespeedi' ); ?>.</a></p>
|
100 |
<p id="gpi_status_ajax" class="ellipsis" style="font-size: 13px;"><?php esc_html_e( 'Google Pagespeed is running in the background ', 'gpagespeedi' ); ?></p>
|
101 |
</span>
|
102 |
<?php else : ?>
|
113 |
<?php if ( ! $worker_status && ! (bool) $this->gpi_options['last_run_finished'] ) : ?>
|
114 |
<div id="message" class="error">
|
115 |
<?php if ( apply_filters( 'gpi_set_time_limit_disabled', false ) ) : ?>
|
116 |
+
<p><strong><?php esc_html_e( 'The last pagespeed report scan failed to finish successfully. We have detected that your server may not allow the maximum execution time to be overridden by this plugin. If you continue to experience problems with pagespeed report scans failing to complete, try setting the Maximum Script Run Time in the Advanced Configuration section on the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=options' ); ?>"><?php esc_html_e( 'Options Page', 'gpagespeedi' ); ?></a></strong>.</p>
|
117 |
<?php else : ?>
|
118 |
+
<p><strong><?php esc_html_e( 'The last pagespeed report scan failed to finish successfully. If you continue to experience problems with pagespeed report scans failing to complete, try increasing the Maximum Execution Time, or setting the Maximum Script Run Time in the Advanced Configuration section on the', 'gpagespeedi' ); ?> <a href="<?php echo esc_url( '?page=google-pagespeed-insights&render=options' ); ?>"><?php esc_html_e( 'Options Page', 'gpagespeedi' ); ?></a></strong>.</p>
|
119 |
<?php endif; ?>
|
120 |
</div>
|
121 |
<?php endif; ?>
|