upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/breeze/inc/class-breeze-preload-fonts.php
bengizmo d1509b3d60 feat(dev-env): implement backup-based development workflow
This commit introduces a more reliable and consistent approach to setting up
the development environment using backups:

- Add setup-from-backup.sh script for environment setup from existing backups
- Standardize script naming and organization
- Move obsolete scripts to bin/obsolete directory
- Update documentation with new workflow instructions
- Create migration guide for transitioning to new workflow
- Update Memory Bank with workflow improvements

The new workflow provides:
- More reliable environment setup
- Faster setup process
- Offline development capability
- Consistent development environments across team members

Breaking changes:
- setup-dev.sh is replaced by setup-from-backup.sh
- sync-and-setup.sh is replaced by separate scripts
- verify-with-wpcli.sh is no longer used

Migration path is documented in MIGRATION_GUIDE.md
2025-03-26 11:26:18 -03:00

61 lines
1.5 KiB
PHP

<?php
if ( ! defined( 'ABSPATH' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit;
}
if ( ! class_exists( 'Breeze_Preload_Fonts' ) ) {
/**
* Handles the Prefetch functionality.
*
* Class Breeze_Prefetch
* @since 1.2.0
*/
class Breeze_Preload_Fonts {
public function __construct() {
add_action( 'wp_head', array( $this, 'load_preload_scripts' ) );
}
/**
* Preload the website fonts added in the options.
*
* @since 1.2.0
* @access public
*/
public function load_preload_scripts() {
$preload_fonts = Breeze_Options_Reader::get_option_value( 'breeze-preload-fonts' );
$fonts_extensions = array(
'woff',
'woff2',
'ttf',
'eot',
'bmap',
'otf',
'otf',
'svg',
);
$fonts_extensions = apply_filters( 'breeze_preload_fonts_exception', $fonts_extensions );
// Check if the option is enabled by admin.
if ( isset( $preload_fonts ) && ! empty( $preload_fonts ) ) {
foreach ( $preload_fonts as $index => $preload_url ) {
$extension = pathinfo( $preload_url, PATHINFO_EXTENSION );
$extension = strtolower( $extension );
if ( 'css' === $extension ) {
echo '<link rel="preload" as="style" onload="this.rel = \'stylesheet\'" href="' . $preload_url . '" crossorigin>' . "\n";
} elseif ( in_array( $extension, $fonts_extensions, true ) ) {
echo '<link rel="preload" as="font" type="font/' . $extension . '" href="' . $preload_url . '" crossorigin>' . "\n";
}
}
}
}
}
new Breeze_Preload_Fonts();
}