Changeset 2318196
- Timestamp:
- 06/04/2020 01:57:39 PM (6 years ago)
- Location:
- image-cdn/trunk
- Files:
-
- 4 edited
-
image-cdn.php (modified) (1 diff)
-
imageengine/class-imagecdn.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
templates/settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
image-cdn/trunk/image-cdn.php
r2279493 r2318196 7 7 * Author URI: https://imageengine.io/ 8 8 * License: GPLv2 or later 9 * Version: 1.0. 19 * Version: 1.0.3 10 10 */ 11 11 -
image-cdn/trunk/imageengine/class-imagecdn.php
r2279493 r2318196 35 35 36 36 // Resource hints. 37 add_action( 'wp_head', array( self::class, 'add_head_tags' ), 0 ); 37 //add_action( 'wp_head', array( self::class, 'add_head_tags' ), 0 ); 38 add_action( 'send_headers', array( self::class, 'add_headers' ), 0 ); 38 39 } 39 40 … … 46 47 add_filter( 'plugin_action_links_' . IMAGE_CDN_BASE, array( self::class, 'add_action_link' ) ); 47 48 } 49 50 /** 51 * Add http headers for Client Hints, Feature Policy and Preconnect Resource Hint. 52 */ 53 public static function add_headers() { 54 // Add client hints. 55 header( 'Accept-CH: viewport-width, width, device-memory, dpr, rtt, downlink, ect' ); 56 57 // Add resource hints and feature policy. 58 $options = self::get_options(); 59 $host = wp_parse_url( $options['url'], PHP_URL_HOST ); 60 if ( ! empty( $host ) ) { 61 $protocol = (is_ssl()) ? "https://" : "http://"; 62 header( 'Link: <'.$protocol.$host.'>; rel=preconnect' ); 63 header( 'Feature-Policy: ch-viewport-width '.$protocol.$host.'; ch-width '.$protocol.$host.'; ch device-memory '.$protocol.$host.'; ch-dpr '.$protocol.$host.'; ch-rtt '.$protocol.$host.'; ch-downlink '.$protocol.$host.'; ch-ect '.$protocol.$host.';' ); 64 } 65 } 66 48 67 49 68 /** -
image-cdn/trunk/readme.txt
r2295220 r2318196 120 120 == Changelog == 121 121 122 = 1.0.3 = 123 * Support for Client Hints and Feature Policy 124 122 125 = 1.0.2 = 123 126 * Updated readme with better documentation -
image-cdn/trunk/templates/settings.php
r2295220 r2318196 21 21 <p><?php esc_html_e( 'To obtain an ImageEngine CDN hostname' ); ?>:</p> 22 22 <ol> 23 <li><a target="_blank" href="https://imageengine.io/signup/? utm_source=WP-plugin-settigns&utm_medium=page&utm_term=wp-imageengine&utm_campaign=wp-imageengine">Sign up for an ImageEngine account</a></li>23 <li><a target="_blank" href="https://imageengine.io/signup/?website=<?php echo get_site_url();?>&?utm_source=WP-plugin-settigns&utm_medium=page&utm_term=wp-imageengine&utm_campaign=wp-imageengine">Sign up for an ImageEngine account</a></li> 24 24 <li> 25 25 <?php
Note: See TracChangeset
for help on using the changeset viewer.