本文整理汇总了PHP中siteorigin_widget_get_font函数的典型用法代码示例。如果您正苦于以下问题:PHP siteorigin_widget_get_font函数的具体用法?PHP siteorigin_widget_get_font怎么用?PHP siteorigin_widget_get_font使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了siteorigin_widget_get_font函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_less_variables
function get_less_variables($instance)
{
$less_vars = array();
$fonts = $instance['fonts'];
$styleable_text_fields = array('title', 'text', 'more_text');
foreach ($styleable_text_fields as $field_name) {
if (!empty($fonts[$field_name . '_options'])) {
$styles = $fonts[$field_name . '_options'];
if (!empty($styles['size'])) {
$less_vars[$field_name . '_size'] = $styles['size'];
}
if (!empty($styles['color'])) {
$less_vars[$field_name . '_color'] = $styles['color'];
}
if (!empty($styles['font'])) {
$font = siteorigin_widget_get_font($styles['font']);
$less_vars[$field_name . '_font'] = $font['family'];
if (!empty($font['weight'])) {
$less_vars[$field_name . '_font_weight'] = $font['weight'];
}
}
}
}
return $less_vars;
}
示例2: get_less_variables
function get_less_variables($instance)
{
$less_vars = array();
if (!empty($instance['headline'])) {
$headline_styles = $instance['headline'];
if (!empty($headline_styles['tag'])) {
$less_vars['headline_tag'] = $headline_styles['tag'];
}
if (!empty($headline_styles['align'])) {
$less_vars['headline_align'] = $headline_styles['align'];
}
if (!empty($headline_styles['color'])) {
$less_vars['headline_color'] = $headline_styles['color'];
}
if (!empty($headline_styles['font'])) {
$font = siteorigin_widget_get_font($headline_styles['font']);
$less_vars['headline_font'] = $font['family'];
if (!empty($font['weight'])) {
$less_vars['headline_font_weight'] = $font['weight'];
}
}
}
if (!empty($instance['sub_headline'])) {
$sub_headline_styles = $instance['sub_headline'];
if (!empty($sub_headline_styles['align'])) {
$less_vars['sub_headline_align'] = $sub_headline_styles['align'];
}
if (!empty($sub_headline_styles['tag'])) {
$less_vars['sub_headline_tag'] = $sub_headline_styles['tag'];
}
if (!empty($sub_headline_styles['color'])) {
$less_vars['sub_headline_color'] = $sub_headline_styles['color'];
}
if (!empty($sub_headline_styles['font'])) {
$font = siteorigin_widget_get_font($sub_headline_styles['font']);
$less_vars['sub_headline_font'] = $font['family'];
if (!empty($font['weight'])) {
$less_vars['sub_headline_font_weight'] = $font['weight'];
}
}
}
if (!empty($instance['divider'])) {
$divider_styles = $instance['divider'];
if (!empty($divider_styles['style'])) {
$less_vars['divider_style'] = $divider_styles['style'];
}
if (!empty($divider_styles['weight'])) {
$less_vars['divider_weight'] = $divider_styles['weight'];
}
if (!empty($divider_styles['color'])) {
$less_vars['divider_color'] = $divider_styles['color'];
}
}
return $less_vars;
}
示例3: get_less_variables
function get_less_variables($instance)
{
if (empty($instance['design']['labels']['font'])) {
$instance['design']['labels'] = array('font' => '');
}
$font = siteorigin_widget_get_font($instance['design']['labels']['font']);
$label_position = $instance['design']['labels']['position'];
if ($label_position != 'left' && $label_position != 'right') {
$label_position = 'default';
}
$vars = array('container_background' => $instance['design']['container']['background'], 'container_padding' => $instance['design']['container']['padding'], 'container_border_color' => $instance['design']['container']['border_color'], 'container_border_width' => $instance['design']['container']['border_width'], 'container_border_style' => $instance['design']['container']['border_style'], 'label_font_family' => $font['family'], 'label_font_weight' => !empty($font['weight']) ? $font['weight'] : '', 'label_font_size' => $instance['design']['labels']['size'], 'label_font_color' => $instance['design']['labels']['color'], 'label_position' => $label_position, 'label_width' => $instance['design']['labels']['width'], 'label_align' => $instance['design']['labels']['align'], 'error_background' => $instance['design']['errors']['background'], 'error_border' => $instance['design']['errors']['border_color'], 'error_text' => $instance['design']['errors']['text_color'], 'error_padding' => $instance['design']['errors']['padding'], 'error_margin' => $instance['design']['errors']['margin'], 'submit_background_color' => $instance['design']['submit']['background_color'], 'submit_background_gradient' => $instance['design']['submit']['background_gradient'] . '%', 'submit_border_color' => $instance['design']['submit']['border_color'], 'submit_border_style' => $instance['design']['submit']['border_style'], 'submit_border_width' => $instance['design']['submit']['border_width'], 'submit_border_radius' => $instance['design']['submit']['border_radius'] . 'px', 'submit_text_color' => $instance['design']['submit']['text_color'], 'submit_font_size' => $instance['design']['submit']['font_size'], 'submit_weight' => $instance['design']['submit']['weight'], 'submit_padding' => $instance['design']['submit']['padding'], 'submit_inset_highlight' => $instance['design']['submit']['inset_highlight'] . '%', 'outline_style' => $instance['design']['focus']['style'], 'outline_color' => $instance['design']['focus']['color'], 'outline_width' => $instance['design']['focus']['width']);
return $vars;
}
示例4: less_import_google_font
/**
* Less function for importing Google web fonts.
*
* @param $instance
* @param $args
*
* @return string
*/
function less_import_google_font($instance, $args)
{
if (empty($instance)) {
return;
}
$font_imports = array(siteorigin_widget_get_font($instance['headline']['font']), siteorigin_widget_get_font($instance['sub_headline']['font']));
$import_strings = array();
foreach ($font_imports as $import) {
$import_strings[] = !empty($import['css_import']) ? empty($import['css_import']) : '';
}
// Remove empty and duplicate items from the array
$import_strings = array_filter($import_strings);
$import_strings = array_unique($import_strings);
return implode("\n", $import_strings);
}
示例5: get_less_variables
function get_less_variables($instance)
{
$less_vars = array();
// All the headline attributes
$less_vars['headline_tag'] = isset($instance['headline']['tag']) ? $instance['headline']['tag'] : false;
$less_vars['headline_align'] = isset($instance['headline']['align']) ? $instance['headline']['align'] : false;
$less_vars['headline_color'] = isset($instance['headline']['color']) ? $instance['headline']['color'] : false;
$less_vars['headline_font_size'] = isset($instance['headline']['font_size']) ? $instance['headline']['font_size'] : false;
$less_vars['headline_line_height'] = isset($instance['headline']['line_height']) ? $instance['headline']['line_height'] : false;
$less_vars['headline_margin'] = isset($instance['headline']['margin']) ? $instance['headline']['margin'] : false;
// Headline font family and weight
if (!empty($instance['headline']['font'])) {
$font = siteorigin_widget_get_font($instance['headline']['font']);
$less_vars['headline_font'] = $font['family'];
if (!empty($font['weight'])) {
$less_vars['headline_font_weight'] = $font['weight'];
}
}
// Set the sub headline attributes
$less_vars['sub_headline_align'] = isset($instance['sub_headline']['align']) ? $instance['sub_headline']['align'] : false;
$less_vars['sub_headline_tag'] = isset($instance['sub_headline']['tag']) ? $instance['sub_headline']['tag'] : false;
$less_vars['sub_headline_color'] = isset($instance['sub_headline']['color']) ? $instance['sub_headline']['color'] : false;
$less_vars['sub_headline_font_size'] = isset($instance['sub_headline']['font_size']) ? $instance['sub_headline']['font_size'] : false;
$less_vars['sub_headline_line_height'] = isset($instance['sub_headline']['line_height']) ? $instance['sub_headline']['line_height'] : false;
$less_vars['sub_headline_margin'] = isset($instance['sub_headline']['margin']) ? $instance['sub_headline']['margin'] : false;
// Sub headline font family and weight
if (!empty($instance['sub_headline']['font'])) {
$font = siteorigin_widget_get_font($instance['sub_headline']['font']);
$less_vars['sub_headline_font'] = $font['family'];
if (!empty($font['weight'])) {
$less_vars['sub_headline_font_weight'] = $font['weight'];
}
}
$less_vars['divider_style'] = isset($instance['divider']['style']) ? $instance['divider']['style'] : false;
$less_vars['divider_width'] = isset($instance['divider']['width']) ? $instance['divider']['width'] : false;
$less_vars['divider_thickness'] = isset($instance['divider']['thickness']) ? intval($instance['divider']['thickness']) . 'px' : false;
$less_vars['divider_align'] = isset($instance['divider']['align']) ? $instance['divider']['align'] : false;
$less_vars['divider_color'] = isset($instance['divider']['color']) ? $instance['divider']['color'] : false;
$less_vars['divider_margin'] = isset($instance['divider']['margin']) ? $instance['divider']['margin'] : false;
return $less_vars;
}
示例6: less_import_google_font
/**
* Less function for importing Google web fonts.
*
* @param $instance
* @param $args
*
* @return string
*/
function less_import_google_font($instance, $args)
{
if (empty($instance)) {
return;
}
$font_import = siteorigin_widget_get_font($instance['design']['heading_font']);
if (!empty($font_import['css_import'])) {
return $font_import['css_import'];
}
}
示例7: less_import_google_font
/**
* Less function for importing Google web fonts.
*
* @param $instance
* @param $args
*
* @return string
*/
function less_import_google_font($instance, $args)
{
if (empty($instance)) {
return;
}
$fonts = $this->get_google_font_fields($instance);
$font_imports = array();
foreach ($fonts as $font) {
$font_imports[] = siteorigin_widget_get_font($font);
}
$import_strings = array();
foreach ($font_imports as $import) {
$import_strings[] = !empty($import['css_import']) ? $import['css_import'] : '';
}
// Remove empty and duplicate items from the array
$import_strings = array_filter($import_strings);
$import_strings = array_unique($import_strings);
return implode("\n", $import_strings);
}