Compare commits

...

23 Commits

Author SHA1 Message Date
Mike Wilkerson d2670bfcc7 Release 5.1.0 2025-07-22 16:25:13 -07:00
Mike Wilkerson 68abe08e4a revise some of the release workflow in DEVELOPMENT.md 2025-07-22 16:24:33 -07:00
Mike Wilkerson b44e8495ab update readme.txt Changelog for 5.1.0 2025-07-22 16:11:17 -07:00
Mike Wilkerson 20152da6f4 fix multisite test expectations 2025-07-22 16:01:25 -07:00
Mike Wilkerson 3e43ea9c52 change test expectations for FA7 as initial default version 2025-07-22 15:56:19 -07:00
Mike Wilkerson d9878e7a5a rebuild admin js bundle 2025-07-22 15:35:05 -07:00
Mike Wilkerson e9a9d9e6dd use version 7 by default on plugin activation 2025-07-22 15:34:43 -07:00
Mike Wilkerson 26d1a7b78f update FA5 Pro CDN config alert 2025-07-22 15:30:21 -07:00
Mike Wilkerson 0b1fe630b3 Add CDN availability alert for FA7 2025-07-22 15:28:14 -07:00
Mike Wilkerson fa1ce8f041 handle latest_version_7 in
FontAwesome_Preference_Conflict_Detector::detect()
2025-07-22 15:21:32 -07:00
Mike Wilkerson e2d014a03c rebuild admin js bundle 2025-07-22 15:10:04 -07:00
Mike Wilkerson 24cbe3c071 fix handling of latest_version_7 in admin UI 2025-07-22 15:09:44 -07:00
Mike Wilkerson 85a9c15083 rebuild icon-chooser js bundle 2025-07-22 14:18:54 -07:00
Mike Wilkerson 12ac84d2b7 update fa-icon-chooser-react to 0.9.1 2025-07-22 14:18:36 -07:00
Mike Wilkerson d38a6298b2 rebuild php docs for 5.1.0 2025-07-22 13:14:42 -07:00
Mike Wilkerson 813a4326d1 bump version to 5.1.0 2025-07-22 13:11:53 -07:00
Mike Wilkerson d1827030ed
FA7 readiness (#256)
* update fa-icon-chooser to 0.9.0-1 for FA7 readiness

* rebuild icon-chooser bundle

* accept 7.x as a kit version

* update icon chooser to 0.9.0-2

* updates to make 7.x work, including latest_version_7

- also add assetsBaseUrlOverride and FONTAWESOME_CDN_URL_TEMPLATE
  in development to enable testing with FA7 pre-release

* front end tweaks to enable overriding the _assetsBaseUrl in
fa-icon-chooser

* adding a new define for FONTAWESOME_ASSETS_BASE_URL_OVERRIDE

based on env var

* rebuild icon-chooser bundle

* remove obsolete error message

* Use svg.css for FA7

* Fix the wire-up of assetsBaseUrlOverride

* fix getUrlText

- handle response.status correctly (fix typo)
- tell axios to keep the responseType as text,
  instead of automatically parsing the JSON payload

* rebuild icon chooser bundle

* formatting fixes

* update fa-icon-chooser to 0.9.0-3 [skip ci]

* npm update icon-chooser

* rebuild icon-chooser bundle

* npm update admin bundle

* rebuild admin js bundle

* npm update block-editor bundle

* rebuild block-editor bundle

* npm update classic-editor

* rebuild classic-editor bundle

* update graphql query response fixture

* update test expectations

* auto-formatting

* WIP: updating test expectations

* update test expectations

* keep only a few versions in releases query fixture

* fixup array indices

* update test mocks

* update test expectations

* update tests

* auto-formatting

* update to fa-icon-chooser-react 0.9.0

* re-build icon chooser bundle [skip ci]
2025-07-22 11:27:54 -07:00
Mike Wilkerson 3a1f570cb5 Release 5.0.2 2025-06-02 15:36:45 -07:00
Mike Wilkerson ec3180f86c udpate changelog for 5.0.2 2025-06-02 15:27:26 -07:00
Mike Wilkerson 39facd1161 rebuild docs 2025-06-02 15:12:38 -07:00
Mike Wilkerson 1d1a40c074 bump to version 5.0.2 2025-06-02 15:09:43 -07:00
Mike Wilkerson 1b8c4596c0
Handle restricted filesystem permissions and allow for disabling block editor support (#243)
* update theme-alpha to derive from twenty-twenty-five

* add try / catch / notify in activator

* add more custom exceptions

* Enable fallback checking for svg stylesheet using HEAD request

* enable differentiating admin warnings from fatal errors

and allow for multiline exception messages.

* check for svg styles with fallback warning notice when in WP admin

* use the warning version of fetch_svg_styles from the config controller too

* make the block editor support actions disableable

* rename function as ensure_

* on activation, initialize svg styles conditionally

* pre-release 5.0.2-1

* re-work the classic editor support

- handle null results when querying for editorId element
- use jQuery to handle binding click events to editors to avoid loss of
  click event bindings due to interaction with other plugin

* rebuild classic-editor bundle

* comment out special filters in theme-alpha/functions.php

* fix translators comment for phpcs

* make jquery dependence explicit for classic-editor

* move maybe_refresh_releases into initialize_admin()

* add default SVG styles

* maybe_refresh_releases only on the plugin's settings page

* reduce admin notices to warnings

* bump version

* wp_die with descriptive message on failed activation

* Fixes for phpcs

* update actions/cache version

* Update Dockerfile-latest to add uopz extension

* migrate SVG styles manager away from being a singleton

- make it more testable with uopz

* update multi-site activation tests to use non-singleton SVG styles
manager

* add uopz extension to CI

* add test coverage for svg styles on activation

* cleanup and auto-formatting

* cleanup and focus ActivationTest

* move svg-styles-manager tests into a separate test module

* add test coverage for filesystem permissions error on activation

* add coverage for throwing a specific exception when lacking filesystem
permissions

* add test coverage for stylesheet presence with and without filesystem permissions

* add more test coverage for loading including wp-admin

* enable uopz extension only for phpunit runs
2025-05-23 14:35:03 -07:00
Mike Wilkerson 2629a30c1c Tested up to 6.8 2025-04-28 11:29:27 -07:00
82 changed files with 34637 additions and 18963 deletions

View File

@ -21,7 +21,7 @@ jobs:
- name: Cache node_module
id: node-modules-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: admin/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('admin/package-lock.json') }}

View File

@ -46,6 +46,7 @@ jobs:
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: uopz
- name: Validate composer.json and composer.lock
id: composer-lock

View File

