function stpb_button($pre_name = '', $data_values = array(), $post = false, $no_value = false, $interface = false)
    {
        ?>
        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_text($pre_name . '[button_label]', $data_values['button_label']);
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Button Label', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('This is the text that appears on your button.', 'smooththemes');
        ?>
</span>
            </div>
        </div>

        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_link($pre_name . '[link]', $data_values['link']);
        /* stpb_input_text($pre_name.'[link]',$data_values['link']); */
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Button Link?', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('Where should your Button link to?', 'smooththemes');
        ?>
</span>
            </div>
        </div>

        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_select_one($pre_name . '[style]', $data_values['style'], array('default' => __('Default', 'smooththemes'), 'primary' => __('Primary', 'smooththemes'), 'success' => __('Success', 'smooththemes'), 'info' => __('Info', 'smooththemes'), 'warning' => __('Warning', 'smooththemes'), 'danger' => __('Danger', 'smooththemes'), 'color' => __('Color - Inherit from theme settings', 'smooththemes')), '.sl-button-color');
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Button Style', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('Choose the style of your Button here.', 'smooththemes');
        ?>
</span>
            </div>
        </div>

        <div class="item">
        <p><label><?php 
        stpb_input_checkbox($pre_name . '[is_block]', $data_values['is_block'], 1);
        ?>
&nbsp;<?php 
        _e('Is block button ?', 'smooththemes');
        ?>
</label></p>
        </div>

        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_text($pre_name . '[margin_top]', $data_values['margin_top']);
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Margin Top', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('Top margin in pixel.', 'smooththemes');
        ?>
</span>
            </div>
        </div>

        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_text($pre_name . '[margin_bottom]', $data_values['margin_bottom']);
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Margin Bottom', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('Margin Padding in pixel.', 'smooththemes');
        ?>
</span>
            </div>
        </div>

        <?php 
        /*
                <div  class="item show-on-select-change sl-button-color" show-on="custom">
                    <div class="left width-50">
                        <?php  stpb_input_color($pre_name.'[custom_bg_color]',$data_values['custom_bg_color']); ?>
                    </div>
                    <div class="right  width-50">
                        <strong><?php _e('Button Background Color','smooththemes') ?></strong>
                    </div>
                </div>
        <div  class="item show-on-select-change sl-button-color" show-on="custom">
                    <div class="left width-50">
                        <?php  stpb_input_color($pre_name.'[custom_label_color]',$data_values['custom_label_color']); ?>
                    </div>
                    <div class="right  width-50">
                        <strong><?php _e('Button Label Color','smooththemes') ?></strong>
                    </div>
                </div>
        */
        ?>


        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_select_one($pre_name . '[size]', $data_values['size'], array('btn-normal' => __('Normal', 'smooththemes'), 'btn-sm' => __('Small', 'smooththemes'), 'btn-lg' => __('Large', 'smooththemes')));
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Button Size', 'smooththemes');
        ?>
</strong>
            </div>
        </div>



        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_select_one($pre_name . '[position]', $data_values['position'], array('default' => __('Default', 'smooththemes'), 'center' => __('Center', 'smooththemes'), 'left' => __('Left', 'smooththemes'), 'right' => __('Right', 'smooththemes')));
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Button Position', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('Choose the alignment of your Button here.', 'smooththemes');
        ?>
</span>
            </div>
        </div>


        <div class="item">
            <div class="left width-50">
                <?php 
        stpb_input_select_one($pre_name . '[link_target]', $data_values['link_target'], array('_self' => __('No, open in same window', 'smooththemes'), '_blank' => __('Yes, open in new window', 'smooththemes')));
        ?>
            </div>
            <div class="right  width-50">
                <strong><?php 
        _e('Open Link in new Window?', 'smooththemes');
        ?>
</strong>
                <span><?php 
        _e('Select here if you want to open the linked page in a new window.', 'smooththemes');
        ?>
</span>
            </div>
        </div>


        <div class="item">
            <strong><?php 
        _e('Icon', 'smooththemes');
        ?>
</strong>
            <span><?php 
        _e('Select icon for your Button.', 'smooththemes');
        ?>
</span>
            <?php 
        stpb_input_icon_popup($pre_name . '[icon]', $data_values['icon']);
        ?>
        </div>

    <?php 
    }
