Skip to content

Commit

Permalink
v1.7.2: Always use https:// embed code URL
Browse files Browse the repository at this point in the history
Typekit's default embed code now uses https://use.typekit.net (instead of //use.typekit.net).

Also addresses https://wordpress.org/support/topic/not-working-embed-code-changes-when-i-save?replies=1
  • Loading branch information
om4james committed Oct 6, 2015
1 parent e1eea19 commit 8250900
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
13 changes: 8 additions & 5 deletions readme.txt
Expand Up @@ -2,9 +2,9 @@
Contributors: jamescollins, glenn-om4
Donate link: https://om4.com.au/wordpress-plugins/#donate
Tags: typekit, fonts, font, design, wp, multisite, wpmu
Requires at least: 3.6
Tested up to: 4.2
Stable tag: 1.7.1
Requires at least: 4.0
Tested up to: 4.3.1
Stable tag: 1.7.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -24,8 +24,6 @@ Compatible with WordPress Multisite.

This plugin is designed to function securely with both WordPress and WordPress Multisite. When the JavaScript Embed Code is entered on the settings page, the user account id is extracted from the embed code and the correctly formed Typekit Embed Code is included in the site header, so it is not possible to use the Embed Code field to include arbitrary JavaScript. The Custom CSS field is also filtered, and doesn't allow any HTML code to be entered.

If the website is using HTTPS/SSL, the SSL version of the Typekit embed code is automatically used instead.

**Available Languages**

* Japanese – 日本語 ( ja )
Expand Down Expand Up @@ -63,6 +61,11 @@ Please see [this page](http://help.typekit.com/customer/portal/articles/6786-bro

== Changelog ==

= 1.7.2 =
* Use Typekit's latest recommended embed code (which uses a https:// typekit embed code URL for all sites).
* WordPress 4.3 compatibility.
* Change plugin's textdomain to match the plugin's folder name in preparation for translate.wordpress.org translations.

= 1.7.1 =
* WordPress 4.1 compatibility.
* Readme updates.
Expand Down
2 changes: 1 addition & 1 deletion typekit-admin.php
Expand Up @@ -67,7 +67,7 @@ function AdminPage() {
<?php
} else {
// ensure the Typekit account ID maps to a valid JS file on Typekit's servers (ie doesn't return a 404 error)
$url = sprintf($this->typekitInstance->embedcodeurl, $this->typekitInstance->scheme, $id);
$url = sprintf($this->typekitInstance->embedcodeurl, $id);
$result = wp_remote_head($url);
if (is_array($result) && $result['response']['code'] == 404) {
?>
Expand Down
18 changes: 4 additions & 14 deletions typekit.php
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Typekit Fonts for WordPress
Plugin URI: https://om4.com.au/wordpress-plugins/typekit-fonts-for-wordpress-plugin/
Description: Use a range of hundreds of high quality fonts on your WordPress website by integrating the <a href="http://typekit.com">Typekit</a> font service into your WordPress blog.
Version: 1.7.1
Version: 1.7.2
Author: OM4
Author URI: https://om4.com.au/
Text Domain: typekit-fonts-for-wordpress
Expand Down Expand Up @@ -41,8 +41,8 @@ class OM4_Typekit {

var $admin;

var $embedcode = '<script type="text/javascript" src="//use.typekit.net/%s.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>';
var $embedcode = '<script src="https://use.typekit.net/%s.js"></script>
<script>try{Typekit.load({ async: true });}catch(e){}</script>';

/**
* Perl-based regular expression that is used to extract the ID from the typekit embed code
Expand All @@ -60,7 +60,7 @@ class OM4_Typekit {
*
* @var string
*/
var $embedcodeurl = '%s://use.typekit.net/%s.js';
var $embedcodeurl = 'https://use.typekit.net/%s.js';

/*
* Default settings
Expand All @@ -69,15 +69,6 @@ class OM4_Typekit {
'id'=> '',
'css' => ''
);

/*
* HTTP scheme.
*
* HTTP by deafult, or HTTPS if the site is being loaded over SSL.
*
* @var string
*/
var $scheme = 'http';

/**
* Class Constructor
Expand All @@ -100,7 +91,6 @@ function OM4_Typekit() {
$this->settings = $data['settings'];
}

if ( is_ssl() ) $this->scheme = 'https';
}

/**
Expand Down

0 comments on commit 8250900

Please sign in to comment.