@ -1087,7 +1087,7 @@ $ cd ..
10. Copy plugin directory assets and wp-dist layout into `wp-svn/trunk`
```bash
bin/dist2trunk
bin/dist-to-trunk
```
This script will just `rm *` anything under `wp-svn/trunk/*` and `wp-svn/assets/*` to make sure that if the new dist
@ -1145,15 +1145,7 @@ password. After the first `svn ci` caches the credentials, you probably won't ne
[See also tips on using SVN with WordPress Plugins](https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/#editing-existing-files).
13. OPTIONAL: Test Installation from WordPress Plugins Directory
Once the trunk has been committed above, this new version is available as the current "Development Version",
available for download as a ZIP file from the plugin's [Advanced View](https://wordpress.org/plugins/font-awesome/advanced/). (See the dropdown under the header: "Please select a specific version to download.")
To try it out, you could start up a clean integration environment from this repo, and then
install the plugin using that downloaded ZIP file.
14. Create the new svn release tag
13. Create the new svn release tag
First, make sure `svn stat` is clean. We want to make sure that the trunk is all committed and clean before we take a
snapshot of it for the release tag.
@ -1164,6 +1156,18 @@ This will snapshot `trunk` as a new release tag. Replace the example tag name wi
svn cp trunk tags/42.1.2
```
```bash
svn ci -m 'Tag release 42.1.2'
```
14. OPTIONAL: Test Installation from WordPress Plugins Directory
Once the trunk has been committed above, this new version is available as the current "Development Version",
available for download as a ZIP file from the plugin's [Advanced View](https://wordpress.org/plugins/font-awesome/advanced/). (See the dropdown under the header: "Please select a specific version to download.")
To try it out, you could start up a clean integration environment from this repo, and then
install the plugin using that downloaded ZIP file.
15. Update `Stable tag` and `Tested up to` tags in `readme.txt`
We've now got three copies of `readme.txt` that should all be updated with new tag values:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10
admin/build/381-rtl.css Normal file
View File

@ -0,0 +1,10 @@
.iVV55iNB320NJJLspy7m{max-width:600px}.BcmdF5mOoQ3Luug6sJrn{border:1px dotted grey;border-radius:5px;margin:1rem 0 1rem 1rem;padding:1rem}
.lX8h3LbX6kaLN7_hLhlw{align-items:stretch;background-color:#e4f6ff;border-radius:.25rem;color:#495057;display:flex;flex-direction:row;flex-wrap:no-wrap;margin-top:1rem;max-width:800px}.nx2ZqeD9AnYnPnKHAqKJ{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem;color:#008bed;font-size:1rem;padding:.55rem .75rem .5rem .25rem}.ovRzytWn5jGccLKV78T9{font-size:.8rem;font-weight:600;line-height:1.5;margin-bottom:.2rem;margin-top:0}.M_C6Dj_EqhO8IuY52iA6{display:flex;flex-direction:column;flex-grow:1;font-size:.8rem;padding:.5rem .25rem .75rem 1rem}.M_C6Dj_EqhO8IuY52iA6 p{margin-bottom:.5rem;margin-top:0}.M_C6Dj_EqhO8IuY52iA6 svg{font-size:.7rem}.M_C6Dj_EqhO8IuY52iA6 ul{margin:0}.M_C6Dj_EqhO8IuY52iA6 li{display:inline-block;margin-bottom:0;padding-left:1rem}.liWjpcvKZkKaYPsJjQPA{margin-top:1rem}.lX8h3LbX6kaLN7_hLhlw button{color:#0073aa}.lX8h3LbX6kaLN7_hLhlw button:hover{color:#00a0d2}.MLwfZfK5uVZOtIHI1cdt{background:#fff9db}.MLwfZfK5uVZOtIHI1cdt .nx2ZqeD9AnYnPnKHAqKJ{color:#fab007}
.uL1wb8HtJb_0IkG3PeEN{max-width:100%}.VJ5yoahvOPmye_Iv2x78 button{background:#0000;border:none;font-size:1.5em;margin-right:.125em;margin-left:.125em;padding-bottom:.25em}.VJ5yoahvOPmye_Iv2x78 button:hover{cursor:pointer}.VJ5yoahvOPmye_Iv2x78 button:disabled{border-bottom:4px solid #008ded;color:unset;cursor:default}
.GfbntzmAC3JXYwdY57Hz{color:red}.nkCRdVrm4cTGk23nWmwZ{display:flex;width:100%}.nkCRdVrm4cTGk23nWmwZ svg{margin-bottom:.125em;margin-left:.5em}._V54L7D6KbeTsNGQHyuu{font-size:.9rem;font-weight:700;width:30%}.jH1jbDhGqqv7Grbj6p5p{margin-left:.25rem;text-align:center;width:1rem}.KYI6mFOoLc2LXE3_WOAV{display:flex;flex-direction:row}.uMUQXnIQhpFojiorojGR{width:50%}.Q3PqTXZI2xQbQuon9Brf{display:flex;flex-direction:column;margin-top:.5rem;width:70%}@media only screen and (min-width:1024px){.Q3PqTXZI2xQbQuon9Brf{margin-top:0}}.p0FxJ9gY4EvqdrEJ5pDs{font-style:italic}.p0FxJ9gY4EvqdrEJ5pDs>ul{list-style:none;margin-right:2em}.rr6y9ViQbhSy0YAp3Svc{display:flex;flex-direction:flex-row}.d104q4pTcfNp1fl3EEwj{font-weight:600;margin-right:5px}.pFNsNzsa6QtxNtsHMsos{margin-bottom:1rem;margin-top:1rem}.x21UupVYDcbhJEXG_vuB{margin-top:1rem}.x21UupVYDcbhJEXG_vuB button{background:none;border:none;cursor:pointer;text-decoration:underline}.x21UupVYDcbhJEXG_vuB button svg{margin-left:.5em}.elGAHNDAzrtnF0LZNYl_ .uMUQXnIQhpFojiorojGR{margin-bottom:1.5rem}.FHOPD8z6_efjfjjQHK9B{color:#868e96;display:block;font-weight:400;line-height:1.5;margin-top:.25rem}.FHOPD8z6_efjfjjQHK9B a{color:#868e96}.FHOPD8z6_efjfjjQHK9B a:hover{color:#228be6}.kP55KzmQ_7zoJ5baS76k{padding-right:1em}
.xAYNgmh_FT28wOZEe4og{background-color:#fff;margin-left:20px;padding:1rem 2rem 2rem}@media only screen and (min-width:1024px){.xAYNgmh_FT28wOZEe4og{max-width:1000px}}.W3wz4Liah2EvWxtTBXN8{align-items:center;display:flex}.OpLLWfmNs6BXGmnmuinK{padding-right:1em}div.OpLLWfmNs6BXGmnmuinK.q0fCXPnTi1vRhNmP0IEt{background-color:#fda09a;border-radius:5px;display:flex;margin:1em;max-width:450px;padding:1em}div.OpLLWfmNs6BXGmnmuinK.q0fCXPnTi1vRhNmP0IEt .A2dLn8oZtVzuXngZMDRp{margin-bottom:auto;margin-top:auto}div.OpLLWfmNs6BXGmnmuinK.q0fCXPnTi1vRhNmP0IEt .xFoMk9Jc8Ir4n5Olcce1{max-width:400px}.OpLLWfmNs6BXGmnmuinK .xFoMk9Jc8Ir4n5Olcce1{padding-right:1em}.OpLLWfmNs6BXGmnmuinK.fQeEY3YNz4yh6R7vdi7J .JPBgwk6PxfiitLxJLE54{color:green}h2.VklefjWwawC59yrOPe3e{font-size:18px}h3.VklefjWwawC59yrOPe3e{font-size:16px}.e8Vu3y2YBkuW8N9IhY2m{margin-bottom:1rem;margin-top:1rem}.gNYVG50hxMZs8Gqbj_T0 th{font-weight:700}button.dpYyb_l0GWlAiVkOmmYt{background:none;border:0}.WJl_9YHKGkhUvtVwgVco{align-items:center;display:flex}.HBCEbIhIET1XISEYneSA{margin:1rem}button.ZXe2iyFqFThwx_UF4CBf{background:#008ded;border:solid #0064b1;border-radius:3px;border-width:1px 1px 4px;color:#fff;cursor:pointer;font-size:14px;font-weight:600;line-height:1.4em;padding:.7em 1.5em}button.ZXe2iyFqFThwx_UF4CBf[disabled]{background:#f8f9fa;border:1px solid #f8f9fa;color:#008ded;cursor:default}button .HgLyUkphZYd8YsLSMJAZ{display:inline-block;min-width:3.2em;text-align:right}.Gu2u4ZSZT25Yqm8zSogj{background-color:#fdfdf3;border:1px solid #000;border-radius:5px;max-width:600px;padding:1.5em}.WOV9bdVrpJVdQWzhBnHZ{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}@media only screen and (min-width:1024px){.QN_KH8sqi5QFBDqaH1rI{display:flex}}.bBMVcUUJf1GW7veG1Zic{flex-direction:row}.pIa2BGO1ABMtYZY185Bf{flex-direction:column}.h0koIl1zvME7toM3jUk9{position:relative}.kWqY7l_wn27HmdUNz7ZY .JPBgwk6PxfiitLxJLE54{font-size:24px}.kWqY7l_wn27HmdUNz7ZY.q3No9l7YMUEH1xvYTNfI .JPBgwk6PxfiitLxJLE54,.Y7M4JHzDp7jtCt6MonbK{color:green}.a6qTuZmDiKS_FHgMZawo,.kWqY7l_wn27HmdUNz7ZY.PwCQsIQEdGz9b0cOj3iA .JPBgwk6PxfiitLxJLE54{color:red}.kWqY7l_wn27HmdUNz7ZY.Gu2u4ZSZT25Yqm8zSogj .JPBgwk6PxfiitLxJLE54,.rw5FUVRrrdM17WyxcRZ9{color:#b7b700}.QEoklKhbCbwOUBs0cspa{margin-right:1rem}.oWHnpotXuoOIlJoqkkgw~label .NzRaF0U8aKPVtS6JIaK8,.gIUwcNcpOHhTKG4sTlfg~label .NzRaF0U8aKPVtS6JIaK8{display:none;opacity:0}.oWHnpotXuoOIlJoqkkgw:checked~label .NzRaF0U8aKPVtS6JIaK8,.gIUwcNcpOHhTKG4sTlfg:checked~label .NzRaF0U8aKPVtS6JIaK8{color:#228be6;display:block;opacity:1}.oWHnpotXuoOIlJoqkkgw:checked~label .iemYJRvB4tzF1xnuGiAw,.gIUwcNcpOHhTKG4sTlfg:checked~label .iemYJRvB4tzF1xnuGiAw{display:none;opacity:0}.oWHnpotXuoOIlJoqkkgw:checked~label .BFR5diS8tiViycbuTDVS,.oWHnpotXuoOIlJoqkkgw:checked~label .BFR5diS8tiViycbuTDVS a{color:#495057}.oWHnpotXuoOIlJoqkkgw:checked~label .BFR5diS8tiViycbuTDVS a:hover,.oWHnpotXuoOIlJoqkkgw~label .BFR5diS8tiViycbuTDVS a:hover{color:#228be6;text-decoration-color:initial}
.kaJ7ZfPW8LYXB3jcG1xM{position:relative}.iw1ugzHiscI8cdqPxDt5{border-bottom:1px solid #dde2e6;display:flex;padding:1rem 0 1rem 1rem}.iw1ugzHiscI8cdqPxDt5 label{font-size:.9rem;font-weight:600;width:30%}.iw1ugzHiscI8cdqPxDt5 label svg{color:#dde2e6;padding-left:.5rem}.DnA1Iv_lwCTNSAFQGrON .iw1ugzHiscI8cdqPxDt5 p{font-size:unset;font-weight:unset}.DnA1Iv_lwCTNSAFQGrON .Pnf8O2SgfIFmVM0PSv3Z p svg{color:unset;padding-left:.5rem}.DnA1Iv_lwCTNSAFQGrON{border-bottom:1px solid #dde2e6;display:flex;flex-direction:column;margin-bottom:.75rem;padding:.5rem 0 1rem 1rem}.iw1ugzHiscI8cdqPxDt5.kjodIeFA7B16RQcru0GW{border-bottom:none}.Pnf8O2SgfIFmVM0PSv3Z{display:flex;justify-content:space-between}.Pnf8O2SgfIFmVM0PSv3Z.kjodIeFA7B16RQcru0GW{flex-direction:column}.DnA1Iv_lwCTNSAFQGrON p{font-size:.9rem;font-weight:600;margin:0;padding:.5rem 0}.Pnf8O2SgfIFmVM0PSv3Z .A0_oAmpyVJ9wdtADndGQ span svg{color:#00c346;padding-left:.5rem}button.HfzrDbHUd_u1i9ndGEBR{background-color:initial;border:none;border-radius:3px;color:#999;cursor:pointer;display:inline-block;margin-right:-.1em;padding:.5rem 1rem;transition:background .1s ease-in;transition:.1s ease-in}button.HfzrDbHUd_u1i9ndGEBR:hover{background-color:#da001d;color:#fff}.elgzg717O9Crp2uzkrTD button{margin-right:2em}.V9u2jF9aJPfN0wX4PDVS{background-color:none;border:none;cursor:pointer;line-height:2.15384615;margin-right:1rem;text-decoration:underline;text-decoration-color:#00000026}.V9u2jF9aJPfN0wX4PDVS:hover{text-decoration-color:#000}.wziOBkVmZ17vJu2Sz35G{border-bottom:1px solid #dde2e6;margin-bottom:.75rem;padding:.5rem 0 1rem 1rem}.DFhEV9q8j6_YiAqxGCIQ{font-size:.9rem;font-weight:600;margin:0;padding:.5rem 0}.DFhEV9q8j6_YiAqxGCIQ.y9VOhnGapgfPZMY_1Bh6 svg{color:#00c346;padding-left:.5rem}.DFhEV9q8j6_YiAqxGCIQ.czVzoPvuSXhcttrzFc9L svg{color:#f8f9fa}.ngog_nfdj6MCATJVipdj{padding:.5rem 0 1rem 1rem}.S_T55Hlv5ASeRm2CyHmV{font-size:.9rem;font-weight:600;margin:0 0 1rem}.S_T55Hlv5ASeRm2CyHmV svg{color:#dde2e6;padding-left:.5rem}.fy5GsBzkO8Epk2RR04LH{margin-right:1.8rem}button.fNJ_UaCGqOZxk72kjIDA{background-color:initial;border:none;border-radius:3px;color:#228be6;cursor:pointer;display:inline-block;margin:0 .2rem 0 0;padding:.5rem;transition:background .1s ease-in;transition:.1s ease-in;vertical-align:middle}button.fNJ_UaCGqOZxk72kjIDA:hover{background-color:#1c7ed6;color:#fff}button.fNJ_UaCGqOZxk72kjIDA span{padding-right:.5em}.SstVIjmK5UOaiy_ltjXE .vdGJ8TWieYuqqCakSyHG{display:inline-block;font-weight:600;height:auto;margin-left:1rem;padding:.4rem;vertical-align:middle;width:30%}.gJq7WtlHzhBcjrgjABY8{margin-right:1.8rem}.o1IZC2E8wgWEslXswxvX{border-collapse:collapse;font-size:.9rem;margin:0 0 1rem;width:100%}.o1IZC2E8wgWEslXswxvX .W3xNRcvtnX8v6hHiakrQ,.o1IZC2E8wgWEslXswxvX .HS7POK_5ddxGDSTzJHun{border-bottom:1px solid #dde2e6;border-top:1px solid #dde2e6;padding:.5rem;text-align:right;vertical-align:top}.o1IZC2E8wgWEslXswxvX .W3xNRcvtnX8v6hHiakrQ{font-weight:600;width:30%}.co95Sqvd5n7VgX7SM5jt{display:block;font-weight:400;line-height:1.5;margin-top:.25rem}.co95Sqvd5n7VgX7SM5jt,.co95Sqvd5n7VgX7SM5jt a{color:#868e96}.co95Sqvd5n7VgX7SM5jt a:hover{color:#228be6}
.wVJC_TuxmtpxI03Tbdkt{border-bottom:2px solid #008ded;display:flex;margin-bottom:.5rem;padding-bottom:1rem}.wVJC_TuxmtpxI03Tbdkt label{margin-left:1rem}
.FGrSfvJewATz8TfOqA_j th.dDmxKRAWr1lhLPK3Z838,td.dDmxKRAWr1lhLPK3Z838{background-color:#ffe2e2}
.heZgRJQYY60l5e4s0W_4 th{vertical-align:top}.heZgRJQYY60l5e4s0W_4 th .cBkIuJWm4fbhOOHopdph{font-weight:700}.heZgRJQYY60l5e4s0W_4 code{font-size:10px}.qxjS23M34RH041PZzC82,.L1uULhjJTYD39y7vA6HC{margin-top:.5rem}.JL6BMdxHE5CPnMDBfHe8{display:flex}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
admin/build/587-rtl.css Normal file
View File

@ -0,0 +1,3 @@
.xAYNgmh_FT28wOZEe4og{background-color:#fff;margin-left:20px;padding:1rem 2rem 2rem}@media only screen and (min-width:1024px){.xAYNgmh_FT28wOZEe4og{max-width:1000px}}.W3wz4Liah2EvWxtTBXN8{align-items:center;display:flex}.OpLLWfmNs6BXGmnmuinK{padding-right:1em}div.OpLLWfmNs6BXGmnmuinK.q0fCXPnTi1vRhNmP0IEt{background-color:#fda09a;border-radius:5px;display:flex;margin:1em;max-width:450px;padding:1em}div.OpLLWfmNs6BXGmnmuinK.q0fCXPnTi1vRhNmP0IEt .A2dLn8oZtVzuXngZMDRp{margin-bottom:auto;margin-top:auto}div.OpLLWfmNs6BXGmnmuinK.q0fCXPnTi1vRhNmP0IEt .xFoMk9Jc8Ir4n5Olcce1{max-width:400px}.OpLLWfmNs6BXGmnmuinK .xFoMk9Jc8Ir4n5Olcce1{padding-right:1em}.OpLLWfmNs6BXGmnmuinK.fQeEY3YNz4yh6R7vdi7J .JPBgwk6PxfiitLxJLE54{color:green}h2.VklefjWwawC59yrOPe3e{font-size:18px}h3.VklefjWwawC59yrOPe3e{font-size:16px}.e8Vu3y2YBkuW8N9IhY2m{margin-bottom:1rem;margin-top:1rem}.gNYVG50hxMZs8Gqbj_T0 th{font-weight:700}button.dpYyb_l0GWlAiVkOmmYt{background:none;border:0}.WJl_9YHKGkhUvtVwgVco{align-items:center;display:flex}.HBCEbIhIET1XISEYneSA{margin:1rem}button.ZXe2iyFqFThwx_UF4CBf{background:#008ded;border:solid #0064b1;border-radius:3px;border-width:1px 1px 4px;color:#fff;cursor:pointer;font-size:14px;font-weight:600;line-height:1.4em;padding:.7em 1.5em}button.ZXe2iyFqFThwx_UF4CBf[disabled]{background:#f8f9fa;border:1px solid #f8f9fa;color:#008ded;cursor:default}button .HgLyUkphZYd8YsLSMJAZ{display:inline-block;min-width:3.2em;text-align:right}.Gu2u4ZSZT25Yqm8zSogj{background-color:#fdfdf3;border:1px solid #000;border-radius:5px;max-width:600px;padding:1.5em}.WOV9bdVrpJVdQWzhBnHZ{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}@media only screen and (min-width:1024px){.QN_KH8sqi5QFBDqaH1rI{display:flex}}.bBMVcUUJf1GW7veG1Zic{flex-direction:row}.pIa2BGO1ABMtYZY185Bf{flex-direction:column}.h0koIl1zvME7toM3jUk9{position:relative}.kWqY7l_wn27HmdUNz7ZY .JPBgwk6PxfiitLxJLE54{font-size:24px}.kWqY7l_wn27HmdUNz7ZY.q3No9l7YMUEH1xvYTNfI .JPBgwk6PxfiitLxJLE54,.Y7M4JHzDp7jtCt6MonbK{color:green}.a6qTuZmDiKS_FHgMZawo,.kWqY7l_wn27HmdUNz7ZY.PwCQsIQEdGz9b0cOj3iA .JPBgwk6PxfiitLxJLE54{color:red}.kWqY7l_wn27HmdUNz7ZY.Gu2u4ZSZT25Yqm8zSogj .JPBgwk6PxfiitLxJLE54,.rw5FUVRrrdM17WyxcRZ9{color:#b7b700}.QEoklKhbCbwOUBs0cspa{margin-right:1rem}.oWHnpotXuoOIlJoqkkgw~label .NzRaF0U8aKPVtS6JIaK8,.gIUwcNcpOHhTKG4sTlfg~label .NzRaF0U8aKPVtS6JIaK8{display:none;opacity:0}.oWHnpotXuoOIlJoqkkgw:checked~label .NzRaF0U8aKPVtS6JIaK8,.gIUwcNcpOHhTKG4sTlfg:checked~label .NzRaF0U8aKPVtS6JIaK8{color:#228be6;display:block;opacity:1}.oWHnpotXuoOIlJoqkkgw:checked~label .iemYJRvB4tzF1xnuGiAw,.gIUwcNcpOHhTKG4sTlfg:checked~label .iemYJRvB4tzF1xnuGiAw{display:none;opacity:0}.oWHnpotXuoOIlJoqkkgw:checked~label .BFR5diS8tiViycbuTDVS,.oWHnpotXuoOIlJoqkkgw:checked~label .BFR5diS8tiViycbuTDVS a{color:#495057}.oWHnpotXuoOIlJoqkkgw:checked~label .BFR5diS8tiViycbuTDVS a:hover,.oWHnpotXuoOIlJoqkkgw~label .BFR5diS8tiViycbuTDVS a:hover{color:#228be6;text-decoration-color:initial}
.iVV55iNB320NJJLspy7m{max-width:600px}.BcmdF5mOoQ3Luug6sJrn{border:1px dotted grey;border-radius:5px;margin:1rem 0 1rem 1rem;padding:1rem}
.lX8h3LbX6kaLN7_hLhlw{align-items:stretch;background-color:#e4f6ff;border-radius:.25rem;color:#495057;display:flex;flex-direction:row;flex-wrap:no-wrap;margin-top:1rem;max-width:800px}.nx2ZqeD9AnYnPnKHAqKJ{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem;color:#008bed;font-size:1rem;padding:.55rem .75rem .5rem .25rem}.ovRzytWn5jGccLKV78T9{font-size:.8rem;font-weight:600;line-height:1.5;margin-bottom:.2rem;margin-top:0}.M_C6Dj_EqhO8IuY52iA6{display:flex;flex-direction:column;flex-grow:1;font-size:.8rem;padding:.5rem .25rem .75rem 1rem}.M_C6Dj_EqhO8IuY52iA6 p{margin-bottom:.5rem;margin-top:0}.M_C6Dj_EqhO8IuY52iA6 svg{font-size:.7rem}.M_C6Dj_EqhO8IuY52iA6 ul{margin:0}.M_C6Dj_EqhO8IuY52iA6 li{display:inline-block;margin-bottom:0;padding-left:1rem}.liWjpcvKZkKaYPsJjQPA{margin-top:1rem}.lX8h3LbX6kaLN7_hLhlw button{color:#0073aa}.lX8h3LbX6kaLN7_hLhlw button:hover{color:#00a0d2}.MLwfZfK5uVZOtIHI1cdt{background:#fff9db}.MLwfZfK5uVZOtIHI1cdt .nx2ZqeD9AnYnPnKHAqKJ{color:#fab007}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
"use strict";(self.webpackChunkfont_awesome_admin=self.webpackChunkfont_awesome_admin||[]).push([[897],{897:(c,e,a)=>{a.d(e,{GEE:()=>n,Nfw:()=>f,SGM:()=>i,wRm:()=>r});var i={prefix:"far",iconName:"circle-check",icon:[512,512,[61533,"check-circle"],"f058","M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z"]},f={prefix:"far",iconName:"square",icon:[448,512,[9632,9723,9724,61590],"f0c8","M384 80c8.8 0 16 7.2 16 16V416c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V96c0-8.8 7.2-16 16-16H384zM64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64z"]},n={prefix:"far",iconName:"circle",icon:[512,512,[128308,128309,128992,128993,128994,128995,128996,9679,9898,9899,11044,61708,61915],"f111","M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"]},r={prefix:"far",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm169.8-90.7c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]}}}]);

View File

@ -0,0 +1 @@
"use strict";(self.webpackChunkfont_awesome_admin=self.webpackChunkfont_awesome_admin||[]).push([[897],{897:(c,e,a)=>{a.d(e,{GEE:()=>f,Nfw:()=>l,SGM:()=>i,wRm:()=>n});const i={prefix:"far",iconName:"circle-check",icon:[512,512,[61533,"check-circle"],"f058","M256 48a208 208 0 1 1 0 416 208 208 0 1 1 0-416zm0 464A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209c9.4-9.4 9.4-24.6 0-33.9s-24.6-9.4-33.9 0l-111 111-47-47c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l64 64c9.4 9.4 24.6 9.4 33.9 0L369 209z"]},l={prefix:"far",iconName:"square",icon:[448,512,[9632,9723,9724,61590],"f0c8","M384 80c8.8 0 16 7.2 16 16l0 320c0 8.8-7.2 16-16 16L64 432c-8.8 0-16-7.2-16-16L48 96c0-8.8 7.2-16 16-16l320 0zM64 32C28.7 32 0 60.7 0 96L0 416c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-320c0-35.3-28.7-64-64-64L64 32z"]},f={prefix:"far",iconName:"circle",icon:[512,512,[128308,128309,128992,128993,128994,128995,128996,9679,9898,9899,11044,61708,61915],"f111","M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"]},n={prefix:"far",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zm169.8-90.7c7.9-22.3 29.1-37.3 52.8-37.3l58.3 0c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24l0-13.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1l-58.3 0c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]}}}]);

View File

@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '6d3dfe35c099deb3625b');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'c533036ab18a17f3f9bc');

File diff suppressed because one or more lines are too long

14004
admin/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "font-awesome-admin",
"version": "5.0.0",
"version": "5.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.2.0",

View File

@ -21,6 +21,8 @@ export default function CdnConfigView({ useOption, handleSubmit }) {
const compat = useOption('compat')
const pseudoElements = useOption('pseudoElements')
const isVersion6 = !!version.match(/^6\./)
const isVersion7 = !!version.match(/^7\./)
const isVersion5 = !isVersion6 && !isVersion7
const pendingOptions = useSelector((state) => state.pendingOptions)
const pendingOptionConflicts = useSelector((state) => state.pendingOptionConflicts)
@ -30,13 +32,15 @@ export default function CdnConfigView({ useOption, handleSubmit }) {
const versionOptions = useSelector((state) => {
const {
releases: { available, latest_version_5, latest_version_6 }
releases: { available, latest_version_5, latest_version_6, latest_version_7 }
} = state
return available.reduce((acc, version) => {
if (latest_version_5 === version) {
acc[version] = `${version} (latest 5.x)`
} else if (latest_version_6 === version) {
acc[version] = `${version} (latest 6.x)`
} else if (latest_version_7 === version) {
acc[version] = `${version} (latest)`
} else {
acc[version] = version
@ -164,9 +168,9 @@ export default function CdnConfigView({ useOption, handleSubmit }) {
</label>
</div>
</div>
{usePro && isVersion6 && (
{usePro && (isVersion6 || isVersion7) && (
<Alert
title={__('Heads up! Pro Version 6 is not available from CDN', 'font-awesome')}
title={isVersion6 ? __('Heads up! Pro Version 6 is not available from CDN', 'font-awesome') : __('Heads up! Pro Version 7 is not available from CDN', 'font-awesome')}
type="warning"
>
<p>
@ -175,7 +179,7 @@ export default function CdnConfigView({ useOption, handleSubmit }) {
</p>
</Alert>
)}
{usePro && !isVersion6 && (
{usePro && isVersion5 && (
<Alert
title={__('Heads up! Pro requires a Font Awesome subscription', 'font-awesome')}
type="info"

View File

@ -374,7 +374,7 @@ export function chooseAwayFromKitConfig({ activeKitToken }) {
dispatch({
type: 'CHOOSE_AWAY_FROM_KIT_CONFIG',
activeKitToken,
concreteVersion: get(releases, 'latest_version_6')
concreteVersion: get(releases, 'latest_version_7')
})
}
}

View File

@ -4,4 +4,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/.common.bash
source $DIR/.resolve-container.bash
$WP_SUDO $DOCKER exec -it -w /var/www/html/wp-content/plugins/font-awesome $WP_CONTAINER composer exec phpunit -- $@
# We need to add the uopz extension to the phpunit command, to enable that extension
# that is used in the tests for mocking.
$WP_SUDO $DOCKER exec -it -w /var/www/html/wp-content/plugins/font-awesome $WP_CONTAINER php -d extension=uopz /var/tmp/composer/vendor/bin/phpunit $@

View File

@ -0,0 +1 @@
.wp-rich-text-font-awesome-icon:hover{border:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));border-radius:2px;cursor:pointer;margin-right:-1px;margin-left:-1px}.fawp-inline-popover-wrapper{display:flex;gap:.5rem;padding:.75rem}.fawp-icon-styling-modal{--border-radius-fa:0.5rem;--border-width-fa:2px;--spacing-xs-fa:0.5rem;--spacing-sm-fa:0.75rem;--spacing-md-fa:1rem;--spacing-lg-fa:1.25rem;--spacing-xl-fa:1.5rem;--spacing-2xl-fa:2rem;--black-fa:#001e42;--gray1-fa:#183153;--gray2-fa:#515e7b;--gray3-fa:#616d89;--gray4-fa:#a5abbb;--gray5-fa:#c2c6d0;--gray6-fa:#dfe1e7;--gray7-fa:#f1f2f4;--white-fa:#fff;--red-fa:#e13333;--yellow-fa:#fab005;--teal-fa:#0da578;--blue-fa:#126ebf;--purple-fa:#9b36b5;--violet-fa:#663fd9;--input-border-color:var(--fa-navy);--input-border-width:0.15rem;border-radius:.75em;max-width:130ch;width:80vw}.fawp-button-icon{padding-left:var(--spacing-xs-fa)}.fawp-icon-modifier{display:flex;flex-wrap:wrap;gap:var(--spacing-xl-fa);position:relative}.fawp-icon-modifier-preview-container{border:2px solid var(--gray7-fa);border-radius:var(--border-radius-fa);display:flex;flex:1 0 auto;flex-direction:column;min-height:300px;padding:var(--spacing-md-fa);width:350px}.fawp-icon-modifier-preview{display:flex;font-size:var(--wp--preset--font-size--medium);margin:auto;padding:var(--spacing-md-fa);text-align:center}.fawp-icon-modifier-preview div{display:flex;margin:auto}.fawp-icon-modifier-preview-controls{flex:1 1 50%}.fawp-tab-content{margin-block-start:var(--spacing-2xl-fa)}.fawp-tab-content .fawp-options-section-heading{font-size:.8em;font-weight:500;margin-block:var(--spacing-xs-fa);text-transform:uppercase}.fawp-animation-controls,.fawp-styling-controls{align-items:stretch;display:flex;gap:var(--spacing-sm-fa)}.fawp-animation-controls .fawp-button,.fawp-styling-controls .fawp-button{background-color:var(--white-fa);border:var(--border-width-fa) solid var(--gray7-fa);border-radius:var(--border-radius-fa);cursor:pointer;flex:auto;padding:var(--spacing-xs-fa) var(--spacing-sm-fa);transition:all .2s ease-in-out}.fawp-animation-controls .fawp-button{padding:var(--spacing-md-fa) var(--spacing-lg-fa)}.fawp-animation-controls .fawp-reset,.fawp-styling-controls .fawp-reset{background-color:var(--gray7-fa);flex-grow:0}.fawp-animation-controls .fawp-button.fawp-selected,.fawp-styling-controls .fawp-button.fawp-selected{border-color:var(--black-fa)}.fawp-animation-controls .fawp-button:hover,.fawp-styling-controls .fawp-button:hover{background-color:var(--black-fa);border-color:var(--black-fa);color:var(--white-fa)}.fawp-color-settings{display:flex;gap:10px}.fawp-color-settings .fawp-color-option-wrapper{display:inline-block;height:28px;transform:scale(1);transition:transform .1s ease;vertical-align:top;width:28px;will-change:transform}.fawp-color-settings .fawp-color-option-wrapper:hover{transform:scale(1.2)}.fawp-color-settings .fawp-button{border:none;border-radius:50%;box-shadow:0 0 0 1px var(--gray5-fa);cursor:pointer;display:inline-block;height:100%;transition:box-shadow .1s ease;vertical-align:top;width:100%}.fawp-color-settings .fawp-button.fawp-selected{box-shadow:0 0 0 2px var(--white-fa),0 0 0 4px var(--black-fa)}.fawp-icon-settings-tab-panel{position:relative}.fawp-color-picker-wrapper{background:#fff;border:1px solid gray;box-shadow:0 2px 4px rgba(0,0,0,.5);padding:10px;position:absolute;left:10%;text-align:left;top:0;z-index:1000}.fawp-animation-controls{flex-wrap:wrap}.fawp-icon-animations .fawp-animation-controls .fawp-button{flex:1 0 33%}.fawp-icon-styling-rotate .fawp-input{border:var(--border-width-fa) solid var(--gray7-fa);border-radius:var(--border-radius-fa);max-width:12ch}

View File

@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '47d88c3b77514e672e25');
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-rich-text'), 'version' => '5935c81d1996f7c0446b');

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "wp-font-awesome-icon",
"version": "5.0.0",
"version": "5.1.0",
"description": "Block editor support for Font Awesome icons.",
"author": "Font Awesome",
"license": "GPL-2.0-or-later",

View File

@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-i18n'), 'version' => '16532cdc2e9643455c8b');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'react-jsx-runtime', 'wp-i18n'), 'version' => 'c20dd0f7cd2815741aab');

View File

@ -1 +1 @@
(()=>{"use strict";var e={338:(e,t,n)=>{var o=n(795);t.H=o.createRoot,o.hydrateRoot},795:e=>{e.exports=window.ReactDOM}},t={};const n=window.React;var o=function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}(338);const i=window.lodash;const r=window.wp.i18n,{IconChooserModal:c}=(0,i.get)(window,["__FontAwesomeOfficialPlugin__","iconChooser"],{});function s(e,t,r){const s=new Event(a||`fontAwesomeIconChooser-${function(e){let t="";for(let e=0;e<16;e++)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return t}()}`,{bubbles:!0,cancelable:!1});var a;const d=document.createElement("div");return t.appendChild(d),(0,o.H)(d).render((0,n.createElement)(c,{onSubmit:function(t){r(e,function(e){const t=[];if(!e.iconName)return void console.error("Font Awesome Icon Chooser: missing required iconName attribute for shortcode");t.push(`name="${e.iconName}"`);const n=["prefix","style","class","aria-hidden","aria-label","aria-labelledby","title","role"];for(const o of n){const n=(0,i.get)(e,o);n&&t.push(`${o}="${n}"`)}return`[icon ${t.join(" ")}]`}(t.detail))},openEvent:s})),()=>{document.dispatchEvent(s)}}function a(e,t){const n=(0,i.get)(window,`tinymce.editors.${e}`);if(n&&!n.hidden)return void n.insertContent(t);const o=window.QTags&&QTags.getInstance(e),r=function(e){const t=window.getComputedStyle(e);if("none"===t.display)return!1;if("hidden"===t.visibility)return!1;const n=e.getBoundingClientRect();return 0!==n.width&&0!==n.height}(o.canvas);o&&r&&QTags.insertContent(t,e)}function d(){const e=(0,i.get)(window,"__FontAwesomeOfficialPlugin_tinymce__.editors",[]);for(const t of e){const e=document.querySelector(`#fawp-tinymce-${t}`),n=document.querySelector(`#${t}`),o=n.parentElement;if(!n||!e||!o){console.error((0,r.__)("Font Awesome Plugin: could not attach to editor id:","font-awesome"),t);continue}const i=s(t,o,((e,t)=>{a(e,t)}));e.addEventListener("click",i)}}"complete"===document.readyState?d():window.addEventListener("DOMContentLoaded",(()=>{d()}))})();
(()=>{"use strict";var t={338:(t,e,n)=>{var o=n(795);e.H=o.createRoot,o.hydrateRoot},795:t=>{t.exports=window.ReactDOM}},e={};window.React;var n=function n(o){var i=e[o];if(void 0!==i)return i.exports;var r=e[o]={exports:{}};return t[o](r,r.exports,n),r.exports}(338);const o=window.lodash;window.wp.i18n;const i=window.ReactJSXRuntime,{IconChooserModal:r}=(0,o.get)(window,["__FontAwesomeOfficialPlugin__","iconChooser"],{}),c={};function s(t,e,c){const s=new Event(a||`fontAwesomeIconChooser-${function(){let t="";for(let e=0;e<16;e++)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()));return t}()}`,{bubbles:!0,cancelable:!1});var a;const d=document.createElement("div");return e.appendChild(d),(0,n.H)(d).render((0,i.jsx)(r,{onSubmit:function(e){c(t,function(t){const e=[];if(!t.iconName)return void console.error("Font Awesome Icon Chooser: missing required iconName attribute for shortcode");e.push(`name="${t.iconName}"`);const n=["prefix","style","class","aria-hidden","aria-label","aria-labelledby","title","role"];for(const i of n){const n=(0,o.get)(t,i);n&&e.push(`${i}="${n}"`)}return`[icon ${e.join(" ")}]`}(e.detail))},openEvent:s})),()=>{document.dispatchEvent(s)}}jQuery(document).on("click",".font-awesome-icon-chooser-media-button",function(t){const e=function(t){if(c[t])return c[t];const e=document.querySelector(`#${t}`),n=e?.parentElement;if(!n)return;const i=s(t,n,(t,e)=>{!function(t,e){const n=(0,o.get)(window,`tinymce.editors.${t}`);if(n&&!n.hidden)return void n.insertContent(e);const i=window.QTags&&QTags.getInstance(t),r=function(t){const e=window.getComputedStyle(t);if("none"===e.display)return!1;if("hidden"===e.visibility)return!1;const n=t.getBoundingClientRect();return 0!==n.width&&0!==n.height}(i.canvas);i&&r&&QTags.insertContent(e,t)}(t,e)});return c[t]=i,i}(t.target.getAttribute("data-fa-editor-id"));setTimeout(e,0)})})();

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "wp-font-awesome-classic-editor",
"version": "5.0.0",
"version": "5.1.0",
"description": "Use the Font Awesome Icon Chooser in the Classic Editor",
"author": "Font Awesome",
"license": "GPL-2.0-or-later",

View File

@ -8,6 +8,8 @@ import { __ } from '@wordpress/i18n'
const { IconChooserModal } = get(window, [GLOBAL_KEY, 'iconChooser'], {})
const ICON_CHOOSER_OPEN_MODAL_BY_EDITOR_ID = {}
// Creates a new icon chooser with its own open event and submit handler.
function newIconChooser(editorId, container, editorInsert) {
const modalOpenEvent = createCustomEvent()
@ -72,31 +74,36 @@ function insertContentIntoEditor(editorId, content) {
}
}
function initialize() {
const editorIds = get(window, '__FontAwesomeOfficialPlugin_tinymce__.editors', [])
for (const editorId of editorIds) {
const button = document.querySelector(`#fawp-tinymce-${editorId}`)
const editor = document.querySelector(`#${editorId}`)
const editorContainer = editor.parentElement
if (!editor || !button || !editorContainer) {
console.error(__('Font Awesome Plugin: could not attach to editor id:', 'font-awesome'), editorId)
continue
}
const openIconChooser = newIconChooser(editorId, editorContainer, (editorId, content) => {
insertContentIntoEditor(editorId, content)
})
button.addEventListener('click', openIconChooser)
function getIconChooserOpenModal(editorId) {
if (ICON_CHOOSER_OPEN_MODAL_BY_EDITOR_ID[editorId]) {
return ICON_CHOOSER_OPEN_MODAL_BY_EDITOR_ID[editorId]
}
const editor = document.querySelector(`#${editorId}`)
const editorContainer = editor?.parentElement
if (!editorContainer) {
// The editor might be hidden. Bail early.
return
}
const openIconChooser = newIconChooser(editorId, editorContainer, (editorId, content) => {
insertContentIntoEditor(editorId, content)
})
ICON_CHOOSER_OPEN_MODAL_BY_EDITOR_ID[editorId] = openIconChooser
return openIconChooser
}
if (document.readyState === 'complete') {
initialize()
} else {
window.addEventListener('DOMContentLoaded', () => {
initialize()
})
}
// Using jQuery seems to be the more idiomatic way to bind click events to the media button
// in the WordPress editor. Doing it this way seems to resolve a conflict with the ACF plugin,
// where our click event binding on the media button seemed to be removed on us.
jQuery(document).on('click', '.font-awesome-icon-chooser-media-button', function(e) {
const editorId = e.target.getAttribute('data-fa-editor-id')
const iconChooserOpenModal = getIconChooserOpenModal(editorId)
// This setTimeout allow for the React component that is the Icon Chooser to be mounted
// and ready to receive the event. After the timeout expires, then the "open" event is dispatched.
// Without this, the event is dispatched before the React component is mounted and ready to receive it.
setTimeout(iconChooserOpenModal, 0)
});

View File

@ -113,3 +113,19 @@ if ( ! defined( 'FONTAWESOME_KIT_LOADER_BASE_URL' ) ) {
define( 'FONTAWESOME_KIT_LOADER_BASE_URL', 'https://kit.fontawesome.com' );
}
}
if ( ! defined( 'FONTAWESOME_ASSETS_BASE_URL_OVERRIDE' ) ) {
if ( 'development' === getenv( 'FONTAWESOME_ENV' ) && boolval( getenv( 'FONTAWESOME_ASSETS_BASE_URL_OVERRIDE' ) ) ) {
/**
* @internal
* @ignore
*/
define( 'FONTAWESOME_ASSETS_BASE_URL_OVERRIDE', untrailingslashit( getenv( 'FONTAWESOME_ASSETS_BASE_URL_OVERRIDE' ) ) );
} else {
/**
* @internal
* @ignore
*/
define( 'FONTAWESOME_ASSETS_BASE_URL_OVERRIDE', null );
}
}

View File

@ -4,7 +4,7 @@ FROM wordpress:latest
# See: https://deb.nodesource.com/
RUN apt-get update && apt-get install -y ca-certificates curl gnupg
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /tmp/nodesource.gpg
ENV NODE_MAJOR=20
ENV NODE_MAJOR=22
RUN echo "deb [signed-by=/tmp/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
# Install packages
@ -18,7 +18,12 @@ RUN curl -L -s https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-
RUN groupadd -r user && useradd --no-log-init -r -g user user
# Install composer
RUN curl https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && chmod +x composer.phar && mv composer.phar /usr/local/bin/composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');" && \
mv composer.phar /usr/local/bin/composer && \
chmod +x /usr/local/bin/composer
COPY ./install-wp-tests-docker.sh /tmp
@ -39,4 +44,6 @@ COPY ./setup-owasp.sh /tmp
RUN /tmp/setup-owasp.sh
RUN pecl install uopz
CMD ["docker-entrypoint.sh"]

View File

@ -270,7 +270,7 @@ represents the last plugin installation trying to clean up.</dd>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="font-awesome.php"><a href="files/font-awesome.html">font-awesome.php</a></abbr>
:
<span class="phpdocumentor-element-found-in__line">403</span>
<span class="phpdocumentor-element-found-in__line">416</span>
</aside>
@ -330,7 +330,7 @@ should call this method from its own activation hook. For example:</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="font-awesome.php"><a href="files/font-awesome.html">font-awesome.php</a></abbr>
:
<span class="phpdocumentor-element-found-in__line">491</span>
<span class="phpdocumentor-element-found-in__line">504</span>
</aside>
@ -456,7 +456,7 @@ to access the Loader's functionality through the its public static methods.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="font-awesome.php"><a href="files/font-awesome.html">font-awesome.php</a></abbr>
:
<span class="phpdocumentor-element-found-in__line">471</span>
<span class="phpdocumentor-element-found-in__line">484</span>
</aside>
@ -515,7 +515,7 @@ dependency should call this from its own uninstall hook. For example:</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="font-awesome.php"><a href="files/font-awesome.html">font-awesome.php</a></abbr>
:
<span class="phpdocumentor-element-found-in__line">441</span>
<span class="phpdocumentor-element-found-in__line">454</span>
</aside>

View File

@ -230,7 +230,7 @@ routes, not to the Font Awesome GraphQL API at <code class="prettyprint">api.fon
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a href="classes/FortAwesome-FontAwesome.html#constant_PLUGIN_VERSION">PLUGIN_VERSION</a>
<span>
&nbsp;= &#039;5.0.1&#039; </span>
&nbsp;= &#039;5.1.0&#039; </span>
</dt>
<dd>The version of this WordPress plugin.</dd>
@ -295,6 +295,13 @@ to run the client-side conflict detection scanner.</dd>
</dt>
<dd>Returns the singleton instance of the FontAwesome plugin.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome.html#method_is_block_editor_support_enabled">is_block_editor_support_enabled()</a>
<span>
&nbsp;: bool </span>
</dt>
<dd>Whether to enable Font Awesome support for the Block Editor.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome.html#method_kit_token">kit_token()</a>
<span>
@ -328,6 +335,15 @@ API server.</dd>
</dt>
<dd>Returns the latest available full release version of Font Awesome 6 as a string,
or null if the releases metadata has not yet been successfully retrieved from the
API server.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome.html#method_latest_version_7">latest_version_7()</a>
<span>
&nbsp;: null|string </span>
</dt>
<dd>Returns the latest available version of Font Awesome 7 as a string,
or null if the releases metadata has not yet been successfully retrieved from the
API server.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
@ -569,7 +585,7 @@ a concrete, semver parseable value, like 5.15.3.</dd>
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">mixed</span>
<span class="phpdocumentor-signature__name">PLUGIN_VERSION</span>
= <span class="phpdocumentor-signature__default-value">&#039;5.0.1&#039;</span>
= <span class="phpdocumentor-signature__default-value">&#039;5.1.0&#039;</span>
</code>
@ -751,7 +767,7 @@ a concrete, semver parseable value, like 5.15.3.</dd>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1154</span>
<span class="phpdocumentor-element-found-in__line">1202</span>
</aside>
@ -805,7 +821,7 @@ Font Awesome that the site owner has chosen to block from being enqueued.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1571</span>
<span class="phpdocumentor-element-found-in__line">1619</span>
</aside>
@ -866,7 +882,7 @@ Font Awesome that the site owner has chosen to block from being enqueued.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">679</span>
<span class="phpdocumentor-element-found-in__line">698</span>
</aside>
@ -918,7 +934,7 @@ to run the client-side conflict detection scanner.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">338</span>
<span class="phpdocumentor-element-found-in__line">349</span>
</aside>
@ -962,6 +978,61 @@ to run the client-side conflict detection scanner.</p>
<span class="phpdocumentor-signature__response_type"><a href="classes/FortAwesome-FontAwesome.html"><abbr title="\FortAwesome\FontAwesome">FontAwesome</abbr></a></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_is_block_editor_support_enabled">
is_block_editor_support_enabled()
<a href="classes/FortAwesome-FontAwesome.html#method_is_block_editor_support_enabled" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">3196</span>
</aside>
<p class="phpdocumentor-summary">Whether to enable Font Awesome support for the Block Editor.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">is_block_editor_support_enabled</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">bool</span></code>
<div class="phpdocumentor-label-line">
</div>
<section class="phpdocumentor-description"><p>This can be disabled with the <code class="prettyprint">font_awesome_disable_block_editor_support</code> filter,
like this:</p>
<p><code class="prettyprint">add_filter( 'font_awesome_disable_block_editor_support', '__return_true' );</code></p>
</section>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-FontAwesome.html#method_is_block_editor_support_enabled#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">5.0.2</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">bool</span>
</section>
</article>
<article
class="phpdocumentor-element
@ -977,7 +1048,7 @@ to run the client-side conflict detection scanner.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1539</span>
<span class="phpdocumentor-element-found-in__line">1587</span>
</aside>
@ -1041,7 +1112,7 @@ configured to load a kit.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">819</span>
<span class="phpdocumentor-element-found-in__line">838</span>
</aside>
@ -1129,7 +1200,7 @@ and the logged in user has the appropriate permissions.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">832</span>
<span class="phpdocumentor-element-found-in__line">851</span>
</aside>
@ -1182,7 +1253,7 @@ API server.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">845</span>
<span class="phpdocumentor-element-found-in__line">864</span>
</aside>
@ -1220,6 +1291,59 @@ API server.</p>
<span class="phpdocumentor-signature__response_type">null|string</span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_latest_version_7">
latest_version_7()
<a href="classes/FortAwesome-FontAwesome.html#method_latest_version_7" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">877</span>
</aside>
<p class="phpdocumentor-summary">Returns the latest available version of Font Awesome 7 as a string,
or null if the releases metadata has not yet been successfully retrieved from the
API server.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">latest_version_7</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">null|string</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-FontAwesome.html#method_latest_version_7#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">5.1.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">null|string</span>
</section>
</article>
<article
class="phpdocumentor-element
@ -1235,7 +1359,7 @@ API server.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1453</span>
<span class="phpdocumentor-element-found-in__line">1501</span>
</aside>
@ -1296,7 +1420,7 @@ API server.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1593</span>
<span class="phpdocumentor-element-found-in__line">1641</span>
</aside>
@ -1369,7 +1493,7 @@ are always inherently supported by the CSS/Webfont technology.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">2861</span>
<span class="phpdocumentor-element-found-in__line">2912</span>
</aside>
@ -1583,7 +1707,7 @@ has a HTTP 200 status.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">2683</span>
<span class="phpdocumentor-element-found-in__line">2734</span>
</aside>
@ -1794,7 +1918,7 @@ approach, because the performance can be poor. <em>Really</em> poor, in some cas
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">882</span>
<span class="phpdocumentor-element-found-in__line">914</span>
</aside>
@ -1850,7 +1974,7 @@ refreshed.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1467</span>
<span class="phpdocumentor-element-found-in__line">1515</span>
</aside>
@ -1909,7 +2033,7 @@ refreshed.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">700</span>
<span class="phpdocumentor-element-found-in__line">719</span>
</aside>
@ -1972,7 +2096,7 @@ Yet this is a valid way to determine that.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1557</span>
<span class="phpdocumentor-element-found-in__line">1605</span>
</aside>
@ -2040,7 +2164,7 @@ Yet this is a valid way to determine that.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">1524</span>
<span class="phpdocumentor-element-found-in__line">1572</span>
</aside>
@ -2152,7 +2276,7 @@ in the db. Otherwise, 5.x, or 6.x, or a semantic version string.</p>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">3086</span>
<span class="phpdocumentor-element-found-in__line">3139</span>
</aside>
@ -2299,10 +2423,12 @@ in the db. Otherwise, 5.x, or 6.x, or a semantic version string.</p>
<li><a href="classes/FortAwesome-FontAwesome.html#method_compatibility">compatibility()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_detecting_conflicts">detecting_conflicts()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_instance">instance()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_is_block_editor_support_enabled">is_block_editor_support_enabled()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_kit_token">kit_token()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_latest_version">latest_version()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_latest_version_5">latest_version_5()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_latest_version_6">latest_version_6()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_latest_version_7">latest_version_7()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_pro">pro()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_pseudo_elements">pseudo_elements()</a></li>
<li><a href="classes/FortAwesome-FontAwesome.html#method_query">query()</a></li>

View File

@ -0,0 +1,446 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Documentation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@100;200;300;400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/template.js"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -three phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/fortawesome.html" class="">FortAwesome</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -nine phpdocumentor-content">
<section>
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/fortawesome.html">FortAwesome</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
SelfhostSetupPermissionsException
<span class="phpdocumentor-element__extends">
extends <a href="classes/FortAwesome-FontAwesome-ServerException.html"><abbr title="\FortAwesome\FontAwesome_ServerException">FontAwesome_ServerException</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<div class="phpdocumentor-label-line">
</div>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome-exception.php"><a href="files/includes-class-fontawesome-exception.html"><abbr title="includes/class-fontawesome-exception.php">class-fontawesome-exception.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">635</span>
</aside>
<p class="phpdocumentor-summary">Thrown when permissions are lacking to setup self-hosting.</p>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-SelfhostSetupPermissionsException.html#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">5.0.2</span>
</dd>
</dl>
<h3 id="toc">
Table of Contents
<a href="classes/FortAwesome-SelfhostSetupPermissionsException.html#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<h4 id="toc-methods">
Methods
<a href="classes/FortAwesome-SelfhostSetupPermissionsException.html#toc-methods" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error">get_wp_error()</a>
<span>
&nbsp;: null|<abbr title="\FortAwesome\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>The WP_Error associated with this exception, if any.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response">get_wp_response()</a>
<span>
&nbsp;: null|array&lt;string|int, mixed&gt; </span>
</dt>
<dd>The response object associated with this exception, if any.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/FortAwesome-SelfhostSetupPermissionsException.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_wp_error">
get_wp_error()
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome-exception.php"><a href="files/includes-class-fontawesome-exception.html"><abbr title="includes/class-fontawesome-exception.php">class-fontawesome-exception.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">104</span>
</aside>
<p class="phpdocumentor-summary">The WP_Error associated with this exception, if any.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_wp_error</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">null|<abbr title="\FortAwesome\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">4.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">null|<abbr title="\FortAwesome\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_wp_response">
get_wp_response()
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome-exception.php"><a href="files/includes-class-fontawesome-exception.html"><abbr title="includes/class-fontawesome-exception.php">class-fontawesome-exception.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">115</span>
</aside>
<p class="phpdocumentor-summary">The response object associated with this exception, if any.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_wp_response</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">null|array&lt;string|int, mixed&gt;</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">4.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">null|array&lt;string|int, mixed&gt;</span>
&mdash;
<section class="phpdocumentor-description"><p>a response array as would be returned by wp_remote_post()
with keys like: 'headers', 'body', 'response'.</p>
</section>
</section>
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/includes/class-fontawesome-exception.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">&times;</button>
</div>
</div>
<script type="text/javascript">
(function () {
function loadExternalCodeSnippet(el, url, line) {
Array.prototype.slice.call(el.querySelectorAll('pre[data-src]')).forEach((pre) => {
const src = url || pre.getAttribute('data-src').replace(/\\/g, '/');
const language = 'php';
const code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) {
return;
}
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
return;
}
if (xhr.status === 404) {
code.textContent = '✖ Error: File could not be found';
return;
}
if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
return;
}
code.textContent = '✖ Error: An unknown error occurred';
};
xhr.send(null);
});
}
const modalButtons = document.querySelectorAll("[data-modal]");
const openedAsLocalFile = window.location.protocol === 'file:';
if (modalButtons.length > 0 && openedAsLocalFile) {
console.warn(
'Viewing the source code is unavailable because you are opening this page from the file:// scheme; ' +
'browsers block XHR requests when a page is opened this way'
);
}
modalButtons.forEach(function (trigger) {
if (openedAsLocalFile) {
trigger.setAttribute("hidden", "hidden");
}
trigger.addEventListener("click", function (event) {
event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
if (!modal) {
console.error(`Modal with id "${trigger.dataset.modal}" could not be found`);
return;
}
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippet(modal, trigger.dataset.src || null, trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
})();
</script>
</article>
</section>
<section class="phpdocumentor-on-this-page__sidebar">
<section class="phpdocumentor-on-this-page__content">
<strong class="phpdocumentor-on-this-page__title">On this page</strong>
<ul class="phpdocumentor-list -clean">
<li class="phpdocumentor-on-this-page-section__title">Table Of Contents</li>
<li>
<ul class="phpdocumentor-list -clean">
<li><a href="classes/FortAwesome-SelfhostSetupPermissionsException.html#toc-methods">Methods</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Methods</li>
<li>
<ul class="phpdocumentor-list -clean">
<li><a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error">get_wp_error()</a></li>
<li><a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response">get_wp_response()</a></li>
</ul>
</li>
</ul>
</section>
</section>
</div>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
<a href="classes/FortAwesome-SelfhostSetupPermissionsException.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

View File

@ -0,0 +1,447 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Documentation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="../">
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/base.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@100;200;300;400;600;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/template.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
<script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
<script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
<script src="js/template.js"></script>
<script src="js/search.js"></script>
<script defer src="js/searchIndex.js"></script>
</head>
<body id="top">
<header class="phpdocumentor-header phpdocumentor-section">
<h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
<input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
<label class="phpdocumentor-header__menu-icon" for="menu-button">
<i class="fas fa-bars"></i>
</label>
<section data-search-form class="phpdocumentor-search">
<label>
<span class="visually-hidden">Search for</span>
<svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
<line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
</svg>
<input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
</label>
</section>
<nav class="phpdocumentor-topnav">
<ul class="phpdocumentor-topnav__menu">
</ul>
</nav>
</header>
<main class="phpdocumentor">
<div class="phpdocumentor-section">
<input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
<label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
Menu
</label>
<aside class="phpdocumentor-column -three phpdocumentor-sidebar">
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="namespaces/fortawesome.html" class="">FortAwesome</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
<h4 class="phpdocumentor-sidebar__root-namespace">
<a href="packages/Application.html" class="">Application</a>
</h4>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
<h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
</section>
<section class="phpdocumentor-sidebar__category">
<h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
<h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
</section>
</aside>
<div class="phpdocumentor-column -nine phpdocumentor-content">
<section>
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="namespaces/fortawesome.html">FortAwesome</a></li>
</ul>
<article class="phpdocumentor-element -class">
<h2 class="phpdocumentor-content__title">
SvgStylesheetCheckException
<span class="phpdocumentor-element__extends">
extends <a href="classes/FortAwesome-FontAwesome-ServerException.html"><abbr title="\FortAwesome\FontAwesome_ServerException">FontAwesome_ServerException</abbr></a>
</span>
<div class="phpdocumentor-element__package">
in package
<ul class="phpdocumentor-breadcrumbs">
<li class="phpdocumentor-breadcrumb"><a href="packages/Application.html">Application</a></li>
</ul>
</div>
</h2>
<div class="phpdocumentor-label-line">
</div>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome-exception.php"><a href="files/includes-class-fontawesome-exception.html"><abbr title="includes/class-fontawesome-exception.php">class-fontawesome-exception.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">643</span>
</aside>
<p class="phpdocumentor-summary">Thrown when the FontAwesome_SVG_Styles_Manager attempts to check for the presence of
the SVG stylesheet via HTTP request, and that request fails.</p>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-SvgStylesheetCheckException.html#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">5.0.2</span>
</dd>
</dl>
<h3 id="toc">
Table of Contents
<a href="classes/FortAwesome-SvgStylesheetCheckException.html#toc" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<h4 id="toc-methods">
Methods
<a href="classes/FortAwesome-SvgStylesheetCheckException.html#toc-methods" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<dl class="phpdocumentor-table-of-contents">
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error">get_wp_error()</a>
<span>
&nbsp;: null|<abbr title="\FortAwesome\WP_Error">WP_Error</abbr> </span>
</dt>
<dd>The WP_Error associated with this exception, if any.</dd>
<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response">get_wp_response()</a>
<span>
&nbsp;: null|array&lt;string|int, mixed&gt; </span>
</dt>
<dd>The response object associated with this exception, if any.</dd>
</dl>
<section class="phpdocumentor-methods">
<h3 class="phpdocumentor-elements__header" id="methods">
Methods
<a href="classes/FortAwesome-SvgStylesheetCheckException.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
</h3>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_wp_error">
get_wp_error()
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome-exception.php"><a href="files/includes-class-fontawesome-exception.html"><abbr title="includes/class-fontawesome-exception.php">class-fontawesome-exception.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">104</span>
</aside>
<p class="phpdocumentor-summary">The WP_Error associated with this exception, if any.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_wp_error</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">null|<abbr title="\FortAwesome\WP_Error">WP_Error</abbr></span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">4.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">null|<abbr title="\FortAwesome\WP_Error">WP_Error</abbr></span>
</section>
</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_get_wp_response">
get_wp_response()
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome-exception.php"><a href="files/includes-class-fontawesome-exception.html"><abbr title="includes/class-fontawesome-exception.php">class-fontawesome-exception.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">115</span>
</aside>
<p class="phpdocumentor-summary">The response object associated with this exception, if any.</p>
<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">get_wp_response</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">null|array&lt;string|int, mixed&gt;</span></code>
<div class="phpdocumentor-label-line">
</div>
<h5 class="phpdocumentor-tag-list__heading" id="tags">
Tags
<a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response#tags" class="headerlink"><i class="fas fa-link"></i></a>
</h5>
<dl class="phpdocumentor-tag-list">
<dt class="phpdocumentor-tag-list__entry">
<span class="phpdocumentor-tag__name">since</span>
</dt>
<dd class="phpdocumentor-tag-list__definition">
<span class="phpdocumentor-tag-link">4.0.0</span>
</dd>
</dl>
<section>
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">null|array&lt;string|int, mixed&gt;</span>
&mdash;
<section class="phpdocumentor-description"><p>a response array as would be returned by wp_remote_post()
with keys like: 'headers', 'body', 'response'.</p>
</section>
</section>
</article>
</section>
<div class="phpdocumentor-modal" id="source-view">
<div class="phpdocumentor-modal-bg" data-exit-button></div>
<div class="phpdocumentor-modal-container">
<div class="phpdocumentor-modal-content">
<pre style="max-height: 500px; overflow-y: scroll" data-src="files/includes/class-fontawesome-exception.php.txt" class="language-php line-numbers linkable-line-numbers"></pre>
</div>
<button data-exit-button class="phpdocumentor-modal__close">&times;</button>
</div>
</div>
<script type="text/javascript">
(function () {
function loadExternalCodeSnippet(el, url, line) {
Array.prototype.slice.call(el.querySelectorAll('pre[data-src]')).forEach((pre) => {
const src = url || pre.getAttribute('data-src').replace(/\\/g, '/');
const language = 'php';
const code = document.createElement('code');
code.className = 'language-' + language;
pre.textContent = '';
pre.setAttribute('data-line', line)
code.textContent = 'Loading…';
pre.appendChild(code);
var xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.onreadystatechange = function () {
if (xhr.readyState !== 4) {
return;
}
if (xhr.status < 400 && xhr.responseText) {
code.textContent = xhr.responseText;
Prism.highlightElement(code);
return;
}
if (xhr.status === 404) {
code.textContent = '✖ Error: File could not be found';
return;
}
if (xhr.status >= 400) {
code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
return;
}
code.textContent = '✖ Error: An unknown error occurred';
};
xhr.send(null);
});
}
const modalButtons = document.querySelectorAll("[data-modal]");
const openedAsLocalFile = window.location.protocol === 'file:';
if (modalButtons.length > 0 && openedAsLocalFile) {
console.warn(
'Viewing the source code is unavailable because you are opening this page from the file:// scheme; ' +
'browsers block XHR requests when a page is opened this way'
);
}
modalButtons.forEach(function (trigger) {
if (openedAsLocalFile) {
trigger.setAttribute("hidden", "hidden");
}
trigger.addEventListener("click", function (event) {
event.preventDefault();
const modal = document.getElementById(trigger.dataset.modal);
if (!modal) {
console.error(`Modal with id "${trigger.dataset.modal}" could not be found`);
return;
}
modal.classList.add("phpdocumentor-modal__open");
loadExternalCodeSnippet(modal, trigger.dataset.src || null, trigger.dataset.line)
const exits = modal.querySelectorAll("[data-exit-button]");
exits.forEach(function (exit) {
exit.addEventListener("click", function (event) {
event.preventDefault();
modal.classList.remove("phpdocumentor-modal__open");
});
});
});
});
})();
</script>
</article>
</section>
<section class="phpdocumentor-on-this-page__sidebar">
<section class="phpdocumentor-on-this-page__content">
<strong class="phpdocumentor-on-this-page__title">On this page</strong>
<ul class="phpdocumentor-list -clean">
<li class="phpdocumentor-on-this-page-section__title">Table Of Contents</li>
<li>
<ul class="phpdocumentor-list -clean">
<li><a href="classes/FortAwesome-SvgStylesheetCheckException.html#toc-methods">Methods</a></li>
</ul>
</li>
<li class="phpdocumentor-on-this-page-section__title">Methods</li>
<li>
<ul class="phpdocumentor-list -clean">
<li><a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_error">get_wp_error()</a></li>
<li><a href="classes/FortAwesome-FontAwesome-Exception.html#method_get_wp_response">get_wp_response()</a></li>
</ul>
</li>
</ul>
</section>
</section>
</div>
<section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
<section class="phpdocumentor-search-results__dialog">
<header class="phpdocumentor-search-results__header">
<h2 class="phpdocumentor-search-results__title">Search results</h2>
<button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
</header>
<section class="phpdocumentor-search-results__body">
<ul class="phpdocumentor-search-results__entries"></ul>
</section>
</section>
</section>
</div>
<a href="classes/FortAwesome-SvgStylesheetCheckException.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
</main>
<script>
cssVars({});
</script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
</body>
</html>

View File

@ -131,7 +131,8 @@ a programming error in this plugin, or that the state of database has been
changed between the time that options would have been valid upon saving and
the time that the page load occurs and those options are found to be invalid.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionSchemaException.html"><abbr title="\FortAwesome\ConflictDetectionSchemaException">ConflictDetectionSchemaException</abbr></a></dt><dd>Thrown when the conflict detection scanner posts data to a REST endpoint and
the data has an invalid schema. This would probably indicate a programming
error in this plugin.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionStorageException.html"><abbr title="\FortAwesome\ConflictDetectionStorageException">ConflictDetectionStorageException</abbr></a></dt><dd>Thrown when there&#039;s a failure to store conflict detection data as a transient.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ClientPreferencesSchemaException.html"><abbr title="\FortAwesome\ClientPreferencesSchemaException">ClientPreferencesSchemaException</abbr></a></dt><dd>Indicates that an incorrect array schema has been provided by a registerd client.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-UpgradeException.html"><abbr title="\FortAwesome\UpgradeException">UpgradeException</abbr></a></dt><dd>Indicates a problem during upgrade process.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupException.html"><abbr title="\FortAwesome\SelfhostSetupException">SelfhostSetupException</abbr></a></dt><dd>Thrown on one of several errors conditions when setting up assets for self-hosting.</dd> </dl>
error in this plugin.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionStorageException.html"><abbr title="\FortAwesome\ConflictDetectionStorageException">ConflictDetectionStorageException</abbr></a></dt><dd>Thrown when there&#039;s a failure to store conflict detection data as a transient.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ClientPreferencesSchemaException.html"><abbr title="\FortAwesome\ClientPreferencesSchemaException">ClientPreferencesSchemaException</abbr></a></dt><dd>Indicates that an incorrect array schema has been provided by a registerd client.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-UpgradeException.html"><abbr title="\FortAwesome\UpgradeException">UpgradeException</abbr></a></dt><dd>Indicates a problem during upgrade process.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupException.html"><abbr title="\FortAwesome\SelfhostSetupException">SelfhostSetupException</abbr></a></dt><dd>Thrown on one of several errors conditions when setting up assets for self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupPermissionsException.html"><abbr title="\FortAwesome\SelfhostSetupPermissionsException">SelfhostSetupPermissionsException</abbr></a></dt><dd>Thrown when permissions are lacking to setup self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SvgStylesheetCheckException.html"><abbr title="\FortAwesome\SvgStylesheetCheckException">SvgStylesheetCheckException</abbr></a></dt><dd>Thrown when the FontAwesome_SVG_Styles_Manager attempts to check for the presence of
the SVG stylesheet via HTTP request, and that request fails.</dd> </dl>

View File

@ -157,7 +157,7 @@ class.</dd>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">3144</span>
<span class="phpdocumentor-element-found-in__line">3212</span>
</aside>

View File

@ -180,6 +180,16 @@ Search.appendIndex(
"name": "SelfhostSetupException",
"summary": "Thrown\u0020on\u0020one\u0020of\u0020several\u0020errors\u0020conditions\u0020when\u0020setting\u0020up\u0020assets\u0020for\u0020self\u002Dhosting.",
"url": "classes/FortAwesome-SelfhostSetupException.html"
}, {
"fqsen": "\\FortAwesome\\SelfhostSetupPermissionsException",
"name": "SelfhostSetupPermissionsException",
"summary": "Thrown\u0020when\u0020permissions\u0020are\u0020lacking\u0020to\u0020setup\u0020self\u002Dhosting.",
"url": "classes/FortAwesome-SelfhostSetupPermissionsException.html"
}, {
"fqsen": "\\FortAwesome\\SvgStylesheetCheckException",
"name": "SvgStylesheetCheckException",
"summary": "Thrown\u0020when\u0020the\u0020FontAwesome_SVG_Styles_Manager\u0020attempts\u0020to\u0020check\u0020for\u0020the\u0020presence\u0020of\nthe\u0020SVG\u0020stylesheet\u0020via\u0020HTTP\u0020request,\u0020and\u0020that\u0020request\u0020fails.",
"url": "classes/FortAwesome-SvgStylesheetCheckException.html"
}, {
"fqsen": "\\FortAwesome\\FontAwesome_REST_Response",
"name": "FontAwesome_REST_Response",
@ -230,6 +240,11 @@ Search.appendIndex(
"name": "latest_version_6",
"summary": "Returns\u0020the\u0020latest\u0020available\u0020full\u0020release\u0020version\u0020of\u0020Font\u0020Awesome\u00206\u0020as\u0020a\u0020string,\nor\u0020null\u0020if\u0020the\u0020releases\u0020metadata\u0020has\u0020not\u0020yet\u0020been\u0020successfully\u0020retrieved\u0020from\u0020the\nAPI\u0020server.",
"url": "classes/FortAwesome-FontAwesome.html#method_latest_version_6"
}, {
"fqsen": "\\FortAwesome\\FontAwesome\u003A\u003Alatest_version_7\u0028\u0029",
"name": "latest_version_7",
"summary": "Returns\u0020the\u0020latest\u0020available\u0020version\u0020of\u0020Font\u0020Awesome\u00207\u0020as\u0020a\u0020string,\nor\u0020null\u0020if\u0020the\u0020releases\u0020metadata\u0020has\u0020not\u0020yet\u0020been\u0020successfully\u0020retrieved\u0020from\u0020the\nAPI\u0020server.",
"url": "classes/FortAwesome-FontAwesome.html#method_latest_version_7"
}, {
"fqsen": "\\FortAwesome\\FontAwesome\u003A\u003Areleases_refreshed_at\u0028\u0029",
"name": "releases_refreshed_at",
@ -290,6 +305,11 @@ Search.appendIndex(
"name": "maybe_enqueue_conflict_detection",
"summary": "",
"url": "classes/FortAwesome-FontAwesome.html#method_maybe_enqueue_conflict_detection"
}, {
"fqsen": "\\FortAwesome\\FontAwesome\u003A\u003Ais_block_editor_support_enabled\u0028\u0029",
"name": "is_block_editor_support_enabled",
"summary": "Whether\u0020to\u0020enable\u0020Font\u0020Awesome\u0020support\u0020for\u0020the\u0020Block\u0020Editor.",
"url": "classes/FortAwesome-FontAwesome.html#method_is_block_editor_support_enabled"
}, {
"fqsen": "\\FortAwesome\\FontAwesome\u003A\u003ASHORTCODE_TAG",
"name": "SHORTCODE_TAG",

View File

@ -129,7 +129,8 @@ a programming error in this plugin, or that the state of database has been
changed between the time that options would have been valid upon saving and
the time that the page load occurs and those options are found to be invalid.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionSchemaException.html"><abbr title="\FortAwesome\ConflictDetectionSchemaException">ConflictDetectionSchemaException</abbr></a></dt><dd>Thrown when the conflict detection scanner posts data to a REST endpoint and
the data has an invalid schema. This would probably indicate a programming
error in this plugin.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionStorageException.html"><abbr title="\FortAwesome\ConflictDetectionStorageException">ConflictDetectionStorageException</abbr></a></dt><dd>Thrown when there&#039;s a failure to store conflict detection data as a transient.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ClientPreferencesSchemaException.html"><abbr title="\FortAwesome\ClientPreferencesSchemaException">ClientPreferencesSchemaException</abbr></a></dt><dd>Indicates that an incorrect array schema has been provided by a registerd client.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-UpgradeException.html"><abbr title="\FortAwesome\UpgradeException">UpgradeException</abbr></a></dt><dd>Indicates a problem during upgrade process.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupException.html"><abbr title="\FortAwesome\SelfhostSetupException">SelfhostSetupException</abbr></a></dt><dd>Thrown on one of several errors conditions when setting up assets for self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome-REST-Response.html"><abbr title="\FortAwesome\FontAwesome_REST_Response">FontAwesome_REST_Response</abbr></a></dt><dd>Handles FontAwesome-specific enhancements to a REST response.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome.html"><abbr title="\FortAwesome\FontAwesome">FontAwesome</abbr></a></dt><dd>Main plugin class, a Singleton. Exposes all API methods and hooks that may be used by
error in this plugin.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionStorageException.html"><abbr title="\FortAwesome\ConflictDetectionStorageException">ConflictDetectionStorageException</abbr></a></dt><dd>Thrown when there&#039;s a failure to store conflict detection data as a transient.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ClientPreferencesSchemaException.html"><abbr title="\FortAwesome\ClientPreferencesSchemaException">ClientPreferencesSchemaException</abbr></a></dt><dd>Indicates that an incorrect array schema has been provided by a registerd client.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-UpgradeException.html"><abbr title="\FortAwesome\UpgradeException">UpgradeException</abbr></a></dt><dd>Indicates a problem during upgrade process.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupException.html"><abbr title="\FortAwesome\SelfhostSetupException">SelfhostSetupException</abbr></a></dt><dd>Thrown on one of several errors conditions when setting up assets for self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupPermissionsException.html"><abbr title="\FortAwesome\SelfhostSetupPermissionsException">SelfhostSetupPermissionsException</abbr></a></dt><dd>Thrown when permissions are lacking to setup self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SvgStylesheetCheckException.html"><abbr title="\FortAwesome\SvgStylesheetCheckException">SvgStylesheetCheckException</abbr></a></dt><dd>Thrown when the FontAwesome_SVG_Styles_Manager attempts to check for the presence of
the SVG stylesheet via HTTP request, and that request fails.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome-REST-Response.html"><abbr title="\FortAwesome\FontAwesome_REST_Response">FontAwesome_REST_Response</abbr></a></dt><dd>Handles FontAwesome-specific enhancements to a REST response.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome.html"><abbr title="\FortAwesome\FontAwesome">FontAwesome</abbr></a></dt><dd>Main plugin class, a Singleton. Exposes all API methods and hooks that may be used by
client code to register with this plugin, to receive notifications about runtime
configuration, or to query the runtime configuration.</dd> </dl>
@ -172,7 +173,7 @@ class.</dd>
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">3144</span>
<span class="phpdocumentor-element-found-in__line">3212</span>
</aside>

View File

@ -129,7 +129,8 @@ a programming error in this plugin, or that the state of database has been
changed between the time that options would have been valid upon saving and
the time that the page load occurs and those options are found to be invalid.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionSchemaException.html"><abbr title="\FortAwesome\ConflictDetectionSchemaException">ConflictDetectionSchemaException</abbr></a></dt><dd>Thrown when the conflict detection scanner posts data to a REST endpoint and
the data has an invalid schema. This would probably indicate a programming
error in this plugin.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionStorageException.html"><abbr title="\FortAwesome\ConflictDetectionStorageException">ConflictDetectionStorageException</abbr></a></dt><dd>Thrown when there&#039;s a failure to store conflict detection data as a transient.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ClientPreferencesSchemaException.html"><abbr title="\FortAwesome\ClientPreferencesSchemaException">ClientPreferencesSchemaException</abbr></a></dt><dd>Indicates that an incorrect array schema has been provided by a registerd client.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-UpgradeException.html"><abbr title="\FortAwesome\UpgradeException">UpgradeException</abbr></a></dt><dd>Indicates a problem during upgrade process.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupException.html"><abbr title="\FortAwesome\SelfhostSetupException">SelfhostSetupException</abbr></a></dt><dd>Thrown on one of several errors conditions when setting up assets for self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome-REST-Response.html"><abbr title="\FortAwesome\FontAwesome_REST_Response">FontAwesome_REST_Response</abbr></a></dt><dd>Handles FontAwesome-specific enhancements to a REST response.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome.html"><abbr title="\FortAwesome\FontAwesome">FontAwesome</abbr></a></dt><dd>Main plugin class, a Singleton. Exposes all API methods and hooks that may be used by
error in this plugin.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ConflictDetectionStorageException.html"><abbr title="\FortAwesome\ConflictDetectionStorageException">ConflictDetectionStorageException</abbr></a></dt><dd>Thrown when there&#039;s a failure to store conflict detection data as a transient.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-ClientPreferencesSchemaException.html"><abbr title="\FortAwesome\ClientPreferencesSchemaException">ClientPreferencesSchemaException</abbr></a></dt><dd>Indicates that an incorrect array schema has been provided by a registerd client.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-UpgradeException.html"><abbr title="\FortAwesome\UpgradeException">UpgradeException</abbr></a></dt><dd>Indicates a problem during upgrade process.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupException.html"><abbr title="\FortAwesome\SelfhostSetupException">SelfhostSetupException</abbr></a></dt><dd>Thrown on one of several errors conditions when setting up assets for self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SelfhostSetupPermissionsException.html"><abbr title="\FortAwesome\SelfhostSetupPermissionsException">SelfhostSetupPermissionsException</abbr></a></dt><dd>Thrown when permissions are lacking to setup self-hosting.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-SvgStylesheetCheckException.html"><abbr title="\FortAwesome\SvgStylesheetCheckException">SvgStylesheetCheckException</abbr></a></dt><dd>Thrown when the FontAwesome_SVG_Styles_Manager attempts to check for the presence of
the SVG stylesheet via HTTP request, and that request fails.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome-REST-Response.html"><abbr title="\FortAwesome\FontAwesome_REST_Response">FontAwesome_REST_Response</abbr></a></dt><dd>Handles FontAwesome-specific enhancements to a REST response.</dd> <dt class="phpdocumentor-table-of-contents__entry -class"><a href="classes/FortAwesome-FontAwesome.html"><abbr title="\FortAwesome\FontAwesome">FontAwesome</abbr></a></dt><dd>Main plugin class, a Singleton. Exposes all API methods and hooks that may be used by
client code to register with this plugin, to receive notifications about runtime
configuration, or to query the runtime configuration.</dd> </dl>
@ -390,7 +391,7 @@ be used for <code class="prettyprint">$plugin</code> in the
<aside class="phpdocumentor-element-found-in">
<abbr class="phpdocumentor-element-found-in__file" title="includes/class-fontawesome.php"><a href="files/includes-class-fontawesome.html"><abbr title="includes/class-fontawesome.php">class-fontawesome.php</abbr></a></abbr>
:
<span class="phpdocumentor-element-found-in__line">3144</span>
<span class="phpdocumentor-element-found-in__line">3212</span>
</aside>

View File

@ -108,12 +108,12 @@
<th class="phpdocumentor-heading">Reason</th>
</tr>
<tr>
<td class="phpdocumentor-cell">819</td>
<td class="phpdocumentor-cell">838</td>
<td class="phpdocumentor-cell"><a href="classes/FortAwesome-FontAwesome.html#method_latest_version"><abbr title="\FortAwesome\FontAwesome::latest_version()">FontAwesome::latest_version()</abbr></a></td>
<td class="phpdocumentor-cell"></td>
</tr>
<tr>
<td class="phpdocumentor-cell">1557</td>
<td class="phpdocumentor-cell">1605</td>
<td class="phpdocumentor-cell"><a href="classes/FortAwesome-FontAwesome.html#method_v4_compatibility"><abbr title="\FortAwesome\FontAwesome::v4_compatibility()">FontAwesome::v4_compatibility()</abbr></a></td>
<td class="phpdocumentor-cell"></td>
</tr>

View File

@ -209,14 +209,14 @@ if ( ! class_exists( 'FortAwesome\FontAwesome_Loader' ) ) :
add_action(
'admin_notices',
function() use ( $e ) {
self::emit_admin_error_output( $e );
self::emit_admin_error_output( $e, 'error' );
}
);
} catch ( Error $e ) {
add_action(
'admin_notices',
function() use ( $e ) {
self::emit_admin_error_output( $e );
self::emit_admin_error_output( $e, 'error' );
}
);
}
@ -249,10 +249,10 @@ if ( ! class_exists( 'FortAwesome\FontAwesome_Loader' ) ) :
require_once self::$loaded['path'] . 'includes/class-fontawesome-activator.php';
FontAwesome_Activator::activate();
} catch ( Exception $e ) {
self::emit_admin_error_output( $e, $activation_failed_message );
self::emit_admin_error_output( $e, 'error', $activation_failed_message );
exit;
} catch ( Error $e ) {
self::emit_admin_error_output( $e, $activation_failed_message );
self::emit_admin_error_output( $e, 'error', $activation_failed_message );
exit;
}
}
@ -263,28 +263,41 @@ if ( ! class_exists( 'FortAwesome\FontAwesome_Loader' ) ) :
* @internal
* @ignore
*/
public static function emit_admin_error_output( $e, $context_message = '' ) {
public static function emit_admin_error_output( $e, $level, $context_message = '' ) {
$message_level_class = $level === 'warning' ? 'notice notice-warning is-dismissible' : 'notice notice-error is-dismissible';
$header_messsage_error = esc_html__( 'The Font Awesome plugin caught a fatal error', 'font-awesome' );
$header_messsage_warning = esc_html__( 'The Font Awesome plugin has a warning', 'font-awesome' );
$header_message = $level === 'warning' ? $header_messsage_warning : $header_messsage_error;
if ( is_admin() && current_user_can( 'manage_options' ) ) {
echo '<div class="error">';
echo '<p>' . esc_html__( 'The Font Awesome plugin caught a fatal error', 'font-awesome' );
echo '<div class="' . esc_html( $message_level_class ) . '">';
echo '<p>' . $header_message;
if ( is_string( $context_message ) && '' !== $context_message ) {
echo ': ' . esc_html( $context_message );
} else {
echo '.';
}
echo '</p><p>';
echo '</p>';
if ( ! is_a( $e, 'Exception' ) && ! is_a( $e, 'Error' ) ) {
echo '<p>';
esc_html_e( 'No error message available.', 'font-awesome' );
echo '</p>';
} else {
self::emit_error_output_to_console( $e );
if ( boolval( $e->getMessage() ) ) {
echo esc_html( $e->getMessage() );
$lines = explode("\n", $e->getMessage());
foreach ($lines as $line) {
echo '<p>';
echo esc_html( $line );
echo '</p>';
}
}
}
echo '</p></div>';
echo '</div>';
}
}
@ -408,10 +421,10 @@ if ( ! class_exists( 'FortAwesome\FontAwesome_Loader' ) ) :
require_once self::$loaded['path'] . 'includes/class-fontawesome-activator.php';
FontAwesome_Activator::initialize();
} catch ( Exception $e ) {
self::emit_admin_error_output( $e, $initialization_failed_msg );
self::emit_admin_error_output( $e, 'error', $initialization_failed_msg );
exit;
} catch ( Error $e ) {
self::emit_admin_error_output( $e, $initialization_failed_msg );
self::emit_admin_error_output( $e, 'error', $initialization_failed_msg );
exit;
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-components', 'wp-i18n'), 'version' => '1b9b95af64627db306eb');
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-i18n'), 'version' => '9291d79bfa031a0e70d7');

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "wordpress-icon-chooser",
"version": "5.0.0",
"version": "5.1.0",
"description": "Choose a Font Awesome icon in WordPress",
"author": "Font Awesome",
"license": "GPL-2.0-or-later",
@ -16,7 +16,7 @@
"env": "wp-env"
},
"dependencies": {
"@fortawesome/fa-icon-chooser-react": "^0.8.0",
"@fortawesome/fa-icon-chooser-react": "^0.9.1",
"blueimp-md5": "^2.19.0"
},
"devDependencies": {

View File

@ -10,7 +10,7 @@ const createInterpolateElement = get(window, [
]);
export default function (params) {
const { kitToken, version, pro, handleQuery, getUrlText, settingsPageUrl } =
const { kitToken, version, pro, handleQuery, getUrlText, settingsPageUrl, assetsBaseUrlOverride } =
params;
return (props) => {
@ -64,6 +64,7 @@ export default function (params) {
"Find icons by name, category, or keyword",
"font-awesome",
)}
_assetsBaseUrl={assetsBaseUrlOverride}
>
<span slot="fatal-error-heading">
{__("Well, this is awkward...", "font-awesome")}

View File

@ -3,9 +3,11 @@ import axios from 'axios'
const ERROR_MSG = 'Font Awesome plugin unexpected response for Icon Chooser'
const getUrlText = (url) => {
return axios.get(url)
return axios.get(url, {
responseType: 'text'
})
.then(response => {
if(response.status >= 200 || response.satus <= 299) {
if(response.status >= 200 || response.status <= 299) {
return response.data
} else {
console.error(response)

View File

@ -13,6 +13,7 @@ const initialData = window[GLOBAL_KEY];
const kitToken = get(initialData, "options.kitToken");
const version = get(initialData, "options.version");
const pro = get(initialData, "options.usePro");
const assetsBaseUrlOverride = get(initialData, "assetsBaseUrlOverride");
const params = {
...initialData,
@ -20,6 +21,7 @@ const params = {
version,
getUrlText,
pro,
assetsBaseUrlOverride
};
params.handleQuery = prepareQueryHandler(params);

View File

@ -5,6 +5,7 @@ require_once trailingslashit( __DIR__ ) . '../defines.php';
require_once trailingslashit( __DIR__ ) . 'class-fontawesome.php';
require_once trailingslashit( __DIR__ ) . 'class-fontawesome-release-provider.php';
require_once trailingslashit( __DIR__ ) . 'class-fontawesome-svg-styles-manager.php';
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/error-util.php';
/**
* Plugin activation logic.
@ -24,7 +25,21 @@ class FontAwesome_Activator {
* @throws ReleaseProviderStorageException
*/
public static function activate() {
self::initialize();
try {
self::initialize();
} catch ( \Exception $e ) {
wp_die(
esc_html( $e->getMessage() ),
esc_html( __( 'Font Awesome Activation Error', 'font-awesome' ) ),
array( 'back_link' => true )
);
} catch ( \Error $e ) {
wp_die(
esc_html( $e->getMessage() ),
esc_html( __( 'Font Awesome Activation Error', 'font-awesome' ) ),
array( 'back_link' => true )
);
}
}
/**
@ -84,7 +99,9 @@ class FontAwesome_Activator {
self::initialize_conflict_detection_options();
}
self::initialize_svg_styles();
if ( fa()->is_block_editor_support_enabled() ) {
self::initialize_svg_styles();
}
}
/**
@ -112,7 +129,7 @@ class FontAwesome_Activator {
* @internal
*/
private static function initialize_user_options() {
$version = fa()->latest_version_6();
$version = fa()->latest_version_7();
$options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => $version ) );
update_option( FontAwesome::OPTIONS_KEY, $options );
}
@ -140,6 +157,6 @@ class FontAwesome_Activator {
* @throws ConfigCorruptionException
*/
private static function initialize_svg_styles() {
FontAwesome_SVG_Styles_Manager::instance()->fetch_svg_styles( fa(), fa_release_provider() );
FontAwesome_SVG_Styles_Manager::ensure_svg_styles_with_admin_notice_warning( fa(), fa_release_provider() );
}
}

View File

@ -135,7 +135,15 @@ class FontAwesome_Config_Controller extends WP_REST_Controller {
$db_item
);
FontAwesome_SVG_Styles_Manager::instance()->fetch_svg_styles( fa(), $this->release_provider() );
/**
* The admin notices will not be shown as a consequence of any failure in this
* function call, since this is a REST controller.
* However, this will allow us attempt the fetch, without it causing a fatal error
* if it fails.
*/
if ( fa()->is_block_editor_support_enabled() ) {
FontAwesome_SVG_Styles_Manager::ensure_svg_styles_with_admin_notice_warning( fa(), $this->release_provider() );
}
$return_data = $this->build_item( fa() );
return new FontAwesome_REST_Response( $return_data, 200 );
@ -234,7 +242,7 @@ class FontAwesome_Config_Controller extends WP_REST_Controller {
*/
if ( isset( $given_options['kitToken'] ) && is_string( $given_options['kitToken'] ) && $version_is_symbolic_latest ) {
$item['version'] = 'latest';
} elseif ( $version_is_concrete || '5.x' === $given_options['version'] || '6.x' === $given_options['version'] ) {
} elseif ( $version_is_concrete || '5.x' === $given_options['version'] || '6.x' === $given_options['version'] || '7.x' === $given_options['version'] ) {
$item['version'] = $given_options['version'];
} else {
throw ConfigSchemaException::concrete_version_expected();

View File

@ -626,3 +626,18 @@ class UpgradeException extends FontAwesome_ServerException {
* @since 5.0.0
*/
class SelfhostSetupException extends FontAwesome_ServerException {}
/**
* Thrown when permissions are lacking to setup self-hosting.
*
* @since 5.0.2
*/
class SelfhostSetupPermissionsException extends FontAwesome_ServerException {}
/**
* Thrown when the FontAwesome_SVG_Styles_Manager attempts to check for the presence of
* the SVG stylesheet via HTTP request, and that request fails.
*
* @since 5.0.2
*/
class SvgStylesheetCheckException extends FontAwesome_ServerException {}

View File

@ -6,7 +6,7 @@ namespace FortAwesome;
*/
class FontAwesome_Preference_Conflict_Detector {
protected static function resolve_version( $configured_option, $current_preference, $latest_version_5, $latest_version_6 ) {
protected static function resolve_version( $configured_option, $current_preference, $latest_version_5, $latest_version_6, $latest_version_7 ) {
/**
* If the version given as configured_option is 'latest', '5.x', or '6.x', as it may be for
* a kit, then we'll resolve that symbolic version into whatever is the corresponding semantic version.
@ -17,6 +17,7 @@ class FontAwesome_Preference_Conflict_Detector {
'latest' => $latest_version_5,
'5.x' => $latest_version_5,
'6.x' => $latest_version_6,
'7.x' => $latest_version_7,
);
$resolved_version = ( is_string( $configured_option ) && isset( $symbolic_versions[ $configured_option ] ) )
@ -45,10 +46,10 @@ class FontAwesome_Preference_Conflict_Detector {
* @ignore
* @since 4.0.0
*/
public static function detect( $configured_options = array(), $client_preferences = array(), $latest_version_5 = null, $latest_version_6 = null ) {
public static function detect( $configured_options = array(), $client_preferences = array(), $latest_version_5 = null, $latest_version_6 = null, $latest_version_7 = null ) {
return array_reduce(
array_keys( $configured_options ),
function ( $carry, $option ) use ( $configured_options, $client_preferences, $latest_version_5, $latest_version_6 ) {
function ( $carry, $option ) use ( $configured_options, $client_preferences, $latest_version_5, $latest_version_6, $latest_version_7 ) {
$resolve_method_candidate = 'resolve_' . $option;
if ( isset( $client_preferences[ $option ] ) ) {
if ( method_exists( __CLASS__, $resolve_method_candidate ) ) {
@ -57,7 +58,8 @@ class FontAwesome_Preference_Conflict_Detector {
$configured_options[ $option ],
$client_preferences[ $option ],
$latest_version_5,
$latest_version_6
$latest_version_6,
$latest_version_7
) ? $carry : array_merge( $carry, array( $option ) );
} else {
return $configured_options[ $option ] === $client_preferences[ $option ]

View File

@ -92,6 +92,12 @@ class FontAwesome_Release_Provider {
*/
protected $latest_version_6 = null;
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/**
* @ignore
*/
protected $latest_version_7 = null;
// phpcs:ignore Generic.Commenting.DocComment.MissingShort
/**
* @ignore
@ -160,6 +166,10 @@ class FontAwesome_Release_Provider {
$this->latest_version_6 = isset( $option_value['data']['latest_version_6'] )
? $option_value['data']['latest_version_6']
: null;
$this->latest_version_7 = isset( $option_value['data']['latest_version_7'] )
? $option_value['data']['latest_version_7']
: null;
} else {
throw new ReleaseMetadataMissingException();
}
@ -186,6 +196,9 @@ query {
latest_version_6: release(version: "6.x") {
version
}
latest_version_7: release(version: "7.x") {
version
}
releases {
version
srisByLicense {
@ -224,6 +237,7 @@ EOD;
$refreshed_at = time();
$latest_version_5 = isset( $body['data']['latest_version_5']['version'] ) ? $body['data']['latest_version_5']['version'] : null;
$latest_version_6 = isset( $body['data']['latest_version_6']['version'] ) ? $body['data']['latest_version_6']['version'] : null;
$latest_version_7 = isset( $body['data']['latest_version_7']['version'] ) ? $body['data']['latest_version_7']['version'] : null;
if ( is_null( $latest_version_5 ) ) {
$e = ApiResponseException::with_wp_error( new WP_Error( 'missing_latest_version_5' ) );
@ -235,11 +249,17 @@ EOD;
throw $e;
}
if ( is_null( $latest_version_7 ) ) {
$e = ApiResponseException::with_wp_error( new WP_Error( 'missing_latest_version_7' ) );
throw $e;
}
$option_value = array(
'refreshed_at' => $refreshed_at,
'data' => array(
'latest_version_5' => $latest_version_5,
'latest_version_6' => $latest_version_6,
'latest_version_7' => $latest_version_7,
'releases' => $releases,
),
);
@ -255,21 +275,32 @@ EOD;
* @return FontAwesome_Resource
*/
private function build_resource( $version, $file_basename, $flags = array(
'use_svg' => false,
'use_pro' => false,
'use_svg' => false,
'use_pro' => false,
'cdn_url_template' => null,
) ) {
$full_url = 'https://';
$full_url .= boolval( $flags['use_pro'] ) ? 'pro.' : 'use.';
$full_url .= 'fontawesome.com/releases/v' . $version . '/';
$version = ( isset( $args['version'] ) && ! empty( $args['version'] ) ) ? $args['version'] : $version;
$use_svg = isset( $flags['use_svg'] ) && $flags['use_svg'];
$use_pro = isset( $flags['use_pro'] ) && $flags['use_pro'];
// use the style to build the relative url lookup the relative url.
$relative_url = $flags['use_svg'] ? 'js/' : 'css/';
$relative_url = $use_svg ? 'js/' : 'css/';
$relative_url .= $file_basename . '.';
$relative_url .= $flags['use_svg'] ? 'js' : 'css';
$relative_url .= $use_svg ? 'js' : 'css';
$full_url .= $relative_url;
$full_url = '';
$license = $flags['use_pro'] ? 'pro' : 'free';
if ( isset( $flags['cdn_url_template'] ) && is_string( $flags['cdn_url_template'] ) ) {
$base_url = preg_replace( '/\{\{\s*version\s*\}\}/', $version, $flags['cdn_url_template'] );
$full_url = preg_replace( '/\{\{\s*relative_url\s*\}\}/', $relative_url, $base_url );
} else {
$base_url = 'https://';
$base_url .= $use_pro ? 'pro.' : 'use.';
$base_url .= 'fontawesome.com/releases/v' . $version . '/';
$full_url = $base_url . $relative_url;
}
$license = $use_pro ? 'pro' : 'free';
// if we can't resolve an integrity_key in this deeply nested lookup, it will remain null.
$integrity_key = null;
@ -456,6 +487,10 @@ EOD;
return $this->latest_version_5;
}
public function latest_version_7() {
return $this->latest_version_7;
}
/**
* Returns a version number corresponding to the most recent minor release
* in the 6.x line.
@ -517,7 +552,23 @@ EOD;
* @return FontAwesome_Resource
*/
public function get_svg_styles_resource( $version ) {
return $this->build_resource( $version, 'svg-with-js' );
$file_basename = ( is_string( $version ) && strlen( $version ) > 0 && '7' === $version[0] )
? 'svg'
: 'svg-with-js';
$cdn_url_template = null;
if ( 'development' === getenv( 'FONTAWESOME_ENV' ) && is_string( getenv( 'FONTAWESOME_CDN_URL_TEMPLATE' ) ) ) {
$cdn_url_template = getenv( 'FONTAWESOME_CDN_URL_TEMPLATE' );
}
return $this->build_resource(
$version,
$file_basename,
array(
'cdn_url_template' => $cdn_url_template,
)
);
}
/**

View File

@ -1,7 +1,15 @@
<?php
namespace FortAwesome;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
require_once trailingslashit( FONTAWESOME_DIR_PATH ) . 'includes/error-util.php';
use Exception;
use Error;
/**
* Class FontAwesome_SVG_Styles_Manager
*/
@ -15,28 +23,13 @@ class FontAwesome_SVG_Styles_Manager {
public const RESOURCE_HANDLE_SVG_STYLES = 'font-awesome-svg-styles';
/**
* @internal
* @ignore
* The handle used when enqueuing default SVG support styles. This is a stylesheet
* that's bundled with the plugin, and will be loaded when a version-specific stylesheet
* cannot be loaded for some reason.
*
* @since 5.0.2
*/
protected static $instance = null;
/**
* Returns the singleton instance of this class.
*
* Internal use only, not part of this plugin's public API.
*
* Ideally, this wouldn't be a singleton, but being a singleton will
* make it mockable with PHPUnit.
*
* @internal
* @ignore
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
public const RESOURCE_HANDLE_SVG_STYLES_DEFAULT = 'font-awesome-svg-styles-default';
/**
* Internal use only, not part of this plugin's public API.
@ -58,7 +51,7 @@ class FontAwesome_SVG_Styles_Manager {
* @internal
* @ignore
*/
public function selfhost_asset_path( $version ) {
public static function selfhost_asset_path( $version ) {
$upload_dir = wp_upload_dir( null, true, false );
if ( isset( $upload_dir['error'] ) && false !== $upload_dir['error'] ) {
@ -71,8 +64,8 @@ class FontAwesome_SVG_Styles_Manager {
}
return array(
'dir' => trailingslashit( $upload_dir['basedir'] ) . $this->selfhost_asset_subdir( $version ),
'file' => $this->selfhost_asset_filename(),
'dir' => trailingslashit( $upload_dir['basedir'] ) . self::selfhost_asset_subdir( $version ),
'file' => self::selfhost_asset_filename( $version ),
);
}
@ -85,7 +78,7 @@ class FontAwesome_SVG_Styles_Manager {
* @internal
* @ignore
*/
public function selfhost_asset_url( $version ) {
public static function selfhost_asset_url( $version ) {
$upload_dir = wp_upload_dir( null, false, false );
if ( isset( $upload_dir['error'] ) && false !== $upload_dir['error'] ) {
@ -97,7 +90,7 @@ class FontAwesome_SVG_Styles_Manager {
);
}
return trailingslashit( $upload_dir['baseurl'] ) . $this->selfhost_asset_subpath( $version );
return trailingslashit( $upload_dir['baseurl'] ) . self::selfhost_asset_subpath( $version );
}
/**
@ -106,7 +99,7 @@ class FontAwesome_SVG_Styles_Manager {
* @ignore
* @internal
*/
public function selfhost_asset_subdir( $version ) {
public static function selfhost_asset_subdir( $version ) {
return "font-awesome/v$version/css";
}
@ -116,8 +109,10 @@ class FontAwesome_SVG_Styles_Manager {
* @ignore
* @internal
*/
public function selfhost_asset_filename() {
return 'svg-with-js.css';
public static function selfhost_asset_filename( $version ) {
return ( is_string( $version ) && strlen( $version ) > 0 && '7' === $version[0] )
? 'svg.css'
: 'svg-with-js.css';
}
/**
@ -126,8 +121,8 @@ class FontAwesome_SVG_Styles_Manager {
* @ignore
* @internal
*/
public function selfhost_asset_subpath( $version ) {
return trailingslashit( $this->selfhost_asset_subdir( $version ) ) . $this->selfhost_asset_filename();
public static function selfhost_asset_subpath( $version ) {
return trailingslashit( self::selfhost_asset_subdir( $version ) ) . self::selfhost_asset_filename( $version );
}
/**
@ -138,14 +133,40 @@ class FontAwesome_SVG_Styles_Manager {
* @internal
* @ignore
*/
public function register_svg_styles( $fa ) {
public static function register_svg_styles( $fa ) {
$concrete_version = $fa->concrete_version( $fa->options() );
$source = self::selfhost_asset_url( $concrete_version );
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
wp_register_style(
self::RESOURCE_HANDLE_SVG_STYLES_DEFAULT,
false
);
/**
* This is a minimal default style for SVGs, which will always be overriden when the
* real stylesheet is loaded successfully. It's only here as a fallback to ensure that,
* in the event that the real stylesheet fails to load, the SVG icons are sized
* correctly, and aren't HUGE.
*/
$default_svg_style = <<< EOT
.svg-inline--fa {
display: inline-block;
height: 1em;
overflow: visible;
vertical-align: -.125em;
}
EOT;
wp_add_inline_style(
self::RESOURCE_HANDLE_SVG_STYLES_DEFAULT,
$default_svg_style
);
wp_register_style(
self::RESOURCE_HANDLE_SVG_STYLES,
$source,
array(),
array( self::RESOURCE_HANDLE_SVG_STYLES_DEFAULT ),
// phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
null,
'all'
@ -168,7 +189,7 @@ class FontAwesome_SVG_Styles_Manager {
* @ignore
* @return string
*/
public function selfhost_asset_full_path( $fa ) {
public static function selfhost_asset_full_path( $fa ) {
$options = $fa->options();
$concrete_version = $fa->concrete_version( $options );
@ -181,7 +202,7 @@ class FontAwesome_SVG_Styles_Manager {
);
}
$asset_path = $this->selfhost_asset_path( $concrete_version );
$asset_path = self::selfhost_asset_path( $concrete_version );
if ( ! $asset_path || ! isset( $asset_path['dir'] ) || ! isset( $asset_path['file'] ) ) {
throw new SelfhostSetupException(
@ -210,9 +231,9 @@ class FontAwesome_SVG_Styles_Manager {
* @ignore
* @return bool
*/
public function is_svg_stylesheet_present( $fa ) {
public static function is_svg_stylesheet_path_present( $fa ) {
if ( ! current_user_can( 'manage_options' ) ) {
throw new SelfhostSetupException(
throw new SelfhostSetupPermissionsException(
esc_html__(
'Current user lacks permissions required to fetch Font Awesome SVG stylesheets for self-hosting. Try logging in as an admin user.',
'font-awesome'
@ -220,14 +241,14 @@ class FontAwesome_SVG_Styles_Manager {
);
}
$asset_full_path = $this->selfhost_asset_full_path( $fa );
$asset_full_path = self::selfhost_asset_full_path( $fa );
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
if ( ! WP_Filesystem( false ) ) {
throw new SelfhostSetupException(
throw new SelfhostSetupPermissionsException(
esc_html__(
'Failed to initialize filesystem usage for creating self-hosted assets. Please report this on the plugin support forum so it can be investigated.',
'font-awesome'
@ -240,6 +261,136 @@ class FontAwesome_SVG_Styles_Manager {
return $wp_filesystem->exists( $asset_full_path );
}
/**
* Internal use only, not part of the plugin's public API.
*
* This checks whether the SVG support stylesheet is present by making a HEAD
* request on this WordPress server. This can be used when the current process
* lacks filesystem permissions for checking the exists of the file on disk.
*
* @param $version a concrete Font Awesome version
* @throws SelfhostSetupException
* @throws SvgStylesheetCheckException
* @throws ConfigCorruptionException when called with an invalid configuration
* @internal
* @ignore
* @return bool
*/
public static function is_svg_stylesheet_url_present( $version ) {
$stylesheet_url = self::selfhost_asset_url( $version );
$response = wp_remote_head( $stylesheet_url );
if ( is_wp_error( $response ) ) {
// phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped
throw SvgStylesheetCheckException::with_wp_error( $response );
}
$response_code = wp_remote_retrieve_response_code( $response );
return is_int( $response_code ) && $response_code >= 200 && $response_code < 300;
}
/**
* Internal use only, not part of the plugin's public API.
*
* This checks whether the SVG support stylesheet is present.
*
* @param $fa FontAwesome
* @throws SelfhostSetupException
* @throws ConfigCorruptionException when called with an invalid configuration
* @internal
* @ignore
* @return bool
*/
public static function is_svg_stylesheet_present( $fa ) {
try {
// First, try using the filesystem.
return self::is_svg_stylesheet_path_present( $fa );
} catch ( SelfhostSetupPermissionsException $_e ) {
// Fallback to checking the URL via HTTP.
$version = $fa->concrete_version( $fa->options() );
return self::is_svg_stylesheet_url_present( $version );
}
}
/**
* Internal use only, not part of this plugin's public API.
*
* Fetches SVG support style asset(s) for self-hosting, and
* and emits an admin notice warning when there's a problem.
*
* @param $fa FontAwesome
* @param $fa_release_provider FontAwesome_Release_Provider
* @return void
*/
public static function ensure_svg_styles_with_admin_notice_warning( $fa, $fa_release_provider ) {
try {
self::fetch_svg_styles( $fa, $fa_release_provider );
} catch ( SelfhostSetupPermissionsException $_e ) {
$message_main = __(
'We couldn\'t save the stylesheet required to render SVG icons added in the Block Editor. We don\'t have permission to save files on your WordPress site. Make an exception to allow it, or place the stylesheet manually.',
'font-awesome'
);
$message_part2 = __(
'Due to another issue, we couldn\'t determine the URL where you need to make the stylesheet available.',
'font-awesome'
);
$message_part3 = __(
'Due to another issue, we couldn\'t find a link to the stylesheet\'s contents for you to manually place.',
'font-awesome'
);
try {
$concrete_version = $fa->concrete_version( $fa->options() );
$url = self::selfhost_asset_url( $concrete_version );
$message_part2 = sprintf(
/* translators: 1: newline, 2: self-hosted stylesheet URL, */
__(
'Here\'s the URL on your WordPress server where you need to make the stylesheet available:%1$s%2$s',
'font-awesome'
),
"\n",
$url
);
$resource = $fa_release_provider->get_svg_styles_resource( $concrete_version );
if ( $resource->source() ) {
$message_part3 = sprintf(
/* translators: 1: newline, 2: Font Awesome CDN stylesheet URL */
__(
'Here\'s a link to the stylesheet whose contents should be copied to that location on your WordPress site:%1$s%2$s',
'font-awesome'
),
"\n",
$resource->source()
);
}
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
} catch ( Exception $_e ) {
// Silently ignore to use the default notification message.
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
} catch ( Error $_e ) {
// Silently ignore to use the default notification message.
}
$full_message = $message_main . "\n" . $message_part2 . "\n" . $message_part3;
$escaped_message = esc_html( $full_message );
$e = new SelfhostSetupPermissionsException( $escaped_message );
notify_admin_warning( $e );
} catch ( Exception $e ) {
notify_admin_warning( $e );
} catch ( Error $e ) {
notify_admin_warning( $e );
}
}
/**
* Internal use only, not part of this plugin's public API.
*
@ -252,12 +403,18 @@ class FontAwesome_SVG_Styles_Manager {
* @throws ApiResponseException
* @throws ReleaseProviderStorageException
* @throws SelfhostSetupException
* @throws SelfhostSetupPermissionsException
* @throws ConfigCorruptionException when called with an invalid configuration
* @return void
*/
public function fetch_svg_styles( $fa, $fa_release_provider ) {
public static function fetch_svg_styles( $fa, $fa_release_provider ) {
if ( self::is_svg_stylesheet_present( $fa ) ) {
// Nothing more to do.
return;
}
if ( ! current_user_can( 'manage_options' ) ) {
throw new SelfhostSetupException(
throw new SelfhostSetupPermissionsException(
esc_html__(
'Current user lacks permissions required to fetch Font Awesome SVG stylesheets for self-hosting. Try logging in as an admin user.',
'font-awesome'
@ -265,14 +422,9 @@ class FontAwesome_SVG_Styles_Manager {
);
}
if ( $this->is_svg_stylesheet_present( $fa ) ) {
// Nothing more to do.
return;
}
$concrete_version = $fa->concrete_version( $fa->options() );
$asset_path = $this->selfhost_asset_path( $concrete_version );
$asset_path = self::selfhost_asset_path( $concrete_version );
if ( ! $asset_path || ! isset( $asset_path['dir'] ) || ! isset( $asset_path['file'] ) ) {
throw new SelfhostSetupException(
@ -290,7 +442,7 @@ class FontAwesome_SVG_Styles_Manager {
}
if ( ! WP_Filesystem( false ) ) {
throw new SelfhostSetupException(
throw new SelfhostSetupPermissionsException(
esc_html__(
'Failed to initialize filesystem usage for creating self-hosted assets. Please report this on the plugin support forum so it can be investigated.',
'font-awesome'
@ -313,13 +465,23 @@ class FontAwesome_SVG_Styles_Manager {
$response = wp_remote_get( $resource->source() );
$code = null;
$is_error = false;
if ( isset( $response['response']['code'] ) ) {
$code = $response['response']['code'];
if ( is_wp_error( $response ) ) {
$is_error = true;
} else {
$code = null;
if ( isset( $response['response']['code'] ) ) {
$code = $response['response']['code'];
}
if ( ! $code || $code >= 400 | ! isset( $response['body'] ) ) {
$is_error = true;
}
}
if ( is_wp_error( $response ) || ! $code || $code >= 400 | ! isset( $response['body'] ) ) {
if ( $is_error ) {
throw new SelfhostSetupException(
esc_html__(
'Failed retrieving an asset for self-hosting. Try again.',
@ -372,7 +534,7 @@ class FontAwesome_SVG_Styles_Manager {
if ( "$algo-$hash" !== $resource->integrity_key() ) {
throw new SelfhostSetupException(
esc_html__(
'Asset integrity key does not match for self-hosted asset. Try removing your font_awesome_svg_styles_loading filter.',
'Asset integrity key does not match for self-hosted asset.',
'font-awesome'
)
);

View File

@ -136,7 +136,7 @@ class FontAwesome {
*
* @since 4.0.0
*/
public const PLUGIN_VERSION = '5.0.1';
public const PLUGIN_VERSION = '5.1.0';
/**
* The namespace for this plugin's REST API.
*
@ -327,6 +327,17 @@ class FontAwesome {
*/
protected $old_remove_unregistered_clients = false;
/**
* If true, features required for Block Editor support will be disabled.
*
* Internal use only, not part of this plugin's public API.
*
* @deprecated
* @internal
* @ignore
*/
protected $disable_block_editor_support = false;
/**
* Returns the singleton instance of the FontAwesome plugin.
*
@ -349,7 +360,13 @@ class FontAwesome {
* @ignore
*/
private function __construct() {
/* noop */
/**
* Determines whether to disable features required for supporting the Block Editor.
*
* @return bool if `true`, disable Block Editor support
* @since 5.0.2
*/
$this->disable_block_editor_support = apply_filters( 'font_awesome_disable_block_editor_support', false );
}
/**
@ -391,9 +408,18 @@ class FontAwesome {
array( $this, 'process_shortcode' )
);
FontAwesome_SVG_Styles_Manager::instance()->register_svg_styles( $this );
if ( $this->is_block_editor_support_enabled() ) {
FontAwesome_SVG_Styles_Manager::register_svg_styles( $this );
block_init();
block_init();
add_action(
'enqueue_block_assets',
function () {
wp_enqueue_style( FontAwesome_SVG_Styles_Manager::RESOURCE_HANDLE_SVG_STYLES );
}
);
}
try {
$this->gather_preferences();
@ -414,13 +440,6 @@ class FontAwesome {
wp_set_script_translations( self::ADMIN_RESOURCE_HANDLE, 'font-awesome' );
}
add_action(
'enqueue_block_assets',
function () {
wp_enqueue_style( FontAwesome_SVG_Styles_Manager::RESOURCE_HANDLE_SVG_STYLES );
}
);
if ( $this->using_kit() ) {
if ( $this->skip_enqueue_kit() ) {
// Normally, conflict detection is built into a kit.
@ -846,6 +865,19 @@ class FontAwesome {
return $this->release_provider()->latest_version_6();
}
/**
* Returns the latest available version of Font Awesome 7 as a string,
* or null if the releases metadata has not yet been successfully retrieved from the
* API server.
*
* @since 5.1.0
*
* @return null|string
*/
public function latest_version_7() {
return $this->release_provider()->latest_version_7();
}
/**
* Queries the Font Awesome API to load releases metadata. Results are stored
* in the wp database.
@ -1037,15 +1069,31 @@ class FontAwesome {
3
);
try {
$svg_styles_manager = FontAwesome_SVG_Styles_Manager::instance();
if ( ! $svg_styles_manager->is_svg_stylesheet_present( $this ) ) {
$svg_styles_manager->fetch_svg_styles( $this, $this->release_provider() );
add_action(
'admin_enqueue_scripts',
function ( $hook ) {
try {
if ( $hook === $this->screen_id ) {
$this->maybe_refresh_releases();
}
} catch ( Exception $e ) {
notify_admin_warning( $e );
} catch ( Error $e ) {
notify_admin_warning( $e );
}
}
);
if ( $this->is_block_editor_support_enabled() ) {
try {
if ( ! FontAwesome_SVG_Styles_Manager::is_svg_stylesheet_present( $this ) ) {
FontAwesome_SVG_Styles_Manager::ensure_svg_styles_with_admin_notice_warning( $this, $this->release_provider() );
}
} catch ( Exception $e ) {
notify_admin_warning( $e );
} catch ( Error $e ) {
notify_admin_warning( $e );
}
} catch ( Exception $e ) {
notify_admin_fatal_error( $e );
} catch ( Error $e ) {
notify_admin_fatal_error( $e );
}
}
@ -1380,7 +1428,8 @@ class FontAwesome {
$options_for_comparison,
$client_preferences,
$this->latest_version_5(),
$this->latest_version_6()
$this->latest_version_6(),
$this->latest_version_7()
);
if ( count( $current_conflicts ) > 0 ) {
$conflicts[ $client_name ] = $current_conflicts;
@ -1641,6 +1690,7 @@ class FontAwesome {
self::ADMIN_RESOURCE_HANDLE,
self::RESOURCE_HANDLE_ICON_CHOOSER,
'wp-tinymce',
'jquery',
),
self::PLUGIN_VERSION,
true
@ -1652,8 +1702,6 @@ class FontAwesome {
}
if ( $hook === $this->screen_id ) {
$this->maybe_refresh_releases();
wp_localize_script(
self::ADMIN_RESOURCE_HANDLE,
self::ADMIN_RESOURCE_LOCALIZATION_NAME,
@ -1667,6 +1715,7 @@ class FontAwesome {
'available' => $this->release_provider()->versions(),
'latest_version_5' => $this->latest_version_5(),
'latest_version_6' => $this->latest_version_6(),
'latest_version_7' => $this->latest_version_7(),
),
'pluginVersion' => FontAwesome::PLUGIN_VERSION,
'preferenceConflicts' => $this->conflicts_by_option(),
@ -1709,14 +1758,17 @@ class FontAwesome {
'media_buttons',
function ( $editor_id ) {
printf(
/* translators: 1: open button tag, 2: editor id, 3: remaining button tag open and icon svg tag, 4: close button tag */
/* translators: 1: open button tag, 2: editor id value, 3: data attribute for editor id, 4: editor id value, 5: closing data attribute value quote, 6: remaining button tag open and icon svg tag, 7: close button tag */
esc_html__(
'%1$s%2$s%3$sAdd Font Awesome%4$s',
'%1$s%2$s%3$s%4$s%5$s%6$sAdd Font Awesome%7$s',
'font-awesome'
),
'<button type="button" id="fawp-tinymce-',
esc_html( $editor_id ),
'" class="button font-awesome-icon-chooser-media-button"><svg xmlns="http://www.w3.org/2000/svg" style="height: 1em; box-sizing: content-box; display: inline-block; vertical-align: -.125em;" viewBox="0 0 512 512"><path fill="currentColor" d="M91.7 96C106.3 86.8 116 70.5 116 52C116 23.3 92.7 0 64 0S12 23.3 12 52c0 16.7 7.8 31.5 20 41l0 3 0 352 0 64 64 0 0-64 373.6 0c14.6 0 26.4-11.8 26.4-26.4c0-3.7-.8-7.3-2.3-10.7L432 272l61.7-138.9c1.5-3.4 2.3-7 2.3-10.7c0-14.6-11.8-26.4-26.4-26.4L91.7 96z"/></svg> ',
'" data-fa-editor-id="',
esc_html( $editor_id ),
'" ',
'class="button font-awesome-icon-chooser-media-button"><svg xmlns="http://www.w3.org/2000/svg" style="height: 1em; box-sizing: content-box; display: inline-block; vertical-align: -.125em;" viewBox="0 0 512 512"><path fill="currentColor" d="M91.7 96C106.3 86.8 116 70.5 116 52C116 23.3 92.7 0 64 0S12 23.3 12 52c0 16.7 7.8 31.5 20 41l0 3 0 352 0 64 64 0 0-64 373.6 0c14.6 0 26.4-11.8 26.4-26.4c0-3.7-.8-7.3-2.3-10.7L432 272l61.7-138.9c1.5-3.4 2.3-7 2.3-10.7c0-14.6-11.8-26.4-26.4-26.4L91.7 96z"/></svg> ',
'</button>'
);
},
@ -1824,7 +1876,7 @@ class FontAwesome {
*
* See: https://wordpress.org/support/topic/plugin-conflicts-with-rankmath
*/
if ( $enable_icon_chooser && is_gutenberg_page() ) {
if ( $enable_icon_chooser && is_gutenberg_page() && $this->is_block_editor_support_enabled() ) {
$deps = array_merge( $deps, array( 'wp-blocks', 'wp-editor', 'wp-rich-text', 'wp-block-editor' ) );
}
@ -1858,6 +1910,7 @@ class FontAwesome {
'options' => $this->options(),
'webpackPublicPath' => trailingslashit( FONTAWESOME_DIR_URL ) . 'admin/build/',
'disableRichTextIcons' => $this->disable_rich_text_icons(),
'assetsBaseUrlOverride' => FONTAWESOME_ASSETS_BASE_URL_OVERRIDE,
);
}
@ -3072,6 +3125,8 @@ EOT;
$concrete_version = $this->latest_version_5();
} elseif ( '6.x' === $version ) {
$concrete_version = $this->latest_version_6();
} elseif ( '7.x' === $version ) {
$concrete_version = $this->latest_version_7();
} else {
$concrete_version = $version;
}
@ -3128,6 +3183,21 @@ EOT;
return true;
}
/**
* Whether to enable Font Awesome support for the Block Editor.
*
* This can be disabled with the `font_awesome_disable_block_editor_support` filter,
* like this:
*
* `add_filter( 'font_awesome_disable_block_editor_support', '__return_true' );`
*
* @since 5.0.2
* @return bool
*/
public function is_block_editor_support_enabled() {
return ! $this->disable_block_editor_support;
}
}
// phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed

View File

@ -4,6 +4,16 @@ namespace FortAwesome;
use WP_Error, Exception;
require_once __DIR__ . '/../includes/class-fontawesome-command.php';
/**
* Handle fatal errors
*
* @ignore
* @internal
*/
function notify_admin_warning( $e ) {
notify_admin( $e, 'warning' );
}
/**
* Handle fatal errors
*
@ -11,14 +21,26 @@ require_once __DIR__ . '/../includes/class-fontawesome-command.php';
* @internal
*/
function notify_admin_fatal_error( $e ) {
notify_admin( $e, 'error' );
}
/**
* Notify admin of error or warning.
*
* @ignore
* @internal
*/
function notify_admin( $e, $level ) {
$notification_level = 'warning' === $level ? 'warning' : 'error';
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
if ( method_exists( 'FortAwesome\FontAwesome_Loader', 'emit_admin_error_output' ) ) {
$command = new FontAwesome_Command(
function () use ( $e ) {
FontAwesome_Loader::emit_admin_error_output( $e );
function () use ( $e, $notification_level ) {
FontAwesome_Loader::emit_admin_error_output( $e, $notification_level );
}
);

View File

@ -3,7 +3,7 @@
* Plugin Name: Font Awesome
* Plugin URI: https://fontawesome.com/how-to-use/on-the-web/using-with/wordpress
* Description: The official way to use Font Awesome Free or Pro icons on your site, brought to you by the Font Awesome team.
* Version: 5.0.1
* Version: 5.1.0
* Author: Font Awesome
* Author URI: https://fontawesome.com/
* License: GPLv2 (or later)

View File

@ -86,4 +86,9 @@ function theme_alpha_fa_classes() {
return implode( ' ', $class_list );
}
add_filter( 'font_awesome_skip_enqueue_kit', '__return_true' );
// add_filter( 'font_awesome_skip_enqueue_kit', '__return_true' );
// add_filter( 'font_awesome_disable_block_editor_support', '__return_true' );
// add_filter('filesystem_method', function() {
// return 'none';
// });

View File

@ -1,15 +1,15 @@
/*
Theme Name: Theme Alpha
Theme URI: http://example.com/theme-alpha/
Description: Twenty Twenty-Two Child Theme
Description: Twenty Twenty-Five Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentytwentytwo
Template: twentytwentyfive
Version: 0.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-twenty-two-child
Text Domain: twenty-twenty-five-child
*/
.theme-alpha-explanation {

View File

@ -1,9 +1,9 @@
=== Font Awesome ===
Contributors: fontawesome, mlwilkerson, robmadole, frrrances, deathnfudge
Stable tag: 5.0.1
Stable tag: 5.1.0
Tags: FontAwesome, icon, svg icon, iconfont, webfont
Requires at least: 5.8
Tested up to: 6.7
Tested up to: 6.8
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@ -187,6 +187,18 @@ If you're using the Icon Chooser, you'll need to use a Pro Kit. (The CDN can onl
== Changelog ==
= 5.1.0 =
* Minor updates to support Font Awesome 7.
= 5.0.2 =
* Fix a bug in the Classic Editor involving interaction with some other plugins, where the Font Awesome
media button would not be visible.
* Make it an admin warning instead of an error when the plugin can't fetch SVG support stylesheet.
* Add a `font_awesome_disable_block_editor_support` filter to allow disabling the block editor support entirely.
* Changes to enable usage of the self-hosted SVG support stylesheet on systems where file system access is not available.
= 5.0.1 =
* Automatically fetch the SVG stylesheet any time the WP admin dashboard or Font Awesome plugin settings
page is loaded. This stylesheet is required for the new embedded SVG icons to display correctly when they

View File

@ -42,6 +42,6 @@ class Mock_FontAwesome_Metadata_Provider extends TestCase {
FontAwesome_Release_Provider::load_releases();
$this->assertEquals( '5.4.1', fa()->latest_version() );
$this->assertEquals( '5.15.4', fa()->latest_version() );
}
}

View File

@ -164,28 +164,3 @@ function match_all( $pattern, $content ) {
return new MatchResult( $match_result, $matches );
}
$__svg_styles_manager_fetch_count = 0;
function get_svg_styles_manager_fetch_count() {
global $__svg_styles_manager_fetch_count;
return $__svg_styles_manager_fetch_count;
}
function reset_svg_styles_manager_fetch_count() {
global $__svg_styles_manager_fetch_count;
return $__svg_styles_manager_fetch_count = 0;
}
function mock_fetch_svg_styles( $obj ) {
return mock_singleton_method(
$obj,
FontAwesome_SVG_Styles_Manager::class,
'fetch_svg_styles',
function ( $method ) {
global $__svg_styles_manager_fetch_count;
$__svg_styles_manager_fetch_count++;
$method->willReturn( null );
}
);
}

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,9 @@ class ActivationTest extends TestCase {
reset_db();
remove_all_actions( 'font_awesome_preferences' );
mock_fetch_svg_styles( $this );
uopz_set_return( FontAwesome_SVG_Styles_Manager::class, 'ensure_svg_styles_with_admin_notice_warning', true );
uopz_set_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_present', false, false );
remove_all_filters( 'font_awesome_disable_block_editor_support' );
FontAwesome::reset();
$this->setup_metadata_provider_mock();
}
@ -31,7 +33,7 @@ class ActivationTest extends TestCase {
public function test_activation_creates_default_config() {
FontAwesome_Activator::activate();
$actual_options = get_option( FontAwesome::OPTIONS_KEY );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_6() ) );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_7() ) );
$this->assertEquals( $expected_options, $actual_options );
$releases = FontAwesome_Release_Provider::get_option();
@ -46,7 +48,7 @@ class ActivationTest extends TestCase {
public function test_initialize_from_scratch_creates_default_config() {
FontAwesome_Activator::initialize();
$actual_options = get_option( FontAwesome::OPTIONS_KEY );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_6() ) );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_7() ) );
$this->assertEquals( $expected_options, $actual_options );
$this->assertEquals(
@ -142,8 +144,7 @@ class ActivationTest extends TestCase {
$initial_conflict_detection_option
);
// 6.1.1 is the latest version 6 in the mock
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => '6.1.1' ) );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => '7.0.0' ) );
FontAwesome_Activator::initialize( true );
$actual_options = get_option( FontAwesome::OPTIONS_KEY );
@ -157,6 +158,72 @@ class ActivationTest extends TestCase {
);
}
public function test_svg_styles_ensured_when_enabled() {
$call_count = 0;
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'ensure_svg_styles_with_admin_notice_warning',
function () use ( &$call_count ) {
$call_count++;
return true;
},
true
);
FontAwesome_Activator::initialize();
$this->assertEquals( 1, $call_count );
}
public function test_no_svg_styles_when_disabled() {
$call_count = 0;
add_filter( 'font_awesome_disable_block_editor_support', '__return_true' );
FontAwesome::reset();
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'ensure_svg_styles_with_admin_notice_warning',
function () use ( &$call_count ) {
$call_count++;
return true;
},
true
);
FontAwesome_Activator::initialize();
$this->assertEquals( 0, $call_count );
}
public function test_fetch_svg_styles_when_no_filesystem_permission() {
uopz_unset_return( FontAwesome_SVG_Styles_Manager::class, 'ensure_svg_styles_with_admin_notice_warning' );
// Simulate the filesystem being inaccessible.
uopz_set_return(
'WP_Filesystem',
false,
false
);
$call_count = 0;
$notified_error = null;
uopz_set_return(
'FortAwesome\notify_admin_warning',
function ( $e ) use ( &$call_count, &$notified_error ) {
$call_count++;
$notified_error = $e;
return true;
},
true
);
$this->assertNull( FontAwesome_Activator::initialize() );
$this->assertEquals( 1, $call_count );
$this->assertMatchesRegularExpression( '/permission to save files/', $notified_error->getMessage() );
}
public function setup_metadata_provider_mock() {
( new Mock_FontAwesome_Metadata_Provider() )->mock(
array(

View File

@ -34,7 +34,7 @@ class FontAwesomeTest extends TestCase {
parent::set_up();
reset_db();
remove_all_actions( 'font_awesome_preferences' );
mock_fetch_svg_styles( $this );
uopz_set_return(FontAwesome_SVG_Styles_Manager::class, 'fetch_svg_styles', null);
wp_script_is( 'font-awesome', 'enqueued' ) && wp_dequeue_script( 'font-awesome' );
wp_script_is( 'font-awesome-v4shim', 'enqueued' ) && wp_dequeue_script( 'font-awesome-v4shim' );
wp_style_is( 'font-awesome', 'enqueued' ) && wp_dequeue_style( 'font-awesome' );
@ -202,14 +202,14 @@ class FontAwesomeTest extends TestCase {
fa()->register(
array(
'name' => 'beta',
'version' => [ ['6.1.1', '='] ]
'version' => [ ['6.7.2', '='] ]
)
);
fa()->register(
array(
'name' => 'gamma',
'version' => [ ['5.4.1', '='] ]
'version' => [ ['5.15.4', '='] ]
)
);
@ -238,14 +238,14 @@ class FontAwesomeTest extends TestCase {
fa()->register(
array(
'name' => 'beta',
'version' => [ ['6.1.1', '='] ]
'version' => [ ['6.7.2', '='] ]
)
);
fa()->register(
array(
'name' => 'gamma',
'version' => [ ['5.4.1', '='] ]
'version' => [ ['5.15.4', '='] ]
)
);
@ -274,14 +274,14 @@ class FontAwesomeTest extends TestCase {
fa()->register(
array(
'name' => 'beta',
'version' => [ ['6.1.1', '='] ]
'version' => [ ['6.7.2', '='] ]
)
);
fa()->register(
array(
'name' => 'gamma',
'version' => [ ['5.4.1', '='] ]
'version' => [ ['5.15.4', '='] ]
)
);
@ -429,7 +429,7 @@ class FontAwesomeTest extends TestCase {
public function test_refresh_releases() {
// Before
$this->assertEquals( '5.4.1', fa()->latest_version() );
$this->assertEquals( '5.15.4', fa()->latest_version() );
(new Mock_FontAwesome_Metadata_Provider())->mock(
array(
@ -443,6 +443,9 @@ class FontAwesomeTest extends TestCase {
'latest_version_6' => array(
'version' => '6.42.1',
),
'latest_version_7' => array(
'version' => '7.0.0',
),
'releases' =>
array()
)
@ -494,6 +497,9 @@ class FontAwesomeTest extends TestCase {
'latest_version_6' => array(
'version' => '6.42.1',
),
'latest_version_7' => array(
'version' => '7.0.0',
),
'releases' =>
array()
)
@ -516,7 +522,7 @@ class FontAwesomeTest extends TestCase {
}
public function test_latest_version() {
$this->assertEquals( '5.4.1', fa()->latest_version() );
$this->assertEquals( '5.15.4', fa()->latest_version() );
}
public function test_releases_refreshed_at() {

View File

@ -41,14 +41,7 @@ class ConfigControllerTest extends TestCase
)
);
mock_singleton_method(
$this,
FontAwesome_SVG_Styles_Manager::class,
'fetch_svg_styles',
function ($method) {
$method->willReturn(null);
}
);
uopz_set_return(FontAwesome_SVG_Styles_Manager::class, 'fetch_svg_styles', null);
FontAwesome_Release_Provider::load_releases();

View File

@ -93,13 +93,13 @@ class ReleaseProviderIntegrationTest extends TestCase {
$enqueued_callback = function () use ( &$enqueued_count ) {
++$enqueued_count;
$this->assertEquals( fa()->latest_version_6(), fa()->version() );
$this->assertEquals( fa()->latest_version_7(), fa()->version() );
};
add_action( 'font_awesome_enqueued', $enqueued_callback );
fa()->gather_preferences();
$resource_collection = fa_release_provider()->get_resource_collection( '5.2.0' );
$resource_collection = fa_release_provider()->get_resource_collection( '5.15.4' );
fa()->enqueue_cdn( fa()->options(), $resource_collection );
$this->assertEquals( 1, $enqueued_count );
@ -168,7 +168,7 @@ class ReleaseProviderIntegrationTest extends TestCase {
$this->assertTrue( is_array( get_option( FontAwesome_Release_Provider::OPTIONS_KEY ) ) );
$resource_collection = FontAwesome_Release_Provider::get_resource_collection(
'5.4.1',
'5.15.4',
array(
'use_pro' => true,
'use_svg' => false,
@ -181,7 +181,7 @@ class ReleaseProviderIntegrationTest extends TestCase {
$this->assertEquals( 3, $all_releases_query_count );
$resource_collection = FontAwesome_Release_Provider::get_resource_collection(
'5.4.1',
'5.15.4',
array(
'use_pro' => true,
'use_svg' => false,
@ -235,7 +235,7 @@ class ReleaseProviderIntegrationTest extends TestCase {
$this->assertTrue( (bool) FontAwesome_Release_Provider::get_option() );
$resource_collection = FontAwesome_Release_Provider::get_resource_collection(
'5.4.1',
'5.15.4',
array(
'use_pro' => true,
'use_svg' => false,

View File

@ -36,7 +36,6 @@ class MultisiteActivationTest extends TestCase {
remove_all_actions( 'font_awesome_preferences' );
remove_all_filters( 'wp_is_large_network' );
FontAwesome::reset();
mock_fetch_svg_styles( $this );
( new Mock_FontAwesome_Metadata_Provider() )->mock(
array(
wp_json_encode(
@ -52,6 +51,12 @@ class MultisiteActivationTest extends TestCase {
)
);
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'fetch_svg_styles',
null
);
FontAwesome_Release_Provider::load_releases();
if ( $this->is_wp_version_compatible() ) {
@ -72,6 +77,8 @@ class MultisiteActivationTest extends TestCase {
foreach ( $this->sub_sites as $blog_id ) {
wp_delete_site( $blog_id );
}
uopz_unset_return( FontAwesome_SVG_Styles_Manager::class, 'fetch_svg_styles' );
}
public function is_wp_version_compatible() {
@ -86,11 +93,22 @@ class MultisiteActivationTest extends TestCase {
return;
}
$fetch_svg_styles_call_count = 0;
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'fetch_svg_styles',
function () use ( &$fetch_svg_styles_call_count ) {
$fetch_svg_styles_call_count++;
},
true
);
if ( is_network_admin() ) {
FontAwesome_Activator::initialize();
$site_count = 0;
$test_obj = $this;
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_6() ) );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_7() ) );
for_each_blog(
function () use ( $test_obj, $expected_options, &$site_count ) {
@ -106,7 +124,7 @@ class MultisiteActivationTest extends TestCase {
);
$this->assertEquals( $site_count, 3 );
$this->assertTrue( get_svg_styles_manager_fetch_count() > 0 );
$this->assertTrue( $fetch_svg_styles_call_count > 0 );
} else {
$this->assertEquals( count( $this->sub_sites ), 2 );
@ -114,7 +132,7 @@ class MultisiteActivationTest extends TestCase {
switch_to_blog( $this->sub_sites[1] );
FontAwesome_Activator::initialize();
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_6() ) );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_7() ) );
// It is active there on the second sub-site.
$this->assertEquals( $expected_options, get_option( FontAwesome::OPTIONS_KEY ) );
@ -129,7 +147,7 @@ class MultisiteActivationTest extends TestCase {
// The network wide release metadata will have been initialized.
$this->assertTrue( boolval( get_network_option( get_main_network_id(), FontAwesome_Release_Provider::OPTIONS_KEY ) ) );
$this->assertTrue( get_svg_styles_manager_fetch_count() > 0 );
$this->assertTrue( $fetch_svg_styles_call_count > 0 );
}
}
@ -154,7 +172,7 @@ class MultisiteActivationTest extends TestCase {
$options_for_main_blog_id = fa()->options();
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_6() ) );
$expected_options = array_merge( FontAwesome::DEFAULT_USER_OPTIONS, array( 'version' => fa()->latest_version_7() ) );
/**
* We'll first, separately ensure that the options are initialized on the main site,

View File

@ -69,7 +69,20 @@ class PreferenceConflictDetectorTest extends TestCase {
'version' => array( array( '5.8.2', '>' ) ),
);
$this->assertEquals( array(), FontAwesome_Preference_Conflict_Detector::detect( $options, $client_preferences, '5.12.0', '6.1.1' ) );
$this->assertEquals( array(), FontAwesome_Preference_Conflict_Detector::detect( $options, $client_preferences, '5.12.0', '6.1.1', '7.0.0' ) );
}
public function test_success_when_configured_version_is_symbolically_7x() {
$options = array(
'version' => '7.x',
);
$client_preferences = array(
'version' => array( array( '7.0.0', '>=' ) ),
);
$this->assertEquals( array(), FontAwesome_Preference_Conflict_Detector::detect( $options, $client_preferences, '5.12.0', '6.1.1', '7.0.0' ) );
}
public function test_failure_when_configured_version_is_symbolically_latest() {
@ -82,7 +95,7 @@ class PreferenceConflictDetectorTest extends TestCase {
'version' => array( array( '5.8.2', '=' ) ),
);
$this->assertEquals( array( 'version' ), FontAwesome_Preference_Conflict_Detector::detect( $options, $client_preferences, '5.12.0', '6.1.1' ) );
$this->assertEquals( array( 'version' ), FontAwesome_Preference_Conflict_Detector::detect( $options, $client_preferences, '5.12.0', '6.1.1', '7.0.0' ) );
}
public function test_with_empty_preference() {

View File

@ -21,23 +21,13 @@ use Yoast\WPTestUtils\WPIntegration\TestCase;
class ReleaseProviderTest extends TestCase {
// sorted descending the way rsort would sort, lexically, not semver.
protected $known_versions_sorted_desc = array(
'6.1.1',
'6.0.0-beta3',
'5.4.1',
'5.3.1',
'5.2.0',
'5.1.1',
'7.0.0',
'6.7.2',
'6.7.1',
'5.15.4',
'5.15.3',
'5.1.0',
'5.0.9',
'5.0.8',
'5.0.6',
'5.0.4',
'5.0.3',
'5.0.2',
'5.0.13',
'5.0.12',
'5.0.10',
'5.0.1',
);
public function set_up() {
@ -279,7 +269,7 @@ class ReleaseProviderTest extends TestCase {
$farp = $this->create_release_provider_with_mock_metadata( $mock_response );
$this->assertEquals( '5.4.1', $farp->latest_version() );
$this->assertEquals( '5.15.4', $farp->latest_version() );
}
public function test_latest_version_5() {
@ -287,7 +277,7 @@ class ReleaseProviderTest extends TestCase {
$farp = $this->create_release_provider_with_mock_metadata( $mock_response );
$this->assertEquals( '5.4.1', $farp->latest_version_5() );
$this->assertEquals( '5.15.4', $farp->latest_version_5() );
}
public function test_latest_version_6() {
@ -295,7 +285,7 @@ class ReleaseProviderTest extends TestCase {
$farp = $this->create_release_provider_with_mock_metadata( $mock_response );
$this->assertEquals( '6.1.1', $farp->latest_version_6() );
$this->assertEquals( '6.7.2', $farp->latest_version_6() );
}
// Ensure that the ReleaseProvider sorts versions semantically.
@ -309,16 +299,14 @@ class ReleaseProviderTest extends TestCase {
$this->create_release_provider_with_mock_metadata( $mock_response );
$farp = FontAwesome_Release_Provider::reset();
$versions = $farp->versions();
$this->assertEquals( '6.1.1', $farp->versions()[0] );
$this->assertEquals( '7.0.0', $farp->versions()[0] );
/**
* The deprecated latest_version() is defined to be the latest 5.x version,
* because that reflects the data available on api.fontawesome.com, even though
* it's not the absolutely latest version.
*/
$this->assertEquals( '5.4.1', $farp->latest_version() );
$this->assertEquals( '5.15.4', $farp->latest_version() );
}
/**
@ -347,8 +335,8 @@ class ReleaseProviderTest extends TestCase {
$farp = FontAwesome_Release_Provider::reset();
$this->assertEquals( '5.4.1', $farp->latest_version_5() );
$this->assertEquals( '5.15.4', $farp->latest_version_5() );
$this->assertNull( $farp->latest_version_6() );
$this->assertEquals( '5.4.1', $farp->latest_version() );
$this->assertEquals( '5.15.4', $farp->latest_version() );
}
}

View File

@ -133,7 +133,7 @@ class RemoveBlocklistTest extends TestCase {
fa()->gather_preferences();
$resource_collection = fa_release_provider()->get_resource_collection( '5.2.0' );
$resource_collection = fa_release_provider()->get_resource_collection( '5.15.4' );
fa()->enqueue_cdn( fa()->options(), $resource_collection );
ob_start();
@ -197,7 +197,7 @@ class RemoveBlocklistTest extends TestCase {
fa()->gather_preferences();
$resource_collection = fa_release_provider()->get_resource_collection( '5.2.0' );
$resource_collection = fa_release_provider()->get_resource_collection( '5.15.4' );
fa()->enqueue_cdn( fa()->options(), $resource_collection );
ob_start();
@ -293,7 +293,7 @@ class RemoveBlocklistTest extends TestCase {
fa()->gather_preferences();
$resource_collection = fa_release_provider()->get_resource_collection( '5.2.0' );
$resource_collection = fa_release_provider()->get_resource_collection( '5.15.4' );
fa()->enqueue_cdn( fa()->options(), $resource_collection );
ob_start();

View File

@ -0,0 +1,314 @@
<?php
namespace FortAwesome;
require_once __DIR__ . '/../includes/class-fontawesome-activator.php';
require_once __DIR__ . '/../includes/class-fontawesome-exception.php';
require_once __DIR__ . '/_support/font-awesome-phpunit-util.php';
use Yoast\WPTestUtils\WPIntegration\TestCase;
/**
* Class SvgStyleManagerTest
*/
class SvgStyleManagerTest extends TestCase {
public function set_up() {
parent::set_up();
reset_db();
uopz_unset_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_present' );
uopz_unset_return( FontAwesome_Release_Provider::class, 'get_svg_styles_resource' );
uopz_unset_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_url_present' );
uopz_unset_return( FontAwesome_SVG_Styles_Manager::class, 'fetch_svg_styles' );
uopz_unset_return( 'WP_Filesystem' );
uopz_unset_return( 'wp_remote_get' );
uopz_unset_return( 'wp_remote_head' );
remove_all_filters( 'font_awesome_disable_block_editor_support' );
$this->setup_metadata_provider_mock();
FontAwesome_Release_Provider::load_releases();
$admin_user = get_users( array( 'role' => 'administrator' ) )[0];
wp_set_current_user( $admin_user->ID, $admin_user->user_login );
FontAwesome::reset();
update_option(
FontAwesome::OPTIONS_KEY,
array_merge(
FontAwesome::DEFAULT_USER_OPTIONS,
array(
'version' => '6.x',
'kitToken' => 'abc123',
'apiToken' => true,
)
)
);
}
public function test_fetch_svg_styles_when_styles_not_already_present() {
$fetch_svg_styles_call_count = 0;
uopz_set_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_present', false, false );
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
$this->assertTrue( WP_Filesystem( false ) );
global $wp_filesystem;
$filesystem_class = get_class( $wp_filesystem );
$wp_remote_get_call_count = 0;
$mock_css_contents = 'FAKE_CSS_CONTENTS';
uopz_set_return(
'wp_remote_get',
function () use ( &$wp_remote_get_call_count, $mock_css_contents ) {
$wp_remote_get_call_count++;
return array(
'response' => array(
'code' => 200,
),
'body' => $mock_css_contents,
);
},
true
);
$mock_content_sha384_hash_hex = hash( 'sha384', $mock_css_contents );
$written_asset_path = null;
$hash_bin = hex2bin( $mock_content_sha384_hash_hex );
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
$mock_integrity_key = 'sha384-' . base64_encode( $hash_bin );
uopz_set_return(
FontAwesome_Release_Provider::class,
'get_svg_styles_resource',
function () use ( $mock_integrity_key ) {
return new FontAwesome_Resource( 'svg-with-js.css', $mock_integrity_key );
},
true
);
uopz_set_return(
$filesystem_class,
'put_contents',
function ( $asset_path ) use ( &$written_asset_path ) {
$written_asset_path = $asset_path;
return true;
},
true
);
FontAwesome_SVG_Styles_Manager::fetch_svg_styles( fa(), fa_release_provider() );
$this->assertEquals( 1, $wp_remote_get_call_count );
$this->assertMatchesRegularExpression( '/svg-with-js\.css$/', $written_asset_path );
}
public function test_fetch_svg_styles_when_no_filesystem_permission() {
uopz_set_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_present', false, false );
// Simulate the filesystem being inaccessible.
uopz_set_return(
'WP_Filesystem',
false,
false
);
$this->expectException( SelfhostSetupPermissionsException::class );
$this->expectExceptionMessage( 'Failed to initialize filesystem usage' );
FontAwesome_SVG_Styles_Manager::fetch_svg_styles( fa(), fa_release_provider() );
}
public function test_no_wp_remote_get_for_fetch_svg_styles_when_already_present() {
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'is_svg_stylesheet_present',
true,
false
);
$wp_remote_get_call_count = 0;
uopz_set_return(
'wp_remote_get',
function () use ( &$wp_remote_get_call_count ) {
$wp_remote_get_call_count++;
},
true
);
FontAwesome_SVG_Styles_Manager::fetch_svg_styles( fa(), fa_release_provider() );
$this->assertEquals( 0, $wp_remote_get_call_count );
}
public function test_is_svg_stylesheet_present_when_present_with_filesystem_permissions() {
if ( ! function_exists( 'WP_Filesystem' ) ) {
require_once ABSPATH . 'wp-admin/includes/file.php';
}
global $wp_filesystem;
if ( ! $wp_filesystem ) {
$this->assertTrue( WP_Filesystem( false ) );
}
$this->assertNotNull( $wp_filesystem );
$filesystem_class = get_class( $wp_filesystem );
uopz_set_return(
$filesystem_class,
'exists',
true,
false
);
// It should not fall back to fetching by URL, but if it does, fail.
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'is_svg_stylesheet_url_present',
false
);
$this->assertTrue( FontAwesome_SVG_Styles_Manager::is_svg_stylesheet_present( fa() ) );
}
public function test_is_svg_stylesheet_present_when_present_with_no_filesystem_permissions() {
// Simulate the filesystem being inaccessible.
uopz_set_return(
'WP_Filesystem',
false,
false
);
uopz_set_return(
'wp_remote_head',
array(
'response' => array(
'code' => 200,
),
)
);
// It should fallback to an HTTP request.
$this->assertTrue( FontAwesome_SVG_Styles_Manager::is_svg_stylesheet_present( fa() ) );
}
public function test_fetch_svg_styles_when_loading_wp_admin_when_not_yet_present() {
$call_count = 0;
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'fetch_svg_styles',
function () use ( &$call_count ) {
$call_count++;
return null;
},
true
);
uopz_set_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_present', false );
fa()->initialize_admin();
$this->assertEquals( 1, $call_count );
}
public function test_no_fetch_svg_styles_when_loading_wp_admin_when_already_present() {
$call_count = 0;
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'fetch_svg_styles',
function () use ( &$call_count ) {
$call_count++;
return null;
},
true
);
uopz_set_return( FontAwesome_SVG_Styles_Manager::class, 'is_svg_stylesheet_present', true );
fa()->initialize_admin();
$this->assertEquals( 0, $call_count );
}
public function test_no_svg_styles_when_loading_wp_admin_when_block_editor_disabled() {
$call_count = 0;
add_filter( 'font_awesome_disable_block_editor_support', '__return_true' );
FontAwesome::reset();
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'is_svg_stylesheet_present',
function () use ( &$call_count ) {
$call_count++;
return null;
},
true
);
fa()->initialize_admin();
$this->assertEquals( 0, $call_count );
}
public function test_register_svg_styles_when_initializing_when_enabled() {
$call_count = 0;
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'register_svg_styles',
function () use ( &$call_count ) {
$call_count++;
return null;
},
true
);
fa()->init();
$this->assertEquals( 1, $call_count );
}
public function test_no_register_svg_styles_when_initializing_when_disabled() {
$call_count = 0;
add_filter( 'font_awesome_disable_block_editor_support', '__return_true' );
FontAwesome::reset();
uopz_set_return(
FontAwesome_SVG_Styles_Manager::class,
'register_svg_styles',
function () use ( &$call_count ) {
$call_count++;
return null;
},
true
);
fa()->init();
$this->assertEquals( 0, $call_count );
}
public function setup_metadata_provider_mock() {
( new Mock_FontAwesome_Metadata_Provider() )->mock(
array(
wp_json_encode(
array(
'data' => graphql_releases_query_fixture(),
)
),
)
);
}
}