is_google_font() public static méthode

Determine if a font-name is a valid google font or not.
public static is_google_font ( string $fontname ) : boolean
$fontname string The name of the font we want to check.
Résultat boolean
Exemple #1
0
 /**
  * Enqueue scripts js or css
  *
  * @return void
  * @access public
  */
 public function enqueueScripts()
 {
     $font = $this->getValue();
     if (\Kirki_Fonts::is_google_font($font)) {
         $font_uri = \Kirki_Fonts::get_google_font_uri(array($font));
         wp_enqueue_style('googlefonts', $font_uri);
     }
 }
Exemple #2
0
 public function test_kirki_fonts()
 {
     $this->assertEquals(Kirki_Fonts::get_all_fonts(), Kirki_Toolkit::fonts()->get_all_fonts());
     $this->assertEquals(Kirki_Fonts::get_font_choices(), Kirki_Toolkit::fonts()->get_font_choices());
     $this->assertEquals(Kirki_Fonts::is_google_font('Open Sans'), Kirki_Toolkit::fonts()->is_google_font('Open Sans'));
     $this->assertEquals(Kirki_Fonts::get_google_font_uri(array('Roboto')), Kirki_Toolkit::fonts()->get_google_font_uri(array('Roboto')));
     $this->assertEquals(Kirki_Fonts::get_google_font_subsets(), Kirki_Toolkit::fonts()->get_google_font_subsets());
     $this->assertEquals(Kirki_Fonts::choose_google_font_variants('Roboto'), Kirki_Toolkit::fonts()->choose_google_font_variants('Roboto'));
     $this->assertEquals(Kirki_Fonts::get_standard_fonts(), Kirki_Toolkit::fonts()->get_standard_fonts());
     $this->assertEquals(Kirki_Fonts::get_font_stack(''), Kirki_Toolkit::fonts()->get_font_stack(''));
     $this->assertEquals(Kirki_Fonts::sanitize_font_choice(''), Kirki_Toolkit::fonts()->sanitize_font_choice(''));
     $this->assertEquals(Kirki_Fonts::get_google_fonts(), Kirki_Toolkit::fonts()->get_google_fonts());
 }
 public function test()
 {
     $this->assertEquals(kirki_get_option(), Kirki::get_option());
     $this->assertEquals(kirki_sanitize_hex('#ffffff'), Kirki_Color::sanitize_hex('#ffffff'));
     $this->assertEquals(kirki_get_rgb('#ffffff'), Kirki_Color::get_rgb('#ffffff'));
     $this->assertEquals(kirki_get_rgba('#ffffff'), Kirki_Color::get_rgba('#ffffff'));
     $this->assertEquals(kirki_get_brightness('#ffffff'), Kirki_Color::get_brightness('#ffffff'));
     $font_registry = Kirki_Toolkit::fonts();
     $this->assertEquals(Kirki_Fonts::get_all_fonts(), $font_registry->get_all_fonts());
     $this->assertEquals(Kirki_Fonts::get_font_choices(), $font_registry->get_font_choices());
     $this->assertEquals(Kirki_Fonts::is_google_font('foo'), $font_registry->is_google_font('foo'));
     $this->assertEquals(Kirki_Fonts::get_google_font_uri(array('foo')), $font_registry->get_google_font_uri(array('foo')));
     $this->assertEquals(Kirki_Fonts::get_google_font_subsets(), $font_registry->get_google_font_subsets());
     $this->assertEquals(Kirki_Fonts::choose_google_font_variants('Roboto'), $font_registry->choose_google_font_variants('Roboto'));
     $this->assertEquals(Kirki_Fonts::get_standard_fonts(), $font_registry->get_standard_fonts());
     $this->assertEquals(Kirki_Fonts::get_font_stack('foo'), $font_registry->get_font_stack('foo'));
     $this->assertEquals(Kirki_Fonts::sanitize_font_choice('foo'), $font_registry->sanitize_font_choice('foo'));
     $this->assertEquals(Kirki_Fonts::get_google_fonts(), $font_registry->get_google_fonts());
 }