ED 8F0A(B BBBED 8F0A(B BBBAH XX d1j FBE E(A0A8D` 8A0A(B BBBF X 3L X 3! X 3; X 4; X 84; Y d4; Y 4! 0Y 4: ( DY 4Q BNJ0 DBF pY 7 BBB B(D0A8GT 8D0A(B BBBK`HYBH]AG]IPM^HmRiA $ zR x , @ PZ ,A1 0 dZ XA BGA D0 AABA H Z A BIB E(A0A8F` 8A0A(B BBBD L Z 8I FBD A(Jz (A ABBIQ]MF X 4[ K. BBB E(A0A8Dp 8D0A(B BBBAxBhxBp p [ M FEB B(A0D8GM\B 8D0A(B BBBHBSB \ Hj! \ dj @ ,\ k FBE D(D0F@_ 0A(A BBBF H p\ |k FBB E(D0D8FP~ 8A0A(B BBBA H \ k FBB B(A0A8DP, 8D0A(B BBBE ] 4m! H ] Pm FBB E(A0D8Dp 8D0A(B BBBG 0 h] n FBA D@ ABBG 0 ] `o FBA D@ ABBG ( ] p FAD@ ABA ] p ^ p OEB A(A0 (A BBBA* (A EGBED (A EGBED (A FBDIC0 ^ t FBB B(A0A8m 0D(B BBBI 0D(B BBBGv 0E(E BBBB4 0A(E BBBHn 0A(W BBBD 4B 4B @5B P5B / \ @5B P5B -1 @5B P5B K=B Pc o 4B 4B p4B =B 4B 4B o o o 4B o # I=B ;B =B OBB ic' => __( '900 Italic', 'inspiro' ), ); } return apply_filters( 'inspiro/font-weight', self::$font_weight ); } /** * Get font weight for selected Font Family passed by setting key * * @param string $setting_key The setting key name for Font Family control. * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @return array */ public static function get_font_family_weight( $setting_key, $wp_customize ) { $font_family_weight = array( '' => __( 'Inherit', 'inspiro' ), ); if ( ! is_object( $wp_customize->get_setting( $setting_key ) ) ) { return $font_family_weight; } $default = $wp_customize->get_setting( $setting_key )->default; $select_font_family = get_theme_mod( $setting_key, $default ); $font_family = self::clean_google_fonts( $select_font_family ); $all_font_weight = self::get_all_font_weight(); if ( isset( self::$google_fonts[ $font_family ][0] ) && is_array( self::$google_fonts[ $font_family ][0] ) ) { foreach ( self::$google_fonts[ $font_family ][0] as $font_weight ) { // Skip font variants (italic, i). if ( strpos( $font_weight, 'italic' ) === false || strpos( $font_weight, 'i' ) === false ) { $font_family_weight[ $font_weight ] = $all_font_weight[ $font_weight ]; } } } return $font_family_weight; } /** * Get font presets * * @return array Array of all font presets for Inspiro theme */ public static function get_font_presets() { if ( empty( self::$font_presets ) ) { self::$font_presets = array( array( 'name' => 'Default', 'image' => 'system.png', 'mods' => array( 'body-font-family' => '', 'body-font-size' => '16', 'body-font-weight' => '400', 'body-text-transform' => '', 'body-line-height' => '1.8', // TODO: add all settings here. ), ), ); // TODO: add font presets. } return apply_filters( 'inspiro/font-presets', self::$font_presets ); } /** * Clean font name. * * Google Fonts are saved as {'Font Name', Category}. This function cleanes this up to retreive only the {Font Name}. * * @since 1.3.0 * @param string $font_value Name of the font. * * @return string Font name where commas and inverted commas are removed if the font is a Google Font. */ public static function clean_google_fonts( $font_value ) { // Bail if fontVAlue does not contain a comma. if ( strpos( $font_value, ',' ) === false ) { return $font_value; } $split_font = explode( ',', $font_value ); $google_font_value = str_replace( "'", '', $split_font[0] ); // Check if the cleaned font exists in the Google fonts array. $google_fonts = self::get_google_fonts(); if ( isset( $google_fonts[ $google_font_value ] ) ) { $font_value = $google_font_value; } return $font_value; } } }