Changeset 3465921
- Timestamp:
- 02/20/2026 04:10:59 PM (5 weeks ago)
- Location:
- host-webfonts-local
- Files:
-
- 6 edited
- 1 copied
-
tags/6.1.3 (copied) (copied from host-webfonts-local/trunk)
-
tags/6.1.3/host-webfonts-local.php (modified) (1 diff)
-
tags/6.1.3/readme.txt (modified) (2 diffs)
-
tags/6.1.3/src/Helper.php (modified) (12 diffs)
-
trunk/host-webfonts-local.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/src/Helper.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
host-webfonts-local/tags/6.1.3/host-webfonts-local.php
r3465853 r3465921 4 4 * Plugin URI: https://daan.dev/wordpress/omgf/ 5 5 * Description: Increase GDPR/DSGVO compliance and leverage browser cache by automatically self-hosting Google Fonts. 6 * Version: 6.1. 26 * Version: 6.1.3 7 7 * Author: Daan from Daan.dev 8 8 * Author URI: https://daan.dev -
host-webfonts-local/tags/6.1.3/readme.txt
r3465853 r3465921 4 4 Requires at least: 5.9 5 5 Tested up to: 6.9 6 Stable tag: 6.1. 26 Stable tag: 6.1.3 7 7 Requires PHP: 7.3 8 8 License: GPLv2 or later … … 89 89 == Changelog == 90 90 91 = 6.1.3 = 92 * Coincidentally found a bug that has been haunting me for years, that's why I'm releasing this quick patch release. 93 * Fixed: in some scenarios, unloaded_stylesheets would be stored as an array with one empty element in the database. 94 91 95 = 6.1.2 | February 20th, 2026 = 92 * Fixed: if the expected MIME type of adownloaded file didn't match, a class OMGF\OMGF exception would be thrown.96 * Fixed: if the expected MIME type of the downloaded file didn't match, a class OMGF\OMGF exception would be thrown. 93 97 * Dev: Updated CI tools. 94 98 -
host-webfonts-local/tags/6.1.3/src/Helper.php
r3375747 r3465921 29 29 * This is basically a wrapper around update_option() to offer a centralized interface for 30 30 * storing OMGF's settings in the wp_options table. 31 * 32 * @param mixed $value 33 * @param string $setting 34 * 35 * @return bool 31 36 * @since v5.6.0 32 37 * 33 * @param mixed $value34 * @param string $setting35 *36 * @return bool37 38 */ 38 39 public static function update_option( $setting, $value, $autoload = true ) { … … 54 55 * Gets all settings for OMGF. 55 56 * @filter omgf_settings 57 * @return array 56 58 * @since 5.5.7 57 * @return array58 59 */ 59 60 public static function get_settings() { … … 83 84 * This is basically a wrapper around delete_option() to offer a centralized interface for 84 85 * removing OMGF's settings in the wp_options table. 86 * 87 * @param string $setting 88 * 89 * @return bool 85 90 * @since v5.6.0 86 91 * 87 * @param string $setting88 *89 * @return bool90 92 */ 91 93 public static function delete_option( $setting ) { … … 124 126 * 125 127 * @filter omgf_setting_{$name} 128 * 129 * @param mixed $default (optional) 130 * @param string $name 131 * 126 132 * @since v5.6.0 127 133 * 128 * @param mixed $default (optional)129 * @param string $name130 134 */ 131 135 public static function get_option( $name, $default = null ) { … … 175 179 176 180 if ( empty( $unloaded_stylesheets ) ) { 181 // Returns a string with one empty element if the option is empty, that's why we array_filter it. 177 182 $unloaded_stylesheets = explode( ',', self::get_option( Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS, '' ) ); 178 183 } 179 184 180 return array_filter( $unloaded_stylesheets ); 185 // Remove empty elements (and store it to the static variable before returning it) 186 $unloaded_stylesheets = array_filter( $unloaded_stylesheets ); 187 188 return $unloaded_stylesheets; 181 189 } 182 190 … … 203 211 /** 204 212 * Fetch cache keys from the DB. 213 * @return array 214 * 215 * @codeCoverageIgnore 205 216 * @since v5.6.4 Extract cache keys from Optimized Fonts option if the option itself appears empty. 206 * @return array207 *208 * @codeCoverageIgnore209 217 */ 210 218 public static function cache_keys() { … … 234 242 * Optimized Local Fonts to be displayed in the Optimize Local Fonts table. 235 243 * Use a static variable to reduce database reads/writes. 244 * 245 * @param bool $force_add 246 * @param array $maybe_add If it doesn't exist, it's added to the cache layer. 247 * 248 * @return array 249 * 250 * @codeCoverageIgnore 236 251 * @since v4.5.7 237 252 * 238 * @param bool $force_add239 * @param array $maybe_add If it doesn't exist, it's added to the cache layer.240 *241 * @return array242 *243 * @codeCoverageIgnore244 253 */ 245 254 public static function admin_optimized_fonts( $maybe_add = [], $force_add = false ) { … … 275 284 * Optimized Local Fonts to be used in the frontend. Doesn\'t contain unloaded fonts. 276 285 * Use a static variable to reduce database reads/writes. 286 * 287 * @param bool $force_add 288 * @param array $maybe_add If it doesn't exist, it's added to the cache layer. 289 * 290 * @return array 291 * 292 * @codeCoverageIgnore 277 293 * @since v5.8.1 278 294 * 279 * @param bool $force_add280 * @param array $maybe_add If it doesn't exist, it's added to the cache layer.281 *282 * @return array283 *284 * @codeCoverageIgnore285 295 */ 286 296 public static function optimized_fonts( $maybe_add = [], $force_add = false ) { … … 321 331 322 332 /** 333 * @return array 334 * 335 * @codeCoverageIgnore 323 336 * @since v5.4.4 Returns the available subsets in all requested fonts/stylesheets. 324 337 * Functions as a temporary cache layer to reduce DB reads with get_option(). 325 * @return array326 *327 * @codeCoverageIgnore328 338 */ 329 339 public static function available_used_subsets( $maybe_add = [], $intersect = false ) { … … 378 388 * To prevent "Cannot use output buffering in output buffering display handlers" errors, I introduced a debug 379 389 * array feature, to easily display, well, arrays in the debug log (duh!) 390 * 391 * @param array|object $array The array to be displayed in the debug log 392 * @param string $name A descriptive name to be shown in the debug log 393 * 394 * @return void 395 * 396 * @codeCoverageIgnore 380 397 * @since v5.3.7 381 398 * 382 * @param array|object $array The array to be displayed in the debug log383 * @param string $name A descriptive name to be shown in the debug log384 *385 * @return void386 *387 * @codeCoverageIgnore388 399 */ 389 400 public static function debug_array( $name, $array ) { 390 401 if ( ! self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) || 391 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) {402 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) { 392 403 return; 393 404 } … … 444 455 public static function debug( $message ) { 445 456 if ( ! self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) || 446 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) {457 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) { 447 458 return; 448 459 } … … 505 516 * Generate a request to $uri including the required parameters for OMGF to run in the frontend. 506 517 * 518 * @param $url A (relative or absolute) URL, defaults to home URL. 519 * 520 * @return string 507 521 * @since v5.4.4 Added omgf_optimize_run_args filter so other plugins can add query parameters to the Save & Optimize routine. 508 522 * 509 * @param $url A (relative or absolute) URL, defaults to home URL.510 *511 * @return string512 523 */ 513 524 public static function no_cache_optimize_url( $url = '' ) { -
host-webfonts-local/trunk/host-webfonts-local.php
r3465853 r3465921 4 4 * Plugin URI: https://daan.dev/wordpress/omgf/ 5 5 * Description: Increase GDPR/DSGVO compliance and leverage browser cache by automatically self-hosting Google Fonts. 6 * Version: 6.1. 26 * Version: 6.1.3 7 7 * Author: Daan from Daan.dev 8 8 * Author URI: https://daan.dev -
host-webfonts-local/trunk/readme.txt
r3465853 r3465921 4 4 Requires at least: 5.9 5 5 Tested up to: 6.9 6 Stable tag: 6.1. 26 Stable tag: 6.1.3 7 7 Requires PHP: 7.3 8 8 License: GPLv2 or later … … 89 89 == Changelog == 90 90 91 = 6.1.3 = 92 * Coincidentally found a bug that has been haunting me for years, that's why I'm releasing this quick patch release. 93 * Fixed: in some scenarios, unloaded_stylesheets would be stored as an array with one empty element in the database. 94 91 95 = 6.1.2 | February 20th, 2026 = 92 * Fixed: if the expected MIME type of adownloaded file didn't match, a class OMGF\OMGF exception would be thrown.96 * Fixed: if the expected MIME type of the downloaded file didn't match, a class OMGF\OMGF exception would be thrown. 93 97 * Dev: Updated CI tools. 94 98 -
host-webfonts-local/trunk/src/Helper.php
r3375747 r3465921 29 29 * This is basically a wrapper around update_option() to offer a centralized interface for 30 30 * storing OMGF's settings in the wp_options table. 31 * 32 * @param mixed $value 33 * @param string $setting 34 * 35 * @return bool 31 36 * @since v5.6.0 32 37 * 33 * @param mixed $value34 * @param string $setting35 *36 * @return bool37 38 */ 38 39 public static function update_option( $setting, $value, $autoload = true ) { … … 54 55 * Gets all settings for OMGF. 55 56 * @filter omgf_settings 57 * @return array 56 58 * @since 5.5.7 57 * @return array58 59 */ 59 60 public static function get_settings() { … … 83 84 * This is basically a wrapper around delete_option() to offer a centralized interface for 84 85 * removing OMGF's settings in the wp_options table. 86 * 87 * @param string $setting 88 * 89 * @return bool 85 90 * @since v5.6.0 86 91 * 87 * @param string $setting88 *89 * @return bool90 92 */ 91 93 public static function delete_option( $setting ) { … … 124 126 * 125 127 * @filter omgf_setting_{$name} 128 * 129 * @param mixed $default (optional) 130 * @param string $name 131 * 126 132 * @since v5.6.0 127 133 * 128 * @param mixed $default (optional)129 * @param string $name130 134 */ 131 135 public static function get_option( $name, $default = null ) { … … 175 179 176 180 if ( empty( $unloaded_stylesheets ) ) { 181 // Returns a string with one empty element if the option is empty, that's why we array_filter it. 177 182 $unloaded_stylesheets = explode( ',', self::get_option( Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS, '' ) ); 178 183 } 179 184 180 return array_filter( $unloaded_stylesheets ); 185 // Remove empty elements (and store it to the static variable before returning it) 186 $unloaded_stylesheets = array_filter( $unloaded_stylesheets ); 187 188 return $unloaded_stylesheets; 181 189 } 182 190 … … 203 211 /** 204 212 * Fetch cache keys from the DB. 213 * @return array 214 * 215 * @codeCoverageIgnore 205 216 * @since v5.6.4 Extract cache keys from Optimized Fonts option if the option itself appears empty. 206 * @return array207 *208 * @codeCoverageIgnore209 217 */ 210 218 public static function cache_keys() { … … 234 242 * Optimized Local Fonts to be displayed in the Optimize Local Fonts table. 235 243 * Use a static variable to reduce database reads/writes. 244 * 245 * @param bool $force_add 246 * @param array $maybe_add If it doesn't exist, it's added to the cache layer. 247 * 248 * @return array 249 * 250 * @codeCoverageIgnore 236 251 * @since v4.5.7 237 252 * 238 * @param bool $force_add239 * @param array $maybe_add If it doesn't exist, it's added to the cache layer.240 *241 * @return array242 *243 * @codeCoverageIgnore244 253 */ 245 254 public static function admin_optimized_fonts( $maybe_add = [], $force_add = false ) { … … 275 284 * Optimized Local Fonts to be used in the frontend. Doesn\'t contain unloaded fonts. 276 285 * Use a static variable to reduce database reads/writes. 286 * 287 * @param bool $force_add 288 * @param array $maybe_add If it doesn't exist, it's added to the cache layer. 289 * 290 * @return array 291 * 292 * @codeCoverageIgnore 277 293 * @since v5.8.1 278 294 * 279 * @param bool $force_add280 * @param array $maybe_add If it doesn't exist, it's added to the cache layer.281 *282 * @return array283 *284 * @codeCoverageIgnore285 295 */ 286 296 public static function optimized_fonts( $maybe_add = [], $force_add = false ) { … … 321 331 322 332 /** 333 * @return array 334 * 335 * @codeCoverageIgnore 323 336 * @since v5.4.4 Returns the available subsets in all requested fonts/stylesheets. 324 337 * Functions as a temporary cache layer to reduce DB reads with get_option(). 325 * @return array326 *327 * @codeCoverageIgnore328 338 */ 329 339 public static function available_used_subsets( $maybe_add = [], $intersect = false ) { … … 378 388 * To prevent "Cannot use output buffering in output buffering display handlers" errors, I introduced a debug 379 389 * array feature, to easily display, well, arrays in the debug log (duh!) 390 * 391 * @param array|object $array The array to be displayed in the debug log 392 * @param string $name A descriptive name to be shown in the debug log 393 * 394 * @return void 395 * 396 * @codeCoverageIgnore 380 397 * @since v5.3.7 381 398 * 382 * @param array|object $array The array to be displayed in the debug log383 * @param string $name A descriptive name to be shown in the debug log384 *385 * @return void386 *387 * @codeCoverageIgnore388 399 */ 389 400 public static function debug_array( $name, $array ) { 390 401 if ( ! self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) || 391 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) {402 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) { 392 403 return; 393 404 } … … 444 455 public static function debug( $message ) { 445 456 if ( ! self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) || 446 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) {457 ( self::get_option( Settings::OMGF_ADV_SETTING_DEBUG_MODE ) && file_exists( self::log_file() ) && filesize( self::log_file() ) > MB_IN_BYTES ) ) { 447 458 return; 448 459 } … … 505 516 * Generate a request to $uri including the required parameters for OMGF to run in the frontend. 506 517 * 518 * @param $url A (relative or absolute) URL, defaults to home URL. 519 * 520 * @return string 507 521 * @since v5.4.4 Added omgf_optimize_run_args filter so other plugins can add query parameters to the Save & Optimize routine. 508 522 * 509 * @param $url A (relative or absolute) URL, defaults to home URL.510 *511 * @return string512 523 */ 513 524 public static function no_cache_optimize_url( $url = '' ) {
Note: See TracChangeset
for help on using the changeset viewer.