芝麻web文件管理V1.00
编辑当前文件:/var/www/cognitio.in/wp-content/plugins/popup-maker/classes/Integration/GoogleFonts.php
false ] ) ); if ( ! is_wp_error( $response ) ) { $data = json_decode( $response, true ); } // Store transient for a long time after fetching from Google to save API key hits. $transient_time = self::$api_key === self::$default_api_key ? 8 * WEEK_IN_SECONDS : 1 * WEEK_IN_SECONDS; if ( ! empty( $data['errors'] ) || empty( $data['items'] ) ) { $data = self::load_backup_fonts(); // Store transient for short period. $transient_time = 1 * DAY_IN_SECONDS; } $items = $data['items']; $font_list = []; if ( count( $items ) ) { foreach ( $items as $item ) { $font_list[ $item['family'] ] = $item; } } set_site_transient( 'pum_google_fonts_list', $font_list, $transient_time ); return $font_list; } /** * Adds options to the font family dropdowns. * * @param $options * * @return array */ public static function font_family_options( $options ) { $font_list = self::fetch_fonts(); if ( empty( $font_list ) ) { return $options; } $new_options = []; // $options = array_merge( $options, array( // '' => __( 'Google Web Fonts', 'popup-maker' ) . ' ⤵', // ) ); foreach ( $font_list as $font_family => $font ) { $new_options[ $font_family ] = $font_family; } $options[ __( 'Google Web Fonts', 'popup-maker' ) ] = $new_options; return $options; } }