Version Description
- March 17th, 2017 =
- Replaced the saved tab's ID w/ an "Add New" button on the single saved tab page - it should be easier to add saved tabs in bulk now
- Added a filter for all of the custom tab content - it should allow you to apply custom logic such as permissions in one central location
- Changed the way saved tabs are applied on the edit product page - it should allow embed content (especially Google Maps Embed content) to function correctly in all instances.
Download this release
Release Info
Developer | yikesitskevin |
Plugin | Custom Product Tabs for WooCommerce |
Version | 1.5.8 |
Comparing to | |
See all releases |
Code changes from version 1.5.7 to 1.5.8
admin/page.yikes-woo-saved-tabs-single.php
CHANGED
@@ -21,7 +21,9 @@ $number_of_products_using_this_tab = count( $products );
|
|
21 |
<div class="wrap">
|
22 |
<h1 class="screen-media">
|
23 |
Custom Product Tabs for WooCommerce | <span id="yikes_woo_tab_title_header"><?php echo $tab_title; ?></span>
|
24 |
-
<span class="
|
|
|
|
|
25 |
</h1>
|
26 |
|
27 |
<?php if ( $new_tab !== true ) { ?>
|
21 |
<div class="wrap">
|
22 |
<h1 class="screen-media">
|
23 |
Custom Product Tabs for WooCommerce | <span id="yikes_woo_tab_title_header"><?php echo $tab_title; ?></span>
|
24 |
+
<span class="yikes_woo_add_another_tab page-title-action" id="yikes_woo_add_another_tab">
|
25 |
+
<a href="<?php echo $new_tab_url; ?>"> <?php _e( 'Add Tab', 'yikes-inc-easy-custom-woocommerce-product-tabs' ); ?> </a>
|
26 |
+
</span>
|
27 |
</h1>
|
28 |
|
29 |
<?php if ( $new_tab !== true ) { ?>
|
css/repeatable-custom-tabs.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.yikes_woo_tabs_title_field {
|
2 |
position: absolute;
|
3 |
right: 1em;
|
4 |
top: 12px;
|
5 |
border-top: 1px solid #a0a5aa;
|
6 |
width: 100%;
|
7 |
white-space: nowrap;
|
8 |
max-width: 79%;
|
9 |
max-width: 100%;
|
|
|
10 |
position: absolute;
|
11 |
right: 1em;
|
12 |
top: 12px;
|
13 |
border-top: 1px solid #a0a5aa;
|
14 |
width: 100%;
|
15 |
white-space: nowrap;
|
16 |
max-width: 79%;
|
17 |
max-width: 100%;
|
|
|
1 |
position: absolute;
|
2 |
right: 1em;
|
3 |
top: 12px;
|
4 |
border-top: 1px solid #a0a5aa;
|
5 |
width: 100%;
|
6 |
white-space: nowrap;
|
7 |
max-width: 79%;
|
8 |
max-width: 100%;
|
9 |
+
.yikes_woo_tabs_title_field {
|
10 |
position: absolute;
|
11 |
right: 1em;
|
12 |
top: 12px;
|
13 |
border-top: 1px solid #a0a5aa;
|
14 |
width: 100%;
|
15 |
white-space: nowrap;
|
16 |
max-width: 79%;
|
17 |
max-width: 100%;
|
css/repeatable-custom-tabs.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.yikes_woo_tabs_title_field{width:70%!important}#duplicate_this_row{display:none}a[href="#yikes_woocommerce_custom_product_tabs"]:before{font-family:yikes-woo-font!important;content:"\e600"!important;font-size:15px!important;display:block;float:left;margin-top:2px}#yikes_woocommerce_custom_product_tabs hr{margin:1.5em 0}#yikes_woocommerce_custom_product_tabs .options_group{padding:0 1em}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce{max-width:85%;padding-left:0}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field{padding:5px 0!important}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel .form-field label{font-size:1.1em;font-weight:700;margin:2px 8px 0 0;width:auto}.yikes-woo-custom-tab-divider{display:block;height:2px;margin:2em 0 1.5em;border-bottom:1px solid #0073aa}.yikes-custom-wysiwyg-label{margin-left:1em;line-height:3}.yikes-logo{position:absolute;top:0;right:0;margin-top:.75em;margin-right:.75em;opacity:.85}#yikes-woo-tabs-review-us{float:right}.yikes-woo-tabs-hidden-how-to-info{display:none;font-family:"Open Sans",sans-serif!important;margin-right:30px}.woocommerce_options_panel p.yikes_woo_how_to_info{margin:9px 0 0;padding:0;text-align:right}.yikes-tabs-how-to-toggle{font-size:20px;position:absolute;right:1em;top:12px}.yikes-tabs-how-to-toggle:hover{cursor:pointer}.move-tab-data-down,.move-tab-data-up{font-size:25px;transition:color .2s}.move-tab-data-down:hover,.move-tab-data-up:hover{cursor:pointer;color:#4c9cce}.button-holder{margin-top:-190px;position:absolute;right:1em;width:110px}.yikes_wc_move_tab_container{margin-top:.5em;text-align:center}.woocommerce_options_panel p.yikes_wc_move_tab{line-height:1;margin:0;padding:0}.button-holder .button-secondary.remove_this_tab{background:#e35b5b;border-color:#dc3232;box-shadow:0 1px 0 #dc3232;color:#fff;cursor:pointer;margin-top:20px}.button-holder .button-secondary.remove_this_tab .dashicons{margin-top:-2px;vertical-align:middle}@font-face{font-family:yikes-woo-font;src:url(font/yikes-woo-font.eot?-394dt5);src:url(font/yikes-woo-font.eot?#iefix-394dt5) format('embedded-opentype'),url(font/yikes-woo-font.woff?-394dt5) format('woff'),url(font/yikes-woo-font.ttf?-394dt5) format('truetype'),url(font/yikes-woo-font.svg?-394dt5#yikes-woo-font) format('svg');font-weight:400;font-style:normal}[class*=" yikes-woo-"],[class^=yikes-woo-]{font-family:yikes-woo-font;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.yikes-woo-uniE600:before{content:"\e600"}.loading-wp-editor-gif{
|
1 |
+
.yikes_woo_tabs_title_field{width:70%!important}#duplicate_this_row{display:none}a[href="#yikes_woocommerce_custom_product_tabs"]:before{font-family:yikes-woo-font!important;content:"\e600"!important;font-size:15px!important;display:block;float:left;margin-top:2px}#yikes_woocommerce_custom_product_tabs hr{margin:1.5em 0}#yikes_woocommerce_custom_product_tabs .options_group{padding:0 1em}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce{max-width:85%;padding-left:0}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field{padding:5px 0!important}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel .form-field label{font-size:1.1em;font-weight:700;margin:2px 8px 0 0;width:auto}.yikes-woo-custom-tab-divider{display:block;height:2px;margin:2em 0 1.5em;border-bottom:1px solid #0073aa}.yikes-custom-wysiwyg-label{margin-left:1em;line-height:3}.yikes-logo{position:absolute;top:0;right:0;margin-top:.75em;margin-right:.75em;opacity:.85}#yikes-woo-tabs-review-us{float:right}.yikes-woo-tabs-hidden-how-to-info{display:none;font-family:"Open Sans",sans-serif!important;margin-right:30px}.woocommerce_options_panel p.yikes_woo_how_to_info{margin:9px 0 0;padding:0;text-align:right}.yikes-tabs-how-to-toggle{font-size:20px;position:absolute;right:1em;top:12px}.yikes-tabs-how-to-toggle:hover{cursor:pointer}.move-tab-data-down,.move-tab-data-up{font-size:25px;transition:color .2s}.move-tab-data-down:hover,.move-tab-data-up:hover{cursor:pointer;color:#4c9cce}.button-holder{margin-top:-190px;position:absolute;right:1em;width:110px}.yikes_wc_move_tab_container{margin-top:.5em;text-align:center}.woocommerce_options_panel p.yikes_wc_move_tab{line-height:1;margin:0;padding:0}.button-holder .button-secondary.remove_this_tab{background:#e35b5b;border-color:#dc3232;box-shadow:0 1px 0 #dc3232;color:#fff;cursor:pointer;margin-top:20px}.button-holder .button-secondary.remove_this_tab .dashicons{margin-top:-2px;vertical-align:middle}@font-face{font-family:yikes-woo-font;src:url(./font/yikes-woo-font.eot?-394dt5);src:url(./font/yikes-woo-font.eot?#iefix-394dt5) format('embedded-opentype'),url(./font/yikes-woo-font.woff?-394dt5) format('woff'),url(./font/yikes-woo-font.ttf?-394dt5) format('truetype'),url(./font/yikes-woo-font.svg?-394dt5#yikes-woo-font) format('svg');font-weight:400;font-style:normal}[class*=" yikes-woo-"],[class^=yikes-woo-]{font-family:yikes-woo-font;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.yikes-woo-uniE600:before{content:"\e600"}.loading-wp-editor-gif{margin-left:50%;margin-right:50%}.loading-wp-editor-gif-settings{padding-left:50px}.dashicons.inline-button-dashicons{font-size:15px;vertical-align:bottom}.yikes_woo_save_success{color:#31843f;float:left;padding-top:1em}._yikes_wc_add_tab_center,.add_tabs_container{border-top:1px solid #a0a5aa;margin:2em 2px 0 0;text-align:right;width:100%}.add_tabs_container .button.button-primary{margin-top:10px}._yikes_wc_add_tab_center{border-top:none;text-align:center}#_yikes_wc_apply_a_saved_tab,#add_another_tab{background:#cc99c2;border-color:#b366a4;color:#fff;text-decoration:none!important}.add_tabs_container._yikes_wc_add_tab_center_new .button.button-primary{display:none}#add_another_tab{-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);margin-bottom:10px;margin-top:10px}#_yikes_wc_apply_a_saved_tab{-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);margin:10px 0 0 8px}._yikes_wc_feedback_message{display:none;padding-left:3px}#yikes_woo_tab_error_message{color:red}#yikes_woo_tab_success_message{color:#31843f;margin-top:4px}.yikes_woo_how_to_h3{padding-left:10px;margin-top:0;font-weight:700}.yikes_woo_how_to_info,.yikes_woo_how_to_note{padding-left:23px!important}.yikes_woo_how_to_note{font-style:italic}.yikes-tabs-how-to-toggle-cursor{cursor:pointer}.yikes_woo_settings_info{font-family:"Open Sans",sans-serif}.yikes_woo_using_reusable_tab{opacity:.6;pointer-events:none}.lity-container{background:#fff;border-radius:6px;padding:.6em 1em 1em}.lity-container .lity-content::after{box-shadow:none}[class*=yikes_wc_lity_col]{float:left}.yikes_wc_lity_col_title{width:93%;padding:4px 20px 4px 2px;white-space:nowrap}.yikes_wc_lity_col_select{width:7%;padding-right:8px;padding-top:4px;cursor:pointer}.yikes_wc_lity_header{border-bottom:1px solid #555d66;margin-bottom:.4em;line-height:1;font-size:1.2em;font-weight:700;padding:0 0 8px;text-align:center;width:100%}.yikes_wc_lity_header>span{width:100px;text-align:center;white-space:nowrap}.display_saved_tabs_lity{min-width:300px}.yikes_woo_delete_this_tab{color:#0073aa;cursor:pointer}.yikes_woo_delete_this_tab:hover{color:#00a0d2}.yikes_woo_reusable_tab_title>input{width:100%}.yikes_woo_reusable_tab_content>label h3,.yikes_woo_reusable_tab_title>label h3{margin-bottom:6px}.yikes_woo_reusable_tab_content,.yikes_woo_reusable_tab_title{margin-bottom:20px}.wp-core-ui .button-secondary.yikes_woo_delete_this_tab{background:#e35b5b;border-color:#dc3232;box-shadow:0 1px 0 #dc3232;color:#fff;cursor:pointer}.yikes_woo_add_another_tab:hover>a{color:#fff}.yikes_woo_number_of_products{font-weight:700}.yikes_woo_save_and_delete_tab_buttons{margin-top:10px}._yikes_wc_title_red_overlay{background-color:#e68989!important}.woocommerce_options_panel p.yikes_wc_override_reusable_tab_container{line-height:1.1;margin-top:0;position:absolute;right:1em}.woocommerce_options_panel label._yikes_wc_override_reusable_tab_label{margin:2px 0 0 4px;float:none}@media screen and (max-width:1500px){#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce{max-width:79%}.woocommerce_options_panel p.yikes_wc_override_reusable_tab_container{max-width:100px}}@media screen and (max-width:1300px){.button-holder{margin-top:8px;position:relative;right:auto;text-align:center;width:100%}.woocommerce_options_panel p.yikes_wc_move_tab,.yikes_wc_move_tab_container{display:inline-block}.move-tab-data-down,.move-tab-data-up{margin-top:-5px}.button-holder .button-secondary.remove_this_tab{margin-left:26px;margin-top:0}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel div.form-field-tinymce,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field,#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.form-field-tinymce{max-width:100%}.woocommerce_options_panel p.yikes_wc_override_reusable_tab_container{margin-bottom:0;max-width:100%;position:relative}#yikes_woocommerce_custom_product_tabs.woocommerce_options_panel p.yikes_woo_using_reusable_tab{margin-top:0}}
|
js/repeatable-custom-tabs.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
/*
|
2 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
|
|
3 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
|
|
1 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
2 |
+
/*
|
3 |
jQuery( '#_yikes_wc_apply_a_saved_tab' ).removeClass( 'disabled' );
|
js/repeatable-custom-tabs.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function yikes_woo_handle_reusable_tabs(){var a={action:"yikes_woo_fetch_reusable_tab",security_nonce:repeatable_custom_tabs.fetch_reusable_tab_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,a,function(a){if("undefined"!=typeof a.success&&a.success===!0)if("undefined"!=typeof a.data&&"undefined"!=typeof a.data.message)jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass("yikes_woo_save_success").text(a.data.message).fadeIn().delay("2000").fadeOut();else{var b=JSON.parse(a.data);lity_html=create_lity_manage_reusable_tabs_html(b),global_lity=lity(lity_html,{handler:"inline"})}else"undefined"!=typeof a.success&&a.success===!1&&console.log(a);jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")})}function create_lity_manage_reusable_tabs_html(a){var b=1,c="";return c+='<div class="display_saved_tabs_lity">',c+='<div class="yikes_wc_lity_header">',c+="<span> Choose a Tab </span>",c+="</div>",jQuery.each(a,function(a,d){c+='<div id="saved_tab_container_'+b+'" data-tab-id="'+d.tab_id+'">',c+='<div style="display:none;" id="yikes_woo_saved_tab_content_'+b+'">',c+=d.tab_content,c+="</div>",c+='<div class="yikes_wc_lity_col_title">',c+='<span class="yikes_woo_saved_tab_title_lity" id="yikes_woo_saved_tab_title_'+b+'">',c+=d.tab_title,c+="</span>",c+="</div>",c+='<div class="yikes_wc_lity_col_select">',c+='<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="'+b+'"></span>',c+="</div>",c+="</div>",b++}),c+="</div>"}function yikes_woo_toggle_reusable_override_overlay(a,b){"disable"===a?(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").addClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").addClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").addClass("yikes_woo_using_reusable_tab")):(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").removeClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").removeClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").removeClass("yikes_woo_using_reusable_tab"))}function yikes_woo_check_for_reusable_tabs_and_disable(){jQuery(".yikes_wc_override_reusable_tab_container").each(function(){if(1==jQuery(this).data("reusable-tab")){var a=jQuery(this).children("._yikes_wc_override_reusable_tab").data("tab-number");yikes_woo_toggle_reusable_override_overlay("disable",a)}})}function yikes_woo_add_another_tab(a){yikes_woo_toggle_controls("disable"),jQuery("._yikes_wc_add_tab_center_new").removeClass("_yikes_wc_add_tab_center_new"),jQuery("#add_another_tab").parent(".add_tabs_container").removeClass("_yikes_wc_add_tab_center");var b=jQuery("#duplicate_this_row"),c=parseInt(jQuery("#number_of_tabs").val())+parseInt(1),d=jQuery("#duplicate_this_row .button-holder"),e="_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c,f="_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c;b.children("p").each(function(){jQuery(this).clone().insertBefore("#duplicate_this_row").removeClass("hidden_duplicator_row_title_field hidden_duplicator_row_content_field").addClass("new_duplicate_row")}).promise().done(function(){jQuery(".new_duplicate_row").removeClass("_yikes_wc_override_reusable_tab_container_duplicate").children("#_yikes_wc_override_reusable_tab_duplicate").attr("id","_yikes_wc_override_reusable_tab_"+c).attr("data-tab-number",c),jQuery(".new_duplicate_row").children("._yikes_wc_override_reusable_tab_label_duplicate").attr("for","_yikes_wc_override_reusable_tab_"+c).attr("id","_yikes_wc_override_reusable_tab_label_"+c).removeClass("_yikes_wc_override_reusable_tab_label_duplicate").addClass("_yikes_wc_override_reusable_tab_label"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c),jQuery(".new_duplicate_row").find("input").each(function(){jQuery(this).is('input[name="hidden_duplicator_row_title"]')&&jQuery(this).attr("name",f).removeClass("yikes_woo_tabs_title_field_duplicate").attr("id",f).parents("p").addClass(f+"_field").removeClass("hidden_duplicator_row_title_field").find("label").removeAttr("for").attr("for",f+"_field")}),jQuery(".new_duplicate_row").find("textarea").each(function(){jQuery(this).is('textarea[name="hidden_duplicator_row_content"]')&&jQuery(this).attr("name",e).attr("id",e).parents("p").addClass(e+"_field").removeClass("hidden_duplicator_row_content_field").find("label").removeAttr("for").attr("for",e+"_field")}),jQuery("#number_of_tabs").val(c),c>1&&jQuery(".new_duplicate_row").first().before('<div class="yikes-woo-custom-tab-divider"></div>')}),jQuery("#_yikes_wc_override_reusable_tab_container_duplicate").first().attr("id","_yikes_wc_override_reusable_tab_container_"+c),d.clone().insertAfter(jQuery("."+e+"_field")).addClass("last-button-holder"),jQuery(".last-button-holder").removeAttr("alt").attr("alt",c).hide(),jQuery("."+e+"_field").html(repeatable_custom_tabs.loading_gif),yikes_woo_get_wp_editor_ajax(e,!0,a),jQuery(".last-button-holder").removeClass("last-button-holder"),jQuery(".new_duplicate_row").removeClass("new_duplicate_row")}jQuery(document).ready(function(){setTimeout(function(){yikes_woo_check_for_reusable_tabs_and_disable()},4e3),jQuery(".yikes-tabs-how-to-toggle").on("click",function(a){yikes_woo_toggle_how_to()}),jQuery("#add_another_tab").click(function(a){yikes_woo_add_another_tab(""),a.preventDefault()}),jQuery("body").on("click",".remove_this_tab",function(a){var b=jQuery(this),c=b.parents(".button-holder").attr("alt"),d=jQuery("#number_of_tabs").val(),e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_";if(c!==d)for(var g=parseInt(c);g<d;){var h="",i="",j=g+1;h=jQuery("#"+e+j).val(),jQuery("#"+e+g).val(h),i=yikes_woo_get_content_from_wysiwyg(f+j),yikes_woo_set_content_for_wysiwyg(f+g,i);var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(l);var m=jQuery("#_yikes_wc_override_reusable_tab_"+j).is(":checked");jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",m),jQuery("#_yikes_wc_override_reusable_tab_container_"+j).is(":visible")?jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show():jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+j+"_field").hasClass("yikes_woo_using_reusable_tab")?yikes_woo_toggle_reusable_override_overlay("disable",g):yikes_woo_toggle_reusable_override_overlay("enable",g),g++}var e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_",n=f+d,o=jQuery("#_yikes_wc_override_reusable_tab_container_"+d),p=jQuery("."+e+d+"_field"),q=jQuery("."+f+d+"_field"),r=jQuery(".yikes-woo-custom-tab-divider").last(),s=jQuery("."+f+d+"_field").next(".button-holder"),t=parseInt(d)-parseInt(1);"undefined"!=typeof tinymce&&tinymce.execCommand("mceRemoveEditor",!1,n),o.remove(),p.remove(),q.remove(),r.remove(),s.remove(),jQuery("#number_of_tabs").val(t),0===parseInt(t)&&jQuery("#add_another_tab").parent(".add_tabs_container").addClass("_yikes_wc_add_tab_center"),a.preventDefault()}),jQuery("body").on("click",".move-tab-data-up",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt");if(1==b)return!1;var c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d="_yikes_wc_custom_repeatable_product_tabs_tab_content_",e=jQuery("#"+c+b).val(),f=yikes_woo_get_content_from_wysiwyg(d+b),g=parseInt(b)-parseInt(1),h=jQuery("#"+c+g).val(),i=yikes_woo_get_content_from_wysiwyg(d+g);jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",g)):jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",g));var j=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(l),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(j),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(k),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+c+b).val(h),jQuery("#"+c+g).val(e),yikes_woo_set_content_for_wysiwyg(d+b,i),yikes_woo_set_content_for_wysiwyg(d+g,f)}),jQuery("body").on("click",".move-tab-data-down",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt"),c=jQuery("#number_of_tabs").val();if(b==c)return!1;var d="_yikes_wc_custom_repeatable_product_tabs_tab_title_",e="_yikes_wc_custom_repeatable_product_tabs_tab_content_",f=jQuery("#"+d+b).val(),g=yikes_woo_get_content_from_wysiwyg(e+b),h=parseInt(b)+parseInt(1),i=jQuery("#"+d+h).val(),j=yikes_woo_get_content_from_wysiwyg(e+h);jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",h)):jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",h));var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(),n=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(n),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val(l),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+d+b).val(i),jQuery("#"+d+h).val(f),yikes_woo_set_content_for_wysiwyg(e+b,j),yikes_woo_set_content_for_wysiwyg(e+h,g)}),jQuery("body").on("click","#_yikes_wc_apply_a_saved_tab",function(){return!jQuery(this).hasClass("disabled")&&(jQuery(this).addClass("disabled"),void yikes_woo_handle_reusable_tabs())}),jQuery("body").on("click",".yikes_woo_saved_tab_selector_lity",function(){var a=jQuery(this).data("saved-tab-number"),b="_yikes_wc_custom_repeatable_product_tabs_tab_title_",c=jQuery("#yikes_woo_saved_tab_content_"+a).html(),d=jQuery("#yikes_woo_saved_tab_title_"+a).text(),e=jQuery("#saved_tab_container_"+a).data("tab-id");yikes_woo_add_another_tab(c);var f=jQuery("#number_of_tabs").val();jQuery("#"+b+f).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+f+"_action").val("add"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+f).val(e),jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+f+"_toolbar").length>0?yikes_woo_toggle_reusable_override_overlay("disable",f):jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+f).addClass("yikes_woo_disable_this_tab"),jQuery("#_yikes_wc_override_reusable_tab_container_"+f).show(),global_lity.close()}),jQuery("body").on("click","._yikes_wc_override_reusable_tab",function(){var a=jQuery(this).data("tab-number");jQuery(this).is(":checked")===!0?(yikes_woo_display_feedback_messages("_yikes_wc_override_reusable_tab_container_"+a,"_yikes_wc_override_reusable_tab_message","If you override this tab it will no longer recognize global tab changes.",!1),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("remove"),yikes_woo_toggle_reusable_override_overlay("enable",a)):(jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("add"),yikes_woo_toggle_reusable_override_overlay("disable",a))}),jQuery("body").on("focusout",".yikes_woo_tabs_title_field",function(){var a=jQuery(this);if(1===parseInt(jQuery("#number_of_tabs").val()))return a.removeClass("_yikes_wc_title_red_overlay"),void a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove();var b=jQuery(this).attr("id"),c=jQuery(this).val(),d=!1;jQuery(".yikes_woo_tabs_title_field").each(function(e,f){jQuery(f).attr("id")!=b&&""!=jQuery(f).val()&&jQuery(f).val()===c&&(a.addClass("_yikes_wc_title_red_overlay"),a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove(),a.parent(".form-field").prepend('<span class="_yikes_wc_duplicate_title_message"> Please choose a unique tab name - duplicate tab names can create errors </span>'),d=!0)}),d===!1&&(jQuery("._yikes_wc_title_red_overlay").removeClass("_yikes_wc_title_red_overlay"),jQuery("._yikes_wc_duplicate_title_message").remove())}),jQuery("body").on("lity:close",function(){jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}),jQuery("#yikes_woo_save_custom_tabs").click(function(){if(jQuery("#yikes_woo_save_custom_tabs").hasClass("disabled")!==!0){jQuery("#yikes_woo_save_custom_tabs").addClass("disabled"),jQuery("#yikes_woo_ajax_save_feedback").fadeOut();for(var a=jQuery("#number_of_tabs").val(),b={action:"yikes_woo_save_product_tabs",post_id:repeatable_custom_tabs.global_post_id,number_of_tabs:a,security_nonce:repeatable_custom_tabs.save_product_tabs_nonce},c=1;c<=a;c++)b["_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c]=yikes_woo_get_content_from_wysiwyg("_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").val();jQuery.post(repeatable_custom_tabs.ajaxurl,b,function(a){"undefined"!=typeof a.success&&(a.success===!0?feedback_message_class="yikes_woo_save_success":a.success===!1&&(feedback_message_class="yikes_woo_save_failure")),"undefined"!=typeof a.data&&"undefined"!=typeof a.data.message&&jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass(feedback_message_class).text(a.data.message).fadeIn().delay("2000").fadeOut(),jQuery("#yikes_woo_save_custom_tabs").removeClass("disabled")})}})});
|
1 |
+
function yikes_woo_apply_resuable_tab(a){var b=a.data,c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d=b.tab_title,e=b.tab_id,f=b.tab_content;yikes_woo_add_another_tab(f);var g=jQuery("#number_of_tabs").val();jQuery("#"+c+g).val(d),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val("add"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(e),jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+g+"_toolbar").length>0?yikes_woo_toggle_reusable_override_overlay("disable",g):jQuery("#"+c+g).addClass("yikes_woo_disable_this_tab"),jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show()}function yikes_woo_fetch_reusable_tab(a,b){var c={action:"yikes_woo_fetch_reusable_tab",tab_id:a,security_nonce:repeatable_custom_tabs.fetch_reusable_tab_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,c,function(a){global_lity.close(),b(a)})}function yikes_woo_fetch_reusable_tabs(a,b){var c={action:"yikes_woo_fetch_reusable_tabs",fetch_tab_content:a,security_nonce:repeatable_custom_tabs.fetch_reusable_tabs_nonce};jQuery.post(repeatable_custom_tabs.ajaxurl,c,function(a){b(a)})}function yikes_woo_handle_reusable_tabs(a){if("undefined"!=typeof a.success&&a.success===!0)if("undefined"!=typeof a.data&&"undefined"!=typeof a.data.message)jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass("yikes_woo_save_success").text(a.data.message).fadeIn().delay("2000").fadeOut();else{var b=JSON.parse(a.data);lity_html=create_lity_manage_reusable_tabs_html(b),global_lity=lity(lity_html,{handler:"inline"})}else"undefined"!=typeof a.success&&a.success===!1&&console.log(response);jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}function create_lity_manage_reusable_tabs_html(a){var b=1,c="";return c+='<div class="display_saved_tabs_lity">',c+='<div class="yikes_wc_lity_header">',c+="<span> Choose a Tab </span>",c+="</div>",jQuery.each(a,function(a,d){c+='<div id="saved_tab_container_'+b+'" data-tab-id="'+d.tab_id+'">',c+='<div class="yikes_wc_lity_col_title">',c+='<span class="yikes_woo_saved_tab_title_lity" id="yikes_woo_saved_tab_title_'+b+'">',c+=d.tab_title,c+="</span>",c+="</div>",c+='<div class="yikes_wc_lity_col_select">',c+='<span class="yikes_woo_saved_tab_selector_lity dashicons dashicons-plus-alt" data-saved-tab-number="'+b+'"></span>',c+="</div>",c+="</div>",b++}),c+="</div>"}function yikes_woo_toggle_reusable_override_overlay(a,b){"disable"===a?(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").addClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").addClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").addClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").addClass("yikes_woo_using_reusable_tab")):(jQuery("#qt__yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"_toolbar").removeClass("yikes_woo_using_reusable_tab"),jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b).removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-media-buttons").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-container").children(".mce-container-body").children(".mce-toolbar-grp").removeClass("yikes_woo_using_reusable_tab"),jQuery("#wp-_yikes_wc_custom_repeatable_product_tabs_tab_content_"+b+"-editor-container").children(".mce-tinymce").children(".mce-container-body").children(".mce-edit-area").removeClass("yikes_woo_using_reusable_tab"),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+b+"_field").removeClass("yikes_woo_using_reusable_tab"))}function yikes_woo_check_for_reusable_tabs_and_disable(){jQuery(".yikes_wc_override_reusable_tab_container").each(function(){if(1==jQuery(this).data("reusable-tab")){var a=jQuery(this).children("._yikes_wc_override_reusable_tab").data("tab-number");yikes_woo_toggle_reusable_override_overlay("disable",a)}})}function yikes_woo_add_another_tab(a){yikes_woo_toggle_controls("disable"),jQuery("._yikes_wc_add_tab_center_new").removeClass("_yikes_wc_add_tab_center_new"),jQuery("#add_another_tab").parent(".add_tabs_container").removeClass("_yikes_wc_add_tab_center");var b=jQuery("#duplicate_this_row"),c=parseInt(jQuery("#number_of_tabs").val())+parseInt(1),d=jQuery("#duplicate_this_row .button-holder"),e="_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c,f="_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c;b.children("p").each(function(){jQuery(this).clone().insertBefore("#duplicate_this_row").removeClass("hidden_duplicator_row_title_field hidden_duplicator_row_content_field").addClass("new_duplicate_row")}).promise().done(function(){jQuery(".new_duplicate_row").removeClass("_yikes_wc_override_reusable_tab_container_duplicate").children("#_yikes_wc_override_reusable_tab_duplicate").attr("id","_yikes_wc_override_reusable_tab_"+c).attr("data-tab-number",c),jQuery(".new_duplicate_row").children("._yikes_wc_override_reusable_tab_label_duplicate").attr("for","_yikes_wc_override_reusable_tab_"+c).attr("id","_yikes_wc_override_reusable_tab_label_"+c).removeClass("_yikes_wc_override_reusable_tab_label_duplicate").addClass("_yikes_wc_override_reusable_tab_label"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_action_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"),jQuery(".new_duplicate_row").children("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_duplicate").attr("name","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).attr("id","_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c),jQuery(".new_duplicate_row").find("input").each(function(){jQuery(this).is('input[name="hidden_duplicator_row_title"]')&&jQuery(this).attr("name",f).removeClass("yikes_woo_tabs_title_field_duplicate").attr("id",f).parents("p").addClass(f+"_field").removeClass("hidden_duplicator_row_title_field").find("label").removeAttr("for").attr("for",f+"_field")}),jQuery(".new_duplicate_row").find("textarea").each(function(){jQuery(this).is('textarea[name="hidden_duplicator_row_content"]')&&jQuery(this).attr("name",e).attr("id",e).parents("p").addClass(e+"_field").removeClass("hidden_duplicator_row_content_field").find("label").removeAttr("for").attr("for",e+"_field")}),jQuery("#number_of_tabs").val(c),c>1&&jQuery(".new_duplicate_row").first().before('<div class="yikes-woo-custom-tab-divider"></div>')}),jQuery("#_yikes_wc_override_reusable_tab_container_duplicate").first().attr("id","_yikes_wc_override_reusable_tab_container_"+c),d.clone().insertAfter(jQuery("."+e+"_field")).addClass("last-button-holder"),jQuery(".last-button-holder").removeAttr("alt").attr("alt",c).hide(),jQuery("."+e+"_field").html(repeatable_custom_tabs.loading_gif),yikes_woo_get_wp_editor_ajax(e,!0,a),jQuery(".last-button-holder").removeClass("last-button-holder"),jQuery(".new_duplicate_row").removeClass("new_duplicate_row")}jQuery(document).ready(function(){setTimeout(function(){yikes_woo_check_for_reusable_tabs_and_disable()},4e3),jQuery(".yikes-tabs-how-to-toggle").on("click",function(a){yikes_woo_toggle_how_to()}),jQuery("#add_another_tab").click(function(a){yikes_woo_add_another_tab(""),a.preventDefault()}),jQuery("body").on("click",".remove_this_tab",function(a){var b=jQuery(this),c=b.parents(".button-holder").attr("alt"),d=jQuery("#number_of_tabs").val(),e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_";if(c!==d)for(var g=parseInt(c);g<d;){var h="",i="",j=g+1;h=jQuery("#"+e+j).val(),jQuery("#"+e+g).val(h),i=yikes_woo_get_content_from_wysiwyg(f+j),yikes_woo_set_content_for_wysiwyg(f+g,i);var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+j).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(l);var m=jQuery("#_yikes_wc_override_reusable_tab_"+j).is(":checked");jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",m),jQuery("#_yikes_wc_override_reusable_tab_container_"+j).is(":visible")?jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show():jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("._yikes_wc_custom_repeatable_product_tabs_tab_title_"+j+"_field").hasClass("yikes_woo_using_reusable_tab")?yikes_woo_toggle_reusable_override_overlay("disable",g):yikes_woo_toggle_reusable_override_overlay("enable",g),g++}var e="_yikes_wc_custom_repeatable_product_tabs_tab_title_",f="_yikes_wc_custom_repeatable_product_tabs_tab_content_",n=f+d,o=jQuery("#_yikes_wc_override_reusable_tab_container_"+d),p=jQuery("."+e+d+"_field"),q=jQuery("."+f+d+"_field"),r=jQuery(".yikes-woo-custom-tab-divider").last(),s=jQuery("."+f+d+"_field").next(".button-holder"),t=parseInt(d)-parseInt(1);"undefined"!=typeof tinymce&&tinymce.execCommand("mceRemoveEditor",!1,n),o.remove(),p.remove(),q.remove(),r.remove(),s.remove(),jQuery("#number_of_tabs").val(t),0===parseInt(t)&&jQuery("#add_another_tab").parent(".add_tabs_container").addClass("_yikes_wc_add_tab_center"),a.preventDefault()}),jQuery("body").on("click",".move-tab-data-up",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt");if(1==b)return!1;var c="_yikes_wc_custom_repeatable_product_tabs_tab_title_",d="_yikes_wc_custom_repeatable_product_tabs_tab_content_",e=jQuery("#"+c+b).val(),f=yikes_woo_get_content_from_wysiwyg(d+b),g=parseInt(b)-parseInt(1),h=jQuery("#"+c+g).val(),i=yikes_woo_get_content_from_wysiwyg(d+g);jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",g)):jQuery("."+c+g+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+c+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",g));var j=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(l),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g+"_action").val(j),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+g).val(k),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+g).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+g).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+g).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+g).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+c+b).val(h),jQuery("#"+c+g).val(e),yikes_woo_set_content_for_wysiwyg(d+b,i),yikes_woo_set_content_for_wysiwyg(d+g,f)}),jQuery("body").on("click",".move-tab-data-down",function(){var a=jQuery(this),b=a.parents(".button-holder").attr("alt"),c=jQuery("#number_of_tabs").val();if(b==c)return!1;var d="_yikes_wc_custom_repeatable_product_tabs_tab_title_",e="_yikes_wc_custom_repeatable_product_tabs_tab_content_",f=jQuery("#"+d+b).val(),g=yikes_woo_get_content_from_wysiwyg(e+b),h=parseInt(b)+parseInt(1),i=jQuery("#"+d+h).val(),j=yikes_woo_get_content_from_wysiwyg(e+h);jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")?(yikes_woo_toggle_reusable_override_overlay("enable",b),yikes_woo_toggle_reusable_override_overlay("disable",h)):jQuery("."+d+h+"_field").hasClass("yikes_woo_using_reusable_tab")&&!jQuery("."+d+b+"_field").hasClass("yikes_woo_using_reusable_tab")&&(yikes_woo_toggle_reusable_override_overlay("disable",b),yikes_woo_toggle_reusable_override_overlay("enable",h));var k=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(),l=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(),m=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(),n=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val();jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b+"_action").val(m),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h+"_action").val(k),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+b).val(n),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+h).val(l),jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!0&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!1?(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!0),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!1)):jQuery("#_yikes_wc_override_reusable_tab_"+b).is(":checked")===!1&&jQuery("#_yikes_wc_override_reusable_tab_"+h).is(":checked")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_"+h).prop("checked",!1),jQuery("#_yikes_wc_override_reusable_tab_"+b).prop("checked",!0)),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!0&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!1?(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).show(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).hide()):jQuery("#_yikes_wc_override_reusable_tab_container_"+b).is(":visible")===!1&&jQuery("#_yikes_wc_override_reusable_tab_container_"+h).is(":visible")===!0&&(jQuery("#_yikes_wc_override_reusable_tab_container_"+h).hide(),jQuery("#_yikes_wc_override_reusable_tab_container_"+b).show()),jQuery("#"+d+b).val(i),jQuery("#"+d+h).val(f),yikes_woo_set_content_for_wysiwyg(e+b,j),yikes_woo_set_content_for_wysiwyg(e+h,g)}),jQuery("body").on("click","#_yikes_wc_apply_a_saved_tab",function(){return!jQuery(this).hasClass("disabled")&&(jQuery(this).addClass("disabled"),void yikes_woo_fetch_reusable_tabs(!1,yikes_woo_handle_reusable_tabs))}),jQuery("body").on("click",".yikes_woo_saved_tab_selector_lity",function(){var a=jQuery(this).data("saved-tab-number"),b=jQuery("#saved_tab_container_"+a).data("tab-id");jQuery(".lity-content").html(repeatable_custom_tabs.loading_gif).css("width","50px").children("img").css("margin-left","37%"),yikes_woo_fetch_reusable_tab(b,yikes_woo_apply_resuable_tab)}),jQuery("body").on("click","._yikes_wc_override_reusable_tab",function(){var a=jQuery(this).data("tab-number");jQuery(this).is(":checked")===!0?(yikes_woo_display_feedback_messages("_yikes_wc_override_reusable_tab_container_"+a,"_yikes_wc_override_reusable_tab_message","If you override this tab it will no longer recognize global tab changes.",!1),jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("remove"),yikes_woo_toggle_reusable_override_overlay("enable",a)):(jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+a+"_action").val("add"),yikes_woo_toggle_reusable_override_overlay("disable",a))}),jQuery("body").on("focusout",".yikes_woo_tabs_title_field",function(){var a=jQuery(this);if(1===parseInt(jQuery("#number_of_tabs").val()))return a.removeClass("_yikes_wc_title_red_overlay"),void a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove();var b=jQuery(this).attr("id"),c=jQuery(this).val(),d=!1;jQuery(".yikes_woo_tabs_title_field").each(function(e,f){jQuery(f).attr("id")!=b&&""!=jQuery(f).val()&&jQuery(f).val()===c&&(a.addClass("_yikes_wc_title_red_overlay"),a.parent(".form-field").children("._yikes_wc_duplicate_title_message").remove(),a.parent(".form-field").prepend('<span class="_yikes_wc_duplicate_title_message"> Please choose a unique tab name - duplicate tab names can create errors </span>'),d=!0)}),d===!1&&(jQuery("._yikes_wc_title_red_overlay").removeClass("_yikes_wc_title_red_overlay"),jQuery("._yikes_wc_duplicate_title_message").remove())}),jQuery("body").on("lity:close",function(){jQuery("#_yikes_wc_apply_a_saved_tab").removeClass("disabled")}),jQuery("#yikes_woo_save_custom_tabs").click(function(){if(jQuery("#yikes_woo_save_custom_tabs").hasClass("disabled")!==!0){jQuery("#yikes_woo_save_custom_tabs").addClass("disabled"),jQuery("#yikes_woo_ajax_save_feedback").fadeOut();for(var a=jQuery("#number_of_tabs").val(),b={action:"yikes_woo_save_product_tabs",post_id:repeatable_custom_tabs.global_post_id,number_of_tabs:a,security_nonce:repeatable_custom_tabs.save_product_tabs_nonce},c=1;c<=a;c++)b["_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_tab_title_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c]=yikes_woo_get_content_from_wysiwyg("_yikes_wc_custom_repeatable_product_tabs_tab_content_"+c),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c).val(),b["_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action"]=jQuery("#_yikes_wc_custom_repeatable_product_tabs_saved_tab_id_"+c+"_action").val();jQuery.post(repeatable_custom_tabs.ajaxurl,b,function(a){"undefined"!=typeof a.success&&(a.success===!0?feedback_message_class="yikes_woo_save_success":a.success===!1&&(feedback_message_class="yikes_woo_save_failure")),"undefined"!=typeof a.data&&"undefined"!=typeof a.data.message&&jQuery("#yikes_woo_ajax_save_feedback").removeClass().addClass(feedback_message_class).text(a.data.message).fadeIn().delay("2000").fadeOut(),jQuery("#yikes_woo_save_custom_tabs").removeClass("disabled")})}})});
|
readme.txt
CHANGED
@@ -3,10 +3,10 @@ Contributors: yikesinc, eherman24, liljimmi, yikesitskevin
|
|
3 |
Donate link: http://yikesinc.com
|
4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.7.
|
7 |
Requires WooCommerce at least: 2.0
|
8 |
Tested WooCommerce up to: 2.6.9
|
9 |
-
Stable tag: 1.5.
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Add custom tabs with content to products in WooCommerce.
|
@@ -74,6 +74,11 @@ Yes! Since v1.4 we've added the necessary code to ensure the custom tab data is
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
|
|
77 |
= 1.5.7 - February 27th, 2017 =
|
78 |
* Duplicating a product now duplicates the corresponding saved tabs correctly
|
79 |
* Added two filters (`yikes_woo_use_the_content_filter` and `yikes_woo_filter_main_tab_content`) to help provide a work-around to using the standard `the_content` filter which has caused numerous issues due to plugin conflicts.
|
3 |
Donate link: http://yikesinc.com
|
4 |
Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.7.3
|
7 |
Requires WooCommerce at least: 2.0
|
8 |
Tested WooCommerce up to: 2.6.9
|
9 |
+
Stable tag: 1.5.8
|
10 |
License: GPLv2 or later
|
11 |
|
12 |
Add custom tabs with content to products in WooCommerce.
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.5.8 - March 17th, 2017 =
|
78 |
+
* Replaced the saved tab's ID w/ an "Add New" button on the single saved tab page - it should be easier to add saved tabs in bulk now
|
79 |
+
* Added a filter for all of the custom tab content - it should allow you to apply custom logic such as permissions in one central location
|
80 |
+
* Changed the way saved tabs are applied on the edit product page - it should allow embed content (especially Google Maps Embed content) to function correctly in all instances.
|
81 |
+
|
82 |
= 1.5.7 - February 27th, 2017 =
|
83 |
* Duplicating a product now duplicates the corresponding saved tabs correctly
|
84 |
* Added two filters (`yikes_woo_use_the_content_filter` and `yikes_woo_filter_main_tab_content`) to help provide a work-around to using the standard `the_content` filter which has caused numerous issues due to plugin conflicts.
|
yikes-inc-easy-custom-woocommerce-product-tabs.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
6 |
* Author: YIKES, Inc
|
7 |
* Author URI: http://www.yikesinc.com
|
8 |
-
* Version: 1.5.
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
*
|
@@ -62,7 +62,7 @@
|
|
62 |
private $tab_data = false;
|
63 |
|
64 |
/** plugin version number */
|
65 |
-
const VERSION = '1.5.
|
66 |
|
67 |
/** plugin text domain */
|
68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
@@ -162,7 +162,8 @@
|
|
162 |
// Define our AJAX calls
|
163 |
add_action( 'wp_ajax_yikes_woo_get_wp_editor', array( $this, 'yikes_woo_get_wp_editor' ) );
|
164 |
add_action( 'wp_ajax_yikes_woo_save_tab_as_reusable', array( $this, 'yikes_woo_save_tab_as_reusable' ) );
|
165 |
-
add_action( '
|
|
|
166 |
add_action( 'wp_ajax_yikes_woo_delete_reusable_tab_handler', array( $this, 'yikes_woo_delete_reusable_tab_handler' ) );
|
167 |
add_action( 'wp_ajax_yikes_woo_save_product_tabs', array( $this, 'yikes_woo_save_product_tabs' ) );
|
168 |
|
@@ -199,6 +200,7 @@
|
|
199 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
200 |
'get_wp_editor_security_nonce' => wp_create_nonce( 'yikes_woo_get_wp_editor_nonce' ),
|
201 |
'save_tab_as_reusable_nonce' => wp_create_nonce( 'yikes_woo_save_tab_as_reusable_nonce' ),
|
|
|
202 |
'fetch_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tab_nonce' ),
|
203 |
'delete_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_delete_reusable_tab_nonce' ),
|
204 |
'save_product_tabs_nonce' => wp_create_nonce( 'yikes_woo_save_product_tabs_nonce' ),
|
@@ -296,6 +298,18 @@
|
|
296 |
$tabs['reviews']['priority'] = $i; // make sure the reviews tab remains on the end (if it is set)
|
297 |
}
|
298 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
|
300 |
return $tabs;
|
301 |
|
@@ -317,7 +331,7 @@
|
|
317 |
**/
|
318 |
public function custom_product_tabs_panel_content( $key, $tab ) {
|
319 |
|
320 |
-
$content = '';
|
321 |
|
322 |
// Hardcoding Site Origin Page Builder conflict fix - remove their the_content filter
|
323 |
remove_filter( 'the_content', 'siteorigin_panels_filter_content' );
|
@@ -623,8 +637,8 @@
|
|
623 |
);
|
624 |
|
625 |
// Return wp_editor HTML
|
626 |
-
wp_editor( $tab_content, $textarea_id, $wp_editor_options );
|
627 |
-
|
628 |
}
|
629 |
|
630 |
/**
|
@@ -786,12 +800,13 @@
|
|
786 |
wp_send_json_success( array( 'redirect' => false ) );
|
787 |
}
|
788 |
|
|
|
789 |
/**
|
790 |
-
* [AJAX] Fetch
|
791 |
*
|
792 |
* @since 1.5
|
793 |
*
|
794 |
-
* @return object success w/
|
795 |
*/
|
796 |
public function yikes_woo_fetch_reusable_tab() {
|
797 |
|
@@ -800,15 +815,48 @@
|
|
800 |
wp_send_json_error();
|
801 |
}
|
802 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
803 |
// Get the array of saved tabs
|
804 |
$saved_tabs = get_option( 'yikes_woo_reusable_products_tabs' );
|
805 |
|
806 |
-
|
807 |
-
foreach( $saved_tabs as $key => $tab ) {
|
808 |
-
if ( isset( $tab['tab_content'] ) ) {
|
809 |
|
810 |
-
|
811 |
-
|
|
|
|
|
812 |
}
|
813 |
}
|
814 |
|
@@ -1048,6 +1096,9 @@
|
|
1048 |
// Get our saved tabs array
|
1049 |
$yikes_custom_tab_data = get_option( 'yikes_woo_reusable_products_tabs', array() );
|
1050 |
|
|
|
|
|
|
|
1051 |
// If saved_tab_id is set, we should show the single saved tab // add new tab page
|
1052 |
if ( isset( $_GET['saved-tab-id'] ) && ! empty( $_GET['saved-tab-id'] ) ) {
|
1053 |
|
@@ -1076,9 +1127,6 @@
|
|
1076 |
$delete_message_display = '';
|
1077 |
}
|
1078 |
|
1079 |
-
// New tab URL - used to supply the 'Add Tab' href
|
1080 |
-
$new_tab_url = add_query_arg( array( 'saved-tab-id' => 'new' ), esc_url_raw( 'options-general.php?page=' . $settings_page_slug ) );
|
1081 |
-
|
1082 |
// Show tab table list
|
1083 |
require_once( plugin_dir_path(__FILE__) . 'admin/page.yikes-woo-saved-tabs.php' );
|
1084 |
}
|
5 |
* Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
|
6 |
* Author: YIKES, Inc
|
7 |
* Author URI: http://www.yikesinc.com
|
8 |
+
* Version: 1.5.8
|
9 |
* Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
|
10 |
* Domain Path: languages/
|
11 |
*
|
62 |
private $tab_data = false;
|
63 |
|
64 |
/** plugin version number */
|
65 |
+
const VERSION = '1.5.8';
|
66 |
|
67 |
/** plugin text domain */
|
68 |
const TEXT_DOMAIN = 'yikes-inc-easy-custom-woocommerce-product-tabs';
|
162 |
// Define our AJAX calls
|
163 |
add_action( 'wp_ajax_yikes_woo_get_wp_editor', array( $this, 'yikes_woo_get_wp_editor' ) );
|
164 |
add_action( 'wp_ajax_yikes_woo_save_tab_as_reusable', array( $this, 'yikes_woo_save_tab_as_reusable' ) );
|
165 |
+
add_action( 'wp_ajax_yikes_woo_fetch_reusable_tabs', array( $this, 'yikes_woo_fetch_reusable_tabs' ) );
|
166 |
+
add_action( 'wp_ajax_yikes_woo_fetch_reusable_tab', array( $this, 'yikes_woo_fetch_reusable_tab' ) );
|
167 |
add_action( 'wp_ajax_yikes_woo_delete_reusable_tab_handler', array( $this, 'yikes_woo_delete_reusable_tab_handler' ) );
|
168 |
add_action( 'wp_ajax_yikes_woo_save_product_tabs', array( $this, 'yikes_woo_save_product_tabs' ) );
|
169 |
|
200 |
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
201 |
'get_wp_editor_security_nonce' => wp_create_nonce( 'yikes_woo_get_wp_editor_nonce' ),
|
202 |
'save_tab_as_reusable_nonce' => wp_create_nonce( 'yikes_woo_save_tab_as_reusable_nonce' ),
|
203 |
+
'fetch_reusable_tabs_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tabs_nonce' ),
|
204 |
'fetch_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_fetch_reusable_tab_nonce' ),
|
205 |
'delete_reusable_tab_nonce' => wp_create_nonce( 'yikes_woo_delete_reusable_tab_nonce' ),
|
206 |
'save_product_tabs_nonce' => wp_create_nonce( 'yikes_woo_save_product_tabs_nonce' ),
|
298 |
$tabs['reviews']['priority'] = $i; // make sure the reviews tab remains on the end (if it is set)
|
299 |
}
|
300 |
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Filter: 'yikes_woo_filter_all_product_tabs'
|
304 |
+
*
|
305 |
+
* Generic filter that passes all of the tab info and the corresponding product. Cheers.
|
306 |
+
*
|
307 |
+
* Note: This passes all of the tabs for the current product, not just the Custom Product Tabs created by this plugin.
|
308 |
+
*
|
309 |
+
* @param array | $tab | Array of $tab data arrays.
|
310 |
+
* @param object | $product | The WooCommerce product these tabs are for
|
311 |
+
*/
|
312 |
+
$tabs = apply_filters( 'yikes_woo_filter_all_product_tabs', $tabs, $product );
|
313 |
|
314 |
return $tabs;
|
315 |
|
331 |
**/
|
332 |
public function custom_product_tabs_panel_content( $key, $tab ) {
|
333 |
|
334 |
+
$content = '';
|
335 |
|
336 |
// Hardcoding Site Origin Page Builder conflict fix - remove their the_content filter
|
337 |
remove_filter( 'the_content', 'siteorigin_panels_filter_content' );
|
637 |
);
|
638 |
|
639 |
// Return wp_editor HTML
|
640 |
+
wp_editor( stripslashes( $tab_content ), $textarea_id, $wp_editor_options );
|
641 |
+
exit;
|
642 |
}
|
643 |
|
644 |
/**
|
800 |
wp_send_json_success( array( 'redirect' => false ) );
|
801 |
}
|
802 |
|
803 |
+
|
804 |
/**
|
805 |
+
* [AJAX] Fetch a single reusable
|
806 |
*
|
807 |
* @since 1.5
|
808 |
*
|
809 |
+
* @return object success w/ tab data || failure w/ message
|
810 |
*/
|
811 |
public function yikes_woo_fetch_reusable_tab() {
|
812 |
|
815 |
wp_send_json_error();
|
816 |
}
|
817 |
|
818 |
+
$tab_id = isset( $_POST['tab_id'] ) ? filter_var( $_POST['tab_id'], FILTER_SANITIZE_NUMBER_INT ) : '';
|
819 |
+
|
820 |
+
// Get the array of saved tabs
|
821 |
+
$saved_tabs = get_option( 'yikes_woo_reusable_products_tabs' );
|
822 |
+
|
823 |
+
$tab = isset( $saved_tabs[$tab_id] ) ? $saved_tabs[$tab_id] : false;
|
824 |
+
|
825 |
+
$tab['tab_content'] = stripslashes( $tab['tab_content'] );
|
826 |
+
|
827 |
+
if ( ! empty( $saved_tabs ) ) {
|
828 |
+
wp_send_json_success( $tab );
|
829 |
+
} else {
|
830 |
+
wp_send_json_success( array( 'message' => 'Could not find the tab. Pleae try again.' ) );
|
831 |
+
}
|
832 |
+
|
833 |
+
// If we get this far, send error
|
834 |
+
wp_send_json_error( array( 'message' => 'Uh oh. Something went wrong.' ) );
|
835 |
+
}
|
836 |
+
|
837 |
+
/**
|
838 |
+
* [AJAX] Fetch all reusable tabs
|
839 |
+
*
|
840 |
+
* @since 1.5
|
841 |
+
*
|
842 |
+
* @return object success w/ saved_tabs || failure w/ message
|
843 |
+
*/
|
844 |
+
public function yikes_woo_fetch_reusable_tabs() {
|
845 |
+
|
846 |
+
// Verify the nonce
|
847 |
+
if ( ! check_ajax_referer( 'yikes_woo_fetch_reusable_tabs_nonce', 'security_nonce', false ) ) {
|
848 |
+
wp_send_json_error();
|
849 |
+
}
|
850 |
+
|
851 |
// Get the array of saved tabs
|
852 |
$saved_tabs = get_option( 'yikes_woo_reusable_products_tabs' );
|
853 |
|
854 |
+
$fetch_tab_content = isset( $_POST['fetch_tab_content'] ) ? filter_var( $_POST['fetch_tab_content'], FILTER_VALIDATE_BOOLEAN ) : false;
|
|
|
|
|
855 |
|
856 |
+
// We don't need to pass the content back, and it could be a LOT, so let's just remove it
|
857 |
+
if ( $fetch_tab_content === false ) {
|
858 |
+
foreach( $saved_tabs as $key => $tab ) {
|
859 |
+
unset( $saved_tabs[$key]['tab_content'] );
|
860 |
}
|
861 |
}
|
862 |
|
1096 |
// Get our saved tabs array
|
1097 |
$yikes_custom_tab_data = get_option( 'yikes_woo_reusable_products_tabs', array() );
|
1098 |
|
1099 |
+
// New tab URL - used to supply the 'Add Tab' href
|
1100 |
+
$new_tab_url = add_query_arg( array( 'saved-tab-id' => 'new' ), esc_url_raw( 'options-general.php?page=' . $settings_page_slug ) );
|
1101 |
+
|
1102 |
// If saved_tab_id is set, we should show the single saved tab // add new tab page
|
1103 |
if ( isset( $_GET['saved-tab-id'] ) && ! empty( $_GET['saved-tab-id'] ) ) {
|
1104 |
|
1127 |
$delete_message_display = '';
|
1128 |
}
|
1129 |
|
|
|
|
|
|
|
1130 |
// Show tab table list
|
1131 |
require_once( plugin_dir_path(__FILE__) . 'admin/page.yikes-woo-saved-tabs.php' );
|
1132 |
}
|