label (CSS stack or Google family name). */ public static function curated() { return array( '' => __( '— Theme / Commerce7 default —', '7labs-debug-branding-for-commerce7' ), 'system-ui' => 'System UI', 'Georgia, serif' => 'Georgia', 'Georgia, "Times New Roman", serif' => 'Georgia / Times', 'Palatino, "Palatino Linotype", serif' => 'Palatino', 'Arial, Helvetica, sans-serif' => 'Arial', '"Helvetica Neue", Helvetica, Arial, sans-serif' => 'Helvetica Neue', 'Verdana, Geneva, sans-serif' => 'Verdana', '"Trebuchet MS", Helvetica, sans-serif' => 'Trebuchet MS', '"Courier New", Courier, monospace' => 'Courier New', 'google:Inter' => 'Inter (Google)', 'google:Roboto' => 'Roboto (Google)', 'google:Open Sans' => 'Open Sans (Google)', 'google:Lato' => 'Lato (Google)', 'google:Montserrat' => 'Montserrat (Google)', 'google:Poppins' => 'Poppins (Google)', 'google:Source Sans 3' => 'Source Sans 3 (Google)', 'google:Nunito' => 'Nunito (Google)', 'google:Raleway' => 'Raleway (Google)', 'google:Work Sans' => 'Work Sans (Google)', 'google:DM Sans' => 'DM Sans (Google)', 'google:Playfair Display' => 'Playfair Display (Google)', 'google:Merriweather' => 'Merriweather (Google)', 'google:Lora' => 'Lora (Google)', 'google:Cormorant Garamond'=> 'Cormorant Garamond (Google)', 'google:Libre Baskerville' => 'Libre Baskerville (Google)', 'google:EB Garamond' => 'EB Garamond (Google)', 'google:Oswald' => 'Oswald (Google)', 'google:Josefin Sans' => 'Josefin Sans (Google)', 'google:Quicksand' => 'Quicksand (Google)', ); } /** * Resolve a stored font key to a CSS font-family value. * * @param string $key Key. * @return string */ public static function css_family( $key ) { $key = (string) $key; if ( '' === $key ) { return ''; } if ( 0 === strpos( $key, 'google:' ) ) { $family = substr( $key, 7 ); return '"' . $family . '", sans-serif'; } if ( 0 === strpos( $key, 'custom:' ) ) { $id = substr( $key, 7 ); $font = self::get_custom( $id ); if ( $font && ! empty( $font['family'] ) ) { return '"' . $font['family'] . '", sans-serif'; } return ''; } if ( 'system-ui' === $key ) { return 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'; } $curated = self::curated(); return isset( $curated[ $key ] ) ? $key : sanitize_text_field( $key ); } /** * Custom fonts list from settings. * * @return array */ public static function custom_fonts() { $settings = C7DBT_Settings::get(); return isset( $settings['custom_fonts'] ) && is_array( $settings['custom_fonts'] ) ? $settings['custom_fonts'] : array(); } /** * Get one custom font. * * @param string $id ID. * @return array|null */ public static function get_custom( $id ) { foreach ( self::custom_fonts() as $font ) { if ( isset( $font['id'] ) && $font['id'] === $id ) { return $font; } } return null; } /** * Options for