Version Description
- Bug fix: enqueue Font Awesome assets in admin and login areas, not just in the front end
Download this release
Release Info
| Developer | mlwilkerson |
| Plugin | |
| Version | 4.0.0-rc11 |
| Comparing to | |
| See all releases | |
Code changes from version 4.0.0-rc10 to 4.0.0-rc11
font-awesome.php
CHANGED
|
@@ -7,7 +7,7 @@ use \Exception, \Error;
|
|
| 7 |
* Plugin Name: Font Awesome
|
| 8 |
* Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
|
| 9 |
* 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.
|
| 10 |
-
* Version: 4.0.0-
|
| 11 |
* Author: Font Awesome
|
| 12 |
* Author URI: https://fontawesome.com/
|
| 13 |
* License: GPLv2 (or later)
|
| 7 |
* Plugin Name: Font Awesome
|
| 8 |
* Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
|
| 9 |
* 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.
|
| 10 |
+
* Version: 4.0.0-rc11
|
| 11 |
* Author: Font Awesome
|
| 12 |
* Author URI: https://fontawesome.com/
|
| 13 |
* License: GPLv2 (or later)
|
includes/class-fontawesome-config-controller.php
CHANGED
|
@@ -137,8 +137,9 @@ if ( ! class_exists( 'FortAwesome\FontAwesome_Config_Controller' ) ) :
|
|
| 137 |
// Ideally, we'd be able to detect which plugin results in such an error by catching it and then
|
| 138 |
// reporting to the client which plugin caused the error. But at a minimum, we need to make sure
|
| 139 |
// that we return 500 instead of 200 in these cases.
|
| 140 |
-
// phpcs:
|
| 141 |
ini_set( 'display_errors', 0 );
|
|
|
|
| 142 |
|
| 143 |
try {
|
| 144 |
$fa = fa();
|
|
@@ -170,8 +171,9 @@ if ( ! class_exists( 'FortAwesome\FontAwesome_Config_Controller' ) ) :
|
|
| 170 |
* @return WP_Error|WP_REST_Response
|
| 171 |
*/
|
| 172 |
public function update_item( $request ) {
|
| 173 |
-
// phpcs:
|
| 174 |
ini_set( 'display_errors', 0 );
|
|
|
|
| 175 |
|
| 176 |
try {
|
| 177 |
$item = $this->prepare_item_for_database( $request );
|
| 137 |
// Ideally, we'd be able to detect which plugin results in such an error by catching it and then
|
| 138 |
// reporting to the client which plugin caused the error. But at a minimum, we need to make sure
|
| 139 |
// that we return 500 instead of 200 in these cases.
|
| 140 |
+
// phpcs:disable
|
| 141 |
ini_set( 'display_errors', 0 );
|
| 142 |
+
// phpcs:enable
|
| 143 |
|
| 144 |
try {
|
| 145 |
$fa = fa();
|
| 171 |
* @return WP_Error|WP_REST_Response
|
| 172 |
*/
|
| 173 |
public function update_item( $request ) {
|
| 174 |
+
// phpcs:disable
|
| 175 |
ini_set( 'display_errors', 0 );
|
| 176 |
+
// phpcs:enable
|
| 177 |
|
| 178 |
try {
|
| 179 |
$item = $this->prepare_item_for_database( $request );
|
includes/class-fontawesome-v3deprecation-controller.php
CHANGED
|
@@ -97,8 +97,9 @@ if ( ! class_exists( 'FontAwesome_V3Deprecation_Controller' ) ) :
|
|
| 97 |
// Ideally, we'd be able to detect which plugin results in such an error by catching it and then
|
| 98 |
// reporting to the client which plugin caused the error. But at a minimum, we need to make sure
|
| 99 |
// that we return 500 instead of 200 in these cases.
|
| 100 |
-
// phpcs:
|
| 101 |
ini_set( 'display_errors', 0 );
|
|
|
|
| 102 |
|
| 103 |
try {
|
| 104 |
$fa = fa();
|
|
@@ -121,8 +122,9 @@ if ( ! class_exists( 'FontAwesome_V3Deprecation_Controller' ) ) :
|
|
| 121 |
* @return WP_Error|WP_REST_Response
|
| 122 |
*/
|
| 123 |
public function update_item( $request ) {
|
| 124 |
-
// phpcs:
|
| 125 |
ini_set( 'display_errors', 0 );
|
|
|
|
| 126 |
|
| 127 |
try {
|
| 128 |
$fa = fa();
|
| 97 |
// Ideally, we'd be able to detect which plugin results in such an error by catching it and then
|
| 98 |
// reporting to the client which plugin caused the error. But at a minimum, we need to make sure
|
| 99 |
// that we return 500 instead of 200 in these cases.
|
| 100 |
+
// phpcs:disable
|
| 101 |
ini_set( 'display_errors', 0 );
|
| 102 |
+
// phpcs:enable
|
| 103 |
|
| 104 |
try {
|
| 105 |
$fa = fa();
|
| 122 |
* @return WP_Error|WP_REST_Response
|
| 123 |
*/
|
| 124 |
public function update_item( $request ) {
|
| 125 |
+
// phpcs:disable
|
| 126 |
ini_set( 'display_errors', 0 );
|
| 127 |
+
// phpcs:enable
|
| 128 |
|
| 129 |
try {
|
| 130 |
$fa = fa();
|
includes/class-fontawesome.php
CHANGED
|
@@ -100,7 +100,7 @@ if ( ! class_exists( 'FortAwesome\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 |
*
|
|
@@ -1344,13 +1344,15 @@ if ( ! class_exists( 'FortAwesome\FontAwesome' ) ) :
|
|
| 1344 |
|
| 1345 |
if ( 'webfont' === $load_spec['method'] ) {
|
| 1346 |
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
|
|
|
|
|
|
| 1354 |
|
| 1355 |
// Filter the <link> tag to add the integrity and crossorigin attributes for completeness.
|
| 1356 |
add_filter(
|
|
@@ -1374,17 +1376,18 @@ if ( ! class_exists( 'FortAwesome\FontAwesome' ) ) :
|
|
| 1374 |
|
| 1375 |
if ( $load_spec['v4shim'] ) {
|
| 1376 |
/**
|
| 1377 |
-
* Enqueue v4 compatibility as late as possible, though still within the normal
|
| 1378 |
* We need the @font-face override, especially to appear after any unregistered loads of Font Awesome
|
| 1379 |
* that may try to declare a @font-face with a font-family of "FontAwesome".
|
| 1380 |
*/
|
| 1381 |
-
|
| 1382 |
-
|
| 1383 |
-
|
| 1384 |
-
|
| 1385 |
-
|
|
|
|
| 1386 |
|
| 1387 |
-
|
| 1388 |
@font-face {
|
| 1389 |
font-family: "FontAwesome";
|
| 1390 |
src: url("https://${license_subdomain}.fontawesome.com/releases/v${version}/webfonts/fa-brands-400.eot"),
|
|
@@ -1417,14 +1420,15 @@ if ( ! class_exists( 'FortAwesome\FontAwesome' ) ) :
|
|
| 1417 |
}
|
| 1418 |
EOT;
|
| 1419 |
|
| 1420 |
-
|
| 1421 |
-
|
| 1422 |
-
|
| 1423 |
-
|
| 1424 |
|
| 1425 |
-
|
| 1426 |
-
|
| 1427 |
-
|
|
|
|
| 1428 |
|
| 1429 |
// Filter the <link> tag to add the integrity and crossorigin attributes for completeness.
|
| 1430 |
// Not all resources have an integrity_key for all versions of Font Awesome, so we'll skip this for those
|
|
@@ -1451,17 +1455,19 @@ EOT;
|
|
| 1451 |
}
|
| 1452 |
}
|
| 1453 |
} else {
|
| 1454 |
-
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
|
|
|
| 1459 |
|
| 1460 |
-
|
| 1461 |
-
|
|
|
|
| 1462 |
}
|
| 1463 |
-
|
| 1464 |
-
|
| 1465 |
|
| 1466 |
// Filter the <script> tag to add additional attributes for integrity, crossorigin, defer.
|
| 1467 |
add_filter(
|
|
@@ -1490,13 +1496,15 @@ EOT;
|
|
| 1490 |
);
|
| 1491 |
|
| 1492 |
if ( $load_spec['v4shim'] ) {
|
| 1493 |
-
|
| 1494 |
-
|
| 1495 |
-
|
| 1496 |
-
|
| 1497 |
-
|
| 1498 |
-
|
| 1499 |
-
|
|
|
|
|
|
|
| 1500 |
|
| 1501 |
add_filter(
|
| 1502 |
'script_loader_tag',
|
|
@@ -1527,21 +1535,24 @@ EOT;
|
|
| 1527 |
$obj = $this;
|
| 1528 |
/**
|
| 1529 |
* We need to detect unregistered clients *after* they would have been enqueued, if they used
|
| 1530 |
-
* the recommended mechanism of wp_enqueue_style and wp_enqueue_script.
|
| 1531 |
-
* The wp_print_styles action hook is fired after the wp_enqueue_scripts hook
|
|
|
|
| 1532 |
* We'll use priority 0 in an effort to be as early as possible, to prevent any unregistered client
|
| 1533 |
* from actually being printed to the head.
|
| 1534 |
*/
|
| 1535 |
-
|
| 1536 |
-
|
| 1537 |
-
|
| 1538 |
-
$obj
|
| 1539 |
-
|
| 1540 |
-
$
|
| 1541 |
-
|
| 1542 |
-
|
| 1543 |
-
|
| 1544 |
-
|
|
|
|
|
|
|
| 1545 |
}
|
| 1546 |
|
| 1547 |
/**
|
| 100 |
/**
|
| 101 |
* The version of this WordPress plugin.
|
| 102 |
*/
|
| 103 |
+
const PLUGIN_VERSION = '4.0.0-rc11';
|
| 104 |
/**
|
| 105 |
* The version of this plugin's REST API.
|
| 106 |
*
|
| 1344 |
|
| 1345 |
if ( 'webfont' === $load_spec['method'] ) {
|
| 1346 |
|
| 1347 |
+
foreach ( [ 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ] as $action ) {
|
| 1348 |
+
add_action(
|
| 1349 |
+
$action,
|
| 1350 |
+
function () use ( $resource_collection ) {
|
| 1351 |
+
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters
|
| 1352 |
+
wp_enqueue_style( self::RESOURCE_HANDLE, $resource_collection[0]->source(), null, null );
|
| 1353 |
+
}
|
| 1354 |
+
);
|
| 1355 |
+
}
|
| 1356 |
|
| 1357 |
// Filter the <link> tag to add the integrity and crossorigin attributes for completeness.
|
| 1358 |
add_filter(
|
| 1376 |
|
| 1377 |
if ( $load_spec['v4shim'] ) {
|
| 1378 |
/**
|
| 1379 |
+
* Enqueue v4 compatibility as late as possible, though still within the normal script enqueue hooks.
|
| 1380 |
* We need the @font-face override, especially to appear after any unregistered loads of Font Awesome
|
| 1381 |
* that may try to declare a @font-face with a font-family of "FontAwesome".
|
| 1382 |
*/
|
| 1383 |
+
foreach ( [ 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ] as $action ) {
|
| 1384 |
+
add_action(
|
| 1385 |
+
$action,
|
| 1386 |
+
function () use ( $resource_collection, $options, $license_subdomain, $version ) {
|
| 1387 |
+
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters
|
| 1388 |
+
wp_enqueue_style( self::RESOURCE_HANDLE_V4SHIM, $resource_collection[1]->source(), null, null );
|
| 1389 |
|
| 1390 |
+
$font_face = <<< EOT
|
| 1391 |
@font-face {
|
| 1392 |
font-family: "FontAwesome";
|
| 1393 |
src: url("https://${license_subdomain}.fontawesome.com/releases/v${version}/webfonts/fa-brands-400.eot"),
|
| 1420 |
}
|
| 1421 |
EOT;
|
| 1422 |
|
| 1423 |
+
wp_add_inline_style(
|
| 1424 |
+
self::RESOURCE_HANDLE_V4SHIM,
|
| 1425 |
+
$font_face
|
| 1426 |
+
);
|
| 1427 |
|
| 1428 |
+
},
|
| 1429 |
+
PHP_INT_MAX
|
| 1430 |
+
);
|
| 1431 |
+
}
|
| 1432 |
|
| 1433 |
// Filter the <link> tag to add the integrity and crossorigin attributes for completeness.
|
| 1434 |
// Not all resources have an integrity_key for all versions of Font Awesome, so we'll skip this for those
|
| 1455 |
}
|
| 1456 |
}
|
| 1457 |
} else {
|
| 1458 |
+
foreach ( [ 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ] as $action ) {
|
| 1459 |
+
add_action(
|
| 1460 |
+
$action,
|
| 1461 |
+
function () use ( $resource_collection, $load_spec ) {
|
| 1462 |
+
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters
|
| 1463 |
+
wp_enqueue_script( self::RESOURCE_HANDLE, $resource_collection[0]->source(), null, null, false );
|
| 1464 |
|
| 1465 |
+
if ( $load_spec['pseudoElements'] ) {
|
| 1466 |
+
wp_add_inline_script( self::RESOURCE_HANDLE, 'FontAwesomeConfig = { searchPseudoElements: true };', 'before' );
|
| 1467 |
+
}
|
| 1468 |
}
|
| 1469 |
+
);
|
| 1470 |
+
}
|
| 1471 |
|
| 1472 |
// Filter the <script> tag to add additional attributes for integrity, crossorigin, defer.
|
| 1473 |
add_filter(
|
| 1496 |
);
|
| 1497 |
|
| 1498 |
if ( $load_spec['v4shim'] ) {
|
| 1499 |
+
foreach ( [ 'wp_enqueue_scripts', 'admin_enqueue_scripts', 'login_enqueue_scripts' ] as $action ) {
|
| 1500 |
+
add_action(
|
| 1501 |
+
$action,
|
| 1502 |
+
function () use ( $resource_collection ) {
|
| 1503 |
+
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters
|
| 1504 |
+
wp_enqueue_script( self::RESOURCE_HANDLE_V4SHIM, $resource_collection[1]->source(), null, null, false );
|
| 1505 |
+
}
|
| 1506 |
+
);
|
| 1507 |
+
}
|
| 1508 |
|
| 1509 |
add_filter(
|
| 1510 |
'script_loader_tag',
|
| 1535 |
$obj = $this;
|
| 1536 |
/**
|
| 1537 |
* We need to detect unregistered clients *after* they would have been enqueued, if they used
|
| 1538 |
+
* the recommended mechanism of wp_enqueue_style and wp_enqueue_script (or the admin equivalents).
|
| 1539 |
+
* The wp_print_styles action hook is fired after the wp_enqueue_scripts hook
|
| 1540 |
+
* (admin_print_styles after admin_enqueue_scripts).
|
| 1541 |
* We'll use priority 0 in an effort to be as early as possible, to prevent any unregistered client
|
| 1542 |
* from actually being printed to the head.
|
| 1543 |
*/
|
| 1544 |
+
foreach ( [ 'wp_print_styles', 'admin_print_styles', 'login_head' ] as $action ) {
|
| 1545 |
+
add_action(
|
| 1546 |
+
$action,
|
| 1547 |
+
function() use ( $obj, $options ) {
|
| 1548 |
+
$obj->detect_unregistered_clients();
|
| 1549 |
+
if ( $options['removeUnregisteredClients'] ) {
|
| 1550 |
+
$obj->remove_unregistered_clients();
|
| 1551 |
+
}
|
| 1552 |
+
},
|
| 1553 |
+
0
|
| 1554 |
+
);
|
| 1555 |
+
}
|
| 1556 |
}
|
| 1557 |
|
| 1558 |
/**
|
readme.txt
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 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.
|
| 7 |
Requires PHP: 5.6
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
|
@@ -186,6 +186,10 @@ Find the Font Awesome admin settings page either under the "Settings" menu on th
|
|
| 186 |
|
| 187 |
== Changelog ==
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
= 4.0.0-rc10 =
|
| 190 |
|
| 191 |
* Attempt to fix a problem where the admin settings is sometimes being confused by unexpected output from the WordPress
|
| 1 |
=== Font Awesome ===
|
| 2 |
Contributors: fontawesome, mlwilkerson, robmadole, rachelbaker
|
| 3 |
+
Stable tag: 4.0.0-rc11
|
| 4 |
Tags: font, awesome, fontawesome, font-awesome, icon, svg, webfont
|
| 5 |
Requires at least: 4.7
|
| 6 |
+
Tested up to: 5.2.2
|
| 7 |
Requires PHP: 5.6
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
| 186 |
|
| 187 |
== Changelog ==
|
| 188 |
|
| 189 |
+
= 4.0.0-rc11 =
|
| 190 |
+
|
| 191 |
+
* Bug fix: enqueue Font Awesome assets in admin and login areas, not just in the front end
|
| 192 |
+
|
| 193 |
= 4.0.0-rc10 =
|
| 194 |
|
| 195 |
* Attempt to fix a problem where the admin settings is sometimes being confused by unexpected output from the WordPress
|
