本文整理汇总了PHP中of_recognized_font_sizes函数的典型用法代码示例。如果您正苦于以下问题:PHP of_recognized_font_sizes函数的具体用法?PHP of_recognized_font_sizes怎么用?PHP of_recognized_font_sizes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了of_recognized_font_sizes函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optionsframework_fields
//.........这里部分代码省略.........
$checked = '';
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-' . $option;
$name = $option_name . '[' . $value['id'] . '][' . $option . ']';
if (isset($val[$option])) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
}
break;
// Color picker
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color" type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
break;
// Uploader
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例2: optionsframework_fields
//.........这里部分代码省略.........
break;
// Multicheck
// Multicheck
case "multicheck":
foreach ($value['options'] as $key => $option) {
$checked = '';
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-' . $option;
$name = $option_name . '[' . $value['id'] . '][' . $option . ']';
if (isset($val[$option])) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
}
break;
// Color picker
// Color picker
case "color":
$output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
$output .= '<input class="of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
break;
// Uploader
// Uploader
case "upload":
$output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例3: of_sanitize_font_size
function of_sanitize_font_size($value)
{
$recognized = of_recognized_font_sizes();
$value = preg_replace('/px/', '', $value);
if (in_array((int) $value, $recognized)) {
return (int) $value;
}
return (int) apply_filters('of_default_font_size', $recognized);
}
示例4: optionsframework_fields
//.........这里部分代码省略.........
}
break;
// Color picker
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color" type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
break;
// Uploader
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break;
// Install Demo
// Install Demo
case 'demo':
$output .= '<a href="#">' . __('Install Demo', 'accesspress-mag') . '</a>';
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => $value['size'] . "px", 'face' => $value['face'], 'style' => $value['style'], 'color' => $value['color']);
$typography_stored = wp_parse_args($val, $typography_defaults);
$accesspress_pro_font_list = get_option('accesspress_mag_google_font');
$font_family = $typography_stored['face'];
$font_array = accesspress_search_key($accesspress_pro_font_list, 'family', $font_family);
$variants_array = $font_array['0']['variants'];
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => $variants_array, 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例5: optionsframework_fields
//.........这里部分代码省略.........
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-' . $option;
$name = $option_name . '[' . $value['id'] . '][' . $option . ']';
if (isset($val[$option])) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
}
break;
// Color picker
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color" type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
break;
// Uploader
// Uploader
case "upload":
$mode = isset($value['mode']) ? $value['mode'] : 'uri_only';
$output .= optionsframework_uploader($value['id'], $val, $mode, null);
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例6: optionsframework_fields
//.........这里部分代码省略.........
$checked = '';
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-' . $option;
$name = $option_name . '[' . $value['id'] . '][' . $option . ']';
if (isset($val[$option])) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
}
break;
// Color picker
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color" type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
break;
// Uploader
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例7: optionsframework_fields
//.........这里部分代码省略.........
$checked = '';
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-' . $option;
$name = $option_name . '[' . $value['id'] . '][' . $option . ']';
if (isset($val[$option])) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input vpanel_multicheck" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . '><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
}
break;
// Color picker
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color ' . (isset($value['class']) ? esc_attr($value['class']) : '') . '" type="text" value="' . esc_attr($val) . '"' . $default_color . '>';
break;
// Uploader
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . (is_string($typography_stored['size']) ? selected($typography_stored['size'], $size, false) : "") . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例8: optionsframework_fields
//.........这里部分代码省略.........
break;
// Color picker
// Color picker
case "color":
$output .= '<div id="' . esc_attr($value['id'] . '_picker') . '" class="colorSelector"><div style="' . esc_attr('background-color:' . $val) . '"></div></div>';
$output .= '<input class="colorSwatch of-color" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" type="text" value="' . esc_attr($val) . '" />';
break;
// Editor
// Editor
case 'editor':
echo $output;
$textarea_name = esc_attr($option_name . '[' . $value['id'] . ']');
$default_editor_settings = array('textarea_name' => $textarea_name, 'media_buttons' => false, 'tinymce' => array('plugins' => 'wordpress'));
$editor_settings = array();
if (isset($value['settings'])) {
$editor_settings = $value['settings'];
}
$editor_settings = array_merge($editor_settings, $default_editor_settings);
wp_editor($val, $value['id'], $editor_settings);
$output = '';
break;
// Uploader
// Uploader
case "upload":
$output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
// New AJAX Uploader using Media Library
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '"
onchange="options_font_preview(\'' . esc_attr($value['id'] . '_size') . '\', \'' . esc_attr($value['id']) . '_preview' . '\', \'font-size\');return true;">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '"
onchange="options_font_preview(\'' . esc_attr($value['id'] . '_face') . '\', \'' . esc_attr($value['id']) . '_preview' . '\', \'font-family\');return true;">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style"
onchange="options_font_preview(\'' . esc_attr($value['id'] . '_style') . '\', \'' . esc_attr($value['id']) . '_preview' . '\', \'font-style\');return true;">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
示例9: optionsframework_fields
//.........这里部分代码省略.........
$checked = '';
$label = $option;
$option = preg_replace('/[^a-zA-Z0-9._\\-]/', '', strtolower($key));
$id = $option_name . '-' . $value['id'] . '-' . $option;
$name = $option_name . '[' . $value['id'] . '][' . $option . ']';
if (isset($val[$option])) {
$checked = checked($val[$option], 1, false);
}
$output .= '<input id="' . esc_attr($id) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($name) . '" ' . $checked . ' /><label for="' . esc_attr($id) . '">' . esc_html($label) . '</label>';
}
break;
// Color picker
// Color picker
case "color":
$default_color = '';
if (isset($value['std'])) {
if ($val != $value['std']) {
$default_color = ' data-default-color="' . $value['std'] . '" ';
}
}
$output .= '<input name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" id="' . esc_attr($value['id']) . '" class="of-color" type="text" value="' . esc_attr($val) . '"' . $default_color . ' />';
break;
// Uploader
// Uploader
case "upload":
$output .= Options_Framework_Media_Uploader::optionsframework_uploader($value['id'], $val, null);
break;
// Typography
// Typography
case 'typography':
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($value['options'])) {
$typography_options = wp_parse_args($value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
示例10: html
public function html()
{
unset($font_size, $font_style, $font_face, $font_color);
$typography_defaults = array('size' => '', 'face' => '', 'style' => '', 'color' => '');
$typography_stored = wp_parse_args($this->val, $typography_defaults);
$typography_options = array('sizes' => of_recognized_font_sizes(), 'faces' => of_recognized_font_faces(), 'styles' => of_recognized_font_styles(), 'color' => true);
if (isset($this->value['options'])) {
$typography_options = wp_parse_args($this->value['options'], $typography_options);
}
// Font Size
if ($typography_options['sizes']) {
$font_size = '<select class="of-typography of-typography-size" name="' . esc_attr($this->option_name . '[' . $this->value['id'] . '][size]') . '" id="' . esc_attr($this->value['id'] . '_size') . '">';
$sizes = $typography_options['sizes'];
foreach ($sizes as $i) {
$size = $i . 'px';
$font_size .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$font_size .= '</select>';
}
// Font Face
if ($typography_options['faces']) {
$font_face = '<select class="of-typography of-typography-face" name="' . esc_attr($this->option_name . '[' . $this->value['id'] . '][face]') . '" id="' . esc_attr($this->value['id'] . '_face') . '">';
$faces = $typography_options['faces'];
foreach ($faces as $key => $face) {
$font_face .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$font_face .= '</select>';
}
// Font Styles
if ($typography_options['styles']) {
$font_style = '<select class="of-typography of-typography-style" name="' . $this->option_name . '[' . $this->value['id'] . '][style]" id="' . $this->value['id'] . '_style">';
$styles = $typography_options['styles'];
foreach ($styles as $key => $style) {
$font_style .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$font_style .= '</select>';
}
// Font Color
if ($typography_options['color']) {
$font_color = '<div id="' . esc_attr($this->value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$font_color .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($this->option_name . '[' . $this->value['id'] . '][color]') . '" id="' . esc_attr($this->value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
}
// Allow modification/injection of typography fields
$typography_fields = compact('font_size', 'font_face', 'font_style', 'font_color');
$typography_fields = apply_filters('of_typography_fields', $typography_fields, $typography_stored, $this->option_name, $this->value);
$this->output .= implode('', $typography_fields);
return $this->output;
}