Typekit Fonts for WordPress - Version 1.8.1

Version Description

  • PHP7 compatibility (no more deprecated constructor warning).
Download this release

Release Info

Developer jamescollins
Plugin Icon 128x128 Typekit Fonts for WordPress
Version 1.8.1
Comparing to
See all releases

Code changes from version 1.8 to 1.8.1

Files changed (3) hide show
  1. readme.txt +5 -2
  2. typekit-admin.php +5 -6
  3. typekit.php +23 -25
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: jamescollins, glenn-om4
3
  Donate link: https://om4.com.au/plugins/#donate
4
  Tags: typekit, fonts, font, design, wp, multisite, wpmu, css, snippet
5
  Requires at least: 4.0
6
- Tested up to: 4.4
7
- Stable tag: 1.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -61,6 +61,9 @@ Please see [this page](http://help.typekit.com/customer/portal/articles/6786-bro
61
 
62
  == Changelog ==
63
 
 
 
 
64
  = 1.8 =
65
  * Use WordPress.org language packs for plugin translations.
66
  * Improved compatibility with older PHP versions (no more pass by reference).
3
  Donate link: https://om4.com.au/plugins/#donate
4
  Tags: typekit, fonts, font, design, wp, multisite, wpmu, css, snippet
5
  Requires at least: 4.0
6
+ Tested up to: 4.5
7
+ Stable tag: 1.8.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
61
 
62
  == Changelog ==
63
 
64
+ = 1.8.1 =
65
+ * PHP7 compatibility (no more deprecated constructor warning).
66
+
67
  = 1.8 =
68
  * Use WordPress.org language packs for plugin translations.
69
  * Improved compatibility with older PHP versions (no more pass by reference).
typekit-admin.php CHANGED
@@ -6,14 +6,14 @@
6
  */
7
  class OM4_Typekit_Admin {
8
 
9
- var $typekitInstance;
10
 
11
  /**
12
  * Class Constructor
13
  *
14
  * @param OM4_Typekit instance
15
  */
16
- function OM4_Typekit_Admin(& $instance) {
17
  global $wpdb;
18
 
19
  $this->typekitInstance = $instance;
@@ -24,14 +24,14 @@ class OM4_Typekit_Admin {
24
  /**
25
  * Set up the Admin Settings menu
26
  */
27
- function AdminMenu() {
28
  add_options_page(__('Typekit Fonts', 'typekit-fonts-for-wordpress'), __('Typekit Fonts', 'typekit-fonts-for-wordpress'), 'manage_options', basename(__FILE__), array($this, 'AdminPage'));
29
  }
30
 
31
  /**
32
  * Display the admin settings page
33
  */
34
- function AdminPage() {
35
  ?>
36
  <div class="wrap typekitsettings">
37
  <style type="text/css">
@@ -154,5 +154,4 @@ class OM4_Typekit_Admin {
154
  </div>
155
  <?php
156
  }
157
- }
158
- ?>
6
  */
7
  class OM4_Typekit_Admin {
8
 
9
+ private $typekitInstance;
10
 
11
  /**
12
  * Class Constructor
13
  *
14
  * @param OM4_Typekit instance
15
  */
16
+ public function __construct(& $instance) {
17
  global $wpdb;
18
 
19
  $this->typekitInstance = $instance;
24
  /**
25
  * Set up the Admin Settings menu
26
  */
27
+ public function AdminMenu() {
28
  add_options_page(__('Typekit Fonts', 'typekit-fonts-for-wordpress'), __('Typekit Fonts', 'typekit-fonts-for-wordpress'), 'manage_options', basename(__FILE__), array($this, 'AdminPage'));
29
  }
30
 
31
  /**
32
  * Display the admin settings page
33
  */
34
+ public function AdminPage() {
35
  ?>
36
  <div class="wrap typekitsettings">
37
  <style type="text/css">
154
  </div>
155
  <?php
156
  }
157
+ }
 
typekit.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Typekit Fonts for WordPress
4
  Plugin URI: https://om4.com.au/plugins/typekit-fonts-for-wordpress-plugin/
5
  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.
6
- Version: 1.8
7
  Author: OM4
8
  Author URI: https://om4.com.au/plugins/
9
  Text Domain: typekit-fonts-for-wordpress
@@ -11,7 +11,7 @@ License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
14
- /* Copyright 2009-2015 OM4 (email : info@om4.com.au)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
@@ -31,17 +31,17 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
31
 
32
  class OM4_Typekit {
33
 
34
- var $dbVersion = 1;
35
 
36
- var $installedVersion;
37
 
38
- var $dirname;
39
 
40
- var $optionName = 'OM4_Typekit';
41
 
42
- var $admin;
43
 
44
- var $embedcode = '<script src="https://use.typekit.net/%s.js"></script>
45
  <script>try{Typekit.load({ async: true });}catch(e){}</script>';
46
 
47
  /**
@@ -53,19 +53,19 @@ class OM4_Typekit {
53
  *
54
  * @var string
55
  */
56
- var $embedcoderegexp = '#(https?:)?//use\.typekit\.(com|net)/([a-z0-9]*)\.js#i';
57
 
58
  /**
59
  * The format for the Typekit JS file URL. Used in HTTP requests to verify that the URL doesn't produce a 404 error
60
  *
61
  * @var string
62
  */
63
- var $embedcodeurl = 'https://use.typekit.net/%s.js';
64
 
65
  /*
66
  * Default settings
67
  */
68
- var $settings = array(
69
  'id'=> '',
70
  'css' => ''
71
  );
@@ -74,7 +74,7 @@ class OM4_Typekit {
74
  * Class Constructor
75
  *
76
  */
77
- function OM4_Typekit() {
78
 
79
  // Store the name of the directory that this plugin is installed in
80
  $this->dirname = str_replace('/typekit.php', '', plugin_basename(__FILE__));
@@ -98,7 +98,7 @@ class OM4_Typekit {
98
  /**
99
  * Load up the relevant language pack if we're using WordPress in a different language.
100
  */
101
- function LoadDomain() {
102
  load_plugin_textdomain( 'typekit-fonts-for-wordpress' );
103
  }
104
 
@@ -106,7 +106,7 @@ class OM4_Typekit {
106
  * Plugin Activation Tasks
107
  *
108
  */
109
- function Activate() {
110
  // There aren't really any installation tasks at the moment
111
  if (!$this->installedVersion) {
112
  $this->installedVersion = $this->dbVersion;
@@ -118,7 +118,7 @@ class OM4_Typekit {
118
  * Performs any upgrade tasks if required
119
  *
120
  */
121
- function CheckVersion() {
122
  if ($this->installedVersion != $this->dbVersion) {
123
  // Upgrade tasks
124
  if ($this->installedVersion == 0) {
@@ -132,7 +132,7 @@ class OM4_Typekit {
132
  * Initialise the plugin.
133
  * Set up the admin interface if necessary
134
  */
135
- function Initialise() {
136
 
137
  $this->CheckVersion();
138
 
@@ -146,7 +146,7 @@ class OM4_Typekit {
146
  /**
147
  * Saves the plugin's settings to the database
148
  */
149
- function SaveSettings() {
150
  $data = array_merge(array('version' => $this->installedVersion), array('settings' => $this->settings));
151
  update_option($this->optionName, $data);
152
  }
@@ -155,7 +155,7 @@ class OM4_Typekit {
155
  * Retrieve the Typekit embed code if the unique account id has been set
156
  * @return string The typekit embed code if the unique account ID has been set, otherwise an empty string
157
  */
158
- function GetEmbedCode() {
159
  if ('' != $id = $this->GetAccountID()) return sprintf($this->embedcode, $id);
160
  return '';
161
  }
@@ -164,7 +164,7 @@ class OM4_Typekit {
164
  * Get the stored Typekit Account ID
165
  * @return string The account ID if it has been specified, otherwise an empty string
166
  */
167
- function GetAccountID() {
168
  if (strlen($this->settings['id'])) return $this->settings['id'];
169
  return '';
170
  }
@@ -173,7 +173,7 @@ class OM4_Typekit {
173
  * Extract the unique account id from the JavaScript embed code
174
  * @param string JavaScript embed code
175
  */
176
- function ParseEmbedCode($code) {
177
  $matches = array();
178
 
179
  $this->settings['id'] = '';
@@ -187,7 +187,7 @@ class OM4_Typekit {
187
  * Retrieve the custom CSS rules
188
  * @return string The custom CSS rules
189
  */
190
- function GetCSSRules() {
191
  return $this->settings['css'];
192
  }
193
 
@@ -196,7 +196,7 @@ class OM4_Typekit {
196
  * The input is santized by stripping all HTML tags
197
  * @param string CSS code
198
  */
199
- function SetCSSRules($code) {
200
  $this->settings['css'] = '';
201
  $code = strip_tags($code);
202
  if (strlen($code)) $this->settings['css'] = $code;
@@ -205,7 +205,7 @@ class OM4_Typekit {
205
  /**
206
  * Display the plugin's javascript and css code in the site's header
207
  */
208
- function HeaderCode() {
209
  ?>
210
 
211
  <!-- BEGIN Typekit Fonts for WordPress -->
@@ -234,5 +234,3 @@ if(defined('ABSPATH') && defined('WPINC')) {
234
  $GLOBALS["OM4_Typekit"] = new OM4_Typekit();
235
  }
236
  }
237
-
238
- ?>
3
  Plugin Name: Typekit Fonts for WordPress
4
  Plugin URI: https://om4.com.au/plugins/typekit-fonts-for-wordpress-plugin/
5
  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.
6
+ Version: 1.8.1
7
  Author: OM4
8
  Author URI: https://om4.com.au/plugins/
9
  Text Domain: typekit-fonts-for-wordpress
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  */
13
 
14
+ /* Copyright 2009-2016 OM4 (email : info@om4.com.au)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
31
 
32
  class OM4_Typekit {
33
 
34
+ private $dbVersion = 1;
35
 
36
+ private $installedVersion;
37
 
38
+ private $dirname;
39
 
40
+ private $optionName = 'OM4_Typekit';
41
 
42
+ private $admin;
43
 
44
+ public $embedcode = '<script src="https://use.typekit.net/%s.js"></script>
45
  <script>try{Typekit.load({ async: true });}catch(e){}</script>';
46
 
47
  /**
53
  *
54
  * @var string
55
  */
56
+ public $embedcoderegexp = '#(https?:)?//use\.typekit\.(com|net)/([a-z0-9]*)\.js#i';
57
 
58
  /**
59
  * The format for the Typekit JS file URL. Used in HTTP requests to verify that the URL doesn't produce a 404 error
60
  *
61
  * @var string
62
  */
63
+ public $embedcodeurl = 'https://use.typekit.net/%s.js';
64
 
65
  /*
66
  * Default settings
67
  */
68
+ private $settings = array(
69
  'id'=> '',
70
  'css' => ''
71
  );
74
  * Class Constructor
75
  *
76
  */
77
+ public function __construct() {
78
 
79
  // Store the name of the directory that this plugin is installed in
80
  $this->dirname = str_replace('/typekit.php', '', plugin_basename(__FILE__));
98
  /**
99
  * Load up the relevant language pack if we're using WordPress in a different language.
100
  */
101
+ public function LoadDomain() {
102
  load_plugin_textdomain( 'typekit-fonts-for-wordpress' );
103
  }
104
 
106
  * Plugin Activation Tasks
107
  *
108
  */
109
+ public function Activate() {
110
  // There aren't really any installation tasks at the moment
111
  if (!$this->installedVersion) {
112
  $this->installedVersion = $this->dbVersion;
118
  * Performs any upgrade tasks if required
119
  *
120
  */
121
+ public function CheckVersion() {
122
  if ($this->installedVersion != $this->dbVersion) {
123
  // Upgrade tasks
124
  if ($this->installedVersion == 0) {
132
  * Initialise the plugin.
133
  * Set up the admin interface if necessary
134
  */
135
+ public function Initialise() {
136
 
137
  $this->CheckVersion();
138
 
146
  /**
147
  * Saves the plugin's settings to the database
148
  */
149
+ public function SaveSettings() {
150
  $data = array_merge(array('version' => $this->installedVersion), array('settings' => $this->settings));
151
  update_option($this->optionName, $data);
152
  }
155
  * Retrieve the Typekit embed code if the unique account id has been set
156
  * @return string The typekit embed code if the unique account ID has been set, otherwise an empty string
157
  */
158
+ public function GetEmbedCode() {
159
  if ('' != $id = $this->GetAccountID()) return sprintf($this->embedcode, $id);
160
  return '';
161
  }
164
  * Get the stored Typekit Account ID
165
  * @return string The account ID if it has been specified, otherwise an empty string
166
  */
167
+ public function GetAccountID() {
168
  if (strlen($this->settings['id'])) return $this->settings['id'];
169
  return '';
170
  }
173
  * Extract the unique account id from the JavaScript embed code
174
  * @param string JavaScript embed code
175
  */
176
+ public function ParseEmbedCode($code) {
177
  $matches = array();
178
 
179
  $this->settings['id'] = '';
187
  * Retrieve the custom CSS rules
188
  * @return string The custom CSS rules
189
  */
190
+ public function GetCSSRules() {
191
  return $this->settings['css'];
192
  }
193
 
196
  * The input is santized by stripping all HTML tags
197
  * @param string CSS code
198
  */
199
+ public function SetCSSRules($code) {
200
  $this->settings['css'] = '';
201
  $code = strip_tags($code);
202
  if (strlen($code)) $this->settings['css'] = $code;
205
  /**
206
  * Display the plugin's javascript and css code in the site's header
207
  */
208
+ public function HeaderCode() {
209
  ?>
210
 
211
  <!-- BEGIN Typekit Fonts for WordPress -->
234
  $GLOBALS["OM4_Typekit"] = new OM4_Typekit();
235
  }
236
  }