title = __('Optimize Google Fonts', $this->plugin_text_domain); add_filter('omgf_optimize_settings_content', [$this, 'do_title'], 10); add_filter('omgf_optimize_settings_content', [$this, 'do_description'], 15); add_filter('omgf_optimize_settings_content', [$this, 'do_before'], 20); add_filter('omgf_optimize_settings_content', [$this, 'do_optimization_mode'], 30); add_filter('omgf_optimize_settings_content', [$this, 'do_promo_combine_requests'], 40); add_filter('omgf_optimize_settings_content', [$this, 'do_display_option'], 50); add_filter('omgf_optimize_settings_content', [$this, 'do_promo_force_font_display'], 60); add_filter('omgf_optimize_settings_content', [$this, 'do_promo_include_file_types'], 70); add_filter('omgf_optimize_settings_content', [$this, 'do_promo_force_subsets'], 80); add_filter('omgf_optimize_settings_content', [$this, 'do_after'], 100); add_filter('omgf_optimize_settings_content', [$this, 'do_optimize_fonts_container'], 200); add_filter('omgf_optimize_settings_content', [$this, 'do_optimize_fonts_contents'], 250); add_filter('omgf_optimize_settings_content', [$this, 'close_optimize_fonts_container'], 300); add_filter('omgf_optimize_settings_content', [$this, 'do_before'], 350); add_filter('omgf_optimize_settings_content', [$this, 'do_optimize_edit_roles'], 375); add_filter('omgf_optimize_settings_content', [$this, 'do_after'], 400); } /** * */ public function do_description() { ?>
= __('These settings affect the fonts OMGF downloads and the stylesheet it generates. If you\'re simply looking to replace your Google Fonts for locally hosted copies, the default settings should suffice.', $this->plugin_text_domain); ?>
= sprintf(__('To install additional Google Fonts, an add-on is required, which can be downloaded here.', $this->plugin_text_domain), self::FFW_PRESS_OMGF_AF_URL); ?>
do_radio( __('Optimization Mode', $this->plugin_text_domain), OMGF_Admin_Settings::OMGF_OPTIMIZATION_MODE, OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZATION_MODE, OMGF_OPTIMIZATION_MODE, __('Manual processing mode is best suited for configurations, which use a fixed number of fonts across the entire site. When in manual mode, the generated stylesheet is forced throughout the entire site. Automatic processing mode is best suited for configurations using e.g. page builders, which load different fonts on certain pages.', $this->plugin_text_domain) ); } /** * */ public function do_promo_combine_requests() { $this->do_checkbox( __('Combine & Dedupe (Pro)', $this->plugin_text_domain), 'omgf_pro_combine_requests', defined('OMGF_PRO_COMBINE_REQUESTS') ? true : false, __('Combine and deduplicate multiple Google Fonts stylesheets into one stylesheet. This feature is always on in OMGF Pro.', $this->plugin_text_domain) . ' ' . $this->promo, true ); } /** * */ public function do_display_option() { $this->do_select( __('Font-Display Option', $this->plugin_text_domain), OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_DISPLAY_OPTION, OMGF_Admin_Settings::OMGF_FONT_DISPLAY_OPTIONS, OMGF_DISPLAY_OPTION, __('Select which value to set the font-display attribute to. Defaults to Swap (recommended).', $this->plugin_text_domain) ); } /** * Force Font-Display Option Site Wide */ public function do_promo_force_font_display() { $this->do_checkbox( __('Force Font-Display Option Site Wide (Pro)', $this->plugin_text_domain), 'omgf_pro_force_font_display', defined('OMGF_PRO_FORCE_FONT_DISPLAY') ? OMGF_PRO_FORCE_FONT_DISPLAY : false, __('Force the abovefont-display attribute on all @font-face statements to ensure all text is user-visible while webfonts and icon sets are loading.', $this->plugin_text_domain),
true
);
}
/**
* Display WOFF2 Only
*
* @return void
*/
public function do_promo_include_file_types()
{
$this->do_select(
__('Include File Types (Pro)', $this->plugin_text_domain),
'omgf_pro_file_types',
OMGF_Admin_Settings::OMGF_FILE_TYPES_OPTIONS,
defined('OMGF_PRO_FILE_TYPES') ? OMGF_PRO_FILE_TYPES : [],
__('Select which file types should be included in the stylesheet. Loading WOFF2 files only will result in a smaller stylesheet, but will make the stylesheet slightly less Cross Browser compatible. Using WOFF and WOFF2 together (default) accounts for +98% of browsers. Add EOT for IE 6-10 and TTF and SVG for legacy Android/iOS browsers. Use CTRL + click to select multiple values.', $this->plugin_text_domain) . ' ' . $this->promo,
true,
true
);
}
/**
*
*/
public function do_promo_force_subsets()
{
$this->do_select(
__('Force Subsets (Pro)', $this->plugin_text_domain),
'omgf_pro_force_subsets',
OMGF_Admin_Settings::OMGF_FORCE_SUBSETS_OPTIONS,
defined('OMGF_PRO_FORCE_SUBSETS') ? OMGF_PRO_FORCE_SUBSETS : [],
__('If a theme or plugin loads subsets you don\'t need, use this option to force all Google Fonts to be loaded in the selected subsets. You can also use this option to force the loading of additional subsets, if a theme/plugin doesn\'t allow you to configure the loaded subsets. Use CTRL + click to select multiple values.', $this->plugin_text_domain) . ' ' . $this->promo,
true,
true
);
}
/**
*
*/
public function do_optimize_fonts_container()
{
?>
| = __('Style', $this->plugin_text_domain); ?> | = __('Weight', $this->plugin_text_domain); ?> | = __('Preload', $this->plugin_text_domain); ?>= __('Preload font files (before everything else) so they will be available as soon as they are required for the rendering of the page. Only use preload for font files that are used above the fold.', $this->plugin_text_domain); ?>![]() |
= __('Do not load', $this->plugin_text_domain); ?> | = __('Fallback Font Stack (Pro)', $this->plugin_text_domain); ?> | |
|---|---|---|---|---|---|
| = sprintf(__('Stylesheet handle: %s', $this->plugin_text_domain), $handle); ?> | |||||
| = rawurldecode($font->family); ?>= $aka ? ' (' . sprintf(__('formerly known as %s', $this->plugin_text_domain) . ')', ucfirst($aka)) : ''; ?> (= __('Unload italics', $this->plugin_text_domain); ?> = __('In most situations you can safely unload all Italic font styles. Modern browsers are capable of mimicking Italic font styles.', $this->plugin_text_domain); ?> | = __('Unload all', $this->plugin_text_domain); ?> | = __('Load all', $this->plugin_text_domain); ?>) | |||||
| id][$variant->id] ?? ''; $unload = OMGF::unloaded_fonts()[$handle][$font->id][$variant->id] ?? ''; $class = $handle . '-' . $font->id . '-' . $variant->id; ?> | = $variant->fontStyle; ?> | = $variant->fontWeight; ?> | = $unload ? 'disabled' : ''; ?> /> | = $preload ? 'disabled' : ''; ?> /> | |
= sprintf(__("This list is populated with all Google Fonts captured and downloaded from %s. Optimizations will be applied on every page using these fonts. If you want to optimize additional Google Fonts from other pages, switch to Automatic (Pro) and visit the pages containing the stylesheets you'd like to optimize. This list will automatically be populated with the captured fonts.", $this->plugin_text_domain), OMGF_MANUAL_OPTIMIZE_URL); ?> = sprintf(__("This list is automatically populated with Google Fonts captured throughout your entire site. Optimizations will be applied on every page using these fonts. Automatic mode might not work when a Full Page Cache plugin is activated. If this list is not being populated with Google Fonts, you could try to visit your frontend and append the following parameter to the URL: %s", $this->plugin_text_domain), $no_cache_param); ?>
= sprintf(__("You've chosen to optimize your Google Fonts manually. OMGF will not run automatically and will %s the requested Google Fonts throughout your website that were captured on the post/page you defined. A Cross-Browser compatible stylesheet will be generated for all requested Google Fonts.", $this->plugin_text_domain), OMGF_FONT_PROCESSING); ?>
= __('Enter the URL of the post/page you\'d like to scan for Google Fonts. The detected and optimized stylesheets will be applied on all pages where they\'re used.', $this->plugin_text_domain); ?>
= __('This section will be populated with all captured fonts, font styles and available options after saving changes.', $this->plugin_text_domain); ?>
= sprintf(__("You've chosen to optimize your Google Fonts automatically. OMGF will run silently in the background and %s all requested Google Fonts. If the captured stylesheet doesn't exist yet, a call is sent to OMGF's Download API to download the font files and generate a Cross-Browser compatible stylesheet.", $this->plugin_text_domain), OMGF_FONT_PROCESSING); ?>
= __("After saving your changes, this section will be populated with all captured fonts, font styles and available options as your site's frontend is visited by you or others. You will be able to manage your fonts at a later point.", $this->plugin_text_domain); ?>