diff --git a/css/settings.css b/css/settings.css index 736d27c0..eccb9ae5 100644 --- a/css/settings.css +++ b/css/settings.css @@ -560,11 +560,40 @@ fieldset[disabled] .form-control { } .fz-form-wrap .chosen-container .chosen-results li{ padding: 8px; - font-weight: 500; + font-weight: 600; font-size: 16px; line-height: 19px; color: #050505; } +.fz-form-wrap .chosen-container .chosen-results li.group-result{ + font-weight: normal; + text-transform: uppercase; + color: #000000bd; + pointer-events: none; +} +.fz-form-wrap .chosen-container .chosen-results li.feedzy-pro-terms{ + pointer-events: none; + font-weight: 500; +} +.fz-form-wrap .chosen-container .chosen-results li.feedzy-separator{ + font-size: 0; + padding: 0; + border-bottom: 1px solid #757575; + height: 0; +} +.fz-form-wrap .chosen-container .chosen-results li.feedzy-pro-term{ + display: flex; + align-items: center; + gap: 10px; + color: #757575; + pointer-events: none; +} +.fz-form-wrap .chosen-container .chosen-results li.feedzy-pro-term .pro-label{ + background: #80a2ff; + padding-left: 7px; + padding-right: 7px; + border-radius: 5px; +} .fz-form-wrap .chosen-container .chosen-results li:hover, .fz-form-wrap .chosen-container .chosen-results li.result-selected{ background: #F2F2F2; diff --git a/includes/admin/feedzy-rss-feeds-import.php b/includes/admin/feedzy-rss-feeds-import.php index fe350f9b..902415a1 100644 --- a/includes/admin/feedzy-rss-feeds-import.php +++ b/includes/admin/feedzy-rss-feeds-import.php @@ -188,6 +188,7 @@ public function enqueue_styles() { feedzy_is_pro() ? 'dashicons-upload' : 'dashicons-lock', esc_html__( 'Upload Import', 'feedzy-rss-feeds' ) ), + 'is_pro' => feedzy_is_pro(), ), ) ); @@ -502,6 +503,19 @@ public function feedzy_import_feed_options() { $import_post_term = '[#auto_categories]'; } + if ( feedzy_is_pro() ) { + $custom_terms = array( + '[#item_categories]' => __( 'Item Categories', 'feedzy-rss-feeds' ), + '[#auto_categories]' => __( 'Auto Categories by keyword', 'feedzy-rss-feeds' ), + ); + } elseif ( ! feedzy_is_pro() ) { + $custom_terms = array( + '[#item_categories]' => __( 'Item Categories', 'feedzy-rss-feeds' ) . sprintf( '%s', __( 'PRO', 'feedzy-rss-feeds' ) ), + '[#auto_categories]' => __( 'Auto Categories by keyword', 'feedzy-rss-feeds' ) . sprintf( '%s', __( 'PRO', 'feedzy-rss-feeds' ) ), + ); + } + $custom_post_term = wp_json_encode( $custom_terms ); + $import_link_author_admin = get_post_meta( $post->ID, 'import_link_author_admin', true ); $import_link_author_public = get_post_meta( $post->ID, 'import_link_author_public', true ); @@ -661,6 +675,7 @@ public function save_feedzy_import_feed_meta( $post_id, $post ) { $data_meta['import_use_external_image'] = isset( $data_meta['import_use_external_image'] ) ? $data_meta['import_use_external_image'] : 'no'; // Check feeds remove html checkbox checked OR not. $data_meta['import_remove_html'] = isset( $data_meta['import_remove_html'] ) ? $data_meta['import_remove_html'] : 'no'; + $data_meta['import_post_term'] = isset( $data_meta['import_post_term'] ) ? $data_meta['import_post_term'] : ''; // If it is filter_conditions we want to escape it. if ( isset( $data_meta['filter_conditions'] ) ) { diff --git a/includes/views/import-metabox-edit.php b/includes/views/import-metabox-edit.php index bfa440db..312a556d 100644 --- a/includes/views/import-metabox-edit.php +++ b/includes/views/import-metabox-edit.php @@ -160,7 +160,7 @@ class="dashicons dashicons-arrow-down-alt2">
- +
- -
+ +
', + // translators: %1$s: magic tag, %2$s: opening anchor tag, %3$s: closing anchor tag. + __( 'Auto-create categories from source: %1$s %2$s Learn More %3$s', 'feedzy-rss-feeds' ), + '[#item_categories]', + '', '' ) ); ?>
- -
- [#item_categories]', - '', - '' - ) - ); - ?> -
-
- [#auto_categories]', - '', - '' - ) - ); +
+ [#auto_categories]', + '', + '' + ) + ); ?> -
+
+
diff --git a/includes/views/js/import-metabox-edit.js b/includes/views/js/import-metabox-edit.js index b465bce6..d49dbce4 100644 --- a/includes/views/js/import-metabox-edit.js +++ b/includes/views/js/import-metabox-edit.js @@ -170,6 +170,7 @@ function update_taxonomy() { const selected = $(this).val(); let tax_selected = $(this).data('tax'); + const custom_tag = $(this).data('custom-tag'); if (typeof tax_selected !== 'undefined') { tax_selected = tax_selected.split(','); } else { @@ -239,8 +240,37 @@ tax_selected = tax_selected.filter(function (item) { return '' !== item; }); + const selected_tax_length = tax_selected.length; + if (!feedzy.i10n.is_pro) { + options += + ''; + } + options += + ''; + $.each(custom_tag, function (key, customTag) { + let is_selected = ''; + if (in_array(key, tax_selected)) { + is_selected = 'selected'; + const index = tax_selected.indexOf(key); + + if (-1 !== index) { + tax_selected.splice(index, 1); + } + } + options += + ''; + }); + if ( - tax_selected.length > 0 && + selected_tax_length > 0 && $('#feedzy_post_terms').hasClass('fz-chosen-custom-tag') ) { $.each(tax_selected, function (index, customTag) { @@ -252,6 +282,10 @@ ''; }); } + + if (!feedzy.i10n.is_pro) { + options += ''; + } } else { show_terms = false; options = $('#empty_select_tpl').html(); @@ -1146,22 +1180,22 @@ } function feedzyTab() { - $(".fz-tabs-menu a").click(function () { - $(this).parents(".fz-tabs-menu").find("a").removeClass("active"); - $(this).addClass("active"); - var tagid = $(this).data("id"); + $('.fz-tabs-menu a').click(function () { + $(this).parents('.fz-tabs-menu').find('a').removeClass('active'); + $(this).addClass('active'); + const tagid = $(this).data('id'); $(this) - .parents(".feedzy-accordion-item__content") - .find(".fz-tabs-content .fz-tab-content") + .parents('.feedzy-accordion-item__content') + .find('.fz-tabs-content .fz-tab-content') .hide(); - $("#" + tagid).show(); + $('#' + tagid).show(); }); - $(".fz-tabs-content .fz-tab-content").hide(); - $(".fz-tabs-menu").each(function() { - $(this).find("a").first().addClass("active"); + $('.fz-tabs-content .fz-tab-content').hide(); + $('.fz-tabs-menu').each(function () { + $(this).find('a').first().addClass('active'); }); - $(".fz-tabs-content").each(function() { - $(this).find(".fz-tab-content").first().show(); + $('.fz-tabs-content').each(function () { + $(this).find('.fz-tab-content').first().show(); }); } @@ -1279,7 +1313,7 @@ $('.feedzy-remove-media').on('click', function () { if ( - $('#use-inherited-thumbnail').length && + $('#use-inherited-thumbnail').length && $('#use-inherited-thumbnail').is(':checked') ) { return false; @@ -1290,25 +1324,39 @@ 'change', function () { const selectedValue = $(this).val(); - const thumbnailValue = $('input[name="feedzy_meta_data[default_thumbnail_id]"]').val(); - const hasImagePreview = $('#custom-fallback-section .feedzy-media-preview').length > 0; - const hasThumbnails = (thumbnailValue && thumbnailValue !== '' && thumbnailValue !== '0') || hasImagePreview; + const thumbnailValue = $( + 'input[name="feedzy_meta_data[default_thumbnail_id]"]' + ).val(); + const hasImagePreview = + $('#custom-fallback-section .feedzy-media-preview').length > + 0; + const hasThumbnails = + (thumbnailValue && + thumbnailValue !== '' && + thumbnailValue !== '0') || + hasImagePreview; if (selectedValue === 'custom') { $('#custom-fallback-section').show(); $('#general-fallback-preview').hide(); - + if (hasThumbnails) { - $('.feedzy-open-media').html(feedzy.i10n.action_btn_text_2); + $('.feedzy-open-media').html( + feedzy.i10n.action_btn_text_2 + ); $('.feedzy-remove-media').addClass('is-show'); } else { - $('.feedzy-open-media').html(feedzy.i10n.action_btn_text_1); + $('.feedzy-open-media').html( + feedzy.i10n.action_btn_text_1 + ); $('.feedzy-remove-media').removeClass('is-show'); } } else if (selectedValue === 'general') { $('#custom-fallback-section').hide(); $('#general-fallback-preview').show(); - $('input[name="feedzy_meta_data[default_thumbnail_id]"]').val(''); + $( + 'input[name="feedzy_meta_data[default_thumbnail_id]"]' + ).val(''); } } );