loading all variants? if ( true === self::$force_load_all_variants ) { $all_variants = Fonts::get_all_variants(); $args['choices']['variant'] = array_keys( $all_variants ); } if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { foreach ( $args['choices']['variant'] as $extra_variant ) { $this->fonts[ $value['font-family'] ][] = $extra_variant; } } return; } // Process non-typography fields. if ( isset( $args['output'] ) && is_array( $args['output'] ) ) { foreach ( $args['output'] as $output ) { // If we don't have a typography-related output argument we can skip this. if ( ! isset( $output['property'] ) || ! in_array( $output['property'], [ 'font-family', 'font-weight' ], true ) ) { continue; } // Get the value. $option_type = ( isset( $args['option_type'] ) ) ? $args['option_type'] : 'theme_mod'; $default = ( isset( $args['default'] ) ) ? $args['default'] : ''; $value = apply_filters( 'kirki_get_value', get_theme_mod( $args['settings'], $default ), $args['settings'], $default, $option_type ); if ( is_string( $value ) ) { if ( 'font-family' === $output['property'] ) { if ( ! array_key_exists( $value, $this->fonts ) ) { $this->fonts[ $value ] = []; } } elseif ( 'font-weight' === $output['property'] ) { foreach ( $this->fonts as $font => $variants ) { if ( ! in_array( $value, $variants, true ) ) { $this->fonts[ $font ][] = $value; } } } } } } } /** * Determines the vbalidity of the selected font as well as its properties. * This is vital to make sure that the google-font script that we'll generate later * does not contain any invalid options. */ public function process_fonts() { // Early exit if font-family is empty. if ( empty( $this->fonts ) ) { return; } foreach ( $this->fonts as $font => $variants ) { // Determine if this is indeed a google font or not. // If it's not, then just remove it from the array. if ( ! array_key_exists( $font, $this->google_fonts ) ) { unset( $this->fonts[ $font ] ); continue; } // Get all valid font variants for this font. $font_variants = []; if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { $font_variants = $this->google_fonts[ $font ]['variants']; } foreach ( $variants as $variant ) { // If this is not a valid variant for this font-family // then unset it and move on to the next one. if ( ! in_array( strval( $variant ), $font_variants, true ) ) { $variant_key = array_search( $variant, $this->fonts[ $font ], true ); unset( $this->fonts[ $font ][ $variant_key ] ); continue; } } } } /** * Get the standard fonts JSON. * * @since 1.0.0 * @return void */ public function get_standardfonts_json() { echo wp_json_encode( Fonts::get_standard_fonts() ); wp_die(); } } loading all variants? if ( true === self::$force_load_all_variants ) { $all_variants = Fonts::get_all_variants(); $args['choices']['variant'] = array_keys( $all_variants ); } if ( ! empty( $args['choices']['variant'] ) && is_array( $args['choices']['variant'] ) ) { foreach ( $args['choices']['variant'] as $extra_variant ) { $this->fonts[ $value['font-family'] ][] = $extra_variant; } } return; } // Process non-typography fields. if ( isset( $args['output'] ) && is_array( $args['output'] ) ) { foreach ( $args['output'] as $output ) { // If we don't have a typography-related output argument we can skip this. if ( ! isset( $output['property'] ) || ! in_array( $output['property'], [ 'font-family', 'font-weight' ], true ) ) { continue; } // Get the value. $option_type = ( isset( $args['option_type'] ) ) ? $args['option_type'] : 'theme_mod'; $default = ( isset( $args['default'] ) ) ? $args['default'] : ''; $value = apply_filters( 'kirki_get_value', get_theme_mod( $args['settings'], $default ), $args['settings'], $default, $option_type ); if ( is_string( $value ) ) { if ( 'font-family' === $output['property'] ) { if ( ! array_key_exists( $value, $this->fonts ) ) { $this->fonts[ $value ] = []; } } elseif ( 'font-weight' === $output['property'] ) { foreach ( $this->fonts as $font => $variants ) { if ( ! in_array( $value, $variants, true ) ) { $this->fonts[ $font ][] = $value; } } } } } } } /** * Determines the vbalidity of the selected font as well as its properties. * This is vital to make sure that the google-font script that we'll generate later * does not contain any invalid options. */ public function process_fonts() { // Early exit if font-family is empty. if ( empty( $this->fonts ) ) { return; } foreach ( $this->fonts as $font => $variants ) { // Determine if this is indeed a google font or not. // If it's not, then just remove it from the array. if ( ! array_key_exists( $font, $this->google_fonts ) ) { unset( $this->fonts[ $font ] ); continue; } // Get all valid font variants for this font. $font_variants = []; if ( isset( $this->google_fonts[ $font ]['variants'] ) ) { $font_variants = $this->google_fonts[ $font ]['variants']; } foreach ( $variants as $variant ) { // If this is not a valid variant for this font-family // then unset it and move on to the next one. if ( ! in_array( strval( $variant ), $font_variants, true ) ) { $variant_key = array_search( $variant, $this->fonts[ $font ], true ); unset( $this->fonts[ $font ][ $variant_key ] ); continue; } } } } /** * Get the standard fonts JSON. * * @since 1.0.0 * @return void */ public function get_standardfonts_json() { echo wp_json_encode( Fonts::get_standard_fonts() ); wp_die(); } }
Fatal error: Uncaught Error: Class "Kirki\Module\Webfonts\Google" not found in /htdocs/wp-content/plugins/kirki/kirki-packages/module-webfonts/src/Webfonts.php:62 Stack trace: #0 /htdocs/wp-includes/class-wp-hook.php(324): Kirki\Module\Webfonts->run('') #1 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /htdocs/wp-settings.php(726): do_action('wp_loaded') #4 /htdocs/wp-config.php(94): require_once('/htdocs/wp-sett...') #5 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #6 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #7 /htdocs/index.php(17): require('/htdocs/wp-blog...') #8 {main} thrown in /htdocs/wp-content/plugins/kirki/kirki-packages/module-webfonts/src/Webfonts.php on line 62