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


PHP Kirki::get_config_id方法代码示例

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


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

示例1: css

 /**
  * The class constructor.
  *
  * @var 	string		the setting ID.
  * @var 	string		theme_mod / option
  * @var 	array 		an array of arrays of the output arguments.
  * @var 	mixed		a callable function.
  */
 public static function css($field)
 {
     /**
      * Make sure the field is sanitized before proceeding any further.
      */
     $field = Kirki_Field::sanitize_field($field);
     /**
      * Get the config ID used in the Kirki class.
      */
     $config_id = Kirki::get_config_id($field);
     /**
      * Set class vars
      */
     self::$settings = $field['settings'];
     self::$output = $field['output'];
     self::$callback = $field['sanitize_callback'];
     /**
      * Get the value of this field
      */
     if ('option' == Kirki::$config[$config_id]['option_type'] && '' != Kirki::$config[$config_id]['option_name']) {
         self::$value = Kirki::get_option($config_id, str_replace(array(']', Kirki::$config[$config_id]['option_name'] . '['), '', $field['settings']));
     } else {
         self::$value = Kirki::get_option($config_id, $field['settings']);
     }
     /**
      * Returns the styles
      */
     if (!is_array(self::$value)) {
         return self::styles();
     }
 }
开发者ID:nikoz84,项目名称:kirki,代码行数:39,代码来源:class-kirki-output.php

示例2: 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


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