' . "\n";
}
}
else {
$output .= '
' . "\n";
}
}
if ( isset( $value['dependency'] ) ) {
optionsframework_fields_dependency()->set( $value['id'], $value['dependency'] );
}
switch ( $value['type'] ) {
// Basic text input
case 'text':
$output .= '
';
break;
// Password input
case 'password':
$output .= '
';
break;
// Textarea
case 'textarea':
$rows = '8';
if ( isset( $value['settings']['rows'] ) ) {
$custom_rows = $value['settings']['rows'];
if ( is_numeric( $custom_rows ) ) {
$rows = $custom_rows;
}
}
if ( empty( $value['sanitize'] ) || 'without_sanitize' != $value['sanitize'] ) {
$val = stripslashes( $val );
}
$output .= '
';
break;
// Select Box
case 'select':
$output .= '
';
break;
// Radio Box
case "radio":
$name = $option_name .'['. $value['id'] .']';
$wrap_class = 'controls-input-wrap';
if ( empty( $value['style'] ) || 'horizontal' == $value['style'] ) {
$wrap_class .= ' inline-input-wrap';
} else if ( 'vertical' == $value['style'] ) {
$wrap_class .= ' block-input-wrap';
}
$show_hide = empty($value['show_hide']) ? array() : (array) $value['show_hide'];
$classes = array( 'of-input', 'of-radio' );
if ( !empty($show_hide) ) {
$classes[] = 'of-js-hider';
}
foreach ($value['options'] as $key => $option) {
$id = $option_name . '-' . $value['id'] .'-'. $key;
$input_classes = $classes;
$attr = '';
if ( !empty($show_hide[ $key ]) ) {
$input_classes[] = 'js-hider-show';
if ( true !== $show_hide[ $key ] ) {
if ( is_array( $show_hide[ $key ] ) ) {
$data_js_atregt = implode( ', .', $show_hide[ $key ] );
} else {
$data_js_atregt = $show_hide[ $key ];
}
$attr = ' data-js-target="' . $data_js_atregt . '"';
}
}
$output .= '
'
. ''
. ''
. '
';
}
break;
// Image Selectors
case "images":
$name = $option_name .'['. $value['id'] .']';
$show_hide = empty($value['show_hide']) ? array() : (array) $value['show_hide'];
$classes = array('of-radio-img-radio');
if ( !empty($show_hide) ) {
$classes[] = 'of-js-hider';
}
if ( empty($value['base_dir']) ) {
$dir = get_template_directory_uri();
} else {
$dir = $value['base_dir'];
}
foreach ( $value['options'] as $key => $option ) {
$input_classes = $classes;
$selected = '';
$checked = '';
$attr = '';
if ( $val == $key ) {
$selected = ' of-radio-img-selected';
$checked = ' checked="checked"';
}
if ( !empty($show_hide[ $key ]) ) {
$input_classes[] = 'js-hider-show';
if ( true !== $show_hide[ $key ] ) {
if ( is_array( $show_hide[ $key ] ) ) {
$data_js_atregt = implode( ', .', $show_hide[ $key ] );
} else {
$data_js_atregt = $show_hide[ $key ];
}
$attr = ' data-js-target="' . $data_js_atregt . '"';
}
}
$output .= '
';
$output .= '
';
$img_info = '';
if ( is_array( $option ) && isset( $option['src'], $option['title'] ) ) {
$img = $dir . $option['src'];
$title = $option['title'];
if ( $title ) {
$img_title_style = '';
if ( isset( $option['title_width'] ) ) {
$img_title_style = ' style="width: ' . absint( $option['title_width'] ) . 'px;"';
}
$img_info = '
' . esc_html($title) . '
';
}
} else if ( $option !== $key ) {
$img = $dir . $option;
$title = $option;
} else {
$img = presscore_get_default_small_image();
$img = $img[0];
$title = $option;
$img_title_style = '';
if ( isset( $option['title_width'] ) ) {
$img_title_style = ' style="width: ' . absint( $option['title_width'] ) . 'px;"';
}
$img_info = '
' . esc_html($title) . '
';
}
$output .= '
 . ')
';
$output .= $img_info;
$output .= '
';
}
break;
// Checkbox
case "checkbox":
$classes = array();
$classes[] = 'checkbox';
$classes[] = 'of-input';
if( isset($value['options']['java_hide']) && $value['options']['java_hide'] ) {
$classes[] = 'of-js-hider';
}else if( isset($value['options']['java_hide_global']) && $value['options']['java_hide_global'] ) {
$classes[] = 'of-js-hider-global';
}
$classes = implode(' ', $classes);
$output .= '
';
break;
// 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 .= '
';
}
break;
// Color picker
case "color":
$default_color = '';
if ( isset($value['std']) ) {
if ( $val != $value['std'] )
$default_color = ' data-default-color="' .$value['std'] . '" ';
}
$output .= '
';
break;
// Uploader
case "upload":
$mode = isset( $value['mode'] ) ? $value['mode'] : 'uri_only';
$output .= optionsframework_uploader( $value['id'], $val, $mode, null );
break;
// 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 = '
';
}
// Font Face
if ( $typography_options['faces'] ) {
$font_face = '
';
}
// Font Styles
if ( $typography_options['styles'] ) {
$font_style = '
';
}
// Font Color
if ( $typography_options['color'] ) {
$default_color = '';
if ( isset($value['std']['color']) ) {
if ( $val != $value['std']['color'] )
$default_color = ' data-default-color="' .$value['std']['color'] . '" ';
}
$font_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, $option_name, $value );
$output .= implode( '', $typography_fields );
break;
// Background
case 'background':
$background = $val;
// Background Color
$default_color = '';
if ( isset( $value['std']['color'] ) ) {
if ( $val != $value['std']['color'] )
$default_color = ' data-default-color="' .$value['std']['color'] . '" ';
}
$output .= '
';
// Background Image
if ( !isset($background['image']) ) {
$background['image'] = '';
}
$output .= optionsframework_uploader( $value['id'], $background['image'], null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) );
$class = 'of-background-properties';
if ( '' == $background['image'] ) {
$class .= ' hide';
}
$output .= '
';
// Background Repeat
$output .= '';
// Background Position
$output .= '';
// Background Attachment
$output .= '';
$output .= '
';
break;
// Editor
case 'editor':
$output .= '
' . wp_kses( $explain_value, $allowedtags) . '
'."\n";
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;
// Info
case "info":
$id = '';
$class = 'section';
if ( isset( $value['id'] ) ) {
$id = 'id="' . esc_attr( $value['id'] ) . '" ';
}
if ( isset( $value['type'] ) ) {
$class .= ' section-' . $value['type'];
}
if ( isset( $value['class'] ) ) {
$class .= ' ' . $value['class'];
}
$output .= '
';
if ( isset($value['name']) ) {
$output .= '
' . esc_html( $value['name'] ) . '
';
}
if ( $value['desc'] ) {
$output .= '
' . apply_filters('of_sanitize_info', $value['desc'] ) . '
';
}
if ( !empty($value['image']) ) {
$output .= '
';
}
$output .= '
';
break;
// Heading for Navigation
case "heading":
if ( $in_block ) {
$in_block = false;
$output .= '