Initial Commit
This commit is contained in:
76
views/settings/fields/field-ajax_button.php
Normal file
76
views/settings/fields/field-ajax_button.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Ajax button field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
<button class="button" name="<?php echo esc_attr($field->id); ?>" id="<?php echo esc_attr($field->id); ?>" value="<?php echo wp_create_nonce($field->action); ?>">
|
||||
<?php echo $field->title; ?>
|
||||
</button>
|
||||
</label>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$('#<?php echo esc_js($field->id); ?>').on('click', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var $this = $(this);
|
||||
var default_label = $this.html();
|
||||
|
||||
$this.html('...').attr('disabled', 'disabled');
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo esc_js(admin_url('admin-ajax.php?action=').$field->action); ?>",
|
||||
dataType: "json",
|
||||
success: function(response) {
|
||||
|
||||
$this.html(response.message);
|
||||
|
||||
setTimeout(function() {
|
||||
$this.html(default_label).removeAttr('disabled');
|
||||
}, 4000);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
50
views/settings/fields/field-checkbox.php
Normal file
50
views/settings/fields/field-checkbox.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Checkbox field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<input type='hidden' value='0' name="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<input <?php checked(wu_get_setting($field_slug)); ?> name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" id="<?php echo esc_attr($field->id); ?>" value="1">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
51
views/settings/fields/field-color.php
Normal file
51
views/settings/fields/field-color.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Color field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<input class="field-<?php echo esc_attr($field->id); ?>" name="<?php echo esc_attr($field->id); ?>" type="text" id="<?php echo esc_attr($field->id); ?>" class="regular-text" value="<?php echo wu_get_setting($field->id); ?>" placeholder="<?php echo $field->placeholder ? $field->placeholder : ''; ?>">
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function($) {
|
||||
$(function() {
|
||||
// Add Color Picker to all inputs that have 'color-field' class
|
||||
$('.field-<?php echo esc_attr($field->id); ?>').wpColorPicker();
|
||||
});
|
||||
})(jQuery);
|
||||
</script>
|
11
views/settings/fields/field-heading.php
Normal file
11
views/settings/fields/field-heading.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Heading field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-m-0" id="<?php echo esc_attr($field->id); ?>" data-type="heading">
|
||||
<h3 class="wu-m-0 wu-my-2"><?php echo $field->title; ?></h3>
|
||||
<p class="wu-m-0 wu-my-2"><?php echo $field->desc; ?></p>
|
||||
</div>
|
10
views/settings/fields/field-heading_collapsible.php
Normal file
10
views/settings/fields/field-heading_collapsible.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Heading collapsible field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div data-target="<?php echo 'collapsible-'.$field_slug; ?>" class="wu-settings-heading-collapsible wu-col-sm-12 <?php echo isset($field['active']) && !$field['active'] ? 'wu-settings-heading-collapsible-disabled' : ''; ?>">
|
||||
<?php echo $field['title']; ?>
|
||||
</div>
|
60
views/settings/fields/field-image.php
Normal file
60
views/settings/fields/field-image.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* Image field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
// We need to get the media scripts
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_script('media');
|
||||
|
||||
$suffix = WU_Scripts()->suffix();
|
||||
|
||||
wp_enqueue_script('wu-field-button-upload', WP_Ultimo()->get_asset("wu-field-image$suffix.js", 'js'));
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="<?php echo $field_slug; ?>"><?php echo $field['title']; ?></label></th>
|
||||
<td>
|
||||
|
||||
<?php $image_url = WU_Settings::get_logo('full', wu_get_setting($field_slug));
|
||||
|
||||
if (!$image_url && isset($field['default'])) $image_url = $field['default'];
|
||||
|
||||
if ( $image_url ) {
|
||||
$image = '<img id="%s" src="%s" alt="%s" style="width:%s; height:auto">';
|
||||
printf(
|
||||
$image,
|
||||
$field_slug.'-preview',
|
||||
$image_url,
|
||||
get_bloginfo('name'),
|
||||
$field['width'].'px'
|
||||
);
|
||||
|
||||
} ?>
|
||||
|
||||
<br>
|
||||
|
||||
<a href="#" class="button wu-field-button-upload" data-target="<?php echo $field_slug; ?>">
|
||||
<?php echo $field['button']; ?>
|
||||
</a>
|
||||
|
||||
<a data-default="<?php echo $field['default']; ?>" href="#" class="button wu-field-button-upload-remove" data-target="<?php echo $field_slug; ?>">
|
||||
<?php _e('Remove Image', 'wp-ultimo'); ?>
|
||||
</a>
|
||||
|
||||
<?php if (!empty($field['desc'])) : ?>
|
||||
<p class="description" id="<?php echo $field_slug; ?>-desc">
|
||||
<?php echo $field['desc']; ?>
|
||||
</p>
|
||||
|
||||
<input type="hidden" name="<?php echo $field_slug; ?>" id="<?php echo $field_slug; ?>" value="<?php echo wu_get_setting($field_slug) ? wu_get_setting($field_slug) : $field['default']; ?>">
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
94
views/settings/fields/field-multi_checkbox.php
Normal file
94
views/settings/fields/field-multi_checkbox.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/**
|
||||
* Multi checkbox field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<tr id="multiselect-<?php echo $field_slug; ?>">
|
||||
<th scope="row"><label for="<?php echo $field_slug; ?>"><?php echo $field['title']; ?></label> <?php echo WU_Util::tooltip($field['tooltip']); ?></th>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
|
||||
// Check if it was selected
|
||||
$settings = wu_get_setting($field_slug);
|
||||
|
||||
if ($settings === false) {
|
||||
|
||||
$settings = isset($field['default']) ? $field['default'] : false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow multi-select
|
||||
* @since 1.5.0
|
||||
*/
|
||||
|
||||
$sortable_class = isset($field['sortable']) && $field['sortable'] ? 'wu-sortable' : '';
|
||||
|
||||
// If sortable, merge settings and list of items
|
||||
if (isset($field['sortable']) && $field['sortable'] && $settings) {
|
||||
|
||||
$_settings = $settings;
|
||||
|
||||
foreach ($_settings as $key => &$value) {
|
||||
|
||||
if (!isset($field['options'][$key])) {
|
||||
|
||||
unset($_settings[$key]);
|
||||
|
||||
continue;
|
||||
|
||||
} // end if;
|
||||
|
||||
$value = $field['options'][$key];
|
||||
|
||||
} // end foreach;
|
||||
|
||||
$field['options'] = $_settings + $field['options'];
|
||||
|
||||
} // end if;
|
||||
|
||||
?>
|
||||
|
||||
<div class="row <?php echo $sortable_class; ?>">
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Loop the values
|
||||
*/
|
||||
foreach ($field['options'] as $field_value => $field_name) :
|
||||
|
||||
// Check this setting
|
||||
$this_settings = isset($settings[$field_value]) ? $settings[$field_value] : false;
|
||||
|
||||
?>
|
||||
|
||||
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
|
||||
|
||||
<label for="multiselect-<?php echo $field_value; ?>">
|
||||
<input <?php checked($this_settings); ?> name="<?php echo sprintf('%s[%s]', $field_slug, $field_value); ?>" type="checkbox" id="multiselect-<?php echo $field_value; ?>" value="1">
|
||||
<?php echo $field_name; ?>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="button" data-select-all="multiselect-<?php echo $field_slug; ?>" class="button wu-select-all"><?php _e('Check / Uncheck All', 'wp-ultimo'); ?></button>
|
||||
|
||||
<br>
|
||||
|
||||
<?php if (!empty($field['desc'])) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field_slug; ?>-desc">
|
||||
<?php echo $field['desc']; ?>
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
44
views/settings/fields/field-note.php
Normal file
44
views/settings/fields/field-note.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Note field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<?php if ($field->title) : ?>
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="<?php echo esc_attr($field->title ? 'wu-w-2/3' : 'wu-w-full'); ?>">
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
54
views/settings/fields/field-select.php
Normal file
54
views/settings/fields/field-select.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Select field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<select name="<?php echo esc_attr($field->id); ?>" id="<?php echo esc_attr($field->id); ?>" class="regular-text">
|
||||
|
||||
<?php foreach ($field->options as $value => $option) : ?>
|
||||
|
||||
<option <?php selected(wu_get_setting($field->id), $value); ?> value="<?php echo esc_attr($value); ?>">
|
||||
|
||||
<?php echo $option; ?>
|
||||
|
||||
</option>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
</select>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
39
views/settings/fields/field-select2.php
Normal file
39
views/settings/fields/field-select2.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Select2 field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
$setting = wu_get_setting($field_slug);
|
||||
|
||||
$setting = is_array($setting) ? $setting : array();
|
||||
|
||||
$placeholder = isset($field['placeholder']) ? $field['placeholder'] : '';
|
||||
|
||||
// WU_Scripts()->enqueue_select2();
|
||||
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="<?php echo $field_slug; ?>"><?php echo $field['title']; ?></label> <?php echo WU_Util::tooltip($field['tooltip']); ?> </th>
|
||||
<td>
|
||||
|
||||
<select data-width="350px" multiple="multiple" placeholder="<?php echo $placeholder; ?>" class="wu-select" name="<?php echo $field_slug; ?>[]" id="<?php echo $field_slug; ?>">
|
||||
|
||||
<?php foreach ($field['options'] as $value => $option) : ?>
|
||||
<option <?php selected(in_array($value, $setting)); ?> value="<?php echo $value; ?>"><?php echo $option; ?></option>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</select>
|
||||
|
||||
<?php if (!empty($field['desc'])) : ?>
|
||||
<p class="description" id="<?php echo $field_slug; ?>-desc">
|
||||
<?php echo $field['desc']; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
48
views/settings/fields/field-text.php
Normal file
48
views/settings/fields/field-text.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Text field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<input <?php echo $field->html_attr ? $field->get_html_attributes() : ''; ?> <?php echo $field->disabled ? 'disabled="disabled"' : ''; ?> name="<?php echo esc_attr($field->id); ?>" type="<?php echo esc_attr($field->type); ?>" id="<?php echo esc_attr($field->id); ?>" class="regular-text" value="<?php echo wu_get_setting($field->id); ?>" placeholder="<?php echo $field->placeholder ? $field->placeholder : ''; ?>">
|
||||
|
||||
<?php if (isset($field->append) && !empty($field->append)) : ?>
|
||||
|
||||
<?php echo $field->append; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
42
views/settings/fields/field-textarea.php
Normal file
42
views/settings/fields/field-textarea.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Textarea field view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<textarea cols="60" rows="7" name="<?php echo esc_attr($field->id); ?>" id="<?php echo esc_attr($field->id); ?>" class="regular-text" placeholder="<?php echo $field->placeholder ? esc_attr($field->placeholder) : ''; ?>"><?php echo esc_textarea(stripslashes(wu_get_setting($field_slug))); ?></textarea>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
46
views/settings/fields/field-wp_editor.php
Normal file
46
views/settings/fields/field-wp_editor.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Field wp_editor view.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
?>
|
||||
<div class="wu-my-6">
|
||||
|
||||
<div class="wu-flex">
|
||||
|
||||
<div class="wu-w-1/3">
|
||||
|
||||
<label for="<?php echo esc_attr($field->id); ?>">
|
||||
|
||||
<?php echo $field->title; ?>
|
||||
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="wu-w-2/3">
|
||||
|
||||
<div style="max-width: 800px;">
|
||||
|
||||
<?php wp_editor(wu_get_setting($field->id), $field->id, $field->args); ?>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if ($field->desc) : ?>
|
||||
|
||||
<p class="description" id="<?php echo $field->id; ?>-desc">
|
||||
|
||||
<?php echo $field->desc; ?>
|
||||
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php // if (isset($field['tooltip'])) {echo WU_Util::tooltip($field['tooltip']);} ?>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user