get_standard_fonts() public static méthode

Return an array of standard websafe fonts.
public static get_standard_fonts ( ) : array
Résultat array Standard websafe fonts.
Exemple #1
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());
 }
 /**
  * Assets that have to be enqueued in 'customize_controls_enqueue_scripts'.
  */
 public function customize_controls_enqueue_scripts()
 {
     // Get an array of all our fields.
     $fields = Kirki::$fields;
     // Do we have tooltips anywhere?
     $has_tooltips = false;
     foreach ($fields as $field) {
         if ($has_tooltips) {
             continue;
         }
         // Field has tooltip.
         if (isset($field['tooltip']) && !empty($field['tooltip'])) {
             $has_tooltips = true;
         }
         // Backwards-compatibility ("help" argument instead of "tooltip").
         if (isset($field['help']) && !empty($field['help'])) {
             $has_tooltips = true;
         }
     }
     // If we have tooltips, enqueue the tooltips script.
     /* TODO: if ( $has_tooltips ) { */
     wp_enqueue_script('kirki-tooltip', trailingslashit(Kirki::$url) . 'assets/js/tooltip.js', array('jquery', 'customize-controls', 'jquery-ui-tooltip'));
     /* TODO: } */
     // Enqueue the reset script.
     wp_enqueue_script('kirki-reset', trailingslashit(Kirki::$url) . 'assets/js/reset.js', array('jquery', 'kirki-set-setting-value'));
     // Register kirki-functions.
     wp_register_script('kirki-set-setting-value', trailingslashit(Kirki::$url) . 'assets/js/functions/set-setting-value.js');
     wp_register_script('kirki-validate-css-value', trailingslashit(Kirki::$url) . 'assets/js/functions/validate-css-value.js');
     wp_register_script('kirki-notifications', trailingslashit(Kirki::$url) . 'assets/js/functions/notifications.js', array('kirki-l10n', 'kirki-validate-css-value'));
     // Register serialize.js.
     wp_register_script('serialize-js', trailingslashit(Kirki::$url) . 'assets/js/vendor/serialize.js');
     // Register the color-alpha picker.
     wp_enqueue_style('wp-color-picker');
     wp_register_script('wp-color-picker-alpha', trailingslashit(Kirki::$url) . 'assets/js/vendor/wp-color-picker-alpha.js', array('wp-color-picker'), '1.2', true);
     // Register the jquery-ui-spinner.
     wp_register_script('jquery-ui-spinner', trailingslashit(Kirki::$url) . 'assets/js/vendor/jquery-ui-spinner', array('jquery', 'jquery-ui-core', 'jquery-ui-button'));
     // Register codemirror.
     wp_register_script('codemirror', trailingslashit(Kirki::$url) . 'assets/js/vendor/codemirror/lib/codemirror.js', array('jquery'));
     // Register selectize.
     wp_register_script('selectize', trailingslashit(Kirki::$url) . 'assets/js/vendor/selectize.js', array('jquery'));
     // An array of control scripts and their dependencies.
     $scripts = array('checkbox' => array('jquery', 'customize-base'), 'code' => array('jquery', 'customize-base', 'codemirror'), 'color' => array('jquery', 'customize-base', 'wp-color-picker-alpha'), 'color-palette' => array('jquery', 'customize-base', 'jquery-ui-button'), 'dashicons' => array('jquery', 'customize-base'), 'date' => array('jquery', 'customize-base', 'jquery-ui-datepicker'), 'dimension' => array('jquery', 'customize-base', 'kirki-notifications'), 'dropdown-pages' => array('jquery', 'customize-base', 'selectize'), 'editor' => array('jquery', 'customize-base', 'kirki-l10n'), 'generic' => array('jquery', 'customize-base'), 'multicheck' => array('jquery', 'customize-base'), 'multicolor' => array('jquery', 'customize-base', 'wp-color-picker-alpha'), 'number' => array('jquery', 'customize-base', 'jquery-ui-spinner'), 'palette' => array('jquery', 'customize-base', 'jquery-ui-button'), 'preset' => array('jquery', 'customize-base', 'selectize', 'kirki-set-setting-value'), 'radio-buttonset' => array('jquery', 'customize-base'), 'radio-image' => array('jquery', 'customize-base'), 'radio' => array('jquery', 'customize-base'), 'repeater' => array('jquery', 'customize-base', 'jquery-ui-core', 'jquery-ui-sortable', 'kirki-l10n'), 'select' => array('jquery', 'customize-base', 'selectize'), 'slider' => array('jquery', 'customize-base'), 'sortable' => array('jquery', 'customize-base', 'jquery-ui-core', 'jquery-ui-sortable', 'serialize-js'), 'spacing' => array('jquery', 'customize-base', 'kirki-notifications'), 'switch' => array('jquery', 'customize-base'), 'toggle' => array('jquery', 'customize-base'), 'typography' => array('jquery', 'customize-base', 'selectize', 'wp-color-picker-alpha'));
     foreach ($scripts as $id => $dependencies) {
         wp_register_script('kirki-' . $id, trailingslashit(Kirki::$url) . 'assets/js/controls/' . $id . '.js', $dependencies, false, true);
     }
     // Add fonts to our JS objects.
     $google_fonts = Kirki_Fonts::get_google_fonts();
     $standard_fonts = Kirki_Fonts::get_standard_fonts();
     $all_variants = Kirki_Fonts::get_all_variants();
     $all_subsets = Kirki_Fonts::get_google_font_subsets();
     $standard_fonts_final = array();
     foreach ($standard_fonts as $key => $value) {
         $standard_fonts_final[] = array('family' => $value['stack'], 'label' => $value['label'], 'subsets' => array(), 'is_standard' => true, 'variants' => array(array('id' => 'regular', 'label' => $all_variants['regular']), array('id' => 'italic', 'label' => $all_variants['italic']), array('id' => '700', 'label' => $all_variants['700']), array('id' => '700italic', 'label' => $all_variants['700italic'])));
     }
     $google_fonts_final = array();
     foreach ($google_fonts as $family => $args) {
         $label = isset($args['label']) ? $args['label'] : $family;
         $variants = isset($args['variants']) ? $args['variants'] : array('regular', '700');
         $subsets = isset($args['subsets']) ? $args['subsets'] : array();
         $available_variants = array();
         foreach ($variants as $variant) {
             if (array_key_exists($variant, $all_variants)) {
                 $available_variants[] = array('id' => $variant, 'label' => $all_variants[$variant]);
             }
         }
         $available_subsets = array();
         foreach ($subsets as $subset) {
             if (array_key_exists($subset, $all_subsets)) {
                 $available_subsets[] = array('id' => $subset, 'label' => $all_subsets[$subset]);
             }
         }
         $google_fonts_final[] = array('family' => $family, 'label' => $label, 'variants' => $available_variants, 'subsets' => $available_subsets);
     }
     $final = array_merge($standard_fonts_final, $google_fonts_final);
     wp_localize_script('kirki-typography', 'kirkiAllFonts', $final);
 }