示例#2
0
function stpb_input_ui_contact_tpl($name = '', $item_value = array(), $supports = array(), $index = '-1', $titles = array(), $more_fields = array())
{
    $item_value = wp_parse_args($item_value, array('label' => '', 'name' => '', 'field_type' => '', 'field_width' => '', 'placeholder' => '', 'required' => '', 'options' => '', 'css_class' => '', 'format' => ''));
    $field_type = apply_filters('st_contact_field_type', array('text' => __('Text', 'smooththemes'), 'textarea' => __('Textarea', 'smooththemes'), 'select' => __('Select', 'smooththemes'), 'checkbox' => __('Checkbox', 'smooththemes'), 'radio' => __('Radio', 'smooththemes'), 'date' => __('Date', 'smooththemes'), 'captcha' => __('Captcha', 'smooththemes'), 'submit' => __('Submit', 'smooththemes')));
    $field_width = apply_filters('st_contact_field_width', array('field-col1' => __('100%', 'smooththemes'), 'field-col2' => __('50%', 'smooththemes'), 'field-col3' => __('33%', 'smooththemes')));
    $validation = apply_filters('st_contact_validation', array('none' => __('None', 'smooththemes'), 'email' => __('Email', 'smooththemes'), 'number' => __('Number', 'smooththemes'), 'phone' => __('Phone', 'smooththemes')));
    $required = apply_filters('st_contact_required', array('no' => __('No', 'smooththemes'), 'yes' => __('Yes', 'smooththemes')));
    $show_on_name = apply_filters('st_contact_form_show_on_name', array('text', 'textarea', 'select', 'radio', 'checkbox', 'date'));
    $show_on_option = apply_filters('st_contact_form_show_on_option', array('select', 'radio', 'checkbox'));
    $show_on_placeholder = apply_filters('st_contact_form_show_on_placeholder', array('text', 'textarea'));
    $show_on_validation = apply_filters('st_contact_form_show_on_validation', array('text'));
    $show_on_required = apply_filters('st_contact_form_show_on_required', array('text', 'select', 'radio', 'checkbox', 'textarea', 'date'));
    ?>
    <div class="stpb-widget widget closed">
        <div class="ui-handlediv" title="<?php 
    _e('Click to toggle', 'smooththemes');
    ?>
"><i class="iconentypo-down-open"></i></div>
        <span class="remove stwrmt " href="#"><i class="iconentypo-cancel"></i></span>
        <div class="stpb-hndle">
            <i class="iconentypo-move algt"></i>

            <?php 
    if ($supports['label'] == true) {
        ?>
                <p class="algt">
                <span class="live-type"><?php 
        echo $item_value['field_type'] ? esc_html($item_value['field_type']) : __('Text', 'smooththemes');
        ?>
 : </span>
                <span class="live-title"><?php 
        echo esc_html($item_value['label']);
        ?>
</span>
                </p>
            <?php 
    }
    ?>
        </div>
        <div class="inside">
            <div class="widget-content">

                <div class="widget-content">

                    <?php 
    if ($supports['label'] == true) {
        ?>
                    <p>
                        <label><?php 
        echo $titles['label'];
        ?>
</label>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][label]' : '';
        stpb_input_text($name_item, esc_attr($item_value['label']), 'contact-form-item-label', false, 'data-ui-name="[label]"');
        ?>
                    </p>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['name'] == true) {
        ?>
                    <div class="st-builder-item-contact-form-item" show-on="<?php 
        echo implode(' ', $show_on_name);
        ?>
">
                    <p>
                        <label><?php 
        echo $titles['name'];
        ?>
&nbsp;<span class="contact-form-item-name-label">[<?php 
        echo esc_attr($item_value['name']);
        ?>
]</span></label>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][name]' : '';
        stpb_input_hidden($name_item, esc_attr($item_value['name']), 'contact-form-item-name', false, 'data-ui-name="[name]" readonly="true"');
        ?>
                    </p>
                    </div>
                    <?php 
    }
    ?>

                    <?php 
    if ($supports['field_type'] == true) {
        ?>
                    <p>
                        <label><?php 
        echo $titles['field_type'];
        ?>
</label>
                        <select <?php 
        echo $index >= 0 ? ' data-name="' . $name . '[' . $index . '][field_type]' . '" ' : '';
        ?>
  data-ui-name="<?php 
        echo '[field_type]';
        ?>
" class="contact_field_type select select-one-items" show-on-change=".st-builder-item-contact-form-item">
                        <?php 
        foreach ($field_type as $k => $op) {
            $selected = "";
            if ($item_value['field_type'] == $k) {
                $selected = ' selected="selected" ';
            }
            echo '<option ' . $selected . 'value="' . esc_attr($k) . '" >' . esc_html($op) . '</option>';
        }
        ?>
                        </select>
                    </p>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['options'] == true) {
        ?>
                    <div class="st-builder-item-contact-form-item" show-on="<?php 
        echo implode(' ', $show_on_option);
        ?>
">
                    <p>
                        <label><?php 
        echo $titles['options'];
        ?>
</label>
                        <ul class="contact-form-list-items-option">
                            <?php 
        $op = $item_value['options'];
        $ops = explode('-|-', $item_value['options']);
        if (count($ops) > 0) {
            foreach ($ops as $item) {
                ?>
                            <li class="st-builder-item-contact-form-item-option">
                                <input type="text" value="<?php 
                echo $item;
                ?>
" class="contact-form-value-option" />
                                <a href="#" class="st-builder-item-contact-form-sort-option"><i class="iconentypo-arrow-combo"></i></a>
                                <a href="#" class="st-builder-item-contact-form-remove-option"><i class="iconentypo-minus-circled"></i></a>                                
                            </li>
                            <?php 
            }
        }
        ?>
                        </ul>
                        <a href="#" class="button st-builder-item-contact-form-add-option"><?php 
        _e('Add new');
        ?>
 <i class="iconentypo-plus-circled"></i></a>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][options]' : '';
        stpb_input_text($name_item, $item_value['options'], 'hide contact-form-tmp-value-option', false, 'data-ui-name="[options]"');
        ?>
                    </p>
                        <div class="st-builder-item-contact-form-item-option-tpl">
                            <input type="text" value="" class="contact-form-value-option" />
                            <a href="#" class="st-builder-item-contact-form-sort-option"><i class="iconentypo-arrow-combo"></i></a>
                            <a href="#" class="st-builder-item-contact-form-remove-option"><i class="iconentypo-minus-circled"></i></a>
                        </div>
                    </div>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['field_width'] == true) {
        ?>
                    <p>
                        <label><?php 
        echo $titles['field_width'];
        ?>
</label>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][field_width]' : '';
        stpb_input_select_one($name_item, $item_value['field_width'], $field_width, '', '', false, 'data-ui-name="[field_width]"');
        ?>
                    </p>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['placeholder'] == true) {
        ?>
                    <div class="st-builder-item-contact-form-item" show-on="<?php 
        echo implode(' ', $show_on_placeholder);
        ?>
">
                    <p>
                        <label><?php 
        echo $titles['placeholder'];
        ?>
</label>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][placeholder]' : '';
        stpb_input_text($name_item, esc_attr($item_value['placeholder']), '', false, 'data-ui-name="[placeholder]"');
        ?>
                    </p>
                    </div>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['validation'] == true) {
        ?>
                    <div class="st-builder-item-contact-form-item" show-on="<?php 
        echo implode(' ', $show_on_validation);
        ?>
">
                        <p>
                            <label><?php 
        echo $titles['validation'];
        ?>
</label>
                            <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][validation]' : '';
        stpb_input_select_one($name_item, $item_value['validation'], $validation, '', '', false, 'data-ui-name="[validation]"');
        ?>
                        </p>
                    </div>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['required'] == true) {
        ?>
                    <div class="st-builder-item-contact-form-item" show-on="<?php 
        echo implode(' ', $show_on_required);
        ?>
">
                    <p>
                        <label><?php 
        echo $titles['required'];
        ?>
</label>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][required]' : '';
        stpb_input_select_one($name_item, $item_value['required'], $required, '', '', false, 'data-ui-name="[required]"');
        ?>
                    </p>
                    </div>
                    <?php 
    }
    ?>
                    
                    <?php 
    if ($supports['css_class'] == true) {
        ?>
                    <p>
                        <label><?php 
        echo $titles['css_class'];
        ?>
</label>
                        <?php 
        $name_item = $index >= 0 ? $name . '[' . $index . '][css_class]' : '';
        stpb_input_text($name_item, esc_attr($item_value['css_class']), '', false, 'data-ui-name="[css_class]"');
        ?>
                    </p>
                    <?php 
    }
    ?>

                    <?php 
    if (is_array($more_fields)) {
        foreach ($more_fields as $field) {
            if ($field['type'] == 'heading') {
                ?>
                                <div class="ui-heading">
                                   <?php 
                echo $field['title'];
                ?>
                                </div>
                            <?php 
            } elseif ($field['type'] == 'text') {
                ?>
                                <p><label><?php 
                echo $field['title'];
                ?>
</label>
                                <input type="text" class="ui-input" <?php 
                echo $index >= 0 ? ' data-name="' . $name . '[' . $index . '][' . $field['name'] . ']' . '" ' : '';
                ?>
 data-ui-name="<?php 
                echo '[' . $field['name'] . ']';
                ?>
" value="<?php 
                echo esc_attr($item_value[$field['name']]);
                ?>
" >
                                </p>
                                <?php 
            } else {
                if ($field['type'] == 'upload') {
                    ?>
                                <div class="ui-item-image" >
                                    <label><?php 
                    echo $field['title'];
                    ?>
</label>
                                    <span class="st-upload-wrap">
                                        <input type="text" <?php 
                    echo $index >= 0 ? ' data-name="' . $name . '[' . $index . '][' . $field['name'] . ']' . '" ' : '';
                    ?>
  data-ui-name="<?php 
                    echo '[' . $field['name'] . ']';
                    ?>
" class="st-upload-input input-upload" value="<?php 
                    echo esc_attr($item_value[$field['name']]);
                    ?>
">
                                        <input type="button" class="st-upload-button button-primary" value="<?php 
                    _e('Select image', 'smooththemes');
                    ?>
"/>

                                        <a href="#" <?php 
                    echo $item_value[$field['name']] != '' ? '' : ' style="display: none;" ';
                    ?>
 class="remove_image" title="<?php 
                    _e('Remove', 'smooththemes');
                    ?>
"><i class="iconentypo-cancel"></i></a>
                                    </span>
                                </div>
                                <?php 
                } else {
                    if ($field['type'] == 'link') {
                        ?>
                                <div class="ui-link">
                                <label><?php 
                        echo $field['title'];
                        ?>
</label>
                                <?php 
                        stpb_input_link($name . '[' . $index . '][' . $field['name'] . ']', $item_value[$field['name']], ' data-ui-name="[' . $field['name'] . ']" ');
                        ?>
                                </div>
                                <?php 
                    }
                }
            }
        }
    }
    ?>

                    <?php 
    if ($supports['content'] == true) {
        ?>
                    <div class="st-editor">
                    <textarea class="ui-cont ui-input" rows="10" <?php 
        echo $index >= 0 ? ' data-name="' . $name . '[' . $index . '][content]' . '" ' : '';
        ?>
  data-ui-name="<?php 
        echo '[content]';
        ?>
"><?php 
        echo esc_attr($item_value['content']);
        ?>
</textarea>
                    </div>
                    <span class="desc"><?php 
        _e('Arbitrary text or HTML', 'smooththemes');
        ?>
</span>
                    <p><label><input type="checkbox" <?php 
        echo $item_value['autop'] == 1 ? ' checked="checked" ' : '';
        ?>
  <?php 
        echo $index >= 0 ? ' data-name="' . $name . '[' . $index . '][autop]' . '" ' : '';
        ?>
 data-ui-name="<?php 
        echo '[autop]';
        ?>
" value="1" class="ui-autop" >&nbsp;<?php 
        _e('Automatically add paragraphs', 'smooththemes');
        ?>
</label></p>

                    <?php 
    }
    ?>

                </div>

                <div class="widget-control-actions">
                    <div class="alignleft">
                        <a class="remove" href="#remove"><?php 
    _e('Remove', 'smooththemes');
    ?>
</a> |
                        <a class="close" href="#close"><?php 
    _e('Close', 'smooththemes');
    ?>
</a>
                    </div>
                    <br class="clear">
                </div>
            </div>

        </div>
    </div>
    <?php 
}