' . "\n" . '
' . "\n";
}
}
// Set default value to $val
if ( isset( $value['std'] ) ) {
$val = $value['std'];
}
// If the option is already saved, ovveride $val
if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') && ( $value['type'] != 'free_html') ) {
if ( isset( $settings[($value['id'])]) ) {
$val = $settings[($value['id'])];
// Striping slashes of non-array options
if ( !is_array($val) ) {
$val = stripslashes( $val );
}
}
}
// If there is a description save it for labels
$explain_value = '';
if ( isset( $value['desc'] ) ) {
$explain_value = $value['desc'];
}
( !empty($value['class']) && strpos($value['class'],"not-met") ) ? $disabled = "" : $disabled = '';
( !empty($value['placeholder']) ) ? $placeholder = 'placeholder="' . esc_attr( $value['placeholder'] ) . '"' : $placeholder = '';
switch ( $value['type'] ) {
// Basic text input
case 'text':
//var_dump(eo_chck_cl("google_ua_key","lvalidl"));
$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;
}
}
$val = stripslashes( $val );
$output .= '
';
break;
// Select Box
case 'select':
$output .= '
';
break;
// Radio Box
case "radio":
$name = $option_name .'['. $value['id'] .']';
foreach ($value['options'] as $key => $option) {
$id = $option_name . '-' . $value['id'] .'-'. $key;
$output .= '
';
}
break;
// Image Selectors
case "images":
$name = $option_name .'['. $value['id'] .']';
foreach ( $value['options'] as $key => $option ) {
$selected = '';
if ( $val != '' && ($val == $key) ) {
$selected = ' of-radio-img-selected';
}
$output .= '
';
$output .= '
' . esc_html( $key ) . '
';
// _eo-of-mod: imgclass
$output .= '
 . ')
';
}
break;
// Checkbox
case "checkbox":
$output .= '
';
$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;
// _eo-of-mod Added Multiselect from latest
case "multiselect":
$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":
$output .= optionsframework_uploader( $value['id'], $val, null );
break;
// Typography
case 'typography':
unset( $font_source, $font_subset, $font_variant, $font_size, $font_style, $font_face, $font_color );
$typography_defaults = array(
'source' => 'os_font',
'subset' => '',
'variant' => '',
'size' => '',
'face' => '',
'style' => '',
'color' => ''
);
$typography_stored = wp_parse_args( $val, $typography_defaults );
// var_dump($fonts_all);
// $all_fonts_sources[$all_font["font_src_slug"]] = $all_font["font_src_name"];
$typography_options = array(
//'sources' => array("os_font"=>"Os fonts"),
//'faces' => eo_default_font_faces(),
// Uncomment above 2, and comment out below 2 if you only want OS fonts
'sources' => eo_get_font_sources(),
'faces' => eo_combined_font_faces(),
'subsets' => '',
'variants' => array("400" => "Regular400"),
// 'variants' => eo_combined_font_variants(),
'sizes' => of_recognized_font_sizes(),
'styles' => of_recognized_font_styles(),
'color' => true
);
if ( isset( $value['options'] ) ) {
$typography_options = wp_parse_args( $value['options'], $typography_options );
}
// Font Sources -- if we have multiple sources for font option
if ( isset($typography_options['sources']) ) {
// var_dump( $typography_stored);
$font_source = '
';
}
// Font Size
if ( $typography_options['sizes'] ) {
$font_size = '
';
}
// Font Face
if ( $typography_options['faces'] ) {
$tsrcs = $typography_options['sources'];
// If the font sources are properly defined in an array("font_squirrel"=>"Font Squirrel","typekit"=>"Type Kit") etc, & count 'em.
if(is_array($tsrcs)) $f_src_c = count($tsrcs);
if( $f_src_c < 2 ) {
//We do not have multiple font sources
$faces = $typography_options['faces'];
// var_dump($faces);
// Just fall back to default
$font_face = '
';
}
else {
// Have multiple font sources, get the faces for them, first make sure we have a stored source choice, if not check for sources and get the first
$all_faces = $typography_options['faces'];
// If we dont have a selected source, just select the first available
( !empty($typography_stored['source']) ) ? $stored_s = $typography_stored['source'] : $stored_s = key($tsrcs);
$font_face = '';
$cnt = 1;
foreach ( $tsrcs as $k => $f ) {
$cnt++;
// Get the faces for each font source from the previouslly stored option all_fonts
if($k != $stored_s) {
$hidd = "hid".$cnt."-";
$hiddclas = "hidtype";
}
else {
$hidd = '';
$cnt = '';
$hiddclas = "";
}
// Keep the select as is if it's the stored font, else modify the id and hide
// ($stored_s
$font_face .= '
';
}
}
// var_dump($faces);
}
// Font Styles
if ( $typography_options['styles'] ) {
$tsrcs = $typography_stored['source'];
// _eo-review: make same with above hid class ?
( $tsrcs == "gwf_font") ? $hiddclas = ' hidv' : $hiddclas = '';
// Display styles only for standart fonts, google has variants.
$font_style = '
';
}
if ( $typography_options['variants'] ) {
$ftg = $typography_stored['face'];
// var_dump( $value['id'],$typography_stored['variant'] );
$tsrcs = $typography_stored['source'];
( $tsrcs == "os_font") ? $hiddclas = ' hidv' : $hiddclas = '';
if($typography_stored['face'] && $tsrcs != "os_font") {
$variants = eo_get_gwf_variant($ftg);
}
else {
$variants = $typography_options['variants'];
}
// Display styles only for standart fonts, google has variants.
$font_variant = '
';
}
// Font Color
if ( $typography_options['color'] ) {
//var_dump($typography_stored);
$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_source','font_face','font_variant','font_size', 'font_subset', 'font_style', 'font_color' );
// var_dump($typography_fields);
$typography_fields = apply_filters( 'of_typography_fields', $typography_fields, $typography_stored, $option_name, $value );
//var_dump($typography_fields);
$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( $default_editor_settings, $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 .= '
' . "\n";
if ( isset($value['name']) ) {
$output .= '
' . esc_html( $value['name'] ) . '
' . "\n";
}
if ( $value['desc'] ) {
$output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n";
}
$output .= '' . "\n";
break;
case "free_html":
$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 .= '
' . "\n";
if ( isset($value['name']) ) {
$output .= '
' . esc_html( $value['name'] ) . '
' . "\n";
}
if ( $value['desc'] ) {
// $output .= apply_filters('of_sanitize_info', $value['desc'] ) . "\n";
$output .= $value['desc'] . "\n";
}
$output .= '' . "\n";
break;
// Heading for Navigation
case "heading":
$counter++;
if ($counter >= 2) {
$output .= '
'."\n";
if(eo_check_of_opt('load_bs_adm') == "1" && !empty($eo_opts["groups"]) ) $output .= '