diff --git a/assets/css/admin-main.css b/assets/css/admin-main.css index 555d4e9410..05d885d066 100644 --- a/assets/css/admin-main.css +++ b/assets/css/admin-main.css @@ -7599,27 +7599,15 @@ body.stop-scrolling { .directorist-form-image-upload-field .ezmu__info-list-item:empty { display: none; } -.directorist-form-image-upload-field .ezmu__thumbnail-list-item { - width: auto; -} .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; } -.directorist-add-listing-wrapper .ezmu__thumbnail-list-item { - max-width: 300px; - -webkit-flex-basis: 300px; - -ms-flex-preferred-size: 300px; - flex-basis: 300px; -} .directorist-add-listing-wrapper .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } -.directorist-add-listing-wrapper .ezmu__media-picker-buttons { - margin-top: 10px; -} .directorist-add-listing-wrapper .ezmu__titles-area .ezmu__title-1 { font-size: 30px; } diff --git a/assets/css/admin-main.rtl.css b/assets/css/admin-main.rtl.css index 9ccfec7752..01517bfb59 100644 --- a/assets/css/admin-main.rtl.css +++ b/assets/css/admin-main.rtl.css @@ -7599,27 +7599,15 @@ body.stop-scrolling { .directorist-form-image-upload-field .ezmu__info-list-item:empty { display: none; } -.directorist-form-image-upload-field .ezmu__thumbnail-list-item { - width: auto; -} .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; } -.directorist-add-listing-wrapper .ezmu__thumbnail-list-item { - max-width: 300px; - -webkit-flex-basis: 300px; - -ms-flex-preferred-size: 300px; - flex-basis: 300px; -} .directorist-add-listing-wrapper .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } -.directorist-add-listing-wrapper .ezmu__media-picker-buttons { - margin-top: 10px; -} .directorist-add-listing-wrapper .ezmu__titles-area .ezmu__title-1 { font-size: 30px; } diff --git a/assets/css/all-listings.css b/assets/css/all-listings.css index 892954cb33..b6e9dcf1c5 100644 --- a/assets/css/all-listings.css +++ b/assets/css/all-listings.css @@ -3042,27 +3042,15 @@ body.stop-scrolling { .directorist-form-image-upload-field .ezmu__info-list-item:empty { display: none; } -.directorist-form-image-upload-field .ezmu__thumbnail-list-item { - width: auto; -} .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; } -.directorist-add-listing-wrapper .ezmu__thumbnail-list-item { - max-width: 300px; - -webkit-flex-basis: 300px; - -ms-flex-preferred-size: 300px; - flex-basis: 300px; -} .directorist-add-listing-wrapper .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } -.directorist-add-listing-wrapper .ezmu__media-picker-buttons { - margin-top: 10px; -} .directorist-add-listing-wrapper .ezmu__titles-area .ezmu__title-1 { font-size: 30px; } diff --git a/assets/css/all-listings.rtl.css b/assets/css/all-listings.rtl.css index 2107a31b4b..f356910c1a 100644 --- a/assets/css/all-listings.rtl.css +++ b/assets/css/all-listings.rtl.css @@ -3042,27 +3042,15 @@ body.stop-scrolling { .directorist-form-image-upload-field .ezmu__info-list-item:empty { display: none; } -.directorist-form-image-upload-field .ezmu__thumbnail-list-item { - width: auto; -} .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; } -.directorist-add-listing-wrapper .ezmu__thumbnail-list-item { - max-width: 300px; - -webkit-flex-basis: 300px; - -ms-flex-preferred-size: 300px; - flex-basis: 300px; -} .directorist-add-listing-wrapper .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } -.directorist-add-listing-wrapper .ezmu__media-picker-buttons { - margin-top: 10px; -} .directorist-add-listing-wrapper .ezmu__titles-area .ezmu__title-1 { font-size: 30px; } diff --git a/assets/css/public-main.css b/assets/css/public-main.css index 1029699eab..a8c11873fc 100644 --- a/assets/css/public-main.css +++ b/assets/css/public-main.css @@ -3042,27 +3042,15 @@ body.stop-scrolling { .directorist-form-image-upload-field .ezmu__info-list-item:empty { display: none; } -.directorist-form-image-upload-field .ezmu__thumbnail-list-item { - width: auto; -} .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; } -.directorist-add-listing-wrapper .ezmu__thumbnail-list-item { - max-width: 300px; - -webkit-flex-basis: 300px; - -ms-flex-preferred-size: 300px; - flex-basis: 300px; -} .directorist-add-listing-wrapper .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } -.directorist-add-listing-wrapper .ezmu__media-picker-buttons { - margin-top: 10px; -} .directorist-add-listing-wrapper .ezmu__titles-area .ezmu__title-1 { font-size: 30px; } diff --git a/assets/css/public-main.rtl.css b/assets/css/public-main.rtl.css index 2107a31b4b..f356910c1a 100644 --- a/assets/css/public-main.rtl.css +++ b/assets/css/public-main.rtl.css @@ -3042,27 +3042,15 @@ body.stop-scrolling { .directorist-form-image-upload-field .ezmu__info-list-item:empty { display: none; } -.directorist-form-image-upload-field .ezmu__thumbnail-list-item { - width: auto; -} .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; } -.directorist-add-listing-wrapper .ezmu__thumbnail-list-item { - max-width: 300px; - -webkit-flex-basis: 300px; - -ms-flex-preferred-size: 300px; - flex-basis: 300px; -} .directorist-add-listing-wrapper .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } -.directorist-add-listing-wrapper .ezmu__media-picker-buttons { - margin-top: 10px; -} .directorist-add-listing-wrapper .ezmu__titles-area .ezmu__title-1 { font-size: 30px; } diff --git a/assets/js/add-listing.js b/assets/js/add-listing.js index 636fb15564..c7b2e525b6 100644 --- a/assets/js/add-listing.js +++ b/assets/js/add-listing.js @@ -128,6 +128,13 @@ var localized_data = directorist.add_listing_data; function joinQueryString(url, queryString) { return url.match(/[?]/) ? "".concat(url, "&").concat(queryString) : "".concat(url, "?").concat(queryString); } +function scrollTo(selector) { + var _document$querySelect; + (_document$querySelect = document.querySelector(selector)) === null || _document$querySelect === void 0 || _document$querySelect.scrollIntoView({ + block: 'start', + behavior: 'smooth' + }); +} /* Show and hide manual coordinate input field */ $(window).on('load', function () { @@ -465,12 +472,6 @@ $(document).ready(function () { render_category_based_fields(); storeCustomFieldsData(); }); - function scrollToEl(selector) { - document.querySelector(selector).scrollIntoView({ - block: 'start', - behavior: 'smooth' - }); - } function atbdp_element_value(element) { var field = $(element); if (field.length) { @@ -478,25 +479,23 @@ $(document).ready(function () { } return ''; } - var uploaders = localized_data.media_uploader; var mediaUploaders = []; - if (uploaders) { - var i = 0; - var _iterator = _createForOfIteratorHelper(uploaders), + if (localized_data.media_uploader) { + var _iterator = _createForOfIteratorHelper(localized_data.media_uploader), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var uploader = _step.value; - if ($('.' + uploader['element_id']).length) { - var media_uploader = new EzMediaUploader({ - containerClass: uploader['element_id'] + if ($('.' + uploader.element_id).length) { + var EzUploader = new EzMediaUploader({ + containerClass: uploader.element_id }); mediaUploaders.push({ - media_uploader: media_uploader, + media_uploader: EzUploader, uploaders_data: uploader }); - mediaUploaders[i].media_uploader.init(); - i++; + EzUploader.init(); + // mediaUploaders[i].media_uploader.init(); } } } catch (err) { @@ -508,190 +507,254 @@ $(document).ready(function () { var on_processing = false; var has_media = true; var quick_login_modal__success_callback = null; + var $notification = $('#listing_notifier'); // ----------------------------- // Submit The Form // ----------------------------- + var uploadedImages = []; $('body').on('submit', '#directorist-add-listing-form', function (e) { e.preventDefault(); - if (localized_data.is_admin) { - return; - } var $form = $(e.target); - var $submitButton = $form.find('.directorist-form-submit__btn'); - var err_log = {}; var error_count = 0; + var err_log = {}; + var $submitButton = $('.directorist-form-submit__btn'); if (on_processing) { - $submitButton.attr('disabled', true); return; } - var form_data = new FormData(); - form_data.append('action', 'add_listing_action'); - form_data.append('directorist_nonce', directorist.directorist_nonce); - $submitButton.addClass('atbd_loading'); - var fieldValuePairs = $form.serializeArray(); - - // Append Form Fields Values - var _iterator2 = _createForOfIteratorHelper(fieldValuePairs), - _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var field = _step2.value; - form_data.append(field.name, field.value); - } - - // images - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); + function disableSubmitButton() { + on_processing = true; + $submitButton.addClass('atbd_loading').attr('disabled', true); } + function enableSubmitButton() { + on_processing = false; + $submitButton.removeClass('atbd_loading').attr('disabled', false); + } + + // images + var selectedImages = []; if (mediaUploaders.length) { for (var _i = 0, _mediaUploaders = mediaUploaders; _i < _mediaUploaders.length; _i++) { var uploader = _mediaUploaders[_i]; - if (has_media && uploader.media_uploader) { - if (uploader.media_uploader.hasValidFiles()) { - // files - var files = uploader.media_uploader.getTheFiles(); - if (files) { - for (var i = 0; i < files.length; i++) { - form_data.append(uploader.uploaders_data['meta_name'] + '[]', files[i]); - } + if (!uploader.media_uploader || $(uploader.media_uploader.container).parents('form').get(0) !== $form.get(0)) { + continue; + } + if (!uploader.media_uploader.hasValidFiles()) { + $submitButton.removeClass('atbd_loading'); + err_log.listing_gallery = { + msg: uploader.uploaders_data['error_msg'] + }; + error_count++; + scrollTo('.' + uploader.uploaders_data.element_id); + break; + } + selectedImages = uploader.media_uploader.getTheFiles(); + } + } + if (selectedImages.length) { + var counter = 0; + function uploadImage() { + var formData = new FormData(); + formData.append('action', 'directorist_upload_listing_image'); + formData.append('directorist_nonce', directorist.directorist_nonce); + formData.append('image', selectedImages[counter]); + $.ajax({ + method: 'POST', + processData: false, + contentType: false, + url: localized_data.ajaxurl, + data: formData, + beforeSend: function beforeSend() { + disableSubmitButton(); + var totalImages = selectedImages.length; + if (totalImages === 1) { + $notification.show().html("".concat(localized_data.i18n_text.image_uploading_msg, "")); + } else { + var completedPercent = Math.ceil((counter === 0 ? 1 : counter) * 100 / totalImages); + $notification.show().html("".concat(localized_data.i18n_text.image_uploading_msg, " (").concat(completedPercent, "%)")); + } + }, + success: function success(response) { + if (!response.success) { + enableSubmitButton(); + $notification.show().html("".concat(response.data, "")); + return; } + uploadedImages.push(response.data); + counter++; + if (counter < selectedImages.length) { + uploadImage(); + } else { + submitForm($form, uploadedImages); + } + }, + error: function error(response) { + enableSubmitButton(); + $notification.html("".concat(response.responseJSON.data, "")); + } + }); + } + if (uploadedImages.length === selectedImages.length) { + submitForm($form, uploadedImages); + } else { + uploadImage(); + } + } else { + submitForm($form); + } + function submitForm($form) { + var uploadedImages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var error_count = 0; + var err_log = {}; + var form_data = new FormData(); + form_data.append('action', 'add_listing_action'); + form_data.append('directorist_nonce', directorist.directorist_nonce); + form_data.append('listing_img', uploadedImages); + disableSubmitButton(); + var fieldValuePairs = $form.serializeArray(); + + // Append Form Fields Values + var _iterator2 = _createForOfIteratorHelper(fieldValuePairs), + _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { + var field = _step2.value; + form_data.append(field.name, field.value); + } + + //images + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); + } + if (mediaUploaders.length) { + for (var _i2 = 0, _mediaUploaders2 = mediaUploaders; _i2 < _mediaUploaders2.length; _i2++) { + var uploader = _mediaUploaders2[_i2]; + if (!uploader.media_uploader || $(uploader.media_uploader.container).parents('form').get(0) !== $form.get(0)) { + continue; + } + if (uploader.media_uploader.hasValidFiles()) { var files_meta = uploader.media_uploader.getFilesMeta(); if (files_meta) { for (var i = 0; i < files_meta.length; i++) { - var elm = files_meta[i]; - for (var key in elm) { - form_data.append("".concat(uploader.uploaders_data['files_meta_name'], "[").concat(i, "][").concat(key, "]"), elm[key]); - } + form_data.append("listing_img_old[".concat(i, "]"), files_meta[i].attachmentID); } } } else { - $submitButton.removeClass('atbd_loading'); err_log.listing_gallery = { msg: uploader.uploaders_data['error_msg'] }; error_count++; - if ($('#' + uploader.uploaders_data['element_id']).length) { - scrollToEl('#' + uploader.uploaders_data['element_id']); - } - if ($('.' + uploader.uploaders_data['element_id']).length) { - scrollToEl('.' + uploader.uploaders_data['element_id']); + if ($('.' + uploader.uploaders_data.element_id).length) { + scrollTo('.' + uploader.uploaders_data.element_id); } } } } - } - // categories - var categories = $form.find('#at_biz_dir-categories').val(); - if (Array.isArray(categories) && categories.length) { - for (var key in categories) { - var value = categories[key]; - form_data.append('tax_input[at_biz_dir-category][]', value); + // categories + var categories = $form.find('#at_biz_dir-categories').val(); + if (Array.isArray(categories) && categories.length) { + for (var key in categories) { + form_data.append('tax_input[at_biz_dir-category][]', categories[key]); + } } - } - if (typeof categories === 'string') { - form_data.append('tax_input[at_biz_dir-category][]', categories); - } - if (form_data.has('admin_category_select[]')) { - form_data.delete('admin_category_select[]'); - } - if (form_data.has('directory_type')) { - form_data.delete('directory_type'); - } - var form_directory_type = $form.find("input[name='directory_type']"); - var form_directory_type_value = form_directory_type !== undefined ? form_directory_type.val() : ''; - var directory_type = qs.directory_type ? qs.directory_type : form_directory_type_value; - form_data.append('directory_type', directory_type); - if (qs.plan) { - form_data.append('plan_id', qs.plan); - } - if (error_count) { - on_processing = false; - $submitButton.attr('disabled', false); - console.log('Form has invalid data'); - console.log(error_count, err_log); - return; - } - on_processing = true; - $.ajax({ - method: 'POST', - processData: false, - contentType: false, - url: localized_data.ajaxurl, - data: form_data, - success: function success(response) { - //console.log(response); - // return; - // show the error notice - $submitButton.attr('disabled', false); - var redirect_url = response && response.redirect_url ? response.redirect_url : ''; - redirect_url = redirect_url && typeof redirect_url === 'string' ? response.redirect_url.replace(/:\/\//g, '%3A%2F%2F') : ''; - if (response.error === true) { - $('#listing_notifier').show().html("".concat(response.error_msg, "")); - $submitButton.removeClass('atbd_loading'); - on_processing = false; - if (response.quick_login_required) { - var modal = $('#directorist-quick-login'); - var email = response.email; - - // Prepare fields - modal.find('input[name="email"]').val(email); - modal.find('input[name="email"]').prop('disabled', true); - - // Show alert - var alert = '
' + response.error_msg + '
'; - modal.find('.directorist-modal-alerts-area').html(alert); - - // Show the modal - modal.addClass('show'); - quick_login_modal__success_callback = function quick_login_modal__success_callback(args) { - $('#guest_user_email').prop('disabled', true); - $('#listing_notifier').hide().html(''); - args.elements.submit_button.remove(); - var form_actions = args.elements.form.find('.directorist-form-actions'); - form_actions.find('.directorist-toggle-modal').removeClass('directorist-d-none'); - }; - } - } else { - // preview on and no need to redirect to payment - if (response.preview_mode === true && response.need_payment !== true) { - if (response.edited_listing !== true) { - $('#listing_notifier').show().html("".concat(response.success_msg, "")); - window.location.href = joinQueryString(response.preview_url, "preview=1&redirect=".concat(redirect_url)); - } else { - $('#listing_notifier').show().html("".concat(response.success_msg, "")); - if (qs.redirect) { - window.location.href = joinQueryString(response.preview_url, "post_id=".concat(response.id, "&preview=1&payment=1&edited=1&redirect=").concat(qs.redirect)); - } else { - window.location.href = joinQueryString(response.preview_url, "preview=1&edited=1&redirect=".concat(redirect_url)); - } + if (typeof categories === 'string') { + form_data.append('tax_input[at_biz_dir-category][]', categories); + } + if (form_data.has('admin_category_select[]')) { + form_data.delete('admin_category_select[]'); + } + if (form_data.has('directory_type')) { + form_data.delete('directory_type'); + } + var form_directory_type = $form.find("input[name='directory_type']"); + var form_directory_type_value = form_directory_type !== undefined ? form_directory_type.val() : ''; + var directory_type = qs.directory_type ? qs.directory_type : form_directory_type_value; + form_data.append('directory_type', directory_type); + if (qs.plan) { + form_data.append('plan_id', qs.plan); + } + if (error_count) { + enableSubmitButton(); + console.log('Form has invalid data'); + console.log(error_count, err_log); + return; + } + $.ajax({ + method: 'POST', + processData: false, + contentType: false, + url: localized_data.ajaxurl, + data: form_data, + beforeSend: function beforeSend() { + disableSubmitButton(); + $notification.show().html("".concat(localized_data.i18n_text.submission_wait_msg, "")); + }, + success: function success(response) { + var redirect_url = response && response.redirect_url ? response.redirect_url : ''; + redirect_url = redirect_url && typeof redirect_url === 'string' ? response.redirect_url.replace(/:\/\//g, '%3A%2F%2F') : ''; + if (response.error === true) { + enableSubmitButton(); + $notification.show().html("".concat(response.error_msg, "")); + if (response.quick_login_required) { + var modal = $('#directorist-quick-login'); + var email = response.email; + + // Prepare fields + modal.find('input[name="email"]').val(email); + modal.find('input[name="email"]').prop('disabled', true); + + // Show alert + var alert = '
' + response.error_msg + '
'; + modal.find('.directorist-modal-alerts-area').html(alert); + + // Show the modal + modal.addClass('show'); + quick_login_modal__success_callback = function quick_login_modal__success_callback(args) { + $('#guest_user_email').prop('disabled', true); + $notification.hide().html(''); + args.elements.submit_button.remove(); + var form_actions = args.elements.form.find('.directorist-form-actions'); + form_actions.find('.directorist-toggle-modal').removeClass('directorist-d-none'); + }; } - // preview mode active and need payment - } else if (response.preview_mode === true && response.need_payment === true) { - window.location.href = joinQueryString(response.preview_url, "preview=1&payment=1&redirect=".concat(redirect_url)); } else { - var is_edited = response.edited_listing ? "listing_id=".concat(response.id, "&edited=1") : ''; - if (response.need_payment === true) { - $('#listing_notifier').show().html("".concat(response.success_msg, "")); - window.location.href = decodeURIComponent(redirect_url); + // preview on and no need to redirect to payment + if (response.preview_mode === true && response.need_payment !== true) { + if (response.edited_listing !== true) { + $notification.show().html("".concat(response.success_msg, "")); + window.location.href = joinQueryString(response.preview_url, "preview=1&redirect=".concat(redirect_url)); + } else { + $notification.show().html("".concat(response.success_msg, "")); + if (qs.redirect) { + window.location.href = joinQueryString(response.preview_url, "post_id=".concat(response.id, "&preview=1&payment=1&edited=1&redirect=").concat(qs.redirect)); + } else { + window.location.href = joinQueryString(response.preview_url, "preview=1&edited=1&redirect=".concat(redirect_url)); + } + } + // preview mode active and need payment + } else if (response.preview_mode === true && response.need_payment === true) { + window.location.href = joinQueryString(response.preview_url, "preview=1&payment=1&redirect=".concat(redirect_url)); } else { - $('#listing_notifier').show().html("".concat(response.success_msg, "")); - window.location.href = joinQueryString(response.redirect_url, is_edited); + var is_edited = response.edited_listing ? "listing_id=".concat(response.id, "&edited=1") : ''; + if (response.need_payment === true) { + $notification.show().html("".concat(response.success_msg, "")); + window.location.href = decodeURIComponent(redirect_url); + } else { + $notification.show().html("".concat(response.success_msg, "")); + window.location.href = joinQueryString(response.redirect_url, is_edited); + } } } + }, + error: function error(_error) { + enableSubmitButton(); + console.log(_error); } - }, - error: function error(_error) { - on_processing = false; - $submitButton.attr('disabled', false); - $submitButton.removeClass('atbd_loading'); - console.log(_error); - ""; - } - }); + }); + } }); // Custom Field Checkbox Button More diff --git a/assets/js/add-listing.min.js b/assets/js/add-listing.min.js index 469b0f34ed..529cee5fd5 100644 --- a/assets/js/add-listing.min.js +++ b/assets/js/add-listing.min.js @@ -1 +1,5 @@ -!function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=303)}({1:function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},10:function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r");return r.addClass(t[0].className),r.text(e.text),r}},i=e.args&&"object"===o()(e.args)?Object.assign(r,e.args):r,n=a(t).find("option"),c=n.length?n[0].innerHTML:"";c.length&&(i.placeholder=c),a(t).select2(i)}))}},13:function(e,t,r){var i=r(10);e.exports=function(e){if(Array.isArray(e))return i(e)},e.exports.__esModule=!0,e.exports.default=e.exports},14:function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},15:function(e,t,r){var i=r(10);e.exports=function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},16:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},17:function(e,t){function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,c=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw c}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r'.concat(r,"");e.append(i)}var n=e.find(".directorist-select2-dropdown-toggle");o(".select2-hidden-accessible").on("select2:open",(function(e){o(this).next().find(".directorist-select2-dropdown-toggle").addClass("--is-open")})),o(".select2-hidden-accessible").on("select2:close",(function(e){o(this).next().find(".directorist-select2-dropdown-toggle").removeClass("--is-open")})),n.on("click",(function(e){var t=o(this).hasClass("--is-open"),r=o(this).closest(".select2-container").siblings("select:enabled");t?r.select2("close"):r.select2("open")})),d()}(),function(){var e=o(".select2-hidden-accessible");if(!e&&!e.length)return;var t,i=r(e);try{for(i.s();!(t=i.n()).done;){var n=t.value;o(n).children("option:selected").val()&&a(n)}}catch(e){i.e(e)}finally{i.f()}}(),o(".select2-hidden-accessible").on("change",(function(e){o(this).children("option:selected").val()&&a(o(this))}))}function a(e){o(".select2-selection__clear").css({display:"none"});var t=s(e);if(t&&t.length){t.find(".directorist-select2-dropdown-close").remove();var r=directorist.assets_url+"icons/font-awesome/svgs/solid/times.svg",i=directorist.icon_markup.replace("##URL##",r).replace("##CLASS##","");t.prepend(''.concat(i,"")),t.find(".directorist-select2-dropdown-close").on("click",(function(e){o(this).closest(".select2-container").siblings("select:enabled").val(null).trigger("change"),t.find(".directorist-select2-dropdown-close").remove(),d()})),d()}}function s(e){var t=e?o(e).next(".select2-container"):o(".select2-container");if((t=o(t).find(".directorist-select2-addons-area")).length||(o(".select2-container").append(''),t=o(".select2-container").find(".directorist-select2-addons-area")),!(t=e?o(e).next(".select2-container"):null))return null;var r=o(t).find(".directorist-select2-addons-area");return r.length?r:(t.append(''),t.find(".directorist-select2-addons-area"))}function d(){var e=o(".select2-container").find(".directorist-select2-addons-area");if(e.length){var t=e.outerWidth();o(".select2-container").find(".select2-selection__rendered").css({"padding-right":t+"px"})}}window.addEventListener("load",n),window.addEventListener("directorist-search-form-nav-tab-reloaded",n),window.addEventListener("directorist-type-change",n),window.addEventListener("directorist-instant-search-reloaded",n)},2:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},20:function(e,t,r){"use strict";var i=r(8),o=r.n(i),n=r(2),c=r.n(n),a=r(11);r(17);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function d(e){for(var t=1;t=r+1?o[r]:"",n=new Option(i,t,!0,!0);l(e).append(n),l(e).trigger({type:"select2:select",params:{data:{id:t,text:m}}})}))}}(r,p,m)}))}window.addEventListener("load",u),document.body.addEventListener("directorist-search-form-nav-tab-reloaded",u),document.body.addEventListener("directorist-reload-select2-fields",u)},26:function(e,t){window.addEventListener("DOMContentLoaded",(function(){if(void 0===window.directorist_select_executed){window.directorist_select_executed=!0;var e=document.querySelectorAll(".atbd-drop-select");null!==e&&e.forEach((function(e){e.querySelectorAll(".atbd-dropdown-item").forEach((function(t){t.addEventListener("click",(function(r){r.preventDefault(),e.querySelector(".atbd-dropdown-toggle").textContent=t.textContent,e.querySelectorAll(".atbd-dropdown-item").forEach((function(e){e.classList.remove("atbd-active")})),t.classList.add("atbd-active")}))}))})),document.querySelectorAll(".atbd-drop-select.with-sort").forEach((function(e){e.querySelectorAll(".atbd-dropdown-item").forEach((function(t){var r=e.querySelector(".atbd-dropdown-toggle"),i=t.getAttribute("data-status");t.addEventListener("click",(function(e){r.setAttribute("data-status","".concat(i))}))}))}))}}))},28:function(e,t){var r;r=jQuery,void 0===window.directorist_dropdown_executed&&(window.directorist_dropdown_executed=!0,window.addEventListener("DOMContentLoaded",(function(){var e=document.querySelectorAll(".directorist-dropdown-select"),t=0;null!==e&&e.forEach((function(e){e.querySelector(".directorist-dropdown-select-toggle").addEventListener("click",(function(r){r.preventDefault(),++t%2==1?(document.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("directorist-dropdown-select-show")})),e.querySelector(".directorist-dropdown-select-items").classList.add("directorist-dropdown-select-show")):document.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("directorist-dropdown-select-show")}))}))})),document.body.addEventListener("click",(function(e){"directorist-dropdown-select-toggle"!==e.target.getAttribute("data-drop-toggle")&&(t=0,document.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("directorist-dropdown-select-show")})))}));var i=document.querySelectorAll(".atbd-drop-select");null!==i&&i.forEach((function(e){e.querySelectorAll(".directorist-dropdown-select-items").forEach((function(t){t.addEventListener("click",(function(r){r.preventDefault(),e.querySelector(".directorist-dropdown-select-toggle").textContent=r.target.textContent,e.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("atbd-active")})),t.classList.add("atbd-active")}))}))})),r("body").on("click",".directorist-dropdown .directorist-dropdown-toggle",(function(e){e.preventDefault(),r(this).siblings(".directorist-dropdown-option").toggle()})),r("body").on("click",".directorist-dropdown .directorist-dropdown-option ul li a",(function(e){e.preventDefault();var t=r(this).html();r(this).children(".directorist-dropdown-toggle__text").html(t),r(this).closest(".directorist-dropdown-option").siblings(".directorist-dropdown-toggle").children(".directorist-dropdown-toggle__text").html(t),r(".directorist-dropdown-option").hide()})),r(document).bind("click",(function(e){r(e.target).parents().hasClass("directorist-dropdown")||r(".directorist-dropdown-option").hide()})),r(document).on("click",".atbd_dropdown",(function(e){"atbd_dropdown"===r(this).attr("class")&&(e.preventDefault(),r(this).siblings(".atbd_dropdown").removeClass("atbd_drop--active"),r(this).toggleClass("atbd_drop--active"),e.stopPropagation())})),r(document).on("click",(function(e){!1===r(e.target).is(".atbd_dropdown, .atbd_drop--active")&&r(".atbd_dropdown").removeClass("atbd_drop--active")})),r("body").on("click",".atbd_dropdown-toggle",(function(e){e.preventDefault()})),r("body").on("click",".directorist-dropdown-js .directorist-dropdown__toggle-js",(function(e){e.preventDefault(),r(this).siblings(".directorist-dropdown__links-js").is(":visible")||r(".directorist-dropdown__links").hide(),r(this).siblings(".directorist-dropdown__links-js").toggle()})),r("body").on("click",(function(e){e.target.closest(".directorist-dropdown-js")||r(".directorist-dropdown__links-js").hide()}))})))},303:function(e,t,r){e.exports=r(304)},304:function(e,t,r){"use strict";r.r(t);var i=r(2),o=r.n(i);r(28),r(26),r(61),r(20);function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,n=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw n}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r").insertAfter(e)},success:function(e){jQuery(".atbdp_ajax_loading").remove(),i(e)}})}(o,"atbdp_social_info_handler",i,(function(e){t.append(e)}))})),document.addEventListener("directorist-reload-plupload",(function(){a(".directorist-color-field-js").length&&a(".directorist-color-field-js").wpColorPicker().empty()})),a("body").on("click",".directorist-form-social-fields__remove",(function(e){var t=a(this).data("id"),r=a("div#socialID-".concat(t));swal({title:s.i18n_text.confirmation_text,text:s.i18n_text.ask_conf_sl_lnk_del_txt,type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:s.i18n_text.confirm_delete,closeOnConfirm:!1},(function(e){e&&(r.slideUp("fast",(function(){r.remove(),a(".directorist-form-social-fields").each((function(e,t){var r=a(t);r.attr("id","socialID-".concat(e)),r.find("select").attr("name","social[".concat(e,"][id]")),r.find(".atbdp_social_input").attr("name","social[".concat(e,"][url]")),r.find(".directorist-form-social-fields__remove").attr("data-id",e)}))})),swal({title:s.i18n_text.deleted,type:"success",timer:200,showConfirmButton:!1}))}))})),!s.is_admin){var e=a("#at_biz_dir-location").attr("data-allow_new"),t=a("#at_biz_dir-location").attr("data-max");e?a("#at_biz_dir-location").select2({tags:!0,maximumSelectionLength:t,language:{maximumSelected:function(){return s.i18n_text.max_location_msg}},tokenSeparators:[","]}):a("#at_biz_dir-location").select2({allowClear:!0,tags:!1,maximumSelectionLength:t,tokenSeparators:[","]});var r=a("#at_biz_dir-tags").attr("data-allow_new"),i=a("#at_biz_dir-tags").attr("data-max");r?a("#at_biz_dir-tags").select2({tags:!0,maximumSelectionLength:i,tokenSeparators:[","]}):a("#at_biz_dir-tags").select2({allowClear:!0,maximumSelectionLength:i,tokenSeparators:[","]});var c=a("#at_biz_dir-categories").attr("data-allow_new"),l=a("#at_biz_dir-categories").attr("data-max");c?a("#at_biz_dir-categories").select2({allowClear:!0,tags:!0,maximumSelectionLength:l,tokenSeparators:[","]}):a("#at_biz_dir-categories").select2({maximumSelectionLength:l,allowClear:!0})}a(".directorist-form-pricing-field").hasClass("price-type-both")&&(a("#price").show(),a("#price_range").hide()),a(".directorist-form-pricing-field__options .directorist-checkbox__label").on("click",(function(){var e=a(this);!0===e.parent(".directorist-checkbox").children("input[type=checkbox]").prop("checked")?a("#".concat(e.data("option"))).hide():a("#".concat(e.data("option"))).show();var t=e.parent().siblings(".directorist-checkbox");t.children("input[type=checkbox]").prop("checked",!1),a("#".concat(t.children(".directorist-checkbox__label").data("option"))).hide()}));var u=a("#has_tagline").val();a("#has_excerpt").val()&&u?a(".atbd_tagline_moto_field").fadeIn():a(".atbd_tagline_moto_field").fadeOut(),a("#atbd_optional_field_check").on("change",(function(){a(this).is(":checked")?a(".atbd_tagline_moto_field").fadeIn():a(".atbd_tagline_moto_field").fadeOut()})),a("#listing_t_c").on("click",(function(e){e.preventDefault(),a("#tc_container").toggleClass("active")}));var f=function(e){if(""==e)return{};for(var t={},r=0;r'),p();var m=[];function _(){var e=document.querySelectorAll(".atbdp_category_custom_fields .directorist-form-element"),t=document.querySelectorAll(".atbdp_category_custom_fields .directorist-form-checks");e.length&&e.forEach((function(e){var t=e.value,r=e.getAttribute("data-id");m.push({id:r,value:t})})),t.length&&t.forEach((function(e){var t=e.checked,r=e.getAttribute("id");m.push({id:r,checked:t})}))}function g(e){document.querySelector(e).scrollIntoView({block:"start",behavior:"smooth"})}a("#at_biz_dir-categories").on("change",(function(){p(),_()})),a("#at_biz_dir-categorychecklist").on("change",(function(e){p(),_()}));var h=s.media_uploader,v=[];if(h){var b,y=0,w=n(h);try{for(w.s();!(b=w.n()).done;){var x=b.value;if(a("."+x.element_id).length){var k=new EzMediaUploader({containerClass:x.element_id});v.push({media_uploader:k,uploaders_data:x}),v[y].media_uploader.init(),y++}}}catch(e){w.e(e)}finally{w.f()}}var j=!1,S=null;function C(){a(".directorist-custom-field-btn-more").length&&a(".directorist-custom-field-btn-more").each((function(e,t){var r=a(t).closest(".directorist-custom-field-checkbox, .directorist-custom-field-radio"),i=a(r).find(".directorist-checkbox, .directorist-radio");a(i).slice(20,i.length).hide(),i.length<=20&&a(t).hide()}))}a("body").on("submit","#directorist-add-listing-form",(function(e){if(e.preventDefault(),!s.is_admin){var t=a(e.target),r=t.find(".directorist-form-submit__btn"),i={},o=0;if(j)r.attr("disabled",!0);else{var c=new FormData;c.append("action","add_listing_action"),c.append("directorist_nonce",directorist.directorist_nonce),r.addClass("atbd_loading");var l,u=n(t.serializeArray());try{for(u.s();!(l=u.n()).done;){var p=l.value;c.append(p.name,p.value)}}catch(e){u.e(e)}finally{u.f()}if(v.length){var m,_=n(v);try{for(_.s();!(m=_.n()).done;){var h=m.value;if(h.media_uploader)if(h.media_uploader.hasValidFiles()){var b=h.media_uploader.getTheFiles();if(b)for(var y=0;y".concat(e.error_msg,"")),r.removeClass("atbd_loading"),j=!1,e.quick_login_required){var i=a("#directorist-quick-login"),o=e.email;i.find('input[name="email"]').val(o),i.find('input[name="email"]').prop("disabled",!0);var n='
'+e.error_msg+"
";i.find(".directorist-modal-alerts-area").html(n),i.addClass("show"),S=function(e){a("#guest_user_email").prop("disabled",!0),a("#listing_notifier").hide().html(""),e.elements.submit_button.remove(),e.elements.form.find(".directorist-form-actions").find(".directorist-toggle-modal").removeClass("directorist-d-none")}}}else if(!0===e.preview_mode&&!0!==e.need_payment)!0!==e.edited_listing?(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=d(e.preview_url,"preview=1&redirect=".concat(t))):(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),f.redirect?window.location.href=d(e.preview_url,"post_id=".concat(e.id,"&preview=1&payment=1&edited=1&redirect=").concat(f.redirect)):window.location.href=d(e.preview_url,"preview=1&edited=1&redirect=".concat(t)));else if(!0===e.preview_mode&&!0===e.need_payment)window.location.href=d(e.preview_url,"preview=1&payment=1&redirect=".concat(t));else{var c=e.edited_listing?"listing_id=".concat(e.id,"&edited=1"):"";!0===e.need_payment?(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=decodeURIComponent(t)):(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=d(e.redirect_url,c))}},error:function(e){j=!1,r.attr("disabled",!1),r.removeClass("atbd_loading"),console.log(e)}})}}})),a(window).on("load",(function(){C()})),a("body").on("click",".directorist-custom-field-btn-more",(function(e){e.preventDefault();var t=a(this).closest(".directorist-custom-field-checkbox, .directorist-custom-field-radio"),r=a(t).find(".directorist-checkbox, .directorist-radio");a(r).slice(20,r.length).slideUp(),a(this).toggleClass("active"),a(this).hasClass("active")?(a(this).text(s.i18n_text.see_less_text),a(r).slice(20,r.length).slideDown()):(a(this).text(s.i18n_text.see_more_text),a(r).slice(20,r.length).slideUp())})),a("#directorist-quick-login .directorist-toggle-modal").on("click",(function(e){e.preventDefault(),a("#directorist-quick-login").removeClass("show")})),a("#quick-login-from-submit-btn").on("click",(function(e){e.preventDefault();var t=a(this).data("form"),r=a(this).data("form"),i=(a(r),a(t)),n=i.find(".directorist-form-feedback"),c=a(i).find('input[name="email"]'),s=a(i).find('input[name="password"]'),d=a(i).find('input[name="directorist-quick-login-security"]'),l=o()({action:"directorist_ajax_quick_login",username:c.val(),password:s.val(),rememberme:!1},"directorist-quick-login-security",d.val()),u=a(this),f=u.html();a.ajax({method:"POST",url:directorist.ajaxurl,data:l,beforeSend:function(){n.html(""),u.prop("disabled",!0),u.prepend(' ')},success:function(e){if(u.html(f),e.loggedin){s.prop("disabled",!0);var t='
Successfully logged in, please continue to the listing submission
';if(n.html(t),S)S({elements:{modal_id:r,form:i,email:c,password:s,submit_button:u}})}else{t='
'+e.message+"
";n.html(t),u.prop("disabled",!1)}},error:function(e){console.log({error:e}),u.prop("disabled",!1),u.html(f)}})}))}))},61:function(e,t){var r;r=jQuery,void 0===window.directorist_colorPicker_executed&&(window.directorist_colorPicker_executed=!0,r(document).ready((function(){function e(){document.querySelectorAll(".directorist-color-picker-wrap").forEach((function(e){if(null!==e){var t=r(".directorist-color-picker");""!==t.value?t.wpColorPicker():t.wpColorPicker().empty()}}))}e(),document.body.addEventListener("directorist-search-form-nav-tab-reloaded",e)})))},8:function(e,t,r){var i=r(13),o=r(14),n=r(15),c=r(16);e.exports=function(e){return i(e)||o(e)||n(e)||c()},e.exports.__esModule=!0,e.exports.default=e.exports}}); \ No newline at end of file +<<<<<<< HEAD +!function(e){var t={};function r(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(o,i,function(t){return e[t]}.bind(null,i));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=303)}({1:function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},10:function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r");return r.addClass(t[0].className),r.text(e.text),r}},o=e.args&&"object"===i()(e.args)?Object.assign(r,e.args):r,n=c(t).find("option"),a=n.length?n[0].innerHTML:"";a.length&&(o.placeholder=a),c(t).select2(o)}))}},13:function(e,t,r){var o=r(10);e.exports=function(e){if(Array.isArray(e))return o(e)},e.exports.__esModule=!0,e.exports.default=e.exports},14:function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},15:function(e,t,r){var o=r(10);e.exports=function(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},16:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},17:function(e,t){function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){s=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(s)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r'.concat(r,"");e.append(o)}var n=e.find(".directorist-select2-dropdown-toggle");i(".select2-hidden-accessible").on("select2:open",(function(e){i(this).next().find(".directorist-select2-dropdown-toggle").addClass("--is-open")})),i(".select2-hidden-accessible").on("select2:close",(function(e){i(this).next().find(".directorist-select2-dropdown-toggle").removeClass("--is-open")})),n.on("click",(function(e){var t=i(this).hasClass("--is-open"),r=i(this).closest(".select2-container").siblings("select:enabled");t?r.select2("close"):r.select2("open")})),d()}(),function(){var e=i(".select2-hidden-accessible");if(!e&&!e.length)return;var t,o=r(e);try{for(o.s();!(t=o.n()).done;){var n=t.value;i(n).children("option:selected").val()&&c(n)}}catch(e){o.e(e)}finally{o.f()}}(),i(".select2-hidden-accessible").on("change",(function(e){i(this).children("option:selected").val()&&c(i(this))}))}function c(e){i(".select2-selection__clear").css({display:"none"});var t=s(e);if(t&&t.length){t.find(".directorist-select2-dropdown-close").remove();var r=directorist.assets_url+"icons/font-awesome/svgs/solid/times.svg",o=directorist.icon_markup.replace("##URL##",r).replace("##CLASS##","");t.prepend(''.concat(o,"")),t.find(".directorist-select2-dropdown-close").on("click",(function(e){i(this).closest(".select2-container").siblings("select:enabled").val(null).trigger("change"),t.find(".directorist-select2-dropdown-close").remove(),d()})),d()}}function s(e){var t=e?i(e).next(".select2-container"):i(".select2-container");if((t=i(t).find(".directorist-select2-addons-area")).length||(i(".select2-container").append(''),t=i(".select2-container").find(".directorist-select2-addons-area")),!(t=e?i(e).next(".select2-container"):null))return null;var r=i(t).find(".directorist-select2-addons-area");return r.length?r:(t.append(''),t.find(".directorist-select2-addons-area"))}function d(){var e=i(".select2-container").find(".directorist-select2-addons-area");if(e.length){var t=e.outerWidth();i(".select2-container").find(".select2-selection__rendered").css({"padding-right":t+"px"})}}window.addEventListener("load",n),window.addEventListener("directorist-search-form-nav-tab-reloaded",n),window.addEventListener("directorist-type-change",n),window.addEventListener("directorist-instant-search-reloaded",n)},2:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},20:function(e,t,r){"use strict";var o=r(8),i=r.n(o),n=r(2),a=r.n(n),c=r(11);r(17);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function d(e){for(var t=1;t=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,c=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){s=!0,n=e},f:function(){try{c||null==r.return||r.return()}finally{if(s)throw n}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r").insertAfter(e)},success:function(e){jQuery(".atbdp_ajax_loading").remove(),o(e)}})}(i,"atbdp_social_info_handler",o,(function(e){t.append(e)}))})),document.addEventListener("directorist-reload-plupload",(function(){c(".directorist-color-field-js").length&&c(".directorist-color-field-js").wpColorPicker().empty()})),c("body").on("click",".directorist-form-social-fields__remove",(function(e){var t=c(this).data("id"),r=c("div#socialID-".concat(t));swal({title:s.i18n_text.confirmation_text,text:s.i18n_text.ask_conf_sl_lnk_del_txt,type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:s.i18n_text.confirm_delete,closeOnConfirm:!1},(function(e){e&&(r.slideUp("fast",(function(){r.remove(),c(".directorist-form-social-fields").each((function(e,t){var r=c(t);r.attr("id","socialID-".concat(e)),r.find("select").attr("name","social[".concat(e,"][id]")),r.find(".atbdp_social_input").attr("name","social[".concat(e,"][url]")),r.find(".directorist-form-social-fields__remove").attr("data-id",e)}))})),swal({title:s.i18n_text.deleted,type:"success",timer:200,showConfirmButton:!1}))}))})),!s.is_admin){var e=c("#at_biz_dir-location").attr("data-allow_new"),t=c("#at_biz_dir-location").attr("data-max");e?c("#at_biz_dir-location").select2({tags:!0,maximumSelectionLength:t,language:{maximumSelected:function(){return s.i18n_text.max_location_msg}},tokenSeparators:[","]}):c("#at_biz_dir-location").select2({allowClear:!0,tags:!1,maximumSelectionLength:t,tokenSeparators:[","]});var r=c("#at_biz_dir-tags").attr("data-allow_new"),o=c("#at_biz_dir-tags").attr("data-max");r?c("#at_biz_dir-tags").select2({tags:!0,maximumSelectionLength:o,tokenSeparators:[","]}):c("#at_biz_dir-tags").select2({allowClear:!0,maximumSelectionLength:o,tokenSeparators:[","]});var a=c("#at_biz_dir-categories").attr("data-allow_new"),l=c("#at_biz_dir-categories").attr("data-max");a?c("#at_biz_dir-categories").select2({allowClear:!0,tags:!0,maximumSelectionLength:l,tokenSeparators:[","]}):c("#at_biz_dir-categories").select2({maximumSelectionLength:l,allowClear:!0})}c(".directorist-form-pricing-field").hasClass("price-type-both")&&(c("#price").show(),c("#price_range").hide()),c(".directorist-form-pricing-field__options .directorist-checkbox__label").on("click",(function(){var e=c(this);!0===e.parent(".directorist-checkbox").children("input[type=checkbox]").prop("checked")?c("#".concat(e.data("option"))).hide():c("#".concat(e.data("option"))).show();var t=e.parent().siblings(".directorist-checkbox");t.children("input[type=checkbox]").prop("checked",!1),c("#".concat(t.children(".directorist-checkbox__label").data("option"))).hide()}));var u=c("#has_tagline").val();c("#has_excerpt").val()&&u?c(".atbd_tagline_moto_field").fadeIn():c(".atbd_tagline_moto_field").fadeOut(),c("#atbd_optional_field_check").on("change",(function(){c(this).is(":checked")?c(".atbd_tagline_moto_field").fadeIn():c(".atbd_tagline_moto_field").fadeOut()})),c("#listing_t_c").on("click",(function(e){e.preventDefault(),c("#tc_container").toggleClass("active")})),c(".directorist-form-categories-field").after('
');var p=function(e){if(""==e)return{};for(var t={},r=0;r1&&void 0!==arguments[1]?arguments[1]:[],r=0,o={},i=new FormData;i.append("action","add_listing_action"),i.append("directorist_nonce",directorist.directorist_nonce),i.append("image_ids",t),c(".directorist-form-submit__btn").addClass("atbd_loading");var a,l=e.serializeArray(),u=n(l);try{for(u.s();!(a=u.n()).done;){var f=a.value;""!==f.value&&i.append(f.name,f.value)}}catch(e){u.e(e)}finally{u.f()}if(b.length){var m,_=n(b);try{for(_.s();!(m=_.n()).done;){var g=m.value;if(g.media_uploader){var v=g.media_uploader.hasValidFiles();if(v){var y=g.media_uploader.getFilesMeta();if(y)for(var w=0;w".concat(e.error_msg,"")),c(".directorist-form-submit__btn").removeClass("atbd_loading"),!1,e.quick_login_required){var r=c("#directorist-quick-login"),o=e.email;r.find('input[name="email"]').val(o),r.find('input[name="email"]').prop("disabled",!0);var i='
'+e.error_msg+"
";r.find(".directorist-modal-alerts-area").html(i),r.addClass("show"),k=function(e){c("#guest_user_email").prop("disabled",!0),c("#listing_notifier").hide().html(""),e.elements.submit_button.remove(),e.elements.form.find(".directorist-form-actions").find(".directorist-toggle-modal").removeClass("directorist-d-none")}}}else if(!0===e.preview_mode&&!0!==e.need_payment)!0!==e.edited_listing?(c("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=d(e.preview_url,"preview=1&redirect=".concat(t))):(c("#listing_notifier").show().html(''.concat(e.success_msg,"")),p.redirect?window.location.href=d(e.preview_url,"post_id=".concat(e.id,"&preview=1&payment=1&edited=1&redirect=").concat(p.redirect)):window.location.href=d(e.preview_url,"preview=1&edited=1&redirect=".concat(t)));else if(!0===e.preview_mode&&!0===e.need_payment)window.location.href=d(e.preview_url,"preview=1&payment=1&redirect=".concat(t));else{var n=e.edited_listing?"listing_id=".concat(e.id,"&edited=1"):"";!0===e.need_payment?(c("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=decodeURIComponent(t)):(c("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=d(e.redirect_url,n))}},error:function(e){!1,c(".directorist-form-submit__btn").attr("disabled",!1),c(".directorist-form-submit__btn").removeClass("atbd_loading"),console.log(e)}})}function A(){c(".directorist-custom-field-btn-more").length&&c(".directorist-custom-field-btn-more").each((function(e,t){var r=c(t).closest(".directorist-custom-field-checkbox, .directorist-custom-field-radio"),o=c(r).find(".directorist-checkbox, .directorist-radio");c(o).slice(20,o.length).slideUp(),o.length<=20&&c(t).slideUp()}))}c("body").on("submit","#directorist-add-listing-form",(function(e){if(!s.is_admin){e.preventDefault();var t=c(e.target),r={};c("#listing_notifier").empty().show().html(''.concat("Processing your submission, plese wait..",""));var o=[],i=[];if(b.length){var a,d=n(b);try{for(d.s();!(a=d.n()).done;){var l=a.value;if(l.media_uploader)if(l.media_uploader.hasValidFiles()){var u=l.media_uploader.getTheFiles();o=u}else c(".directorist-form-submit__btn").removeClass("atbd_loading"),r.listing_gallery={msg:l.uploaders_data.error_msg},c("#"+l.uploaders_data.element_id).length&&h("#"+l.uploaders_data.element_id),c("."+l.uploaders_data.element_id).length&&h("."+l.uploaders_data.element_id)}}catch(e){d.e(e)}finally{d.f()}}if(o.length){var p=0;!function e(){var r=new FormData;r.append("action","directorist_process_listing_image"),r.append("directorist_nonce",directorist.directorist_nonce),r.append("images",o[p]),c.ajax({method:"POST",processData:!1,contentType:!1,url:s.ajaxurl,data:r,success:function(r){i.push(r.data.id),console.log(r),p++,c("#listing_notifier").empty().show().html(''.concat("Uploading "+p+" image out of "+o.length,"")),p ')},success:function(e){if(u.html(p),e.loggedin){s.prop("disabled",!0);var t='
Successfully logged in, please continue to the listing submission
';if(n.html(t),k)k({elements:{modal_id:r,form:o,email:a,password:s,submit_button:u}})}else{t='
'+e.message+"
";n.html(t),u.prop("disabled",!1)}},error:function(e){console.log({error:e}),u.prop("disabled",!1),u.html(p)}})}))}))},61:function(e,t){var r;(r=jQuery)(document).ready((function(){function e(){document.querySelectorAll(".directorist-color-picker-wrap").forEach((function(e){if(null!==e){var t=r(".directorist-color-picker");""!==t.value?t.wpColorPicker():t.wpColorPicker().empty()}}))}e(),document.body.addEventListener("directorist-search-form-nav-tab-reloaded",e)}))},8:function(e,t,r){var o=r(13),i=r(14),n=r(15),a=r(16);e.exports=function(e){return o(e)||i(e)||n(e)||a()},e.exports.__esModule=!0,e.exports.default=e.exports}}); +======= +!function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=303)}({1:function(e,t){function r(t){return e.exports=r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},10:function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r");return r.addClass(t[0].className),r.text(e.text),r}},i=e.args&&"object"===o()(e.args)?Object.assign(r,e.args):r,n=a(t).find("option"),c=n.length?n[0].innerHTML:"";c.length&&(i.placeholder=c),a(t).select2(i)}))}},13:function(e,t,r){var i=r(10);e.exports=function(e){if(Array.isArray(e))return i(e)},e.exports.__esModule=!0,e.exports.default=e.exports},14:function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports},15:function(e,t,r){var i=r(10);e.exports=function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},16:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports},17:function(e,t){function r(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,c=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw c}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r'.concat(r,"");e.append(i)}var n=e.find(".directorist-select2-dropdown-toggle");o(".select2-hidden-accessible").on("select2:open",(function(e){o(this).next().find(".directorist-select2-dropdown-toggle").addClass("--is-open")})),o(".select2-hidden-accessible").on("select2:close",(function(e){o(this).next().find(".directorist-select2-dropdown-toggle").removeClass("--is-open")})),n.on("click",(function(e){var t=o(this).hasClass("--is-open"),r=o(this).closest(".select2-container").siblings("select:enabled");t?r.select2("close"):r.select2("open")})),d()}(),function(){var e=o(".select2-hidden-accessible");if(!e&&!e.length)return;var t,i=r(e);try{for(i.s();!(t=i.n()).done;){var n=t.value;o(n).children("option:selected").val()&&a(n)}}catch(e){i.e(e)}finally{i.f()}}(),o(".select2-hidden-accessible").on("change",(function(e){o(this).children("option:selected").val()&&a(o(this))}))}function a(e){o(".select2-selection__clear").css({display:"none"});var t=s(e);if(t&&t.length){t.find(".directorist-select2-dropdown-close").remove();var r=directorist.assets_url+"icons/font-awesome/svgs/solid/times.svg",i=directorist.icon_markup.replace("##URL##",r).replace("##CLASS##","");t.prepend(''.concat(i,"")),t.find(".directorist-select2-dropdown-close").on("click",(function(e){o(this).closest(".select2-container").siblings("select:enabled").val(null).trigger("change"),t.find(".directorist-select2-dropdown-close").remove(),d()})),d()}}function s(e){var t=e?o(e).next(".select2-container"):o(".select2-container");if((t=o(t).find(".directorist-select2-addons-area")).length||(o(".select2-container").append(''),t=o(".select2-container").find(".directorist-select2-addons-area")),!(t=e?o(e).next(".select2-container"):null))return null;var r=o(t).find(".directorist-select2-addons-area");return r.length?r:(t.append(''),t.find(".directorist-select2-addons-area"))}function d(){var e=o(".select2-container").find(".directorist-select2-addons-area");if(e.length){var t=e.outerWidth();o(".select2-container").find(".select2-selection__rendered").css({"padding-right":t+"px"})}}window.addEventListener("load",n),window.addEventListener("directorist-search-form-nav-tab-reloaded",n),window.addEventListener("directorist-type-change",n),window.addEventListener("directorist-instant-search-reloaded",n)},2:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},20:function(e,t,r){"use strict";var i=r(8),o=r.n(i),n=r(2),c=r.n(n),a=r(11);r(17);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function d(e){for(var t=1;t=r+1?o[r]:"",n=new Option(i,t,!0,!0);l(e).append(n),l(e).trigger({type:"select2:select",params:{data:{id:t,text:m}}})}))}}(r,p,m)}))}window.addEventListener("load",u),document.body.addEventListener("directorist-search-form-nav-tab-reloaded",u),document.body.addEventListener("directorist-reload-select2-fields",u)},26:function(e,t){window.addEventListener("DOMContentLoaded",(function(){if(void 0===window.directorist_select_executed){window.directorist_select_executed=!0;var e=document.querySelectorAll(".atbd-drop-select");null!==e&&e.forEach((function(e){e.querySelectorAll(".atbd-dropdown-item").forEach((function(t){t.addEventListener("click",(function(r){r.preventDefault(),e.querySelector(".atbd-dropdown-toggle").textContent=t.textContent,e.querySelectorAll(".atbd-dropdown-item").forEach((function(e){e.classList.remove("atbd-active")})),t.classList.add("atbd-active")}))}))})),document.querySelectorAll(".atbd-drop-select.with-sort").forEach((function(e){e.querySelectorAll(".atbd-dropdown-item").forEach((function(t){var r=e.querySelector(".atbd-dropdown-toggle"),i=t.getAttribute("data-status");t.addEventListener("click",(function(e){r.setAttribute("data-status","".concat(i))}))}))}))}}))},28:function(e,t){var r;r=jQuery,void 0===window.directorist_dropdown_executed&&(window.directorist_dropdown_executed=!0,window.addEventListener("DOMContentLoaded",(function(){var e=document.querySelectorAll(".directorist-dropdown-select"),t=0;null!==e&&e.forEach((function(e){e.querySelector(".directorist-dropdown-select-toggle").addEventListener("click",(function(r){r.preventDefault(),++t%2==1?(document.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("directorist-dropdown-select-show")})),e.querySelector(".directorist-dropdown-select-items").classList.add("directorist-dropdown-select-show")):document.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("directorist-dropdown-select-show")}))}))})),document.body.addEventListener("click",(function(e){"directorist-dropdown-select-toggle"!==e.target.getAttribute("data-drop-toggle")&&(t=0,document.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("directorist-dropdown-select-show")})))}));var i=document.querySelectorAll(".atbd-drop-select");null!==i&&i.forEach((function(e){e.querySelectorAll(".directorist-dropdown-select-items").forEach((function(t){t.addEventListener("click",(function(r){r.preventDefault(),e.querySelector(".directorist-dropdown-select-toggle").textContent=r.target.textContent,e.querySelectorAll(".directorist-dropdown-select-items").forEach((function(e){e.classList.remove("atbd-active")})),t.classList.add("atbd-active")}))}))})),r("body").on("click",".directorist-dropdown .directorist-dropdown-toggle",(function(e){e.preventDefault(),r(this).siblings(".directorist-dropdown-option").toggle()})),r("body").on("click",".directorist-dropdown .directorist-dropdown-option ul li a",(function(e){e.preventDefault();var t=r(this).html();r(this).children(".directorist-dropdown-toggle__text").html(t),r(this).closest(".directorist-dropdown-option").siblings(".directorist-dropdown-toggle").children(".directorist-dropdown-toggle__text").html(t),r(".directorist-dropdown-option").hide()})),r(document).bind("click",(function(e){r(e.target).parents().hasClass("directorist-dropdown")||r(".directorist-dropdown-option").hide()})),r(document).on("click",".atbd_dropdown",(function(e){"atbd_dropdown"===r(this).attr("class")&&(e.preventDefault(),r(this).siblings(".atbd_dropdown").removeClass("atbd_drop--active"),r(this).toggleClass("atbd_drop--active"),e.stopPropagation())})),r(document).on("click",(function(e){!1===r(e.target).is(".atbd_dropdown, .atbd_drop--active")&&r(".atbd_dropdown").removeClass("atbd_drop--active")})),r("body").on("click",".atbd_dropdown-toggle",(function(e){e.preventDefault()})),r("body").on("click",".directorist-dropdown-js .directorist-dropdown__toggle-js",(function(e){e.preventDefault(),r(this).siblings(".directorist-dropdown__links-js").is(":visible")||r(".directorist-dropdown__links").hide(),r(this).siblings(".directorist-dropdown__links-js").toggle()})),r("body").on("click",(function(e){e.target.closest(".directorist-dropdown-js")||r(".directorist-dropdown__links-js").hide()}))})))},303:function(e,t,r){e.exports=r(304)},304:function(e,t,r){"use strict";r.r(t);var i=r(2),o=r.n(i);r(28),r(26),r(61),r(20);function n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,n=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw n}}}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r").insertAfter(e)},success:function(e){jQuery(".atbdp_ajax_loading").remove(),i(e)}})}(o,"atbdp_social_info_handler",i,(function(e){t.append(e)}))})),document.addEventListener("directorist-reload-plupload",(function(){a(".directorist-color-field-js").length&&a(".directorist-color-field-js").wpColorPicker().empty()})),a("body").on("click",".directorist-form-social-fields__remove",(function(e){var t=a(this).data("id"),r=a("div#socialID-".concat(t));swal({title:s.i18n_text.confirmation_text,text:s.i18n_text.ask_conf_sl_lnk_del_txt,type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:s.i18n_text.confirm_delete,closeOnConfirm:!1},(function(e){e&&(r.slideUp("fast",(function(){r.remove(),a(".directorist-form-social-fields").each((function(e,t){var r=a(t);r.attr("id","socialID-".concat(e)),r.find("select").attr("name","social[".concat(e,"][id]")),r.find(".atbdp_social_input").attr("name","social[".concat(e,"][url]")),r.find(".directorist-form-social-fields__remove").attr("data-id",e)}))})),swal({title:s.i18n_text.deleted,type:"success",timer:200,showConfirmButton:!1}))}))})),!s.is_admin){var e=a("#at_biz_dir-location").attr("data-allow_new"),t=a("#at_biz_dir-location").attr("data-max");e?a("#at_biz_dir-location").select2({tags:!0,maximumSelectionLength:t,language:{maximumSelected:function(){return s.i18n_text.max_location_msg}},tokenSeparators:[","]}):a("#at_biz_dir-location").select2({allowClear:!0,tags:!1,maximumSelectionLength:t,tokenSeparators:[","]});var r=a("#at_biz_dir-tags").attr("data-allow_new"),i=a("#at_biz_dir-tags").attr("data-max");r?a("#at_biz_dir-tags").select2({tags:!0,maximumSelectionLength:i,tokenSeparators:[","]}):a("#at_biz_dir-tags").select2({allowClear:!0,maximumSelectionLength:i,tokenSeparators:[","]});var c=a("#at_biz_dir-categories").attr("data-allow_new"),l=a("#at_biz_dir-categories").attr("data-max");c?a("#at_biz_dir-categories").select2({allowClear:!0,tags:!0,maximumSelectionLength:l,tokenSeparators:[","]}):a("#at_biz_dir-categories").select2({maximumSelectionLength:l,allowClear:!0})}a(".directorist-form-pricing-field").hasClass("price-type-both")&&(a("#price").show(),a("#price_range").hide()),a(".directorist-form-pricing-field__options .directorist-checkbox__label").on("click",(function(){var e=a(this);!0===e.parent(".directorist-checkbox").children("input[type=checkbox]").prop("checked")?a("#".concat(e.data("option"))).hide():a("#".concat(e.data("option"))).show();var t=e.parent().siblings(".directorist-checkbox");t.children("input[type=checkbox]").prop("checked",!1),a("#".concat(t.children(".directorist-checkbox__label").data("option"))).hide()}));var u=a("#has_tagline").val();a("#has_excerpt").val()&&u?a(".atbd_tagline_moto_field").fadeIn():a(".atbd_tagline_moto_field").fadeOut(),a("#atbd_optional_field_check").on("change",(function(){a(this).is(":checked")?a(".atbd_tagline_moto_field").fadeIn():a(".atbd_tagline_moto_field").fadeOut()})),a("#listing_t_c").on("click",(function(e){e.preventDefault(),a("#tc_container").toggleClass("active")}));var f=function(e){if(""==e)return{};for(var t={},r=0;r'),p();var m=[];function _(){var e=document.querySelectorAll(".atbdp_category_custom_fields .directorist-form-element"),t=document.querySelectorAll(".atbdp_category_custom_fields .directorist-form-checks");e.length&&e.forEach((function(e){var t=e.value,r=e.getAttribute("data-id");m.push({id:r,value:t})})),t.length&&t.forEach((function(e){var t=e.checked,r=e.getAttribute("id");m.push({id:r,checked:t})}))}function g(e){document.querySelector(e).scrollIntoView({block:"start",behavior:"smooth"})}a("#at_biz_dir-categories").on("change",(function(){p(),_()})),a("#at_biz_dir-categorychecklist").on("change",(function(e){p(),_()}));var h=s.media_uploader,v=[];if(h){var b,y=0,w=n(h);try{for(w.s();!(b=w.n()).done;){var x=b.value;if(a("."+x.element_id).length){var k=new EzMediaUploader({containerClass:x.element_id});v.push({media_uploader:k,uploaders_data:x}),v[y].media_uploader.init(),y++}}}catch(e){w.e(e)}finally{w.f()}}var j=!1,S=null;function C(){a(".directorist-custom-field-btn-more").length&&a(".directorist-custom-field-btn-more").each((function(e,t){var r=a(t).closest(".directorist-custom-field-checkbox, .directorist-custom-field-radio"),i=a(r).find(".directorist-checkbox, .directorist-radio");a(i).slice(20,i.length).hide(),i.length<=20&&a(t).hide()}))}a("body").on("submit","#directorist-add-listing-form",(function(e){if(e.preventDefault(),!s.is_admin){var t=a(e.target),r=t.find(".directorist-form-submit__btn"),i={},o=0;if(j)r.attr("disabled",!0);else{var c=new FormData;c.append("action","add_listing_action"),c.append("directorist_nonce",directorist.directorist_nonce),r.addClass("atbd_loading");var l,u=n(t.serializeArray());try{for(u.s();!(l=u.n()).done;){var p=l.value;c.append(p.name,p.value)}}catch(e){u.e(e)}finally{u.f()}if(v.length){var m,_=n(v);try{for(_.s();!(m=_.n()).done;){var h=m.value;if(h.media_uploader)if(h.media_uploader.hasValidFiles()){var b=h.media_uploader.getTheFiles();if(b)for(var y=0;y".concat(e.error_msg,"")),r.removeClass("atbd_loading"),j=!1,e.quick_login_required){var i=a("#directorist-quick-login"),o=e.email;i.find('input[name="email"]').val(o),i.find('input[name="email"]').prop("disabled",!0);var n='
'+e.error_msg+"
";i.find(".directorist-modal-alerts-area").html(n),i.addClass("show"),S=function(e){a("#guest_user_email").prop("disabled",!0),a("#listing_notifier").hide().html(""),e.elements.submit_button.remove(),e.elements.form.find(".directorist-form-actions").find(".directorist-toggle-modal").removeClass("directorist-d-none")}}}else if(!0===e.preview_mode&&!0!==e.need_payment)!0!==e.edited_listing?(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=d(e.preview_url,"preview=1&redirect=".concat(t))):(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),f.redirect?window.location.href=d(e.preview_url,"post_id=".concat(e.id,"&preview=1&payment=1&edited=1&redirect=").concat(f.redirect)):window.location.href=d(e.preview_url,"preview=1&edited=1&redirect=".concat(t)));else if(!0===e.preview_mode&&!0===e.need_payment)window.location.href=d(e.preview_url,"preview=1&payment=1&redirect=".concat(t));else{var c=e.edited_listing?"listing_id=".concat(e.id,"&edited=1"):"";!0===e.need_payment?(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=decodeURIComponent(t)):(a("#listing_notifier").show().html(''.concat(e.success_msg,"")),window.location.href=d(e.redirect_url,c))}},error:function(e){j=!1,r.attr("disabled",!1),r.removeClass("atbd_loading"),console.log(e)}})}}})),a(window).on("load",(function(){C()})),a("body").on("click",".directorist-custom-field-btn-more",(function(e){e.preventDefault();var t=a(this).closest(".directorist-custom-field-checkbox, .directorist-custom-field-radio"),r=a(t).find(".directorist-checkbox, .directorist-radio");a(r).slice(20,r.length).slideUp(),a(this).toggleClass("active"),a(this).hasClass("active")?(a(this).text(s.i18n_text.see_less_text),a(r).slice(20,r.length).slideDown()):(a(this).text(s.i18n_text.see_more_text),a(r).slice(20,r.length).slideUp())})),a("#directorist-quick-login .directorist-toggle-modal").on("click",(function(e){e.preventDefault(),a("#directorist-quick-login").removeClass("show")})),a("#quick-login-from-submit-btn").on("click",(function(e){e.preventDefault();var t=a(this).data("form"),r=a(this).data("form"),i=(a(r),a(t)),n=i.find(".directorist-form-feedback"),c=a(i).find('input[name="email"]'),s=a(i).find('input[name="password"]'),d=a(i).find('input[name="directorist-quick-login-security"]'),l=o()({action:"directorist_ajax_quick_login",username:c.val(),password:s.val(),rememberme:!1},"directorist-quick-login-security",d.val()),u=a(this),f=u.html();a.ajax({method:"POST",url:directorist.ajaxurl,data:l,beforeSend:function(){n.html(""),u.prop("disabled",!0),u.prepend(' ')},success:function(e){if(u.html(f),e.loggedin){s.prop("disabled",!0);var t='
Successfully logged in, please continue to the listing submission
';if(n.html(t),S)S({elements:{modal_id:r,form:i,email:c,password:s,submit_button:u}})}else{t='
'+e.message+"
";n.html(t),u.prop("disabled",!1)}},error:function(e){console.log({error:e}),u.prop("disabled",!1),u.html(f)}})}))}))},61:function(e,t){var r;r=jQuery,void 0===window.directorist_colorPicker_executed&&(window.directorist_colorPicker_executed=!0,r(document).ready((function(){function e(){document.querySelectorAll(".directorist-color-picker-wrap").forEach((function(e){if(null!==e){var t=r(".directorist-color-picker");""!==t.value?t.wpColorPicker():t.wpColorPicker().empty()}}))}e(),document.body.addEventListener("directorist-search-form-nav-tab-reloaded",e)})))},8:function(e,t,r){var i=r(13),o=r(14),n=r(15),c=r(16);e.exports=function(e){return i(e)||o(e)||n(e)||c()},e.exports.__esModule=!0,e.exports.default=e.exports}}); +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 diff --git a/assets/js/all-listings.js b/assets/js/all-listings.js index 059b476f44..31777098f2 100644 --- a/assets/js/all-listings.js +++ b/assets/js/all-listings.js @@ -1845,6 +1845,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = // Directorist pagination $('body').on("click", ".directorist-instant-search .directorist-pagination .page-numbers", function (e) { + var _form_data; e.preventDefault(); var tag = []; var price = []; @@ -1912,7 +1913,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = var page = paginate_link && paginate_link.length ? paginate_link.match(/paged=.+/) : ''; var page_no = page && page.length ? page[0].replace(/paged=/, '') : ''; } - var form_data = _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({ + var form_data = (_form_data = { action: 'directorist_instant_search', _nonce: directorist.ajax_nonce, current_page_id: directorist.current_page_id, @@ -1934,7 +1935,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = website: website || getURLParameter(full_url, 'website'), phone: phone || getURLParameter(full_url, 'phone'), custom_field: custom_field || getURLParameter(full_url, 'custom_field') - }, "view", view), "paged", page_no), "data_atts", JSON.parse(data_atts)); + }, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_form_data, "view", view), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_form_data, "paged", page_no), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(_form_data, "data_atts", JSON.parse(data_atts)), _form_data); //business hours if ($('input[name="open_now"]').is(':checked')) { diff --git a/assets/src/js/global/add-listing.js b/assets/src/js/global/add-listing.js index 93ef68d2b0..63392207f9 100644 --- a/assets/src/js/global/add-listing.js +++ b/assets/src/js/global/add-listing.js @@ -19,6 +19,13 @@ const localized_data = directorist.add_listing_data; return url.match( /[?]/ ) ? `${url}&${queryString}` : `${url}?${queryString}`; } +function scrollTo(selector) { + document.querySelector(selector)?.scrollIntoView({ + block: 'start', + behavior: 'smooth' + }); +} + /* Show and hide manual coordinate input field */ $(window).on('load', function () { if ($('input#manual_coordinate').length) { @@ -382,13 +389,6 @@ $(document).ready(function () { storeCustomFieldsData(); }); - function scrollToEl(selector) { - document.querySelector(selector).scrollIntoView({ - block: 'start', - behavior: 'smooth' - }) - } - function atbdp_element_value(element) { const field = $(element); if (field.length) { @@ -397,21 +397,21 @@ $(document).ready(function () { return ''; } - const uploaders = localized_data.media_uploader; let mediaUploaders = []; - if (uploaders) { - let i = 0; - for (var uploader of uploaders) { - if ($('.' + uploader['element_id']).length) { - let media_uploader = new EzMediaUploader({ - containerClass: uploader['element_id'], + if (localized_data.media_uploader) { + for (let uploader of localized_data.media_uploader) { + if ($('.' + uploader.element_id).length) { + const EzUploader = new EzMediaUploader({ + containerClass: uploader.element_id, }); + mediaUploaders.push({ - media_uploader: media_uploader, + media_uploader: EzUploader, uploaders_data: uploader, }); - mediaUploaders[i].media_uploader.init(); - i++; + + EzUploader.init(); + // mediaUploaders[i].media_uploader.init(); } } } @@ -419,210 +419,303 @@ $(document).ready(function () { let on_processing = false; let has_media = true; let quick_login_modal__success_callback = null; + const $notification = $('#listing_notifier'); // ----------------------------- // Submit The Form // ----------------------------- + let uploadedImages = []; + $('body').on('submit', '#directorist-add-listing-form', function (e) { e.preventDefault(); - if (localized_data.is_admin) { - return; - } - - const $form = $(e.target); - const $submitButton = $form.find('.directorist-form-submit__btn'); - const err_log = {}; - let error_count = 0; + const $form = $(e.target); + let error_count = 0; + const err_log = {}; + const $submitButton = $('.directorist-form-submit__btn'); if (on_processing) { - $submitButton.attr('disabled', true); return; } - const form_data = new FormData(); - - form_data.append('action', 'add_listing_action'); - form_data.append('directorist_nonce', directorist.directorist_nonce); - - $submitButton.addClass('atbd_loading'); - - const fieldValuePairs = $form.serializeArray(); + function disableSubmitButton() { + on_processing = true; + $submitButton.addClass('atbd_loading').attr('disabled', true); + } - // Append Form Fields Values - for ( const field of fieldValuePairs ) { - form_data.append( field.name, field.value ); + function enableSubmitButton() { + on_processing = false; + $submitButton.removeClass('atbd_loading').attr('disabled', false); } // images + let selectedImages = []; + if (mediaUploaders.length) { for (var uploader of mediaUploaders) { - if (has_media && uploader.media_uploader) { - if (uploader.media_uploader.hasValidFiles()) { - // files - var files = uploader.media_uploader.getTheFiles(); - if (files) { - for (var i = 0; i < files.length; i++) { - form_data.append(uploader.uploaders_data['meta_name'] + '[]', files[i]); - } - } - var files_meta = uploader.media_uploader.getFilesMeta(); - if (files_meta) { - for (var i = 0; i < files_meta.length; i++) { - var elm = files_meta[i]; - for (var key in elm) { - form_data.append(`${uploader.uploaders_data['files_meta_name']}[${i}][${key}]`, elm[key]); - } - } - } - } else { - $submitButton.removeClass('atbd_loading'); - err_log.listing_gallery = { - msg: uploader.uploaders_data['error_msg'] - }; - error_count++; - if ($('#' + uploader.uploaders_data['element_id']).length) { - scrollToEl('#' + uploader.uploaders_data['element_id']); - } - if ($('.' + uploader.uploaders_data['element_id']).length) { - scrollToEl('.' + uploader.uploaders_data['element_id']); - } - } + if (!uploader.media_uploader || $(uploader.media_uploader.container).parents('form').get(0) !== $form.get(0)) { + continue; } - } - } - // categories - const categories = $form.find('#at_biz_dir-categories').val(); - if (Array.isArray(categories) && categories.length) { - for (var key in categories) { - var value = categories[key]; - form_data.append('tax_input[at_biz_dir-category][]', value); - } - } - - if (typeof categories === 'string') { - form_data.append('tax_input[at_biz_dir-category][]', categories); - } - - if( form_data.has( 'admin_category_select[]') ) { - form_data.delete( 'admin_category_select[]' ); - } - - if( form_data.has( 'directory_type') ) { - form_data.delete( 'directory_type' ); - } - - var form_directory_type = $form.find("input[name='directory_type']"); - - var form_directory_type_value = form_directory_type !== undefined ? form_directory_type.val() : ''; - var directory_type = qs.directory_type ? qs.directory_type : form_directory_type_value; + if (!uploader.media_uploader.hasValidFiles()) { + $submitButton.removeClass('atbd_loading'); - form_data.append('directory_type', directory_type); + err_log.listing_gallery = { + msg: uploader.uploaders_data['error_msg'] + }; - if (qs.plan) { - form_data.append('plan_id', qs.plan); - } + error_count++; + scrollTo('.' + uploader.uploaders_data.element_id); + break; + } - if (error_count) { - on_processing = false; - $submitButton.attr('disabled', false); - console.log('Form has invalid data'); - console.log(error_count, err_log); - return; + selectedImages = uploader.media_uploader.getTheFiles(); + } } - on_processing = true; + if ( selectedImages.length ) { + let counter = 0; - $.ajax({ - method: 'POST', - processData: false, - contentType: false, - url: localized_data.ajaxurl, - data: form_data, - success(response) { - //console.log(response); - // return; - // show the error notice - $submitButton.attr('disabled', false); - - var redirect_url = ( response && response.redirect_url ) ? response.redirect_url : ''; - redirect_url = ( redirect_url && typeof redirect_url === 'string' ) ? response.redirect_url.replace( /:\/\//g, '%3A%2F%2F' ) : ''; + function uploadImage() { + const formData = new FormData(); - if (response.error === true) { - $('#listing_notifier').show().html(`${response.error_msg}`); - $submitButton.removeClass('atbd_loading'); - on_processing = false; + formData.append( 'action', 'directorist_upload_listing_image' ); + formData.append( 'directorist_nonce', directorist.directorist_nonce ); + formData.append( 'image', selectedImages[ counter ] ); - if (response.quick_login_required) { - var modal = $('#directorist-quick-login'); - var email = response.email; + $.ajax( { + method: 'POST', + processData: false, + contentType: false, + url: localized_data.ajaxurl, + data: formData, + beforeSend() { + disableSubmitButton(); - // Prepare fields - modal.find('input[name="email"]').val(email); - modal.find('input[name="email"]').prop('disabled', true); + const totalImages = selectedImages.length; + if ( totalImages === 1 ) { + $notification + .show() + .html(`${localized_data.i18n_text.image_uploading_msg}`); + } else { + const completedPercent = Math.ceil( ( ( counter === 0 ? 1 : counter ) * 100 ) / totalImages ); + $notification + .show() + .html(`${localized_data.i18n_text.image_uploading_msg} (${completedPercent}%)`); + } + }, + success( response ) { + if ( ! response.success ) { + enableSubmitButton() + + $notification.show().html(`${response.data}`); + + return; + } - // Show alert - var alert = '
' + response.error_msg + '
'; - modal.find('.directorist-modal-alerts-area').html(alert); + uploadedImages.push( response.data ); - // Show the modal - modal.addClass('show'); + counter++; + + if ( counter < selectedImages.length ) { + uploadImage(); + } else { + submitForm( $form, uploadedImages ); + } + }, + error(response) { + enableSubmitButton(); - quick_login_modal__success_callback = function (args) { - $('#guest_user_email').prop('disabled', true); - $('#listing_notifier').hide().html(''); + $notification.html(`${response.responseJSON.data}`); + } + } ); + } - args.elements.submit_button.remove(); + if ( uploadedImages.length === selectedImages.length ) { + submitForm( $form, uploadedImages ); + } else { + uploadImage(); + } + } else { + submitForm( $form ); + } - var form_actions = args.elements.form.find('.directorist-form-actions'); - form_actions.find('.directorist-toggle-modal').removeClass('directorist-d-none'); + function submitForm( $form, uploadedImages = [] ) { + var error_count = 0; + var err_log = {}; + let form_data = new FormData(); + + form_data.append('action', 'add_listing_action'); + form_data.append('directorist_nonce', directorist.directorist_nonce); + form_data.append('listing_img', uploadedImages ); + + disableSubmitButton(); + + const fieldValuePairs = $form.serializeArray(); + + // Append Form Fields Values + for ( const field of fieldValuePairs ) { + form_data.append( field.name, field.value ); + } + + //images + if (mediaUploaders.length) { + for (var uploader of mediaUploaders) { + if (!uploader.media_uploader || $(uploader.media_uploader.container).parents('form').get(0) !== $form.get(0)) { + continue; + } + + if (uploader.media_uploader.hasValidFiles()) { + var files_meta = uploader.media_uploader.getFilesMeta(); + if (files_meta) { + for (var i = 0; i < files_meta.length; i++) { + form_data.append(`listing_img_old[${i}]`, files_meta[i].attachmentID); + } + } + } else { + err_log.listing_gallery = { + msg: uploader.uploaders_data['error_msg'] + }; + + error_count++; + + if ($('.' + uploader.uploaders_data.element_id).length) { + scrollTo('.' + uploader.uploaders_data.element_id); } } - } else { - // preview on and no need to redirect to payment - if (response.preview_mode === true && response.need_payment !== true) { - if (response.edited_listing !== true) { - $('#listing_notifier') - .show() - .html(`${response.success_msg}`); + } + } + + // categories + const categories = $form.find('#at_biz_dir-categories').val(); + if ( Array.isArray( categories ) && categories.length ) { + for ( let key in categories ) { + form_data.append('tax_input[at_biz_dir-category][]', categories[key]); + } + } + + if ( typeof categories === 'string' ) { + form_data.append('tax_input[at_biz_dir-category][]', categories); + } + + if( form_data.has( 'admin_category_select[]') ) { + form_data.delete( 'admin_category_select[]' ); + } + + if( form_data.has( 'directory_type') ) { + form_data.delete( 'directory_type' ); + } + + var form_directory_type = $form.find( "input[name='directory_type']" ); + + var form_directory_type_value = form_directory_type !== undefined ? form_directory_type.val() : ''; + var directory_type = qs.directory_type ? qs.directory_type : form_directory_type_value; + + form_data.append('directory_type', directory_type); + + if (qs.plan) { + form_data.append('plan_id', qs.plan); + } + + if (error_count) { + enableSubmitButton(); - window.location.href = joinQueryString( response.preview_url, `preview=1&redirect=${redirect_url}` ); + console.log('Form has invalid data'); + console.log(error_count, err_log); + return; + } - } else { - $('#listing_notifier') - .show() - .html(`${response.success_msg}`); - if (qs.redirect) { - window.location.href = joinQueryString( response.preview_url, `post_id=${response.id}&preview=1&payment=1&edited=1&redirect=${qs.redirect}` ); - } else { - window.location.href = joinQueryString( response.preview_url, `preview=1&edited=1&redirect=${redirect_url}` ); + $.ajax({ + method: 'POST', + processData: false, + contentType: false, + url: localized_data.ajaxurl, + data: form_data, + beforeSend() { + disableSubmitButton(); + + $notification + .show() + .html(`${localized_data.i18n_text.submission_wait_msg}`); + }, + success(response) { + var redirect_url = ( response && response.redirect_url ) ? response.redirect_url : ''; + redirect_url = ( redirect_url && typeof redirect_url === 'string' ) ? response.redirect_url.replace( /:\/\//g, '%3A%2F%2F' ) : ''; + + if (response.error === true) { + enableSubmitButton(); + + $notification.show().html(`${response.error_msg}`); + + if (response.quick_login_required) { + var modal = $('#directorist-quick-login'); + var email = response.email; + + // Prepare fields + modal.find('input[name="email"]').val(email); + modal.find('input[name="email"]').prop('disabled', true); + + // Show alert + var alert = '
' + response.error_msg + '
'; + modal.find('.directorist-modal-alerts-area').html(alert); + + // Show the modal + modal.addClass('show'); + + quick_login_modal__success_callback = function (args) { + $('#guest_user_email').prop('disabled', true); + $notification.hide().html(''); + + args.elements.submit_button.remove(); + + var form_actions = args.elements.form.find('.directorist-form-actions'); + form_actions.find('.directorist-toggle-modal').removeClass('directorist-d-none'); } } - // preview mode active and need payment - } else if (response.preview_mode === true && response.need_payment === true) { - window.location.href = joinQueryString( response.preview_url, `preview=1&payment=1&redirect=${redirect_url}` ); } else { - const is_edited = response.edited_listing ? `listing_id=${response.id}&edited=1` : ''; - - if (response.need_payment === true) { - $('#listing_notifier').show().html(`${response.success_msg}`); - window.location.href = decodeURIComponent(redirect_url); + // preview on and no need to redirect to payment + if (response.preview_mode === true && response.need_payment !== true) { + if (response.edited_listing !== true) { + $notification + .show() + .html(`${response.success_msg}`); + + window.location.href = joinQueryString( response.preview_url, `preview=1&redirect=${redirect_url}` ); + + } else { + $notification + .show() + .html(`${response.success_msg}`); + if (qs.redirect) { + window.location.href = joinQueryString( response.preview_url, `post_id=${response.id}&preview=1&payment=1&edited=1&redirect=${qs.redirect}` ); + } else { + window.location.href = joinQueryString( response.preview_url, `preview=1&edited=1&redirect=${redirect_url}` ); + } + } + // preview mode active and need payment + } else if (response.preview_mode === true && response.need_payment === true) { + window.location.href = joinQueryString( response.preview_url, `preview=1&payment=1&redirect=${redirect_url}` ); } else { - $('#listing_notifier').show().html(`${response.success_msg}`); - window.location.href = joinQueryString( response.redirect_url, is_edited ); + const is_edited = response.edited_listing ? `listing_id=${response.id}&edited=1` : ''; + + if (response.need_payment === true) { + $notification.show().html(`${response.success_msg}`); + window.location.href = decodeURIComponent(redirect_url); + } else { + $notification.show().html(`${response.success_msg}`); + window.location.href = joinQueryString( response.redirect_url, is_edited ); + } } } - } - }, - error(error) { - on_processing = false; - $submitButton.attr('disabled', false); - $submitButton.removeClass('atbd_loading'); - console.log(error);`` - }, - }); - }); + }, + error(error) { + enableSubmitButton(); + + console.log(error); + }, + }); + } + } ); // Custom Field Checkbox Button More function customFieldSeeMore() { diff --git a/assets/src/scss/component/_add-listing.scss b/assets/src/scss/component/_add-listing.scss index e2593661ae..4ac91024da 100644 --- a/assets/src/scss/component/_add-listing.scss +++ b/assets/src/scss/component/_add-listing.scss @@ -287,30 +287,18 @@ display: none; } } - - .ezmu__thumbnail-list-item { - width: auto; - } } //add listing image upload .directorist-add-listing-wrapper { max-width: 750px !important; margin: 0 auto; - .ezmu__thumbnail-list-item { - max-width: 300px; - flex-basis: 300px; - } .ezmu__thumbnail-list-item_back { height: 200px; width: 100%; } - - .ezmu__media-picker-buttons { - margin-top: 10px; - } - + .ezmu__titles-area { .ezmu__title-1 { font-size: 30px; diff --git a/assets/vendor-css/ez-media-uploader.css b/assets/vendor-css/ez-media-uploader.css index 0480ca56dd..340bc5be2b 100644 --- a/assets/vendor-css/ez-media-uploader.css +++ b/assets/vendor-css/ez-media-uploader.css @@ -1,30 +1,30 @@ /** * EZ Media Uploader - * Company: Aazz Tech - * Develoepr: Syed Galib Ahmed + * Company: SovWare + * Developer: Syed Galib Ahmed * Version: 1.0 * Initial Release: 24 December, 2019 * */ .ez-media-uploader { - margin: 10px auto; position: relative; - padding: 10px 10px; + padding: 18px; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + -ms-flex-align: center; + align-items: center; -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; + -ms-flex-pack: center; + justify-content: center; -webkit-box-orient: vertical; -webkit-box-direction: normal; - -ms-flex-direction: column; - flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; min-height: 250px; - border: 3px dashed #ccc; - background-color: #eaeaea; + border: 2px dashed #ccc; + background-color: #f1f1f1; + border-radius: 5px; } .ezmu__old-files, @@ -120,7 +120,8 @@ background-size: contain; width: 100%; height: 100%; - filter: invert(48%) sepia(0%) saturate(2537%) hue-rotate(86deg) brightness(118%) contrast(119%); + -webkit-filter: invert(48%) sepia(0%) saturate(2537%) hue-rotate(86deg) brightness(118%) contrast(119%); + filter: invert(48%) sepia(0%) saturate(2537%) hue-rotate(86deg) brightness(118%) contrast(119%); } .ezmu-icon-upload { @@ -245,20 +246,23 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { display: -ms-flexbox; display: flex; -ms-flex-wrap: wrap; - flex-wrap: wrap; + flex-wrap: wrap; -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + -ms-flex-align: center; + align-items: center; -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; + -ms-flex-pack: center; + justify-content: center; + gap: 15px; } + .ezmu__thumbnail-list-item { - margin: 5px; - width: 100%; position: relative; - border-radius: 8px; + border-radius: 5px; overflow: hidden; + max-width: calc(50% - 7.5px); + -ms-flex-preferred-size: calc(50% - 7.5px); + flex-basis: calc(50% - 7.5px); } .ezmu__featured_tag { @@ -291,27 +295,27 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { } .ezmu__front-item__close-icon { position: relative; - width: 30px; - height: 30px; + width: 25px; + height: 25px; border-radius: 50%; - color: #000; + color: #222; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; + -ms-flex-align: center; + align-items: center; -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; + -ms-flex-pack: center; + justify-content: center; cursor: pointer; - -webkit-transition: all ease-in-out 200ms; - -o-transition: all ease-in-out 200ms; - transition: all ease-in-out 200ms; + -webkit-transition: background-color ease-in .2s; + -o-transition: background-color ease-in .2s; + transition: background-color ease-in .2s; background-color: rgba(255, 255, 255, 0.8); background-image: url('../images/times-solid-dark.svg'); background-repeat: no-repeat !important; - background-size: 12px; + background-size: 8px; background-position: center; } @@ -385,22 +389,24 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { cursor: pointer; text-align: center; border: none; - -webkit-transition: all ease-in-out 300ms; - -o-transition: all ease-in-out 300ms; - transition: all ease-in-out 300ms; + -webkit-transition: background-color ease-in .1s; + -o-transition: background-color ease-in .1s; + transition: background-color ease-in .1s; background-color: rgba(255, 255, 255, 0.8); background-position: center; background-repeat: no-repeat !important; background-size: 12px; + font-size: 10px; } .ezmu__front-item__sort-button.ezmu--sort-up { background-image: url('../images/chevron-right-solid.svg'); + border-radius: 0 3px 3px 0; } - .ezmu__front-item__sort-button.ezmu--sort-down { background-image: url('../images/chevron-left-solid.svg'); + border-radius: 3px 0 0 3px; } .ezmu__front-item__sort-button:hover { @@ -442,8 +448,8 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { display: block; width: 100%; height: 100% !important; - -o-object-fit: contain; - object-fit: contain; + -o-object-fit: cover; + object-fit: cover; } .ezmu__thumbnail-img-bg { @@ -479,7 +485,8 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { } } .ezmu__thumbnail-list-item.ezmu__thumbnail_avater .ezmu__thumbnail-img { - object-fit: cover; + -o-object-fit: cover; + object-fit: cover; } .ezmu__thumbnail-list-item.ezmu__thumbnail_avater .ezmu__front-item__close { @@ -487,12 +494,14 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { right: unset; bottom: 10px; left: 50%; - transform: scale(0.9) translateX(-50%); + -webkit-transform: scale(0.9) translateX(-50%); + -ms-transform: scale(0.9) translateX(-50%); + transform: scale(0.9) translateX(-50%); } .ezmu__info-list { padding: 0; - margin: 25px auto 10px; + margin: 0; text-align: center; max-width: 800px; width: 100%; @@ -503,8 +512,10 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { display: inline-block; margin-bottom: 5px; margin-right: 20px; - color:gray; + color:#777; font-size: 14px; + -webkit-transition: all ease-in-out 300ms; + -o-transition: all ease-in-out 300ms; transition: all ease-in-out 300ms; } @@ -522,6 +533,8 @@ input[type="file"].ezmu__file-input + .ezmu__input-label { background-color:#c4c4c4; vertical-align: top; border-radius: 50%; + -webkit-transition: all ease-in-out 300ms; + -o-transition: all ease-in-out 300ms; transition: all ease-in-out 300ms; } diff --git a/assets/vendor-css/ez-media-uploader.min.css b/assets/vendor-css/ez-media-uploader.min.css index 1387f9840d..8ebcc1d518 100644 --- a/assets/vendor-css/ez-media-uploader.min.css +++ b/assets/vendor-css/ez-media-uploader.min.css @@ -1,8 +1,8 @@ /** * EZ Media Uploader - * Company: Aazz Tech - * Develoepr: Syed Galib Ahmed + * Company: SovWare + * Developer: Syed Galib Ahmed * Version: 1.0 * Initial Release: 24 December, 2019 * */ -.ez-media-uploader{margin:10px auto;position:relative;padding:10px 10px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;min-height:250px;border:3px dashed #ccc;background-color:#eaeaea}.ezmu-dictionary,.ezmu__old-files{display:none}.ezmu__media-picker-section,.ezmu__preview-section,.ezmu__status-section{display:none;width:100%}.ezmu__drop-zone-section{display:none;height:100%;position:absolute;right:0;left:0;top:0;bottom:0;z-index:999;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;text-align:center;overflow:hidden;background:#f2f2f2}.ezmu__media-picker-section.show,.ezmu__preview-section.show,.ezmu__status-section.show{display:block}.ezmu__media-picker-section.ezmu--show,.ezmu__preview-section.ezmu--show,.ezmu__status-section.ezmu--show{display:block}.ez-media-uploader.highlight{border-color:#2b2b2b}.ez-media-uploader.drag-enter *,.ez-media-uploader.highlight *{pointer-events:none}.ez-media-uploader.highlight .ezmu__drop-zone-section{display:-webkit-box;display:-ms-flexbox;display:flex}.ezmu__media-picker-controls{text-align:center}.ezmu__media-picker-icon-wrap-upload{margin-bottom:20px;display:inline-block;margin-bottom:20px;width:60px;height:60px;vertical-align:bottom}.ezmu__media-picker-icon-wrap-avater{display:inline-block;width:100px;height:100px;vertical-align:bottom}.ezmu__icon{display:inline-block;background-repeat:no-repeat!important;background-position:center;background-size:contain;width:100%;height:100%;filter:invert(48%) sepia(0%) saturate(2537%) hue-rotate(86deg) brightness(118%) contrast(119%)}.ezmu-icon-upload{background-image:url('../images/cloud-upload-alt-solid.svg')}.ezmu-icon-avater{background-image:url('../images/user-alt-solid.svg')}.ezmu__media-picker-buttons{margin-top:20px;text-align:center}.ezmu__upload-button-wrap{display:inline-block}input[type=file].ezmu__file-input{display:none}input[type=file].ezmu__file-input+.ezmu__input-label{cursor:pointer}.ezmu__btn{display:inline-block;margin-bottom:.5rem;padding:8px 15px;color:#fff;cursor:pointer;border:none;border-radius:4px;-webkit-transition:all ease-in-out .3s;-o-transition:all ease-in-out .3s;transition:all ease-in-out .3s;background-color:#2b2b2b;background-color:#fff;color:#2b2b2b;-webkit-box-shadow:0 12px 8px -10px#ccc;box-shadow:0 12px 8px -10px#ccc}.ezmu__btn:hover{color:#fff;background-color:#007bff}.ezmu__loading-section{display:none;position:absolute;right:0;left:0;top:0;bottom:0;background-color:#f2f2f2;z-index:-99}.ezmu__loading-section.ezmu--show{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999}.ezmu__loading-icon{font-size:4rem}.ezmu__loading-icon-img{width:64px;height:auto;-webkit-animation:ezmuSpin linear infinite 2s;animation:ezmuSpin linear infinite 2s}.ezmu__loading-icon-img-bg{width:64px;height:64px;display:inline-block;background-image:url('../images/spinner-solid.svg');background-repeat:no-repeat!important;background-position:center;background-size:contain;-webkit-animation:ezmuSpin linear infinite 2s;animation:ezmuSpin linear infinite 2s}@-webkit-keyframes ezmuSpin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes ezmuSpin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ezmu__thumbnail-list{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ezmu__thumbnail-list-item{margin:5px;width:100%;position:relative;border-radius:8px;overflow:hidden}.ezmu__featured_tag{position:absolute;top:5px;left:5px;padding:5px 10px;color:#000;border-radius:3px;display:inline-block;font-size:12px;background-color:rgba(255,255,255,.8)}.ezmu__thumbnail-list-item_front{position:absolute;z-index:99;left:0;right:0;top:0;bottom:0}.ezmu__thumbnail-front-item{position:absolute}.ezmu__front-item__close{right:5px;top:5px}.ezmu__front-item__close-icon{position:relative;width:30px;height:30px;border-radius:50%;color:#000;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;-webkit-transition:all ease-in-out .2s;-o-transition:all ease-in-out .2s;transition:all ease-in-out .2s;background-color:rgba(255,255,255,.8);background-image:url('../images/times-solid-dark.svg');background-repeat:no-repeat!important;background-size:12px;background-position:center}.ezmu__front-item__close-icon:hover{color:#fff;background-color:rgba(255,0,0,.7);background-image:url('../images/times-solid-light.svg')}.ezmu__front-item__close-icon-img{width:12px}.ezmu__front-item__close-btn{position:absolute;top:0;bottom:0;right:0;left:0;z-index:99}.ezmu__front-item__featured{display:none;top:5px;left:5px}.ezmu__front-item__featured.ezmu--show{display:block}.ezmu__front-item__featured-text{position:static;background-color:rgba(255,255,255,.8);padding:5px 10px;color:#000;border-radius:3px;display:inline-block;font-size:12px}.ezmu__front-item__thumbnail-size{bottom:5px;right:5px}.ezmu__front-item__thumbnail-size-text{position:static;display:inline-block;background-color:rgba(255,255,255,.8);padding:5px;border-radius:3px;font-size:12px}.ezmu__front-item__thumbnail-size-text.has-error{color:#fff;background-color:rgba(255,32,32,.8)}.ezmu__front-item__sort-buttons{position:absolute;bottom:5px;left:5px}.ezmu__front-item__sort-button{position:relative;width:30px;height:30px;display:inline-block;cursor:pointer;text-align:center;border:none;-webkit-transition:all ease-in-out .3s;-o-transition:all ease-in-out .3s;transition:all ease-in-out .3s;background-color:rgba(255,255,255,.8);background-position:center;background-repeat:no-repeat!important;background-size:12px}.ezmu__front-item__sort-button.ezmu--sort-up{background-image:url('../images/chevron-right-solid.svg')}.ezmu__front-item__sort-button.ezmu--sort-down{background-image:url('../images/chevron-left-solid.svg')}.ezmu__front-item__sort-button:hover{background-color:#fff}.ezmu__front-item__sort-button-skin{position:absolute;right:0;left:0;top:0;bottom:0;z-index:99}.ezmu__thumbnail-list-item_back{width:140px;height:140px;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;background-color:#d4d4d4}.ezmu__thumbnail-img{display:block;width:100%;height:100%!important;-o-object-fit:contain;object-fit:contain}.ezmu__thumbnail-img-bg{display:block;width:100%;height:100%;background-position:center;background-repeat:no-repeat!important;background-size:100px 100px;background-image:url('../images/file-solid.svg')}.ezmu__thumbnail-icon{display:block;margin:0 auto;width:100px;height:100px;-o-object-fit:contain;object-fit:contain}.ezmu__thumbnail-list-item.ezmu__thumbnail_avater{width:140px;height:140px;border-radius:50%}.ezmu__thumbnail-list-item.ezmu__thumbnail_avater .ezmu__thumbnail-img{object-fit:cover}.ezmu__thumbnail-list-item.ezmu__thumbnail_avater .ezmu__front-item__close{top:unset;right:unset;bottom:10px;left:50%;transform:scale(.9) translateX(-50%)}.ezmu__info-list{padding:0;margin:25px auto 10px;text-align:center;max-width:800px;width:100%}.ezmu__info-list-item{list-style:none;display:inline-block;margin-bottom:5px;margin-right:20px;color:gray;font-size:14px;transition:all ease-in-out .3s}.ezmu__info-list-item::before{content:' ';display:inline-block;margin-right:5px;margin-top:4px;width:14px;height:14px;background-repeat:no-repeat;background-position:center;background-size:8px 8px;background-image:url('../images/info-solid.svg');background-color:#c4c4c4;vertical-align:top;border-radius:50%;transition:all ease-in-out .3s}.ezmu__info-list-item.is-featured{color:#1aa663}.ezmu__info-list-item.is-featured::before{background-image:url('../images/info-solid-light.svg');background-color:#1aa663}.ezmu__info-list-item.has-error{color:#f25454}.ezmu__info-list-item.has-error::before{background-image:url('../images/info-solid-light.svg');background-color:#f25454}.ezmu_alert{margin:10px auto;max-width:300px;width:100%;text-align:center;padding:5px;border-radius:3px;color:gray;background-color:#fff}.ezmu_alert_error{color:#600000;background-color:#fbb}.ezmu__titles-area{display:block}.ezmu__title-1,.ezmu__title-2,.ezmu__title-3{display:block;margin-bottom:1rem;text-align:center}.ezmu__title-1{font-size:2rem}.ezmu__title-2{font-size:1.5rem}.ezmu__title-3{font-size:1.2rem} \ No newline at end of file +.ez-media-uploader,.ezmu__drop-zone-section{-webkit-box-orient:vertical;-webkit-box-direction:normal}.ezmu__btn,.ezmu__info-list-item{-webkit-transition:.3s ease-in-out;-o-transition:.3s ease-in-out}.ez-media-uploader{position:relative;padding:18px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-ms-flex-direction:column;flex-direction:column;min-height:250px;border:2px dashed #ccc;background-color:#f1f1f1;border-radius:5px}.ezmu__drop-zone-section,.ezmu__loading-section{position:absolute;left:0;top:0;right:0;bottom:0}.ezmu-dictionary,.ezmu__old-files,input[type=file].ezmu__file-input{display:none}.ezmu__media-picker-section,.ezmu__preview-section,.ezmu__status-section{display:none;width:100%}.ezmu__drop-zone-section{display:none;height:100%;z-index:999;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-direction:column;flex-direction:column;text-align:center;overflow:hidden;background:#f2f2f2}.ezmu__btn,.ezmu__icon,.ezmu__media-picker-icon-wrap-avater,.ezmu__upload-button-wrap{display:inline-block}.ezmu__front-item__close-icon,.ezmu__front-item__sort-button,.ezmu__icon,.ezmu__loading-icon-img-bg,.ezmu__thumbnail-img-bg{background-repeat:no-repeat!important}.ezmu__media-picker-section.ezmu--show,.ezmu__media-picker-section.show,.ezmu__preview-section.ezmu--show,.ezmu__preview-section.show,.ezmu__status-section.ezmu--show,.ezmu__status-section.show{display:block}.ez-media-uploader.highlight{border-color:#2b2b2b}.ez-media-uploader.drag-enter *,.ez-media-uploader.highlight *{pointer-events:none}.ez-media-uploader.highlight .ezmu__drop-zone-section{display:-webkit-box;display:-ms-flexbox;display:flex}.ezmu__media-picker-controls{text-align:center}.ezmu__media-picker-icon-wrap-upload{display:inline-block;margin-bottom:20px;width:60px;height:60px;vertical-align:bottom}.ezmu__media-picker-icon-wrap-avater{width:100px;height:100px;vertical-align:bottom}.ezmu__icon{background-position:center;background-size:contain;width:100%;height:100%;-webkit-filter:invert(48%) sepia(0%) saturate(2537%) hue-rotate(86deg) brightness(118%) contrast(119%);filter:invert(48%) sepia(0%) saturate(2537%) hue-rotate(86deg) brightness(118%) contrast(119%)}.ezmu-icon-upload{background-image:url('../images/cloud-upload-alt-solid.svg')}.ezmu-icon-avater{background-image:url('../images/user-alt-solid.svg')}.ezmu__media-picker-buttons{margin-top:20px;text-align:center}input[type=file].ezmu__file-input+.ezmu__input-label{cursor:pointer}.ezmu__btn{margin-bottom:.5rem;padding:8px 15px;cursor:pointer;border:none;border-radius:4px;transition:.3s ease-in-out;background-color:#fff;color:#2b2b2b;-webkit-box-shadow:0 12px 8px -10px#ccc;box-shadow:0 12px 8px -10px#ccc}.ezmu__btn:hover{color:#fff;background-color:#007bff}.ezmu__loading-section{display:none;background-color:#f2f2f2;z-index:-99}.ezmu__loading-section.ezmu--show{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;z-index:9999}.ezmu__loading-icon{font-size:4rem}.ezmu__loading-icon-img{width:64px;height:auto;-webkit-animation:2s linear infinite ezmuSpin;animation:2s linear infinite ezmuSpin}.ezmu__loading-icon-img-bg{width:64px;height:64px;display:inline-block;background-image:url('../images/spinner-solid.svg');background-position:center;background-size:contain;-webkit-animation:2s linear infinite ezmuSpin;animation:2s linear infinite ezmuSpin}@-webkit-keyframes ezmuSpin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes ezmuSpin{from{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.ezmu__thumbnail-list{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;gap:15px}.ezmu__thumbnail-list-item{position:relative;border-radius:5px;overflow:hidden;max-width:calc(50% - 7.5px);-ms-flex-preferred-size:calc(50% - 7.5px);flex-basis:calc(50% - 7.5px)}.ezmu__featured_tag{position:absolute;top:5px;left:5px;padding:5px 10px;color:#000;border-radius:3px;display:inline-block;font-size:12px;background-color:rgba(255,255,255,.8)}.ezmu__thumbnail-list-item_front{position:absolute;z-index:99;left:0;right:0;top:0;bottom:0}.ezmu__thumbnail-front-item{position:absolute}.ezmu__front-item__close{right:5px;top:5px}.ezmu__front-item__close-icon{position:relative;width:25px;height:25px;border-radius:50%;color:#222;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;-webkit-transition:background-color .2s ease-in;-o-transition:background-color .2s ease-in;transition:background-color .2s ease-in;background-color:rgba(255,255,255,.8);background-image:url('../images/times-solid-dark.svg');background-size:8px;background-position:center}.ezmu__front-item__close-icon:hover{color:#fff;background-color:rgba(255,0,0,.7);background-image:url('../images/times-solid-light.svg')}.ezmu__front-item__close-icon-img{width:12px}.ezmu__front-item__close-btn{position:absolute;top:0;bottom:0;right:0;left:0;z-index:99}.ezmu__front-item__featured{display:none;top:5px;left:5px}.ezmu__front-item__featured.ezmu--show,.ezmu__titles-area{display:block}.ezmu__front-item__featured-text,.ezmu__front-item__sort-button,.ezmu__front-item__thumbnail-size-text{display:inline-block;background-color:rgba(255,255,255,.8)}.ezmu__front-item__featured-text{position:static;padding:5px 10px;color:#000;border-radius:3px;font-size:12px}.ezmu__front-item__thumbnail-size{bottom:5px;right:5px}.ezmu__front-item__thumbnail-size-text{position:static;padding:5px;border-radius:3px;font-size:12px}.ezmu__front-item__thumbnail-size-text.has-error{color:#fff;background-color:rgba(255,32,32,.8)}.ezmu__front-item__sort-buttons{position:absolute;bottom:5px;left:5px}.ezmu__front-item__sort-button{position:relative;width:30px;height:30px;cursor:pointer;text-align:center;border:none;-webkit-transition:background-color .1s ease-in;-o-transition:background-color .1s ease-in;transition:background-color .1s ease-in;background-position:center;background-size:12px;font-size:10px}.ezmu__front-item__sort-button.ezmu--sort-up{background-image:url('../images/chevron-right-solid.svg');border-radius:0 3px 3px 0}.ezmu__front-item__sort-button.ezmu--sort-down{background-image:url('../images/chevron-left-solid.svg');border-radius:3px 0 0 3px}.ezmu__front-item__sort-button:hover{background-color:#fff}.ezmu__front-item__sort-button-skin{position:absolute;right:0;left:0;top:0;bottom:0;z-index:99}.ezmu__thumbnail-list-item_back{width:140px;height:140px;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;background-color:#d4d4d4}.ezmu__thumbnail-img{display:block;width:100%;height:100%!important;-o-object-fit:cover;object-fit:cover}.ezmu__thumbnail-img-bg{display:block;width:100%;height:100%;background-position:center;background-size:100px 100px;background-image:url('../images/file-solid.svg')}.ezmu__thumbnail-icon{display:block;margin:0 auto;width:100px;height:100px;-o-object-fit:contain;object-fit:contain}.ezmu__info-list,.ezmu_alert{width:100%;text-align:center}.ezmu__thumbnail-list-item.ezmu__thumbnail_avater{width:140px;height:140px;border-radius:50%}@media screen and (max-width:1399px) and (min-width:1199px){.ezmu__thumbnail-list-item.ezmu__thumbnail_avater,.ezmu__thumbnail-list-item_back{width:100px;height:100px}}.ezmu__thumbnail-list-item.ezmu__thumbnail_avater .ezmu__thumbnail-img{-o-object-fit:cover;object-fit:cover}.ezmu__thumbnail-list-item.ezmu__thumbnail_avater .ezmu__front-item__close{top:unset;right:unset;bottom:10px;left:50%;-webkit-transform:scale(.9) translateX(-50%);-ms-transform:scale(.9) translateX(-50%);transform:scale(.9) translateX(-50%)}.ezmu__info-list{padding:0;margin:0;max-width:800px}.ezmu__info-list-item{list-style:none;display:inline-block;margin-bottom:5px;margin-right:20px;color:#777;font-size:14px;transition:.3s ease-in-out}.ezmu__info-list-item::before{content:' ';display:inline-block;margin-right:5px;margin-top:4px;width:14px;height:14px;background-repeat:no-repeat;background-position:center;background-size:8px 8px;background-image:url('../images/info-solid.svg');background-color:#c4c4c4;vertical-align:top;border-radius:50%;-webkit-transition:.3s ease-in-out;-o-transition:.3s ease-in-out;transition:.3s ease-in-out}.ezmu__info-list-item.is-featured{color:#1aa663}.ezmu__info-list-item.is-featured::before{background-image:url('../images/info-solid-light.svg');background-color:#1aa663}.ezmu__info-list-item.has-error{color:#f25454}.ezmu__info-list-item.has-error::before{background-image:url('../images/info-solid-light.svg');background-color:#f25454}.ezmu_alert{margin:10px auto;max-width:300px;padding:5px;border-radius:3px;color:gray;background-color:#fff}.ezmu_alert_error{color:#600000;background-color:#fbb}.ezmu__title-1,.ezmu__title-2,.ezmu__title-3{display:block;margin-bottom:1rem;text-align:center}.ezmu__title-1{font-size:2rem}.ezmu__title-2{font-size:1.5rem}.ezmu__title-3{font-size:1.2rem} \ No newline at end of file diff --git a/assets/vendor-js/plasma-slider.js b/assets/vendor-js/plasma-slider.js index 98a9be53e4..1b181eb144 100644 --- a/assets/vendor-js/plasma-slider.js +++ b/assets/vendor-js/plasma-slider.js @@ -339,6 +339,7 @@ if ( 'contain' === self.options.backgroundSize && self.options.blurBackground ) { var slider_item_img_back = createElementWithClass('plasmaSlider__bgImgBlur', 'img'); slider_item_img_back.src = opt.src; + slider_item_img_back.loading = 'lazy'; slider_item_bg.appendChild(slider_item_img_back); } @@ -346,6 +347,7 @@ var slider_item_img_front = createElementWithClass('plasmaSlider__bgImg plasmaSlider__' + background_size, 'img'); slider_item_img_front.src = opt.src; slider_item_img_front.alt = opt.alt; + slider_item_img_front.loading = 'lazy'; slider_item_bg.appendChild(slider_item_img_front); slider_item.appendChild(slider_item_bg); diff --git a/assets/vendor-js/plasma-slider.min.js b/assets/vendor-js/plasma-slider.min.js index 1e72c56ede..753c51fc81 100644 --- a/assets/vendor-js/plasma-slider.min.js +++ b/assets/vendor-js/plasma-slider.min.js @@ -1,9 +1,8 @@ /** * Plasma Slider * Company: Aazz Tech - * Develoepr: Syed Galib Ahmed + * Developer: Syed Galib Ahmed * Version: 1.0 * Initial Release: 1 February, 2020 * */ - -(function(){function t(t){var a=o("plasmaSlider__contents"),n=o("plasmaSlider__contentsWrap");if(Array.isArray(t.options.images)&&t.options.images.length){var e=100*t.options.images.length,r="width: "+e+"%;",s=r;n.setAttribute("style",s);var l=t.options.images;p(l,function(a,e){var r=0===e,s=i({src:"src"in a?a.src:"",alt:"alt"in a?a.alt:"",active:r},t);n.appendChild(s)})}return a.appendChild(n),a}function i(t,i){var a={src:"",alt:"",active:!1};a=r(a,t);var n=a.active?" active":"",e=o("plasmaSlider__sliderItem"+n),s=i.options.backgroundSize,l=o("plasmaSlider__bg"),c=i.options.backgroundColor;if(l.setAttribute("style","background-color: "+c+";"),"contain"===i.options.backgroundSize&&i.options.blurBackground){var h=o("plasmaSlider__bgImgBlur","img");h.src=a.src,l.appendChild(h)}var u=o("plasmaSlider__bgImg plasmaSlider__"+s,"img");return u.src=a.src,u.alt=a.alt,l.appendChild(u),e.appendChild(l),e}function a(t){var i=o("plasmaSlider__footer");if(!Array.isArray(t.options.images))return i;var a=o("plasmaSlider__thumbnailList");if(t.options.thumbnailBackgroundColor.length){var n="background-color: "+t.options.thumbnailBackgroundColor;a.setAttribute("style",n)}return p(t.options.images,function(t,i){var n="plasmaSlider__thumbnailListItem",e=0===i?n+" active":n,r=e,s=o(r),l=o("plasmaSlider__thumbnailListItemImg","img");l.src="src"in t?t.src:"",l.alt="alt"in t?t.alt:"Thumbnail Image",s.appendChild(l),a.appendChild(s)}),i.appendChild(a),i}function n(){var t=o("plasmaSlider__controlRight"),i=o("plasmaSlider__arrowBtn arrowBtn--right","button",'');return i.setAttribute("type","button"),i.setAttribute("data-direction","right"),t.appendChild(i),t}function e(){var t=o("plasmaSlider__controlLeft"),i=o("plasmaSlider__arrowBtn arrowBtn--left","button",'');return i.setAttribute("type","button"),i.setAttribute("data-direction","left"),t.appendChild(i),t}function r(t,i){if(!i)return t;if(i&&"object"!=typeof i)return defaults;var a;for(a in i)t.hasOwnProperty(a)&&(t[a]=i[a]);return t}function s(t){var i=!1;if("string"==typeof t){var a=t.match(/[^\d]/),n=a?null:parseInt(t);i=!!(n&&n>0),t=i?n:t}return"number"==typeof t&&(t=!(t<1)&&t,i=!!t),!!i&&t}function l(t){var i=null;if(t)switch(t){case"0":case"false":i=!1;break;case"1":case"true":i=!0}return i}function o(t,i,a){t=void 0===t?"":t,i=void 0===i?"div":i,a=void 0===a?"":a;var n=document.createElement(i);return c(n,t),n.innerHTML=a,n}function c(t,i){if("object"==typeof t&&"className"in t){var a=t.className.split(" ");-1==a.indexOf(i)&&(t.className+=" "+i,t.className=t.className.trim())}}function h(t,i){if(t){var a=new RegExp(i,"g");t.className=t.className.replace(a,""),t.className=t.className.trim()}}function u(t,i){if(t){var a=new RegExp(i,"g"),n=t.className.match(a);return n}}function d(t){if(!t)return null;if(!("parentElement"in t&&t.parentElement))return null;var i=t.parentElement.children,a=[].slice.call(i).indexOf(t);return a}function p(t,i){for(var a=0;a1){var h=n();i.appendChild(h);var u=e();i.appendChild(u)}var d=t(this);if(i.appendChild(d),this.container.appendChild(i),this.options.showThumbnails&&this.options.images.length>1){var p=a(this);this.container.appendChild(p)}}},this.attachEvents=function(){if(this.container){var t=this,i=this.container.querySelectorAll(".plasmaSlider__arrowBtn");if(i&&i.length&&p(i,function(i){i.addEventListener("click",function(i){var a=i.target.className,n="plasmaSliderSkin"===a?i.target.parentElement:i.target;t.handleArrowEvent(n)})}),this.options.showThumbnails){var a=this.container.querySelectorAll(".plasmaSlider__thumbnailListItem");a&&a.length&&p(a,function(i){i.addEventListener("click",function(i){t.handleThumbnailEvent(i.target.parentElement)})})}}},this.handleArrowEvent=function(t){var i=this,a=t,n=a.getAttribute("data-direction"),e=i.container.querySelectorAll(".plasmaSlider__contentsWrap .plasmaSlider__sliderItem.active"),r=d(e[0]);if(!(null===r||r<0)){var s="right"===n?r+1:r-1;this.options.rtl&&(s="right"===n?r-1:r+1),this.changeSlideTo(s)}},this.handleThumbnailEvent=function(t){var i=d(t);this.changeSlideTo(i)},this.changeSlideTo=function(t){var i=this.options.images.length-1;t=t<0?i:t,t=t>i?0:t;var a="width: "+100*(i+1)+"%;",n=0===t?"left: ":"left: -";this.options.rtl&&(n=0===t?"right: ":"right: -");var e=a+n+100*t+"%;",r=this.container.querySelectorAll(".plasmaSlider__contentsWrap");r[0].setAttribute("style",e);var s=this.container.querySelectorAll(".plasmaSlider__contentsWrap .plasmaSlider__sliderItem.active");h(s[0],"active");var l=r[0].children.item(t);c(l,"active"),this.updateNavigation(t)},this.updateNavigation=function(t){if(this.options.showThumbnails){var i=this.container.querySelectorAll(".plasmaSlider__thumbnailList .plasmaSlider__thumbnailListItem");if(i&&i.length){p(i,function(i,a){h(i,"active"),a===t&&c(i,"active")});var a=i[0].parentElement,n=a.clientWidth,e=a.scrollLeftMax,r=i[t].offsetLeft,s=i[t].offsetWidth,l=r,o=l+s;l=l>e?e:l,l=l<0?0:l;var u=a.scrollLeft,d=u+n;(ld)&&(a.scrollLeft=l)}}}}})(); \ No newline at end of file +!function(){function t(t,i){var a;if(!i)return t;if(i&&"object"!=typeof i)return defaults;for(a in i)t.hasOwnProperty(a)&&(t[a]=i[a]);return t}function i(t){var i=!1;if("string"==typeof t){var a=t.match(/[^\d]/)?null:parseInt(t);t=(i=!!a&&a>0)?a:t}return"number"==typeof t&&(i=!!(t=!(t<1)&&t)),!!i&&t}function a(t){var i=null;if(t)switch(t){case"0":case"false":i=!1;break;case"1":case"true":i=!0}return i}function n(t,i,a){t=void 0===t?"":t,i=void 0===i?"div":i,a=void 0===a?"":a;var n=document.createElement(i);return e(n,t),n.innerHTML=a,n}function e(t,i){"object"==typeof t&&"className"in t&&-1==t.className.split(" ").indexOf(i)&&(t.className+=" "+i,t.className=t.className.trim())}function r(t,i){if(t){var a=RegExp(i,"g");t.className=t.className.replace(a,""),t.className=t.className.trim()}}function s(t){if(!t||!("parentElement"in t&&t.parentElement))return null;var i=t.parentElement.children;return[].slice.call(i).indexOf(t)}function l(t,i){for(var a=0;a1){var s,o,c,h,d=(s=n("plasmaSlider__controlRight"),o=n("plasmaSlider__arrowBtn arrowBtn--right","button",''),o.setAttribute("type","button"),o.setAttribute("data-direction","right"),s.appendChild(o),s);i.appendChild(d);var p=(c=n("plasmaSlider__controlLeft"),h=n("plasmaSlider__arrowBtn arrowBtn--left","button",''),h.setAttribute("type","button"),h.setAttribute("data-direction","left"),c.appendChild(h),c);i.appendChild(p)}var u=function i(a){var e=n("plasmaSlider__contents"),r=n("plasmaSlider__contentsWrap");if(Array.isArray(a.options.images)&&a.options.images.length){var s=100*a.options.images.length;r.setAttribute("style","width: "+s+"%;"),l(a.options.images,function(i,e){var s=function i(a,e){var r={src:"",alt:"",active:!1},s=n("plasmaSlider__sliderItem"+((r=t(r,a)).active?" active":"")),l=e.options.backgroundSize,o=n("plasmaSlider__bg"),c=e.options.backgroundColor;if(o.setAttribute("style","background-color: "+c+";"),"contain"===e.options.backgroundSize&&e.options.blurBackground){var h=n("plasmaSlider__bgImgBlur","img");h.src=r.src,h.loading="lazy",o.appendChild(h)}var d=n("plasmaSlider__bgImg plasmaSlider__"+l,"img");return d.src=r.src,d.alt=r.alt,d.loading="lazy",o.appendChild(d),s.appendChild(o),s}({src:"src"in i?i.src:"",alt:"alt"in i?i.alt:"",active:0===e},a);r.appendChild(s)})}return e.appendChild(r),e}(this);if(i.appendChild(u),this.container.appendChild(i),this.options.showThumbnails&&this.options.images.length>1){var m=function t(i){var a=n("plasmaSlider__footer");if(!Array.isArray(i.options.images))return a;var e=n("plasmaSlider__thumbnailList");if(i.options.thumbnailBackgroundColor.length){var r="background-color: "+i.options.thumbnailBackgroundColor;e.setAttribute("style",r)}return l(i.options.images,function(t,i){var a="plasmaSlider__thumbnailListItem",r=n(0===i?a+" active":a),s=n("plasmaSlider__thumbnailListItemImg","img");s.src="src"in t?t.src:"",s.alt="alt"in t?t.alt:"Thumbnail Image",r.appendChild(s),e.appendChild(r)}),a.appendChild(e),a}(this);this.container.appendChild(m)}}},this.attachEvents=function(){if(this.container){var t=this,i=this.container.querySelectorAll(".plasmaSlider__arrowBtn");if(i&&i.length&&l(i,function(i){i.addEventListener("click",function(i){var a="plasmaSliderSkin"===i.target.className?i.target.parentElement:i.target;t.handleArrowEvent(a)})}),this.options.showThumbnails){var a=this.container.querySelectorAll(".plasmaSlider__thumbnailListItem");a&&a.length&&l(a,function(i){i.addEventListener("click",function(i){t.handleThumbnailEvent(i.target.parentElement)})})}}},this.handleArrowEvent=function(t){var i=t.getAttribute("data-direction"),a=s(this.container.querySelectorAll(".plasmaSlider__contentsWrap .plasmaSlider__sliderItem.active")[0]);if(null!==a&&!(a<0)){var n="right"===i?a+1:a-1;this.options.rtl&&(n="right"===i?a-1:a+1),this.changeSlideTo(n)}},this.handleThumbnailEvent=function(t){var i=s(t);this.changeSlideTo(i)},this.changeSlideTo=function(t){var i=this.options.images.length-1,a=0===(t=(t=t<0?i:t)>i?0:t)?"left: ":"left: -";this.options.rtl&&(a=0===t?"right: ":"right: -");var n="width: "+(i+1)*100+"%;"+a+100*t+"%;",s=this.container.querySelectorAll(".plasmaSlider__contentsWrap");s[0].setAttribute("style",n),r(this.container.querySelectorAll(".plasmaSlider__contentsWrap .plasmaSlider__sliderItem.active")[0],"active"),e(s[0].children.item(t),"active"),this.updateNavigation(t)},this.updateNavigation=function(t){if(this.options.showThumbnails){var i=this.container.querySelectorAll(".plasmaSlider__thumbnailList .plasmaSlider__thumbnailListItem");if(i&&i.length){l(i,function(i,a){r(i,"active"),a===t&&e(i,"active")});var a=i[0].parentElement,n=a.clientWidth,s=a.scrollLeftMax,o=i[t].offsetLeft,c=i[t].offsetWidth,h=o,d=h+c;h=(h=h>s?s:h)<0?0:h;var p=a.scrollLeft;(hp+n)&&(a.scrollLeft=h)}}}}}(); \ No newline at end of file diff --git a/directorist-base.php b/directorist-base.php index f1249386df..6cbb70bbb2 100644 --- a/directorist-base.php +++ b/directorist-base.php @@ -162,6 +162,8 @@ final class Directorist_Base public $announcement; public $review; + public $background_image_process = null; + /** * Main Directorist_Base Instance. * @@ -226,6 +228,8 @@ public static function instance() self::$instance->tools = new ATBDP_Tools(); self::$instance->announcement = new ATBDP_Announcement(); + self::$instance->background_image_process = new \Directorist\Background_Image_Process(); + // Load widgets Directorist\Widgets\Init::instance(); diff --git a/includes/asset-loader/localized_data.php b/includes/asset-loader/localized_data.php index e8c1e6d85c..117fca5e95 100644 --- a/includes/asset-loader/localized_data.php +++ b/includes/asset-loader/localized_data.php @@ -150,6 +150,8 @@ public static function get_add_listings_data() { 'deleted' => __( 'Deleted!', 'directorist' ), 'max_location_creation' => esc_attr( $max_loc_creation ), 'max_location_msg' => sprintf( __('You can only use %s', 'directorist'), $max_loc_creation ), + 'submission_wait_msg' => esc_html__( 'Please wait, your submission is being processed.', 'directorist' ), + 'image_uploading_msg' => esc_html__( 'Please wait, your selected images being uploaded.', 'directorist' ) ); //get listing is if the screen in edit listing diff --git a/includes/classes/class-add-listing.php b/includes/classes/class-add-listing.php index e2eea6a49a..c0742a2f8a 100644 --- a/includes/classes/class-add-listing.php +++ b/includes/classes/class-add-listing.php @@ -48,6 +48,63 @@ public function __construct() { add_action( 'parse_query', array( $this, 'parse_query' ) ); // do stuff likes adding, editing, renewing, favorite etc in this hook. add_action( 'wp_ajax_add_listing_action', array( $this, 'atbdp_submit_listing' ) ); add_action( 'wp_ajax_nopriv_add_listing_action', array( $this, 'atbdp_submit_listing' ) ); + + add_action( 'wp_ajax_directorist_upload_listing_image', array( __CLASS__, 'upload_listing_image' ) ); + add_action( 'wp_ajax_nopriv_directorist_upload_listing_image', array( __CLASS__, 'upload_listing_image' ) ); + } + + public static function upload_listing_image() { + try { + if ( ! directorist_verify_nonce() ) { + throw new Exception( __( 'Invalid request.', 'directorist' ), 400 ); + } + + $image = ! empty( $_FILES['image'] ) ? directorist_clean( $_FILES['image'] ) : array(); + + if ( empty( $image ) ) { + return; + } + + // Set temporary upload directory. + add_filter( 'upload_dir', array( __CLASS__, 'set_temporary_upload_dir' ) ); + + // handle file upload + $status = wp_handle_upload( + $image, + array( + 'test_form' => true, + 'test_type' => true, + 'action' => 'directorist_upload_listing_image', + 'mimes' => directorist_get_mime_types( 'image' ), + ) + ); + + // Restore to default upload directory. + remove_filter( 'upload_dir', array( __CLASS__, 'set_temporary_upload_dir' ) ); + + if ( ! empty( $status['error'] ) ) { + throw new Exception( sprintf( '%s - (%s)', $status['error'], $image['name'] ), 500 ); + } + + if ( empty( $status['url'] ) ) { + throw new Exception( sprintf( __( 'Could not upload (%s), please try again.', 'directorist' ), $image['name'] ), 500 ); + } + + wp_send_json_success( explode( 'directorist_temp_uploads/', $status['url'] )[1] ); + + } catch ( Exception $e ) { + + wp_send_json_error( $e->getMessage(), $e->getCode() ); + + } + } + + public static function set_temporary_upload_dir( $upload ) { + $upload['subdir'] = '/directorist_temp_uploads'; + $upload['path'] = $upload['basedir'] . $upload['subdir']; + $upload['url'] = $upload['baseurl'] . $upload['subdir']; + + return $upload; } /** @@ -212,6 +269,9 @@ public function atbdp_submit_listing() { case 'map': self::process_map( $field, $posted_data, $meta_data, $error ); break; + + case 'image_upload': + break; default: $meta_data[ '_' . $field->get_key() ] = $field->sanitize( $posted_data ); @@ -395,7 +455,7 @@ public function atbdp_submit_listing() { } wp_send_json( apply_filters( 'atbdp_listing_form_submission_info', $data ) ); - } catch ( Exception $e ) { + } catch (Exception $e ) { return wp_send_json( array( 'error' => true, 'error_msg' => $e->getMessage(), @@ -449,91 +509,104 @@ public static function is_admin_only_field( $field ) { } public static function upload_images( $listing_id, $posted_data ) { - $listing_images = atbdp_get_listing_attachment_ids( $listing_id ); - $files = ! empty( $_FILES['listing_img'] ) ? directorist_clean( wp_unslash( $_FILES['listing_img'] ) ) : array(); - $files_meta = directorist_get_var( $posted_data['files_meta'], array() ); - - if ( ! empty( $listing_images ) ) { - foreach ( $listing_images as $__old_id ) { - $match_found = false; - - if ( ! empty( $files_meta ) ) { - foreach ( $files_meta as $__new_id ) { - $new_id = isset( $__new_id['attachmentID'] ) ? (int) $__new_id['attachmentID'] : ''; - if ( $new_id === (int) $__old_id ) { - $match_found = true; - break; - } - } - } + $image_upload_field = directorist_get_listing_form_field( $posted_data['directory_id'], 'image_upload' ); - if ( ! $match_found ) { - wp_delete_attachment( (int) $__old_id, true ); - } - } + if ( empty( $image_upload_field ) ) { + return; } - $attach_data = array(); + $selected_images = Fields::create( $image_upload_field )->get_value( $posted_data ); + $old_images = $selected_images['old']; + $new_images = $selected_images['new']; - if ( $files ) { - foreach ( $files['name'] as $key => $value ) { + self::clean_unselected_images( $listing_id, $old_images ); - $filetype = wp_check_filetype( $files['name'][ $key ] ); + if ( empty( $old_images ) && empty( $new_images ) ) { + return; + } - if ( empty( $filetype['ext'] ) ) { + try { + $upload_dir = wp_get_upload_dir(); + $temp_dir = $upload_dir['basedir'] . '/directorist_temp_uploads/'; + $target_dir = trailingslashit( $upload_dir['path'] ); + $uploaded_images = $old_images; + $background_processable_images = array(); + + foreach ( $new_images as $image ) { + if ( empty( $image ) ) { continue; } - if ( $files['name'][ $key ] ) { - $file = array( - 'name' => $files['name'][ $key ], - 'type' => $files['type'][ $key ], - 'tmp_name' => $files['tmp_name'][ $key ], - 'error' => $files['error'][ $key ], - 'size' => $files['size'][ $key ], - ); - - $_FILES['my_file_upload'] = $file; - $meta_data = array(); - $meta_data['name'] = $files['name'][ $key ]; - $meta_data['id'] = atbdp_handle_attachment( 'my_file_upload', $listing_id ); + $filepath = $temp_dir . $image; + + if ( is_dir( $filepath ) || ! file_exists( $filepath ) ) { + continue; + } - array_push( $attach_data, $meta_data ); + if ( file_exists( $target_dir . $image ) ) { + $image = wp_unique_filename( $target_dir, $image ); } - } - } + + rename( $filepath, $target_dir . $image ); - $new_files_meta = array(); + $mime = wp_check_filetype( $image ); + $name = wp_basename( $image, ".{$mime['ext']}" ); - foreach ( $files_meta as $key => $value ) { - if ( $key === 0 && $value['oldFile'] === 'true' ) { - update_post_meta( $listing_id, '_listing_prv_img', $value['attachmentID'] ); - set_post_thumbnail( $listing_id, $value['attachmentID'] ); - } + // Construct the attachment array. + $attachment = array( + 'post_mime_type' => $mime['type'], + 'guid' => trailingslashit( $upload_dir['url'] ) . $image, + 'post_parent' => $listing_id, + 'post_title' => sanitize_text_field( $name ), + ); - if ( $key === 0 && $value['oldFile'] !== 'true' ) { - foreach ( $attach_data as $item ) { - if ( $item['name'] === $value['name'] ) { - update_post_meta( $listing_id, '_listing_prv_img', $item['id'] ); - set_post_thumbnail( $listing_id, $item['id'] ); - } + $attachment_id = wp_insert_attachment( $attachment, $target_dir . $image, $listing_id, false ); + + if ( is_wp_error( $attachment_id ) ) { + throw new Exception( $attachment_id->get_error_message() ); + + continue; } - } - if ( $key !== 0 && $value['oldFile'] === 'true' ) { - $new_files_meta[] = $value['attachmentID']; + $background_processable_images[ $attachment_id ] = $target_dir . $image; + + $uploaded_images[] = $attachment_id; } - if ( $key !== 0 && $value['oldFile'] !== 'true' ) { - foreach ( $attach_data as $item ) { - if ( $item['name'] === $value['name'] ) { - $new_files_meta[] = $item['id']; - } + if ( ! empty( $uploaded_images ) ) { + update_post_meta( $listing_id, '_listing_prv_img', $uploaded_images[0] ); + set_post_thumbnail( $listing_id, $uploaded_images[0] ); + + unset( $uploaded_images[0] ); + + if ( count( $uploaded_images ) ) { + update_post_meta( $listing_id, '_listing_img', $uploaded_images ); } + + directorist_background_image_process( $background_processable_images ); } + + } catch ( Exception $e ) { + + error_log( $e->getMessage() ); + } + } - update_post_meta( $listing_id, '_listing_img', $new_files_meta ); + protected static function clean_unselected_images( $listing_id, $selected_images ) { + $saved_images = atbdp_get_listing_attachment_ids( $listing_id ); + if ( empty( $saved_images ) ) { + return; + } + + $unselected_images = array_diff( $saved_images, $selected_images ); + if ( empty( $unselected_images ) ) { + return; + } + + foreach ( $unselected_images as $unselected_image ) { + wp_delete_attachment( $unselected_image, true ); + } } public static function process_map( $field, $posted_data, &$data, $error ) { diff --git a/includes/classes/class-background-image-process.php b/includes/classes/class-background-image-process.php new file mode 100644 index 0000000000..68a4685bdc --- /dev/null +++ b/includes/classes/class-background-image-process.php @@ -0,0 +1,94 @@ +prefix = 'wp_' . get_current_blog_id(); + $this->action = 'directorist_background_image_process'; + + parent::__construct(); + } + + /** + * Handle cron healthcheck + * + * Restart the background process if not already running + * and data exists in the queue. + */ + public function handle_cron_healthcheck() { + if ( $this->is_process_running() ) { + // Background process already running. + return; + } + + if ( $this->is_queue_empty() ) { + // No data to process. + $this->clear_scheduled_event(); + return; + } + + $this->handle(); + } + + /** + * Schedule fallback event. + */ + protected function schedule_event() { + if ( ! wp_next_scheduled( $this->cron_hook_identifier ) ) { + wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier ); + } + } + + + /** + * Task + * + * Override this method to perform any actions required on each + * queue item. Return the modified item for further processing + * in the next pass through. Or, return false to remove the + * item from the queue. + * + * @param array $attachments { attachment_id => attachment_path } + * @return string|bool + */ + protected function task( $image ) { + $image_id = key( $image ); + + if ( ! headers_sent() ) { + header( 'X-WP-Upload-Attachment-ID: ' . $image_id ); + } + + \wp_update_attachment_metadata( $image_id, \wp_generate_attachment_metadata( $image_id, $image[ $image_id ] ) ); + } + + /** + * See if the batch limit has been exceeded. + * + * @return bool + */ + public function is_memory_exceeded() { + return $this->memory_exceeded(); + } +} diff --git a/includes/fields/class-directorist-image-upload-field.php b/includes/fields/class-directorist-image-upload-field.php index a596245cac..fb06e43bf9 100644 --- a/includes/fields/class-directorist-image-upload-field.php +++ b/includes/fields/class-directorist-image-upload-field.php @@ -13,17 +13,27 @@ class Image_Upload_Field extends Base_Field { public $type = 'image_upload'; public function get_value( $posted_data ) { - if ( empty( $_FILES[ $this->get_key() ] ) ) { - return array(); - } + $new_images = $posted_data[ $this->get_key() ]; + $old_images = (array) $posted_data[ $this->get_key() . '_old' ]; - return directorist_clean( wp_unslash( $_FILES[ $this->get_key() ] ) ); + return array( + 'new' => array_filter( explode( ',', $new_images ) ), + 'old' => array_filter( wp_parse_id_list( $old_images ) ), + ); } public function validate( $posted_data ) { - $files = $this->get_value( $posted_data ); + $files = $this->get_value( $posted_data ); + $old_images = $files['old']; + $new_images = $files['new']; + + if ( $this->is_required() && empty( $old_images ) && empty( $new_images ) ) { + $this->add_error( __( 'This field is required.', 'directorist' ) ); + + return false; + } - if ( count( $files['name'] ) > $this->get_total_upload_limit() ) { + if ( ( count( $old_images ) + count( $new_images ) ) > $this->get_total_upload_limit() ) { $this->add_error( sprintf( _n( '%s image allowed only.', '%s images allowed only.', $this->get_total_upload_limit(), 'directorist' ), $this->get_total_upload_limit() @@ -32,27 +42,41 @@ public function validate( $posted_data ) { return false; } + // TODO: use get_attached_file to calculate the old images file size. + + $upload_dir = wp_get_upload_dir(); + $temp_dir = $upload_dir['basedir'] . '/directorist_temp_uploads/'; $total_size = 0; - foreach ( $files['name'] as $key => $value ) { - if ( strpos( $files['type'][ $key ], 'image' ) === false ) { + foreach ( $new_images as $file ) { + $filepath = realpath( $temp_dir . $file ); + + if ( empty( $file ) || ! $filepath ) { + continue; + } + + $filesize = filesize( $filepath ); + $real_mime = wp_get_image_mime( $filepath ); + + if ( ! $real_mime || strpos( $real_mime, 'image' ) === false ) { + $this->add_error( sprintf( - __( '[%1$s] Only image allowed.', 'directorist' ), - $files['name'][ $key ] + __( '[%1$s] invalid file type, only image allowed.', 'directorist' ), + $file ) ); continue; } - if ( $files['size'][ $key ] > $this->get_per_image_upload_size() ) { + if ( $filesize > $this->get_per_image_upload_size() ) { $this->add_error( sprintf( - __( '[%1$s] Size exceeded, %2$s is allowed only.', 'directorist' ), - $files['name'][ $key ], + __( '[%1$s] size exceeded, %2$s is allowed only.', 'directorist' ), + $file, size_format( $this->get_per_image_upload_size() ) ) ); } - $total_size += $files['size'][ $key ]; + $total_size += $filesize; if ( $total_size > $this->get_total_upload_size() ) { $this->add_error( sprintf( diff --git a/includes/helper-functions.php b/includes/helper-functions.php index c236130e36..2a5eb9a5b0 100644 --- a/includes/helper-functions.php +++ b/includes/helper-functions.php @@ -2447,13 +2447,30 @@ function atbdp_guest_submission($guest_email) } } -function atbdp_get_listing_attachment_ids($post_id){ +function atbdp_get_listing_attachment_ids( $listing_id ) { + $featured_image = (int) get_post_meta( $listing_id, '_listing_prv_img', true ); + $attachment_ids = array(); - $listing_img = get_post_meta($post_id, '_listing_img', true); - $listing_img = !empty($listing_img) ? $listing_img : array(); - $listing_prv_img = get_post_meta($post_id, '_listing_prv_img', true); - array_unshift($listing_img, $listing_prv_img); - return $listing_img; + if ( $featured_image ) { + $attachment_ids[] = $featured_image; + } + + $gallery_images = (array) get_post_meta( $listing_id, '_listing_img', true ); + + if ( empty( $gallery_images ) ) { + return $attachment_ids; + } + + $gallery_images = wp_parse_id_list( $gallery_images ); + $gallery_images = array_filter( $gallery_images ); + + if ( empty( $gallery_images ) ) { + return $attachment_ids; + } + + $attachment_ids = array_merge( $attachment_ids, $gallery_images ); + + return $attachment_ids; } @@ -4028,44 +4045,36 @@ function directorist_password_reset_url( $user, $password_reset = true, $confirm return apply_filters( 'directorist_password_reset_url', $reset_password_url ); } -function directorist_get_mime_types( $filter_type = '', $return_type = '' ) { - $supported_mime_types = wp_get_mime_types(); - - // Filter - if ( ! empty( $filter_type ) ) { - $filtered_supported_mime_types = []; - - foreach ($supported_mime_types as $key => $value) { - $_type = preg_replace( "/\/\w+$/", '', $value ); - - if ( $_type !== $filter_type ) { - continue; - } - - $filtered_supported_mime_types[ $key ] = $value; - } +/** + * Get allowed mime types. + * + * @param string $filterby Filter allowed mime types by group. eg. image, audio, video, document etc. + * @param string $return_type Get the full mime types map or only extensions. Valid args are extension and .extension. + * + * @return array + */ +function directorist_get_mime_types( $filterby = '', $return_type = '' ) { + $allowed_mime_types = get_allowed_mime_types(); - $supported_mime_types = $filtered_supported_mime_types; + if ( ! empty( $filterby ) ) { + $allowed_mime_types = array_filter( $allowed_mime_types, static function( $mime_type, $extensions ) use ( $filterby ) { + return stripos( $mime_type, $filterby ) !== false; + }, ARRAY_FILTER_USE_BOTH ); } - // Convert to extension if ( $return_type === 'extension' || $return_type === '.extension' ) { - $extensions = array_keys( $supported_mime_types ); - - $extended_extensions = []; - - foreach ( $extensions as $extension ) { - $_sub_extensions = explode( '|', $extension ); - - foreach ( $_sub_extensions as $sub_extension ) { - $extended_extensions[] = ( $return_type === '.extension' ) ? '.' . $sub_extension : $sub_extension; - } + $allowed_mime_types = array_reduce( array_keys( $allowed_mime_types ), static function( $carry, $extension ) { + return array_merge( $carry, explode( '|', $extension ) ); + }, array() ); + + if ( $return_type === '.extension' ) { + $allowed_mime_types = array_map( static function( $extension ) { + return '.' . $extension; + }, $allowed_mime_types ); } - - $supported_mime_types = array_values( $extended_extensions ); } - return $supported_mime_types; + return $allowed_mime_types; } /** @@ -4198,3 +4207,25 @@ function directorist_validate_youtube_vimeo_url( $url ) { function directorist_is_listing_post_type( $listing_id ) { return ( get_post_type( absint( $listing_id ) ) === ATBDP_POST_TYPE ); } + +function directorist_background_image_process( $images ) { + if ( empty( $images ) || ! is_array( $images ) ) { + return; + } + + $should_dispatch = false; + + foreach ( $images as $image_id => $image_path ) { + if ( empty( $image_id ) || empty( $image_path ) ) { + continue; + } + + $should_dispatch = true; + + ATBDP()->background_image_process->push_to_queue( array( $image_id => $image_path ) ); + } + + if ( $should_dispatch ) { + ATBDP()->background_image_process->save()->dispatch(); + } +} diff --git a/includes/model/SingleListing.php b/includes/model/SingleListing.php index 5a311a9b31..e44f3c8eaa 100644 --- a/includes/model/SingleListing.php +++ b/includes/model/SingleListing.php @@ -493,7 +493,7 @@ public function get_slider_data() { // Get the preview images $preview_img_id = get_post_meta( $listing_id, '_listing_prv_img', true); - $preview_img_link = ! empty($preview_img_id) ? atbdp_get_image_source($preview_img_id, 'large') : ''; + $preview_img_link = ! empty($preview_img_id) ? atbdp_get_image_source( $preview_img_id, 'large' ) : ''; $preview_img_alt = get_post_meta($preview_img_id, '_wp_attachment_image_alt', true); $preview_img_alt = ( ! empty( $preview_img_alt ) ) ? $preview_img_alt : get_the_title( $preview_img_id ); diff --git a/languages/directorist.pot b/languages/directorist.pot index b5f2feea3a..b3b6fbc42b 100644 --- a/languages/directorist.pot +++ b/languages/directorist.pot @@ -6,7 +6,11 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +<<<<<<< HEAD +"POT-Creation-Date: 2022-11-03 08:18+0000\n" +======= "POT-Creation-Date: 2023-11-16 11:06+0000\n" +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 "X-Poedit-Basepath: ..\n" "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" "X-Poedit-SearchPath-0: .\n" @@ -158,6 +162,273 @@ msgstr "" msgid "You need to be logged in to view the content of this page" msgstr "" +<<<<<<< HEAD +#: ../includes/helper-functions.php:972 +msgid "You need to be logged in to view the content of this page. You can login %s. Don't have an account? %s" +msgstr "" + +#: ../includes/helper-functions.php:972, ../includes/classes/class-helper.php:538, ../includes/classes/class-settings-panel.php:4003, ../templates/account/registration.php:33, ../templates/account/registration.php:25 +msgid "Here" +msgstr "" + +#: ../includes/helper-functions.php:972 +msgid "Sign up" +msgstr "" + +#: ../includes/helper-functions.php:1001 +msgid "Jan" +msgstr "" + +#: ../includes/helper-functions.php:1002 +msgid "Feb" +msgstr "" + +#: ../includes/helper-functions.php:1003 +msgid "Mar" +msgstr "" + +#: ../includes/helper-functions.php:1004 +msgid "Apr" +msgstr "" + +#: ../includes/helper-functions.php:1005 +msgid "May" +msgstr "" + +#: ../includes/helper-functions.php:1006 +msgid "Jun" +msgstr "" + +#: ../includes/helper-functions.php:1007 +msgid "Jul" +msgstr "" + +#: ../includes/helper-functions.php:1008 +msgid "Aug" +msgstr "" + +#: ../includes/helper-functions.php:1009 +msgid "Sep" +msgstr "" + +#: ../includes/helper-functions.php:1010 +msgid "Oct" +msgstr "" + +#: ../includes/helper-functions.php:1011 +msgid "Nov" +msgstr "" + +#: ../includes/helper-functions.php:1012 +msgid "Dec" +msgstr "" + +#: ../includes/helper-functions.php:1567, ../includes/classes/class-settings-panel.php:1690, ../includes/classes/class-settings-panel.php:3132 +msgid "A to Z (title)" +msgstr "" + +#: ../includes/helper-functions.php:1568, ../includes/classes/class-settings-panel.php:1694, ../includes/classes/class-settings-panel.php:3136 +msgid "Z to A (title)" +msgstr "" + +#: ../includes/helper-functions.php:1569, ../includes/classes/class-settings-panel.php:1698, ../includes/classes/class-settings-panel.php:3140 +msgid "Latest listings" +msgstr "" + +#: ../includes/helper-functions.php:1570, ../includes/classes/class-settings-panel.php:1702, ../includes/classes/class-settings-panel.php:3144 +msgid "Oldest listings" +msgstr "" + +#: ../includes/helper-functions.php:1571, ../includes/classes/class-settings-panel.php:1706, ../includes/classes/class-settings-panel.php:3148 +msgid "Popular listings" +msgstr "" + +#: ../includes/helper-functions.php:1572, ../includes/classes/class-settings-panel.php:1710, ../includes/classes/class-settings-panel.php:3152 +msgid "Price (low to high)" +msgstr "" + +#: ../includes/helper-functions.php:1573, ../includes/classes/class-settings-panel.php:1714, ../includes/classes/class-settings-panel.php:3156 +msgid "Price (high to low)" +msgstr "" + +#: ../includes/helper-functions.php:1574, ../includes/classes/class-settings-panel.php:1718, ../includes/classes/class-settings-panel.php:3160 +msgid "Random listings" +msgstr "" + +#: ../includes/helper-functions.php:1719, ../includes/classes/class-settings-panel.php:1759, ../includes/classes/class-settings-panel.php:1778, ../includes/classes/class-settings-panel.php:3079, ../includes/classes/class-settings-panel.php:3605, ../includes/classes/class-settings-panel.php:3693, ../includes/widgets/all-categories.php:49, ../includes/widgets/all-locations.php:49, ../includes/widgets/all-tags.php:48 +msgid "List" +msgstr "" + +#: ../includes/helper-functions.php:1722, ../includes/classes/class-settings-panel.php:1755, ../includes/classes/class-settings-panel.php:1774, ../includes/classes/class-settings-panel.php:3075, ../includes/classes/class-settings-panel.php:3601, ../includes/classes/class-settings-panel.php:3689 +msgid "Grid" +msgstr "" + +#: ../includes/helper-functions.php:1725, ../includes/classes/class-settings-panel.php:1763, ../includes/classes/class-settings-panel.php:1782, ../includes/classes/class-settings-panel.php:3083, ../includes/classes/class-settings-panel.php:4651, ../includes/classes/class-settings-panel.php:4655, ../includes/widgets/single-map.php:27 +msgid "Map" +msgstr "" + +#: ../includes/helper-functions.php:2500 +msgid "Email already registered. Please login first" +msgstr "" + +#: ../includes/helper-functions.php:2539, ../includes/classes/class-settings-panel.php:4559 +msgid "Remove Data on Uninstall?" +msgstr "" + +#: ../includes/helper-functions.php:2540, ../includes/classes/class-settings-panel.php:4560 +msgid "Checked it if you would like Directorist to completely remove all of its data when the plugin is deleted." +msgstr "" + +#: ../includes/helper-functions.php:2551 +msgid "CSV" +msgstr "" + +#: ../includes/helper-functions.php:2652 +msgid "Search Home" +msgstr "" + +#: ../includes/helper-functions.php:2656, ../includes/classes/class-settings-panel.php:4712, ../includes/classes/class-setup-wizard.php:425, ../includes/elementor/search-result.php:15 +msgid "Search Result" +msgstr "" + +#: ../includes/helper-functions.php:2660, ../includes/classes/class-setup-wizard.php:345 +msgid "Add Listing" +msgstr "" + +#: ../includes/helper-functions.php:2664, ../includes/classes/class-settings-panel.php:4584, ../includes/classes/class-setup-wizard.php:353, ../includes/elementor/all-listing.php:16, ../templates/dashboard/tab-my-listings.php:28 +msgid "All Listings" +msgstr "" + +#: ../includes/helper-functions.php:2672, ../includes/classes/class-setup-wizard.php:361, ../includes/elementor/category.php:15 +msgid "Single Category" +msgstr "" + +#: ../includes/helper-functions.php:2680, ../includes/classes/class-setup-wizard.php:369, ../includes/elementor/location.php:15 +msgid "Single Location" +msgstr "" + +#: ../includes/helper-functions.php:2684, ../includes/classes/class-setup-wizard.php:377, ../includes/elementor/tag.php:15 +msgid "Single Tag" +msgstr "" + +#: ../includes/helper-functions.php:2688, ../includes/classes/class-setup-wizard.php:385 +msgid "Author Profile" +msgstr "" + +#: ../includes/helper-functions.php:2692, ../includes/classes/class-settings-panel.php:4892, ../includes/classes/class-setup-wizard.php:393, ../includes/elementor/user-dashboard.php:15 +msgid "Dashboard" +msgstr "" + +#: ../includes/helper-functions.php:2696, ../includes/classes/class-setup-wizard.php:409, ../includes/elementor/custom-registration.php:15 +msgid "Registration" +msgstr "" + +#: ../includes/helper-functions.php:2700, ../includes/classes/class-setup-wizard.php:401, ../includes/elementor/user-login.php:15, ../includes/model/SingleListing.php:1169, ../templates/listing-form/quick-login.php:41 +msgid "Login" +msgstr "" + +#: ../includes/helper-functions.php:3152 +msgid "Add listing page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3153, ../includes/helper-functions.php:3161, ../includes/helper-functions.php:3169, ../includes/helper-functions.php:3177, ../includes/helper-functions.php:3185, ../includes/helper-functions.php:3193, ../includes/helper-functions.php:3201, ../includes/helper-functions.php:3209, ../includes/helper-functions.php:3217, ../includes/helper-functions.php:3225, ../includes/helper-functions.php:3233, ../includes/helper-functions.php:3241, ../includes/helper-functions.php:3249 +msgid "Contains a collection of relevant data that will help you debug your website accurately and more efficiently." +msgstr "" + +#: ../includes/helper-functions.php:3155, ../includes/helper-functions.php:3163, ../includes/helper-functions.php:3171, ../includes/helper-functions.php:3179, ../includes/helper-functions.php:3187, ../includes/helper-functions.php:3195, ../includes/helper-functions.php:3203, ../includes/helper-functions.php:3211, ../includes/helper-functions.php:3219, ../includes/helper-functions.php:3227, ../includes/helper-functions.php:3235, ../includes/helper-functions.php:3243 +msgid "Select Page" +msgstr "" + +#: ../includes/helper-functions.php:3160 +msgid "Dashboard page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3168 +msgid "User Profile page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3176 +msgid "Single Category page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3184, ../includes/helper-functions.php:3192 +msgid "Single Location page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3200 +msgid "Registration page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3208 +msgid "Login page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3216 +msgid "Search Result page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3224 +msgid "Checkout page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3232 +msgid "Payment Receipt page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3240 +msgid "Transaction Failure page not selected" +msgstr "" + +#: ../includes/helper-functions.php:3248 +msgid "Map Api Key is missing" +msgstr "" + +#: ../includes/helper-functions.php:3251 +msgid "Give the Api" +msgstr "" + +#: ../includes/helper-functions.php:3256 +msgid "SMTP not configured" +msgstr "" + +#: ../includes/helper-functions.php:3257 +msgid "SMTP is a TCP/IP protocol responsible for email deliveries. You must configure SMTP to send or receive emails." +msgstr "" + +#: ../includes/helper-functions.php:3344 +msgid "Something went wrong!" +msgstr "" + +#: ../includes/helper-functions.php:3345 +msgid "Registration failed. Please make sure you filed up all the necessary fields marked with *" +msgstr "" + +#: ../includes/helper-functions.php:3346 +msgid "Sorry, that email already exists!" +msgstr "" + +#: ../includes/helper-functions.php:3347, ../includes/classes/class-user.php:227 +msgid "Username too short. At least 4 characters is required" +msgstr "" + +#: ../includes/helper-functions.php:3348, ../includes/classes/class-user.php:231 +msgid "Sorry, that username already exists!" +msgstr "" + +#: ../includes/helper-functions.php:3349, ../includes/classes/class-user.php:241 +msgid "Password length must be greater than 5" +msgstr "" + +#: ../includes/helper-functions.php:3350, ../includes/classes/class-user.php:256 +msgid "Email is not valid" +msgstr "" + +#: ../includes/helper-functions.php:3351 +msgid "Space is not allowed in username" +msgstr "" + +#: ../includes/helper-functions.php:3352 +======= #: ../includes/helper-functions.php:939 msgid "You need to be logged in to view the content of this page. You can login %s. Don't have an account? %s" msgstr "" @@ -427,6 +698,7 @@ msgid "Space is not allowed in username" msgstr "" #: ../includes/helper-functions.php:3276 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgid "Please make sure you filed up the user type" msgstr "" @@ -666,7 +938,11 @@ msgstr "" msgid "Sorry, Something went wrong. Listing ID is missing. Please try again." msgstr "" +<<<<<<< HEAD +#: ../includes/checkout/class-checkout.php:86, ../includes/checkout/class-checkout.php:182, ../includes/classes/class-custom-post.php:259, ../includes/classes/class-custom-post.php:267, ../includes/classes/class-settings-panel.php:511, ../includes/classes/class-settings-panel.php:2246, ../includes/model/Listings.php:183, ../includes/model/Listings.php:2037, ../includes/modules/multi-directory-setup/class-multi-directory-manager.php:3317, ../views/admin-templates/listing-form/expiration-featured-fields.php:57 +======= #: ../includes/checkout/class-checkout.php:86, ../includes/checkout/class-checkout.php:182, ../includes/classes/class-custom-post.php:314, ../includes/classes/class-custom-post.php:322, ../includes/classes/class-settings-panel.php:519, ../includes/classes/class-settings-panel.php:2238, ../includes/model/Listings.php:211, ../includes/model/Listings.php:2042, ../includes/modules/multi-directory-setup/class-builder-data.php:1173, ../views/admin-templates/listing-form/expiration-featured-fields.php:57 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgid "Featured" msgstr "" @@ -687,6 +963,31 @@ msgstr "" msgid "Every %d minutes" msgstr "" +<<<<<<< HEAD +#: ../includes/classes/class-add-listing.php:55, ../includes/classes/class-add-listing.php:115, ../includes/classes/class-ajax-handler.php:222, ../includes/classes/class-ajax-handler.php:1153, ../includes/classes/class-ajax-handler.php:1366, ../includes/classes/class-settings-panel.php:373, ../includes/modules/multi-directory-setup/class-multi-directory-manager.php:235, ../includes/modules/multi-directory-setup/class-multi-directory-manager.php:315, ../includes/modules/multi-directory-setup/class-multi-directory-manager.php:437 +msgid "Something is wrong! Please refresh and retry." +msgstr "" + +#: ../includes/classes/class-add-listing.php:178, ../includes/classes/class-add-listing.php:183, ../includes/classes/class-add-listing.php:188, ../includes/classes/class-add-listing.php:193, ../includes/classes/class-add-listing.php:198, ../includes/classes/class-add-listing.php:204 +msgid " field is required!" +msgstr "" + +#: ../includes/classes/class-add-listing.php:479, ../includes/classes/class-add-listing.php:326 +msgctxt "tag delimiter" +msgid "," +msgstr "" + +#: ../includes/classes/class-add-listing.php:742 +msgid "Your Submission is Completed! redirecting.." +msgstr "" + +#: ../includes/classes/class-add-listing.php:746 +msgid "Sorry! Something Wrong with Your Submission" +msgstr "" + +#: ../includes/classes/class-add-listing.php:752 +msgid "Payment Required! redirecting to checkout.." +======= #: ../includes/classes/class-add-listing.php:82, ../includes/classes/class-setup-wizard.php:115, ../includes/classes/class-tools.php:70 msgid "Invalid request!" msgstr "" @@ -709,6 +1010,7 @@ msgstr "" #: ../includes/classes/class-add-listing.php:121 msgid "Invalid guest email." +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgstr "" #: ../includes/classes/class-add-listing.php:218 @@ -2664,7 +2966,11 @@ msgstr "" msgid "Popular Badge Text" msgstr "" +<<<<<<< HEAD +#: ../includes/classes/class-settings-panel.php:2251, ../includes/model/Listings.php:182, ../includes/model/Listings.php:2049, ../includes/modules/multi-directory-setup/class-multi-directory-manager.php:3331, ../includes/modules/multi-directory-setup/class-multi-directory-migration.php:1604 +======= #: ../includes/classes/class-settings-panel.php:2243, ../includes/model/Listings.php:210, ../includes/model/Listings.php:2054, ../includes/modules/multi-directory-setup/class-builder-data.php:1187, ../includes/modules/multi-directory-setup/class-multi-directory-migration.php:1605 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgid "Popular" msgstr "" @@ -5086,6 +5392,17 @@ msgid_plural "Reviews" msgstr[0] "" msgstr[1] "" +<<<<<<< HEAD +#: ../includes/model/Listings.php:1119 +msgid "No listing found." +msgstr "" + +#: ../includes/model/Listings.php:1537 +msgid "Posted %s ago" +msgstr "" + +#: ../includes/model/Listings.php:1603 +======= #: ../includes/model/Listings.php:1142 msgid "No listing found." msgstr "" @@ -5095,27 +5412,40 @@ msgid "Posted %s ago" msgstr "" #: ../includes/model/Listings.php:1630 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgctxt "search result header" msgid "%s result" msgid_plural "%s results" msgstr[0] "" msgstr[1] "" +<<<<<<< HEAD +#: ../includes/model/Listings.php:1600 +======= #: ../includes/model/Listings.php:1627 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgctxt "search result header" msgid "%s result in %s" msgid_plural "%s results in %s" msgstr[0] "" msgstr[1] "" +<<<<<<< HEAD +#: ../includes/model/Listings.php:1597 +======= #: ../includes/model/Listings.php:1624 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgctxt "search result header" msgid "%s result for %s" msgid_plural "%s results for %s" msgstr[0] "" msgstr[1] "" +<<<<<<< HEAD +#: ../includes/model/Listings.php:1594 +======= #: ../includes/model/Listings.php:1621 +>>>>>>> 21829f182e5820dd7e33a3b8c362611f0b3a9517 msgctxt "search result header" msgid "%s result for %s in %s" msgid_plural "%s results for %s in %s" diff --git a/templates/listing-form/fields/image_upload.php b/templates/listing-form/fields/image_upload.php index 6565eab961..9f0b0c4753 100644 --- a/templates/listing-form/fields/image_upload.php +++ b/templates/listing-form/fields/image_upload.php @@ -7,19 +7,18 @@ if ( ! defined( 'ABSPATH' ) ) exit; -$p_id = $listing_form->get_add_listing_id(); -$listing_img = atbdp_get_listing_attachment_ids( $p_id ); -$maximum = !empty( $data['max'] ) ? $data['max'] : $data['max_image_limit']; -$unlimited = !empty( $data['unlimited'] ) ? $data['unlimited'] : ''; +$listing_img = atbdp_get_listing_attachment_ids( $listing_form->get_add_listing_id() ); +$maximum = ! empty( $data['max'] ) ? $data['max'] : $data['max_image_limit']; +$unlimited = ! empty( $data['unlimited'] ) ? $data['unlimited'] : ''; $limit = $unlimited ? '0' : $maximum; -$max_file_size = $data['max_per_image_limit']; -$max_total_file_size = $data['max_total_image_limit']; -$max_file_size_kb = (float) $max_file_size * 1024;// -$max_total_file_size_kb = (float) $max_total_file_size * 1024;// -$required = $data['required'] ? '1' : 0; +$max_file_size = (float) $data['max_per_image_limit']; +$max_total_file_size = (float) $data['max_total_image_limit']; +$max_file_size_kb = $max_file_size * 1024; +$max_total_file_size_kb = $max_total_file_size * 1024; +$required = (bool) $data['required']; $accepted_mime_types = directorist_get_mime_types( 'image', 'extension' ); -$accepted_mime_types_upper = array_map( function( $ext ) { return strtoupper( $ext ); }, $accepted_mime_types ) ; +$accepted_mime_types_upper = array_map( 'strtoupper', $accepted_mime_types ) ; $accepted_mime_types = array_merge( $accepted_mime_types, $accepted_mime_types_upper ); $img_upload_data = [ @@ -29,33 +28,28 @@ 'is_required' => $required, 'max_size_per_img' => $max_file_size_kb, ]; + $img_upload_data = json_encode( $img_upload_data ); ?>
-
-
-
- -
-
@@ -75,7 +69,5 @@ 1 ) ? esc_html__('Maximum __DT__ files are allowed', 'directorist') : esc_html__( 'Maximum __DT__ file is allowed', 'directorist' ) ); ?>
-
- -
\ No newline at end of file + diff --git a/templates/single/slider.php b/templates/single/slider.php index 56fb90d0a6..61728ab150 100644 --- a/templates/single/slider.php +++ b/templates/single/slider.php @@ -27,27 +27,19 @@ if ( ! empty( $data['images'] ) ) : $img_src = $data['images'][0]['src']; $img_alt = $data['images'][0]['alt']; - if ( 'contain' === $data['background-size'] && $data['blur-background'] ) { - $output = "{$img_alt}"; - echo wp_kses_post( $output ); - } + if ( 'contain' === $data['background-size'] && $data['blur-background'] ) : ?> + <?php echo esc_attr( $img_alt ); ?> + - $output = "{$img_alt}"; - echo wp_kses_post( $output ); - endif; ?> + <?php echo esc_attr( $img_alt ); ?> +
- " . "\n"; - echo wp_kses_post( $output ); - } - endif; - ?> + + +
- - \ No newline at end of file +