' . esc_html( $value['name'] ) . ''; } } return $menu; } /** * Generates the options fields that are used in the form. */ function optionsframework_fields() { $cur_page_id = optionsframework_get_cur_page_id(); $options = optionsframework_get_page_options( $cur_page_id ); optionsframework_interface( $options, $cur_page_id ); } function optionsframework_interface( $options, $cur_page_id ) { $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 = apply_filters( "optionsframework_fields_saved_settings-{$cur_page_id}", get_option( $option_name ) ); $optionsframework_debug = presscore_options_debug(); $do_not_export = apply_filters( 'optionsframework_fields_black_list', array() ); $preserved_options = apply_filters( 'optionsframework_validate_preserve_fields', array() ); $in_block = false; $counter = 0; $menu = ''; $elements_without_wrap = array( 'block_begin', 'block_end', 'block', 'heading', 'info', 'page', 'js_hide_begin', 'js_hide_end', 'title', 'divider' ); foreach ( $options as $value ) { if ( ! is_array( $value ) || ! array_key_exists( 'type', $value ) ) { continue; } $val = ''; $select_value = ''; $checked = ''; $output = ''; // Set default value to $val if ( isset( $value['std'] ) ) { $val = $value['std']; } // If the option is already saved, ovveride $val if ( !in_array( $value['type'], array( 'page', 'info', 'heading' ) ) ) { if ( isset( $value['id'], $settings[($value['id'])] ) ) { $val = $settings[($value['id'])]; // Striping slashes of non-array options if ( !is_array($val) && ! in_array( $value['type'], array( 'textarea' ) ) ) { $val = stripslashes( $val ); } } } if ( !empty($value['before']) ) { $output .= $value['before']; } // Wrap all options if ( !in_array( $value['type'], $elements_without_wrap ) ) { $data_attr = ''; if ( in_array( $value['type'], array( 'radio', 'checkbox', 'select', 'slider', 'images' ) ) ) { $data_attr .= ' data-value="' . esc_attr( $val ) . '"'; } // Keep all ids lowercase with no spaces $value['id'] = preg_replace('/(\W!-)/', '', 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['divider'] ) && in_array( $value['divider'], array( 'top', 'surround' ) ) ) { $output .= '
' . "\n"; } $output .= '
' . "\n"; if ( !empty( $value['name'] ) ) { $output .= '
' . ( !empty( $value['name'] ) ? esc_html( $value['name'] ): '' ) . "\n"; if ( isset( $value['desc'] ) ) { $explain_value = $value['desc']; $output .= '
' . esc_html( $explain_value ) . '
'."\n"; } $output .= '
' . "\n"; } if ( $value['type'] != 'editor' ) { if ( empty( $value['name'] ) ) { $output .= '
' . "\n"; } else { $output .= '
' . "\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 .= '' . esc_attr($title) .''; $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 .= '
'."\n".''; } $counter++; if ( $counter >= 2 ) { $output .= '
'."\n"; } $class = ''; $class = ! empty( $value['id'] ) ? $value['id'] : $value['name']; $class = preg_replace('/[^a-zA-Z0-9._\-]/', '', strtolower($class) ); $output .= '
'; break; /* Custom fields */ // Background case 'background_img': $preset_images = empty( $value['preset_images'] ) ? presscore_opts_get_bg_images( $value['id'] ) : $value['preset_images']; $img_preview = false; if ( $preset_images ) { $output .= '
'; if ( empty( $value['images_base_dir'] ) ) { $dir = get_template_directory_uri(); } else { $dir = $value['images_base_dir']; } foreach ( $preset_images as $full_src=>$thumb_src ) { $selected = ''; $img = $dir . $thumb_src; $data_img = $dir . $full_src; if ( strpos($val['image'], $full_src) !== false ) { $selected = ' of-radio-img-selected'; $img_preview = $img; } $output .= ''; } $output .= '
'; } $background = $val; // Background Image if ( !isset($background['image']) ) { $background['image'] = ''; } $output .= optionsframework_uploader( $value['id'], $background['image'], null, null, esc_attr( $option_name . '[' . $value['id'] . '][image]' ) ); $class = 'of-background-properties'; if ( '' == $background['image'] ) { $class .= ' hide'; } $output .= '
'; if ( !isset($value['fields']) || in_array('repeat', (array) $value['fields']) ) { // Background Repeat $output .= ''; } if ( !isset($value['fields']) || in_array('position_x', (array) $value['fields']) ) { // Background Position x $output .= ''; } if ( !isset($value['fields']) || in_array('position_y', (array) $value['fields']) ) { // Background Position y $output .= ''; } // Background Attachment $output .= '
'; break; // Block case "block": case "block_begin": if ( $in_block ) { $in_block = false; $output .= '
'."\n".''; } $in_block = true; $class = 'section'; $id = ''; if ( isset( $value['type'] ) ) { $class .= ' section-' . $value['type']; } if ( isset( $value['class'] ) ) { $class .= ' ' . $value['class']; } if( isset( $value['id'] ) ){ $id .= ' id="' . esc_attr($value['id']) . '"'; } $output .= ''."\n"; if( isset($value['name']) && !empty($value['name']) ){ $output .= '

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

