Skip to content

Commit b95c92d

Browse files
committed
1.5.5 update
1 parent 4538816 commit b95c92d

File tree

7 files changed

+76
-367
lines changed

7 files changed

+76
-367
lines changed

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
8+
{
9+
"name": "Listen for XDebug",
10+
"type": "php",
11+
"request": "launch",
12+
"port": 9000
13+
},
14+
{
15+
"name": "Launch currently open script",
16+
"type": "php",
17+
"request": "launch",
18+
"program": "${file}",
19+
"cwd": "${fileDirname}",
20+
"port": 9000
21+
}
22+
]
23+
}

admin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Plugin Name: Pre* Party Resource Hints
44
* Plugin URI: https://wordpress.org/plugins/pre-party-browser-hints/
55
* Description: Take advantage of the browser resource hints DNS-Prefetch, Prerender, Preconnect, Prefetch, and Preload to improve page load time.
6-
* Version: 1.5.4.1
6+
* Version: 1.5.5
77
* Author: Sam Perrow
88
* Author URI: https://www.linkedin.com/in/sam-perrow
99
* License: GPL2
10-
* last edited October 19, 2018
10+
* last edited February 16, 2019
1111
*
12-
* Copyright 2018 Sam Perrow (email : sam.perrow399@gmail.com)
12+
* Copyright 2016 Sam Perrow (email : sam.perrow399@gmail.com)
1313
*
1414
* This program is free software; you can redistribute it and/or modify
1515
* it under the terms of the GNU General Public License as published by

class-gktpp-options.php

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ public function save_plugin_tabs() {
4040
}
4141

4242
public function apply_wp_screen_options( $status, $option, $value ) {
43-
if ( 'gktpp_screen_options' === $option ) {
44-
return $value;
45-
}
46-
47-
return $status;
43+
return ( 'gktpp_screen_options' === $option ) ? $value : $status;
4844
}
4945

5046
public function admin_tabs( $current = 'insert-urls' ) {
@@ -120,14 +116,15 @@ public static function url_updated( $status ) { ?>
120116
</div>
121117
<?php }
122118

123-
private function resource_hint_nav() { ?>
124-
<p><a href="<?php echo esc_html( '/wp-admin/admin.php?page=gktpp-plugin-settings&tab=info#gktpp-dns-prefetch'); ?>">DNS Prefetch</a></p>
125-
<p><a href="<?php echo esc_html( '/wp-admin/admin.php?page=gktpp-plugin-settings&tab=info#gktpp-prefetch' ); ?>">Prefetch</a></p>
126-
<p><a href="<?php echo esc_html( '/wp-admin/admin.php?page=gktpp-plugin-settings&tab=info#gktpp-prerender' ); ?>">Prerender</a></p>
127-
<p><a href="<?php echo esc_html( '/wp-admin/admin.php?page=gktpp-plugin-settings&tab=info#gktpp-preconnect' ); ?>">Preconnect</a></p>
128-
<p><a href="<?php echo esc_html( '/wp-admin/admin.php?page=gktpp-plugin-settings&tab=info#gktpp-preload' ); ?>">Preload</a></p>
129-
130-
<?php }
119+
private function resource_hint_nav() {
120+
$link = '/wp-admin/admin.php?page=gktpp-plugin-settings&tab=info#gktpp-'; ?>
121+
<p><a href="<?php echo esc_html( $link . 'dns-prefetch'); ?>">DNS Prefetch</a></p>
122+
<p><a href="<?php echo esc_html( $link . 'prefetch' ); ?>">Prefetch</a></p>
123+
<p><a href="<?php echo esc_html( $link . 'prerender' ); ?>">Prerender</a></p>
124+
<p><a href="<?php echo esc_html( $link . 'preconnect' ); ?>">Preconnect</a></p>
125+
<p><a href="<?php echo esc_html( $link . 'preload' ); ?>">Preload</a></p>
126+
<?php
127+
}
131128

132129
private function show_dnsprefetch_info() {
133130
?>

class-gktpp-table.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function get_columns() {
5959
'url' => __( 'URL', 'gktpp' ),
6060
'hint_type' => __( 'Hint Type', 'gktpp' ),
6161
'status' => __( 'Status', 'gktpp' ),
62-
'author' => __( 'Author', 'gktpp' ),
62+
'author' => __( 'Author', 'gktpp' )
6363
);
6464

6565
return $columns;
@@ -114,16 +114,12 @@ public function column_default( $item, $column_name ) {
114114
switch ( $column_name ) {
115115
case 'url':
116116
return $item['url'];
117-
118117
case 'hint_type':
119118
return $item['hint_type'];
120-
121119
case 'status':
122-
return $item['status'];
123-
120+
return $item['status'];
124121
case 'author':
125122
return wp_get_current_user()->display_name;
126-
127123
default:
128124
return esc_html_e( 'Error', 'gktpp' );
129125
}
@@ -138,7 +134,7 @@ public function get_sortable_columns() {
138134
$sortable_columns = array(
139135
'url' => array( 'url', true ),
140136
'hint_type' => array( 'hint_type', false ),
141-
'status' => array( 'status', false ),
137+
'status' => array( 'status', false )
142138
);
143139

144140
return $sortable_columns;
@@ -198,8 +194,8 @@ public function prepare_items() {
198194

199195
GKTPP_Enter_Data::contact_author();
200196

201-
$text = sprintf( __( 'Tip: test your website on <a href="%s">WebPageTest.org</a> to know which resource hints and URLs to insert.' ), __( 'https://www.webpagetest.org' ) );
202-
echo $text;
197+
$text = sprintf( __( 'Tip: test your website on <a href="%s">WebPageTest.org</a> to know which resource hints and URLs to insert.' ), __( 'https://www.webpagetest.org' ) );
198+
echo $text;
203199
}
204200

205201
}
@@ -208,7 +204,7 @@ public function get_bulk_actions() {
208204
$actions = array(
209205
'deleted' => __( 'Delete', 'gktpp' ),
210206
'enabled' => __( 'Enable', 'gktpp' ),
211-
'disabled' => __( 'Disable', 'gktpp' ),
207+
'disabled' => __( 'Disable', 'gktpp' )
212208
);
213209
return $actions;
214210
}

js/find-external-domains.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var gktppFindExternalDomains = function() {
22
var scripts = document.getElementsByTagName('script');
3+
var host = document.location.origin;
34
var urls = [];
45

56
function sanitizeURL(url) {
@@ -8,7 +9,6 @@ var gktppFindExternalDomains = function() {
89

910
function findResourceSources() {
1011
var resources = window.performance.getEntriesByType('resource');
11-
var host = document.location.origin;
1212

1313
for (var i = 0; i < resources.length; i++ ) {
1414
var newStr = resources[i].name.split('/');
@@ -26,7 +26,7 @@ var gktppFindExternalDomains = function() {
2626
findResourceSources();
2727
console.log(urls);
2828
var xhr = new XMLHttpRequest();
29-
xhr.open('POST', document.location.origin + '/wp-admin/admin-ajax.php', true);
29+
xhr.open('POST', host + '/wp-admin/admin-ajax.php', true);
3030
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
3131
xhr.send('action=gktpp_post_domain_names&urls=' + JSON.stringify(urls));
3232
}, 6000);

0 commit comments

Comments
 (0)