first commit

This commit is contained in:
Roman Pyrih
2023-07-24 08:30:51 +02:00
commit c2e100a763
7128 changed files with 1622619 additions and 0 deletions

View File

@@ -0,0 +1,166 @@
<?php
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
$url_install_plugin = is_multisite() ? network_admin_url( 'plugin-install.php?s=brizy&tab=search&type=term' ) : admin_url( 'plugin-install.php?s=brizy&tab=search&type=term' );
?>
<style>
.about-wrap .feature-section .fw-brz {
text-align: center;
margin-top: 30px;
}
.fw-brz__btn-install {
color: #fff;
font-size: 15px;
line-height: 1;
background-color: #d62c64;
box-shadow: 0px 2px 0px 0px #981e46;
padding: 11px 27px 12px;
border: 1px solid #d62c64;
border-bottom: 0;
border-radius: 3px;
text-shadow: none;
height: auto;
text-decoration: none;
transition: all 200ms linear;
}
.fw-brz__btn-install:hover {
background-color: #141923;
color: #fff;
border-color: #141923;
box-shadow: 0px 2px 0px 0px #141923;
}
.fw-btn-install-border {
color: #d62c64;
font-size: 18px;
font-weight: bold;
border: 3px solid #d62c64;
text-decoration: none;
padding: 11px 27px 12px;
margin-top: 45px;
display: inline-block;
transition: all 200ms linear;
}
.fw-btn-install-border:hover {
background-color: #141923;
color: #fff;
border-color: #141923;
}
.section-item .fw-brz-title-feature {
font-size: 18px;
}
.section-item .inline-svg img {
width: 300px;
height: 200px;
}
</style>
<div class="wrap about-wrap full-width-layout" style="margin:0 auto;">
<div class="feature-section one-col">
<div class="col" style="margin-top: 0;">
<h2>Try Brizy: <b>An effortless way</b> to create WordPress pages visually! &#x1F389</h2>
<p style="text-align: center;font-size: 16px;"><?php _e( 'No designer or coding skills required.' ); ?></p>
<p class="fw-brz">
<a class="fw-brz__btn-install" href="<?php echo $url_install_plugin; ?>">
<?php _e( 'Install Now | for FREE' ); ?>
</a>
</p>
</div>
</div>
<div class="inline-svg full-width">
<iframe width="1200" height="600" src="https://www.youtube.com/embed/KUv-NqDR-8s?rel=0&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
</div>
<div class="floating-header-section" style="margin-bottom: 60px;">
<div class="section-header">
<h2><?php _e( 'Create & Edit Everything Visually' ); ?></h2>
</div>
<div class="section-content">
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-1.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Choose from a lot of elements to create your own design' ); ?></h3>
</div>
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-2.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Start from over 150 pre-made blocks to create your page' ); ?></h3>
</div>
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-3.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'The interface shows only whats needed for the task at hand' ); ?></h3>
</div>
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-4.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Know where your elements will drop when you drag them' ); ?></h3>
</div>
<div class="section-item">
<a class="fw-btn-install-border" href="<?php echo $url_install_plugin; ?>">
<?php _e( 'Install Now & Start Creating' ); ?>
</a>
</div>
</div>
</div>
<div class="floating-header-section" style="margin-bottom: 50px;">
<div class="section-header">
<h2>
<?php _e( 'Fast & Easy' ); ?><br>
<?php _e( 'Using Only' ); ?><br>
<?php _e( 'Drag & Drop' ); ?>
</h2>
</div>
<div class="section-content">
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-5.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Brizy has the smartest text editor youll ever work with' ); ?></h3>
</div>
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-6.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Try different fonts & colors across your pages in seconds' ); ?></h3>
</div>
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-7.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Changes in mobile view will be applied only on mobile devices' ); ?></h3>
</div>
<div class="section-item">
<div class="inline-svg">
<img src="https://ps.w.org/brizy/assets/screenshot-8.gif?rev=1863674" alt="">
</div>
<h3 class="fw-brz-title-feature"><?php _e( 'Over 4000 icons separated in 27 categories are included' ); ?></h3>
</div>
<div class="section-item">
<a class="fw-btn-install-border" href="<?php echo $url_install_plugin; ?>">
<?php _e( 'Install Now & Start Creating' ); ?>
</a>
</div>
</div>
</div>
<div class="feature-section">
<h2>
<?php echo esc_html_e( 'Thanks for giving Brizy a Try!' ); ?>
</h2>
<p style="font-size: 14px; text-align:center;">
Brizy is developed by the team behind the <a href="https://wordpress.org/plugins/unyson/" target="_blank">Unyson open source framework</a> for WordPress. The content created with the back end visual page builder from Unyson cant be edited with Brizy. You can however use Brizy to create new pages. Consider joining our <a href="https://www.facebook.com/brizy.io/" target="_blank">Facebook community</a> where our members help us shape the development of Brizy.
</p>
</div>
<hr />
</div>
<?php
return;

