当前位置: 首页>>代码示例>>PHP>>正文


PHP Kirki_Toolkit::fonts方法代码示例

本文整理汇总了PHP中Kirki_Toolkit::fonts方法的典型用法代码示例。如果您正苦于以下问题:PHP Kirki_Toolkit::fonts方法的具体用法?PHP Kirki_Toolkit::fonts怎么用?PHP Kirki_Toolkit::fonts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Kirki_Toolkit的用法示例。


在下文中一共展示了Kirki_Toolkit::fonts方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_kirki_fonts

 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());
 }
开发者ID:1bigidea,项目名称:kirki,代码行数:13,代码来源:test-deprecated.php

示例2: test

 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());
 }
开发者ID:quintenm,项目名称:maresthema-2016,代码行数:19,代码来源:test-deprecated.php

示例3: google_link

 public function google_link()
 {
     /**
      * Get the array of fields from the Kirki object.
      */
     $fields = Kirki::$fields;
     /**
      * Early exit if no fields are found.
      */
     if (empty($fields)) {
         return;
     }
     $fonts = array();
     /**
      * Run a loop for our fields
      */
     foreach ($fields as $field) {
         /**
          * No reason to proceed any further if no 'output' has been defined
          * or if it's not defined as an array.
          */
         if (!isset($field['output']) || !is_array($field['output'])) {
             continue;
         }
         /**
          * Run through each of our "output" items in the array separately.
          */
         foreach ($field['output'] as $output) {
             $valid = false;
             /**
              * If the field-type exists and is set to "typography"
              * then we need some extra checks to figure out if we need to proceed.
              */
             if (isset($field['type']) && 'typography' == $field['type']) {
                 if (isset($field['choices']) && isset($field['choices']['font-family']) && $field['choices']['font-family']) {
                     $valid = true;
                 }
             }
             /**
              * Check if the "property" of this item is related to typography.
              */
             if (isset($output['property']) && in_array($output['property'], array('font-family', 'font-weight', 'font-subset'))) {
                 $valid = true;
             }
             /**
              * If the $valid var is not true, then we don't need to proceed.
              * Continue to the next item in the array.
              */
             if (!$valid) {
                 continue;
             }
             /**
              * Get the value of this field
              */
             $value = Kirki_Values::get_sanitized_field_value($field);
             /**
              * Typography fields arew a bit more complex than usual fields.
              * We need to get the sub-items of the array
              * and then base our calculations on these.
              */
             if ('typography' == $field['type']) {
                 /**
                  * Add the font-family to the array
                  */
                 if (isset($value['font-family'])) {
                     $fonts[]['font-family'] = $value['font-family'];
                 }
                 /**
                  * Add the font-weight to the array
                  */
                 if (isset($value['font-weight'])) {
                     $fonts[]['font-weight'] = $value['font-weight'];
                 }
             } else {
                 if ('font-family' == $output['property']) {
                     /**
                      * Add the font-family to the array
                      */
                     $fonts[]['font-family'] = $value;
                 } else {
                     if ('font-weight' == $output['property']) {
                         /**
                          * Add font-weight to the array
                          */
                         $fonts[]['font-weight'] = $value;
                     } else {
                         if ('font-subset' == $output['property']) {
                             /**
                              * add font subsets to the array
                              */
                             $fonts[]['subsets'] = $value;
                         }
                     }
                 }
             }
         }
     }
     /**
      * Start going through all the items in the $fonts array.
      */
//.........这里部分代码省略.........
开发者ID:quintenm,项目名称:maresthema-2016,代码行数:101,代码来源:class-kirki-google-fonts-scripts.php

示例4: google_link

 public function google_link()
 {
     // Get the array of fields
     $fields = Kirki::$fields;
     // Early exit if no fields are found.
     if (empty($fields)) {
         return;
     }
     $fonts = array();
     foreach ($fields as $field) {
         /**
          * Sanitize the field
          */
         $field = Kirki_Field::sanitize_field($field);
         if (!is_array($field['output'])) {
             continue;
         }
         foreach ($field['output'] as $output) {
             if (in_array($output['property'], array('font-family', 'font-weight', 'font-subset'))) {
                 /**
                  * Get the value of the field
                  */
                 $config_id = Kirki::get_config_id($field);
                 $settings = $field['settings'];
                 if ('option' == Kirki::$config[$config_id]['option_type'] && '' != Kirki::$config[$config_id]['option_name']) {
                     $settings = str_replace(array(']', Kirki::$config[$config_id]['option_name'] . '['), '', $field['settings']);
                 }
                 $value = Kirki::get_option($config_id, $settings);
                 if ('font-family' == $output['property']) {
                     /**
                      * Add the font-family to the array
                      */
                     $fonts[]['font-family'] = $value;
                 } else {
                     if ('font-weight' == $output['property']) {
                         /**
                          * Add font-weight to the array
                          */
                         $fonts[]['font-weight'] = $value;
                     } else {
                         if ('font-subset' == $output['property']) {
                             /**
                              * add font subsets to the array
                              */
                             $fonts[]['subsets'] = $value;
                         }
                     }
                 }
             }
         }
     }
     foreach ($fonts as $font) {
         // Do we have font-families?
         if (isset($font['font-family'])) {
             $font_families = !isset($font_families) ? array() : $font_families;
             $font_families[] = $font['font-family'];
             if (Kirki_Toolkit::fonts()->is_google_font($font['font-family'])) {
                 $has_google_font = true;
             }
         }
         // Do we have font-weights?
         if (isset($font['font-weight'])) {
             $font_weights = !isset($font_weights) ? array() : $font_weights;
             $font_weights[] = $font['font-weight'];
         }
         // Do we have font-subsets?
         if (isset($font['subsets'])) {
             $font_subsets = !isset($font_subsets) ? array() : $font_subsets;
             $font_subsets[] = $font['subsets'];
         }
     }
     // Make sure there are no empty values and define defaults.
     $font_families = !isset($font_families) || empty($font_families) ? false : $font_families;
     $font_weights = !isset($font_weights) || empty($font_weights) ? '400' : $font_weights;
     $font_subsets = !isset($font_subsets) || empty($font_subsets) ? 'all' : $font_subsets;
     if (!isset($has_google_font) || !$has_google_font) {
         $font_families = false;
     }
     // Return the font URL.
     return $font_families ? Kirki_Toolkit::fonts()->get_google_font_uri($font_families, $font_weights, $font_subsets) : false;
 }
开发者ID:Neminath,项目名称:lastmile,代码行数:81,代码来源:class-kirki-scripts-frontend-google-fonts.php

示例5: get_google_fonts

 public static function get_google_fonts()
 {
     $font_registry = Kirki_Toolkit::fonts();
     return $font_registry->get_google_fonts();
 }
开发者ID:wpmu,项目名称:maera,代码行数:5,代码来源:deprecated.php

示例6: google_link

 public function google_link()
 {
     // Get the array of fields
     $fields = Kirki::$fields;
     // Early exit if no fields are found.
     if (empty($fields)) {
         return;
     }
     $fonts = array();
     foreach ($fields as $field) {
         // Sanitize the field's output & settings_raw items.
         $field['output'] = Kirki_Field::sanitize_output($field);
         $field['settings_raw'] = Kirki_Field::sanitize_settings_raw($field);
         // Make sure output is properly formatted
         if (isset($field['output']) && is_array($field['output'])) {
             foreach ($field['output'] as $output) {
                 if (in_array($output['property'], array('font-family', 'font-weight', 'font-subset'))) {
                     // The value of this control
                     $value = Kirki::get_option($field['settings_raw']);
                     if ('font-family' == $output['property']) {
                         // Add the font-family to the array
                         $fonts[]['font-family'] = $value;
                     } else {
                         if ('font-weight' == $output['property']) {
                             // Add font-weight to the array
                             $fonts[]['font-weight'] = $value;
                         } else {
                             if ('font-subset' == $output['property']) {
                                 // add font subsets to the array
                                 $fonts[]['subsets'] = $value;
                             }
                         }
                     }
                 }
             }
         }
     }
     foreach ($fonts as $font) {
         // Do we have font-families?
         if (isset($font['font-family'])) {
             $font_families = !isset($font_families) ? array() : $font_families;
             $font_families[] = $font['font-family'];
             if (Kirki_Toolkit::fonts()->is_google_font($font['font-family'])) {
                 $has_google_font = true;
             }
         }
         // Do we have font-weights?
         if (isset($font['font-weight'])) {
             $font_weights = !isset($font_weights) ? array() : $font_weights;
             $font_weights[] = $font['font-weight'];
         }
         // Do we have font-subsets?
         if (isset($font['subsets'])) {
             $font_subsets = !isset($font_subsets) ? array() : $font_subsets;
             $font_subsets[] = $font['subsets'];
         }
     }
     // Make sure there are no empty values and define defaults.
     $font_families = !isset($font_families) || empty($font_families) ? false : $font_families;
     $font_weights = !isset($font_weights) || empty($font_weights) ? '400' : $font_weights;
     $font_subsets = !isset($font_subsets) || empty($font_subsets) ? 'all' : $font_subsets;
     if (!isset($has_google_font) || !$has_google_font) {
         $font_families = false;
     }
     // Return the font URL.
     return $font_families ? Kirki_Toolkit::fonts()->get_google_font_uri($font_families, $font_weights, $font_subsets) : false;
 }
开发者ID:wpmu,项目名称:maera,代码行数:67,代码来源:class-kirki-scripts-frontend-google-fonts.php


注:本文中的Kirki_Toolkit::fonts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。