Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View 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>

View File

@ -0,0 +1,338 @@
<div id="general" data-type="heading" class="wu-bg-gray-100 wu--mt-1 wu--mx-3 wu-p-4 wu-border-solid wu-border-b wu-border-l-0 wu-border-r-0 wu-border-t-0 wu-border-gray-300">
<h3 class="wu-m-0 wu-p-0 wu-uppercase wu-text-gray-600 wu-text-sm wu-tracking-wide">General Options</h3>
<p class="wu-m-0 wu-p-0 wu-text-gray-600">Here we define some of the fundamental settings of the plugin.</p>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="trial">Trial Period</label> </th>
<td>
<input min="0" name="trial" type="number" id="trial" class="regular-text" value="0" placeholder="">
<p class="description" id="trial-desc">
Number of days for the trial period. Leave 0 to disable trial.
</p>
</td>
</tr>
</tbody>
</table>
<div id="general" data-type="heading" class="wu-bg-gray-100 wu--mt-1 wu--mx-3 wu-p-4 wu-border-solid wu-border-b wu-border-l-0 wu-border-r-0 wu-border-t wu-border-gray-300">
<h3 class="wu-m-0 wu-p-0 wu-uppercase wu-text-gray-600 wu-text-sm wu-tracking-wide">Currency Options</h3>
<p class="wu-m-0 wu-p-0 wu-text-gray-600">The following options affect how prices are displayed on the frontend, the backend and in reports.</p>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="currency_symbol">Currency Symbol</label> </th>
<td>
<select name="currency_symbol" id="currency_symbol">
<option value="AED">United Arab Emirates Dirham (د.إ)</option>
<option value="ARS">Argentine Peso ($)</option>
<option value="AUD">Australian Dollars ($)</option>
<option value="BDT">Bangladeshi Taka (&nbsp;)</option>
<option value="BRL">Brazilian Real (R$)</option>
<option value="BGN">Bulgarian Lev (лв.)</option>
<option value="CAD">Canadian Dollars ($)</option>
<option value="CLP">Chilean Peso ($)</option>
<option value="CNY">Chinese Yuan (¥)</option>
<option value="COP">Colombian Peso ($)</option>
<option value="CZK">Czech Koruna ()</option>
<option value="DKK">Danish Krone (DKK)</option>
<option value="DOP">Dominican Peso (RD$)</option>
<option value="EUR">Euros ()</option>
<option value="HKD">Hong Kong Dollar ($)</option>
<option value="HRK">Croatia kuna (Kn)</option>
<option value="HUF">Hungarian Forint (Ft)</option>
<option value="ISK">Icelandic krona (Kr.)</option>
<option value="IDR">Indonesia Rupiah (Rp)</option>
<option value="INR">Indian Rupee (Rs.)</option>
<option value="NPR">Nepali Rupee (Rs.)</option>
<option value="ILS">Israeli Shekel ()</option>
<option value="JPY">Japanese Yen (¥)</option>
<option value="KES">Kenyan Shilling (KSh)</option>
<option value="KIP">Lao Kip ()</option>
<option value="KRW">South Korean Won ()</option>
<option value="MYR">Malaysian Ringgits (RM)</option>
<option value="MXN">Mexican Peso ($)</option>
<option value="NGN">Nigerian Naira ()</option>
<option value="NOK">Norwegian Krone (kr)</option>
<option value="NZD">New Zealand Dollar ($)</option>
<option value="PYG">Paraguayan Guaraní ()</option>
<option value="PHP">Philippine Pesos ()</option>
<option value="PLN">Polish Zloty ()</option>
<option value="GBP">Pounds Sterling (£)</option>
<option value="RON">Romanian Leu (lei)</option>
<option value="RUB">Russian Ruble (руб.)</option>
<option value="SGD">Singapore Dollar ($)</option>
<option value="ZAR">South African rand (R)</option>
<option value="SEK">Swedish Krona (kr)</option>
<option value="CHF">Swiss Franc (CHF)</option>
<option value="TWD">Taiwan New Dollars (NT$)</option>
<option value="THB">Thai Baht (฿)</option>
<option value="TRY">Turkish Lira ()</option>
<option value="UAH">Ukrainian Hryvnia ()</option>
<option selected="selected" value="USD">US Dollars ($)</option>
<option value="VND">Vietnamese Dong ()</option>
<option value="EGP">Egyptian Pound (EGP)</option>
</select>
<p class="description" id="currency_symbol-desc">
Select the currency symbol to be used in WP Ultimo
</p>
</td>
</tr>
<tr>
<th scope="row"><label for="currency_position">Currency Position</label> </th>
<td>
<select name="currency_position" id="currency_position">
<option value="%s%v">Left ($99.99)</option>
<option value="%v%s">Right (99.99$)</option>
<option selected="selected" value="%s %v">Left with space ($ 99.99)</option>
<option value="%v %s">Right with space (99.99 $)</option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="decimal_separator">Decimal Separator</label> </th>
<td>
<input name="decimal_separator" type="text" id="decimal_separator" class="regular-text" value="."
placeholder="">
</td>
</tr>
<tr>
<th scope="row"><label for="thousand_separator">Thousand Separator</label> </th>
<td>
<input name="thousand_separator" type="text" id="thousand_separator" class="regular-text" value=","
placeholder="">
</td>
</tr>
<tr>
<th scope="row"><label for="precision">Number of Decimals</label> </th>
<td>
<input min="0" name="precision" type="number" id="precision" class="regular-text" value="2"
placeholder="">
</td>
</tr>
</tbody>
</table>
<div id="dashboard_elements" data-type="heading">
<h3>Subscriber Dashboard Options</h3>
<p>Control the elements added to the Subscriber's Dashboard.</p>
</div>
<table class="form-table">
<tbody>
<tr id="multiselect-limits_and_quotas">
<th scope="row"><label for="limits_and_quotas">Limits and Quotas</label> </th>
<td>
<div class="row ">
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
<label for="multiselect-post">
<input checked="checked" name="limits_and_quotas[post]" type="checkbox" id="multiselect-post"
value="1">
Posts </label>
</div>
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
<label for="multiselect-page">
<input checked="checked" name="limits_and_quotas[page]" type="checkbox" id="multiselect-page"
value="1">
Pages </label>
</div>
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
<label for="multiselect-attachment">
<input checked="checked" name="limits_and_quotas[attachment]" type="checkbox"
id="multiselect-attachment" value="1">
Media </label>
</div>
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
<label for="multiselect-product">
<input checked="checked" name="limits_and_quotas[product]" type="checkbox" id="multiselect-product"
value="1">
Products </label>
</div>
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
<label for="multiselect-sites">
<input checked="checked" name="limits_and_quotas[sites]" type="checkbox" id="multiselect-sites"
value="1">
Sites </label>
</div>
<div class="wu-col-sm-4" style="margin-bottom: 2px;">
<label for="multiselect-visits">
<input checked="checked" name="limits_and_quotas[visits]" type="checkbox" id="multiselect-visits"
value="1">
Visits </label>
</div>
</div>
<div style="clear: both"> </div> <br>
<button type="button" data-select-all="multiselect-limits_and_quotas" class="button wu-select-all">Check /
Uncheck All</button>
<br>
<p class="description" id="limits_and_quotas-desc">
Select which elements you would like to display on the Limits and Quotas Widget.
</p>
</td>
</tr>
</tbody>
</table>
<div id="error_reporting" data-type="heading">
<h3>Error Reporting</h3>
<p>Help us make WP Ultimo better by automatically reporting fatal errors and warnings so we can fix them as soon
as possible.</p>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="enable_error_reporting">Send Error Data to WP Ultimo Developers</label> </th>
<td>
<label for="enable_error_reporting">
<input name="enable_error_reporting" type="checkbox" id="enable_error_reporting" value="1">
Send Error Data to WP Ultimo Developers </label>
<p class="description" id="enable_error_reporting-desc">
With this option enabled, every time your installation runs into an error related to WP Ultimo, that
error data will be sent to us. That way we can review, debug, and fix issues without you having to
manually report anything. No sensitive data gets collected, only environmental stuff (e.g. if this is
this is a subdomain network, etc).
</p>
</td>
</tr>
</tbody>
</table>
<div id="uninstall" data-type="heading">
<h3>Uninstall Options</h3>
<p>Change the plugin behavior on uninstall.</p>
</div>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label for="uninstall_wipe_tables">Remove Data on Uninstall</label> </th>
<td>
<label for="uninstall_wipe_tables">
<input name="uninstall_wipe_tables" type="checkbox" id="uninstall_wipe_tables" value="1">
Remove Data on Uninstall </label>
<p class="description" id="uninstall_wipe_tables-desc">
Remove all saved data for WP Ultimo when the plugin is uninstalled.
</p>
</td>
</tr>
</tbody>
</table>
<p class="submit">
<button type="submit" name="_submit" id="_submit" class="button button-primary">Save Changes</button>
<input type="hidden" id="_wpnonce" name="_wpnonce" value="59c475b6c4"><input type="hidden"
name="_wp_http_referer" value="/wp-admin/network/admin.php?page=wp-ultimo"> <input type="hidden"
name="wu_action" value="save_settings">
</p>