本文整理汇总了PHP中Kirki::fonts方法的典型用法代码示例。如果您正苦于以下问题:PHP Kirki::fonts方法的具体用法?PHP Kirki::fonts怎么用?PHP Kirki::fonts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kirki
的用法示例。
在下文中一共展示了Kirki::fonts方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: google_link
function google_link()
{
$fields = Kirki::fields()->get_all();
// Early exit if no fields are found.
if (!$fields || empty($fields)) {
return;
}
// Get an array of all the google fonts
$google_fonts = Kirki::fonts()->get_google_fonts();
$fonts = array();
foreach ($fields as $field) {
if (isset($field['output'])) {
// Check if this is a font-family control
$is_font_family = isset($field['output']['property']) && 'font-family' == $field['output']['property'] ? true : false;
// Check if this is a font-weight control
$is_font_weight = isset($field['output']['property']) && 'font-weight' == $field['output']['property'] ? true : false;
// Check if this is a font subset control
$is_font_subset = isset($field['output']['property']) && 'font-subset' == $field['output']['property'] ? true : false;
if ($is_font_family || $is_font_weight || $is_font_subset) {
// The value of this control
$value = kirki_get_option($field['settings_raw']);
if ($is_font_family) {
$fonts[]['font-family'] = $value;
} else {
if ($is_font_weight) {
$fonts[]['font-weight'] = $value;
} else {
if ($is_font_subset) {
$fonts[]['subsets'] = $value;
}
}
}
}
}
}
foreach ($fonts as $font) {
if (isset($font['font-family'])) {
$font_families = !isset($font_families) ? array() : $font_families;
$font_families[] = $font['font-family'];
if (Kirki::fonts()->is_google_font($font['font-family'])) {
$has_google_font = true;
}
}
if (isset($font['font-weight'])) {
$font_weights = !isset($font_weights) ? array() : $font_weights;
$font_weights[] = $font['font-weight'];
}
if (isset($font['subsets'])) {
$font_subsets = !isset($font_subsets) ? array() : $font_subsets;
$font_subsets[] = $font['subsets'];
}
}
$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 $font_families ? Kirki::fonts()->get_google_font_uri($font_families, $font_weights, $font_subsets) : false;
}
开发者ID:rsantellan,项目名称:wordpress-ecommerce,代码行数:60,代码来源:class-kirki-scripts-frontend-google-fonts.php
示例2: get_google_fonts
public static function get_google_fonts()
{
$font_registry = Kirki::fonts();
return $font_registry->get_google_fonts();
}