' . esc_html( $value['name'] ) . ''; } } return $menu; } /** * Generates the options fields that are used in the form. */ function optionsframework_fields() { global $allowedtags; $optionsframework_settings = get_option( 'optionsframework' ); $eo_opts = get_option( 'eo_opts' ); $all_fonts = get_option( 'eo_all_fonts_arr' ); // Gets the unique option id if ( isset( $optionsframework_settings['id'] ) ) { $option_name = $optionsframework_settings['id']; } else { $option_name = 'options_framework_theme'; }; $settings = get_option($option_name); $options =& _optionsframework_options(); $counter = 0; $menu = ''; $first_font = ''; add_thickbox(); // _eo-of-mod : load thickbox for previews foreach ( $options as $value ) { $val = ''; $select_value = ''; $output = ''; // _eo-of-mod : opt-groups if(eo_check_of_opt('load_bs_adm') == "1") { if (!empty($value["group"]) && array_key_exists('group', $value)) { $gval = $value["group"]; $gfirstid = $eo_opts["groups"][$gval]["first_item"]; $glastid = $eo_opts["groups"][$gval]['last_item']; if ( $gfirstid == $value["id"] ) { // var_dump("First goefid" . ${"goefid_$gval"}); // $output .= '
$output .='
'; } } } // Wrap all options if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) && ( $value['type'] != "free_html" ) ) { // Keep all ids lowercase with no spaces $value['id'] = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower( $value['id'] ) ); $id = 'section-' . $value['id']; $class = 'section'; if ( isset( $value['type'] ) ) { $class .= ' section-' . $value['type']; } if ( isset( $value['class'] ) ) { $class .= ' ' . $value['class']; } $output .= '
'."\n"; // additional inner wrap for stacking or hiding empty, not met options $output .= ''."\n"; if ( isset( $value['name'] ) ) { $output .= '

'; if ( isset( $value['desc'] ) ) $output .= ''; // _eo-of-mod : Display preview of the options if it has a preview image if ($value['type'] == "typography" && empty($first_font) && !empty($value['prev']) ) { $previmg = get_template_directory_uri().'/panel/rsc/img/preview/fonts_prev.jpg'; $output .= ''; $output .= esc_html( $value['name'] ); $output .= ''; if ( eo_check_of_opt('prev_pop') == "1" ) $output .= ''; $first_font = "nope"; } else { if ( isset( $value['prev']) && !empty($value['prev']) ) $previmg = get_template_directory_uri().'/panel/rsc/img/preview/'.$value['prev']; if ( !empty($value['prev']) ) $output .= ''; $output .= esc_html( $value['name'] ); if ( !empty($value['prev']) ) $output .= ''; if ( !empty($value['prev']) && eo_check_of_opt('prev_pop') == "1" ) $output .= ''; } if(eo_check_of_opt('load_bs_adm') == "1" && !empty($value['prev']) ) { // $output .= ' ¿ '; } if ( isset( $value['preq'] ) ) { /*if(strpos($value['preq'],"|") !== false) { $preqa = explode("|",$value['preq']); $preqt = $preqa[0]; $preqd = $preqa[1]; }*/ if( is_array($value['preq']) ) { $preqs = $value['preq']; foreach ( $preqs as $preqab => $preqd ) { $output .= '*'; if (eo_check_of_opt('prev_pop') == "1" ) $output .= ''; } } else { $output .= '*'; if (eo_check_of_opt('prev_pop') == "1" ) $output .= ''; } } if ( isset( $value['desc'] ) ) $output .= ''; $output .= '

' . "\n"; } if ( $value['type'] != 'editor' ) { $output .= '
' . "\n" . '
' . "\n"; } else { $output .= '
' . "\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') ) { 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 .= '' . $option .''; } 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'] ) { $tsrcs = $typography_stored['source']; ( $tsrcs == "os_font") ? $hiddclas = ' hidv' : $hiddclas = ''; // 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 .= '
'; } $class = ''; $class = ! empty( $value['id'] ) ? $value['id'] : $value['name']; $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) ); $output .= '
'; if(eo_check_of_opt('load_bs_adm') == "1" && !empty($eo_opts["groups"]) ) { $output .= '
'; } $output .= '

' . esc_html( $value['name'] ) . '

' . "\n"; break; } if ( ( $value['type'] != "heading" ) && ( $value['type'] != "info" ) && ( $value['type'] != "free_html" )) { $output .= '
'; if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) { $output .= '
' . wp_kses( $explain_value, $allowedtags ) . '
'."\n"; } // extra
for innerwrap // $output .= '
'; $output .= '
'."\n"; if(isset($value["force_clear"]) ) $output .='
'; } if(eo_check_of_opt('load_bs_adm') == "1") { if (!empty($value["group"]) && array_key_exists('group', $value)) { if ( $glastid == $value["id"] ) $output .= '
'; } } echo $output; } // _eo-fix: Where is this extra div coming from ? if(eo_check_of_opt('load_bs_adm') == "1" ) echo '
'; echo ''; }