View File

@@ -0,0 +1,28 @@
<?php if (!defined('FW')) die('Forbidden');
/**
* @var string $type
* @var string $html
*/
{
$classes = array(
'option' => array(
'form-field',
'fw-backend-container',
'fw-backend-container-type-'. $type
),
'content' => array(
'fw-backend-container-content',
),
);
foreach ($classes as $key => $_classes) {
$classes[$key] = implode(' ', $_classes);
}
unset($key, $_classes);
}
?>
<tr class="<?php echo esc_attr($classes['option']) ?>">
<td colspan="2" class="<?php echo esc_attr($classes['content']) ?>"><?php echo $html ?></td>
</tr>

View File

@@ -0,0 +1,126 @@
<?php if (!defined('FW')) die('Forbidden');
/**
* @var string $id
* @var array $option
* @var array $data
*/
{
if (!isset($option['label'])) {
$option['label'] = fw()->backend->option_type($option['type'])->_default_label(
$id, $option
);
}
if (!isset($option['desc'])) {
$option['desc'] = '';
}
}
{
$help = false;
if (!empty($option['help'])) {
$help = array(
'icon' => 'info',
'html' => '{undefined}',
);
if (is_array($option['help'])) {
$help = array_merge($help, $option['help']);
} else {
$help['html'] = $option['help'];
}
switch ($help['icon']) {
case 'info':
$help['class'] = 'dashicons dashicons-info';
break;
case 'video':
$help['class'] = 'dashicons dashicons-video-alt3';
break;
default:
$help['class'] = 'dashicons dashicons-smiley';
}
}
}
{
$classes = array(
'option' => array(
'fw-backend-option',
'fw-backend-option-design-customizer',
'fw-backend-option-type-'. $option['type'],
'fw-row',
'fw-clearfix',
),
'label' => array(
'fw-backend-option-label',
'responsive' => 'fw-col-xs-12',
),
'input' => array(
'fw-backend-option-input',
'fw-backend-option-input-type-'. $option['type'],
'fw-clearfix',
'responsive' => 'fw-col-xs-12',
),
'desc' => array(
'fw-backend-option-desc',
'responsive' => 'fw-col-xs-12',
),
);
/** Additional classes for option div */
{
if ($help) {
$classes['option'][] = 'with-help';
}
if ($option['label'] === false) {
$classes['label']['hidden'] = 'fw-hidden';
unset($classes['label']['responsive']);
$classes['input']['responsive'] = 'fw-col-xs-12';
$classes['desc']['responsive'] = 'fw-col-xs-12';
}
}
/** Additional classes for input div */
{
$width_type = fw()->backend->option_type($option['type'])->_get_backend_width_type();
if (!in_array($width_type, array('auto', 'fixed', 'full'))) {
$width_type = 'auto';
}
$classes['input']['width-type'] = 'width-type-'. $width_type;
}
foreach ($classes as $key => $_classes) {
$classes[$key] = implode(' ', $_classes);
}
unset($key, $_classes);
}
?>
<div class="<?php echo esc_attr($classes['option']) ?>" id="fw-backend-option-<?php echo esc_attr($data['id_prefix'] . $id) ?>">
<?php if ($option['label'] !== false): ?>
<div class="<?php echo esc_attr($classes['label']) ?>">
<div class="fw-inner fw-clearfix">
<label for="<?php echo esc_attr($data['id_prefix']) . esc_attr($id) ?>"><span class="customize-control-title"><?php echo fw_htmlspecialchars($option['label']) ?></span></label>
<?php if ($help): ?><div class="fw-option-help fw-option-help-in-label <?php echo esc_attr($help['class']) ?>" title="<?php echo esc_attr($help['html']) ?>"></div><?php endif; ?>
</div>
</div>
<?php endif; ?>
<?php if ($option['desc']): ?>
<div class="<?php echo esc_attr($classes['desc']) ?>">
<div class="fw-inner"><span class="description customize-control-description"><?php echo ($option['desc'] ? $option['desc'] : '') ?></span></div>
</div>
<?php endif; ?>
<div class="<?php echo esc_attr($classes['input']) ?>">
<div class="fw-inner fw-pull-<?php echo is_rtl() ? 'right' : 'left'; ?> fw-clearfix">
<div class="fw-inner-option">
<?php echo fw()->backend->option_type($option['type'])->render($id, $option, $data) ?>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,163 @@
<?php if (!defined('FW')) die('Forbidden');
/**
* @var string $id
* @var array $option
* @var array $data
*/
{
if (!isset($option['label'])) {
$option['label'] = fw()->backend->option_type($option['type'])->_default_label(
$id, $option
);
}
if (!isset($option['desc'])) {
$option['desc'] = '';
}
}
{
$help = false;
if (!empty($option['help'])) {
$help = array(
'icon' => 'info',
'html' => '{undefined}',
);
if (is_array($option['help'])) {
$help = array_merge($help, $option['help']);
} else {
$help['html'] = $option['help'];
}
switch ($help['icon']) {
case 'info':
$help['class'] = 'dashicons dashicons-info';
break;
case 'video':
$help['class'] = 'dashicons dashicons-video-alt3';
break;
default:
$help['class'] = 'dashicons dashicons-smiley';
}
}
}
{
try {
$responsive_classes = FW_Cache::get(
$cache_key = 'fw:backend-option-view:responsive-classes'
);
} catch (FW_Cache_Not_Found_Exception $e) {
FW_Cache::set(
$cache_key,
$responsive_classes = apply_filters('fw:backend-option-view:design-default:responsive-classes', array(
'label' => 'fw-col-xs-12 fw-col-sm-3 fw-col-lg-2',
'input' => 'fw-col-xs-12 fw-col-sm-9 fw-col-lg-10',
))
);
}
$classes = array(
'option' => array(
'fw-backend-option',
'fw-backend-option-design-default',
'fw-backend-option-type-'. $option['type'],
'fw-row',
'fw-clearfix',
),
'label' => array(
'fw-backend-option-label',
'responsive' => $responsive_classes['label'],
),
'input' => array(
'fw-backend-option-input',
'fw-backend-option-input-type-'. $option['type'],
'fw-clearfix',
'responsive' => $responsive_classes['input'],
),
'desc' => array(
'fw-backend-option-desc',
'responsive' => 'fw-col-xs-12 fw-col-sm-offset-3 fw-col-sm-9 fw-col-lg-offset-2 fw-col-lg-10',
),
);
/** Additional classes for option div */
{
if ($help) {
$classes['option'][] = 'with-help';
}
if ($option['label'] === false) {
$classes['label']['hidden'] = 'fw-hidden';
unset($classes['label']['responsive']);
$classes['input']['responsive'] = 'fw-col-xs-12';
$classes['desc']['responsive'] = 'fw-col-xs-12';
}
$hide_bottom_border = fw_akg( 'hide-bottom-border', $option, false );
if( $hide_bottom_border ) {
$classes['option'][] = 'fw-bottom-border-hidden';
}
}
/** Additional classes for input div */
{
$width_type = fw()->backend->option_type($option['type'])->_get_backend_width_type();
if (!in_array($width_type, array('auto', 'fixed', 'full'))) {
$width_type = 'auto';
}
$classes['input']['width-type'] = 'width-type-'. $width_type;
}
foreach ($classes as $key => $_classes) {
$classes[$key] = implode(' ', $_classes);
}
unset($key, $_classes);
}
try {
$desc_under_label = FW_Cache::get(
$cache_key = 'fw:backend-option-view:desc-under-label'
);
} catch (FW_Cache_Not_Found_Exception $e) {
FW_Cache::set(
$cache_key,
/**
* Fixes https://github.com/ThemeFuse/Unyson/issues/2143
* @since 2.6.9
*/
$desc_under_label = apply_filters('fw:backend-option-view:design-default:desc-under-label', false)
);
}
?>
<div class="<?php echo esc_attr($classes['option']) ?>" id="fw-backend-option-<?php echo esc_attr($data['id_prefix'] . $id) ?>">
<?php if ($option['label'] !== false): ?>
<div class="<?php echo esc_attr($classes['label']) ?>">
<div class="fw-inner fw-clearfix">
<label for="<?php echo esc_attr($data['id_prefix']) . esc_attr($id) ?>"><?php echo fw_htmlspecialchars($option['label']) ?></label>
<?php if ($help): ?><div class="fw-option-help fw-option-help-in-label fw-visible-xs-block <?php echo esc_attr($help['class']) ?>" title="<?php echo esc_attr($help['html']) ?>"></div><?php endif; ?>
<?php if ($option['desc'] && $desc_under_label): ?><div class="fw-clear"></div><p><em class="fw-text-muted"><?php echo ($option['desc'] ? $option['desc'] : '') ?></em></p><?php endif; ?>
</div>
</div>
<?php endif; ?>
<div class="<?php echo esc_attr($classes['input']) ?>">
<div class="fw-inner fw-pull-<?php echo is_rtl() ? 'right' : 'left'; ?> fw-clearfix">
<?php if ($help): ?><div class="fw-option-help fw-option-help-in-input fw-pull-right fw-hidden-xs <?php echo esc_attr($help['class']) ?>" title="<?php echo esc_attr($help['html']) ?>"></div><?php endif; ?>
<div class="fw-inner-option fw-clearfix">
<?php echo fw()->backend->option_type($option['type'])->render($id, $option, $data) ?>
</div>
</div>
</div>
<?php if ($option['desc'] && !$desc_under_label): ?>
<div class="<?php echo esc_attr($classes['desc']) ?>">
<div class="fw-inner"><?php echo ($option['desc'] ? $option['desc'] : '') ?></div>
</div>
<?php endif; ?>
</div>

