' . 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'); // Gets the unique option id if ( isset( $optionsframework_settings['id'] ) ) { $option_name = $optionsframework_settings['id']; } else { $option_name = 'optionsframework'; }; $settings = get_option($option_name); $options = optionsframework_options(); $counter = 0; $menu = ''; foreach ( $options as $value ) { $counter++; $val = ''; $select_value = ''; $checked = ''; $output = ''; // Wrap all options if ( ( $value['type'] != "heading" ) && ( $value['type'] != "infotext" ) && ( $value['type'] != "info" ) && ( $value['type'] != "adstwofifty" ) && ( $value['type'] != "innertabopen" ) && ( $value['type'] != "innertabclose" ) && ( $value['type'] != "tabheading" ) && ( $value['type'] != "groupcontaineropen" ) && ( $value['type'] != "groupcontainerclose" ) ) { // 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"; if ( isset( $value['name'] ) ) { $output .= '

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

' . "\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'] != "infotext" ) && ( $value['type'] != "info" ) && ( $value['type'] != "adstwofifty" ) && ( $value['type'] != "innertabopen" ) && ( $value['type'] != "innertabclose" ) && ( $value['type'] != "tabheading" ) && ( $value['type'] != "groupcontaineropen" ) && ( $value['type'] != "groupcontainerclose" ) ) { 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']; } switch ( $value['type'] ) { // Basic text input case 'text': $output .= ''; break; // Upgrade to PRO case 'proupgrade': $output .= '

Available in PRO. Upgrade now.

'; 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 ($value['type'] == '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 = ''; $checked = ''; if ( $val != '' ) { if ( $val == $key ) { $selected = ' of-radio-img-selected'; $checked = ' checked="checked"'; } } $output .= ''; $output .= '
' . esc_html( $key ) . '
'; $output .= '' . $option .''; } break; // Image Selectors case "proimages": foreach ( $value['options'] as $key => $option ) { $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; // Color picker case "color": $output .= '
'; $output .= ''; break; // Uploader case "upload": $output .= optionsframework_medialibrary_uploader( $value['id'], $val, null ); break; // Typography case 'typography': $typography_stored = $val; // Font Size $output .= ''; // Font Face $output .= ''; // Font Weight $output .= ''; // Font Color $output .= '
'; $output .= ''; break; // Background case 'background': $background = $val; // Background Color $output .= '
'; $output .= ''; // 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 .= '
'; // 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": $class = 'section'; 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; // Heading for Navigation case "heading": if ($counter >= 2) { $output .= '
'."\n"; } $jquery_click_hook = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($value['name']) ); $jquery_click_hook = "of-option-" . $jquery_click_hook; $menu .= '' . esc_html( $value['name'] ) . ''; $output .= '
'; break; // testing case "tabheading": $output .= '

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

'; break; case "infotext": $output .= '

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

'; break; case "innertabopen": $output .= '
'; break; case "innertabclose": $output .= '
'; break; case "groupcontaineropen": $output .= '

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

'; break; case "groupcontainerclose": $output .= '
'; break; } if ( ( $value['type'] != "heading" ) && ( $value['type'] != "infotext" ) && ( $value['type'] != "info" ) && ( $value['type'] != "adstwofifty" ) && ( $value['type'] != "innertabopen" ) && ( $value['type'] != "innertabclose" ) && ( $value['type'] != "tabheading" ) && ( $value['type'] != "groupcontaineropen" ) && ( $value['type'] != "groupcontainerclose" ) ) { $output .= '
'; if ( ( $value['type'] != "checkbox" ) && ( $value['type'] != "editor" ) ) { $output .= '
' . wp_kses( $explain_value, $allowedtags) . '
'."\n"; } $output .= '
'."\n"; } echo $output; } echo '
'; }