| @@ -2,10 +2,10 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Easy Fonts |
| 4 | 4 | * Plugin URI: https://fluxpress.io |
| 5 | 5 | * Description: Detect, self-host, preload, and trim Google Fonts automatically — reliably, with zero-CLS metric-matched fallbacks. Built on WordPress's native HTML API. |
| 6 | - * Version: 2.0.0 | |
| 7 | - * Author: FluxPress | |
| 6 | + * Version: 2.0.4 | |
| 7 | + * Author: Uzair | |
| 8 | 8 | * Author URI: https://fluxpress.io |
| 9 | 9 | * License: GPL-2.0-or-later |
| 10 | 10 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 11 | 11 | * Text Domain: easyfonts |
| @@ -17,13 +17,38 @@ | ||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | defined( 'ABSPATH' ) || exit; |
| 20 | 20 | |
| 21 | -define( 'EASYFONTS_VERSION', '2.0.0' ); | |
| 21 | +define( 'EASYFONTS_VERSION', '2.0.4' ); | |
| 22 | 22 | define( 'EASYFONTS_FILE', __FILE__ ); |
| 23 | 23 | define( 'EASYFONTS_DIR', plugin_dir_path( __FILE__ ) ); |
| 24 | 24 | define( 'EASYFONTS_URL', plugin_dir_url( __FILE__ ) ); |
| 25 | 25 | define( 'EASYFONTS_BASENAME', plugin_basename( __FILE__ ) ); |
| 26 | + | |
| 27 | +/** | |
| 28 | + * PHP 7.4 polyfills. The plugin advertises "Requires PHP: 7.4", but parts of the | |
| 29 | + * codebase use string helpers added in PHP 8.0. These guarded shims keep it | |
| 30 | + * genuinely 7.4-compatible without changing any call sites. | |
| 31 | + */ | |
| 32 | +if ( ! function_exists( 'str_starts_with' ) ) { | |
| 33 | + function str_starts_with( $haystack, $needle ): bool { | |
| 34 | + return '' === $needle || 0 === strncmp( (string) $haystack, (string) $needle, strlen( (string) $needle ) ); | |
| 35 | + } | |
| 36 | +} | |
| 37 | +if ( ! function_exists( 'str_ends_with' ) ) { | |
| 38 | + function str_ends_with( $haystack, $needle ): bool { | |
| 39 | + if ( '' === $needle ) { | |
| 40 | + return true; | |
| 41 | + } | |
| 42 | + $len = strlen( (string) $needle ); | |
| 43 | + return $len <= strlen( (string) $haystack ) && 0 === substr_compare( (string) $haystack, (string) $needle, -$len ); | |
| 44 | + } | |
| 45 | +} | |
| 46 | +if ( ! function_exists( 'str_contains' ) ) { | |
| 47 | + function str_contains( $haystack, $needle ): bool { | |
| 48 | + return '' === $needle || false !== strpos( (string) $haystack, (string) $needle ); | |
| 49 | + } | |
| 50 | +} | |
| 26 | 51 | |
| 27 | 52 | /** |
| 28 | 53 | * PSR-4 autoloader for the EasyFonts\ namespace. |
| 29 | 54 | */ |