' . "\n"; } break; // Page case "page": break; // fields generator case "fields_generator": if ( ! isset( $value['options']['fields'] ) || ! is_array( $value['options']['fields'] ) ) { break; } $del_link = ''; $output .= '
    '; // saved elements if ( is_array( $val ) ) { $i = 0; // create elements foreach ( $val as $index=>$field ) { $block = $b_title = ''; // use patterns foreach ( $value['options']['fields'] as $name => $data ) { // if only_for list isset and current index not in the list - skip this element if ( isset( $data['only_for'] ) && is_array( $data['only_for'] ) && ! in_array( $index, $data['only_for'] ) ) { continue; } // checked если поле присутствует в записи, если нет поля value в шаблоне // или если оно есть и равно значению поля в записи $checked = false; if ( isset( $field[$name] ) && ( ! isset( $data['value'] ) || ( isset( $data['value'] ) && $data['value'] == $field[$name] ) ) ) { $checked = true; } // get the title if ( isset( $data['class'] ) && 'of_fields_gen_title' == $data['class'] ) { $b_title = $field[$name]; } $el_args = array( 'name' => sprintf('%s[%s][%d][%s]', $option_name, $value['id'], $index, $name ), 'description' => isset($data['description']) ? $data['description'] : '', 'class' => isset($data['class']) ? $data['class'] : '', 'value' => ('checkbox' == $data['type']) ? '' : $field[$name], 'checked' => $checked ); if ( 'select' == $data['type'] ) { $el_args['options'] = isset($data['options']) ? $data['options'] : array(); $el_args['selected'] = $el_args['value']; } if( isset($data['desc_wrap']) ) { $el_args['desc_wrap'] = $data['desc_wrap']; } if( isset($data['wrap']) ) { $el_args['wrap'] = $data['wrap']; } if( isset($data['style']) ) { $el_args['style'] = $data['style']; } // create form elements $element = dt_create_tag( $data['type'], $el_args); $block .= $element; } unset($data); $output .= ''; $i++; } unset($field); } $output .= '
