public function get_google_font($font)
 {
     $google_fonts = fw_get_google_fonts_v2();
     $google_fonts = false === $google_fonts ? array() : json_decode($google_fonts);
     foreach ($google_fonts->items as $g_font) {
         if ($font === $g_font->family) {
             return $g_font;
         }
     }
     return false;
 }
 /**
  * Returns fonts
  * @return array
  */
 public function get_fonts()
 {
     $cache_key = 'fw_option_type/' . $this->get_type();
     try {
         return FW_Cache::get($cache_key);
     } catch (FW_Cache_Not_Found_Exception $e) {
         $fonts = array('standard' => apply_filters('fw_option_type_typography_v2_standard_fonts', array("Arial", "Verdana", "Trebuchet", "Georgia", "Times New Roman", "Tahoma", "Palatino", "Helvetica", "Calibri", "Myriad Pro", "Lucida", "Arial Black", "Gill Sans", "Geneva", "Impact", "Serif")), 'google' => json_decode(fw_get_google_fonts_v2(), true));
         FW_Cache::set($cache_key, $fonts);
         return $fonts;
     }
 }
Esempio n. 3
0
/**
 * @return Array with Google fonts
 */
function fw_get_google_fonts()
{
    $cache_key = 'fw_google_fonts';
    try {
        return FW_Cache::get($cache_key);
    } catch (FW_Cache_Not_Found_Exception $e) {
        $g_fonts = json_decode(fw_get_google_fonts_v2(), true);
        $old_fonts = (include dirname(__FILE__) . '/fw-google-fonts.json.php');
        $fonts = array();
        foreach ($g_fonts['items'] as $font) {
            $fonts[$font['family']] = array('family' => $font['family'], 'variants' => $font['variants'], 'position' => isset($old_fonts[$font['family']]) ? $old_fonts[$font['family']]['position'] : 99999);
        }
        $fonts = apply_filters('fw_google_fonts', $fonts);
        FW_Cache::set($cache_key, $fonts);
        return $fonts;
    }
}