Version Description
Cache releases data in the WordPress database to reduce the number of server-side network requests.
Ensure that releases data are always loaded fresh from fontawesome.com when loading the admin settings page so site owners can see when new versions are available.
Add more specific error message on admin dashboard in the event that the WordPress server is not able to reach fontawesome.com in order to get an initial set of available releases data.
Download this release
Release Info
Developer | mlwilkerson |
Plugin | Font Awesome Icons |
Version | 4.0.0-rc4 |
Comparing to | |
See all releases |
Code changes from version 4.0.0-rc3 to 4.0.0-rc4
- font-awesome.php +6 -6
- includes/class-fontawesome-noreleasesexception.php +16 -0
- includes/class-fontawesome-release-provider.php +146 -34
- includes/class-fontawesome.php +16 -3
- readme.txt +11 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +3 -3
font-awesome.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Font Awesome
|
4 |
* Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
|
5 |
* Description: Adds Font Awesome 5 icons to your WordPress site. Supports Font Awesome Pro. Resolves conflicts across many plugins or themes that use Font Awesome.
|
6 |
-
* Version: 4.0.0-
|
7 |
* Author: Font Awesome
|
8 |
* Author URI: https://fontawesome.com/
|
9 |
* License: GPLv2 (or later)
|
@@ -14,18 +14,18 @@
|
|
14 |
|
15 |
defined( 'WPINC' ) || die;
|
16 |
|
17 |
-
if ( ! function_exists( '
|
18 |
/**
|
19 |
* Handle fatal errors
|
20 |
*
|
21 |
* @ignore
|
22 |
*/
|
23 |
-
function
|
24 |
add_action(
|
25 |
'admin_notices',
|
26 |
function () use ( $message ) {
|
27 |
?>
|
28 |
-
<div class="error"><p>The Font Awesome plugin has experienced
|
29 |
<?php
|
30 |
if ( ! is_null( $message ) ) {
|
31 |
echo esc_html( ": $message" );
|
@@ -81,8 +81,8 @@ if ( ! defined( 'FONT_AWESOME_OFFICIAL_LOADED' ) ) {
|
|
81 |
define( 'FONT_AWESOME_OFFICIAL_LOADED', 1 );
|
82 |
fa()->run();
|
83 |
} catch ( Exception $e ) {
|
84 |
-
|
85 |
} catch ( Error $e ) {
|
86 |
-
|
87 |
}
|
88 |
}
|
3 |
* Plugin Name: Font Awesome
|
4 |
* Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
|
5 |
* Description: Adds Font Awesome 5 icons to your WordPress site. Supports Font Awesome Pro. Resolves conflicts across many plugins or themes that use Font Awesome.
|
6 |
+
* Version: 4.0.0-rc4
|
7 |
* Author: Font Awesome
|
8 |
* Author URI: https://fontawesome.com/
|
9 |
* License: GPLv2 (or later)
|
14 |
|
15 |
defined( 'WPINC' ) || die;
|
16 |
|
17 |
+
if ( ! function_exists( 'font_awesome_handle_fatal_error' ) ) {
|
18 |
/**
|
19 |
* Handle fatal errors
|
20 |
*
|
21 |
* @ignore
|
22 |
*/
|
23 |
+
function font_awesome_handle_fatal_error( $message = null ) {
|
24 |
add_action(
|
25 |
'admin_notices',
|
26 |
function () use ( $message ) {
|
27 |
?>
|
28 |
+
<div class="error"><p>The Font Awesome plugin has experienced a fatal error
|
29 |
<?php
|
30 |
if ( ! is_null( $message ) ) {
|
31 |
echo esc_html( ": $message" );
|
81 |
define( 'FONT_AWESOME_OFFICIAL_LOADED', 1 );
|
82 |
fa()->run();
|
83 |
} catch ( Exception $e ) {
|
84 |
+
font_awesome_handle_fatal_error( $e->getMessage() );
|
85 |
} catch ( Error $e ) {
|
86 |
+
font_awesome_handle_fatal_error( $e->getMessage() );
|
87 |
}
|
88 |
}
|
includes/class-fontawesome-noreleasesexception.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Module for FontAwesome_NoReleasesException.
|
4 |
+
*
|
5 |
+
* @noinspection PhpIncludeInspection
|
6 |
+
*/
|
7 |
+
|
8 |
+
/**
|
9 |
+
* An exception class to indicate a fatal error that we have no Font Awesome release metadata,
|
10 |
+
* after attempting to load some.
|
11 |
+
*
|
12 |
+
* @package FontAwesome
|
13 |
+
* @subpackage FontAwesome/includes
|
14 |
+
*/
|
15 |
+
class FontAwesome_NoReleasesException extends Exception {
|
16 |
+
}
|
includes/class-fontawesome-release-provider.php
CHANGED
@@ -11,6 +11,7 @@
|
|
11 |
*/
|
12 |
|
13 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-resource.php';
|
|
|
14 |
|
15 |
use Composer\Semver\Semver;
|
16 |
use GuzzleHttp\Client;
|
@@ -22,6 +23,22 @@ use GuzzleHttp\Client;
|
|
22 |
* @subpackage FontAwesome/includes
|
23 |
*/
|
24 |
class FontAwesome_Release_Provider {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
26 |
/**
|
27 |
* @ignore
|
@@ -32,10 +49,7 @@ class FontAwesome_Release_Provider {
|
|
32 |
/**
|
33 |
* @ignore
|
34 |
*/
|
35 |
-
protected $_status =
|
36 |
-
'code' => null,
|
37 |
-
'message' => '',
|
38 |
-
);
|
39 |
|
40 |
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
41 |
/**
|
@@ -88,16 +102,21 @@ class FontAwesome_Release_Provider {
|
|
88 |
|
89 |
/**
|
90 |
* Returns an associative array indicating the status of the status of the last network
|
91 |
-
* request that attempted to retrieve releases metadata
|
|
|
92 |
*
|
93 |
-
* The shape looks like this:
|
94 |
* ```php
|
95 |
* array(
|
96 |
-
* 'code' => 403,
|
97 |
* 'message' => 'some message',
|
98 |
* )
|
99 |
* ```
|
100 |
-
*
|
|
|
|
|
|
|
|
|
101 |
*
|
102 |
* @return FontAwesome_Release_Provider
|
103 |
*/
|
@@ -121,6 +140,12 @@ class FontAwesome_Release_Provider {
|
|
121 |
$client_params['handler'] = self::$_handler;
|
122 |
}
|
123 |
$this->_api_client = new Client( $client_params );
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
|
126 |
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
@@ -142,12 +167,23 @@ class FontAwesome_Release_Provider {
|
|
142 |
/**
|
143 |
* @ignore
|
144 |
*/
|
|
|
145 |
private function load_releases() {
|
|
|
|
|
|
|
|
|
|
|
146 |
try {
|
147 |
$response = $this->_api_client->get( 'api/releases' );
|
148 |
|
149 |
-
$this->_status
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
151 |
|
152 |
$body = $response->getBody();
|
153 |
$body_contents = $body->getContents();
|
@@ -157,25 +193,64 @@ class FontAwesome_Release_Provider {
|
|
157 |
foreach ( $api_releases as $release ) {
|
158 |
$releases[ $release['version'] ] = $release;
|
159 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
$this->_releases = $releases;
|
161 |
} catch ( GuzzleHttp\Exception\ConnectException $e ) {
|
162 |
-
$this->_status
|
163 |
-
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
166 |
} catch ( GuzzleHttp\Exception\ServerException $e ) {
|
167 |
-
$this->_status
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
170 |
} catch ( GuzzleHttp\Exception\ClientException $e ) {
|
171 |
-
$this->_status
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
173 |
} catch ( Exception $e ) {
|
174 |
-
$this->_status
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
}
|
181 |
|
@@ -209,21 +284,49 @@ class FontAwesome_Release_Provider {
|
|
209 |
return( new FontAwesome_Resource( $full_url, $integrity_key ) );
|
210 |
}
|
211 |
|
212 |
-
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
213 |
/**
|
214 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
*/
|
216 |
protected function releases() {
|
217 |
-
if (
|
218 |
-
$this->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
}
|
220 |
-
// TODO: after figuring out how we'll handle releases API failures we may want to change what we return in the null case here.
|
221 |
-
return is_null( $this->_releases ) ? array() : $this->_releases;
|
222 |
}
|
223 |
|
224 |
/**
|
225 |
* Returns a simple array of available Font Awesome versions as strings, sorted in descending semantic version order.
|
226 |
*
|
|
|
227 |
* @return array
|
228 |
*/
|
229 |
public function versions() {
|
@@ -234,13 +337,18 @@ class FontAwesome_Release_Provider {
|
|
234 |
* Returns an array containing version, shim, source URLs and integrity keys for given params.
|
235 |
* They should be loaded in the order they appear in this collection.
|
236 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
* @param string $version
|
238 |
* @param mixed $style_opt either the string 'all' or an array containing any of the following:
|
239 |
* ['solid', 'regular', 'light', 'brands']
|
240 |
* @param array $flags boolean flags, defaults: array('use_pro' => false, 'use_svg' => false, 'use_shim' => true)
|
241 |
-
* @throws InvalidArgumentException
|
242 |
-
* Shims were not introduced for webfonts until 5.1.0. Throws when called with an array for $style_opt
|
243 |
-
* that contains no known style specifiers.
|
244 |
* @return array
|
245 |
*/
|
246 |
public function get_resource_collection( $version, $style_opt, $flags = array(
|
@@ -315,6 +423,7 @@ class FontAwesome_Release_Provider {
|
|
315 |
/**
|
316 |
* Returns a version number corresponding to the most recent minor release.
|
317 |
*
|
|
|
318 |
* @return string|null most recent major.minor.patch version (not a semver). Returns null if no versions available.
|
319 |
*/
|
320 |
public function latest_minor_release() {
|
@@ -325,6 +434,7 @@ class FontAwesome_Release_Provider {
|
|
325 |
/**
|
326 |
* Returns a version number corresponding to the minor release immediately prior to the most recent minor release.
|
327 |
*
|
|
|
328 |
* @return string|null latest patch level for the previous minor version. major.minor.patch version (not a semver).
|
329 |
* Returns null if there is no latest (and therefore no previous).
|
330 |
* Returns null if there's no previous, because the latest represents the only minor version in the set
|
@@ -350,7 +460,9 @@ class FontAwesome_Release_Provider {
|
|
350 |
$satisfying_versions = Semver::rsort(
|
351 |
Semver::satisfiedBy( $this->versions(), $previous_minor_release_semver_constraint )
|
352 |
);
|
353 |
-
|
|
|
|
|
354 |
return $result === $latest ? null : $result;
|
355 |
}
|
356 |
}
|
11 |
*/
|
12 |
|
13 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-resource.php';
|
14 |
+
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-noreleasesexception.php';
|
15 |
|
16 |
use Composer\Semver\Semver;
|
17 |
use GuzzleHttp\Client;
|
23 |
* @subpackage FontAwesome/includes
|
24 |
*/
|
25 |
class FontAwesome_Release_Provider {
|
26 |
+
/**
|
27 |
+
* Name of the transient that stores the cache of Font Awesome releases so we won't query
|
28 |
+
* the fontawesome.com releases API except when the admin settings page is re-loaded.
|
29 |
+
*
|
30 |
+
* @since 4.0.0-rc4
|
31 |
+
* @ignore
|
32 |
+
*/
|
33 |
+
const RELEASES_TRANSIENT = 'font-awesome-releases';
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Expiry time for the releases transient.
|
37 |
+
*
|
38 |
+
* @ignore
|
39 |
+
*/
|
40 |
+
const RELEASES_TRANSIENT_EXPIRY = 0;
|
41 |
+
|
42 |
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
43 |
/**
|
44 |
* @ignore
|
49 |
/**
|
50 |
* @ignore
|
51 |
*/
|
52 |
+
protected $_status = null;
|
|
|
|
|
|
|
53 |
|
54 |
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
55 |
/**
|
102 |
|
103 |
/**
|
104 |
* Returns an associative array indicating the status of the status of the last network
|
105 |
+
* request that attempted to retrieve releases metadata, or null if no network request has
|
106 |
+
* been issued during the life time of the current Singleton instance.
|
107 |
*
|
108 |
+
* The shape of an array return looks like this:
|
109 |
* ```php
|
110 |
* array(
|
111 |
+
* 'code' => 403,
|
112 |
* 'message' => 'some message',
|
113 |
* )
|
114 |
* ```
|
115 |
+
*
|
116 |
+
* The value of the `code` key is one of:
|
117 |
+
* - `200` if successful,
|
118 |
+
* - `0` if there was some code error that prevented the network request from completing
|
119 |
+
* - otherwise some HTTP error code as returned by {@see \Guzzle\Client}
|
120 |
*
|
121 |
* @return FontAwesome_Release_Provider
|
122 |
*/
|
140 |
$client_params['handler'] = self::$_handler;
|
141 |
}
|
142 |
$this->_api_client = new Client( $client_params );
|
143 |
+
|
144 |
+
$cached_releases = get_transient( self::RELEASES_TRANSIENT );
|
145 |
+
|
146 |
+
if ( $cached_releases ) {
|
147 |
+
$this->_releases = $cached_releases;
|
148 |
+
}
|
149 |
}
|
150 |
|
151 |
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
|
167 |
/**
|
168 |
* @ignore
|
169 |
*/
|
170 |
+
// phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag.Missing
|
171 |
private function load_releases() {
|
172 |
+
$init_status = array(
|
173 |
+
'code' => null,
|
174 |
+
'message' => '',
|
175 |
+
);
|
176 |
+
|
177 |
try {
|
178 |
$response = $this->_api_client->get( 'api/releases' );
|
179 |
|
180 |
+
$this->_status = array_merge(
|
181 |
+
$init_status,
|
182 |
+
array(
|
183 |
+
'code' => $response->getStatusCode(),
|
184 |
+
'message' => 'ok',
|
185 |
+
)
|
186 |
+
);
|
187 |
|
188 |
$body = $response->getBody();
|
189 |
$body_contents = $body->getContents();
|
193 |
foreach ( $api_releases as $release ) {
|
194 |
$releases[ $release['version'] ] = $release;
|
195 |
}
|
196 |
+
|
197 |
+
$previous_transient = get_transient( self::RELEASES_TRANSIENT );
|
198 |
+
|
199 |
+
if ( $previous_transient ) {
|
200 |
+
// We must be refreshing the releases metadata, so delete the transient before trying to set it again.
|
201 |
+
delete_transient( self::RELEASES_TRANSIENT );
|
202 |
+
}
|
203 |
+
|
204 |
+
$ret = set_transient( self::RELEASES_TRANSIENT, $releases, self::RELEASES_TRANSIENT_EXPIRY );
|
205 |
+
|
206 |
+
if ( ! $ret ) {
|
207 |
+
throw new Exception();
|
208 |
+
}
|
209 |
+
|
210 |
$this->_releases = $releases;
|
211 |
} catch ( GuzzleHttp\Exception\ConnectException $e ) {
|
212 |
+
$this->_status = array_merge(
|
213 |
+
$init_status,
|
214 |
+
array(
|
215 |
+
'code' => $e->getCode(),
|
216 |
+
'message' => 'Whoops, we could not connect to the Font Awesome server to get releases data. ' .
|
217 |
+
'There seems to be an internet connectivity problem between your WordPress server ' .
|
218 |
+
'and the Font Awesome server.',
|
219 |
+
)
|
220 |
+
);
|
221 |
} catch ( GuzzleHttp\Exception\ServerException $e ) {
|
222 |
+
$this->_status = array_merge(
|
223 |
+
$init_status,
|
224 |
+
array(
|
225 |
+
'code' => $e->getCode(),
|
226 |
+
'message' => 'Whoops, there was a problem on the fontawesome.com server when we attempted to get releases data. ' .
|
227 |
+
'Probably if you reload to try again, it will work.',
|
228 |
+
)
|
229 |
+
);
|
230 |
} catch ( GuzzleHttp\Exception\ClientException $e ) {
|
231 |
+
$this->_status = array_merge(
|
232 |
+
$init_status,
|
233 |
+
array(
|
234 |
+
'code' => $e->getCode(),
|
235 |
+
'message' => 'Whoops, we could not update the releases data from the Font Awesome server.',
|
236 |
+
)
|
237 |
+
);
|
238 |
} catch ( Exception $e ) {
|
239 |
+
$this->_status = array_merge(
|
240 |
+
$init_status,
|
241 |
+
array(
|
242 |
+
'code' => 0,
|
243 |
+
'message' => 'Whoops, we failed to update the releases data.',
|
244 |
+
)
|
245 |
+
);
|
246 |
+
} catch ( \Error $e ) {
|
247 |
+
$this->_status = array_merge(
|
248 |
+
$init_status,
|
249 |
+
array(
|
250 |
+
'code' => 0,
|
251 |
+
'message' => 'Whoops, we failed when trying to update the releases data.',
|
252 |
+
)
|
253 |
+
);
|
254 |
}
|
255 |
}
|
256 |
|
284 |
return( new FontAwesome_Resource( $full_url, $integrity_key ) );
|
285 |
}
|
286 |
|
|
|
287 |
/**
|
288 |
+
* Retrieves Font Awesome releases metadata with as few network requests as possible.
|
289 |
+
*
|
290 |
+
* Will first attempt to return releases already memoized by this Singleton instance.
|
291 |
+
* Next, will try to retrieve a cached set of releases from a non-expiring transient.
|
292 |
+
*
|
293 |
+
* If there's nothing cached, then it tries to load releases by making a network request to the
|
294 |
+
* releases API endpoint.
|
295 |
+
*
|
296 |
+
* If that fails, it throws an exception.
|
297 |
+
*
|
298 |
+
* @see FontAwesome_Release_Provider::RELEASES_TRANSIENT()
|
299 |
+
* @see FontAwesome_Release_Provider::RELEASES_TRANSIENT_EXPIRY()
|
300 |
+
* @throws FontAwesome_NoReleasesException
|
301 |
+
* @return array
|
302 |
*/
|
303 |
protected function releases() {
|
304 |
+
if ( $this->_releases ) {
|
305 |
+
return $this->_releases;
|
306 |
+
} else {
|
307 |
+
$cached_releases = get_transient( self::RELEASES_TRANSIENT );
|
308 |
+
|
309 |
+
if ( $cached_releases ) {
|
310 |
+
return $cached_releases;
|
311 |
+
} elseif ( is_null( $this->_releases ) ) {
|
312 |
+
$this->load_releases();
|
313 |
+
|
314 |
+
// TODO: consider adding retry logic for loading Font Awesome releases.
|
315 |
+
if ( is_null( $this->_releases ) ) {
|
316 |
+
throw new FontAwesome_NoReleasesException();
|
317 |
+
} else {
|
318 |
+
return $this->_releases;
|
319 |
+
}
|
320 |
+
} else {
|
321 |
+
return $this->_releases;
|
322 |
+
}
|
323 |
}
|
|
|
|
|
324 |
}
|
325 |
|
326 |
/**
|
327 |
* Returns a simple array of available Font Awesome versions as strings, sorted in descending semantic version order.
|
328 |
*
|
329 |
+
* @throws FontAwesome_NoReleasesException
|
330 |
* @return array
|
331 |
*/
|
332 |
public function versions() {
|
337 |
* Returns an array containing version, shim, source URLs and integrity keys for given params.
|
338 |
* They should be loaded in the order they appear in this collection.
|
339 |
*
|
340 |
+
* Throws InvalidArgumentException if called with use_svg = true, use_shim = true and version < 5.1.0.
|
341 |
+
* Shims were not introduced for webfonts until 5.1.0.
|
342 |
+
*
|
343 |
+
* Throws InvalidArgumentException when called with an array for $style_opt that contains no known style specifiers.
|
344 |
+
*
|
345 |
+
* Throws FontAwesome_NoReleasesException when no releases metadata could be loaded.
|
346 |
+
*
|
347 |
* @param string $version
|
348 |
* @param mixed $style_opt either the string 'all' or an array containing any of the following:
|
349 |
* ['solid', 'regular', 'light', 'brands']
|
350 |
* @param array $flags boolean flags, defaults: array('use_pro' => false, 'use_svg' => false, 'use_shim' => true)
|
351 |
+
* @throws InvalidArgumentException | FontAwesome_NoReleasesException
|
|
|
|
|
352 |
* @return array
|
353 |
*/
|
354 |
public function get_resource_collection( $version, $style_opt, $flags = array(
|
423 |
/**
|
424 |
* Returns a version number corresponding to the most recent minor release.
|
425 |
*
|
426 |
+
* @throws FontAwesome_NoReleasesException
|
427 |
* @return string|null most recent major.minor.patch version (not a semver). Returns null if no versions available.
|
428 |
*/
|
429 |
public function latest_minor_release() {
|
434 |
/**
|
435 |
* Returns a version number corresponding to the minor release immediately prior to the most recent minor release.
|
436 |
*
|
437 |
+
* @throws FontAwesome_NoReleasesException
|
438 |
* @return string|null latest patch level for the previous minor version. major.minor.patch version (not a semver).
|
439 |
* Returns null if there is no latest (and therefore no previous).
|
440 |
* Returns null if there's no previous, because the latest represents the only minor version in the set
|
460 |
$satisfying_versions = Semver::rsort(
|
461 |
Semver::satisfiedBy( $this->versions(), $previous_minor_release_semver_constraint )
|
462 |
);
|
463 |
+
|
464 |
+
$result = count( $satisfying_versions ) > 0 ? $satisfying_versions[0] : null;
|
465 |
+
|
466 |
return $result === $latest ? null : $result;
|
467 |
}
|
468 |
}
|
includes/class-fontawesome.php
CHANGED
@@ -16,6 +16,7 @@ require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontaweso
|
|
16 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-config-controller.php';
|
17 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-v3deprecation-controller.php';
|
18 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-v3mapper.php';
|
|
|
19 |
require_once ABSPATH . 'wp-admin/includes/screen.php';
|
20 |
|
21 |
use Composer\Semver\Semver;
|
@@ -100,7 +101,7 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
100 |
/**
|
101 |
* The version of this WordPress plugin.
|
102 |
*/
|
103 |
-
const PLUGIN_VERSION = '4.0.0-
|
104 |
/**
|
105 |
* The version of this plugin's REST API.
|
106 |
*
|
@@ -254,10 +255,17 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
254 |
|
255 |
try {
|
256 |
$fa->load();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
} catch ( Exception $e ) {
|
258 |
-
|
259 |
} catch ( Error $e ) {
|
260 |
-
|
261 |
}
|
262 |
},
|
263 |
10,
|
@@ -378,6 +386,7 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
378 |
*
|
379 |
* @since 4.0.0
|
380 |
*
|
|
|
381 |
* @return null|string
|
382 |
*/
|
383 |
public function get_latest_version() {
|
@@ -392,6 +401,7 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
392 |
*
|
393 |
* @since 4.0.0
|
394 |
*
|
|
|
395 |
* @link https://getcomposer.org/doc/articles/versions.md
|
396 |
* @return null|string
|
397 |
*/
|
@@ -407,6 +417,7 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
407 |
*
|
408 |
* @since 4.0.0
|
409 |
*
|
|
|
410 |
* @return null|string
|
411 |
*/
|
412 |
public function get_previous_version() {
|
@@ -421,6 +432,7 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
421 |
*
|
422 |
* @since 4.0.0
|
423 |
*
|
|
|
424 |
* @link https://getcomposer.org/doc/articles/versions.md
|
425 |
* @return null|string
|
426 |
*/
|
@@ -436,6 +448,7 @@ if ( ! class_exists( 'FontAwesome' ) ) :
|
|
436 |
*
|
437 |
* @since 4.0.0
|
438 |
*
|
|
|
439 |
* @see FontAwesome_Release_Provider::versions()
|
440 |
* @return null|string
|
441 |
*/
|
16 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-config-controller.php';
|
17 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-v3deprecation-controller.php';
|
18 |
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-v3mapper.php';
|
19 |
+
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/class-fontawesome-noreleasesexception.php';
|
20 |
require_once ABSPATH . 'wp-admin/includes/screen.php';
|
21 |
|
22 |
use Composer\Semver\Semver;
|
101 |
/**
|
102 |
* The version of this WordPress plugin.
|
103 |
*/
|
104 |
+
const PLUGIN_VERSION = '4.0.0-rc4';
|
105 |
/**
|
106 |
* The version of this plugin's REST API.
|
107 |
*
|
255 |
|
256 |
try {
|
257 |
$fa->load();
|
258 |
+
} catch ( FontAwesome_NoReleasesException $e ) {
|
259 |
+
font_awesome_handle_fatal_error(
|
260 |
+
'Sorry, your WordPress server was unable to contact the Font Awesome server to retrieve available ' .
|
261 |
+
'releases data. Most likely, just re-loading this page to get it try again should work. But if you\'re running ' .
|
262 |
+
'WordPress offline, from an airplane, or in some other way that blocks your WordPress server from reaching ' .
|
263 |
+
'fontawesome.com, then that will block you from proceeding until you can connect successfully.'
|
264 |
+
);
|
265 |
} catch ( Exception $e ) {
|
266 |
+
font_awesome_handle_fatal_error( $e->getMessage() );
|
267 |
} catch ( Error $e ) {
|
268 |
+
font_awesome_handle_fatal_error( $e->getMessage() );
|
269 |
}
|
270 |
},
|
271 |
10,
|
386 |
*
|
387 |
* @since 4.0.0
|
388 |
*
|
389 |
+
* @throws FontAwesome_NoReleasesException
|
390 |
* @return null|string
|
391 |
*/
|
392 |
public function get_latest_version() {
|
401 |
*
|
402 |
* @since 4.0.0
|
403 |
*
|
404 |
+
* @throws FontAwesome_NoReleasesException
|
405 |
* @link https://getcomposer.org/doc/articles/versions.md
|
406 |
* @return null|string
|
407 |
*/
|
417 |
*
|
418 |
* @since 4.0.0
|
419 |
*
|
420 |
+
* @throws FontAwesome_NoReleasesException
|
421 |
* @return null|string
|
422 |
*/
|
423 |
public function get_previous_version() {
|
432 |
*
|
433 |
* @since 4.0.0
|
434 |
*
|
435 |
+
* @throws FontAwesome_NoReleasesException
|
436 |
* @link https://getcomposer.org/doc/articles/versions.md
|
437 |
* @return null|string
|
438 |
*/
|
448 |
*
|
449 |
* @since 4.0.0
|
450 |
*
|
451 |
+
* @throws FontAwesome_NoReleasesException
|
452 |
* @see FontAwesome_Release_Provider::versions()
|
453 |
* @return null|string
|
454 |
*/
|
readme.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
=== Font Awesome ===
|
2 |
Contributors: fontawesome, mlwilkerson, robmadole, rachelbaker
|
3 |
-
Stable tag: 4.0.0-
|
4 |
Tags: font, awesome, fontawesome, font-awesome, icon, svg, webfont
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.0
|
@@ -184,6 +184,16 @@ Find the Font Awesome admin settings page either under the "Settings" menu on th
|
|
184 |
|
185 |
== Changelog ==
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
= 4.0.0-rc3 =
|
188 |
|
189 |
* Add missing v3 shim file
|
1 |
=== Font Awesome ===
|
2 |
Contributors: fontawesome, mlwilkerson, robmadole, rachelbaker
|
3 |
+
Stable tag: 4.0.0-rc4
|
4 |
Tags: font, awesome, fontawesome, font-awesome, icon, svg, webfont
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.0
|
184 |
|
185 |
== Changelog ==
|
186 |
|
187 |
+
= 4.0.0-rc4 =
|
188 |
+
|
189 |
+
* Cache releases data in the WordPress database to reduce the number of server-side network requests.
|
190 |
+
|
191 |
+
* Ensure that releases data are always loaded fresh from fontawesome.com when loading the admin
|
192 |
+
settings page so site owners can see when new versions are available.
|
193 |
+
|
194 |
+
* Add more specific error message on admin dashboard in the event that the WordPress server is not able to
|
195 |
+
reach fontawesome.com in order to get an initial set of available releases data.
|
196 |
+
|
197 |
= 4.0.0-rc3 =
|
198 |
|
199 |
* Add missing v3 shim file
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInitadc30c9d532b84e52c3daae28954a0e3::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitd357a228d37902e150da5683de3c30da
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitd357a228d37902e150da5683de3c30da
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInitadc30c9d532b84e52c3daae28954a0e3
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitadc30c9d532b84e52c3daae28954a0e3', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitadc30c9d532b84e52c3daae28954a0e3', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitadc30c9d532b84e52c3daae28954a0e3::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitadc30c9d532b84e52c3daae28954a0e3::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequireadc30c9d532b84e52c3daae28954a0e3($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequireadc30c9d532b84e52c3daae28954a0e3($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
@@ -56,8 +56,8 @@ class ComposerStaticInitd357a228d37902e150da5683de3c30da
|
|
56 |
public static function getInitializer(ClassLoader $loader)
|
57 |
{
|
58 |
return \Closure::bind(function () use ($loader) {
|
59 |
-
$loader->prefixLengthsPsr4 =
|
60 |
-
$loader->prefixDirsPsr4 =
|
61 |
|
62 |
}, null, ClassLoader::class);
|
63 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInitadc30c9d532b84e52c3daae28954a0e3
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php',
|
56 |
public static function getInitializer(ClassLoader $loader)
|
57 |
{
|
58 |
return \Closure::bind(function () use ($loader) {
|
59 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInitadc30c9d532b84e52c3daae28954a0e3::$prefixLengthsPsr4;
|
60 |
+
$loader->prefixDirsPsr4 = ComposerStaticInitadc30c9d532b84e52c3daae28954a0e3::$prefixDirsPsr4;
|
61 |
|
62 |
}, null, ClassLoader::class);
|
63 |
}
|