'; // control panel $output .= '
'; if ( ! empty( $value['options']['title'] ) ) { $output .= '
' . esc_html( $value['options']['title'] ) . '
'; } // use pattern foreach( $value['options']['fields'] as $name => $data ) { if( isset($data['only_for']) ) continue; $el_args = array( 'name' => sprintf('%s[%s][%s]', $option_name, $value['id'], $name ), 'description' => isset($data['description']) ? $data['description'] : '', 'class' => isset($data['class']) ? $data['class'] : '', 'checked' => isset($data['checked']) ? $data['checked'] : false ); if ( 'select' == $data['type'] ) { $el_args['options'] = isset($data['options']) ? $data['options'] : array(); $el_args['selected'] = isset($data['selected']) ? $data['selected'] : false; } if( isset($data['desc_wrap']) ) { $el_args['desc_wrap'] = $data['desc_wrap']; } if( isset($data['wrap']) ) { $el_args['wrap'] = $data['wrap']; } if( isset($data['style']) ) { $el_args['style'] = $data['style']; } if( isset($data['value']) ) { $el_args['value'] = $data['value']; } // create form $element = dt_create_tag( $data['type'], $el_args); $output .= $element; } unset($data); // add button $button = dt_create_tag( 'button', array( 'name' => $option_name. '[' . $value['id'] . '][add]', 'title' => isset($value['options']['button']['title'])?$value['options']['button']['title']:_x('Add', 'backend fields button', 'the7mk2'), 'class' => 'of_fields_gen_add button-secondary' )); $output .= $button; $output .= '
'; break; // Social icons case 'social_icons': if ( !isset($value['options']) || !is_array($value['options']) ) { continue; } foreach( $value['options'] as $class=>$desc ) { $name = sprintf( '%s[%s][%s]', $option_name, $value['id'], $class ); $link = isset($val[ $class ]) ? $val[ $class ] : ''; $maxlength = isset( $value['maxlength'] )?' maxlength="' .$value['maxlength']. '"':''; $output .= ''; } break; // fields generator alpha case "fields_generator_alpha": if ( !empty($value['options']['interface_filter']) && function_exists($value['options']['interface_filter']) ) { add_filter('optionsframework_interface_fields_generator', $value['options']['interface_filter'], 10, 2); } $del_link = ''; $name = sprintf( '%s[%s]', $option_name, $value['id'] ); $output .= '
    '; // saved elements if ( is_array( $val ) ) { $next_id = isset($val['next_id']) ? $val['next_id'] : max(array_keys($val)); $output .= ''; $i = 0; // create elements foreach ( $val as $field_id=>$field_data ) { $title = empty($field_data['title']) ? _x('no title', 'theme-options', 'the7mk2') : $field_data['title']; $output .= ''; $i++; } unset($field); } $output .= '
'; // control panel $output .= '
'; $output .= apply_filters('optionsframework_interface_fields_generator', '', $value); $output .= '
'; break; // Social icons case 'social_icon': if( !isset($value['options']['fields']) || !is_array($value['options']['fields']) ) { continue; } $w = $h = '20'; if( !empty($value['options']['ico_width']) ) { $w = intval($value['options']['ico_width']); } if( !empty($value['options']['ico_height']) ) { $h = intval($value['options']['ico_height']); } $ico_size = sprintf( 'width: %dpx;height: %dpx;', $w, $h ); foreach( $value['options']['fields'] as $field=>$ico ) { $defaults = array( 'img' => '', 'desc' => '' ); $ico = wp_parse_args( (array)$ico, $defaults ); extract( $ico ); $name = sprintf( '%s[%s][%s]', $option_name, $value['id'], $field ); $soc_link = isset( $val[ $field ], $val[ $field ]['link'] ) ? $val[ $field ]['link'] : ''; $src = isset( $val[ $field ], $val[ $field ]['src'] ) ? $val[ $field ]['src'] : ''; $maxlength = isset( $value['maxlength'] )?' maxlength="' .$value['maxlength']. '"':''; $output .= ''; $output .= '
'; } break; // Slider case 'slider': $classes = array( 'of-slider' ); if ( !empty( $value['options']['java_hide_if_not_max'] ) ) { $classes[] = 'of-js-hider'; $classes[] = 'js-hide-if-not-max'; } else if( !empty( $value['options']['java_hide_global_not_max'] ) ) { $classes[] = 'of-js-hider-global'; $classes[] = 'js-hide-if-not-max'; } $classes = implode( ' ', $classes ); $output .= '
'; $slider_opts = array( 'max' => isset( $value['options']['max'] ) ? intval( $value['options']['max'] ) : 100, 'min' => isset( $value['options']['min'] ) ? intval( $value['options']['min'] ) : 0, 'step' => isset( $value['options']['step'] ) ? intval( $value['options']['step'] ) : 1, 'value' => isset( $val ) ? intval( $val ) : 100 ); $str = ''; foreach( $slider_opts as $name=>$val ) { $str .= ' data-' . $name . '="' . esc_attr( $val ) . '"'; } $output .= ''; break; // Hidden area begin case 'js_hide_begin': $class = 'of-js-hide'; if ( ! isset( $value['hidden_by_default'] ) || $value['hidden_by_default'] ) { $class .= ' hide-if-js'; } if ( !empty( $value['class'] ) ) { $class .= ' ' . $value['class']; } $output .= '
'; break; // Hidden area end case 'js_hide_end': $output .= '
'; break; // Social buttons case 'social_buttons': $social_buttons = (array)apply_filters('optionsframework_interface-social_buttons', array()); if ( empty($social_buttons) ) { $output .= '

