Typekit Fonts for WordPress - Version 1.0.3

Version Description

Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.3

readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: jamescollins, glenn-om4
3
  Tags: typekit, fonts, font, design, wp, wpmu
4
  Requires at least: 2.8
5
- Tested up to: 2.9
6
- Stable tag: 1.0.2
7
 
8
  Use a range of hundreds of high quality fonts on your WordPress website by integrating the Typekit font service into your WordPress blog.
9
 
@@ -21,6 +21,8 @@ Compatible with both WordPress and WordPress MU (WPMU).
21
 
22
  This plugin is designed to function securely with both WordPress and WordPress MU. 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.
23
 
 
 
24
  == Installation ==
25
 
26
  Installation of this plugin is simple:
@@ -50,13 +52,17 @@ Please see [this page](http://getsatisfaction.com/typekit/topics/typekit_browser
50
 
51
  == Changelog ==
52
 
 
 
 
 
53
  = v1.0.2 =
54
  * Add instructions on how to use Typekit Kit Editor selectors.
55
  * Add instructions on how to use font weights / styles.
56
 
57
  = v1.0.1 =
58
- * WordPress 2.9 compatibility
59
- * Improve FAQ
60
 
61
  = v1.0.0 =
62
 
2
  Contributors: jamescollins, glenn-om4
3
  Tags: typekit, fonts, font, design, wp, wpmu
4
  Requires at least: 2.8
5
+ Tested up to: 3.0.1
6
+ Stable tag: 1.0.3
7
 
8
  Use a range of hundreds of high quality fonts on your WordPress website by integrating the Typekit font service into your WordPress blog.
9
 
21
 
22
  This plugin is designed to function securely with both WordPress and WordPress MU. 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.
23
 
24
+ If the website is using HTTPS/SSL, the SSL version of the Typekit embed code is automatically used instead.
25
+
26
  == Installation ==
27
 
28
  Installation of this plugin is simple:
52
 
53
  == Changelog ==
54
 
55
+ = v1.0.3 =
56
+ * Add support for HTTPS/SSL websites.
57
+ * WordPress 3.0.1 compatibility.
58
+
59
  = v1.0.2 =
60
  * Add instructions on how to use Typekit Kit Editor selectors.
61
  * Add instructions on how to use font weights / styles.
62
 
63
  = v1.0.1 =
64
+ * WordPress 2.9 compatibility.
65
+ * Improve FAQ.
66
 
67
  = v1.0.0 =
68
 
screenshot-1.png CHANGED
Binary file
typekit-admin.php CHANGED
@@ -67,7 +67,7 @@ class OM4_Typekit_Admin {
67
  <?php
68
  } else {
69
  // ensure the Typekit account ID maps to a valid JS file on Typekit's servers (ie doesn't return a 404 error)
70
- $url = sprintf($this->typekitInstance->embedcodeurl, $id);
71
  $result = wp_remote_head($url);
72
  if (is_array($result) && $result['response']['code'] == 404) {
73
  ?>
@@ -100,8 +100,9 @@ class OM4_Typekit_Admin {
100
  </ol>
101
  <h3><?php _e('Plugin Configuration', 'om4-typekit'); ?></h3>
102
  <ol start="4">
103
- <li><?php _e('Enter the whole 2 lines of your embed code into the box below:', 'om4-typekit'); ?><br />
104
- <p class="option"><label for="embedcode"><?php _e('Typekit Embed Code:', 'om4-typekit'); ?></label> <textarea name="embedcode" rows="3" cols="80" /><?php echo $this->typekitInstance->GetEmbedCode(); ?></textarea></p>
 
105
 
106
  </li>
107
  <li><?php _e('You can add selectors using the Typekit Kit Editor. Alternatively you can define your own CSS rules in your own style sheet or using the Custom CSS Rules field below (technical note: these CSS rules will be embedded in the header of each page). Look at the advanced examples shown in the Typekit editor for ideas.', 'om4-typekit'); ?>
67
  <?php
68
  } else {
69
  // ensure the Typekit account ID maps to a valid JS file on Typekit's servers (ie doesn't return a 404 error)
70
+ $url = sprintf($this->typekitInstance->embedcodeurl, $this->typekitInstance->scheme, $id);
71
  $result = wp_remote_head($url);
72
  if (is_array($result) && $result['response']['code'] == 404) {
73
  ?>
100
  </ol>
101
  <h3><?php _e('Plugin Configuration', 'om4-typekit'); ?></h3>
102
  <ol start="4">
103
+ <li><?php _e('Enter the whole 2 lines of your embed code into the box below.', 'om4-typekit'); ?><br />
104
+ <p class="option"><label for="embedcode"><?php _e('Typekit Embed Code:', 'om4-typekit'); ?></label> <textarea name="embedcode" rows="3" cols="80" /><?php echo $this->typekitInstance->GetEmbedCode(); ?></textarea><br />
105
+ <?php _e('Note: If you website loads over SSL/HTTPS, then the SSL Typekit embed code is used automatically (regardless of which scheme is pasted above).', 'om4-typekit'); ?></p>
106
 
107
  </li>
108
  <li><?php _e('You can add selectors using the Typekit Kit Editor. Alternatively you can define your own CSS rules in your own style sheet or using the Custom CSS Rules field below (technical note: these CSS rules will be embedded in the header of each page). Look at the advanced examples shown in the Typekit editor for ideas.', 'om4-typekit'); ?>
typekit-fonts-for-wordpress.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: \n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/typekit-fonts-for-wordpress\n"
11
- "POT-Creation-Date: 2010-01-15 03:24+0000\n"
12
  "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -92,14 +92,20 @@ msgid "Plugin Configuration"
92
  msgstr ""
93
 
94
  #: typekit-admin.php:103
95
- msgid "Enter the whole 2 lines of your embed code into the box below:"
96
  msgstr ""
97
 
98
  #: typekit-admin.php:104
99
  msgid "Typekit Embed Code:"
100
  msgstr ""
101
 
102
- #: typekit-admin.php:107
 
 
 
 
 
 
103
  msgid ""
104
  "You can add selectors using the Typekit Kit Editor. Alternatively you can "
105
  "define your own CSS rules in your own style sheet or using the Custom CSS "
@@ -108,50 +114,50 @@ msgid ""
108
  "editor for ideas."
109
  msgstr ""
110
 
111
- #: typekit-admin.php:108
112
  msgid "Custom CSS Rules:"
113
  msgstr ""
114
 
115
- #: typekit-admin.php:109
116
  msgid "Click here for help on CSS"
117
  msgstr ""
118
 
119
- #: typekit-admin.php:114
120
  msgid "Save Settings"
121
  msgstr ""
122
 
123
- #: typekit-admin.php:116
124
  msgid "Help"
125
  msgstr ""
126
 
127
- #: typekit-admin.php:117
128
  msgid "Fonts not showing?"
129
  msgstr ""
130
 
131
- #: typekit-admin.php:119
132
  msgid ""
133
  "Have you created your Typekit account, added fonts to it and <strong>pressed "
134
  "Publish</strong>? Fonts aren't available until they are published."
135
  msgstr ""
136
 
137
- #: typekit-admin.php:120
138
  msgid ""
139
  "Have you <strong>waited a few minutes</strong> to allow Typekit time to send "
140
  "your fonts out around the world? Grab a cup of coffee and try again soon."
141
  msgstr ""
142
 
143
- #: typekit-admin.php:121
144
  msgid ""
145
  "Have you <strong>added CSS rules</strong> to display your fonts? If in "
146
  "doubt, just try the H2 rule shown in the example and see if that works for "
147
  "you."
148
  msgstr ""
149
 
150
- #: typekit-admin.php:123
151
  msgid "CSS"
152
  msgstr ""
153
 
154
- #: typekit-admin.php:124
155
  msgid ""
156
  "You can use CSS selectors to apply your new typekit fonts. The settings for "
157
  "this plugin allow you to add new CSS rules to your website to activate "
@@ -160,7 +166,7 @@ msgid ""
160
  "good way to access different font weights."
161
  msgstr ""
162
 
163
- #: typekit-admin.php:125
164
  msgid ""
165
  "There are many options for using CSS, but here are a few common scenarios. "
166
  "Note: we've used proxima-nova for our examples, you'll need to change "
@@ -168,44 +174,44 @@ msgid ""
168
  "names will be visible in the Kit Editor."
169
  msgstr ""
170
 
171
- #: typekit-admin.php:126
172
  msgid "Headings"
173
  msgstr ""
174
 
175
- #: typekit-admin.php:128
176
  msgid ""
177
  "If you want your Typekit fonts to be used for H2 headings, add a rule like "
178
  "this to your CSS Rules field:"
179
  msgstr ""
180
 
181
- #: typekit-admin.php:130
182
  msgid ""
183
  "(and you can add similar rules if you want to target other headings such as "
184
  "H3)"
185
  msgstr ""
186
 
187
- #: typekit-admin.php:132
188
  msgid "Sidebar Headings"
189
  msgstr ""
190
 
191
- #: typekit-admin.php:134
192
  msgid ""
193
  "If you want your Typekit fonts to be used for sidebar H2 headings, add a "
194
  "rule like this to your CSS Rules field:"
195
  msgstr ""
196
 
197
- #: typekit-admin.php:137
198
  msgid "Font Weights"
199
  msgstr ""
200
 
201
- #: typekit-admin.php:138
202
  msgid ""
203
  "If your Kit contains more than one weight and/or style for a particular "
204
  "font, you need to use numeric <code class=\"inline\">font-weight</code> "
205
  "values in your CSS rules to map to a font's weights."
206
  msgstr ""
207
 
208
- #: typekit-admin.php:139
209
  msgid ""
210
  "Typekit fonts have been assigned values from 100 to 900 based on information "
211
  "from the font's designer. Web browsers also do some guessing as to which "
@@ -216,16 +222,16 @@ msgid ""
216
  "corresponds to <code class=\"inline\">font-weight: normal;</code>"
217
  msgstr ""
218
 
219
- #: typekit-admin.php:140
220
  #, php-format
221
  msgid "See <a href=\"%s\">this help article</a> for more details."
222
  msgstr ""
223
 
224
- #: typekit-admin.php:141
225
  msgid "Advanced targetting of fonts with CSS selectors"
226
  msgstr ""
227
 
228
- #: typekit-admin.php:143
229
  msgid ""
230
  "You can target your fonts to specific parts of your website if you know a "
231
  "bit more about your current WordPress theme and where the font family is "
@@ -237,33 +243,33 @@ msgid ""
237
  "for that selector to override that rule."
238
  msgstr ""
239
 
240
- #: typekit-admin.php:144
241
  msgid "For example, if your theme has this CSS rule:"
242
  msgstr ""
243
 
244
- #: typekit-admin.php:146
245
  msgid ""
246
  "you could create this rule to apply your new font to the body of your "
247
  "website:"
248
  msgstr ""
249
 
250
- #: typekit-admin.php:149
251
  msgid "Where to go to get help"
252
  msgstr ""
253
 
254
- #: typekit-admin.php:151
255
  msgid ""
256
  "<a href=\"http://getsatisfaction.com/typekit/\" target=\"_blank\">Typekit "
257
  "Support</a>"
258
  msgstr ""
259
 
260
- #: typekit-admin.php:152
261
  msgid ""
262
  "<a href=\"http://www.sitepoint.com/forums/forumdisplay.php?f=53\" target="
263
  "\"_blank\">Sitepoint CSS Forums</a>"
264
  msgstr ""
265
 
266
- #: typekit-admin.php:153
267
  msgid ""
268
  "<a href=\"http://www.w3schools.com/CSS/default.asp\" target=\"_blank"
269
  "\">W3Schools CSS Help</a>"
8
  msgstr ""
9
  "Project-Id-Version: \n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/typekit-fonts-for-wordpress\n"
11
+ "POT-Creation-Date: 2010-08-24 02:22+0000\n"
12
  "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
92
  msgstr ""
93
 
94
  #: typekit-admin.php:103
95
+ msgid "Enter the whole 2 lines of your embed code into the box below."
96
  msgstr ""
97
 
98
  #: typekit-admin.php:104
99
  msgid "Typekit Embed Code:"
100
  msgstr ""
101
 
102
+ #: typekit-admin.php:105
103
+ msgid ""
104
+ "Note: If you website loads over SSL/HTTPS, then the SSL Typekit embed code "
105
+ "is used automatically (regardless of which scheme is pasted above)."
106
+ msgstr ""
107
+
108
+ #: typekit-admin.php:108
109
  msgid ""
110
  "You can add selectors using the Typekit Kit Editor. Alternatively you can "
111
  "define your own CSS rules in your own style sheet or using the Custom CSS "
114
  "editor for ideas."
115
  msgstr ""
116
 
117
+ #: typekit-admin.php:109
118
  msgid "Custom CSS Rules:"
119
  msgstr ""
120
 
121
+ #: typekit-admin.php:110
122
  msgid "Click here for help on CSS"
123
  msgstr ""
124
 
125
+ #: typekit-admin.php:115
126
  msgid "Save Settings"
127
  msgstr ""
128
 
129
+ #: typekit-admin.php:117
130
  msgid "Help"
131
  msgstr ""
132
 
133
+ #: typekit-admin.php:118
134
  msgid "Fonts not showing?"
135
  msgstr ""
136
 
137
+ #: typekit-admin.php:120
138
  msgid ""
139
  "Have you created your Typekit account, added fonts to it and <strong>pressed "
140
  "Publish</strong>? Fonts aren't available until they are published."
141
  msgstr ""
142
 
143
+ #: typekit-admin.php:121
144
  msgid ""
145
  "Have you <strong>waited a few minutes</strong> to allow Typekit time to send "
146
  "your fonts out around the world? Grab a cup of coffee and try again soon."
147
  msgstr ""
148
 
149
+ #: typekit-admin.php:122
150
  msgid ""
151
  "Have you <strong>added CSS rules</strong> to display your fonts? If in "
152
  "doubt, just try the H2 rule shown in the example and see if that works for "
153
  "you."
154
  msgstr ""
155
 
156
+ #: typekit-admin.php:124
157
  msgid "CSS"
158
  msgstr ""
159
 
160
+ #: typekit-admin.php:125
161
  msgid ""
162
  "You can use CSS selectors to apply your new typekit fonts. The settings for "
163
  "this plugin allow you to add new CSS rules to your website to activate "
166
  "good way to access different font weights."
167
  msgstr ""
168
 
169
+ #: typekit-admin.php:126
170
  msgid ""
171
  "There are many options for using CSS, but here are a few common scenarios. "
172
  "Note: we've used proxima-nova for our examples, you'll need to change "
174
  "names will be visible in the Kit Editor."
175
  msgstr ""
176
 
177
+ #: typekit-admin.php:127
178
  msgid "Headings"
179
  msgstr ""
180
 
181
+ #: typekit-admin.php:129
182
  msgid ""
183
  "If you want your Typekit fonts to be used for H2 headings, add a rule like "
184
  "this to your CSS Rules field:"
185
  msgstr ""
186
 
187
+ #: typekit-admin.php:131
188
  msgid ""
189
  "(and you can add similar rules if you want to target other headings such as "
190
  "H3)"
191
  msgstr ""
192
 
193
+ #: typekit-admin.php:133
194
  msgid "Sidebar Headings"
195
  msgstr ""
196
 
197
+ #: typekit-admin.php:135
198
  msgid ""
199
  "If you want your Typekit fonts to be used for sidebar H2 headings, add a "
200
  "rule like this to your CSS Rules field:"
201
  msgstr ""
202
 
203
+ #: typekit-admin.php:138
204
  msgid "Font Weights"
205
  msgstr ""
206
 
207
+ #: typekit-admin.php:139
208
  msgid ""
209
  "If your Kit contains more than one weight and/or style for a particular "
210
  "font, you need to use numeric <code class=\"inline\">font-weight</code> "
211
  "values in your CSS rules to map to a font's weights."
212
  msgstr ""
213
 
214
+ #: typekit-admin.php:140
215
  msgid ""
216
  "Typekit fonts have been assigned values from 100 to 900 based on information "
217
  "from the font's designer. Web browsers also do some guessing as to which "
222
  "corresponds to <code class=\"inline\">font-weight: normal;</code>"
223
  msgstr ""
224
 
225
+ #: typekit-admin.php:141
226
  #, php-format
227
  msgid "See <a href=\"%s\">this help article</a> for more details."
228
  msgstr ""
229
 
230
+ #: typekit-admin.php:142
231
  msgid "Advanced targetting of fonts with CSS selectors"
232
  msgstr ""
233
 
234
+ #: typekit-admin.php:144
235
  msgid ""
236
  "You can target your fonts to specific parts of your website if you know a "
237
  "bit more about your current WordPress theme and where the font family is "
243
  "for that selector to override that rule."
244
  msgstr ""
245
 
246
+ #: typekit-admin.php:145
247
  msgid "For example, if your theme has this CSS rule:"
248
  msgstr ""
249
 
250
+ #: typekit-admin.php:147
251
  msgid ""
252
  "you could create this rule to apply your new font to the body of your "
253
  "website:"
254
  msgstr ""
255
 
256
+ #: typekit-admin.php:150
257
  msgid "Where to go to get help"
258
  msgstr ""
259
 
260
+ #: typekit-admin.php:152
261
  msgid ""
262
  "<a href=\"http://getsatisfaction.com/typekit/\" target=\"_blank\">Typekit "
263
  "Support</a>"
264
  msgstr ""
265
 
266
+ #: typekit-admin.php:153
267
  msgid ""
268
  "<a href=\"http://www.sitepoint.com/forums/forumdisplay.php?f=53\" target="
269
  "\"_blank\">Sitepoint CSS Forums</a>"
270
  msgstr ""
271
 
272
+ #: typekit-admin.php:154
273
  msgid ""
274
  "<a href=\"http://www.w3schools.com/CSS/default.asp\" target=\"_blank"
275
  "\">W3Schools CSS Help</a>"
typekit.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Typekit Fonts for WordPress
4
  Plugin URI: http://om4.com.au/wordpress-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.0.2
7
  Author: OM4
8
  Author URI: http://om4.com.au/
9
  Text Domain: om4-typekit
@@ -39,7 +39,7 @@ class OM4_Typekit {
39
 
40
  var $admin;
41
 
42
- var $embedcode = '<script type="text/javascript" src="http://use.typekit.com/%s.js"></script>
43
  <script type="text/javascript">try{Typekit.load();}catch(e){}</script>';
44
 
45
  /**
@@ -49,14 +49,14 @@ class OM4_Typekit {
49
  *
50
  * @var string
51
  */
52
- var $embedcoderegexp = '#http://use\.typekit\.com/([a-z0-9]*)\.js#i';
53
 
54
  /**
55
  * The format for the Typekit JS file URL
56
  *
57
  * @var string
58
  */
59
- var $embedcodeurl = 'http://use.typekit.com/%s.js';
60
 
61
  /*
62
  * Default settings
@@ -65,6 +65,15 @@ class OM4_Typekit {
65
  'id'=> '',
66
  'css' => ''
67
  );
 
 
 
 
 
 
 
 
 
68
 
69
  /**
70
  * Class Constructor
@@ -86,6 +95,8 @@ class OM4_Typekit {
86
  $this->installedVersion = intval($data['version']);
87
  $this->settings = $data['settings'];
88
  }
 
 
89
  }
90
 
91
  /**
@@ -152,7 +163,7 @@ class OM4_Typekit {
152
  * @return string The typekit embed code if the unique account ID has been set, otherwise an empty string
153
  */
154
  function GetEmbedCode() {
155
- if ('' != $id = $this->GetAccountID()) return sprintf($this->embedcode, $id);
156
  return '';
157
  }
158
 
@@ -173,9 +184,9 @@ class OM4_Typekit {
173
  $matches = array();
174
 
175
  $this->settings['id'] = '';
176
- // Attempt to extract the ID from the embed code using our regular expression
177
- if (preg_match($this->embedcoderegexp, $code, $matches) && sizeof($matches) == 2) {
178
- $this->settings['id'] = $matches[1];
179
  }
180
  }
181
 
3
  Plugin Name: Typekit Fonts for WordPress
4
  Plugin URI: http://om4.com.au/wordpress-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.0.3
7
  Author: OM4
8
  Author URI: http://om4.com.au/
9
  Text Domain: om4-typekit
39
 
40
  var $admin;
41
 
42
+ var $embedcode = '<script type="text/javascript" src="%s://use.typekit.com/%s.js"></script>
43
  <script type="text/javascript">try{Typekit.load();}catch(e){}</script>';
44
 
45
  /**
49
  *
50
  * @var string
51
  */
52
+ var $embedcoderegexp = '#http(s?)://use\.typekit\.com/([a-z0-9]*)\.js#i';
53
 
54
  /**
55
  * The format for the Typekit JS file URL
56
  *
57
  * @var string
58
  */
59
+ var $embedcodeurl = '%s://use.typekit.com/%s.js';
60
 
61
  /*
62
  * Default settings
65
  'id'=> '',
66
  'css' => ''
67
  );
68
+
69
+ /*
70
+ * HTTP scheme.
71
+ *
72
+ * HTTP by deafult, or HTTPS if the site is being loaded over SSL.
73
+ *
74
+ * @var string
75
+ */
76
+ var $scheme = 'http';
77
 
78
  /**
79
  * Class Constructor
95
  $this->installedVersion = intval($data['version']);
96
  $this->settings = $data['settings'];
97
  }
98
+
99
+ if ( is_ssl() ) $this->scheme = 'https';
100
  }
101
 
102
  /**
163
  * @return string The typekit embed code if the unique account ID has been set, otherwise an empty string
164
  */
165
  function GetEmbedCode() {
166
+ if ('' != $id = $this->GetAccountID()) return sprintf($this->embedcode, $this->scheme, $id);
167
  return '';
168
  }
169
 
184
  $matches = array();
185
 
186
  $this->settings['id'] = '';
187
+ // Attempt to extract the kit ID from the embed code using our regular expression
188
+ if (preg_match($this->embedcoderegexp, $code, $matches) && sizeof($matches) == 3) {
189
+ $this->settings['id'] = $matches[2];
190
  }
191
  }
192