View File

@@ -0,0 +1,3 @@
<?php
echo fw()->backend->option_type($option['type'])->render($id, $option, $data);

View File

@@ -0,0 +1,11 @@
<?php if (!defined('FW')) die('Forbidden');
/**
* @var string $id
* @var array $option
* @var mixed $data
*/
/**
* https://github.com/ThemeFuse/Unyson/issues/1347
*/
require dirname(__FILE__) .'/backend-option-design-default.php';

View File

@@ -0,0 +1,413 @@
<?php if (!defined('FW')) die('Forbidden');
/**
* @see FW_Settings_Form::_form_render()
* @var FW_Settings_Form $form
* @var array $values
* @var string $input_name_reset
* @var string $input_name_save
* @var string $js_form_selector Form CSS selector safe to be used in js (js escaped)
* @var bool $is_theme_settings Backwards compatibility with old Theme Settings hooks
*/
?>
<?php if ($form->get_is_side_tabs()): ?>
<div class="fw-settings-form-header fw-row">
<div class="fw-col-xs-12 fw-col-sm-6">
<h2><?php echo $form->get_string('title'); ?></h2>
</div>
<div class="fw-col-xs-12 fw-col-sm-6">
<div class="form-header-buttons">
<?php
/**
* Make sure firs submit button is Save button
* because the first button is "clicked" when you press enter in some input
* and the form is submitted.
* So to prevent form Reset on input Enter, make Save button first in html
*/
echo fw_html_tag('input', array(
'type' => 'submit',
'name' => $input_name_save,
'class' => 'fw-hidden',
));
?>
<?php
echo implode(
'<i class="submit-button-separator"></i>',
apply_filters(
$is_theme_settings
? 'fw_settings_form_header_buttons'
: 'fw:settings-form:'. $form->get_id() .':side-tabs:header-buttons',
array(
fw_html_tag('input', array(
'type' => 'submit',
'name' => $input_name_reset,
'value' => $form->get_string('reset_button'),
'class' => 'button-secondary button-large submit-button-reset fw-settings-form-reset-btn',
)),
fw_html_tag('input', array(
'type' => 'submit',
'name' => $input_name_save,
'value' => $form->get_string('save_button'),
'class' => 'button-primary button-large submit-button-save',
))
)
)
);
?>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(function($){
fwEvents.one('fw:options:init', function(data){
$('<?php echo $js_form_selector ?>').on(
'fw:settings-form:reset fw:settings-form:init-header',
function(){
$(this).find('.fw-settings-form-header:not(.initialized)').addClass('initialized');
}
).trigger('fw:settings-form:init-header');
});
});
</script>
<?php endif; ?>
<?php echo fw()->backend->render_options($form->get_options(), $values); ?>
<div class="form-footer-buttons">
<!-- This div is required to follow after options in order to have special styles in case options will contain tabs (css adjacent selector + ) -->
<?php echo implode(
$form->get_is_side_tabs() ? ' ' : ' &nbsp;&nbsp; ',
apply_filters(
$is_theme_settings
? 'fw_settings_form_footer_buttons'
: 'fw:settings-form:'. $form->get_id() .':side-tabs:footer-buttons',
array(
fw_html_tag('input', array(
'type' => 'submit',
'name' => $input_name_save,
'value' => $form->get_string('save_button'),
'class' => 'button-primary button-large',
)),
fw_html_tag('input', array(
'type' => 'submit',
'name' => $input_name_reset,
'value' => $form->get_string('reset_button'),
'class' => 'button-secondary button-large fw-settings-form-reset-btn',
))
)
)
); ?>
</div>
<!-- reset warning -->
<script type="text/javascript">
jQuery( function ( $ ) {
$( document.body ).on(
'click.fw-settings-form-reset-warning',
'<?php echo $js_form_selector ?> input[name="<?php echo esc_js( $input_name_reset ) ?>"]',
function ( e ) {
/**
* on confirm() the submit input looses focus
* fwForm.isAdminPage() must be able to select the input to send it in _POST
* so use alternative solution http://stackoverflow.com/a/5721762
*/
$( this ).closest( 'form' ).find( '[clicked]:submit' ).removeAttr( 'clicked' );
$( this ).attr( 'clicked', '' );
var resetWarning = '<?php echo esc_js( $form->get_string( 'reset_warning' ) ); ?>',
data = { 'reset_warning': resetWarning };
if ( ! confirm( resetWarning ) ) {
e.preventDefault();
$( document.body ).trigger( 'fw:settings-form:cancel-reset', data );
$( this ).removeAttr( 'clicked' );
} else {
$( document.body ).trigger( 'fw:settings-form:before-reset', data );
}
}
);
} );
</script>
<!-- end: reset warning -->
<script type="text/javascript">
jQuery(function($){
var $form = $('<?php echo $js_form_selector ?>:first'),
timeoutId = 0;
$form.on('change.fw_settings_form_delayed_change', function(){
clearTimeout(timeoutId);
/**
* Run on timeout to prevent too often trigger (and cpu load) when a bunch of changes will happen at once
*/
timeoutId = setTimeout(function () {
$form.trigger('fw:settings-form:delayed-change');
}, 333);
});
});
</script>
<?php if ($form->get_is_ajax_submit()): ?>
<!-- ajax submit -->
<div id="fw-settings-form-ajax-save-extra-message"
data-html="<?php echo fw_htmlspecialchars(apply_filters(
$is_theme_settings
? 'fw_settings_form_ajax_save_loading_extra_message'
: 'fw:settings-form:'. $form->get_id() .':ajax-submit:extra-message',
''
)) ?>"></div>
<script type="text/javascript">
jQuery(function ($) {
function isReset($submitButton) {
return $submitButton.length && $submitButton.attr('name') == '<?php echo esc_js($input_name_reset) ?>';
}
var formSelector = '<?php echo $js_form_selector ?>',
loadingExtraMessage = $('#fw-settings-form-ajax-save-extra-message').attr('data-html'),
loadingModalId = 'fw-options-ajax-save-loading';
$(formSelector).addClass('prevent-all-tabs-init'); // fixes https://github.com/ThemeFuse/Unyson/issues/1491
fwForm.initAjaxSubmit({
selector: formSelector,
loading: function(elements, show) {
if (show) {
var title, description;
if (isReset(elements.$submitButton)) {
title = '<?php echo esc_js(__('Resetting', 'fw')) ?>';
description =
'<?php echo esc_js(__('We are currently resetting your settings.', 'fw')) ?>'+
'<br/>'+
'<?php echo esc_js(__('This may take a few moments.', 'fw')) ?>';
} else {
title = '<?php echo esc_js(__('Saving', 'fw')) ?>';
description =
'<?php echo esc_js(__('We are currently saving your settings.', 'fw')) ?>'+
'<br/>'+
'<?php echo esc_js(__('This may take a few moments.', 'fw')); ?>';
}
fw.soleModal.show(
loadingModalId,
'<h2 class="fw-text-muted">'+
'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAAAAACo4kLRAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAnRSTlMA/1uRIrUAAAACYktHRADdUu+NWwAAAAd0SU1FB+EKCgYABDchIukAAACZelRYdFJhdyBwcm9maWxlIHR5cGUgZ2lmOnhtcCBkYXRheG1wAAAImU2NMQ5CMQxD957iHyGNnaTlNkVtEQMSAwPHJx8WHMleXuxyu+/L+/E85niNzHJ85b1gRwvx6vCrWxCGBkdNF1WVaD5DODkx2H0Fgkmv5I2dxFQ9mRKiy3seMdBZCZ4lnUqjQYj/GRW3LPm95w42VvkACzYml9QYNjwAAACjSURBVBjTfZChDoNAEETfbZpgVqJPXHIO0w+hCZYPxJKUD6mpIzmBPrmmigoQcCSM2eRlszM7buWqxzbSd8Y0NgEAtwJ5WvYd39Y7TKOB7xkW0C6AQB4N6KuqB2zMIDDZ0cQmENJ2b8i/AYAl4db3pwj0fAlzmXJGsBIagl4/kitShFjCiNCUsEEI/sx8QKA9WWkLAnV3oNrVN9VtJZtyKrnUH9vgMmhlXVedAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTEwLTEwVDA2OjAwOjA0LTA3OjAw4kWx4AAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0xMC0xMFQwNjowMDowNC0wNzowMJMYCVwAAAAASUVORK5CYII=" alt="Loading" class="wp-spinner" /> '+
title +
'</h2>'+
'<p class="fw-text-muted"><em>'+ description +'</em></p>'+ loadingExtraMessage,
{
autoHide: 60000,
allowClose: false
}
);
return 500; // fixes https://github.com/ThemeFuse/Unyson/issues/1491
} else {
// fw.soleModal.hide(loadingModalId); // we need to show loading until the form reset ajax will finish
}
},
afterSubmitDelay: function (elements) {
fwEvents.trigger('fw:options:init:tabs', {$elements: elements.$form});
},
onErrors: function( elements, data ) {
var message = $.map( data.errors, function( mssg ) { return '<p class="fw-text-danger">' + mssg + '</p>' } ) + fw.soleModal.renderFlashMessages( data.flash_messages );
fw.soleModal.hide( loadingModalId );
fw.soleModal.show(
'fw-options-ajax-save-error',
'<p class="fw-text-danger">' + message + '</p>'
);
},
onAjaxError: function(elements, data) {
{
var message = String(data.errorThrown);
if (data.jqXHR.responseText && data.jqXHR.responseText.indexOf('Fatal error') > -1) {
message = $(data.jqXHR.responseText).text().split(' in ').shift();
}
}
fw.soleModal.hide(loadingModalId);
fw.soleModal.show(
'fw-options-ajax-save-error',
'<p class="fw-text-danger">'+ message +'</p>'
);
},
onSuccess: function(elements, ajaxData) {
/**
* Display messages
*/
do {
/**
* Don't display the "Settings successfully saved" message
* users will click often on the Save button, it's obvious it was saved if no error is shown.
*/
delete ajaxData.flash_messages.success.fw_settings_form_save;
if (
_.isEmpty(ajaxData.flash_messages.error)
&&
_.isEmpty(ajaxData.flash_messages.warning)
&&
_.isEmpty(ajaxData.flash_messages.info)
&&
_.isEmpty(ajaxData.flash_messages.success)
) {
// no messages to display
break;
}
var noErrors = _.isEmpty(ajaxData.flash_messages.error) && _.isEmpty(ajaxData.flash_messages.warning);
// remove success messages, do not make user wait
ajaxData.flash_messages = _.omit(ajaxData.flash_messages, 'success');
var modalHtml = fw.soleModal.renderFlashMessages(ajaxData.flash_messages);
if (modalHtml.length) {
fw.soleModal.show(
'fw-options-ajax-save-success',
'<div style="margin: 0 35px;">' + modalHtml + '</div>',
{
autoHide: noErrors
? 1000 // hide fast the message if everything went fine
: 10000,
showCloseButton: false,
hidePrevious: noErrors ? false : true // close and open popup when there are errors
}
);
} else {
fw.soleModal.hide('fw-options-ajax-save-success');
}
} while(false);
/**
* Refresh form html on Reset
*/
if (isReset(elements.$submitButton)) {
jQuery.ajax({
type: "GET",
dataType: 'text'
}).done(function(html){
fw.soleModal.hide(loadingModalId);
var $form = jQuery(formSelector, html);
html = undefined; // not needed anymore
if (!$form.length) {
alert('Can\'t find the form in the ajax response');
return;
}
// waitSoleModalFadeOut -> formFadeOut -> formReplace -> formFadeIn
setTimeout(function(){
elements.$form.css('transition', 'opacity ease .3s');
elements.$form.css('opacity', '0');
elements.$form.trigger('fw:settings-form:before-html-reset');
fwEvents.trigger('fw:options:teardown', {$elements: elements.$form});
setTimeout(function() {
var scrollTop = jQuery(window).scrollTop();
// replace form html
{
elements.$form.css({
'display': 'block',
'height': elements.$form.height() +'px'
});
elements.$form.get(0).innerHTML = $form.get(0).innerHTML;
$form = undefined; // not needed anymore
elements.$form.css({
'display': '',
'height': ''
});
}
fwEvents.trigger('fw:options:init', {$elements: elements.$form});
jQuery(window).scrollTop(scrollTop);
// fadeIn
{
elements.$form.css('opacity', '');
setTimeout(function(){
elements.$form.css('transition', '');
elements.$form.css('visibility', '');
}, 300);
}
elements.$form.trigger('fw:settings-form:reset');
}, 300);
}, 300);
}).fail(function(jqXHR, textStatus, errorThrown){
fw.soleModal.hide(loadingModalId);
elements.$form.css({
'opacity': '',
'transition': '',
'visibility': ''
});
console.error(jqXHR, textStatus, errorThrown);
alert('Ajax error (more details in console)');
});
} else {
fw.soleModal.hide(loadingModalId);
elements.$form.trigger('fw:settings-form:saved');
}
}
});
});
</script>
<!-- end: ajax submit -->
<?php endif; ?>
<?php if (
$form->get_is_side_tabs()
&&
apply_filters(
$is_theme_settings
? 'fw:settings-form:side-tabs:open-all-boxes'
: 'fw:settings-form:'. $form->get_id() .':side-tabs:open-all-boxes',
true
)
): ?>
<!-- open all postboxes -->
<script type="text/javascript">
jQuery(function ($) {
var execTimeoutId = 0;
fwEvents.on('fw:options:init', function(data){
// use timeout to be executed after the script from backend-options.js
clearTimeout(execTimeoutId);
execTimeoutId = setTimeout(function(){
// undo not first boxes auto close
data.$elements.find(
'<?php echo $js_form_selector ?> .fw-backend-postboxes > .fw-postbox:not(:first-child)'
).removeClass('closed');
}, 10);
});
});
</script>
<?php endif; ?>
<?php if (!empty($_GET['_focus_tab'])): ?>
<script type="text/javascript">
jQuery(function($){
fwEvents.one('fw:options:init', function(){
setTimeout(function(){
$('<?php echo $js_form_selector ?> a[href="#<?php echo esc_js($_GET['_focus_tab']); ?>"]')
.trigger('click');
}, 90);
});
});
</script>
<?php endif; ?>
<?php do_action(
$is_theme_settings
? 'fw_settings_form_footer'
: 'fw:settings-form:'. $form->get_id() .':footer'
); ?>