Use "optionsframework_interface-social_buttons" filter to add some buttons.

'; break; } $saved_buttons = isset($val) ? (array) $val : array(); $output .= '
    '; $output .='
  • '; foreach ( $saved_buttons as $field ) { $output .= '
  • ' . $social_buttons[ $field ] . '
  • '; } $output .= '
'; $output .= '
    '; foreach ( $social_buttons as $v=>$desc ) { if ( in_array($v, $saved_buttons) ) continue; $output .= '
  • ' . $desc . '
  • '; } $output .= '
'; break; // Web fonts case 'web_fonts': // Replace & coz in db value sanitized with esc_attr(). $val = str_replace( '&', '&', $val ); $id = esc_attr( $value['id'] ); $data_attr = ''; if ( isset( $value['fonts'] ) ) { $value['fonts'] = in_array( $value['fonts'], array( 'safe', 'web', 'all' ) ) ? $value['fonts'] : 'all'; $data_attr .= ' data-fonts-group="' . esc_attr( $value['fonts'] ) . '"'; $fonts = optionsframework_get_fonts_options( $value['fonts'] ); if ( $val && isset( $fonts[ $val ] ) ) { $value['options'] = array( $val => $fonts[ $val ] ); } else { reset( $fonts ); $value['options'] = array( key( $fonts ) => current( $fonts ) ); } unset( $fonts ); } $output .= ''; $output .= '
Silence is a true friend who never betrays.
'; break; case 'square_size': $id = esc_attr( $value['id'] ); $output .= ''; $output .= '×'; $output .= ''; break; // import/export theme options case 'import_export_options': $rows = '8'; if ( isset( $value['settings']['rows'] ) ) { $custom_rows = $value['settings']['rows']; if ( is_numeric( $custom_rows ) ) { $rows = $custom_rows; } } $valid_settings = $settings; $fields_black_list = apply_filters( 'optionsframework_fields_black_list', array() ); // do not export preserved settings foreach ( $fields_black_list as $black_setting ) { if ( array_key_exists($black_setting, $valid_settings) ) { unset( $valid_settings[ $black_setting ] ); } } $val = base64_encode( serialize( $valid_settings ) ); $output .= ''; break; case 'title': $output .= '
'; $output .= '

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

'; $output .= '
'; break; case 'divider': $output .= '
'; break; // Gradient case "gradient": $default_color = ''; if ( isset($value['std'][0]) ) { if ( $val != $value['std'][0] ) $default_color_1 = ' data-default-color="' .$value['std'][0] . '" '; } if ( isset($value['std'][1]) ) { if ( $val != $value['std'][1] ) $default_color_2 = ' data-default-color="' .$value['std'][1] . '" '; } $output .= ''; $output .= ' '; $output .= ''; break; // sortable case 'sortable': if ( !empty($value['items']) ) { $sortable_items = $value['items']; } else { $output .= '

No items specified. It needs array( id1 => name1, id2 => name2 ).

