本文整理汇总了PHP中optionsframework_medialibrary_uploader函数的典型用法代码示例。如果您正苦于以下问题:PHP optionsframework_medialibrary_uploader函数的具体用法?PHP optionsframework_medialibrary_uploader怎么用?PHP optionsframework_medialibrary_uploader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了optionsframework_medialibrary_uploader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optionsframework_fields
//.........这里部分代码省略.........
$output .= '<div class="of-radio-img-label">' . esc_html($key) . '</div>';
$output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
}
break;
// Checkbox
// Checkbox
case "checkbox":
$output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
break;
// Multicheck
// Multicheck
case "multicheck":
foreach ($value['options'] as $key => $option) {
$checked = '';
$label = $option;
$option = preg_replace('/\\W/', '', 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><br />';
}
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);
// New AJAX Uploader using Media Library
break;
// Typography
// Typography
case 'typography':
$typography_stored = $val;
// Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = of_recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
// Font Weight
$output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
$styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
break;
// Typography Without Font Face
示例2: optionsframework_fields
//.........这里部分代码省略.........
$output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img-pro" />';
}
break;
// Checkbox
// Checkbox
case "checkbox":
$output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
$output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
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':
$typography_stored = $val;
// Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = of_recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
// Font Weight
$output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
// Font Style
$styles = of_recognized_font_styles();
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
break;
// Background
示例3: optionsframework_machine
//.........这里部分代码省略.........
$output .= '<input type="checkbox" class="checkbox" value="on" id="' . $value['id'] . '" name="' . $value['id'] . '" ' . $checked . ' />';
$output .= '</div>';
$output .= '<div class="explain"><label for="' . $value['id'] . '">' . $explain_value . '</label></div>';
break;
// M U L T I C H E C K B O X
//---------------------------------
// M U L T I C H E C K B O X
//---------------------------------
case "multicheck":
$std = $value['std'];
$output .= '<h3>' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
foreach ($value['options'] as $key => $option) {
$checked = "";
if (get_option($value['id'])) {
if (@in_array($key, get_option($value['id']))) {
$checked = "checked=\"checked\"";
}
} else {
//Empty Value if Unchecked
}
$output .= '<input type="checkbox" class="checkbox" name="' . $value['id'] . '[]" id="' . $key . '" value="' . $key . '" ' . $checked . ' /> <label for="' . $key . '">' . $option . '</label><br>';
}
$output .= '</div>';
$output .= '<div class="explain">' . $explain_value . '</div>';
break;
// U P L O A D
//---------------------------------
// U P L O A D
//---------------------------------
case "upload":
$output .= '<h3>' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
$output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
$output .= '</div>';
$output .= '<div class="explain">' . $explain_value . '</div>';
break;
// C O L O R
//---------------------------------
// C O L O R
//---------------------------------
case "color":
$val = $value['std'];
$stored = get_option($value['id']);
if ($stored != "") {
$val = $stored;
}
$output .= '<h3>' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
$output .= '<input class="color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
$output .= '<div class="wpcolorSelector"><div id="' . $value['id'] . '_picker" ></div></div>';
$output .= '</div>';
$output .= '<div class="explain">' . $explain_value . '</div>';
break;
// T Y P O G R A P H Y
//---------------------------------
// T Y P O G R A P H Y
//---------------------------------
case "typography":
$default = $value['std'];
$typography_stored = get_option($value['id']);
$output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
// C O L O R
if (isset($default['color'])) {
$val = $default['color'];
示例4: optionsframework_machine
//.........这里部分代码省略.........
}
}
$output .= '</div>';
break;
case 'tiles':
$i = 0;
$select_value = '';
$select_value = $data[$value['id']];
foreach ($value['options'] as $key => $option) {
$i++;
$checked = '';
$selected = '';
if (NULL != checked($select_value, $option, false)) {
$checked = checked($select_value, $option, false);
$selected = 'of-radio-tile-selected';
}
$output .= '<span>';
$output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
$output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
$output .= '</span>';
}
break;
// Background
// Background
case 'background':
$background = $data[$value['id']];
// Background Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
$output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
// Background Image - New AJAX Uploader using Media Library
if (!isset($background['image'])) {
$background['image'] = '';
}
$output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, 'image');
$class = 'of-background-properties';
if ('' == $background['image']) {
$class .= ' hide';
}
$output .= '<div class="' . esc_attr($class) . '">';
// Background Repeat
$output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
$repeats = of_recognized_background_repeat();
foreach ($repeats as $key => $repeat) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
}
$output .= '</select>';
// Background Position
$output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
$positions = of_recognized_background_position();
foreach ($positions as $key => $position) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
}
$output .= '</select>';
// Background Attachment
$output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
$attachments = of_recognized_background_attachment();
foreach ($attachments as $key => $attachment) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
}
$output .= '</select>';
$output .= '</div>';
break;
case 'backup':
$instructions = $value['options'];
$backup = get_option(BACKUPS);
if (!isset($backup['backup_log'])) {
示例5: fields
//.........这里部分代码省略.........
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = ClassyOptionsSanitize::recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
// Font Weight
$output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
/* Font Style */
$styles = ClassyOptionsSanitize::recognized_font_styles();
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
break;
// Background
// Background
case 'background':
$background = $val;
// Background Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $background['color']) . '"></div></div>';
$output .= '<input class="of-color of-background of-background-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($background['color']) . '" />';
// Background Image - New AJAX Uploader using Media Library
if (!isset($background['image'])) {
$background['image'] = '';
}
$output .= optionsframework_medialibrary_uploader($value['id'], $background['image'], null, '', 0, 'image');
$class = 'of-background-properties';
if ('' == $background['image']) {
$class .= ' hide';
}
$output .= '<div class="' . esc_attr($class) . '">';
// Background Repeat
$output .= '<select class="of-background of-background-repeat" name="' . esc_attr($option_name . '[' . $value['id'] . '][repeat]') . '" id="' . esc_attr($value['id'] . '_repeat') . '">';
$repeats = of_recognized_background_repeat();
foreach ($repeats as $key => $repeat) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($background['repeat'], $key, false) . '>' . esc_html($repeat) . '</option>';
}
$output .= '</select>';
// Background Position
$output .= '<select class="of-background of-background-position" name="' . esc_attr($option_name . '[' . $value['id'] . '][position]') . '" id="' . esc_attr($value['id'] . '_position') . '">';
$positions = of_recognized_background_position();
foreach ($positions as $key => $position) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($background['position'], $key, false) . '>' . esc_html($position) . '</option>';
}
$output .= '</select>';
// Background Attachment
$output .= '<select class="of-background of-background-attachment" name="' . esc_attr($option_name . '[' . $value['id'] . '][attachment]') . '" id="' . esc_attr($value['id'] . '_attachment') . '">';
$attachments = of_recognized_background_attachment();
foreach ($attachments as $key => $attachment) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($background['attachment'], $key, false) . '>' . esc_html($attachment) . '</option>';
}
$output .= '</select>';
$output .= '</div>';
break;
// Info
// Info
case "info":
$class = 'section';
示例6: optionsframework_fields
//.........这里部分代码省略.........
$output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
}
break;
// Casilla de verificación
// Casilla de verificación
case "checkbox":
$output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
$output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
break;
// Lista de selección múltiple
// Lista de selección múltiple
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;
// Selector de color
// Selector de color
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;
// Cargador
// Cargador
case "upload":
$output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
// Nuevo cargador en AJAX usando Media Library
break;
// Tipografía
// Tipografía
case 'typography':
$typography_stored = $val;
// Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = of_recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
// Font Weight
$output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
/* Font Style */
$styles = of_recognized_font_styles();
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
break;
示例7: optionsframework_machine
//.........这里部分代码省略.........
$output .= '<input type="checkbox" class="checkbox" value="on" id="' . $value['id'] . '" name="' . $value['id'] . '" ' . $checked . ' />';
$output .= '</div>';
$output .= '<div class="explain"><label for="' . $value['id'] . '">' . $explain_value . '</label></div>';
break;
// M U L T I C H E C K B O X
//---------------------------------
// M U L T I C H E C K B O X
//---------------------------------
case "multicheck":
$std = $value['std'];
$output .= '<h3>' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
foreach ($value['options'] as $key => $option) {
$checked = "";
if (get_option($value['id'])) {
if (@in_array($key, get_option($value['id']))) {
$checked = "checked=\"checked\"";
}
} else {
//Empty Value if Unchecked
}
$output .= '<input type="checkbox" class="checkbox" name="' . $value['id'] . '[]" id="' . $key . '" value="' . $key . '" ' . $checked . ' /> <label for="' . $key . '">' . $option . '</label><br>';
}
$output .= '</div>';
$output .= '<div class="explain">' . $explain_value . '</div>';
break;
// U P L O A D
//---------------------------------
// U P L O A D
//---------------------------------
case "upload":
$output .= '<h3>' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
$output .= optionsframework_medialibrary_uploader($value['id'], $val, null);
$output .= '</div>';
$output .= '<div class="explain">' . $explain_value . '</div>';
break;
// C O L O R
//---------------------------------
// C O L O R
//---------------------------------
case "color":
$val = $value['std'];
$stored = get_option($value['id']);
if ($stored != "") {
$val = $stored;
}
$output .= '<h3>' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
$output .= '<input class="color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $val . '" />';
$output .= '<div class="wpcolorSelector"><div id="' . $value['id'] . '_picker" ></div></div>';
$output .= '</div>';
$output .= '<div class="explain">' . $explain_value . '</div>';
break;
// T Y P O G R A P H Y
//---------------------------------
// T Y P O G R A P H Y
//---------------------------------
case "typography":
$default = $value['std'];
$typography_stored = get_option($value['id']);
$output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
$output .= '<div class="controls" >' . "\n";
// C O L O R
if (isset($default['color'])) {
$val = $default['color'];
示例8: optionsframework_fields
//.........这里部分代码省略.........
function statusUpdate(text){
$('#console').prepend('<p>'+text+'</p>');
}
// End jQuery goodness
});
</script>
<?php
$output .= '<div id="itoggle" class="project"><input type="checkbox" class="checkbox of-input" id="' . esc_attr($value['id']) . '" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' /></div>';
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);
// New AJAX Uploader using Media Library
break;
// Typography
// Typography
case 'typography':
$typography_stored = $val;
/* // Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][size]' ) . '" id="' . esc_attr( $value['id'] . '_size' ) . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
}
$output .= '</select>';
*/
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = of_recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
/* // Font Weight
$output .= '<select class="of-typography of-typography-style" name="'.$option_name.'['.$value['id'].'][style]" id="'. $value['id'].'_style">';
*/
/* Font Style */
/* $styles = of_recognized_font_styles();
foreach ( $styles as $key => $style ) {
$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['style'], $key, false ) . '>'. $style .'</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr( $value['id'] ) . '_color_picker" class="colorSelector"><div style="' . esc_attr( 'background-color:' . $typography_stored['color'] ) . '"></div></div>';
示例9: optionsframework_fields
//.........这里部分代码省略.........
$output .= '<img src="' . esc_url($option) . '" alt="' . $option . '" class="of-radio-img-img' . $selected . '" onclick="document.getElementById(\'' . esc_attr($value['id'] . '_' . $key) . '\').checked=true;" />';
}
break;
// Checkbox
// Checkbox
case "checkbox":
$output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
$output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
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);
// New AJAX Uploader using Media Library
break;
// Typography
// Typography
case 'typography':
$typography_stored = $val;
// Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = of_recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
// Font Weight
$output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
/* Font Style */
$styles = of_recognized_font_styles();
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
break;
示例10: optionsframework_fields
//.........这里部分代码省略.........
} else {
if (isset($value['options']['java_hide_global']) && $value['options']['java_hide_global']) {
$classes[] = 'of-js-hider-global';
}
}
$classes = implode(' ', $classes);
$output .= '<input id="' . esc_attr($value['id']) . '" class="' . $classes . '" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
break;
// Multicheck
// Multicheck
case "multicheck":
foreach ($value['options'] as $key => $option) {
$checked = '';
$label = $option;
$option = preg_replace('/\\W/', '', 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":
$mode = isset($value['mode']) ? $value['mode'] : 'full';
$output .= optionsframework_medialibrary_uploader($value['id'], $val, $mode);
// New AJAX Uploader using Media Library
break;
// Typography
// Typography
case 'typography':
$typography_stored = $val;
// Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';
$faces = of_recognized_font_faces();
foreach ($faces as $key => $face) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['face'], $key, false) . '>' . esc_html($face) . '</option>';
}
$output .= '</select>';
// Font Weight
$output .= '<select class="of-typography of-typography-style" name="' . $option_name . '[' . $value['id'] . '][style]" id="' . $value['id'] . '_style">';
/* Font Style */
$styles = of_recognized_font_styles();
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . $style . '</option>';
}
$output .= '</select>';
// Font Color
$output .= '<div id="' . esc_attr($value['id']) . '_color_picker" class="colorSelector"><div style="' . esc_attr('background-color:' . $typography_stored['color']) . '"></div></div>';
$output .= '<input class="of-color of-typography of-typography-color" name="' . esc_attr($option_name . '[' . $value['id'] . '][color]') . '" id="' . esc_attr($value['id'] . '_color') . '" type="text" value="' . esc_attr($typography_stored['color']) . '" />';
break;
示例11: edit_slide
/**
* Generates the an indivdual panel to edit a slide.
* This has been broken into a separate public function because
* not only does it show each slide when loading the
* Edit Slider screen, but it's used to insert a new
* slide when called with AJAX.
*
* @since 1.0.0
*
* @param string $slider_type type of slider
* @param string $slide_id ID for individual slide
* @param array $slide_options any current options for current slide
*/
public function edit_slide($slider_id, $slider_type, $slide_id, $slide_options = null, $visibility = null)
{
global $_wp_additional_image_sizes;
$api = Theme_Blvd_Sliders_API::get_instance();
$slider_types = $api->get_sliders();
$current_slide_type = $this->slide_value($slide_options, 'slide_type');
$current_image = $this->slide_value($slide_options, 'image');
$current_video = $this->slide_value($slide_options, 'video');
?>
<div id="<?php
echo $slide_id;
?>
" class="widget slide-options"<?php
if ($visibility == 'hide') {
echo ' style="display:none"';
}
?>
>
<div class="widget-name">
<a href="#" class="widget-name-arrow">Toggle</a>
<h3 class="image"><?php
echo $slider_types[$slider_type]['types'][$current_slide_type]['name'];
?>
</h3>
<span class="slide-summary"></span>
</div><!-- .element-name (end) -->
<div class="widget-content">
<div class="slide-set-type">
<strong><?php
_e('Image Slide', 'themeblvd_sliders');
?>
</strong>
<select name="slides[<?php
echo $slide_id;
?>
][slide_type]">
<?php
foreach ($slider_types[$slider_type]['types'] as $key => $value) {
echo '<option ' . selected($key, $current_slide_type, false) . ' value="' . $key . '">' . $value['name'] . '</option>';
}
?>
</select>
</div><!-- .slide-set-type (end) -->
<div class="pad">
<div class="slide-media controls grid-wrap">
<div class="slide-set-media">
<?php
foreach ($slider_types[$slider_type]['types'] as $type => $config) {
switch ($type) {
case 'image':
?>
<div class="slide-set-image">
<h3><?php
echo $config['main_title'];
?>
</h3>
<div class="field section-upload">
<?php
if (function_exists('wp_enqueue_media') && function_exists('themeblvd_media_uploader')) {
$title = isset($current_image['title']) ? $current_image['title'] : '';
// If updating from v1.0, this check prevents PHP warning.
echo themeblvd_media_uploader(array('option_name' => 'slides[' . $slide_id . ']', 'type' => 'slider', 'id' => $slide_id . 'image', 'value' => $current_image['url'], 'value_title' => $title, 'value_id' => $current_image['id']));
} else {
// @deprecated
echo optionsframework_medialibrary_uploader('slides[' . $slide_id . ']', 'slider', $slide_id . 'image', $current_image, null, null, $slider_id, null, __('Get Image', 'themeblvd_sliders'));
}
?>
</div><!-- .field (end) -->
</div><!-- .slide-set-image (end) -->
<?php
break;
case 'video':
?>
<div class="slide-set-video">
<h3><?php
echo $config['main_title'];
?>
</h3>
<div class="field video-link">
<?php
echo '<input type="text" name="slides[' . $slide_id . '][video]" placeholder="' . __('Video Link', 'themeblvd') . '" value="' . $current_video . '" />';
/*
// @todo -- Incorporate "Get Video" button. Let's not bring this feature
// to center-satge until we have a better handle on mp4's in WP 3.6.
$current_video = $this->slide_value( $slide_options, 'video' );
if ( function_exists('wp_video_shortcode') && function_exists('themeblvd_media_uploader') ) {
echo '<div class="section-upload">';
//.........这里部分代码省略.........
示例12: themeblvd_logo_option
//.........这里部分代码省略.........
if (!empty($val) && !empty($val['type'])) {
$current_value = $val['type'];
}
$select_type = '<div class="tb-fancy-select">';
$select_type .= '<select name="' . esc_attr($name . '[' . $id . '][type]') . '">';
foreach ($types as $key => $type) {
$select_type .= sprintf('<option value="%s" %s>%s</option>', $key, selected($current_value, $key, false), $type);
}
$select_type .= '</select>';
$select_type .= '<span class="trigger"></span>';
$select_type .= '<span class="textbox"></span>';
$select_type .= '</div><!-- .tb-fancy-select (end) -->';
/*------------------------------------------------------*/
/* Site Title
/*------------------------------------------------------*/
$site_title = '<p class="note">';
$site_title .= __('Current Site Title', 'themeblvd') . ': <strong>';
$site_title .= get_bloginfo('name') . '</strong><br><br>';
$site_title .= __('You can change your site title and tagline by going <a href="options-general.php" target="_blank">here</a>.', 'themeblvd');
$site_title .= '</p>';
/*------------------------------------------------------*/
/* Site Title + Tagline
/*------------------------------------------------------*/
$site_title_tagline = '<p class="note">';
$site_title_tagline .= __('Current Site Title', 'themeblvd') . ': <strong>';
$site_title_tagline .= get_bloginfo('name') . '</strong><br>';
$site_title_tagline .= __('Current Tagline', 'themeblvd') . ': <strong>';
$site_title_tagline .= get_bloginfo('description') . '</strong><br><br>';
$site_title_tagline .= __('You can change your site title by going <a href="options-general.php" target="_blank">here</a>.', 'themeblvd');
$site_title_tagline .= '</p>';
/*------------------------------------------------------*/
/* Custom Text
/*------------------------------------------------------*/
$current_value = '';
if (!empty($val) && !empty($val['custom'])) {
$current_value = $val['custom'];
}
$current_tagline = '';
if (!empty($val) && !empty($val['custom_tagline'])) {
$current_tagline = $val['custom_tagline'];
}
$custom_text = sprintf('<p><label class="inner-label"><strong>%s</strong></label>', __('Title', 'themeblvd'));
$custom_text .= sprintf('<input type="text" name="%s" value="%s" /></p>', esc_attr($name . '[' . $id . '][custom]'), esc_attr($current_value));
$custom_text .= sprintf('<p><label class="inner-label"><strong>%s</strong> (%s)</label>', __('Tagline', 'themeblvd'), __('optional', 'themeblvd'));
$custom_text .= sprintf('<input type="text" name="%s" value="%s" /></p>', esc_attr($name . '[' . $id . '][custom_tagline]'), esc_attr($current_tagline));
$custom_text .= sprintf('<p class="note">%s</p>', __('Insert your custom text.', 'themeblvd'));
/*------------------------------------------------------*/
/* Image
/*------------------------------------------------------*/
if (function_exists('wp_enqueue_media')) {
// WP 3.5+
$current_value = array('url' => '', 'width' => '');
if (is_array($val) && isset($val['image'])) {
$current_value = array('url' => $val['image'], 'width' => $val['image_width']);
}
$current_retina = array('url' => '');
if (is_array($val) && isset($val['image_2x'])) {
$current_retina = array('url' => $val['image_2x']);
}
// Standard Image
$image_upload = '<div class="section-upload image-standard">';
$image_upload .= '<label class="inner-label"><strong>' . __('Standard Image', 'themeblvd') . '</strong></label>';
$image_upload .= themeblvd_media_uploader(array('option_name' => $name, 'type' => 'logo', 'id' => $id, 'value' => $current_value['url'], 'value_width' => $current_value['width'], 'name' => 'image'));
$image_upload .= '</div>';
// Retina image (2x)
$image_upload .= '<div class="section-upload image-2x">';
$image_upload .= '<label class="inner-label"><strong>' . __('HiDPI-optimized Image (optional)', 'themeblvd') . '</strong></label>';
$image_upload .= themeblvd_media_uploader(array('option_name' => $name, 'type' => 'logo_2x', 'id' => $id, 'value' => $current_retina['url'], 'name' => 'image_2x'));
$image_upload .= '</div>';
} else {
// Media uploader prior to WP 3.5 -- @deprecated
$current_value = array('url' => '', 'width' => '', 'id' => '');
if (is_array($val) && isset($val['image'])) {
$current_value = array('url' => $val['image'], 'width' => $val['image_width'], 'id' => '');
}
$current_retina = array('url' => '', 'id' => '');
if (is_array($val) && isset($val['image_2x'])) {
$current_retina = array('url' => $val['image_2x'], 'id' => '');
}
// Standard Image
$image_upload = '<div class="section-upload image-standard">';
$image_upload .= '<label class="inner-label"><strong>' . __('Standard Image', 'themeblvd') . '</strong></label>';
$image_upload .= optionsframework_medialibrary_uploader($name, 'logo', $id, $current_value, null, null, 0, 'image');
$image_upload .= '</div>';
// Retina image (2x)
$image_upload .= '<div class="section-upload image-2x">';
$image_upload .= '<label class="inner-label"><strong>' . __('HiDPI-optimized Image (optional)', 'themeblvd') . '</strong></label>';
$image_upload .= optionsframework_medialibrary_uploader($name, 'logo_2x', $id, $current_retina, null, null, 0, 'image_2x');
$image_upload .= '</div>';
}
/*------------------------------------------------------*/
/* Primary Output
/*------------------------------------------------------*/
$output = sprintf('<div class="select-type">%s</div>', $select_type);
$output .= sprintf('<div class="logo-item title">%s</div>', $site_title);
$output .= sprintf('<div class="logo-item title_tagline">%s</div>', $site_title_tagline);
$output .= sprintf('<div class="logo-item custom">%s</div>', $custom_text);
$output .= sprintf('<div class="logo-item image">%s</div>', $image_upload);
return $output;
}
示例13: 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":
$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>';
示例14: themeblvd_option_fields
//.........这里部分代码省略.........
foreach ($value['options'] as $key => $option) {
$checked = isset($val[$key]) ? checked($val[$key], 1, false) : '';
$label = $option;
$option = preg_replace('/\\W/', '', strtolower($key));
$id = sprintf('%s-%s-%s', $option_name, $value['id'], $option);
$name = sprintf('%s[%s][%s]', $option_name, $value['id'], $key);
$output .= sprintf('<input id="%s" class="checkbox of-input" type="checkbox" name="%s" %s /><label for="%s">%s</label>', esc_attr($id), esc_attr($name), $checked, esc_attr($id), $label);
}
break;
/*---------------------------------------*/
/* Color picker
/*---------------------------------------*/
/*---------------------------------------*/
/* Color picker
/*---------------------------------------*/
case 'color':
$output .= sprintf('<div id="%s" class="colorSelector"><div style="%s"></div></div>', esc_attr($value['id'] . '_picker'), esc_attr('background-color:' . $val));
$output .= sprintf('<input class="of-color" name="%s" id="%s" type="text" value="%s" />', esc_attr($option_name . '[' . $value['id'] . ']'), esc_attr($value['id']), esc_attr($val));
break;
/*---------------------------------------*/
/* Uploader
/*---------------------------------------*/
/*---------------------------------------*/
/* Uploader
/*---------------------------------------*/
case 'upload':
if (function_exists('wp_enqueue_media')) {
// Media uploader WP 3.5+
$args = array('option_name' => $option_name, 'type' => 'standard', 'id' => $value['id'], 'value' => $val);
$output .= themeblvd_media_uploader($args);
} else {
// Legacy media uploader
$val = array('url' => $val, 'id' => '');
$output .= optionsframework_medialibrary_uploader($option_name, 'standard', $value['id'], $val);
// @deprecated
}
break;
/*---------------------------------------*/
/* Typography
/*---------------------------------------*/
/*---------------------------------------*/
/* Typography
/*---------------------------------------*/
case 'typography':
$typography_stored = $val;
// Font Size
if (in_array('size', $value['atts'])) {
$output .= '<div class="tb-fancy-select">';
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
$sizes = themeblvd_recognized_font_sizes();
foreach ($sizes as $i) {
$size = $i . 'px';
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
$output .= '<span class="trigger"></span>';
$output .= '<span class="textbox"></span>';
$output .= '</div><!-- .tb-fancy-select (end) -->';
}
// Font Style
if (in_array('style', $value['atts'])) {
$output .= '<div class="tb-fancy-select">';
$output .= '<select class="of-typography of-typography-style" name="' . esc_attr($option_name . '[' . $value['id'] . '][style]') . '" id="' . esc_attr($value['id'] . '_style') . '">';
$styles = themeblvd_recognized_font_styles();
foreach ($styles as $key => $style) {
$output .= '<option value="' . esc_attr($key) . '" ' . selected($typography_stored['style'], $key, false) . '>' . esc_html($style) . '</option>';
示例15: optionsframework_fields
//.........这里部分代码省略.........
// Checkbox
case "checkbox":
$output .= '<input id="' . esc_attr($value['id']) . '" class="checkbox of-input" type="checkbox" name="' . esc_attr($option_name . '[' . $value['id'] . ']') . '" ' . checked($val, 1, false) . ' />';
$output .= '<label class="explain" for="' . esc_attr($value['id']) . '">' . wp_kses($explain_value, $allowedtags) . '</label>';
break;
// Multicheck
// Multicheck
case "multicheck":
$output .= '<ul class="multicheck-list">';
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 .= '<li>';
$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>';
$output .= '</li>';
}
$output .= '</ul>';
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);
// New AJAX Uploader using Media Library
break;
// Typography
// Typography
case 'typography':
$typography_stored = $val;
// Check if null
if (!isset($typography_stored['size'])) {
$typography_stored['size'] = '';
}
if (!isset($typography_stored['face'])) {
$typography_stored['face'] = '';
}
if (!isset($typography_stored['style'])) {
$typography_stored['style'] = '';
}
if (!isset($typography_stored['color'])) {
$typography_stored['color'] = '';
}
// Font Size
$output .= '<select class="of-typography of-typography-size" name="' . esc_attr($option_name . '[' . $value['id'] . '][size]') . '" id="' . esc_attr($value['id'] . '_size') . '">';
for ($i = 9; $i < 71; $i++) {
$size = $i . 'px';
// Check if null
if (!isset($typography_stored['size'])) {
$typography_stored['size'] = '';
}
$output .= '<option value="' . esc_attr($size) . '" ' . selected($typography_stored['size'], $size, false) . '>' . esc_html($size) . '</option>';
}
$output .= '</select>';
// Font Face
$output .= '<select class="of-typography of-typography-face" name="' . esc_attr($option_name . '[' . $value['id'] . '][face]') . '" id="' . esc_attr($value['id'] . '_face') . '">';