Skip to content

Commit e4acb10

Browse files
fix: redundant code
1 parent e65158e commit e4acb10

File tree

2 files changed

+14
-43
lines changed

2 files changed

+14
-43
lines changed

includes/admin/feedzy-rss-feeds-admin.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,20 @@ public function enqueue_styles_admin() {
206206
),
207207
)
208208
);
209+
210+
wp_enqueue_script( $this->plugin_name . '_license', FEEDZY_ABSURL . 'js/feedzy-license.js', array( 'jquery' ), $this->version, true );
211+
212+
wp_localize_script(
213+
$this->plugin_name . '_license',
214+
'feedzyLicense',
215+
array(
216+
'l10n' => array(
217+
'licenseKey' => __( 'License Key', 'feedzy-rss-feeds' ),
218+
'checkBtn' => __( 'Check License', 'feedzy-rss-feeds' ),
219+
'errorMsg' => __( 'An error occurred while checking the license. Please try again.', 'feedzy-rss-feeds' ),
220+
),
221+
)
222+
);
209223
}
210224

211225
$upsell_screens = array( 'feedzy-rss_page_feedzy-settings', 'feedzy-rss_page_feedzy-admin-menu-pro-upsell' );

js/feedzy-setting.js

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -98,49 +98,6 @@ jQuery(function ($) {
9898
}
9999
});
100100

101-
// License key.
102-
jQuery('.fz-license-section #license_key').on('input', function () {
103-
const licenseKey = jQuery(this).val();
104-
if (licenseKey !== '') {
105-
jQuery('#check_ti_license').removeAttr('disabled');
106-
} else {
107-
jQuery('#check_ti_license').attr('disabled', true);
108-
}
109-
jQuery('.fz-license-section input[name="license_key"]').val(licenseKey);
110-
});
111-
112-
jQuery('.fz-license-section #check_ti_license').on('click', function (e) {
113-
e.preventDefault();
114-
const _this = jQuery(this);
115-
_this.attr('disabled', true).addClass('fz-checking');
116-
117-
_this.parents('.fz-license-section').find('.feedzy-api-error').remove();
118-
119-
const LicenseData = _this
120-
.parent('.fz-input-group-btn')
121-
.find('input')
122-
.serialize();
123-
124-
jQuery.post(
125-
ajaxurl,
126-
LicenseData,
127-
function (response) {
128-
if (!response.success) {
129-
jQuery(
130-
'<p class="feedzy-api-error">' +
131-
response.message +
132-
'</p>'
133-
).insertAfter(
134-
jQuery('.fz-license-section').find('.help-text')
135-
);
136-
_this.removeAttr('disabled').removeClass('fz-checking');
137-
} else {
138-
window.location.reload();
139-
}
140-
},
141-
'json'
142-
);
143-
});
144101
snackbarNotice();
145102

146103
const initializeAutoCatActions = () => {

0 commit comments

Comments
 (0)