'; break; } $saved_items = isset($val) ? (array) $val : array(); $config_icon = ''; if ( !empty( $value['fields'] ) && is_array($value['fields']) ) { $fields_count = 0; $output .= '
'; foreach ( $value['fields'] as $field_id=>$field_settings ) { // classes $field_classes = 'connectedSortable content-holder'; if ( !empty( $field_settings['class'] ) ) { $field_classes .= ' ' . $field_settings['class']; } // items name $item_name = esc_attr( sprintf( '%1$s[%2$s][%3$s][]', $option_name, $value['id'], $field_id ) ); // saved items $saved_field_items = array_key_exists($field_id, $saved_items) ? $saved_items[ $field_id ] : array(); // field title if ( !empty($field_settings['title']) ) { $output .= '
' . ++$fields_count . '. ' . esc_html($field_settings['title']) . '
'; } $output .= '
'; // output fields $output .= '
    '; $output .='
  • '; if ( !empty($saved_field_items) && is_array( $saved_field_items ) ) { foreach ( $saved_field_items as $item_value ) { if ( ! array_key_exists( $item_value, $sortable_items ) ) { continue; } $item_settings = $sortable_items[ $item_value ]; $item_title = empty($item_settings['title']) ? 'undefined' : esc_html( $item_settings['title'] ); $item_class = empty($item_settings['class']) ? '' : ' ' . esc_attr( $item_settings['class'] ); $output .= '
  • ' . $item_title . '' . $config_icon . '
  • '; // remove item from palette list unset( $sortable_items[ $item_value ] ); } } $output .= '
'; $output .= '
'; } $output .= '
'; } $output .= '
'; // palette title if ( !empty($value['palette_title']) ) { $output .= '
' . esc_html($value['palette_title']) . '
'; } $output .= '
    '; foreach ( $sortable_items as $item_value=>$item_settings ) { $item_title = empty($item_settings['title']) ? 'undefined' : esc_html( $item_settings['title'] ); $item_class = empty($item_settings['class']) ? '' : ' ' . esc_attr( $item_settings['class'] ); $output .= '
  • ' . $item_title . '' . $config_icon . '
  • '; } $output .= '
'; $output .= '
'; break; // Select Box case 'pages_list': $html = wp_dropdown_pages( array( 'name' => esc_attr( $option_name . '[' . $value['id'] . ']' ), 'id' => esc_attr( $value['id'] ), 'echo' => 0, 'show_option_none' => __( '— Select —', 'the7mk2' ), 'option_none_value' => '0', 'selected' => $val, 'post_status' => 'publish,private,draft' ) ); $html = str_replace( '
'; // STD. $debug_std = null; if ( isset( $value['std'] ) && ! is_array( $value['std'] ) ) { $debug_std = $value['std']; } else if ( isset( $value['std'] ) && 'gradient' === $value['type'] ) { $debug_std = implode( ', ', $value['std'] ); } if ( null !== $debug_std ) { $output .= '
STD: ' . esc_html( $debug_std ) . '
'; } // EXPORT. if ( in_array( $value['id'], $do_not_export ) ) { $output .= '
EXPORTABLE: no
'; } // PRESERVE. if ( in_array( $value['id'], $preserved_options ) ) { $output .= '
PRESERVED: yes
'; } $output .= '
'; } $output .= '
'; if ( isset( $value['divider'] ) && in_array( $value['divider'], array( 'bottom', 'surround' ) ) ) { $output .= '
' . "\n"; } $output .= ''; } if ( !empty($value['after']) ) { $output .= $value['after']; } do_action( 'options-interface-before-output', $output, $value, $val ); echo apply_filters( 'options-interface-output', $output, $value, $val ); } if ( $in_block ) { echo ''."\n".''; } echo ''; } function optionsframework_get_fonts_options( $group = 'all' ) { switch ( $group ) { case 'safe': return presscore_options_get_safe_fonts(); case 'web': return presscore_options_get_web_fonts(); case 'all': default: return presscore_options_get_all_fonts(); } } function optionsframework_fonts_ajax_response() { if ( ! check_ajax_referer( 'options-framework-ajax-fonts-nonce', false, false ) || ! current_user_can( 'edit_theme_options' ) ) { wp_send_json_error(); } $fonts = optionsframework_get_fonts_options( isset( $_POST['fontsGroup'] ) ? $_POST['fontsGroup'] : '' ); $html = ''; foreach ( $fonts as $key => $option ) { $html .= ''; } wp_send_json_success( $html ); } add_action( 'wp_ajax_of_get_fonts', 'optionsframework_fonts_ajax_response' );