Schema & Structured Data for WP & AMP - Version 1.9.43

Version Description

(04 July 2020) =

  • Fixed: Course post is getting blank when product schema is addedd to the ip_couse post type #1101
  • Fixed: Website and searchbox schema should only show on the homepage #1098
  • Fixed: FAQ schema is not being displayed in homepage(AMP) when using a custom front page #1096
  • Fixed: PHP Notice: Trying to get property 'data' of non-object in /output/service.php on line 3700 because of anonymous users #1094
  • Fixed: NewsArticle is not a known valid target type for the itemReviewed property #1093
  • Fixed: Image size is smaller than recommended #1092
  • Fixed: When ACF Video URL is mapped in modified field its not working #1084
  • Added: Compatibility with Recipe Card Block By WPZOOM ( https://wordpress.org/plugins/recipe-card-blocks-by-wpzoom )
  • Added: Compatibility with ReciPress ( https://wordpress.org/plugins/recipress )
  • Added: More nutrition information properties to recipe schema
  • Added: Schema type blocks (Q&A) has been added in Gutenberg editor #842
  • Added: Schema type blocks (Q&A) has been added in Elementor widget #820
Download this release

Release Info

Developer magazine3
Plugin Icon 128x128 Schema & Structured Data for WP & AMP
Version 1.9.43
Comparing to
See all releases

Code changes from version 1.9.42 to 1.9.43

admin_section/common-function.php CHANGED
@@ -2918,6 +2918,8 @@ function saswp_get_field_note($pname){
2918
  'aiosp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>',
2919
  'squirrly_seo' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/squirrly-seo/">Squirrly SEO</a>',
2920
  'wp_recipe_maker' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-recipe-maker/">WP Recipe Maker</a>',
 
 
2921
  'wp_ultimate_recipe' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-ultimate-recipe/">WP Ultimate Recipe</a>',
2922
  'learn_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/learnpress/">Learn Press</a>',
2923
  'learn_dash' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.learndash.com/pricing-and-purchase/">Learn Dash</a>',
@@ -3689,4 +3691,39 @@ function saswp_get_condition_list($condition, $search = '', $saved_data = ''){
3689
  return $choices;
3690
  }
3691
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3692
  }
2918
  'aiosp' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/all-in-one-seo-pack/">All in One SEO Pack</a>',
2919
  'squirrly_seo' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/squirrly-seo/">Squirrly SEO</a>',
2920
  'wp_recipe_maker' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-recipe-maker/">WP Recipe Maker</a>',
2921
+ 'wp_zoom' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/recipe-card-blocks-by-wpzoom">Recipe Card Blocks by WPZOOM</a>',
2922
+ 'recipress' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/recipress">ReciPress</a>',
2923
  'wp_ultimate_recipe' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/wp-ultimate-recipe/">WP Ultimate Recipe</a>',
2924
  'learn_press' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://wordpress.org/plugins/learnpress/">Learn Press</a>',
2925
  'learn_dash' => esc_html__('Requires','schema-and-structured-data-for-wp').' <a target="_blank" href="https://www.learndash.com/pricing-and-purchase/">Learn Dash</a>',
3691
  return $choices;
3692
  }
3693
 
3694
+ }
3695
+
3696
+ /**
3697
+ * Get image url by specified $size
3698
+ *
3699
+ * @since 1.9.43
3700
+ *
3701
+ * @param string|number $image_id The image id to get url
3702
+ * @param string $size The specific image size
3703
+ * @param array $image_sizes Available image sizes for specified image id
3704
+ * @return string The image url
3705
+ */
3706
+ function saswp_get_image_size_url( $image_id, $size = 'full', $image_sizes = array() ) {
3707
+ if ( isset( $image_sizes[ $size ] ) ) {
3708
+ if ( isset( $image_sizes[ $size ]['url'] ) ) {
3709
+ $image_url = $image_sizes[ $size ]['url'];
3710
+ } elseif ( isset( $image_sizes[ $size ]['source_url'] ) ) {
3711
+ $image_url = $image_sizes[ $size ]['source_url'];
3712
+ }
3713
+ }
3714
+
3715
+ if ( function_exists( 'fly_get_attachment_image_src' ) ) {
3716
+ $thumb = fly_get_attachment_image_src( $image_id, $size );
3717
+
3718
+ if ( $thumb ) {
3719
+ $image_url = isset( $thumb[0] ) ? $thumb[0] : $thumb['src'];
3720
+ }
3721
+ }
3722
+
3723
+ if ( !isset( $image_url ) ) {
3724
+ $thumb = wp_get_attachment_image_src( $image_id, $size );
3725
+ $image_url = $thumb && isset( $thumb[0] ) ? $thumb[0] : '';
3726
+ }
3727
+
3728
+ return $image_url;
3729
  }
admin_section/js/main-script.js CHANGED
@@ -690,6 +690,24 @@ jQuery(document).ready(function($){
690
  $("#saswp-wp-recipe-maker").val(0);
691
  }
692
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
693
 
694
  case 'saswp-wp-ultimate-recipe-checkbox':
695
  saswp_compatibliy_notes(current, id);
690
  $("#saswp-wp-recipe-maker").val(0);
691
  }
692
  break;
693
+
694
+ case 'saswp-wpzoom-checkbox':
695
+ saswp_compatibliy_notes(current, id);
696
+ if ($(this).is(':checked')) {
697
+ $("#saswp-wpzoom").val(1);
698
+ }else{
699
+ $("#saswp-wpzoom").val(0);
700
+ }
701
+ break;
702
+
703
+ case 'saswp-recipress-checkbox':
704
+ saswp_compatibliy_notes(current, id);
705
+ if ($(this).is(':checked')) {
706
+ $("#saswp-recipress").val(1);
707
+ }else{
708
+ $("#saswp-recipress").val(0);
709
+ }
710
+ break;
711
 
712
  case 'saswp-wp-ultimate-recipe-checkbox':
713
  saswp_compatibliy_notes(current, id);
admin_section/js/main-script.min.js CHANGED
@@ -1 +1 @@
1
- var saswp_attached_rv=[],saswp_attached_col=[];jQuery(document).ready(function(s){if(saswp_select2(),s(".saswp-upgrade-to-pro").parent().attr({href:"https://structured-data-for-wp.com/pricing/",target:"_blank"}),s(document).on("click",".saswp-attach-reviews",function(){s(".saswp-enable-append-reviews").is(":checked")?(tb_show(saswp_localize_data.translable_txt.attach_review,"#TB_inline??width=615&height=400&inlineId=saswp-embed-code-div"),s(document).find("#TB_window").width(600).height(415).css({top:"200px","margin-top":"0px"}),s(".saswp-attached-rv-count").show()):s(".saswp-attached-rv-count").hide()}),s(".close-attached-reviews-popup").on("click",function(){s("#TB_closeWindowButton").trigger("click")}),s("#saswp_attahced_reviews").val()&&(saswp_attached_rv=JSON.parse(s("#saswp_attahced_reviews").val())),s("#saswp_attached_collection").val()&&(saswp_attached_col=JSON.parse(s("#saswp_attached_collection").val())),s(document).on("click",".saswp-attach-rv-checkbox",function(){var e;e=parseInt(s(this).parent().attr("data-id"));var a=s(this).parent().attr("data-type");s(this).is(":checked")?("review"==a&&saswp_attached_rv.push(e),"collection"==a&&saswp_attached_col.push(e)):("review"==a&&saswp_attached_rv.splice(saswp_attached_rv.indexOf(e),1),"collection"==a&&saswp_attached_col.splice(saswp_attached_col.indexOf(e),1));var t=saswp_attached_rv.length,i=saswp_attached_col.length,p="";t>0&&(p+=t+" Reviews, "),i>0&&(p+=i+" Collection"),p||(p=0),s(".saswp-attached-rv-count").text("Attached "+p),s("#saswp_attahced_reviews").val(JSON.stringify(saswp_attached_rv)),s("#saswp_attached_collection").val(JSON.stringify(saswp_attached_col))}),s(".saswp-load-more-rv").on("click",function(e){var a=s(this).attr("data-type"),t=s(".saswp-add-rv-loop[data-type="+a+"]").length,i=t/10+1;s("#saswp-add-rv-automatic .spinner").addClass("is-active"),e.preventDefault(),s.get(ajaxurl,{action:"saswp_get_reviews_on_load",data_type:a,offset:t,paged:i,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){var t="";e.result&&(s.each(e.result,function(s,e){var i="";"review"==a&&saswp_attached_rv.includes(parseInt(e.saswp_review_id))&&(i="checked"),"collection"==a&&saswp_attached_col.includes(parseInt(e.saswp_review_id))&&(i="checked"),t+='<div class="saswp-add-rv-loop" data-type="'+a+'" data-id="'+e.saswp_review_id+'">',"review"==a&&(t+='<input class="saswp-attach-rv-checkbox" type="checkbox" '+i+"> <strong> "+e.saswp_reviewer_name+" ( Rating - "+e.saswp_review_rating+' ) <span class="saswp-g-plus"><img src="'+e.saswp_review_platform_icon+'"/></span></strong>'),"collection"==a&&(t+='<input class="saswp-attach-rv-checkbox" type="checkbox" '+i+"> <strong> "+e.saswp_reviewer_name+" </strong>"),t+="</div>"}),s(".saswp-add-rv-automatic-list[data-type="+a+"]").append(t)),e.message&&(s(".saswp-rv-not-found[data-type="+a+"]").removeClass("saswp_hide"),s(".saswp-load-more-rv[data-type="+a+"]").addClass("saswp_hide"))}else alert(e.message);s("#saswp-add-rv-automatic .spinner").removeClass("is-active")},"json")}),s(".saswp-modify-schema-toggle").click(function(e){e.preventDefault(),s(".saswp-modify-container").slideToggle("300");var a=s("#saswp_enable_custom_field"),t=a.val();a.val("1"===t?"0":"1"),s(".saswp-enable-modify-schema-output").change()}),s(".saswp-enable-itemlist").change(function(){s(this).is(":checked")?(s("#saswp_item_list_tags").show(),s(".saspw-item-list-note").show(),"custom"==s("#saswp_item_list_tags").val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()):(s(".saspw-item-list-note").hide(),s("#saswp_item_list_tags").hide(),s("#saswp_item_list_custom").hide())}),s("#saswp_item_list_tags").change(function(){"custom"==s(this).val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()}),s(document).on("click",".saswp-add-g-location-btn",function(e){var a="";a=s("#saswp_google_place_api_key").length?'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="5" step="5" placeholder="5" disabled="disabled">':'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="10" step="10" placeholder="10">',e.preventDefault();var t="";(t+='<tr><td style="width:12%;"><strong>'+saswp_localize_data.translable_txt.place_id+'</strong></td><td style="width:20%;"><input class="saswp-g-location-field" name="sd_data[saswp_reviews_location_name][]" type="text" value=""></td><td style="width:10%;"><strong>'+saswp_localize_data.translable_txt.reviews+'</strong></td><td style="width:10%;">'+a+'</td><td style="width:10%;"><a class="button button-default saswp-fetch-g-reviews">'+saswp_localize_data.translable_txt.fetch+'</a></td><td style="width:10%;"><a type="button" class="saswp-remove-review-item button">x</a></td><td style="width:10%;"><p class="saswp-rv-fetched-msg"></p></td></tr>')&&s(".saswp-g-reviews-settings-table").append(t)}),s(document).on("click",".saswp-fetch-g-reviews",function(){var e=s(this),a="free";e.addClass("updating-message");var t=s(this).parent().parent().find(".saswp-g-location-field").val(),i=s(this).parent().parent().find(".saswp-g-blocks-field").val(),p=s("#saswp_google_place_api_key").val(),o=s("#reviews_addon_license_key").val(),c=s("#reviews_addon_license_key_status").val();if("premium"==(a=s("#saswp_google_place_api_key").length?"free":"premium")){if(!(i>0))return alert(saswp_localize_data.translable_txt.blocks_zero),e.removeClass("updating-message"),!1;if(0!=i%10)return e.parent().parent().find(".saswp-rv-fetched-msg").text(saswp_localize_data.translable_txt.step_in),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b"),e.removeClass("updating-message"),!1}""!=t&&(o||p)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_fetch_google_reviews",reviews_api_status:c,reviews_api:o,location:t,blocks:i,g_api:p,premium_status:a,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){"t"==s.status?(e.parent().parent().find(".saswp-rv-fetched-msg").text(saswp_localize_data.translable_txt.success),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","green")):(e.parent().parent().find(".saswp-rv-fetched-msg").text(s.message),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b")),e.removeClass("updating-message")},error:function(s){console.log(s)}}):(""==t&&alert(saswp_localize_data.translable_txt.enter_place_id),""==p&&alert(saswp_localize_data.translable_txt.enter_api_key),""==o&&alert(saswp_localize_data.translable_txt.enter_rv_api_key),e.removeClass("updating-message"))}),saswp_localize_data.do_tour){var e,a="<h3>"+saswp_localize_data.translable_txt.using_schema+"</h3>";a+="<p>"+saswp_localize_data.translable_txt.do_you_want+" <b>"+saswp_localize_data.translable_txt.sd_update+"</b> "+saswp_localize_data.translable_txt.before_others+"</p>",a+='<style type="text/css">',a+=".wp-pointer-buttons{ padding:0; overflow: hidden; }",a+=".wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #0085ba;} .wp-pointer-content .button-primary{ display:none} #saswp_mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }",a+="</style>",a+='<div id="saswp_mc_embed_signup">',a+='<form method="POST" accept-charset="utf-8" id="saswp-news-letter-form">',a+='<div id="saswp_mc_embed_signup_scroll">',a+='<div class="saswp-mc-field-group" style=" margin-left: 15px; width: 195px; float: left;">',a+='<input type="text" name="saswp_subscriber_name" class="form-control" placeholder="Name" hidden value="'+saswp_localize_data.current_user_name+'" style="display:none">',a+='<input type="text" value="'+saswp_localize_data.current_user_email+'" name="saswp_subscriber_email" class="form-control" placeholder="Email*" style=" width: 180px; padding: 6px 5px;">',a+='<input type="text" name="saswp_subscriber_website" class="form-control" placeholder="Website" hidden style=" display:none; width: 168px; padding: 6px 5px;" value="'+saswp_localize_data.get_home_url+'">',a+='<input type="hidden" name="ml-submit" value="1" />',a+="</div>",a+='<div id="mce-responses">',a+="</div>",a+='<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_a631df13442f19caede5a5baf_c9a71edce6" tabindex="-1" value=""></div>',a+='<input type="submit" value="Subscribe" name="subscribe" id="pointer-close" class="button mc-newsletter-sent" style=" background: #0085ba; border-color: #006799; padding: 0px 16px; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px; margin-top: 1px; color: #fff; box-shadow: 0 1px 0 #006799;">',a+='<p id="saswp-news-letter-status"></p>',a+="</div>",a+="</form>",a+="</div>",s(document).on("submit","#saswp-news-letter-form",function(e){e.preventDefault();var a=s(this),t=a.find('input[name="saswp_subscriber_name"]').val(),i=a.find('input[name="saswp_subscriber_email"]').val();website=a.find('input[name="saswp_subscriber_website"]').val(),s.post(saswp_localize_data.ajax_url,{action:"saswp_subscribe_to_news_letter",saswp_security_nonce:saswp_localize_data.saswp_security_nonce,name:t,email:i,website:website},function(e){e?"Some fields are missing."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):"Invalid email address."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):"Invalid list ID."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):"Already subscribed."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):(s("#saswp-news-letter-status").text("You're subscribed!"),s("#saswp-news-letter-status").css("color","green")):alert("Sorry, unable to subscribe. Please try again later!")})});var t={content:a,position:{edge:"top",align:"left"}};e=function(){s(saswp_localize_data.displayID).pointer(t).pointer("open"),saswp_localize_data.button2&&(jQuery("#pointer-close").after('<a id="pointer-primary" class="button-primary">'+saswp_localize_data.button2+"</a>"),jQuery("#pointer-primary").click(function(){saswp_localize_data.function_name}),jQuery("#pointer-close").click(function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})}))},(t=s.extend(t,{buttons:function(s,e){return button=jQuery('<a id="pointer-close" class="button-secondary">'+saswp_localize_data.button1+"</a>"),button_2=jQuery("#pointer-close.button"),button.bind("click.pointer",function(){e.element.pointer("close")}),button_2.on("click",function(){setTimeout(function(){e.element.pointer("close")},3e3)}),button},close:function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})},show:function(s,e){e.pointer.css({left:"170px",top:"160px"})}})).position&&t.position.defer_loading?s(window).bind("load.wp-pointers",e):e()}if(s(".saswp-tabs a").click(function(e){var a=s(this).attr("href"),t=getParameterByName("tab",a);return t||(t="general"),s(this).siblings().removeClass("nav-tab-active"),s(this).addClass("nav-tab-active"),s(".form-wrap").find(".saswp-"+t).siblings().hide(),s(".form-wrap .saswp-"+t).show(),window.history.pushState("","",a),!1}),s(".saswp-schame-type-select").select2(),s(".saswp-schame-type-select").change(function(e){e.preventDefault(),s(".saswp-custom-fields-table").html("");var a=s(this).val();s(".saswp-option-table-class tr").each(function(e,a){e>0&&s(this).hide()}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"Organization"==a||"CreativeWorkSeries"==a||"MobileApplication"==a||"ImageObject"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a||"Review"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-option-table-class tr").eq(1).show(),s(".saswp-business-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".select-post-type").val("show_globally").trigger("change")),"Service"==a&&(s(".saswp-service-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".saswp-item-reivewed-list").change()),"ItemList"==a?(s(".saswp-schema-modify-section").hide(),s(".saswp-itemlist-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".saswp-itemlist-item-type-list").change()):s(".saswp-schema-modify-section").show(),saswp_enable_rating_review(),s(".saswp-manual-modification").html(""),s(".saswp-static-container .spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_manual_fields_on_ajax",schema_type:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){s(".saswp-static-container .spinner").removeClass("is-active"),s(".saswp-manual-modification").append(e),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_item_reviewed_call()}),"HowTo"==a||"local_business"==a||"FAQ"==a?s(".saswp-enable-modify-schema").show():(s(".saswp-enable-modify-schema-output").val("automatic"),s(".saswp-enable-modify-schema-output").change(),s(".saswp-enable-modify-schema").hide())}),s("#saswp_business_type").select2(),s(".saswp-local-sub-type-2").select2(),s("#saswp_business_type").change(function(){var e=s(this).val(),a=s(".saswp-schame-type-select").val();s(".saswp-option-table-class tr").each(function(e,a){e>1&&(s(this).hide(),s(this).find(".saswp-local-sub-type-2").attr("disabled",!0))}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"Organization"==a||"CreativeWorkSeries"==a||"MobileApplication"==a||"ImageObject"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a||"Review"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-"+e+"-tr").show(),s(".saswp-business-text-field-tr").show(),s(".saswp-"+e+"-tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-review-text-field-tr").find("select").attr("disabled",!1)),"ItemList"==a?(s(".saswp-schema-modify-section").hide(),s(".saswp-itemlist-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)):s(".saswp-schema-modify-section").show(),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),saswp_enable_rating_review()}).change(),s(".saswp-checkbox").change(function(){var e=s(this).attr("id"),a=s(this);switch(e){case"saswp-the-seo-framework-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-seo-framework").val(1):s("#saswp-the-seo-framework").val(0);break;case"saswp-seo-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-seo-press").val(1):s("#saswp-seo-press").val(0);break;case"saswp-aiosp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-aiosp").val(1):s("#saswp-aiosp").val(0);break;case"saswp-smart-crawl-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-smart-crawl").val(1):s("#saswp-smart-crawl").val(0);break;case"saswp-squirrly-seo-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-squirrly-seo").val(1):s("#saswp-squirrly-seo").val(0);break;case"saswp-wp-recipe-maker-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-recipe-maker").val(1):s("#saswp-wp-recipe-maker").val(0);break;case"saswp-wp-ultimate-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-ultimate-recipe").val(1):s("#saswp-wp-ultimate-recipe").val(0);break;case"saswp-zip-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-zip-recipes").val(1):s("#saswp-zip-recipes").val(0);break;case"saswp-mediavine-create-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-mediavine-create").val(1):s("#saswp-mediavine-create").val(0);break;case"saswp-ht-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ht-recipes").val(1):s("#saswp-ht-recipes").val(0);break;case"saswp-wpsso-core-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpsso-core").val(1):s("#saswp-wpsso-core").val(0);break;case"saswp-for-wordpress-checkbox":s(this).is(":checked")?s("#saswp-for-wordpress").val(1):s("#saswp-for-wordpress").val(0);break;case"saswp-for-amp-checkbox":s(this).is(":checked")?s("#saswp-for-amp").val(1):s("#saswp-for-amp").val(0);break;case"saswp_kb_contact_1_checkbox":s(this).is(":checked")?(s("#saswp_kb_contact_1").val(1),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").removeClass("saswp-display-none")):(s("#saswp_kb_contact_1").val(0),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").addClass("saswp-display-none"));break;case"saswp-logo-dimensions-check":s(this).is(":checked")?(s("#saswp-logo-dimensions").val(1),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").show()):(s("#saswp-logo-dimensions").val(0),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").hide());break;case"saswp_archive_schema_checkbox":s(this).is(":checked")?(s("#saswp_archive_schema").val(1),s(".saswp_archive_schema_type_class").parent().parent().show()):(s("#saswp_archive_schema").val(0),s(".saswp_archive_schema_type_class").parent().parent().hide());break;case"saswp_website_schema_checkbox":s(this).is(":checked")?(s("#saswp_website_schema").val(1),s("#saswp_search_box_schema").parent().parent().show()):(s("#saswp_website_schema").val(0),s("#saswp_search_box_schema").parent().parent().hide());break;case"saswp_search_box_schema_checkbox":s(this).is(":checked")?s("#saswp_search_box_schema").val(1):s("#saswp_search_box_schema").val(0);break;case"saswp_breadcrumb_schema_checkbox":s(this).is(":checked")?s("#saswp_breadcrumb_schema").val(1):s("#saswp_breadcrumb_schema").val(0);break;case"saswp_comments_schema_checkbox":s(this).is(":checked")?s("#saswp_comments_schema").val(1):s("#saswp_comments_schema").val(0);break;case"saswp-compativility-checkbox":s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-review-module-checkbox":s(this).is(":checked")?s("#saswp-review-module").val(1):s("#saswp-review-module").val(0);break;case"saswp-stars-rating-checkbox":s(this).is(":checked")?(s(".saswp-stars-post-table").removeClass("saswp_hide"),s("#saswp-stars-rating").val(1)):(s(".saswp-stars-post-table").addClass("saswp_hide"),s("#saswp-stars-rating").val(0));break;case"saswp-kk-star-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-kk-star-raring").val(1):s("#saswp-kk-star-raring").val(0);break;case"saswp-yet-another-stars-rating-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-yet-another-stars-rating").val(1):s("#saswp-yet-another-stars-rating").val(0);break;case"saswp-simple-author-box-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-simple-author-box").val(1):s("#saswp-simple-author-box").val(0);break;case"saswp-woocommerce-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce").val(1):s("#saswp-woocommerce").val(0);break;case"saswp-default-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp_default_review").val(1):s("#saswp_default_review").val(0);break;case"saswp-extra-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-extra").val(1):s("#saswp-extra").val(0);break;case"saswp-soledad-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-soledad").val(1):s("#saswp-soledad").val(0);break;case"saswp-wp-theme-reviews-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-theme-reviews").val(1):s("#saswp-wp-theme-reviews").val(0);break;case"saswp-dw-question-answer-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-dw-question-answer").val(1):s("#saswp-dw-question-answer").val(0);break;case"saswp-wp-job-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-job-manager").val(1):s("#saswp-wp-job-manager").val(0);break;case"saswp-yoast-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-yoast").val(1):s("#saswp-yoast").val(0);break;case"saswp-rankmath-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-rankmath").val(1):s("#saswp-rankmath").val(0);break;case"saswp-taqyeem-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-taqyeem").val(1):s("#saswp-taqyeem").val(0);break;case"saswp-the-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-events-calendar").val(1):s("#saswp-the-events-calendar").val(0);break;case"saswp-homeland-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-homeland").val(1):s("#saswp-homeland").val(0);break;case"saswp-wpresidence-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpresidence").val(1):s("#saswp-wpresidence").val(0);break;case"saswp-myhome-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-myhome").val(1):s("#saswp-myhome").val(0);break;case"saswp-realestate-5-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-realestate-5").val(1):s("#saswp-realestate-5").val(0);break;case"saswp-classipress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-classipress").val(1):s("#saswp-classipress").val(0);break;case"saswp-realhomes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-realhomes").val(1):s("#saswp-realhomes").val(0);break;case"saswp-learn-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-press").val(1):s("#saswp-learn-press").val(0);break;case"saswp-wplms-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wplms").val(1):s("#saswp-wplms").val(0);break;case"saswp-learn-dash-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-dash").val(1):s("#saswp-learn-dash").val(0);break;case"saswp-lifter-lms-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-lifter-lms").val(1):s("#saswp-lifter-lms").val(0);break;case"saswp-wp-event-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-manager").val(1):s("#saswp-wp-event-manager").val(0);break;case"saswp-events-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-events-manager").val(1):s("#saswp-events-manager").val(0);break;case"saswp-event-calendar-wd-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-calendar-wd").val(1):s("#saswp-event-calendar-wd").val(0);break;case"saswp-event-organiser-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-organiser").val(1):s("#saswp-event-organiser").val(0);break;case"saswp-modern-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-modern-events-calendar").val(1):s("#saswp-modern-events-calendar").val(0);break;case"saswp-woocommerce-booking-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking").val(1),s("#saswp-woocommerce-booking-main").val(1)):(s("#saswp-woocommerce-booking").val(0),s("#saswp-woocommerce-booking-main").val(0));break;case"saswp-woocommerce-booking-main-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking-main").val(1),s("#saswp-woocommerce-booking").val(1)):(s("#saswp-woocommerce-booking-main").val(0),s("#saswp-woocommerce-booking").val(0));break;case"saswp-woocommerce-membership-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce-membership").val(1):s("#saswp-woocommerce-membership").val(0);break;case"saswp-defragment-checkbox":s(this).is(":checked")?s("#saswp-defragment").val(1):s("#saswp-defragment").val(0);break;case"saswp-cooked-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-cooked").val(1):s("#saswp-cooked").val(0);break;case"saswp-flexmlx-compativility-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-shopper-approved-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-shopper-approved-review").val(1),s(".saswp-s-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-shopper-approved-review").val(0),s(".saswp-s-reviews-settings-table").parent().parent().parent().hide());break;case"saswp-google-review-checkbox":s(this).is(":checked")?(s("#saswp-google-review").val(1),s("#saswp-google-rv-free-checkbox").length?(s("#saswp-google-review-free").parent().parent().show(),s("#saswp-google-rv-free-checkbox").is(":checked")?s("#saswp_google_place_api_key").parent().parent().show():s("#saswp_google_place_api_key").parent().parent().hide()):s("#saswp_google_place_api_key").parent().parent().show(),s(".saswp-g-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-google-review").val(0),s("#saswp_google_place_api_key").parent().parent().hide(),s(".saswp-g-reviews-settings-table").parent().parent().parent().hide(),s("#saswp-google-rv-free-checkbox").length&&s("#saswp-google-review-free").parent().parent().hide());break;case"saswp-google-rv-free-checkbox":s("#saswp-google-review-checkbox").is(":checked")&&s(this).is(":checked")?(s("#saswp-google-review-free").val(1),s("#saswp_google_place_api_key").parent().parent().show()):(s("#saswp-google-review-free").val(0),s("#saswp_google_place_api_key").parent().parent().hide());break;case"saswp-markup-footer-checkbox":s(this).is(":checked")?s("#saswp-markup-footer").val(1):s("#saswp-markup-footer").val(0);break;case"saswp-pretty-print-checkbox":s(this).is(":checked")?s("#saswp-pretty-print").val(1):s("#saswp-pretty-print").val(0);break;case"saswp-wppostratings-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wppostratings-raring").val(1):s("#saswp-wppostratings-raring").val(0);break;case"saswp-bbpress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-bbpress").val(1):s("#saswp-bbpress").val(0);break;case"saswp-microdata-cleanup-checkbox":s(this).is(":checked")?s("#saswp-microdata-cleanup").val(1):s("#saswp-microdata-cleanup").val(0);break;case"saswp-other-images-checkbox":s(this).is(":checked")?s("#saswp-other-images").val(1):s("#saswp-other-images").val(0);break;case"saswp-rss-feed-image-checkbox":s(this).is(":checked")?s("#saswp-rss-feed-image").val(1):s("#saswp-rss-feed-image").val(0);break;case"saswp-multiple-size-image-checkbox":s(this).is(":checked")?s("#saswp-multiple-size-image").val(1):s("#saswp-multiple-size-image").val(0);break;case"saswp-easy-testimonials-checkbox":s(this).is(":checked")?s("#saswp-easy-testimonials").val(1):s("#saswp-easy-testimonials").val(0);break;case"saswp-testimonial-pro-checkbox":s(this).is(":checked")?s("#saswp-testimonial-pro").val(1):s("#saswp-testimonial-pro").val(0);break;case"saswp-bne-testimonials-checkbox":s(this).is(":checked")?s("#saswp-bne-testimonials").val(1):s("#saswp-bne-testimonials").val(0);break;case"saswp-ampforwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampforwp").val(1):s("#saswp-ampforwp").val(0);break;case"saswp-ampbyautomatic-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampbyautomatic").val(1):s("#saswp-ampbyautomatic").val(0);break;case"saswp-schemaforfaqs-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-schemaforfaqs").val(1):s("#saswp-schemaforfaqs").val(0);break;case"saswp-wp-customer-reviews-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-customer-reviews").val(1):s("#saswp-wp-customer-reviews").val(0);break;case"saswp-total-recipe-generator-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-total-recipe-generator").val(1):s("#saswp-total-recipe-generator").val(0);break;case"saswp-wordpress-news-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wordpress-news").val(1):s("#saswp-wordpress-news").val(0);break;case"saswp-ampwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampwp").val(1):s("#saswp-ampwp").val(0);break;case"saswp-wp-event-aggregator-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-aggregator").val(1):s("#saswp-wp-event-aggregator").val(0);break;case"saswp-stachethemes-event-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-stachethemes-event-calendar").val(1):s("#saswp-stachethemes-event-calendar").val(0);break;case"saswp-all-in-one-event-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-all-in-one-event-calendar").val(1):s("#saswp-all-in-one-event-calendar").val(0);break;case"saswp-event-on-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-on").val(1):s("#saswp-event-on").val(0);break;case"saswp-easy-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-easy-recipe").val(1):s("#saswp-easy-recipe").val(0);break;case"saswp-tevolution-events-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-tevolution-events").val(1):s("#saswp-tevolution-events").val(0);break;case"saswp-strong-testimonials-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-strong-testimonials").val(1):s("#saswp-strong-testimonials").val(0);break;case"saswp-wordlift-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wordlift").val(1):s("#saswp-wordlift").val(0);break;case"saswp-betteramp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-betteramp").val(1):s("#saswp-betteramp").val(0);break;case"saswp-wpamp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpamp").val(1):s("#saswp-wpamp").val(0)}}).change(),s("#saswp_kb_type").change(function(){var e=s(this).val();s(".saswp_org_fields, .saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().addClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide"),"Organization"==e&&(s(".saswp_org_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide")),"Person"==e&&(s(".saswp_org_fields").parent().parent().addClass("saswp_hide"),s(".saswp_person_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().removeClass("saswp_hide"))}).change(),s(document).on("click","input[data-id=media]",function(e){e.preventDefault();var a=s(this),t=a.attr("id").replace("_button",""),i=wp.media({title:"Application Icon",button:{text:"Select Icon"},multiple:!1,library:{type:"image"}}).on("select",function(){var e=i.state().get("selection").first().toJSON();s("#"+t).val(e.url),s("input[data-id='"+t+"_id']").val(e.id),s("input[data-id='"+t+"_height']").val(e.height),s("input[data-id='"+t+"_width']").val(e.width),s("input[data-id='"+t+"_thumbnail']").val(e.url),"sd_default_image_button"===a.attr("id")&&(s("#sd_default_image_width").val(e.width),s("#sd_default_image_height").val(e.height));var p="";"saswp_image_div_"+t=="saswp_image_div_sd_default_image"&&e.height<1200&&(p='<p class="saswp_warning">Image size is smaller than recommended size</p>'),s(".saswp_image_div_"+t).html('<div class="saswp_image_thumbnail"><img class="saswp_image_prev" src="'+e.url+'"/><a data-id="'+t+'" href="#" class="saswp_prev_close">X</a></div>'+p)}).open()}),s(document).on("click",".saswp_prev_close",function(e){e.preventDefault();var a=s(this).attr("data-id");s(this).parent().remove(),s("#"+a).val(""),s("input[data-id='"+a+"_id']").val(""),s("input[data-id='"+a+"_height']").val(""),s("input[data-id='"+a+"_width']").val(""),s("input[data-id='"+a+"_thumbnail']").val(""),"sd_default_image"===a&&(s("#sd_default_image_width").val(""),s("#sd_default_image_height").val(""))}),s(document).on("click",".saswp-modify-schema",function(e){e.preventDefault();var a=s(this).attr("schema-id"),t=s(this);t.addClass("updating-message"),s.get(ajaxurl,{action:"saswp_modify_schema_post_enable",schema_id:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){s(".saswp-post-specific-wrapper[data-id="+a+"] .saswp-post-specific-setting").after(e),s(".saswp_modify_this_schema_hidden_"+a).val(1),s(".saswp-ps-toggle[schema-id="+a+"]").removeClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().removeClass("saswp_hide"),s(".saswp-modify-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),t.removeClass("updating-message"),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_enable_rating_review(),saswp_item_reviewed_call()})}),s(document).on("click",".saswp-restore-schema",function(e){e.preventDefault();var a=s(this).attr("schema-id"),t=s(this);t.addClass("updating-message"),s.post(ajaxurl,{action:"saswp_modify_schema_post_restore",schema_id:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){t.removeClass("updating-message"),"t"==e.status?(s(".saswp_modify_this_schema_hidden_"+a).val(0),s(".saswp-restore-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),s(".saswp-modify-schema[schema-id="+a+"]").parent().removeClass("saswp_hide"),s(".saswp-ps-toggle[schema-id="+a+"]").remove()):alert("Something went wrong")},"json")}),s(document).on("change",".saswp-schema-type-toggle",function(e){var a=s(this).attr("data-schema-id"),t=s(this).attr("data-post-id"),i=s(".saswp_modify_this_schema_hidden_"+a).val();if(s(this).is(":checked")){var p=0;s(".saswp-ps-toggle[schema-id="+a+"]").addClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),s(".saswp-modify-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),s("#saswp_custom_schema_field[schema-id="+a+"]").parent().addClass("saswp_hide")}else{s("#saswp_custom_schema_field[schema-id="+a+"]").parent().removeClass("saswp_hide"),1==i?(s(".saswp-ps-toggle[schema-id="+a+"]").removeClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().removeClass("saswp_hide")):(s(".saswp-modify-schema[schema-id="+a+"]").parent().removeClass("saswp_hide"),s(".saswp-ps-toggle[schema-id="+a+"]").addClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().addClass("saswp_hide"));p=1}s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_enable_disable_schema_on_post",status:p,schema_id:a,post_id:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-reset-data",function(e){e.preventDefault(),1==confirm("Are you sure?")&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_reset_all_settings",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){setTimeout(function(){location.reload()},1e3)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp_license_activation",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("license-status"),i=s(this).attr("add-on"),p=s("#"+i+"_addon_license_key").val();t&&i&&p?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_license_status_check",license_key:p,license_status:t,add_on:i,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){s("#"+i+"_addon_license_key_status").val(e.status),"active"==e.status?(s(".saswp-"+i+"-dashicons").addClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").css("color","green"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","inactive"),s(".saswp_license_activation[add-on='"+i+"']").text("Deactivate"),s(".saswp_license_status_msg[add-on='"+i+"']").text("Activated"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","green"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)):(s(".saswp-"+i+"-dashicons").addClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").css("color","red"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","active"),s(".saswp_license_activation[add-on='"+i+"']").text("Activate"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","red"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)),a.removeClass("updating-message")},error:function(s){console.log(s)}}):(alert("Please enter value license key"),a.removeClass("updating-message"))}),s(".saswp-send-query").on("click",function(e){e.preventDefault();var a=s("#saswp_query_message").val(),t=s("#saswp_query_email").val(),i=s("#saswp_query_premium_cus").val();console.log(saswpIsEmail(t)),""!=s.trim(a)&&i&&""!=s.trim(t)&&1==saswpIsEmail(t)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_send_query_message",premium_cus:i,message:a,email:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){"t"==e.status?(s(".saswp-query-success").show(),s(".saswp-query-error").hide()):(s(".saswp-query-success").hide(),s(".saswp-query-error").show())},error:function(s){console.log(s)}}):""==s.trim(a)&&""==i&&""==s.trim(t)?alert("Please enter the message, email and select customer type"):(""==i&&alert("Select Customer type"),""==s.trim(a)&&alert("Please enter the message"),""==s.trim(t)&&alert("Please enter the email"),0==saswpIsEmail(t)&&alert("Please enter a valid email"))}),s(".saswp-import-plugins").on("click",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id");s.get(ajaxurl,{action:"saswp_import_plugin_data",plugin_name:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status?(s(a).parent().find(".saswp-imported-message").text(e.message),s(a).parent().find(".saswp-imported-message").removeClass("saswp-error"),setTimeout(function(){location.reload()},2e3)):(s(a).parent().find(".saswp-imported-message").addClass("saswp-error"),s(a).parent().find(".saswp-imported-message").text(e.message)),a.removeClass("updating-message")},"json")}),s(".saswp-feedback-no-thanks").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_no_thanks",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(".saswp-feedback-remindme").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_remindme",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(document).on("change",".saswp-local-business-type-select",function(e){e.preventDefault();var a=s(this),t=s(this).val();s.get(ajaxurl,{action:"saswp_get_sub_business_ajax",business_type:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){s(".saswp-local-business-name-select").parents("tr").remove();var t=a.parents(".saswp-post-specific-wrapper").attr("data-id"),i='<tr><th><label for="saswp_business_name_'+t+'">Sub Business Type</label></th>';i+='<td><select class="saswp-local-business-name-select" id="saswp_business_name_'+t+'" name="saswp_business_name_'+t+'">',s.each(e.result,function(s,e){i+='<option value="'+s+'">'+e+"</option>"}),i+="</select></td>",i+="</tr>",a.parents(".form-table tr:first").after(i)}else s(".saswp-local-business-name-select").parents("tr").remove()},"json")}),saswp_item_reviewed_call(),jQuery(".saswp-local-schema-time-picker").timepicker({timeFormat:"H:i:s"}),s(document).on("click",".saswp-add-custom-schema",function(e){e.preventDefault(),s(".saswp-add-custom-schema-field").removeClass("saswp_hide"),s(this).hide()}),s(document).on("click",".saswp-delete-custom-schema",function(e){e.preventDefault(),s("#saswp_custom_schema_field").val(""),s(".saswp-add-custom-schema-field").addClass("saswp_hide"),s(".saswp-add-custom-schema").show()}),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_reviews_datepicker(),s(document).on("click",".saswp-add-more-item",function(e){e.preventDefault();s(".saswp-review-item-list-table").append('<tr class="saswp-review-item-tr"><td>Review Item Feature</td><td><input type="text" name="saswp-review-item-feature[]"></td><td>Rating</td><td><input step="0.1" min="0" max="5" type="number" name="saswp-review-item-star-rating[]"></td><td><a type="button" class="saswp-remove-review-item button">x</a></td></tr>')}),s(document).on("click",".saswp-remove-review-item",function(e){e.preventDefault(),s(this).parent().parent("tr").remove()}),s(document).on("focusout",".saswp-review-item-tr input[type=number]",function(e){e.preventDefault();var a=0,t=s(".saswp-review-item-tr input[type=number]").length;s(".saswp-review-item-tr input[type=number]").each(function(e,t){""==s(t).val()?a+=parseFloat(0):a+=parseFloat(s(t).val())});var i=a/t;s("#saswp-review-item-over-all").val(i)}),s("#saswp-review-location").change(function(){var e=s(this).val();s(".saswp-review-shortcode").addClass("saswp_hide"),3==e&&s(".saswp-review-shortcode").removeClass("saswp_hide")}).change(),s("#saswp-review-item-enable").change(function(){s(this).is(":checked")?s(".saswp-review-fields").show():s(".saswp-review-fields").hide()}).change(),s(document).on("click",".saswp-restore-post-schema",function(e){e.preventDefault();var a=s(this);if(a.addClass("updating-message"),s(".saswp-post-specific-schema-ids").val())var t=JSON.parse(s(".saswp-post-specific-schema-ids").val());s.post(ajaxurl,{action:"saswp_restore_schema",schema_ids:t,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){"t"==s.status?setTimeout(function(){location.reload()},1e3):(alert(s.msg),setTimeout(function(){location.reload()},1e3)),a.removeClass("updating-message")},"json")}),s(document).on("click","div.saswp-tab ul.saswp-tab-nav a",function(e){e.preventDefault();var a=s(this).attr("data-id");s(".saswp-post-specific-wrapper").hide(),s("#"+a).show(),s("div.saswp-tab ul.saswp-tab-nav a").removeClass("selected"),s("div.saswp-tab ul.saswp-tab-nav li").removeClass("selected"),s(this).addClass("selected"),s(this).parent().addClass("selected"),saswp_enable_rating_review()}),s("#saswp-global-tabs a:first").addClass("saswp-global-selected"),s(".saswp-global-container").hide(),"#saswp-default-container"==window.location.hash?s(".saswp-global-container:eq(2)").show():s(".saswp-global-container:first").show(),s("#saswp-global-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-global-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-global-container").hide(),s("#"+e).show())}),s("#saswp-tools-tabs a:first").addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s(".saswp-tools-container:first").show(),s("#saswp-tools-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-tools-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s("#"+e).show())}),s("#saswp-review-tabs a:first").addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s(".saswp-review-container:first").show(),s("#saswp-review-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-review-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s("#"+e).show())}),s("#saswp-compatibility-tabs a:first").addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s(".saswp-compatibility-container:first").show(),s("#saswp-compatibility-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-compatibility-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s("#"+e).show())}),s('a[href="'+saswp_localize_data.new_url_selector+'"]').attr("href",saswp_localize_data.new_url_href),s(".saswp-enable-modify-schema-output").on("change",function(){s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide"),"manual"==s(this).val()&&(s(".saswp-static-container").removeClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide")),"automatic"==s(this).val()&&(s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").removeClass("saswp_hide"))}),s(document).on("change",".saswp-custom-fields-name",function(){var e="text",a=s(this).parent().parent("tr"),t=s(this).val();-1==t.indexOf("_image")&&-1==t.indexOf("_logo")||(e="image");var i=s(this).parent().parent("tr").find("td:eq(1)");saswp_get_meta_list(null,e,null,i,t,a)}),s(document).on("click",".saswp-skip-button",function(e){e.preventDefault(),s(this).parent().parent().hide(),s.post(ajaxurl,{action:"saswp_skip_wizard",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){},"json")}),s(document).on("click",".saswp_add_schema_fields_on_fly",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id"),i=s(this).attr("fields_type"),p=s(this).attr("div_type"),o=s(this).attr("itemlist_sub_type"),c=s("saswp_specific_"+t+" , .saswp-"+p+"-table-div").length,n=s("saswp_specific_"+t+" , .saswp-"+p+"-table-div:nth-child("+c+")").attr("data-id");(n=++n)||(n=0),saswp_get_post_specific_schema_fields(a,n,i,p,t,i+"_",o)}),s(document).on("click",".saswp-table-close",function(){s(this).parent().remove()}),s(document).on("click",".saswp-rmv-modify_row",function(e){e.preventDefault(),s(this).parent().parent().remove()}),s(document).on("change",".saswp-custom-meta-list",function(){var e=s(this),a=s("select#schema_type option:selected").val(),t=s(this).val(),i=s(this).parent().parent("tr").find(".saswp-custom-fields-name").val(),p="",o=a.toLowerCase()+"_"+i,c="saswp_fixed_image["+i+"]";"manual_text"==t?(p+='<td><input type="text" name="saswp_fixed_text['+i+']"></td>',p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):"taxonomy_term"==t?saswp_taxonomy_term.taxonomy?(p+=saswp_taxonomy_term_html(saswp_taxonomy_term.taxonomy,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(p),saswpCustomSelect2()):s.get(ajaxurl,{action:"saswp_get_taxonomy_term_list",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){s&&(saswp_taxonomy_term.taxonomy=s,p+=saswp_taxonomy_term_html(s,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(p),saswpCustomSelect2())},"json"):"custom_field"==t?(p+='<td><select class="saswp-custom-fields-select2" name="saswp_custom_meta_field['+i+']">',p+="</select></td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):"fixed_image"==t?(p+="<td>",p+="<fieldset>",p+='<input data-id="media" style="width: 30%;" class="button" id="'+o+'_button" name="'+o+'_button" type="button" value="Upload" />',p+='<input type="hidden" data-id="'+o+'_height" class="upload-height" name="'+c+'[height]" id="'+o+'_height" value="">',p+='<input type="hidden" data-id="'+o+'_width" class="upload-width" name="'+c+'[width]" id="'+o+'_width" value="">',p+='<input type="hidden" data-id="'+o+'_thumbnail" class="upload-thumbnail" name="'+c+'[thumbnail]" id="'+o+'_thumbnail" value="">',p+='<div class="saswp_image_div_'+o+'">',p+="</div>",p+="</fieldset>",p+="</td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):(p+="<td></td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2())}),s(document).on("change",".saswp-item-reivewed-list",function(){s(".saswp-custom-fields-table").html(""),saswp_meta_list_fields=[];var e=s(this),a=s("select#schema_type option:selected").val();saswp_item_reviewed_ajax(a,e,"manual")}),s(document).on("click",".saswp-add-custom-fields",function(){var e=s(this);e.addClass("updating-message");var a=s("select#schema_type option:selected").val(),t="",i=null;"Review"==a&&(t=s("select.saswp-item-reivewed-list option:selected").val(),i="saswp_review_name");var p=s("#post_ID").val();""!=a&&(saswp_meta_list_fields[a]?saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null):s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_get_schema_type_fields",post_id:p,schema_type:a,schema_subtype:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){saswp_meta_list_fields[a]=s,saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null)},error:function(s){console.log(s)}}))}),saswpCustomSelect2(),saswp_enable_rating_review(),s('a[href="'+saswp_localize_data.collection_post_add_url+'"]').attr("href",saswp_localize_data.collection_post_add_new_url),s(document).on("click",".saswp_coonect_google_place",function(){var e=s("#saswp_google_place_id").val(),a=s("#saswp_language_list").val(),t=s("#saswp_googel_api").val();""!=e&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_connect_google_place",place_id:e,language:a,google_api:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){console.log(s.status)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-add-social-links",function(){s(".saswp-social-links-table").append('<tr><td><input type="text" placeholder="https://www.facebook.com/profile" name="sd_data[saswp_social_links][]" value=""></td><td><a class="button button-default saswp-rmv-modify_row">X</a></td></tr>')}),s(document).on("click",".saswp-show-accept-rv-popup",function(){tb_show("Reviews Form","#TB_inline??width=600&height=400&inlineId=saswp-accept-reviews-popup"),s(document).find("#TB_window").width(600).height(400).css({top:"100px","margin-top":"0px"})}),("saswp_reviews"==saswp_localize_data.post_type||"saswp-collections"==saswp_localize_data.post_type)&&"edit.php"==saswp_localize_data.page_now){var i='<div class="saswp-custom-post-tab">';i+='<div style="display:none;" id="saswp-accept-reviews-popup">',i+='<div class="saswp-accept-rv-container">',i+="<p>Use Below shortcode to show reviews form in your website. Using this you can accept reviews from your website directly</p>",i+='<div class="saswp-show-form-on-tab"><strong>Simple Form</strong> <input value="[saswp-reviews-form]" type="text" readonly></div>',i+='<div class="saswp-show-form-on-tab"><strong>Show form on button tap</strong> <input value="[saswp-reviews-form onbutton=&quot;1&quot;]" type="text" readonly></div>',i+="</div>",i+="</div>",i+='<h2 class="nav-tab-wrapper">',i+="<a href="+saswp_localize_data.reviews_page_url+' class="nav-tab '+(saswp_localize_data.current_url==saswp_localize_data.reviews_page_url?"saswp-global-selected":"")+'">Reviews</a>',i+="<a href="+saswp_localize_data.collections_page_url+' class="nav-tab '+(saswp_localize_data.current_url==saswp_localize_data.collections_page_url?"saswp-global-selected":"")+'">Collections</a>',i+='<a class="nav-tab saswp-show-accept-rv-popup">Accept Reviews</a>',i+="</h2>",i+="</div>",jQuery(jQuery(".wrap")).prepend(i)}"saswp"==saswp_localize_data.post_type&&"edit.php"==saswp_localize_data.page_now&&jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_localize_data.saswp_settings_url+"' id='' class='page-title-action'>Settings</a>"),"undefined"!=typeof saswp_reviews_data&&(console.log(saswp_reviews_data.rating_val),s(".saswp-rating-div").rateYo({spacing:"5px",rating:saswp_reviews_data.rating_val,readOnly:saswp_reviews_data.readonly,onSet:function(e,a){s(this).next().next().val(e)}}).on("rateyo.change",function(e,a){var t=a.rating;s(this).next().text(t)})),s("#sd-person-phone-number, #saswp_kb_telephone").focusout(function(){var e=s(this);e.parent().find(".saswp-phone-validation").remove();var a=s(this).val();/^\+([0-9]{1,3})\)?[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})$/.test(a)?e.parent().find(".saswp-phone-validation").remove():e.after('<span style="color:red;" class="saswp-phone-validation">Invalid Phone Number</span>')}),saswpCollectionSlider(),s(document).on("click",".saswp-grid-page",function(e){e.preventDefault(),saswp_grid_page=s(this).attr("data-id"),saswp_on_collection_design_change()}),s("#saswp-coll-pagination").change(function(){saswp_grid_page=1,s("#saswp-coll-per-page").parent().addClass("saswp_hide_imp"),s(this).is(":checked")&&s("#saswp-coll-per-page").parent().removeClass("saswp_hide_imp"),saswp_on_collection_design_change()}),s(".saswp-accordion").click(function(){s(this).toggleClass("active"),s(this).next(".saswp-accordion-panel").slideToggle(200)}),s(document).on("click",".saswp-opn-cls-btn",function(){s("#saswp-reviews-cntn").toggle(),s("#saswp-reviews-cntn").is(":visible")?(s(".saswp-onclick-show").css("display","flex"),s(".saswp-onclick-hide").hide(),s(".saswp-open-class").css("width","500px")):(s(".saswp-onclick-show").css("display","none"),s(".saswp-onclick-hide").show(),s(".saswp-open-class").css("width","300px"))}),s(".saswp-collection-display-method").change(function(){"shortcode"==s(this).val()?s(".saswp-collection-shortcode").removeClass("saswp_hide"):s(".saswp-collection-shortcode").addClass("saswp_hide")}).change(),s(document).on("click",".saswp-remove-platform",function(e){e.preventDefault();var a=s(this).attr("platform-id");saswp_collection.splice(a,1),s(this).parent().remove(),saswp_on_collection_design_change()}),s(".saswp-number-change").bind("keyup mouseup",function(){saswp_on_collection_design_change()}),s(".saswp-coll-settings-options").change(function(){saswp_grid_page=1;var e=s(".saswp-collection-desing").val();s(".saswp-coll-options").addClass("saswp_hide"),s(".saswp-collection-lp").css("height","auto"),"grid"==e&&s(".saswp-grid-options").removeClass("saswp_hide"),"gallery"==e&&s(".saswp-slider-options").removeClass("saswp_hide"),"fomo"==e&&(s(".saswp-fomo-options").removeClass("saswp_hide"),s(".saswp-collection-lp").css("height","31px")),"popup"==e&&s(".saswp-collection-lp").css("height","31px"),saswp_on_collection_design_change()}).change(),s(".saswp-add-to-collection").on("click",function(e){e.preventDefault();var a=s(this),t=s("#saswp-plaftorm-list").val(),i=s("#saswp-review-count").val();t&&i>0?(a.addClass("updating-message"),saswp_get_collection_data(i,t,a)):alert("Enter Count")});var p,o,c=s("#saswp_collection_id").val();c&&(s(".spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_collection_platforms",collection_id:c,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if(e.status){var a=e.message;s.each(a,function(s,e){saswp_get_collection_data(e,s,null)})}s(".spinner").removeClass("is-active")},"json")),(p=document.createElement("div")).style.cssText="position:absolute; background:black; color:white; padding:4px 6px;z-index:10000;border-radius:2px; font-size:12px;box-shadow:3px 3px 3px rgba(0,0,0,.4);opacity:0;transition:opacity 0.3s",p.innerHTML="Copied!",document.body.appendChild(p);var n=document.getElementById("motivatebox");n&&n.addEventListener("mouseup",function(s){var e=(s=s||event).target||s.srcElement;"motivate"==e.className&&(!function(s){var e=document.createRange();e.selectNodeContents(s);var a=window.getSelection();a.removeAllRanges(),a.addRange(e)}(e),function(){var s;try{s=document.execCommand("copy")}catch(e){s=!1}return s}()&&function(s){var e=s||event;clearTimeout(o),p.style.left=e.pageX-10+"px",p.style.top=e.pageY+15+"px",p.style.opacity=1,o=setTimeout(function(){p.style.opacity=0},500)}(s))},!1)});
1
+ var saswp_attached_rv=[],saswp_attached_col=[];jQuery(document).ready(function(s){if(saswp_select2(),s(".saswp-upgrade-to-pro").parent().attr({href:"https://structured-data-for-wp.com/pricing/",target:"_blank"}),s(document).on("click",".saswp-attach-reviews",function(){s(".saswp-enable-append-reviews").is(":checked")?(tb_show(saswp_localize_data.translable_txt.attach_review,"#TB_inline??width=615&height=400&inlineId=saswp-embed-code-div"),s(document).find("#TB_window").width(600).height(415).css({top:"200px","margin-top":"0px"}),s(".saswp-attached-rv-count").show()):s(".saswp-attached-rv-count").hide()}),s(".close-attached-reviews-popup").on("click",function(){s("#TB_closeWindowButton").trigger("click")}),s("#saswp_attahced_reviews").val()&&(saswp_attached_rv=JSON.parse(s("#saswp_attahced_reviews").val())),s("#saswp_attached_collection").val()&&(saswp_attached_col=JSON.parse(s("#saswp_attached_collection").val())),s(document).on("click",".saswp-attach-rv-checkbox",function(){var e;e=parseInt(s(this).parent().attr("data-id"));var a=s(this).parent().attr("data-type");s(this).is(":checked")?("review"==a&&saswp_attached_rv.push(e),"collection"==a&&saswp_attached_col.push(e)):("review"==a&&saswp_attached_rv.splice(saswp_attached_rv.indexOf(e),1),"collection"==a&&saswp_attached_col.splice(saswp_attached_col.indexOf(e),1));var t=saswp_attached_rv.length,i=saswp_attached_col.length,p="";t>0&&(p+=t+" Reviews, "),i>0&&(p+=i+" Collection"),p||(p=0),s(".saswp-attached-rv-count").text("Attached "+p),s("#saswp_attahced_reviews").val(JSON.stringify(saswp_attached_rv)),s("#saswp_attached_collection").val(JSON.stringify(saswp_attached_col))}),s(".saswp-load-more-rv").on("click",function(e){var a=s(this).attr("data-type"),t=s(".saswp-add-rv-loop[data-type="+a+"]").length,i=t/10+1;s("#saswp-add-rv-automatic .spinner").addClass("is-active"),e.preventDefault(),s.get(ajaxurl,{action:"saswp_get_reviews_on_load",data_type:a,offset:t,paged:i,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){var t="";e.result&&(s.each(e.result,function(s,e){var i="";"review"==a&&saswp_attached_rv.includes(parseInt(e.saswp_review_id))&&(i="checked"),"collection"==a&&saswp_attached_col.includes(parseInt(e.saswp_review_id))&&(i="checked"),t+='<div class="saswp-add-rv-loop" data-type="'+a+'" data-id="'+e.saswp_review_id+'">',"review"==a&&(t+='<input class="saswp-attach-rv-checkbox" type="checkbox" '+i+"> <strong> "+e.saswp_reviewer_name+" ( Rating - "+e.saswp_review_rating+' ) <span class="saswp-g-plus"><img src="'+e.saswp_review_platform_icon+'"/></span></strong>'),"collection"==a&&(t+='<input class="saswp-attach-rv-checkbox" type="checkbox" '+i+"> <strong> "+e.saswp_reviewer_name+" </strong>"),t+="</div>"}),s(".saswp-add-rv-automatic-list[data-type="+a+"]").append(t)),e.message&&(s(".saswp-rv-not-found[data-type="+a+"]").removeClass("saswp_hide"),s(".saswp-load-more-rv[data-type="+a+"]").addClass("saswp_hide"))}else alert(e.message);s("#saswp-add-rv-automatic .spinner").removeClass("is-active")},"json")}),s(".saswp-modify-schema-toggle").click(function(e){e.preventDefault(),s(".saswp-modify-container").slideToggle("300");var a=s("#saswp_enable_custom_field"),t=a.val();a.val("1"===t?"0":"1"),s(".saswp-enable-modify-schema-output").change()}),s(".saswp-enable-itemlist").change(function(){s(this).is(":checked")?(s("#saswp_item_list_tags").show(),s(".saspw-item-list-note").show(),"custom"==s("#saswp_item_list_tags").val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()):(s(".saspw-item-list-note").hide(),s("#saswp_item_list_tags").hide(),s("#saswp_item_list_custom").hide())}),s("#saswp_item_list_tags").change(function(){"custom"==s(this).val()?s("#saswp_item_list_custom").show():s("#saswp_item_list_custom").hide()}),s(document).on("click",".saswp-add-g-location-btn",function(e){var a="";a=s("#saswp_google_place_api_key").length?'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="5" step="5" placeholder="5" disabled="disabled">':'<input class="saswp-g-blocks-field" name="sd_data[saswp_reviews_location_blocks][]" type="number" min="10" step="10" placeholder="10">',e.preventDefault();var t="";(t+='<tr><td style="width:12%;"><strong>'+saswp_localize_data.translable_txt.place_id+'</strong></td><td style="width:20%;"><input class="saswp-g-location-field" name="sd_data[saswp_reviews_location_name][]" type="text" value=""></td><td style="width:10%;"><strong>'+saswp_localize_data.translable_txt.reviews+'</strong></td><td style="width:10%;">'+a+'</td><td style="width:10%;"><a class="button button-default saswp-fetch-g-reviews">'+saswp_localize_data.translable_txt.fetch+'</a></td><td style="width:10%;"><a type="button" class="saswp-remove-review-item button">x</a></td><td style="width:10%;"><p class="saswp-rv-fetched-msg"></p></td></tr>')&&s(".saswp-g-reviews-settings-table").append(t)}),s(document).on("click",".saswp-fetch-g-reviews",function(){var e=s(this),a="free";e.addClass("updating-message");var t=s(this).parent().parent().find(".saswp-g-location-field").val(),i=s(this).parent().parent().find(".saswp-g-blocks-field").val(),p=s("#saswp_google_place_api_key").val(),c=s("#reviews_addon_license_key").val(),o=s("#reviews_addon_license_key_status").val();if("premium"==(a=s("#saswp_google_place_api_key").length?"free":"premium")){if(!(i>0))return alert(saswp_localize_data.translable_txt.blocks_zero),e.removeClass("updating-message"),!1;if(0!=i%10)return e.parent().parent().find(".saswp-rv-fetched-msg").text(saswp_localize_data.translable_txt.step_in),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b"),e.removeClass("updating-message"),!1}""!=t&&(c||p)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_fetch_google_reviews",reviews_api_status:o,reviews_api:c,location:t,blocks:i,g_api:p,premium_status:a,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){"t"==s.status?(e.parent().parent().find(".saswp-rv-fetched-msg").text(saswp_localize_data.translable_txt.success),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","green")):(e.parent().parent().find(".saswp-rv-fetched-msg").text(s.message),e.parent().parent().find(".saswp-rv-fetched-msg").css("color","#988f1b")),e.removeClass("updating-message")},error:function(s){console.log(s)}}):(""==t&&alert(saswp_localize_data.translable_txt.enter_place_id),""==p&&alert(saswp_localize_data.translable_txt.enter_api_key),""==c&&alert(saswp_localize_data.translable_txt.enter_rv_api_key),e.removeClass("updating-message"))}),saswp_localize_data.do_tour){var e,a="<h3>"+saswp_localize_data.translable_txt.using_schema+"</h3>";a+="<p>"+saswp_localize_data.translable_txt.do_you_want+" <b>"+saswp_localize_data.translable_txt.sd_update+"</b> "+saswp_localize_data.translable_txt.before_others+"</p>",a+='<style type="text/css">',a+=".wp-pointer-buttons{ padding:0; overflow: hidden; }",a+=".wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #0085ba;} .wp-pointer-content .button-primary{ display:none} #saswp_mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }",a+="</style>",a+='<div id="saswp_mc_embed_signup">',a+='<form method="POST" accept-charset="utf-8" id="saswp-news-letter-form">',a+='<div id="saswp_mc_embed_signup_scroll">',a+='<div class="saswp-mc-field-group" style=" margin-left: 15px; width: 195px; float: left;">',a+='<input type="text" name="saswp_subscriber_name" class="form-control" placeholder="Name" hidden value="'+saswp_localize_data.current_user_name+'" style="display:none">',a+='<input type="text" value="'+saswp_localize_data.current_user_email+'" name="saswp_subscriber_email" class="form-control" placeholder="Email*" style=" width: 180px; padding: 6px 5px;">',a+='<input type="text" name="saswp_subscriber_website" class="form-control" placeholder="Website" hidden style=" display:none; width: 168px; padding: 6px 5px;" value="'+saswp_localize_data.get_home_url+'">',a+='<input type="hidden" name="ml-submit" value="1" />',a+="</div>",a+='<div id="mce-responses">',a+="</div>",a+='<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_a631df13442f19caede5a5baf_c9a71edce6" tabindex="-1" value=""></div>',a+='<input type="submit" value="Subscribe" name="subscribe" id="pointer-close" class="button mc-newsletter-sent" style=" background: #0085ba; border-color: #006799; padding: 0px 16px; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px; margin-top: 1px; color: #fff; box-shadow: 0 1px 0 #006799;">',a+='<p id="saswp-news-letter-status"></p>',a+="</div>",a+="</form>",a+="</div>",s(document).on("submit","#saswp-news-letter-form",function(e){e.preventDefault();var a=s(this),t=a.find('input[name="saswp_subscriber_name"]').val(),i=a.find('input[name="saswp_subscriber_email"]').val();website=a.find('input[name="saswp_subscriber_website"]').val(),s.post(saswp_localize_data.ajax_url,{action:"saswp_subscribe_to_news_letter",saswp_security_nonce:saswp_localize_data.saswp_security_nonce,name:t,email:i,website:website},function(e){e?"Some fields are missing."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):"Invalid email address."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):"Invalid list ID."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):"Already subscribed."==e?(s("#saswp-news-letter-status").text(""),s("#saswp-news-letter-status").css("color","red")):(s("#saswp-news-letter-status").text("You're subscribed!"),s("#saswp-news-letter-status").css("color","green")):alert("Sorry, unable to subscribe. Please try again later!")})});var t={content:a,position:{edge:"top",align:"left"}};e=function(){s(saswp_localize_data.displayID).pointer(t).pointer("open"),saswp_localize_data.button2&&(jQuery("#pointer-close").after('<a id="pointer-primary" class="button-primary">'+saswp_localize_data.button2+"</a>"),jQuery("#pointer-primary").click(function(){saswp_localize_data.function_name}),jQuery("#pointer-close").click(function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})}))},(t=s.extend(t,{buttons:function(s,e){return button=jQuery('<a id="pointer-close" class="button-secondary">'+saswp_localize_data.button1+"</a>"),button_2=jQuery("#pointer-close.button"),button.bind("click.pointer",function(){e.element.pointer("close")}),button_2.on("click",function(){setTimeout(function(){e.element.pointer("close")},3e3)}),button},close:function(){s.post(saswp_localize_data.ajax_url,{pointer:"saswp_subscribe_pointer",action:"dismiss-wp-pointer"})},show:function(s,e){e.pointer.css({left:"170px",top:"160px"})}})).position&&t.position.defer_loading?s(window).bind("load.wp-pointers",e):e()}if(s(".saswp-tabs a").click(function(e){var a=s(this).attr("href"),t=getParameterByName("tab",a);return t||(t="general"),s(this).siblings().removeClass("nav-tab-active"),s(this).addClass("nav-tab-active"),s(".form-wrap").find(".saswp-"+t).siblings().hide(),s(".form-wrap .saswp-"+t).show(),window.history.pushState("","",a),!1}),s(".saswp-schame-type-select").select2(),s(".saswp-schame-type-select").change(function(e){e.preventDefault(),s(".saswp-custom-fields-table").html("");var a=s(this).val();s(".saswp-option-table-class tr").each(function(e,a){e>0&&s(this).hide()}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"Organization"==a||"CreativeWorkSeries"==a||"MobileApplication"==a||"ImageObject"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a||"Review"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-option-table-class tr").eq(1).show(),s(".saswp-business-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".select-post-type").val("show_globally").trigger("change")),"Service"==a&&(s(".saswp-service-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".saswp-item-reivewed-list").change()),"ItemList"==a?(s(".saswp-schema-modify-section").hide(),s(".saswp-itemlist-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1),s(".saswp-itemlist-item-type-list").change()):s(".saswp-schema-modify-section").show(),saswp_enable_rating_review(),s(".saswp-manual-modification").html(""),s(".saswp-static-container .spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_manual_fields_on_ajax",schema_type:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){s(".saswp-static-container .spinner").removeClass("is-active"),s(".saswp-manual-modification").append(e),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_item_reviewed_call()}),"HowTo"==a||"local_business"==a||"FAQ"==a?s(".saswp-enable-modify-schema").show():(s(".saswp-enable-modify-schema-output").val("automatic"),s(".saswp-enable-modify-schema-output").change(),s(".saswp-enable-modify-schema").hide())}),s("#saswp_business_type").select2(),s(".saswp-local-sub-type-2").select2(),s("#saswp_business_type").change(function(){var e=s(this).val(),a=s(".saswp-schame-type-select").val();s(".saswp-option-table-class tr").each(function(e,a){e>1&&(s(this).hide(),s(this).find(".saswp-local-sub-type-2").attr("disabled",!0))}),"TechArticle"==a||"Article"==a||"Blogposting"==a||"NewsArticle"==a||"WebPage"==a?s(".saswp-enable-speakable").parent().parent().show():s(".saswp-enable-speakable").parent().parent().hide(),"Book"==a||"Course"==a||"Organization"==a||"CreativeWorkSeries"==a||"MobileApplication"==a||"ImageObject"==a||"HowTo"==a||"MusicPlaylist"==a||"MusicAlbum"==a||"Recipe"==a||"TVSeries"==a||"SoftwareApplication"==a||"Event"==a||"VideoGame"==a||"Service"==a||"AudioObject"==a||"VideoObject"==a||"local_business"==a||"Product"==a||"Review"==a?s(".saswp-enable-append-reviews").parent().parent().show():s(".saswp-enable-append-reviews").parent().parent().hide(),"local_business"==a&&(s(".saswp-"+e+"-tr").show(),s(".saswp-business-text-field-tr").show(),s(".saswp-"+e+"-tr").find("select").attr("disabled",!1)),"Review"==a&&(s(".saswp-review-text-field-tr").show(),s(".saswp-review-text-field-tr").find("select").attr("disabled",!1)),"ItemList"==a?(s(".saswp-schema-modify-section").hide(),s(".saswp-itemlist-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)):s(".saswp-schema-modify-section").show(),"Event"==a&&(s(".saswp-event-text-field-tr").show(),s(".saswp-option-table-class tr").find("select").attr("disabled",!1)),saswp_enable_rating_review()}).change(),s(".saswp-checkbox").change(function(){var e=s(this).attr("id"),a=s(this);switch(e){case"saswp-the-seo-framework-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-seo-framework").val(1):s("#saswp-the-seo-framework").val(0);break;case"saswp-seo-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-seo-press").val(1):s("#saswp-seo-press").val(0);break;case"saswp-aiosp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-aiosp").val(1):s("#saswp-aiosp").val(0);break;case"saswp-smart-crawl-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-smart-crawl").val(1):s("#saswp-smart-crawl").val(0);break;case"saswp-squirrly-seo-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-squirrly-seo").val(1):s("#saswp-squirrly-seo").val(0);break;case"saswp-wp-recipe-maker-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-recipe-maker").val(1):s("#saswp-wp-recipe-maker").val(0);break;case"saswp-wpzoom-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpzoom").val(1):s("#saswp-wpzoom").val(0);break;case"saswp-recipress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-recipress").val(1):s("#saswp-recipress").val(0);break;case"saswp-wp-ultimate-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-ultimate-recipe").val(1):s("#saswp-wp-ultimate-recipe").val(0);break;case"saswp-zip-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-zip-recipes").val(1):s("#saswp-zip-recipes").val(0);break;case"saswp-mediavine-create-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-mediavine-create").val(1):s("#saswp-mediavine-create").val(0);break;case"saswp-ht-recipes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ht-recipes").val(1):s("#saswp-ht-recipes").val(0);break;case"saswp-wpsso-core-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpsso-core").val(1):s("#saswp-wpsso-core").val(0);break;case"saswp-for-wordpress-checkbox":s(this).is(":checked")?s("#saswp-for-wordpress").val(1):s("#saswp-for-wordpress").val(0);break;case"saswp-for-amp-checkbox":s(this).is(":checked")?s("#saswp-for-amp").val(1):s("#saswp-for-amp").val(0);break;case"saswp_kb_contact_1_checkbox":s(this).is(":checked")?(s("#saswp_kb_contact_1").val(1),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").removeClass("saswp-display-none")):(s("#saswp_kb_contact_1").val(0),s("#saswp_kb_telephone, #saswp_contact_type").parent().parent("li").addClass("saswp-display-none"));break;case"saswp-logo-dimensions-check":s(this).is(":checked")?(s("#saswp-logo-dimensions").val(1),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").show()):(s("#saswp-logo-dimensions").val(0),s("#saswp-logo-width, #saswp-logo-height").parent().parent("li").hide());break;case"saswp_archive_schema_checkbox":s(this).is(":checked")?(s("#saswp_archive_schema").val(1),s(".saswp_archive_schema_type_class").parent().parent().show()):(s("#saswp_archive_schema").val(0),s(".saswp_archive_schema_type_class").parent().parent().hide());break;case"saswp_website_schema_checkbox":s(this).is(":checked")?(s("#saswp_website_schema").val(1),s("#saswp_search_box_schema").parent().parent().show()):(s("#saswp_website_schema").val(0),s("#saswp_search_box_schema").parent().parent().hide());break;case"saswp_search_box_schema_checkbox":s(this).is(":checked")?s("#saswp_search_box_schema").val(1):s("#saswp_search_box_schema").val(0);break;case"saswp_breadcrumb_schema_checkbox":s(this).is(":checked")?s("#saswp_breadcrumb_schema").val(1):s("#saswp_breadcrumb_schema").val(0);break;case"saswp_comments_schema_checkbox":s(this).is(":checked")?s("#saswp_comments_schema").val(1):s("#saswp_comments_schema").val(0);break;case"saswp-compativility-checkbox":s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-review-module-checkbox":s(this).is(":checked")?s("#saswp-review-module").val(1):s("#saswp-review-module").val(0);break;case"saswp-stars-rating-checkbox":s(this).is(":checked")?(s(".saswp-stars-post-table").removeClass("saswp_hide"),s("#saswp-stars-rating").val(1)):(s(".saswp-stars-post-table").addClass("saswp_hide"),s("#saswp-stars-rating").val(0));break;case"saswp-kk-star-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-kk-star-raring").val(1):s("#saswp-kk-star-raring").val(0);break;case"saswp-yet-another-stars-rating-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-yet-another-stars-rating").val(1):s("#saswp-yet-another-stars-rating").val(0);break;case"saswp-simple-author-box-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-simple-author-box").val(1):s("#saswp-simple-author-box").val(0);break;case"saswp-woocommerce-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce").val(1):s("#saswp-woocommerce").val(0);break;case"saswp-default-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp_default_review").val(1):s("#saswp_default_review").val(0);break;case"saswp-extra-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-extra").val(1):s("#saswp-extra").val(0);break;case"saswp-soledad-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-soledad").val(1):s("#saswp-soledad").val(0);break;case"saswp-wp-theme-reviews-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-theme-reviews").val(1):s("#saswp-wp-theme-reviews").val(0);break;case"saswp-dw-question-answer-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-dw-question-answer").val(1):s("#saswp-dw-question-answer").val(0);break;case"saswp-wp-job-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-job-manager").val(1):s("#saswp-wp-job-manager").val(0);break;case"saswp-yoast-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-yoast").val(1):s("#saswp-yoast").val(0);break;case"saswp-rankmath-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-rankmath").val(1):s("#saswp-rankmath").val(0);break;case"saswp-taqyeem-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-taqyeem").val(1):s("#saswp-taqyeem").val(0);break;case"saswp-the-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-the-events-calendar").val(1):s("#saswp-the-events-calendar").val(0);break;case"saswp-homeland-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-homeland").val(1):s("#saswp-homeland").val(0);break;case"saswp-wpresidence-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpresidence").val(1):s("#saswp-wpresidence").val(0);break;case"saswp-myhome-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-myhome").val(1):s("#saswp-myhome").val(0);break;case"saswp-realestate-5-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-realestate-5").val(1):s("#saswp-realestate-5").val(0);break;case"saswp-classipress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-classipress").val(1):s("#saswp-classipress").val(0);break;case"saswp-realhomes-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-realhomes").val(1):s("#saswp-realhomes").val(0);break;case"saswp-learn-press-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-press").val(1):s("#saswp-learn-press").val(0);break;case"saswp-wplms-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wplms").val(1):s("#saswp-wplms").val(0);break;case"saswp-learn-dash-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-learn-dash").val(1):s("#saswp-learn-dash").val(0);break;case"saswp-lifter-lms-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-lifter-lms").val(1):s("#saswp-lifter-lms").val(0);break;case"saswp-wp-event-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-manager").val(1):s("#saswp-wp-event-manager").val(0);break;case"saswp-events-manager-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-events-manager").val(1):s("#saswp-events-manager").val(0);break;case"saswp-event-calendar-wd-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-calendar-wd").val(1):s("#saswp-event-calendar-wd").val(0);break;case"saswp-event-organiser-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-organiser").val(1):s("#saswp-event-organiser").val(0);break;case"saswp-modern-events-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-modern-events-calendar").val(1):s("#saswp-modern-events-calendar").val(0);break;case"saswp-woocommerce-booking-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking").val(1),s("#saswp-woocommerce-booking-main").val(1)):(s("#saswp-woocommerce-booking").val(0),s("#saswp-woocommerce-booking-main").val(0));break;case"saswp-woocommerce-booking-main-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-woocommerce-booking-main").val(1),s("#saswp-woocommerce-booking").val(1)):(s("#saswp-woocommerce-booking-main").val(0),s("#saswp-woocommerce-booking").val(0));break;case"saswp-woocommerce-membership-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-woocommerce-membership").val(1):s("#saswp-woocommerce-membership").val(0);break;case"saswp-defragment-checkbox":s(this).is(":checked")?s("#saswp-defragment").val(1):s("#saswp-defragment").val(0);break;case"saswp-cooked-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-cooked").val(1):s("#saswp-cooked").val(0);break;case"saswp-flexmlx-compativility-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-flexmlx-compativility").val(1):s("#saswp-flexmlx-compativility").val(0);break;case"saswp-shopper-approved-review-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?(s("#saswp-shopper-approved-review").val(1),s(".saswp-s-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-shopper-approved-review").val(0),s(".saswp-s-reviews-settings-table").parent().parent().parent().hide());break;case"saswp-google-review-checkbox":s(this).is(":checked")?(s("#saswp-google-review").val(1),s("#saswp-google-rv-free-checkbox").length?(s("#saswp-google-review-free").parent().parent().show(),s("#saswp-google-rv-free-checkbox").is(":checked")?s("#saswp_google_place_api_key").parent().parent().show():s("#saswp_google_place_api_key").parent().parent().hide()):s("#saswp_google_place_api_key").parent().parent().show(),s(".saswp-g-reviews-settings-table").parent().parent().parent().show()):(s("#saswp-google-review").val(0),s("#saswp_google_place_api_key").parent().parent().hide(),s(".saswp-g-reviews-settings-table").parent().parent().parent().hide(),s("#saswp-google-rv-free-checkbox").length&&s("#saswp-google-review-free").parent().parent().hide());break;case"saswp-google-rv-free-checkbox":s("#saswp-google-review-checkbox").is(":checked")&&s(this).is(":checked")?(s("#saswp-google-review-free").val(1),s("#saswp_google_place_api_key").parent().parent().show()):(s("#saswp-google-review-free").val(0),s("#saswp_google_place_api_key").parent().parent().hide());break;case"saswp-markup-footer-checkbox":s(this).is(":checked")?s("#saswp-markup-footer").val(1):s("#saswp-markup-footer").val(0);break;case"saswp-pretty-print-checkbox":s(this).is(":checked")?s("#saswp-pretty-print").val(1):s("#saswp-pretty-print").val(0);break;case"saswp-wppostratings-raring-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wppostratings-raring").val(1):s("#saswp-wppostratings-raring").val(0);break;case"saswp-bbpress-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-bbpress").val(1):s("#saswp-bbpress").val(0);break;case"saswp-microdata-cleanup-checkbox":s(this).is(":checked")?s("#saswp-microdata-cleanup").val(1):s("#saswp-microdata-cleanup").val(0);break;case"saswp-other-images-checkbox":s(this).is(":checked")?s("#saswp-other-images").val(1):s("#saswp-other-images").val(0);break;case"saswp-rss-feed-image-checkbox":s(this).is(":checked")?s("#saswp-rss-feed-image").val(1):s("#saswp-rss-feed-image").val(0);break;case"saswp-multiple-size-image-checkbox":s(this).is(":checked")?s("#saswp-multiple-size-image").val(1):s("#saswp-multiple-size-image").val(0);break;case"saswp-easy-testimonials-checkbox":s(this).is(":checked")?s("#saswp-easy-testimonials").val(1):s("#saswp-easy-testimonials").val(0);break;case"saswp-testimonial-pro-checkbox":s(this).is(":checked")?s("#saswp-testimonial-pro").val(1):s("#saswp-testimonial-pro").val(0);break;case"saswp-bne-testimonials-checkbox":s(this).is(":checked")?s("#saswp-bne-testimonials").val(1):s("#saswp-bne-testimonials").val(0);break;case"saswp-ampforwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampforwp").val(1):s("#saswp-ampforwp").val(0);break;case"saswp-ampbyautomatic-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampbyautomatic").val(1):s("#saswp-ampbyautomatic").val(0);break;case"saswp-schemaforfaqs-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-schemaforfaqs").val(1):s("#saswp-schemaforfaqs").val(0);break;case"saswp-wp-customer-reviews-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-customer-reviews").val(1):s("#saswp-wp-customer-reviews").val(0);break;case"saswp-total-recipe-generator-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-total-recipe-generator").val(1):s("#saswp-total-recipe-generator").val(0);break;case"saswp-wordpress-news-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wordpress-news").val(1):s("#saswp-wordpress-news").val(0);break;case"saswp-ampwp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-ampwp").val(1):s("#saswp-ampwp").val(0);break;case"saswp-wp-event-aggregator-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wp-event-aggregator").val(1):s("#saswp-wp-event-aggregator").val(0);break;case"saswp-stachethemes-event-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-stachethemes-event-calendar").val(1):s("#saswp-stachethemes-event-calendar").val(0);break;case"saswp-all-in-one-event-calendar-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-all-in-one-event-calendar").val(1):s("#saswp-all-in-one-event-calendar").val(0);break;case"saswp-event-on-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-event-on").val(1):s("#saswp-event-on").val(0);break;case"saswp-easy-recipe-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-easy-recipe").val(1):s("#saswp-easy-recipe").val(0);break;case"saswp-tevolution-events-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-tevolution-events").val(1):s("#saswp-tevolution-events").val(0);break;case"saswp-strong-testimonials-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-strong-testimonials").val(1):s("#saswp-strong-testimonials").val(0);break;case"saswp-wordlift-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wordlift").val(1):s("#saswp-wordlift").val(0);break;case"saswp-betteramp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-betteramp").val(1):s("#saswp-betteramp").val(0);break;case"saswp-wpamp-checkbox":saswp_compatibliy_notes(a,e),s(this).is(":checked")?s("#saswp-wpamp").val(1):s("#saswp-wpamp").val(0)}}).change(),s("#saswp_kb_type").change(function(){var e=s(this).val();s(".saswp_org_fields, .saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().addClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide"),"Organization"==e&&(s(".saswp_org_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_person_fields").parent().parent().addClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().addClass("saswp_hide")),"Person"==e&&(s(".saswp_org_fields").parent().parent().addClass("saswp_hide"),s(".saswp_person_fields").parent().parent().removeClass("saswp_hide"),s(".saswp_kg_logo").parent().parent().parent().removeClass("saswp_hide"),s("#sd-person-image").parent().parent().parent().removeClass("saswp_hide"))}).change(),s(document).on("click","input[data-id=media]",function(e){e.preventDefault();var a=s(this),t=a.attr("id").replace("_button",""),i=wp.media({title:"Application Icon",button:{text:"Select Icon"},multiple:!1,library:{type:"image"}}).on("select",function(){var e=i.state().get("selection").first().toJSON();s("#"+t).val(e.url),s("input[data-id='"+t+"_id']").val(e.id),s("input[data-id='"+t+"_height']").val(e.height),s("input[data-id='"+t+"_width']").val(e.width),s("input[data-id='"+t+"_thumbnail']").val(e.url),"sd_default_image_button"===a.attr("id")&&(s("#sd_default_image_width").val(e.width),s("#sd_default_image_height").val(e.height));var p="";"saswp_image_div_"+t=="saswp_image_div_sd_default_image"&&e.height<1200&&(p='<p class="saswp_warning">Image size is smaller than recommended size</p>'),s(".saswp_image_div_"+t).html('<div class="saswp_image_thumbnail"><img class="saswp_image_prev" src="'+e.url+'"/><a data-id="'+t+'" href="#" class="saswp_prev_close">X</a></div>'+p)}).open()}),s(document).on("click",".saswp_prev_close",function(e){e.preventDefault();var a=s(this).attr("data-id");s(this).parent().remove(),s("#"+a).val(""),s("input[data-id='"+a+"_id']").val(""),s("input[data-id='"+a+"_height']").val(""),s("input[data-id='"+a+"_width']").val(""),s("input[data-id='"+a+"_thumbnail']").val(""),"sd_default_image"===a&&(s("#sd_default_image_width").val(""),s("#sd_default_image_height").val(""))}),s(document).on("click",".saswp-modify-schema",function(e){e.preventDefault();var a=s(this).attr("schema-id"),t=s(this);t.addClass("updating-message"),s.get(ajaxurl,{action:"saswp_modify_schema_post_enable",schema_id:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){s(".saswp-post-specific-wrapper[data-id="+a+"] .saswp-post-specific-setting").after(e),s(".saswp_modify_this_schema_hidden_"+a).val(1),s(".saswp-ps-toggle[schema-id="+a+"]").removeClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().removeClass("saswp_hide"),s(".saswp-modify-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),t.removeClass("updating-message"),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_enable_rating_review(),saswp_item_reviewed_call()})}),s(document).on("click",".saswp-restore-schema",function(e){e.preventDefault();var a=s(this).attr("schema-id"),t=s(this);t.addClass("updating-message"),s.post(ajaxurl,{action:"saswp_modify_schema_post_restore",schema_id:a,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){t.removeClass("updating-message"),"t"==e.status?(s(".saswp_modify_this_schema_hidden_"+a).val(0),s(".saswp-restore-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),s(".saswp-modify-schema[schema-id="+a+"]").parent().removeClass("saswp_hide"),s(".saswp-ps-toggle[schema-id="+a+"]").remove()):alert("Something went wrong")},"json")}),s(document).on("change",".saswp-schema-type-toggle",function(e){var a=s(this).attr("data-schema-id"),t=s(this).attr("data-post-id"),i=s(".saswp_modify_this_schema_hidden_"+a).val();if(s(this).is(":checked")){var p=0;s(".saswp-ps-toggle[schema-id="+a+"]").addClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),s(".saswp-modify-schema[schema-id="+a+"]").parent().addClass("saswp_hide"),s("#saswp_custom_schema_field[schema-id="+a+"]").parent().addClass("saswp_hide")}else{s("#saswp_custom_schema_field[schema-id="+a+"]").parent().removeClass("saswp_hide"),1==i?(s(".saswp-ps-toggle[schema-id="+a+"]").removeClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().removeClass("saswp_hide")):(s(".saswp-modify-schema[schema-id="+a+"]").parent().removeClass("saswp_hide"),s(".saswp-ps-toggle[schema-id="+a+"]").addClass("saswp_hide"),s(".saswp-restore-schema[schema-id="+a+"]").parent().addClass("saswp_hide"));p=1}s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_enable_disable_schema_on_post",status:p,schema_id:a,post_id:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-reset-data",function(e){e.preventDefault(),1==confirm("Are you sure?")&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_reset_all_settings",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){setTimeout(function(){location.reload()},1e3)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp_license_activation",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("license-status"),i=s(this).attr("add-on"),p=s("#"+i+"_addon_license_key").val();t&&i&&p?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_license_status_check",license_key:p,license_status:t,add_on:i,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){s("#"+i+"_addon_license_key_status").val(e.status),"active"==e.status?(s(".saswp-"+i+"-dashicons").addClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").css("color","green"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","inactive"),s(".saswp_license_activation[add-on='"+i+"']").text("Deactivate"),s(".saswp_license_status_msg[add-on='"+i+"']").text("Activated"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","green"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)):(s(".saswp-"+i+"-dashicons").addClass("dashicons-no-alt"),s(".saswp-"+i+"-dashicons").removeClass("dashicons-yes"),s(".saswp-"+i+"-dashicons").css("color","red"),s(".saswp_license_activation[add-on='"+i+"']").attr("license-status","active"),s(".saswp_license_activation[add-on='"+i+"']").text("Activate"),s(".saswp_license_status_msg[add-on='"+i+"']").css("color","red"),s(".saswp_license_status_msg[add-on='"+i+"']").text(e.message)),a.removeClass("updating-message")},error:function(s){console.log(s)}}):(alert("Please enter value license key"),a.removeClass("updating-message"))}),s(".saswp-send-query").on("click",function(e){e.preventDefault();var a=s("#saswp_query_message").val(),t=s("#saswp_query_email").val(),i=s("#saswp_query_premium_cus").val();console.log(saswpIsEmail(t)),""!=s.trim(a)&&i&&""!=s.trim(t)&&1==saswpIsEmail(t)?s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_send_query_message",premium_cus:i,message:a,email:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(e){"t"==e.status?(s(".saswp-query-success").show(),s(".saswp-query-error").hide()):(s(".saswp-query-success").hide(),s(".saswp-query-error").show())},error:function(s){console.log(s)}}):""==s.trim(a)&&""==i&&""==s.trim(t)?alert("Please enter the message, email and select customer type"):(""==i&&alert("Select Customer type"),""==s.trim(a)&&alert("Please enter the message"),""==s.trim(t)&&alert("Please enter the email"),0==saswpIsEmail(t)&&alert("Please enter a valid email"))}),s(".saswp-import-plugins").on("click",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id");s.get(ajaxurl,{action:"saswp_import_plugin_data",plugin_name:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status?(s(a).parent().find(".saswp-imported-message").text(e.message),s(a).parent().find(".saswp-imported-message").removeClass("saswp-error"),setTimeout(function(){location.reload()},2e3)):(s(a).parent().find(".saswp-imported-message").addClass("saswp-error"),s(a).parent().find(".saswp-imported-message").text(e.message)),a.removeClass("updating-message")},"json")}),s(".saswp-feedback-no-thanks").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_no_thanks",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(".saswp-feedback-remindme").on("click",function(e){e.preventDefault(),s.get(ajaxurl,{action:"saswp_feeback_remindme",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){"t"==e.status&&s(".saswp-feedback-notice").hide()},"json")}),s(document).on("change",".saswp-local-business-type-select",function(e){e.preventDefault();var a=s(this),t=s(this).val();s.get(ajaxurl,{action:"saswp_get_sub_business_ajax",business_type:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if("t"==e.status){s(".saswp-local-business-name-select").parents("tr").remove();var t=a.parents(".saswp-post-specific-wrapper").attr("data-id"),i='<tr><th><label for="saswp_business_name_'+t+'">Sub Business Type</label></th>';i+='<td><select class="saswp-local-business-name-select" id="saswp_business_name_'+t+'" name="saswp_business_name_'+t+'">',s.each(e.result,function(s,e){i+='<option value="'+s+'">'+e+"</option>"}),i+="</select></td>",i+="</tr>",a.parents(".form-table tr:first").after(i)}else s(".saswp-local-business-name-select").parents("tr").remove()},"json")}),saswp_item_reviewed_call(),jQuery(".saswp-local-schema-time-picker").timepicker({timeFormat:"H:i:s"}),s(document).on("click",".saswp-add-custom-schema",function(e){e.preventDefault(),s(".saswp-add-custom-schema-field").removeClass("saswp_hide"),s(this).hide()}),s(document).on("click",".saswp-delete-custom-schema",function(e){e.preventDefault(),s("#saswp_custom_schema_field").val(""),s(".saswp-add-custom-schema-field").addClass("saswp_hide"),s(".saswp-add-custom-schema").show()}),saswp_schema_datepicker(),saswp_schema_timepicker(),saswp_reviews_datepicker(),s(document).on("click",".saswp-add-more-item",function(e){e.preventDefault();s(".saswp-review-item-list-table").append('<tr class="saswp-review-item-tr"><td>Review Item Feature</td><td><input type="text" name="saswp-review-item-feature[]"></td><td>Rating</td><td><input step="0.1" min="0" max="5" type="number" name="saswp-review-item-star-rating[]"></td><td><a type="button" class="saswp-remove-review-item button">x</a></td></tr>')}),s(document).on("click",".saswp-remove-review-item",function(e){e.preventDefault(),s(this).parent().parent("tr").remove()}),s(document).on("focusout",".saswp-review-item-tr input[type=number]",function(e){e.preventDefault();var a=0,t=s(".saswp-review-item-tr input[type=number]").length;s(".saswp-review-item-tr input[type=number]").each(function(e,t){""==s(t).val()?a+=parseFloat(0):a+=parseFloat(s(t).val())});var i=a/t;s("#saswp-review-item-over-all").val(i)}),s("#saswp-review-location").change(function(){var e=s(this).val();s(".saswp-review-shortcode").addClass("saswp_hide"),3==e&&s(".saswp-review-shortcode").removeClass("saswp_hide")}).change(),s("#saswp-review-item-enable").change(function(){s(this).is(":checked")?s(".saswp-review-fields").show():s(".saswp-review-fields").hide()}).change(),s(document).on("click",".saswp-restore-post-schema",function(e){e.preventDefault();var a=s(this);if(a.addClass("updating-message"),s(".saswp-post-specific-schema-ids").val())var t=JSON.parse(s(".saswp-post-specific-schema-ids").val());s.post(ajaxurl,{action:"saswp_restore_schema",schema_ids:t,post_id:saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){"t"==s.status?setTimeout(function(){location.reload()},1e3):(alert(s.msg),setTimeout(function(){location.reload()},1e3)),a.removeClass("updating-message")},"json")}),s(document).on("click","div.saswp-tab ul.saswp-tab-nav a",function(e){e.preventDefault();var a=s(this).attr("data-id");s(".saswp-post-specific-wrapper").hide(),s("#"+a).show(),s("div.saswp-tab ul.saswp-tab-nav a").removeClass("selected"),s("div.saswp-tab ul.saswp-tab-nav li").removeClass("selected"),s(this).addClass("selected"),s(this).parent().addClass("selected"),saswp_enable_rating_review()}),s("#saswp-global-tabs a:first").addClass("saswp-global-selected"),s(".saswp-global-container").hide(),"#saswp-default-container"==window.location.hash?s(".saswp-global-container:eq(2)").show():s(".saswp-global-container:first").show(),s("#saswp-global-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-global-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-global-container").hide(),s("#"+e).show())}),s("#saswp-tools-tabs a:first").addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s(".saswp-tools-container:first").show(),s("#saswp-tools-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-tools-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-tools-container").hide(),s("#"+e).show())}),s("#saswp-review-tabs a:first").addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s(".saswp-review-container:first").show(),s("#saswp-review-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-review-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-review-container").hide(),s("#"+e).show())}),s("#saswp-compatibility-tabs a:first").addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s(".saswp-compatibility-container:first").show(),s("#saswp-compatibility-tabs a").click(function(){var e=s(this).attr("data-id");s(this).hasClass("saswp-global-selected")||(s("#saswp-compatibility-tabs a").removeClass("saswp-global-selected"),s(this).addClass("saswp-global-selected"),s(".saswp-compatibility-container").hide(),s("#"+e).show())}),s('a[href="'+saswp_localize_data.new_url_selector+'"]').attr("href",saswp_localize_data.new_url_href),s(".saswp-enable-modify-schema-output").on("change",function(){s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide"),"manual"==s(this).val()&&(s(".saswp-static-container").removeClass("saswp_hide"),s(".saswp-dynamic-container").addClass("saswp_hide")),"automatic"==s(this).val()&&(s(".saswp-static-container").addClass("saswp_hide"),s(".saswp-dynamic-container").removeClass("saswp_hide"))}),s(document).on("change",".saswp-custom-fields-name",function(){var e="text",a=s(this).parent().parent("tr"),t=s(this).val();-1==t.indexOf("_image")&&-1==t.indexOf("_logo")||(e="image");var i=s(this).parent().parent("tr").find("td:eq(1)");saswp_get_meta_list(null,e,null,i,t,a)}),s(document).on("click",".saswp-skip-button",function(e){e.preventDefault(),s(this).parent().parent().hide(),s.post(ajaxurl,{action:"saswp_skip_wizard",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){},"json")}),s(document).on("click",".saswp_add_schema_fields_on_fly",function(e){e.preventDefault();var a=s(this);a.addClass("updating-message");var t=s(this).attr("data-id"),i=s(this).attr("fields_type"),p=s(this).attr("div_type"),c=s(this).attr("itemlist_sub_type"),o=s("saswp_specific_"+t+" , .saswp-"+p+"-table-div").length,n=s("saswp_specific_"+t+" , .saswp-"+p+"-table-div:nth-child("+o+")").attr("data-id");(n=++n)||(n=0),saswp_get_post_specific_schema_fields(a,n,i,p,t,i+"_",c)}),s(document).on("click",".saswp-table-close",function(){s(this).parent().remove()}),s(document).on("click",".saswp-rmv-modify_row",function(e){e.preventDefault(),s(this).parent().parent().remove()}),s(document).on("change",".saswp-custom-meta-list",function(){var e=s(this),a=s("select#schema_type option:selected").val(),t=s(this).val(),i=s(this).parent().parent("tr").find(".saswp-custom-fields-name").val(),p="",c=a.toLowerCase()+"_"+i,o="saswp_fixed_image["+i+"]";"manual_text"==t?(p+='<td><input type="text" name="saswp_fixed_text['+i+']"></td>',p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):"taxonomy_term"==t?saswp_taxonomy_term.taxonomy?(p+=saswp_taxonomy_term_html(saswp_taxonomy_term.taxonomy,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(p),saswpCustomSelect2()):s.get(ajaxurl,{action:"saswp_get_taxonomy_term_list",saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(s){s&&(saswp_taxonomy_term.taxonomy=s,p+=saswp_taxonomy_term_html(s,i),e.parent().parent("tr").find("td:gt(1)").remove(),e.parent().parent("tr").append(p),saswpCustomSelect2())},"json"):"custom_field"==t?(p+='<td><select class="saswp-custom-fields-select2" name="saswp_custom_meta_field['+i+']">',p+="</select></td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):"fixed_image"==t?(p+="<td>",p+="<fieldset>",p+='<input data-id="media" style="width: 30%;" class="button" id="'+c+'_button" name="'+c+'_button" type="button" value="Upload" />',p+='<input type="hidden" data-id="'+c+'_height" class="upload-height" name="'+o+'[height]" id="'+c+'_height" value="">',p+='<input type="hidden" data-id="'+c+'_width" class="upload-width" name="'+o+'[width]" id="'+c+'_width" value="">',p+='<input type="hidden" data-id="'+c+'_thumbnail" class="upload-thumbnail" name="'+o+'[thumbnail]" id="'+c+'_thumbnail" value="">',p+='<div class="saswp_image_div_'+c+'">',p+="</div>",p+="</fieldset>",p+="</td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2()):(p+="<td></td>",p+='<td><a class="button button-default saswp-rmv-modify_row">X</a></td>',s(this).parent().parent("tr").find("td:gt(1)").remove(),s(this).parent().parent("tr").append(p),saswpCustomSelect2())}),s(document).on("change",".saswp-item-reivewed-list",function(){s(".saswp-custom-fields-table").html(""),saswp_meta_list_fields=[];var e=s(this),a=s("select#schema_type option:selected").val();saswp_item_reviewed_ajax(a,e,"manual")}),s(document).on("click",".saswp-add-custom-fields",function(){var e=s(this);e.addClass("updating-message");var a=s("select#schema_type option:selected").val(),t="",i=null;"Review"==a&&(t=s("select.saswp-item-reivewed-list option:selected").val(),i="saswp_review_name");var p=s("#post_ID").val();""!=a&&(saswp_meta_list_fields[a]?saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null):s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_get_schema_type_fields",post_id:p,schema_type:a,schema_subtype:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){saswp_meta_list_fields[a]=s,saswp_get_meta_list(e,"text",saswp_meta_list_fields[a],null,i,null)},error:function(s){console.log(s)}}))}),saswpCustomSelect2(),saswp_enable_rating_review(),s('a[href="'+saswp_localize_data.collection_post_add_url+'"]').attr("href",saswp_localize_data.collection_post_add_new_url),s(document).on("click",".saswp_coonect_google_place",function(){var e=s("#saswp_google_place_id").val(),a=s("#saswp_language_list").val(),t=s("#saswp_googel_api").val();""!=e&&s.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{action:"saswp_connect_google_place",place_id:e,language:a,google_api:t,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},success:function(s){console.log(s.status)},error:function(s){console.log(s)}})}),s(document).on("click",".saswp-add-social-links",function(){s(".saswp-social-links-table").append('<tr><td><input type="text" placeholder="https://www.facebook.com/profile" name="sd_data[saswp_social_links][]" value=""></td><td><a class="button button-default saswp-rmv-modify_row">X</a></td></tr>')}),s(document).on("click",".saswp-show-accept-rv-popup",function(){tb_show("Reviews Form","#TB_inline??width=600&height=400&inlineId=saswp-accept-reviews-popup"),s(document).find("#TB_window").width(600).height(400).css({top:"100px","margin-top":"0px"})}),("saswp_reviews"==saswp_localize_data.post_type||"saswp-collections"==saswp_localize_data.post_type)&&"edit.php"==saswp_localize_data.page_now){var i='<div class="saswp-custom-post-tab">';i+='<div style="display:none;" id="saswp-accept-reviews-popup">',i+='<div class="saswp-accept-rv-container">',i+="<p>Use Below shortcode to show reviews form in your website. Using this you can accept reviews from your website directly</p>",i+='<div class="saswp-show-form-on-tab"><strong>Simple Form</strong> <input value="[saswp-reviews-form]" type="text" readonly></div>',i+='<div class="saswp-show-form-on-tab"><strong>Show form on button tap</strong> <input value="[saswp-reviews-form onbutton=&quot;1&quot;]" type="text" readonly></div>',i+="</div>",i+="</div>",i+='<h2 class="nav-tab-wrapper">',i+="<a href="+saswp_localize_data.reviews_page_url+' class="nav-tab '+(saswp_localize_data.current_url==saswp_localize_data.reviews_page_url?"saswp-global-selected":"")+'">Reviews</a>',i+="<a href="+saswp_localize_data.collections_page_url+' class="nav-tab '+(saswp_localize_data.current_url==saswp_localize_data.collections_page_url?"saswp-global-selected":"")+'">Collections</a>',i+='<a class="nav-tab saswp-show-accept-rv-popup">Accept Reviews</a>',i+="</h2>",i+="</div>",jQuery(jQuery(".wrap")).prepend(i)}"saswp"==saswp_localize_data.post_type&&"edit.php"==saswp_localize_data.page_now&&jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_localize_data.saswp_settings_url+"' id='' class='page-title-action'>Settings</a>"),"undefined"!=typeof saswp_reviews_data&&(console.log(saswp_reviews_data.rating_val),s(".saswp-rating-div").rateYo({spacing:"5px",rating:saswp_reviews_data.rating_val,readOnly:saswp_reviews_data.readonly,onSet:function(e,a){s(this).next().next().val(e)}}).on("rateyo.change",function(e,a){var t=a.rating;s(this).next().text(t)})),s("#sd-person-phone-number, #saswp_kb_telephone").focusout(function(){var e=s(this);e.parent().find(".saswp-phone-validation").remove();var a=s(this).val();/^\+([0-9]{1,3})\)?[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})[-. ]?([0-9]{2,4})$/.test(a)?e.parent().find(".saswp-phone-validation").remove():e.after('<span style="color:red;" class="saswp-phone-validation">Invalid Phone Number</span>')}),saswpCollectionSlider(),s(document).on("click",".saswp-grid-page",function(e){e.preventDefault(),saswp_grid_page=s(this).attr("data-id"),saswp_on_collection_design_change()}),s("#saswp-coll-pagination").change(function(){saswp_grid_page=1,s("#saswp-coll-per-page").parent().addClass("saswp_hide_imp"),s(this).is(":checked")&&s("#saswp-coll-per-page").parent().removeClass("saswp_hide_imp"),saswp_on_collection_design_change()}),s(".saswp-accordion").click(function(){s(this).toggleClass("active"),s(this).next(".saswp-accordion-panel").slideToggle(200)}),s(document).on("click",".saswp-opn-cls-btn",function(){s("#saswp-reviews-cntn").toggle(),s("#saswp-reviews-cntn").is(":visible")?(s(".saswp-onclick-show").css("display","flex"),s(".saswp-onclick-hide").hide(),s(".saswp-open-class").css("width","500px")):(s(".saswp-onclick-show").css("display","none"),s(".saswp-onclick-hide").show(),s(".saswp-open-class").css("width","300px"))}),s(".saswp-collection-display-method").change(function(){"shortcode"==s(this).val()?s(".saswp-collection-shortcode").removeClass("saswp_hide"):s(".saswp-collection-shortcode").addClass("saswp_hide")}).change(),s(document).on("click",".saswp-remove-platform",function(e){e.preventDefault();var a=s(this).attr("platform-id");saswp_collection.splice(a,1),s(this).parent().remove(),saswp_on_collection_design_change()}),s(".saswp-number-change").bind("keyup mouseup",function(){saswp_on_collection_design_change()}),s(".saswp-coll-settings-options").change(function(){saswp_grid_page=1;var e=s(".saswp-collection-desing").val();s(".saswp-coll-options").addClass("saswp_hide"),s(".saswp-collection-lp").css("height","auto"),"grid"==e&&s(".saswp-grid-options").removeClass("saswp_hide"),"gallery"==e&&s(".saswp-slider-options").removeClass("saswp_hide"),"fomo"==e&&(s(".saswp-fomo-options").removeClass("saswp_hide"),s(".saswp-collection-lp").css("height","31px")),"popup"==e&&s(".saswp-collection-lp").css("height","31px"),saswp_on_collection_design_change()}).change(),s(".saswp-add-to-collection").on("click",function(e){e.preventDefault();var a=s(this),t=s("#saswp-plaftorm-list").val(),i=s("#saswp-review-count").val();t&&i>0?(a.addClass("updating-message"),saswp_get_collection_data(i,t,a)):alert("Enter Count")});var p,c,o=s("#saswp_collection_id").val();o&&(s(".spinner").addClass("is-active"),s.get(ajaxurl,{action:"saswp_get_collection_platforms",collection_id:o,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},function(e){if(e.status){var a=e.message;s.each(a,function(s,e){saswp_get_collection_data(e,s,null)})}s(".spinner").removeClass("is-active")},"json")),(p=document.createElement("div")).style.cssText="position:absolute; background:black; color:white; padding:4px 6px;z-index:10000;border-radius:2px; font-size:12px;box-shadow:3px 3px 3px rgba(0,0,0,.4);opacity:0;transition:opacity 0.3s",p.innerHTML="Copied!",document.body.appendChild(p);var n=document.getElementById("motivatebox");n&&n.addEventListener("mouseup",function(s){var e=(s=s||event).target||s.srcElement;"motivate"==e.className&&(!function(s){var e=document.createRange();e.selectNodeContents(s);var a=window.getSelection();a.removeAllRanges(),a.addRange(e)}(e),function(){var s;try{s=document.execCommand("copy")}catch(e){s=!1}return s}()&&function(s){var e=s||event;clearTimeout(c),p.style.left=e.pageX-10+"px",p.style.top=e.pageY+15+"px",p.style.opacity=1,c=setTimeout(function(){p.style.opacity=0},500)}(s))},!1)});
admin_section/settings.php CHANGED
@@ -2281,7 +2281,33 @@ function saswp_compatibility_page_callback(){
2281
  'id' => 'saswp-wp-recipe-maker',
2282
  'name' => 'sd_data[saswp-wp-recipe-maker]',
2283
  )
2284
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2285
  $wp_ultimate_recipe = array(
2286
  'label' => 'WP Ultimate Recipe',
2287
  'id' => 'saswp-wp-ultimate-recipe-checkbox',
@@ -2698,6 +2724,8 @@ function saswp_compatibility_page_callback(){
2698
  $aiosp,
2699
  $squirrly_seo,
2700
  $recipe_maker,
 
 
2701
  $wp_ultimate_recipe,
2702
  $zip_recipes,
2703
  $total_recipe_generator,
2281
  'id' => 'saswp-wp-recipe-maker',
2282
  'name' => 'sd_data[saswp-wp-recipe-maker]',
2283
  )
2284
+ );
2285
+
2286
+ $wpzoom = array(
2287
+ 'label' => 'Recipe Card Blocks by WPZOOM',
2288
+ 'id' => 'saswp-wpzoom-checkbox',
2289
+ 'name' => 'saswp-wpzoom-checkbox',
2290
+ 'type' => 'checkbox',
2291
+ 'class' => 'checkbox saswp-checkbox',
2292
+ 'note' => saswp_get_field_note('wpzoom'),
2293
+ 'hidden' => array(
2294
+ 'id' => 'saswp-wpzoom',
2295
+ 'name' => 'sd_data[saswp-wpzoom]',
2296
+ )
2297
+ );
2298
+
2299
+ $recipress = array(
2300
+ 'label' => 'ReciPress',
2301
+ 'id' => 'saswp-recipress-checkbox',
2302
+ 'name' => 'saswp-recipress-checkbox',
2303
+ 'type' => 'checkbox',
2304
+ 'class' => 'checkbox saswp-checkbox',
2305
+ 'note' => saswp_get_field_note('recipress'),
2306
+ 'hidden' => array(
2307
+ 'id' => 'saswp-recipress',
2308
+ 'name' => 'sd_data[saswp-recipress]',
2309
+ )
2310
+ );
2311
  $wp_ultimate_recipe = array(
2312
  'label' => 'WP Ultimate Recipe',
2313
  'id' => 'saswp-wp-ultimate-recipe-checkbox',
2724
  $aiosp,
2725
  $squirrly_seo,
2726
  $recipe_maker,
2727
+ $recipress,
2728
+ $wpzoom,
2729
  $wp_ultimate_recipe,
2730
  $zip_recipes,
2731
  $total_recipe_generator,
core/array-list/compatibility-list.php CHANGED
@@ -304,6 +304,18 @@ return array(
304
  'opt_name' => 'saswp-wp-recipe-maker',
305
  'part_in' => 'free',
306
  ),
 
 
 
 
 
 
 
 
 
 
 
 
307
  'wp_ultimate_recipe' => array(
308
  'name' => 'WP Ultimate Recipe',
309
  'free' => 'wp-ultimate-recipe/wp-ultimate-recipe.php',
304
  'opt_name' => 'saswp-wp-recipe-maker',
305
  'part_in' => 'free',
306
  ),
307
+ 'wpzoom' => array(
308
+ 'name' => 'Recipe Card Blocks by WPZOOM',
309
+ 'free' => 'recipe-card-blocks-by-wpzoom/wpzoom-recipe-card.php',
310
+ 'opt_name' => 'saswp-wpzoom',
311
+ 'part_in' => 'free',
312
+ ),
313
+ 'recipress' => array(
314
+ 'name' => 'ReciPress',
315
+ 'free' => 'recipress/recipress.php',
316
+ 'opt_name' => 'saswp-recipress',
317
+ 'part_in' => 'free',
318
+ ),
319
  'wp_ultimate_recipe' => array(
320
  'name' => 'WP Ultimate Recipe',
321
  'free' => 'wp-ultimate-recipe/wp-ultimate-recipe.php',
core/array-list/schema-properties.php CHANGED
@@ -1504,12 +1504,60 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1504
  ),
1505
  ),
1506
  array(
1507
- 'label' => 'Nutrition',
1508
  'id' => 'saswp_recipe_nutrition_'.$schema_id,
1509
  'type' => 'text',
1510
  'attributes' => array(
1511
  'placeholder' => '270 calories'
1512
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1513
  ),
1514
  array(
1515
  'label' => 'Recipe Ingredient',
@@ -1537,6 +1585,11 @@ function saswp_get_fields_by_schema_type( $schema_id = null, $condition = null,
1537
  'placeholder' => 'Video Name'
1538
  ),
1539
  ),
 
 
 
 
 
1540
  array(
1541
  'label' => 'Video Description',
1542
  'id' => 'saswp_recipe_video_description_'.$schema_id,
1504
  ),
1505
  ),
1506
  array(
1507
+ 'label' => 'Calories',
1508
  'id' => 'saswp_recipe_nutrition_'.$schema_id,
1509
  'type' => 'text',
1510
  'attributes' => array(
1511
  'placeholder' => '270 calories'
1512
  ),
1513
+ ),
1514
+ array(
1515
+ 'label' => 'Protein',
1516
+ 'id' => 'saswp_recipe_protein_'.$schema_id,
1517
+ 'type' => 'text',
1518
+ 'attributes' => array(
1519
+ 'placeholder' => '270 grams'
1520
+ ),
1521
+ ),
1522
+ array(
1523
+ 'label' => 'Fat',
1524
+ 'id' => 'saswp_recipe_fat_'.$schema_id,
1525
+ 'type' => 'text',
1526
+ 'attributes' => array(
1527
+ 'placeholder' => '270 grams'
1528
+ ),
1529
+ ),
1530
+ array(
1531
+ 'label' => 'Fiber',
1532
+ 'id' => 'saswp_recipe_fiber_'.$schema_id,
1533
+ 'type' => 'text',
1534
+ 'attributes' => array(
1535
+ 'placeholder' => '270 grams'
1536
+ ),
1537
+ ),
1538
+ array(
1539
+ 'label' => 'Sodium',
1540
+ 'id' => 'saswp_recipe_sodium_'.$schema_id,
1541
+ 'type' => 'text',
1542
+ 'attributes' => array(
1543
+ 'placeholder' => '270 grams'
1544
+ ),
1545
+ ),
1546
+ array(
1547
+ 'label' => 'Sugar',
1548
+ 'id' => 'saswp_recipe_sugar_'.$schema_id,
1549
+ 'type' => 'text',
1550
+ 'attributes' => array(
1551
+ 'placeholder' => '270 grams'
1552
+ ),
1553
+ ),
1554
+ array(
1555
+ 'label' => 'Carbohydrate',
1556
+ 'id' => 'saswp_recipe_carbohydrate_'.$schema_id,
1557
+ 'type' => 'text',
1558
+ 'attributes' => array(
1559
+ 'placeholder' => '270 grams'
1560
+ ),
1561
  ),
1562
  array(
1563
  'label' => 'Recipe Ingredient',
1585
  'placeholder' => 'Video Name'
1586
  ),
1587
  ),
1588
+ array(
1589
+ 'label' => 'Video URL',
1590
+ 'id' => 'saswp_recipe_video_url_'.$schema_id,
1591
+ 'type' => 'text',
1592
+ ),
1593
  array(
1594
  'label' => 'Video Description',
1595
  'id' => 'saswp_recipe_video_description_'.$schema_id,
modules/elementor/assets/js/qanda-block.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function( $ ) {
2
+ /**
3
+ * @param $scope The Widget wrapper element as a jQuery element
4
+ * @param $ The jQuery alias
5
+ */
6
+ var WidgetHelloWorldHandler = function( $scope, $ ) {
7
+ console.log( $scope );
8
+ };
9
+
10
+ // Make sure you run this code under Elementor.
11
+ $( window ).on( 'elementor/frontend/init', function() {
12
+ elementorFrontend.hooks.addAction( 'frontend/element_ready/qanda-block.default', WidgetHelloWorldHandler );
13
+ } );
14
+ } )( jQuery );
modules/elementor/elementor-loader.php CHANGED
@@ -47,6 +47,7 @@ class SASWP_Elementor_Loader {
47
  */
48
  public function widget_scripts() {
49
  wp_register_script( 'saswp-elementor-faq-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/faq-block.js', [ 'jquery' ], false, true );
 
50
  wp_register_script( 'saswp-elementor-how-to-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/how-to-block.js', [ 'jquery' ], false, true );
51
  }
52
 
@@ -60,6 +61,7 @@ class SASWP_Elementor_Loader {
60
  */
61
  private function include_widgets_files() {
62
  require_once( __DIR__ . '/widgets/faq-block.php' );
 
63
  require_once( __DIR__ . '/widgets/how-to-block.php' );
64
  }
65
 
@@ -78,6 +80,8 @@ class SASWP_Elementor_Loader {
78
  // Register Widgets
79
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Faq_Block() );
80
 
 
 
81
  // Register Widgets
82
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\HowTo_Block() );
83
  }
47
  */
48
  public function widget_scripts() {
49
  wp_register_script( 'saswp-elementor-faq-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/faq-block.js', [ 'jquery' ], false, true );
50
+ wp_register_script( 'saswp-elementor-faq-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/qanda-block.js', [ 'jquery' ], false, true );
51
  wp_register_script( 'saswp-elementor-how-to-widget', SASWP_PLUGIN_URL .'/modules/elementor/assets/js/how-to-block.js', [ 'jquery' ], false, true );
52
  }
53
 
61
  */
62
  private function include_widgets_files() {
63
  require_once( __DIR__ . '/widgets/faq-block.php' );
64
+ require_once( __DIR__ . '/widgets/qanda-block.php' );
65
  require_once( __DIR__ . '/widgets/how-to-block.php' );
66
  }
67
 
80
  // Register Widgets
81
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Faq_Block() );
82
 
83
+ \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Qanda_Block() );
84
+
85
  // Register Widgets
86
  \Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\HowTo_Block() );
87
  }
modules/elementor/widgets/qanda-block.php ADDED
@@ -0,0 +1,385 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace SASWPElementorModule\Widgets;
3
+
4
+ use Elementor\Repeater;
5
+ use Elementor\Widget_Base;
6
+ use Elementor\Controls_Manager;
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
9
+
10
+
11
+ class Qanda_Block extends Widget_Base {
12
+
13
+ public function get_name() {
14
+ return 'saswp-qanda-block';
15
+ }
16
+
17
+ public function get_title() {
18
+ return __( 'Q&A Block', 'elementor' );
19
+ }
20
+ public function get_keywords() {
21
+ return [ 'Q&A', 'Q&A schema','qanda schema', 'schema', 'structured data' ];
22
+ }
23
+ public function get_icon() {
24
+ return 'eicon-text';
25
+ }
26
+
27
+ protected function _register_controls() {
28
+
29
+ //Question section starts here
30
+
31
+ $this->start_controls_section(
32
+ 'question_section',
33
+ [
34
+ 'label' => __( 'Question', 'schema-and-structured-data-for-wp' ),
35
+ 'tab' => Controls_Manager::TAB_CONTENT,
36
+ ]
37
+ );
38
+
39
+ $this->add_control(
40
+ 'question_name',
41
+ [
42
+ 'label' => __( 'Name', 'schema-and-structured-data-for-wp' ),
43
+ 'type' => Controls_Manager::TEXT,
44
+ 'placeholder' => __( 'Enter Question Name', 'schema-and-structured-data-for-wp' ),
45
+ ]
46
+ );
47
+
48
+ $this->add_control(
49
+ 'question_text',
50
+ [
51
+ 'label' => __( 'Text', 'schema-and-structured-data-for-wp' ),
52
+ 'type' => Controls_Manager::TEXTAREA,
53
+ 'placeholder' => __( 'Enter Question Description', 'schema-and-structured-data-for-wp' ),
54
+ ]
55
+ );
56
+
57
+ $this->add_control(
58
+ 'question_vote',
59
+ [
60
+ 'label' => __( 'Vote', 'schema-and-structured-data-for-wp' ),
61
+ 'type' => Controls_Manager::NUMBER,
62
+ ]
63
+ );
64
+
65
+ $this->add_control(
66
+ 'question_author',
67
+ [
68
+ 'label' => __( 'Author', 'schema-and-structured-data-for-wp' ),
69
+ 'type' => Controls_Manager::TEXT,
70
+ 'placeholder' => __( 'Enter author name', 'schema-and-structured-data-for-wp' ),
71
+ ]
72
+ );
73
+
74
+ $this->add_control(
75
+ 'question_date',
76
+ [
77
+ 'label' => __( 'Date', 'schema-and-structured-data-for-wp' ),
78
+ 'type' => Controls_Manager::DATE_TIME,
79
+ ]
80
+ );
81
+
82
+ $this->end_controls_section();
83
+
84
+
85
+ //Question section ends here
86
+
87
+ //Accepted Ansesers section starts here
88
+ $this->start_controls_section(
89
+ 'accepted_answers_section',
90
+ [
91
+ 'label' => __( 'Accepted Answers', 'schema-and-structured-data-for-wp' ),
92
+ 'tab' => Controls_Manager::TAB_CONTENT,
93
+ ]
94
+ );
95
+
96
+ $accepted_repeater = new Repeater();
97
+
98
+ $accepted_repeater->add_control(
99
+ 'text', [
100
+ 'label' => __( 'Text', 'schema-and-structured-data-for-wp' ),
101
+ 'type' => Controls_Manager::TEXTAREA,
102
+ 'label_block' => true
103
+ ]
104
+ );
105
+
106
+ $accepted_repeater->add_control(
107
+ 'vote', [
108
+ 'label' => __( 'Vote', 'schema-and-structured-data-for-wp' ),
109
+ 'type' => Controls_Manager::NUMBER,
110
+ 'show_label' => true
111
+ ]
112
+ );
113
+ $accepted_repeater->add_control(
114
+ 'url', [
115
+ 'label' => __( 'URL', 'schema-and-structured-data-for-wp' ),
116
+ 'type' => Controls_Manager::TEXT,
117
+ 'show_label' => true
118
+ ]
119
+ );
120
+ $accepted_repeater->add_control(
121
+ 'author', [
122
+ 'label' => __( 'Author', 'schema-and-structured-data-for-wp' ),
123
+ 'type' => Controls_Manager::TEXT,
124
+ 'show_label' => true
125
+ ]
126
+ );
127
+ $accepted_repeater->add_control(
128
+ 'date', [
129
+ 'label' => __( 'Date Created', 'schema-and-structured-data-for-wp' ),
130
+ 'type' => Controls_Manager::DATE_TIME,
131
+ 'show_label' => true
132
+ ]
133
+ );
134
+
135
+ $this->add_control(
136
+ 'accepted_answers',
137
+ [
138
+ 'label' => __( 'Accepted Answers List', 'schema-and-structured-data-for-wp' ),
139
+ 'type' => Controls_Manager::REPEATER,
140
+ 'fields' => $accepted_repeater->get_controls(),
141
+ 'title_field' => '{{{ text }}}',
142
+ ]
143
+ );
144
+
145
+ $this->end_controls_section();
146
+ //Accepted answers section ends here
147
+
148
+ //suggested Ansesers section starts here
149
+ $this->start_controls_section(
150
+ 'suggested_answers_section',
151
+ [
152
+ 'label' => __( 'Suggested Answers', 'schema-and-structured-data-for-wp' ),
153
+ 'tab' => Controls_Manager::TAB_CONTENT,
154
+ ]
155
+ );
156
+
157
+ $suggested_repeater = new Repeater();
158
+
159
+ $suggested_repeater->add_control(
160
+ 'text', [
161
+ 'label' => __( 'Text', 'schema-and-structured-data-for-wp' ),
162
+ 'type' => Controls_Manager::TEXTAREA,
163
+ 'label_block' => true
164
+ ]
165
+ );
166
+
167
+ $suggested_repeater->add_control(
168
+ 'vote', [
169
+ 'label' => __( 'Vote', 'schema-and-structured-data-for-wp' ),
170
+ 'type' => Controls_Manager::NUMBER,
171
+ 'show_label' => true
172
+ ]
173
+ );
174
+ $suggested_repeater->add_control(
175
+ 'url', [
176
+ 'label' => __( 'URL', 'schema-and-structured-data-for-wp' ),
177
+ 'type' => Controls_Manager::TEXT,
178
+ 'show_label' => true
179
+ ]
180
+ );
181
+ $suggested_repeater->add_control(
182
+ 'author', [
183
+ 'label' => __( 'Author', 'schema-and-structured-data-for-wp' ),
184
+ 'type' => Controls_Manager::TEXT,
185
+ 'show_label' => true
186
+ ]
187
+ );
188
+ $suggested_repeater->add_control(
189
+ 'date', [
190
+ 'label' => __( 'Date Created', 'schema-and-structured-data-for-wp' ),
191
+ 'type' => Controls_Manager::DATE_TIME,
192
+ 'show_label' => true
193
+ ]
194
+ );
195
+
196
+ $this->add_control(
197
+ 'suggested_answers',
198
+ [
199
+ 'label' => __( 'suggested Answers List', 'schema-and-structured-data-for-wp' ),
200
+ 'type' => Controls_Manager::REPEATER,
201
+ 'fields' => $suggested_repeater->get_controls(),
202
+ 'title_field' => '{{{ text }}}',
203
+ ]
204
+ );
205
+
206
+ $this->end_controls_section();
207
+ //suggested answers section ends here
208
+
209
+ }
210
+
211
+ protected function render() {
212
+
213
+ global $saswp_elementor_qanda;
214
+
215
+ $attributes = $this->get_settings_for_display();
216
+ $saswp_elementor_qanda = $attributes;
217
+ $response = '';
218
+ $accepted_answers = '';
219
+ $suggested_answers = '';
220
+ $question = '';
221
+
222
+ $question = '<div class="saswp-qanda-block-question">
223
+ <h3>'.esc_html($attributes['question_name']).'</h3>
224
+ <span class="saswp-qand-date">'.esc_html($attributes['question_date']).' '. __( 'Accepted Answers', 'schema-and-structured-data-for-wp' ).' '.esc_html($attributes['question_author']).'</span>
225
+ <p>'.esc_html($attributes['question_text']).'</p>
226
+ '.__( 'Vote', 'schema-and-structured-data-for-wp' ).' <span class="dashicons dashicons-thumbs-up"></span> ('.esc_html($attributes['question_vote']).')
227
+ </div>';
228
+
229
+ if(isset($attributes['accepted_answers']) && !empty($attributes['accepted_answers'])){
230
+
231
+ foreach($attributes['accepted_answers'] as $answer){
232
+
233
+ $accepted_answers .= '<li>
234
+ <a href="'.esc_url($answer['url']).'">
235
+ <p>'.esc_html($answer['text']).'</p>
236
+ </a>
237
+ <span class="saswp-qand-date">'.esc_html($answer['date']).' '.__( 'By', 'schema-and-structured-data-for-wp' ).' <strong>'.esc_html($answer['author']).'</strong></span>
238
+ <br> '. __( 'Vote', 'schema-and-structured-data-for-wp' ).' <span class="dashicons dashicons-thumbs-up"></span> ('.esc_html($answer['vote']).')
239
+ </li>';
240
+
241
+ }
242
+
243
+ }
244
+
245
+ if(isset($attributes['suggested_answers']) && !empty($attributes['suggested_answers'])){
246
+
247
+ foreach($attributes['suggested_answers'] as $answer){
248
+
249
+ $suggested_answers .= '<li>
250
+ <a href="'.esc_url($answer['url']).'">
251
+ <p>'.esc_html($answer['text']).'</p>
252
+ </a>
253
+ <span class="saswp-qand-date">'.esc_html($answer['date']).' '.__( 'by', 'schema-and-structured-data-for-wp' ).' <strong>'.esc_html($answer['author']).'</strong></span>
254
+ <br> '.__( 'vote', 'schema-and-structured-data-for-wp' ).' <span class="dashicons dashicons-thumbs-up"></span> ('.esc_html($answer['vote']).')
255
+ </li>';
256
+ }
257
+
258
+ }
259
+ //Escaping has been done above for all below html
260
+ $response = '<div class="saswp-qanda-block-html">
261
+ '.$question.'
262
+ <div class="saswp-qanda-block-answer"><h3>'.__( 'Accepted Answers', 'schema-and-structured-data-for-wp' ).'</h3>'.$accepted_answers.'</div>
263
+ <div class="saswp-qanda-block-answer"><h3>'.__( 'Suggested Answers', 'schema-and-structured-data-for-wp' ).'</h3>'.$suggested_answers.'</div>
264
+ </div>';
265
+
266
+ echo $response;
267
+ }
268
+
269
+ protected function _content_template() {
270
+ ?>
271
+
272
+ <#
273
+
274
+ if ( settings.question_name) {
275
+ #>
276
+ <h3>{{{settings.question_name}}}</h3>
277
+ <p>{{{settings.question_text}}}</p>
278
+ <#
279
+
280
+ var q_date = new Date(settings.question_date);
281
+
282
+ if(q_date.getDate()){
283
+ #>
284
+ <span class="saswp-qand-date">{{{q_date.getDate()}}}-{{{q_date.getMonth()}}}-{{{q_date.getFullYear()}}} {{{q_date.getHours()}}}:{{{q_date.getMinutes()}}}:{{{q_date.getSeconds()}}}</span>
285
+ <#
286
+ }
287
+
288
+ if(settings.question_author){
289
+ #>
290
+ by <strong>{{{settings.question_author}}}</strong>
291
+ <#
292
+ }
293
+
294
+ if(settings.question_vote){
295
+ #>
296
+ <br> Vote <span class="dashicons dashicons-thumbs-up"></span> ({{{ settings.question_vote }}})
297
+ <#
298
+ }
299
+
300
+ }
301
+ if ( settings.accepted_answers.length ) {
302
+
303
+ #>
304
+ <h3><?php echo __( 'Accepted Answers', 'schema-and-structured-data-for-wp' ); ?></h3>
305
+ <ul>
306
+ <# _.each( settings.accepted_answers, function( item, index ) {
307
+
308
+ var date = new Date( item.date );
309
+
310
+ if(item.text){
311
+
312
+ #>
313
+ <li class="elementor-repeater-item-{{ item._id }}">
314
+ <a href="{{ item.url }}">
315
+ <p>{{{ item.text }}}</p>
316
+ </a>
317
+ <#
318
+ if(date.getDate()){
319
+ #>
320
+ <span class="saswp-qand-date">{{{date.getDate()}}}-{{{date.getMonth()}}}-{{{date.getFullYear()}}} {{{date.getHours()}}}:{{{date.getMinutes()}}}:{{{date.getSeconds()}}} </span>
321
+ <#
322
+ }
323
+ if(item.author){
324
+ #>
325
+ by <strong>{{{item.author}}}</strong>
326
+ <#
327
+ }
328
+
329
+ if(item.vote){
330
+ #>
331
+ <br> <?php echo __( 'Vote', 'schema-and-structured-data-for-wp' ); ?> <span class="dashicons dashicons-thumbs-up"></span> ({{{ item.vote }}})
332
+ <#
333
+ }
334
+ #>
335
+
336
+ </li>
337
+
338
+ <# } }); #>
339
+ </ul>
340
+ <# } #>
341
+
342
+ <# if ( settings.suggested_answers.length ) {
343
+
344
+ #>
345
+ <h3><?php echo __( 'Suggested Answers', 'schema-and-structured-data-for-wp' ); ?></h3>
346
+ <ul>
347
+ <# _.each( settings.suggested_answers, function( item, index ) {
348
+
349
+ var date = new Date( item.date );
350
+
351
+ if(item.text){
352
+
353
+ #>
354
+ <li class="elementor-repeater-item-{{ item._id }}">
355
+ <a href="{{ item.url }}">
356
+ <p>{{{ item.text }}}</p>
357
+ </a>
358
+ <#
359
+ if(date.getDate()){
360
+ #>
361
+ <span class="saswp-qand-date">{{{date.getDate()}}}-{{{date.getMonth()}}}-{{{date.getFullYear()}}} {{{date.getHours()}}}:{{{date.getMinutes()}}}:{{{date.getSeconds()}}} </span>
362
+ <#
363
+ }
364
+ if(item.author){
365
+ #>
366
+ by <strong>{{{item.author}}}</strong>
367
+ <#
368
+ }
369
+
370
+ if(item.vote){
371
+ #>
372
+ <br> <?php echo __( 'Vote', 'schema-and-structured-data-for-wp' ); ?> <span class="dashicons dashicons-thumbs-up"></span> ({{{ item.vote }}})
373
+ <#
374
+ }
375
+ #>
376
+
377
+ </li>
378
+
379
+ <# } }); #>
380
+ </ul>
381
+ <# } #>
382
+
383
+ <?php
384
+ }
385
+ }
modules/gutenberg/assets/blocks/qanda.js ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ( function( blocks, element, editor, components, i18n) {
3
+
4
+ const el = element.createElement;
5
+ const { __ } = i18n;
6
+ const { RichText, AlignmentToolbar, BlockControls, InspectorControls, MediaUpload } = editor;
7
+ const {SelectControl, Popover, Button, IconButton, TextControl, ToggleControl, PanelBody, DateTimePicker } = components;
8
+
9
+ blocks.registerBlockType( 'saswp/qanda-block', {
10
+ title: __('Q&A (SASWP)', 'schema-and-structured-data-for-wp'),
11
+ icon: 'calendar',
12
+ category: 'saswp-blocks',
13
+ keywords: ['schema', 'structured data', 'qanda', 'Q&A', 'Q and A'],
14
+
15
+ attributes:{
16
+ question_date_created: {
17
+ type: 'string'
18
+ },
19
+ question_time_created: {
20
+ type: 'string'
21
+ },
22
+ question_date_created_iso: {
23
+ type: 'string'
24
+ },
25
+ question_date_created_toggle: {
26
+ type: 'boolean',
27
+ default: false
28
+ },
29
+ question_name: {
30
+ type: 'string'
31
+ },
32
+ question_text: {
33
+ type: 'string'
34
+ },
35
+ question_up_vote: {
36
+ type: 'string'
37
+ },
38
+ question_author: {
39
+ type: 'string'
40
+ },
41
+ accepted_answers: {
42
+ default: [{index: 0, text: '', vote: '', url: '', author: ''}],
43
+ query: {
44
+ index: {
45
+ type: 'number',
46
+ attribute: 'data-index'
47
+ },
48
+ isSelected: {
49
+ type: 'boolean',
50
+ default:false
51
+ },
52
+ text: {
53
+ type: 'string'
54
+ },
55
+ vote: {
56
+ type: 'string'
57
+ },
58
+ url: {
59
+ type: 'string'
60
+ },
61
+ author: {
62
+ type: 'string'
63
+ },
64
+ date_created: {
65
+ type: 'string'
66
+ },
67
+ time_created: {
68
+ type: 'string'
69
+ },
70
+ date_created_iso: {
71
+ type: 'string'
72
+ },
73
+ date_created_toggle: {
74
+ type: 'boolean',
75
+ default: false
76
+ },
77
+ }
78
+ },
79
+ suggested_answers: {
80
+ default: [{index: 0, text: '', vote: '', url: '', author: ''}],
81
+ query: {
82
+ index: {
83
+ type: 'number',
84
+ attribute: 'data-index'
85
+ },
86
+ isSelected: {
87
+ type: 'boolean',
88
+ default:false
89
+ },
90
+ text: {
91
+ type: 'string'
92
+ },
93
+ vote: {
94
+ type: 'string'
95
+ },
96
+ url: {
97
+ type: 'string'
98
+ },
99
+ author: {
100
+ type: 'string'
101
+ },
102
+ date_created: {
103
+ type: 'string'
104
+ },
105
+ time_created: {
106
+ type: 'string'
107
+ },
108
+ date_created_iso: {
109
+ type: 'string'
110
+ },
111
+ date_created_toggle: {
112
+ type: 'boolean',
113
+ default: false
114
+ },
115
+ }
116
+ },
117
+ },
118
+
119
+ // Allow only one How To block per post.
120
+ supports: {
121
+ multiple: false
122
+ },
123
+
124
+ edit: function( props ) {
125
+
126
+ var attributes = props.attributes;
127
+
128
+ function saswpRemoveRepeater(oldItems, fieldname, item){
129
+
130
+ const oldAttributes = attributes;
131
+ const newTestimonials = oldItems.filter(function(itemFilter){
132
+
133
+ return itemFilter.index != item.index
134
+ }).map(function(t){
135
+ if (t.index > oldItems.index) {
136
+ t.index -= 1;
137
+ }
138
+ return t;
139
+ });
140
+
141
+ newTestimonials.forEach(function(value, index){
142
+ newTestimonials[index]['index'] = index;
143
+ });
144
+
145
+ oldAttributes[fieldname] = newTestimonials;
146
+ props.setAttributes({
147
+ attributes: oldAttributes
148
+ });
149
+
150
+ }
151
+ function _cloneArray(arr) {
152
+ if (Array.isArray(arr)) {
153
+ for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
154
+ arr2[i] = arr[i];
155
+ }
156
+ return arr2;
157
+ } else {
158
+ return Array.from(arr);
159
+ }
160
+ }
161
+
162
+ function saswp_on_item_change(newObject, item, type){
163
+
164
+ if(type == 'suggested_answers'){
165
+ return props.setAttributes({
166
+ suggested_answers: [].concat(_cloneArray(props.attributes.suggested_answers.filter(function (itemFilter) {
167
+ return itemFilter.index != item.index;
168
+ })), [newObject])
169
+ });
170
+ }
171
+
172
+ if(type == 'accepted_answers'){
173
+ return props.setAttributes({
174
+ accepted_answers: [].concat(_cloneArray(props.attributes.accepted_answers.filter(function (itemFilter) {
175
+ return itemFilter.index != item.index;
176
+ })), [newObject])
177
+ });
178
+ }
179
+
180
+ }
181
+
182
+ function saswp_answer_date_picker(item, answer_type){
183
+
184
+ var start_date_div = el('div',{},el('span', {}, 'Date Created'),
185
+ el('span',{className:'saswp-qanda-date-fields'},
186
+ el(TextControl,{
187
+ className:'saswp-qanda-start-date',
188
+ value : item.date_created,
189
+ onClick:function(){
190
+ var newObject = Object.assign({}, item, {
191
+ date_created_toggle: true
192
+ });
193
+ saswp_on_item_change(newObject, item, answer_type);
194
+ }
195
+ }),
196
+ el(TextControl,{
197
+ className:'saswp-qanda-start-time',
198
+ value : item.time_created,
199
+ onClick:function(){
200
+ var newObject = Object.assign({}, item, {
201
+ date_created_toggle: true
202
+ });
203
+ saswp_on_item_change(newObject, item, answer_type);
204
+ }
205
+ })
206
+ ),
207
+ item.date_created_toggle ?
208
+ el(
209
+ Popover,{
210
+ class:'saswp-calender-popover',
211
+ position: 'bottom',
212
+ onClose: function(){
213
+ var newObject = Object.assign({}, item, {
214
+ date_created_toggle: false
215
+ });
216
+ saswp_on_item_change(newObject, item, answer_type);
217
+ }
218
+ },
219
+ el(DateTimePicker,{
220
+ currentDate: item.date_created_iso,
221
+ is12Hour : true,
222
+ onChange: function(value){
223
+ item.date_created_iso = value;
224
+ var newDate = moment(value).format('YYYY-MM-DD');
225
+ var newTime = moment(value).format('h:mm:ss a');
226
+
227
+ var newObject = Object.assign({}, item, {
228
+ date_created: newDate,
229
+ time_created: newTime
230
+ });
231
+ saswp_on_item_change(newObject, item, answer_type);
232
+
233
+ }
234
+ })
235
+ )
236
+ : ''
237
+ );
238
+
239
+ return start_date_div;
240
+ }
241
+
242
+ var start_date_div = el('div',{},el('span', {}, 'Date Created'),
243
+ el('span',{className:'saswp-qanda-date-fields'},
244
+ el(TextControl,{
245
+ className:'saswp-qanda-start-date',
246
+ value : attributes.question_date_created,
247
+ onClick:function(){
248
+ props.setAttributes( { question_date_created_toggle: true } );
249
+ }
250
+ }),
251
+ el(TextControl,{
252
+ className:'saswp-qanda-start-time',
253
+ value : attributes.question_time_created,
254
+ onClick:function(){
255
+ props.setAttributes( { question_date_created_toggle: true } );
256
+ }
257
+ })
258
+ ),
259
+ attributes.question_date_created_toggle ?
260
+ el(
261
+ Popover,{
262
+ class:'saswp-calender-popover',
263
+ position: 'bottom',
264
+ onClose: function(){
265
+ props.setAttributes( { question_date_created_toggle: false } );
266
+ }
267
+ },
268
+ el(DateTimePicker,{
269
+ currentDate: attributes.question_date_created_iso,
270
+ is12Hour : true,
271
+ onChange: function(value){
272
+ attributes.question_date_created_iso = value;
273
+ var newDate = moment(value).format('YYYY-MM-DD');
274
+ var newTime = moment(value).format('h:mm:ss a');
275
+ props.setAttributes( { question_date_created: newDate } );
276
+ props.setAttributes( { question_time_created: newTime } );
277
+
278
+ }
279
+ })
280
+ )
281
+ : ''
282
+ );
283
+
284
+ var qanda_details = el('fieldset',{
285
+ className:'saswp-qanda-date-fieldset'},
286
+ el(TextControl,{
287
+ value : attributes.question_name,
288
+ label: __('Question Name', 'schema-and-structured-data-for-wp'),
289
+ onChange: function(value){
290
+ props.setAttributes( { question_name: value } );
291
+ }
292
+ }),
293
+ el(TextControl,{
294
+ value : attributes.question_text,
295
+ type : "textarea",
296
+ label : __('Question Text', 'schema-and-structured-data-for-wp'),
297
+ onChange: function(value){
298
+ props.setAttributes( { question_text: value } );
299
+ }
300
+ }),
301
+ el(TextControl,{
302
+ value : attributes.question_up_vote,
303
+ type : 'number',
304
+ label: __('Up Vote Count', 'schema-and-structured-data-for-wp'),
305
+ onChange: function(value){
306
+ props.setAttributes( { question_up_vote: value } );
307
+ }
308
+ }),
309
+ el(TextControl,{
310
+ value : attributes.question_author,
311
+ label: __('Author', 'schema-and-structured-data-for-wp'),
312
+ onChange: function(value){
313
+ props.setAttributes( { question_author: value } );
314
+ }
315
+ }),
316
+ start_date_div
317
+ );
318
+
319
+
320
+ var organizers_loop = attributes.accepted_answers.sort(function(a, b){
321
+ return a.index - b.index;
322
+ }).map(function(item){
323
+
324
+ return el('fieldset',{className:'saswp-qanda-organisers-fieldset'},el('div',{className:'saswp-qanda-organisers'},
325
+ el(IconButton,{
326
+ icon:'trash',
327
+ className: 'saswp-remove-repeater',
328
+ onClick: function(e){
329
+
330
+ const oldItems = attributes.accepted_answers;
331
+ const fieldname = 'accepted_answers';
332
+ saswpRemoveRepeater(oldItems, fieldname, item);
333
+ }
334
+ }),
335
+ el(TextControl,{
336
+ label:__('Text', 'schema-and-structured-data-for-wp'),
337
+ value: item.text,
338
+ type : "textarea",
339
+ onChange: function( value ) {
340
+ var newObject = Object.assign({}, item, {
341
+ text: value
342
+ });
343
+ saswp_on_item_change(newObject, item, 'accepted_answers');
344
+ }
345
+ }),
346
+ el(TextControl,{
347
+ label:__('Up Vote Count', 'schema-and-structured-data-for-wp'),
348
+ value: item.vote,
349
+ type : 'number',
350
+ onChange: function(value){
351
+ var newObject = Object.assign({}, item, {
352
+ vote: value
353
+ });
354
+ saswp_on_item_change(newObject, item, 'accepted_answers');
355
+ }
356
+ }),
357
+ el(TextControl,{
358
+ label:__('URL', 'schema-and-structured-data-for-wp'),
359
+ value: item.url,
360
+ onChange: function(value){
361
+ var newObject = Object.assign({}, item, {
362
+ url: value
363
+ });
364
+ saswp_on_item_change(newObject, item, 'accepted_answers');
365
+
366
+ }
367
+ }),
368
+ el(TextControl,{
369
+ label:__('Author', 'schema-and-structured-data-for-wp'),
370
+ value: item.author,
371
+ onChange: function(value){
372
+ var newObject = Object.assign({}, item, {
373
+ author: value
374
+ });
375
+ saswp_on_item_change(newObject, item, 'accepted_answers');
376
+ }
377
+ }),
378
+ saswp_answer_date_picker(item, 'accepted_answers')
379
+ ));
380
+
381
+ });
382
+
383
+ var suggested_loop = attributes.suggested_answers.sort(function(a, b){
384
+ return a.index - b.index;
385
+ }).map(function(item){
386
+
387
+ return el('fieldset',{className:'saswp-qanda-organisers-fieldset'},el('div',{className:'saswp-qanda-organisers'},
388
+ el(IconButton,{
389
+ icon:'trash',
390
+ className: 'saswp-remove-repeater',
391
+ onClick: function(e){
392
+
393
+ const oldItems = attributes.suggested_answers;
394
+ const fieldname = 'suggested_answers';
395
+ saswpRemoveRepeater(oldItems, fieldname, item);
396
+ }
397
+ }),
398
+ el(TextControl,{
399
+ label:__('Text', 'schema-and-structured-data-for-wp'),
400
+ value: item.text,
401
+ type : "textarea",
402
+ onChange: function( value ) {
403
+ var newObject = Object.assign({}, item, {
404
+ text: value
405
+ });
406
+ saswp_on_item_change(newObject, item, 'suggested_answers');
407
+ }
408
+ }),
409
+ el(TextControl,{
410
+ label:__('Up Vote Count', 'schema-and-structured-data-for-wp'),
411
+ value: item.vote,
412
+ type : 'number',
413
+ onChange: function(value){
414
+ var newObject = Object.assign({}, item, {
415
+ vote: value
416
+ });
417
+ saswp_on_item_change(newObject, item, 'suggested_answers');
418
+ }
419
+ }),
420
+ el(TextControl,{
421
+ label:__('URL', 'schema-and-structured-data-for-wp'),
422
+ value: item.url,
423
+ onChange: function(value){
424
+ var newObject = Object.assign({}, item, {
425
+ url: value
426
+ });
427
+ saswp_on_item_change(newObject, item, 'suggested_answers');
428
+
429
+ }
430
+ }),
431
+ el(TextControl,{
432
+ label:__('Author', 'schema-and-structured-data-for-wp'),
433
+ value: item.author,
434
+ onChange: function(value){
435
+ var newObject = Object.assign({}, item, {
436
+ author: value
437
+ });
438
+ saswp_on_item_change(newObject, item, 'suggested_answers');
439
+ }
440
+ }),
441
+ saswp_answer_date_picker(item, 'suggested_answers')
442
+ ));
443
+
444
+ });
445
+
446
+ var organizers = el('fieldset',{className:'saswp-qanda-organisers-fieldset'},el('div',{
447
+ className:'saswp-qanda-organisers-container'
448
+ },
449
+ el('h3',{},__('Accepted Answer', 'schema-and-structured-data-for-wp')),
450
+ organizers_loop,
451
+ el(Button,{
452
+ className:'saswp-org-repeater',
453
+ isSecondary: true,
454
+ isLarge : true,
455
+ onClick: function() {
456
+ return props.setAttributes({
457
+ accepted_answers: [].concat(_cloneArray(props.attributes.accepted_answers), [{
458
+ index: props.attributes.accepted_answers.length
459
+ }])
460
+ });
461
+ }
462
+ },
463
+ __('Add More Accepted Answer', 'schema-and-structured-data-for-wp')
464
+ ),
465
+ ));
466
+ var suggested = el('fieldset',{className:'saswp-qanda-organisers-fieldset'},el('div',{
467
+ className:'saswp-qanda-organisers-container'
468
+ },
469
+ el('h3',{},__('Suggested Answer', 'schema-and-structured-data-for-wp')),
470
+ suggested_loop,
471
+ el(Button,{
472
+ className:'saswp-org-repeater',
473
+ isSecondary: true,
474
+ isLarge : true,
475
+ onClick: function() {
476
+ return props.setAttributes({
477
+ suggested_answers: [].concat(_cloneArray(props.attributes.suggested_answers), [{
478
+ index: props.attributes.suggested_answers.length
479
+ }])
480
+ });
481
+ }
482
+ },
483
+ __('Add More Suggested Answer', 'schema-and-structured-data-for-wp')
484
+ ),
485
+ ));
486
+
487
+ return [el(InspectorControls,{className:'saswp-qanda-inspector'},
488
+ el(PanelBody,
489
+ {className:'saswp-qanda-panel-body',
490
+ title: __('Settings', 'schema-and-structured-data-for-wp')
491
+ },
492
+ )),
493
+ el('div',
494
+ {className:'saswp-qanda-block-container'},
495
+ qanda_details, organizers, suggested
496
+ )
497
+ ];
498
+
499
+ },
500
+ save: function( props ) {
501
+ return null
502
+ }
503
+ } );
504
+ }(
505
+ window.wp.blocks,
506
+ window.wp.element,
507
+ window.wp.blockEditor,
508
+ window.wp.components,
509
+ window.wp.i18n,
510
+ ) );
511
+
modules/gutenberg/assets/css/amp/qanda.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ To change this license header, choose License Headers in Project Properties.
3
+ To change this template file, choose Tools | Templates
4
+ and open the template in the editor.
5
+ */
6
+ /*
7
+ Created on : Sep 15, 2019, 1:52:02 PM
8
+ Author : acer
9
+ */
10
+ .saswp-qanda-venue-details, .saswp-qanda-organizers-details, .saswp-qanda-performers-details{
11
+ padding-top:15px;
12
+ }
13
+ .saswp-qanda-date-fieldset select{
14
+ max-width: 100%;
15
+ }
16
+ .saswp-qand-date{
17
+ font-size: 15px;
18
+ }
19
+ .saswp-qanda-block-question{
20
+ margin-bottom: 25px;
21
+ }
22
+ .saswp-qanda-block-answer{
23
+ list-style-type: none;
24
+ margin-bottom: 10px;
25
+ }
26
+ .saswp-qanda-block-answer li{
27
+ margin-top: 15px;
28
+ }
modules/gutenberg/assets/css/qanda.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ To change this license header, choose License Headers in Project Properties.
3
+ To change this template file, choose Tools | Templates
4
+ and open the template in the editor.
5
+ */
6
+ /*
7
+ Created on : Sep 15, 2019, 1:52:02 PM
8
+ Author : acer
9
+ */
10
+ .saswp-qanda-venue-details, .saswp-qanda-organizers-details, .saswp-qanda-performers-details{
11
+ padding-top:15px;
12
+ }
13
+ .saswp-qanda-date-fieldset select{
14
+ max-width: 100%;
15
+ }
16
+ .saswp-qand-date{
17
+ font-size: 15px;
18
+ }
19
+ .saswp-qanda-block-question{
20
+ margin-bottom: 25px;
21
+ }
22
+ .saswp-qanda-block-answer{
23
+ list-style-type: none;
24
+ margin-bottom: 10px;
25
+ }
26
+ .saswp-qanda-block-answer li{
27
+ margin-top: 15px;
28
+ }
modules/gutenberg/includes/class-gutenberg.php CHANGED
@@ -49,6 +49,15 @@ class SASWP_Gutenberg {
49
  'editor' => 'saswp-gutenberg-css-reg-editor',
50
  'local' => array()
51
  ),
 
 
 
 
 
 
 
 
 
52
  'job' => array(
53
  'handler' => 'saswp-job-js-reg',
54
  'local_var' => 'saswpGutenbergJob',
@@ -119,6 +128,10 @@ class SASWP_Gutenberg {
119
  $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/event.css';
120
  echo @file_get_contents($amp_css);
121
  }
 
 
 
 
122
  if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/job-block'){
123
  $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/job.css';
124
  echo @file_get_contents($amp_css);
@@ -158,6 +171,15 @@ class SASWP_Gutenberg {
158
  array()
159
  );
160
 
 
 
 
 
 
 
 
 
 
161
  }
162
  if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/job-block'){
163
 
@@ -307,6 +329,22 @@ class SASWP_Gutenberg {
307
 
308
  }
309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  public function render_event_data($attributes){
311
 
312
  ob_start();
49
  'editor' => 'saswp-gutenberg-css-reg-editor',
50
  'local' => array()
51
  ),
52
+ 'qanda' => array(
53
+ 'handler' => 'saswp-qanda-js-reg',
54
+ 'local_var' => 'saswpGutenbergQanda',
55
+ 'block_name' => 'qanda-block',
56
+ 'render_func' => 'render_qanda_data',
57
+ 'style' => 'saswp-g-qanda-css',
58
+ 'editor' => 'saswp-gutenberg-css-reg-editor',
59
+ 'local' => array()
60
+ ),
61
  'job' => array(
62
  'handler' => 'saswp-job-js-reg',
63
  'local_var' => 'saswpGutenbergJob',
128
  $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/event.css';
129
  echo @file_get_contents($amp_css);
130
  }
131
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/qanda-block'){
132
+ $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/qanda.css';
133
+ echo @file_get_contents($amp_css);
134
+ }
135
  if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/job-block'){
136
  $amp_css = SASWP_PLUGIN_DIR_PATH . 'modules/gutenberg/assets/css/amp/job.css';
137
  echo @file_get_contents($amp_css);
171
  array()
172
  );
173
 
174
+ }
175
+ if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/qanda-block'){
176
+
177
+ wp_enqueue_style(
178
+ 'saswp-g-qanda-css',
179
+ SASWP_PLUGIN_URL . '/modules/gutenberg/assets/css/qanda.css',
180
+ array()
181
+ );
182
+
183
  }
184
  if(isset($parse_blocks['blockName']) && $parse_blocks['blockName'] === 'saswp/job-block'){
185
 
329
 
330
  }
331
 
332
+ public function render_qanda_data($attributes){
333
+
334
+ ob_start();
335
+
336
+ if ( !isset( $attributes ) ) {
337
+ ob_end_clean();
338
+
339
+ return '';
340
+ }
341
+
342
+ echo $this->render->qanda_block_data($attributes);
343
+
344
+ return ob_get_clean();
345
+
346
+ }
347
+
348
  public function render_event_data($attributes){
349
 
350
  ob_start();
modules/gutenberg/includes/render.php CHANGED
@@ -3,6 +3,60 @@ if ( ! defined( 'ABSPATH' ) ) exit;
3
 
4
  class SASWP_Gutenberg_Render {
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  public function event_block_data($attributes){
7
 
8
  $response = '';
3
 
4
  class SASWP_Gutenberg_Render {
5
 
6
+ public function qanda_block_data($attributes){
7
+
8
+ $response = '';
9
+ $accepted_answers = '';
10
+ $suggested_answers = '';
11
+ $question = '';
12
+
13
+ $question = '<div class="saswp-qanda-block-question">
14
+ <h3>'.esc_html($attributes['question_name']).'</h3>
15
+ <span class="saswp-qand-date">'.esc_html($attributes['question_date_created']).' '.esc_html($attributes['question_time_created']).' '.__( 'by', 'schema-and-structured-data-for-wp' ).' '.esc_html($attributes['question_author']).'</span>
16
+ <p>'.esc_html($attributes['question_text']).'</p>
17
+ '. __( 'Vote', 'schema-and-structured-data-for-wp' ).' <span class="dashicons dashicons-thumbs-up"></span> ('.esc_html($attributes['question_up_vote']).')
18
+ </div>';
19
+
20
+ if(isset($attributes['accepted_answers']) && !empty($attributes['accepted_answers'])){
21
+
22
+ foreach($attributes['accepted_answers'] as $answer){
23
+
24
+ $accepted_answers .= '<li>
25
+ <a href="'.esc_url($answer['url']).'">
26
+ <p>'.esc_html($answer['text']).'</p>
27
+ </a>
28
+ <span class="saswp-qand-date">'.esc_html($answer['date_created']).' '.esc_html($answer['time_created']).' by <strong>'.esc_html($answer['author']).'</strong></span>
29
+ <br> '. __( 'Vote', 'schema-and-structured-data-for-wp' ).' <span class="dashicons dashicons-thumbs-up"></span> ('.esc_html($answer['vote']).')
30
+
31
+ </li>';
32
+
33
+ }
34
+
35
+ }
36
+
37
+ if(isset($attributes['suggested_answers']) && !empty($attributes['suggested_answers'])){
38
+
39
+ foreach($attributes['suggested_answers'] as $answer){
40
+
41
+ $suggested_answers .= '<li>
42
+ <a href="'.esc_url($answer['url']).'">
43
+ <p>'.esc_html($answer['text']).'</p>
44
+ </a>
45
+ <span class="saswp-qand-date">'.esc_html($answer['date_created']).' '.esc_html($answer['time_created']).' by <strong>'.esc_html($answer['author']).'</strong></span>
46
+ <br> '. __( 'Vote', 'schema-and-structured-data-for-wp' ).' <span class="dashicons dashicons-thumbs-up"></span> ('.esc_html($answer['vote']).')
47
+ </li>';
48
+ }
49
+
50
+ }
51
+ //Escaping has been done above for all below html
52
+ $response = '<div class="saswp-qanda-block-html">
53
+ '.$question.'
54
+ <div class="saswp-qanda-block-answer"><h3>'. __( 'Accepted Answers', 'schema-and-structured-data-for-wp' ).'</h3>'.$accepted_answers.'</div>
55
+ <div class="saswp-qanda-block-answer"><h3>'. __( 'Suggested Answers', 'schema-and-structured-data-for-wp' ) .'</h3>'.$suggested_answers.'</div>
56
+ </div>';
57
+
58
+ return $response;
59
+ }
60
  public function event_block_data($attributes){
61
 
62
  $response = '';
output/compatibility.php CHANGED
@@ -406,6 +406,12 @@ class saswp_output_compatibility{
406
  public function wp_recipe_maker_on_activation(){
407
  $this->saswp_update_option_on_compatibility_activation('saswp-wp-recipe-maker');
408
  }
 
 
 
 
 
 
409
  public function wp_ultimate_recipe_on_activation(){
410
  $this->saswp_update_option_on_compatibility_activation('saswp-wp-ultimate-recipe');
411
  }
406
  public function wp_recipe_maker_on_activation(){
407
  $this->saswp_update_option_on_compatibility_activation('saswp-wp-recipe-maker');
408
  }
409
+ public function wp_zoom_on_activation(){
410
+ $this->saswp_update_option_on_compatibility_activation('saswp-wpzoom');
411
+ }
412
+ public function recipress_on_activation(){
413
+ $this->saswp_update_option_on_compatibility_activation('saswp-recipress');
414
+ }
415
  public function wp_ultimate_recipe_on_activation(){
416
  $this->saswp_update_option_on_compatibility_activation('saswp-wp-ultimate-recipe');
417
  }
output/elementor.php CHANGED
@@ -9,6 +9,83 @@
9
  */
10
  if (! defined('ABSPATH') ) exit;
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  /**
13
  * Function to generate schema markup for elementor Faq block
14
  * @global type $post
@@ -46,7 +123,6 @@ function saswp_elementor_faq_schema(){
46
  return $input1;
47
  }
48
 
49
-
50
  /**
51
  * Function to generate schema markup for elementor HowTo block
52
  * @global type $post
9
  */
10
  if (! defined('ABSPATH') ) exit;
11
 
12
+ /**
13
+ * Function to generate schema markup for elementor Q&A block
14
+ * @global type $post
15
+ * @global type $saswp_elementor_qanda
16
+ * @return type array
17
+ */
18
+ function saswp_elementor_qanda_schema(){
19
+
20
+ $input1 = array();
21
+
22
+ global $post, $saswp_elementor_qanda;
23
+
24
+ if($saswp_elementor_qanda){
25
+
26
+ $data = $saswp_elementor_qanda;
27
+ $accepted_answer = $data['accepted_answers'];
28
+ $suggested_answer = $data['suggested_answers'];
29
+
30
+ $answer_count = 0;
31
+ $accepted_json = array();
32
+ $suggested_json = array();
33
+
34
+ if($accepted_answer){
35
+ foreach($accepted_answer as $answer){
36
+ $accepted_json[] = array(
37
+ '@type' => 'Answer',
38
+ 'text' => $answer['text'],
39
+ 'dateCreated' => $answer['date'],
40
+ 'upvoteCount' => $answer['vote'],
41
+ 'url' => $answer['url'],
42
+ 'author' => array(
43
+ '@type' => 'Person',
44
+ 'name' => $answer['author']
45
+ ),
46
+ );
47
+ }
48
+
49
+ $answer_count += count($accepted_answer);
50
+ }
51
+
52
+ if($suggested_answer){
53
+ foreach($suggested_answer as $answer){
54
+ $suggested_json[] = array(
55
+ '@type' => 'Answer',
56
+ 'text' => $answer['text'],
57
+ 'dateCreated' => $answer['date'],
58
+ 'upvoteCount' => $answer['vote'],
59
+ 'url' => $answer['url'],
60
+ 'author' => array(
61
+ '@type' => 'Person',
62
+ 'name' => $answer['author']
63
+ ),
64
+ );
65
+ }
66
+ $answer_count += count($suggested_json);
67
+ }
68
+
69
+ $input1['@context'] = saswp_context_url();
70
+ $input1['@type'] = 'QAPage';
71
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#QAPage';
72
+
73
+ $input1['mainEntity']['@type'] = 'Question';
74
+ $input1['mainEntity']['name'] = $data['question_name'];
75
+ $input1['mainEntity']['text'] = $data['question_text'];
76
+ $input1['mainEntity']['answerCount'] = $answer_count;
77
+ $input1['mainEntity']['upvoteCount'] = $data['question_vote'];
78
+ $input1['mainEntity']['dateCreated'] = $data['question_date'];
79
+ $input1['mainEntity']['author']['@type'] = 'Person';
80
+ $input1['mainEntity']['author']['name'] = $data['question_author'];
81
+ $input1['mainEntity']['acceptedAnswer'] = $accepted_json;
82
+ $input1['mainEntity']['suggestedAnswer'] = $suggested_json;
83
+
84
+ }
85
+
86
+ return $input1;
87
+ }
88
+
89
  /**
90
  * Function to generate schema markup for elementor Faq block
91
  * @global type $post
123
  return $input1;
124
  }
125
 
 
126
  /**
127
  * Function to generate schema markup for elementor HowTo block
128
  * @global type $post
output/function.php CHANGED
@@ -88,14 +88,14 @@ function saswp_wp_hook_operation(){
88
 
89
  function saswp_schema_markup_output_in_buffer($content){
90
 
91
- global $saswp_post_reviews, $saswp_elementor_faq, $saswp_divi_faq, $saswp_elementor_howto, $saswp_evo_json_ld;
92
 
93
  if(!$saswp_divi_faq){
94
  $regex = "<script type='text/javascript' src='".SASWP_PLUGIN_URL."modules/divi-builder/scripts/frontend-bundle.min.js?ver=1.0.0'></script>";
95
  $content = str_replace($regex, '', $content);
96
  }
97
 
98
- if($saswp_post_reviews || $saswp_elementor_faq || $saswp_divi_faq || $saswp_elementor_howto || $saswp_evo_json_ld){
99
 
100
  $saswp_json_ld = saswp_get_all_schema_markup_output();
101
 
@@ -162,6 +162,9 @@ function saswp_get_all_schema_markup_output() {
162
  $blog_page = array();
163
 
164
  $gutenberg_how_to = array();
 
 
 
165
  $gutenberg_faq = array();
166
  $elementor_faq = array();
167
  $elementor_howto = array();
@@ -170,16 +173,22 @@ function saswp_get_all_schema_markup_output() {
170
  $gutenberg_job = array();
171
  $gutenberg_course = array();
172
 
173
- if(is_singular()){
174
 
175
- $gutenberg_how_to = saswp_gutenberg_how_to_schema();
176
- $gutenberg_faq = saswp_gutenberg_faq_schema();
177
  $elementor_faq = saswp_elementor_faq_schema();
 
178
  $elementor_howto = saswp_elementor_howto_schema();
 
179
  $divi_builder_faq = saswp_divi_builder_faq_schema();
 
180
  $gutenberg_event = saswp_gutenberg_event_schema();
 
181
  $gutenberg_job = saswp_gutenberg_job_schema();
182
  $gutenberg_course = saswp_gutenberg_course_schema();
 
 
 
183
 
184
  }
185
 
@@ -205,9 +214,9 @@ function saswp_get_all_schema_markup_output() {
205
  }
206
 
207
  $schema_breadcrumb_output = saswp_schema_breadcrumb_output();
208
- $kb_website_output = saswp_kb_website_output();
209
-
210
  if((is_home() || is_front_page() || ( function_exists('ampforwp_is_home') && ampforwp_is_home())) || isset($sd_data['saswp-defragment']) && $sd_data['saswp-defragment'] == 1 ){
 
211
  $kb_schema_output = saswp_kb_schema_output();
212
  }
213
 
@@ -267,12 +276,18 @@ function saswp_get_all_schema_markup_output() {
267
  $output .= ",";
268
  $output .= "\n\n";
269
  }
270
- if(!empty($gutenberg_how_to) && is_singular()){
271
 
272
  $output .= saswp_json_print_format($gutenberg_how_to);
273
  $output .= ",";
274
  $output .= "\n\n";
275
  }
 
 
 
 
 
 
276
  if(!empty($gutenberg_faq)){
277
 
278
  $output .= saswp_json_print_format($gutenberg_faq);
@@ -297,6 +312,12 @@ function saswp_get_all_schema_markup_output() {
297
  $output .= ",";
298
  $output .= "\n\n";
299
  }
 
 
 
 
 
 
300
  if(!empty($elementor_howto)){
301
 
302
  $output .= saswp_json_print_format($elementor_howto);
@@ -321,6 +342,12 @@ function saswp_get_all_schema_markup_output() {
321
  $output .= ",";
322
  $output .= "\n\n";
323
  }
 
 
 
 
 
 
324
  if(!empty($gutenberg_job)){
325
 
326
  $output .= saswp_json_print_format($gutenberg_job);
@@ -1172,7 +1199,15 @@ function saswp_remove_microdata($content){
1172
  $content = preg_replace("/itemscope\='(.*?)\'/", "", $content);
1173
  $content = preg_replace('/itemscope/', "", $content);
1174
  $content = preg_replace('/hreview-aggregate/', "", $content);
 
1175
 
 
 
 
 
 
 
 
1176
  //Clean json markup
1177
  if(isset($sd_data['saswp-aiosp']) && $sd_data['saswp-aiosp'] == 1 ){
1178
  $content = preg_replace('/<script type=\"application\/ld\+json" class=\"aioseop-schema"\>(.*?)<\/script>/', "", $content);
@@ -1310,6 +1345,33 @@ function saswp_get_the_tags(){
1310
 
1311
  }
1312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1313
  /**
1314
  * Function to get shorcode ids from content by shortcode typ
1315
  * @global type $post
88
 
89
  function saswp_schema_markup_output_in_buffer($content){
90
 
91
+ global $saswp_post_reviews, $saswp_elementor_qanda, $saswp_elementor_faq, $saswp_divi_faq, $saswp_elementor_howto, $saswp_evo_json_ld;
92
 
93
  if(!$saswp_divi_faq){
94
  $regex = "<script type='text/javascript' src='".SASWP_PLUGIN_URL."modules/divi-builder/scripts/frontend-bundle.min.js?ver=1.0.0'></script>";
95
  $content = str_replace($regex, '', $content);
96
  }
97
 
98
+ if($saswp_post_reviews || $saswp_elementor_qanda || $saswp_elementor_faq || $saswp_divi_faq || $saswp_elementor_howto || $saswp_evo_json_ld){
99
 
100
  $saswp_json_ld = saswp_get_all_schema_markup_output();
101
 
162
  $blog_page = array();
163
 
164
  $gutenberg_how_to = array();
165
+ $gutenberg_recipe = array();
166
+ $gutenberg_qanda = array();
167
+ $elementor_qanda = array();
168
  $gutenberg_faq = array();
169
  $elementor_faq = array();
170
  $elementor_howto = array();
173
  $gutenberg_job = array();
174
  $gutenberg_course = array();
175
 
176
+ if(is_singular() || is_front_page() || (function_exists('ampforwp_is_front_page') && ampforwp_is_front_page()) ){
177
 
178
+
 
179
  $elementor_faq = saswp_elementor_faq_schema();
180
+ $elementor_qanda = saswp_elementor_qanda_schema();
181
  $elementor_howto = saswp_elementor_howto_schema();
182
+
183
  $divi_builder_faq = saswp_divi_builder_faq_schema();
184
+
185
  $gutenberg_event = saswp_gutenberg_event_schema();
186
+ $gutenberg_qanda = saswp_gutenberg_qanda_schema();
187
  $gutenberg_job = saswp_gutenberg_job_schema();
188
  $gutenberg_course = saswp_gutenberg_course_schema();
189
+ $gutenberg_how_to = saswp_gutenberg_how_to_schema();
190
+ $gutenberg_recipe = saswp_gutenberg_recipe_schema();
191
+ $gutenberg_faq = saswp_gutenberg_faq_schema();
192
 
193
  }
194
 
214
  }
215
 
216
  $schema_breadcrumb_output = saswp_schema_breadcrumb_output();
217
+
 
218
  if((is_home() || is_front_page() || ( function_exists('ampforwp_is_home') && ampforwp_is_home())) || isset($sd_data['saswp-defragment']) && $sd_data['saswp-defragment'] == 1 ){
219
+ $kb_website_output = saswp_kb_website_output();
220
  $kb_schema_output = saswp_kb_schema_output();
221
  }
222
 
276
  $output .= ",";
277
  $output .= "\n\n";
278
  }
279
+ if(!empty($gutenberg_how_to)){
280
 
281
  $output .= saswp_json_print_format($gutenberg_how_to);
282
  $output .= ",";
283
  $output .= "\n\n";
284
  }
285
+ if(!empty($gutenberg_recipe)){
286
+
287
+ $output .= saswp_json_print_format($gutenberg_recipe);
288
+ $output .= ",";
289
+ $output .= "\n\n";
290
+ }
291
  if(!empty($gutenberg_faq)){
292
 
293
  $output .= saswp_json_print_format($gutenberg_faq);
312
  $output .= ",";
313
  $output .= "\n\n";
314
  }
315
+ if(!empty($elementor_qanda)){
316
+
317
+ $output .= saswp_json_print_format($elementor_qanda);
318
+ $output .= ",";
319
+ $output .= "\n\n";
320
+ }
321
  if(!empty($elementor_howto)){
322
 
323
  $output .= saswp_json_print_format($elementor_howto);
342
  $output .= ",";
343
  $output .= "\n\n";
344
  }
345
+ if(!empty($gutenberg_qanda)){
346
+
347
+ $output .= saswp_json_print_format($gutenberg_qanda);
348
+ $output .= ",";
349
+ $output .= "\n\n";
350
+ }
351
  if(!empty($gutenberg_job)){
352
 
353
  $output .= saswp_json_print_format($gutenberg_job);
1199
  $content = preg_replace("/itemscope\='(.*?)\'/", "", $content);
1200
  $content = preg_replace('/itemscope/', "", $content);
1201
  $content = preg_replace('/hreview-aggregate/', "", $content);
1202
+ $content = preg_replace('/hrecipe/', "", $content);
1203
 
1204
+ //Clean json markup
1205
+ if(isset($sd_data['saswp-wpzoom']) && $sd_data['saswp-wpzoom'] == 1 ){
1206
+
1207
+ $regex = '/<script type=\"application\/ld\+json\">(.*?)<\/script><div class=\"wp-block-wpzoom-recipe-card-block-recipe-card/s';
1208
+
1209
+ $content = preg_replace($regex, '<div class="wp-block-wpzoom-recipe-card-block-recipe-card', $content);
1210
+ }
1211
  //Clean json markup
1212
  if(isset($sd_data['saswp-aiosp']) && $sd_data['saswp-aiosp'] == 1 ){
1213
  $content = preg_replace('/<script type=\"application\/ld\+json" class=\"aioseop-schema"\>(.*?)<\/script>/', "", $content);
1345
 
1346
  }
1347
 
1348
+ function saswp_get_the_categories(){
1349
+
1350
+ global $post;
1351
+
1352
+ $category_str = '';
1353
+
1354
+ if(is_object($post)){
1355
+
1356
+ $categories = get_the_category($post->ID);
1357
+
1358
+ if($categories){
1359
+
1360
+ foreach($categories as $category){
1361
+
1362
+ $category_str .= $category->name.', ';
1363
+
1364
+ }
1365
+
1366
+ }
1367
+
1368
+
1369
+ }
1370
+
1371
+ return $category_str;
1372
+
1373
+ }
1374
+
1375
  /**
1376
  * Function to get shorcode ids from content by shortcode typ
1377
  * @global type $post
output/gutenberg.php CHANGED
@@ -9,6 +9,299 @@
9
  */
10
  if (! defined('ABSPATH') ) exit;
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  /**
13
  * Function to generate schema markup for Gutenberg Faq block
14
  * @global type $post
@@ -483,6 +776,78 @@ function saswp_gutenberg_event_schema(){
483
 
484
  }
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  function saswp_gutenberg_job_schema(){
487
 
488
  $input1 = array();
9
  */
10
  if (! defined('ABSPATH') ) exit;
11
 
12
+
13
+ function saswp_gutenberg_recipe_schema(){
14
+
15
+ global $post, $sd_data;
16
+
17
+ $input1 = array();
18
+
19
+ if( (isset($sd_data['saswp-wpzoom']) && $sd_data['saswp-wpzoom'] == 1) && class_exists('WPZOOM_Structured_Data_Helpers') && class_exists('WPZOOM_Helpers') ){
20
+
21
+ $recipe_block = saswp_get_gutenberg_block_data('wpzoom-recipe-card/block-recipe-card');
22
+ $attributes = $recipe_block['attrs'];
23
+
24
+ $service_object = new saswp_output_service();
25
+ $structured_data_helpers = new WPZOOM_Structured_Data_Helpers();
26
+ $helpers = new WPZOOM_Helpers();
27
+ $feature_image = $service_object->saswp_get_fetaure_image();
28
+
29
+ $input1['@context'] = saswp_context_url();
30
+ $input1['@type'] = 'Recipe';
31
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#Recipe';
32
+ $input1['name'] = isset($attributes['recipeTitle']) ? $attributes['recipeTitle'] : saswp_get_the_title();
33
+ $input1['description'] = isset($attributes['summary']) ? $attributes['summary'] : saswp_get_the_excerpt();
34
+ $input1['datePublished'] = get_the_date("c");
35
+ $input1['dateModified'] = get_the_modified_date("c");
36
+ $input1['keywords'] = isset($attributes['keywords']) ? $attributes['keywords'] : saswp_get_the_tags();
37
+ $input1['author'] = saswp_get_author_details();
38
+
39
+
40
+ if(isset($attributes['cuisine'])){
41
+
42
+ $input1['recipeCuisine'] = $attributes['cuisine'];
43
+
44
+ }
45
+ if(isset($attributes['course'])){
46
+
47
+ $input1['recipeCategory'] = $attributes['course'];
48
+
49
+ }
50
+
51
+ if ( ! empty( $attributes['details'] ) && is_array( $attributes['details'] ) ) {
52
+
53
+ $details = array_filter( $attributes['details'], 'is_array' );
54
+
55
+ foreach ( $details as $key => $detail ) {
56
+
57
+ if ( $key === 0 ) {
58
+ if ( ! empty( $detail[ 'value' ] ) ) {
59
+ if ( !is_array( $detail['value'] ) ) {
60
+ $yield = array(
61
+ $detail['value']
62
+ );
63
+
64
+ if ( isset( $detail['unit'] ) && ! empty( $detail['unit'] ) ) {
65
+ $yield[] = $detail['value'] .' '. $detail['unit'];
66
+ }
67
+ }
68
+ elseif ( isset( $detail['jsonValue'] ) ) {
69
+ $yield = array(
70
+ $detail['jsonValue']
71
+ );
72
+
73
+ if ( isset( $detail['unit'] ) && ! empty( $detail['unit'] ) ) {
74
+ $yield[] = $detail['value'] .' '. $detail['unit'];
75
+ }
76
+ }
77
+
78
+ if ( isset( $yield ) ) {
79
+ $input1['recipeYield'] = $yield;
80
+ }
81
+ }
82
+ }elseif ( $key === 3 ) {
83
+ if ( ! empty( $detail[ 'value' ] ) ) {
84
+ if ( !is_array( $detail['value'] ) ) {
85
+ $input1['nutrition']['calories'] = $detail['value'] .' cal';
86
+ }
87
+ elseif ( isset( $detail['jsonValue'] ) ) {
88
+ $input1['nutrition']['calories'] = $detail['jsonValue'] .' cal';
89
+ }
90
+ }
91
+ }elseif ( $key === 1 ) {
92
+ if ( ! empty( $detail[ 'value' ] ) ) {
93
+ if ( !is_array( $detail['value'] ) ) {
94
+ $prepTime = $structured_data_helpers->get_number_from_string( $detail['value'] );
95
+ $input1['prepTime'] = $structured_data_helpers->get_period_time( $detail['value'] );
96
+ }
97
+ elseif ( isset( $detail['jsonValue'] ) ) {
98
+ $prepTime = $structured_data_helpers->get_number_from_string( $detail['jsonValue'] );
99
+ $input1['prepTime'] = $structured_data_helpers->get_period_time( $detail['jsonValue'] );
100
+ }
101
+ }
102
+ }elseif ( $key === 2 ) {
103
+ if ( ! empty( $detail[ 'value' ] )) {
104
+ if ( !is_array( $detail['value'] ) ) {
105
+ $cookTime = $structured_data_helpers->get_number_from_string( $detail['value'] );
106
+ $input1['cookTime'] = $structured_data_helpers->get_period_time( $detail['value'] );
107
+ }
108
+ elseif ( isset( $detail['jsonValue'] ) ) {
109
+ $cookTime = $structured_data_helpers->get_number_from_string( $detail['jsonValue'] );
110
+ $input1['cookTime'] = $structured_data_helpers->get_period_time( $detail['jsonValue'] );
111
+ }
112
+ }
113
+ }
114
+ elseif ( $key === 8 ) {
115
+ if ( ! empty( $detail[ 'value' ] )) {
116
+ if ( !is_array( $detail['value'] ) ) {
117
+ $input1['totalTime'] = $structured_data_helpers->get_period_time( $detail['value'] );
118
+ }
119
+ elseif ( isset( $detail['jsonValue'] ) ) {
120
+ $input1['totalTime'] = $structured_data_helpers->get_period_time( $detail['jsonValue'] );
121
+ }
122
+ }
123
+ }
124
+
125
+ }
126
+
127
+ if ( empty( $input1['totalTime'] ) ) {
128
+ if ( isset( $prepTime, $cookTime ) && ( $prepTime + $cookTime ) > 0 ) {
129
+ $input1['totalTime'] = $structured_data_helpers->get_period_time( $prepTime + $cookTime );
130
+ }
131
+ }
132
+
133
+ }
134
+
135
+ if ( ! empty( $attributes['ingredients'] ) && is_array( $attributes['ingredients'] ) ) {
136
+ $ingredients = array_filter( $attributes['ingredients'], 'is_array' );
137
+ foreach ( $ingredients as $ingredient ) {
138
+ $isGroup = isset( $ingredient['isGroup'] ) ? $ingredient['isGroup'] : false;
139
+
140
+ if ( ! $isGroup ) {
141
+ $input1['recipeIngredient'][] = $structured_data_helpers->get_ingredient_json_ld( $ingredient );
142
+ }
143
+
144
+ }
145
+ }
146
+
147
+ if ( ! empty( $attributes['steps'] ) && is_array( $attributes['steps'] ) ) {
148
+ $steps = array_filter( $attributes['steps'], 'is_array' );
149
+ $groups_section = array();
150
+ $instructions = array();
151
+
152
+ foreach ( $steps as $key => $step ) {
153
+ $isGroup = isset( $step['isGroup'] ) ? $step['isGroup'] : false;
154
+ $parent_permalink = get_the_permalink();
155
+
156
+ if ( $isGroup ) {
157
+ $groups_section[ $key ] = array(
158
+ '@type' => 'HowToSection',
159
+ 'name' => '',
160
+ 'itemListElement' => array(),
161
+ );
162
+ if ( ! empty( $step['jsonText'] ) ) {
163
+ $groups_section[ $key ]['name'] = $step['jsonText'];
164
+ } else {
165
+ $groups_section[ $key ]['name'] = $structured_data_helpers->step_text_to_JSON( $step['text'] );
166
+ }
167
+ }
168
+
169
+ if ( count( $groups_section ) > 0 ) {
170
+ end( $groups_section );
171
+ $last_key = key( $groups_section );
172
+
173
+ if ( ! $isGroup && $key > $last_key ) {
174
+ $groups_section[ $last_key ]['itemListElement'][] = $structured_data_helpers->get_step_json_ld( $step, $parent_permalink );
175
+ }
176
+ } else {
177
+ $instructions[] = $structured_data_helpers->get_step_json_ld( $step, $parent_permalink );
178
+ }
179
+ }
180
+
181
+ $groups_section = array_merge( $instructions, $groups_section );
182
+ $input1['recipeInstructions'] = $groups_section;
183
+ }
184
+
185
+ $image_details = saswp_get_image_by_id($attributes['image']['id']);
186
+
187
+ if($image_details){
188
+ $input1['image'] = $image_details;
189
+ }else{
190
+ if(!empty($feature_image)){
191
+
192
+ $input1 = array_merge($input1, $feature_image);
193
+
194
+ }
195
+ }
196
+
197
+
198
+ //video json
199
+
200
+ if ( isset( $attributes['video'] ) && ! empty( $attributes['video'] ) && isset( $attributes['hasVideo'] ) && $attributes['hasVideo'] ) {
201
+ $video = $attributes['video'];
202
+ $video_id = isset( $video['id'] ) ? $video['id'] : 0;
203
+ $video_type = isset( $video['type'] ) ? $video['type'] : '';
204
+
205
+ if ( 'self-hosted' === $video_type ) {
206
+ $video_attachment = get_post( $video_id );
207
+
208
+ if ( $video_attachment ) {
209
+ $video_data = wp_get_attachment_metadata( $video_id );
210
+ $video_url = wp_get_attachment_url( $video_id );
211
+
212
+ $image_id = get_post_thumbnail_id( $video_id );
213
+ $thumb = wp_get_attachment_image_src( $image_id, 'full' );
214
+ $thumbnail_url = $thumb && isset( $thumb[0] ) ? $thumb[0] : '';
215
+
216
+ $input1['video'] = array_merge(
217
+ $input1['video'], array(
218
+ 'name' => $video_attachment->post_title,
219
+ 'description' => $video_attachment->post_content,
220
+ 'thumbnailUrl' => $thumbnail_url,
221
+ 'contentUrl' => $video_url,
222
+ 'uploadDate' => date( 'c', strtotime( $video_attachment->post_date ) ),
223
+ 'duration' => 'PT' . $video_data['length'] . 'S',
224
+ )
225
+ );
226
+ }
227
+ }
228
+
229
+ if ( isset( $video['title'] ) && ! empty( $video['title'] ) ) {
230
+ $input1['video']['name'] = esc_html( $video['title'] );
231
+ }
232
+ if ( isset( $video['caption'] ) && !empty( $video['caption'] ) ) {
233
+ $input1['video']['description'] = esc_html( $video['caption'] );
234
+ }
235
+ if ( isset( $video['description'] ) && !empty( $video['description'] ) ) {
236
+ $input1['video']['description'] = esc_html( $video['description'] );
237
+ }
238
+ if ( isset( $video['poster']['url'] ) ) {
239
+ $input1['video']['thumbnailUrl'] = esc_url( $video['poster']['url'] );
240
+
241
+ if ( isset( $video['poster']['id'] ) ) {
242
+ $poster_id = $video['poster']['id'];
243
+ $poster_sizes_url = array(
244
+ saswp_get_image_size_url( $poster_id, 'full' ),
245
+ saswp_get_image_size_url( $poster_id, 'wpzoom-rcb-structured-data-1_1' ),
246
+ saswp_get_image_size_url( $poster_id, 'wpzoom-rcb-structured-data-4_3' ),
247
+ saswp_get_image_size_url( $poster_id, 'wpzoom-rcb-structured-data-16_9' ),
248
+ );
249
+ $input1['video']['thumbnailUrl'] = array_values( array_unique( $poster_sizes_url ) );
250
+ }
251
+ }
252
+ if ( isset( $video['url'] ) ) {
253
+ $input1['video']['contentUrl'] = esc_url( $video['url'] );
254
+
255
+ if ( 'embed' === $video_type ) {
256
+ $video_embed_url = $video['url'];
257
+
258
+ $input1['video']['@type'] = 'VideoObject';
259
+
260
+ if ( ! empty( $attributes['image'] ) && isset( $attributes['hasImage'] ) && $attributes['hasImage'] ) {
261
+ $image_id = isset( $attributes['image']['id'] ) ? $attributes['image']['id'] : 0;
262
+ $image_sizes = isset( $attributes['image']['sizes'] ) ? $attributes['image']['sizes'] : array();
263
+ $image_sizes_url = array(
264
+ saswp_get_image_size_url( $image_id, 'full', $image_sizes ),
265
+ saswp_get_image_size_url( $image_id, 'wpzoom-rcb-structured-data-1_1', $image_sizes ),
266
+ saswp_get_image_size_url( $image_id, 'wpzoom-rcb-structured-data-4_3', $image_sizes ),
267
+ saswp_get_image_size_url( $image_id, 'wpzoom-rcb-structured-data-16_9', $image_sizes ),
268
+ );
269
+ $input1['video']['thumbnailUrl'] = array_values( array_unique( $image_sizes_url ) );
270
+ }
271
+
272
+ if ( strpos( $video['url'], 'youtu' ) ) {
273
+ $video_embed_url = $helpers->convert_youtube_url_to_embed( $video['url'] );
274
+ }
275
+ elseif ( strpos( $video['url'] , 'vimeo' ) ) {
276
+ $video_embed_url = $helpers->convert_vimeo_url_to_embed( $video['url'] );
277
+ }
278
+
279
+ $input1['video']['embedUrl'] = esc_url( $video_embed_url );
280
+ }
281
+ }
282
+ if ( isset( $video['date'] ) && 'embed' === $video_type ) {
283
+ $input1['video']['uploadDate'] = $video['date'];
284
+ }
285
+ }
286
+
287
+ $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
288
+ $aggregateRating = $service_object->saswp_rating_box_rating_markup(get_the_ID());
289
+
290
+ if(!empty($aggregateRating)){
291
+ $input1['aggregateRating'] = $aggregateRating;
292
+ }
293
+ if(!empty($extra_theme_review)){
294
+ $input1 = array_merge($input1, $extra_theme_review);
295
+ }
296
+
297
+ $input1 = saswp_append_fetched_reviews($input1, $schema_post_id);
298
+
299
+ }
300
+
301
+ return apply_filters('saswp_modify_recipe_schema_output', $input1 );
302
+
303
+ }
304
+
305
  /**
306
  * Function to generate schema markup for Gutenberg Faq block
307
  * @global type $post
776
 
777
  }
778
 
779
+ function saswp_gutenberg_qanda_schema(){
780
+
781
+ $input1 = array();
782
+
783
+ $attributes = saswp_get_gutenberg_block_data('saswp/qanda-block');
784
+
785
+ if(isset($attributes['attrs'])){
786
+
787
+ $data = $attributes['attrs'];
788
+ $accepted_answer = $data['accepted_answers'];
789
+ $suggested_answer = $data['suggested_answers'];
790
+
791
+ $answer_count = 0;
792
+ $accepted_json = array();
793
+ $suggested_json = array();
794
+
795
+ if($accepted_answer){
796
+ foreach($accepted_answer as $answer){
797
+ $accepted_json[] = array(
798
+ '@type' => 'Answer',
799
+ 'text' => $answer['text'],
800
+ 'dateCreated' => $answer['date_created_iso'],
801
+ 'upvoteCount' => $answer['vote'],
802
+ 'url' => $answer['url'],
803
+ 'author' => array(
804
+ '@type' => 'Person',
805
+ 'name' => $answer['author']
806
+ ),
807
+ );
808
+ }
809
+
810
+ $answer_count += count($accepted_answer);
811
+ }
812
+
813
+ if($suggested_answer){
814
+ foreach($suggested_answer as $answer){
815
+ $suggested_json[] = array(
816
+ '@type' => 'Answer',
817
+ 'text' => $answer['text'],
818
+ 'dateCreated' => $answer['date_created_iso'],
819
+ 'upvoteCount' => $answer['vote'],
820
+ 'url' => $answer['url'],
821
+ 'author' => array(
822
+ '@type' => 'Person',
823
+ 'name' => $answer['author']
824
+ ),
825
+ );
826
+ }
827
+ $answer_count += count($suggested_json);
828
+ }
829
+
830
+ $input1['@context'] = saswp_context_url();
831
+ $input1['@type'] = 'QAPage';
832
+ $input1['@id'] = trailingslashit(saswp_get_permalink()).'#QAPage';
833
+
834
+ $input1['mainEntity']['@type'] = 'Question';
835
+ $input1['mainEntity']['name'] = $data['question_name'];
836
+ $input1['mainEntity']['text'] = $data['question_text'];
837
+ $input1['mainEntity']['answerCount'] = $answer_count;
838
+ $input1['mainEntity']['upvoteCount'] = $data['question_up_vote'];
839
+ $input1['mainEntity']['dateCreated'] = $data['question_date_created_iso'];
840
+ $input1['mainEntity']['author']['@type'] = 'Person';
841
+ $input1['mainEntity']['author']['name'] = $data['question_author'];
842
+ $input1['mainEntity']['acceptedAnswer'] = $accepted_json;
843
+ $input1['mainEntity']['suggestedAnswer'] = $suggested_json;
844
+
845
+ }
846
+
847
+ return $input1;
848
+
849
+ }
850
+
851
  function saswp_gutenberg_job_schema(){
852
 
853
  $input1 = array();
output/markup.php CHANGED
@@ -714,11 +714,7 @@ function saswp_recipe_schema_markup($schema_id, $schema_post_id, $all_post_meta)
714
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_keywords_'.$schema_id, 'saswp_array'),
715
  'recipeYield' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_recipeyield_'.$schema_id, 'saswp_array'),
716
  'recipeCategory' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_category_'.$schema_id, 'saswp_array'),
717
- 'recipeCuisine' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_cuisine_'.$schema_id, 'saswp_array'),
718
- 'nutrition' => array(
719
- '@type' => "NutritionInformation",
720
- 'calories' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_nutrition_'.$schema_id, 'saswp_array'),
721
- ),
722
  'recipeIngredient' => $ingredient,
723
  'recipeInstructions' => $instruction,
724
  'datePublished' => isset($all_post_meta['saswp_recipe_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_published_'.$schema_id][0])):'',
@@ -742,6 +738,35 @@ function saswp_recipe_schema_markup($schema_id, $schema_post_id, $all_post_meta)
742
 
743
  );
744
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
745
  if(saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_name_'.$schema_id, 'saswp_array') !='' && saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_thumbnailurl_'.$schema_id, 'saswp_array') !='' && saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_description_'.$schema_id, 'saswp_array') !=''){
746
 
747
  $input1['video']['@type'] = 'VideoObject';
714
  'keywords' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_keywords_'.$schema_id, 'saswp_array'),
715
  'recipeYield' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_recipeyield_'.$schema_id, 'saswp_array'),
716
  'recipeCategory' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_category_'.$schema_id, 'saswp_array'),
717
+ 'recipeCuisine' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_cuisine_'.$schema_id, 'saswp_array'),
 
 
 
 
718
  'recipeIngredient' => $ingredient,
719
  'recipeInstructions' => $instruction,
720
  'datePublished' => isset($all_post_meta['saswp_recipe_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_published_'.$schema_id][0])):'',
738
 
739
  );
740
 
741
+ if($all_post_meta['saswp_recipe_nutrition_'.$schema_id][0]){
742
+ $input1['nutrition']['@type'] = 'NutritionInformation';
743
+ $input1['nutrition']['calories'] = $all_post_meta['saswp_recipe_nutrition_'.$schema_id][0];
744
+ }
745
+ if($all_post_meta['saswp_recipe_protein_'.$schema_id][0]){
746
+ $input1['nutrition']['@type'] = 'NutritionInformation';
747
+ $input1['nutrition']['proteinContent'] = $all_post_meta['saswp_recipe_protein_'.$schema_id][0];
748
+ }
749
+ if($all_post_meta['saswp_recipe_fat_'.$schema_id][0]){
750
+ $input1['nutrition']['@type'] = 'NutritionInformation';
751
+ $input1['nutrition']['fatContent'] = $all_post_meta['saswp_recipe_fat_'.$schema_id][0];
752
+ }
753
+ if($all_post_meta['saswp_recipe_fiber_'.$schema_id][0]){
754
+ $input1['nutrition']['@type'] = 'NutritionInformation';
755
+ $input1['nutrition']['fiberContent'] = $all_post_meta['saswp_recipe_fiber_'.$schema_id][0];
756
+ }
757
+ if($all_post_meta['saswp_recipe_sodium_'.$schema_id][0]){
758
+ $input1['nutrition']['@type'] = 'NutritionInformation';
759
+ $input1['nutrition']['sodiumContent'] = $all_post_meta['saswp_recipe_sodium_'.$schema_id][0];
760
+ }
761
+ if($all_post_meta['saswp_recipe_sugar_'.$schema_id][0]){
762
+ $input1['nutrition']['@type'] = 'NutritionInformation';
763
+ $input1['nutrition']['sugarContent'] = $all_post_meta['saswp_recipe_sugar_'.$schema_id][0];
764
+ }
765
+ if($all_post_meta['saswp_recipe_carbohydrate_'.$schema_id][0]){
766
+ $input1['nutrition']['@type'] = 'NutritionInformation';
767
+ $input1['nutrition']['carbohydrateContent'] = $all_post_meta['saswp_recipe_carbohydrate_'.$schema_id][0];
768
+ }
769
+
770
  if(saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_name_'.$schema_id, 'saswp_array') !='' && saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_thumbnailurl_'.$schema_id, 'saswp_array') !='' && saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_description_'.$schema_id, 'saswp_array') !=''){
771
 
772
  $input1['video']['@type'] = 'VideoObject';
output/other-schema.php CHANGED
@@ -136,4 +136,67 @@ function saswp_wp_recipe_maker_json_ld($input1){
136
 
137
  return $input1;
138
 
139
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
  return $input1;
138
 
139
+ }
140
+
141
+ add_filter('saswp_modify_recipe_schema_output', 'saswp_recipress_json_ld',10,1);
142
+
143
+ function saswp_recipress_json_ld($input1){
144
+
145
+ global $sd_data, $post;
146
+
147
+ if( (isset($sd_data['saswp-recipress']) && $sd_data['saswp-recipress'] == 1) && function_exists('has_recipress_recipe') && has_recipress_recipe() && function_exists('recipress_recipe')){
148
+
149
+ if(recipress_recipe('title')){
150
+ $input1['name'] = recipress_recipe('title');
151
+ }
152
+ if(recipress_recipe('summary')){
153
+ $input1['description'] = recipress_recipe('summary');
154
+ }
155
+ if(recipress_recipe('cook_time','iso')){
156
+ $input1['cookTime'] = recipress_recipe('cook_time','iso');
157
+ }
158
+ if(recipress_recipe('prep_time', 'iso')){
159
+ $input1['prepTime'] = recipress_recipe('prep_time', 'iso');
160
+ }
161
+ if(recipress_recipe('ready_time','iso')){
162
+ $input1['totalTime'] = recipress_recipe('ready_time','iso');
163
+ }
164
+
165
+ $cuisines = strip_tags( get_the_term_list( $post->ID, 'cuisine', '', ', ') );
166
+
167
+ if($cuisines){
168
+ $input1['recipeCuisine'] = $cuisines;
169
+ }
170
+ if(recipress_recipe('yield')){
171
+ $input1['recipeYield'] = recipress_recipe('yield');
172
+ }
173
+ $ingredients = recipress_recipe('ingredients');
174
+ $ingredients_arr = array();
175
+
176
+ if($ingredients){
177
+ foreach($ingredients as $ing){
178
+ $ingredients_arr[] = $ing['ingredient'];
179
+ }
180
+ $input1['recipeIngredient'] = $ingredients_arr;
181
+ }
182
+
183
+ $instructions = recipress_recipe('instructions');
184
+
185
+ $instructions_arr = array();
186
+
187
+ if($instructions){
188
+ foreach($instructions as $ing){
189
+ $instructions_arr[] = $ing['description'];
190
+ }
191
+ $input1['recipeInstructions'] = $instructions_arr;
192
+ }
193
+
194
+ if(saswp_get_the_categories()){
195
+ $input1['recipeCategory'] = saswp_get_the_categories();
196
+ }
197
+
198
+ }
199
+
200
+ return $input1;
201
+ }
202
+
output/output.php CHANGED
@@ -15,7 +15,7 @@ if (! defined('ABSPATH') ) exit;
15
  */
16
  function saswp_kb_schema_output() {
17
 
18
- global $sd_data;
19
  $input = array();
20
  $site_url = get_home_url();
21
 
@@ -1301,7 +1301,7 @@ function saswp_schema_output() {
1301
 
1302
  $input1 = array(
1303
  '@context' => saswp_context_url(),
1304
- '@type' => $schema_type ,
1305
  '@id' => trailingslashit(saswp_get_permalink()).'#recipe',
1306
  'url' => trailingslashit(saswp_get_permalink()),
1307
  'name' => saswp_get_the_title(),
@@ -1487,62 +1487,56 @@ function saswp_schema_output() {
1487
  $article_section = $cd->cat_name;
1488
 
1489
  }
1490
- $word_count = saswp_reading_time_and_word_count();
1491
- $input1 = array(
1492
- '@context' => saswp_context_url(),
1493
- '@type' => $schema_type ,
1494
- '@id' => trailingslashit(saswp_get_permalink()).'#newsarticle',
1495
- 'url' => trailingslashit(saswp_get_permalink()),
1496
- 'headline' => saswp_get_the_title(),
1497
- 'mainEntityOfPage' => get_the_permalink(),
1498
- 'datePublished' => esc_html($date),
1499
- 'dateModified' => esc_html($modified_date),
1500
- 'description' => saswp_get_the_excerpt(),
1501
- 'articleSection' => $article_section,
1502
- 'articleBody' => saswp_get_the_content(),
1503
- 'keywords' => saswp_get_the_tags(),
1504
- 'name' => saswp_get_the_title(),
1505
- 'thumbnailUrl' => saswp_remove_warnings($image_details, 0, 'saswp_string'),
1506
- 'wordCount' => saswp_remove_warnings($word_count, 'word_count', 'saswp_string'),
1507
- 'timeRequired' => saswp_remove_warnings($word_count, 'timerequired', 'saswp_string'),
1508
- 'mainEntity' => array(
1509
- '@type' => 'WebPage',
1510
- '@id' => trailingslashit(saswp_get_permalink()),
1511
- ),
1512
- 'author' => saswp_get_author_details()
1513
- );
1514
-
1515
- $mainentity = saswp_get_mainEntity($schema_post_id);
1516
-
1517
- if($mainentity){
1518
- $input1['mainEntity'] = $mainentity;
1519
- }
1520
-
1521
- if(!empty($publisher)){
1522
-
1523
- $input1 = array_merge($input1, $publisher);
1524
-
1525
- }
1526
- if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
1527
- $input1['comment'] = saswp_get_comments(get_the_ID());
1528
- }
1529
-
1530
- if(!empty($aggregateRating)){
1531
- $input1['aggregateRating'] = $aggregateRating;
1532
- }
1533
- if(!empty($extra_theme_review)){
1534
- $input1 = array_merge($input1, $extra_theme_review);
1535
- }
1536
-
1537
- $input1 = apply_filters('saswp_modify_news_article_schema_output', $input1 );
1538
-
1539
- $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
1540
-
1541
- if($modified_schema == 1){
1542
 
1543
- $input1 = saswp_news_article_schema_markup($schema_post_id, get_the_ID(), $all_post_meta);
1544
- }
1545
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1546
  break;
1547
 
1548
  case 'Service':
15
  */
16
  function saswp_kb_schema_output() {
17
 
18
+ global $sd_data;
19
  $input = array();
20
  $site_url = get_home_url();
21
 
1301
 
1302
  $input1 = array(
1303
  '@context' => saswp_context_url(),
1304
+ '@type' => 'Recipe',
1305
  '@id' => trailingslashit(saswp_get_permalink()).'#recipe',
1306
  'url' => trailingslashit(saswp_get_permalink()),
1307
  'name' => saswp_get_the_title(),
1487
  $article_section = $cd->cat_name;
1488
 
1489
  }
1490
+ $word_count = saswp_reading_time_and_word_count();
1491
+
1492
+ $input1 = array(
1493
+ '@context' => saswp_context_url(),
1494
+ '@type' => $schema_type ,
1495
+ '@id' => trailingslashit(saswp_get_permalink()).'#newsarticle',
1496
+ 'url' => trailingslashit(saswp_get_permalink()),
1497
+ 'headline' => saswp_get_the_title(),
1498
+ 'mainEntityOfPage' => get_the_permalink(),
1499
+ 'datePublished' => esc_html($date),
1500
+ 'dateModified' => esc_html($modified_date),
1501
+ 'description' => saswp_get_the_excerpt(),
1502
+ 'articleSection' => $article_section,
1503
+ 'articleBody' => saswp_get_the_content(),
1504
+ 'keywords' => saswp_get_the_tags(),
1505
+ 'name' => saswp_get_the_title(),
1506
+ 'thumbnailUrl' => saswp_remove_warnings($image_details, 0, 'saswp_string'),
1507
+ 'wordCount' => saswp_remove_warnings($word_count, 'word_count', 'saswp_string'),
1508
+ 'timeRequired' => saswp_remove_warnings($word_count, 'timerequired', 'saswp_string'),
1509
+ 'mainEntity' => array(
1510
+ '@type' => 'WebPage',
1511
+ '@id' => trailingslashit(saswp_get_permalink()),
1512
+ ),
1513
+ 'author' => saswp_get_author_details()
1514
+ );
1515
+
1516
+ $mainentity = saswp_get_mainEntity($schema_post_id);
1517
+
1518
+ if($mainentity){
1519
+ $input1['mainEntity'] = $mainentity;
1520
+ }
1521
+
1522
+ if(!empty($publisher)){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1523
 
1524
+ $input1 = array_merge($input1, $publisher);
 
1525
 
1526
+ }
1527
+ if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
1528
+ $input1['comment'] = saswp_get_comments(get_the_ID());
1529
+ }
1530
+
1531
+ $input1 = apply_filters('saswp_modify_news_article_schema_output', $input1 );
1532
+
1533
+ $input1 = saswp_get_modified_markup($input1, $schema_type, $schema_post_id, $schema_options);
1534
+
1535
+ if($modified_schema == 1){
1536
+
1537
+ $input1 = saswp_news_article_schema_markup($schema_post_id, get_the_ID(), $all_post_meta);
1538
+ }
1539
+
1540
  break;
1541
 
1542
  case 'Service':
output/service.php CHANGED
@@ -1849,9 +1849,33 @@ Class saswp_output_service{
1849
  $input1['recipeCuisine'] = $custom_fields['saswp_recipe_cuisine'];
1850
  }
1851
  if(isset($custom_fields['saswp_recipe_nutrition'])){
1852
- $input1['nutrition']['calories'] = $custom_fields['saswp_recipe_nutrition'];
 
1853
  }
1854
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1855
  if(isset($custom_fields['saswp_recipe_ingredient'])){
1856
 
1857
  if(is_array($custom_fields['saswp_recipe_ingredient'])){
@@ -1869,26 +1893,37 @@ Class saswp_output_service{
1869
  }
1870
  }
1871
  if(isset($custom_fields['saswp_recipe_video_name'])){
1872
- $input1['video']['name'] = $custom_fields['saswp_recipe_video_name'];
 
1873
  }
1874
 
1875
  if(isset($custom_fields['saswp_recipe_video_description'])){
1876
- $input1['video']['description'] = $custom_fields['saswp_recipe_video_description'];
 
1877
  }
1878
  if(isset($custom_fields['saswp_recipe_video_thumbnailurl'])){
1879
- $input1['video']['thumbnailUrl'] = $custom_fields['saswp_recipe_video_thumbnailurl'];
 
1880
  }
1881
  if(isset($custom_fields['saswp_recipe_video_contenturl'])){
1882
- $input1['video']['contentUrl'] = $custom_fields['saswp_recipe_video_contenturl'];
 
1883
  }
1884
  if(isset($custom_fields['saswp_recipe_video_embedurl'])){
1885
- $input1['video']['embedUrl'] = $custom_fields['saswp_recipe_video_embedurl'];
 
1886
  }
1887
  if(isset($custom_fields['saswp_recipe_video_upload_date'])){
1888
- $input1['video']['uploadDate'] = $custom_fields['saswp_recipe_video_upload_date'];
 
1889
  }
1890
  if(isset($custom_fields['saswp_recipe_video_duration'])){
1891
- $input1['video']['duration'] = $custom_fields['saswp_recipe_video_duration'];
 
 
 
 
 
1892
  }
1893
 
1894
  if(isset($custom_fields['saswp_recipe_rating_value']) && isset($custom_fields['saswp_recipe_rating_count'])){
@@ -3185,7 +3220,9 @@ Class saswp_output_service{
3185
  $product_details = array();
3186
  $varible_prices = array();
3187
 
3188
- if (class_exists('WC_Product')) {
 
 
3189
 
3190
  global $woocommerce;
3191
  global $sd_data;
@@ -3687,7 +3724,7 @@ Class saswp_output_service{
3687
  $accepted_answer['url'] = get_permalink($answer->ID);
3688
  $accepted_answer['text'] = wp_strip_all_tags($answer->post_content);
3689
  $accepted_answer['dateCreated'] = get_the_date("Y-m-d\TH:i:s\Z", $answer);
3690
- $accepted_answer['author'] = array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename);
3691
 
3692
  }else{
3693
 
@@ -3697,7 +3734,7 @@ Class saswp_output_service{
3697
  'url' => get_permalink($answer->ID),
3698
  'text' => wp_strip_all_tags($answer->post_content),
3699
  'dateCreated' => get_the_date("Y-m-d\TH:i:s\Z", $answer),
3700
- 'author' => array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename),
3701
  );
3702
 
3703
  }
@@ -3930,7 +3967,7 @@ Class saswp_output_service{
3930
  if((isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] == 1) && !empty($product_details)){
3931
 
3932
  $input1 = array(
3933
- '@context' => saswp_context_url(),
3934
  '@type' => $schema_type,
3935
  '@id' => trailingslashit(saswp_get_permalink()).'#'.$schema_type,
3936
  'url' => trailingslashit(saswp_get_permalink()),
@@ -4064,11 +4101,33 @@ Class saswp_output_service{
4064
  }
4065
 
4066
  if($multiple_size){
4067
- $width = array(1200, 1200, 1200);
4068
- $height = array($targetHeight, 900, 675);
 
 
 
 
 
 
 
 
 
 
 
4069
  }else{
4070
- $width = array(1200);
4071
- $height = array($targetHeight);
 
 
 
 
 
 
 
 
 
 
 
4072
  }
4073
 
4074
  for($i = 0; $i < count($width); $i++){
1849
  $input1['recipeCuisine'] = $custom_fields['saswp_recipe_cuisine'];
1850
  }
1851
  if(isset($custom_fields['saswp_recipe_nutrition'])){
1852
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1853
+ $input1['nutrition']['calories'] = $custom_fields['saswp_recipe_nutrition'];
1854
  }
1855
+ if(isset($custom_fields['saswp_recipe_protein'])){
1856
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1857
+ $input1['nutrition']['proteinContent'] = $custom_fields['saswp_recipe_protein'];
1858
+ }
1859
+ if(isset($custom_fields['saswp_recipe_fat'])){
1860
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1861
+ $input1['nutrition']['fatContent'] = $custom_fields['saswp_recipe_fat'];
1862
+ }
1863
+ if(isset($custom_fields['saswp_recipe_fiber'])){
1864
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1865
+ $input1['nutrition']['fiberContent'] = $custom_fields['saswp_recipe_fiber'];
1866
+ }
1867
+ if(isset($custom_fields['saswp_recipe_sodium'])){
1868
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1869
+ $input1['nutrition']['sodiumContent'] = $custom_fields['saswp_recipe_sodium'];
1870
+ }
1871
+ if(isset($custom_fields['saswp_recipe_sugar'])){
1872
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1873
+ $input1['nutrition']['sugarContent'] = $custom_fields['saswp_recipe_sugar'];
1874
+ }
1875
+ if(isset($custom_fields['saswp_recipe_carbohydrate'])){
1876
+ $input1['nutrition']['@type'] = 'NutritionInformation';
1877
+ $input1['nutrition']['carbohydrateContent'] = $custom_fields['saswp_recipe_carbohydrate'];
1878
+ }
1879
  if(isset($custom_fields['saswp_recipe_ingredient'])){
1880
 
1881
  if(is_array($custom_fields['saswp_recipe_ingredient'])){
1893
  }
1894
  }
1895
  if(isset($custom_fields['saswp_recipe_video_name'])){
1896
+ $input1['video']['@type'] = 'VideoObject';
1897
+ $input1['video']['name'] = $custom_fields['saswp_recipe_video_name'];
1898
  }
1899
 
1900
  if(isset($custom_fields['saswp_recipe_video_description'])){
1901
+ $input1['video']['@type'] = 'VideoObject';
1902
+ $input1['video']['description'] = $custom_fields['saswp_recipe_video_description'];
1903
  }
1904
  if(isset($custom_fields['saswp_recipe_video_thumbnailurl'])){
1905
+ $input1['video']['@type'] = 'VideoObject';
1906
+ $input1['video']['thumbnailUrl'] = $custom_fields['saswp_recipe_video_thumbnailurl'];
1907
  }
1908
  if(isset($custom_fields['saswp_recipe_video_contenturl'])){
1909
+ $input1['video']['@type'] = 'VideoObject';
1910
+ $input1['video']['contentUrl'] = $custom_fields['saswp_recipe_video_contenturl'];
1911
  }
1912
  if(isset($custom_fields['saswp_recipe_video_embedurl'])){
1913
+ $input1['video']['@type'] = 'VideoObject';
1914
+ $input1['video']['embedUrl'] = $custom_fields['saswp_recipe_video_embedurl'];
1915
  }
1916
  if(isset($custom_fields['saswp_recipe_video_upload_date'])){
1917
+ $input1['video']['@type'] = 'VideoObject';
1918
+ $input1['video']['uploadDate'] = $custom_fields['saswp_recipe_video_upload_date'];
1919
  }
1920
  if(isset($custom_fields['saswp_recipe_video_duration'])){
1921
+ $input1['video']['@type'] = 'VideoObject';
1922
+ $input1['video']['duration'] = $custom_fields['saswp_recipe_video_duration'];
1923
+ }
1924
+
1925
+ if(isset($custom_fields['saswp_recipe_video_url'])){
1926
+ $input1['video']['url'] = $custom_fields['saswp_recipe_video_url'];
1927
  }
1928
 
1929
  if(isset($custom_fields['saswp_recipe_rating_value']) && isset($custom_fields['saswp_recipe_rating_count'])){
3220
  $product_details = array();
3221
  $varible_prices = array();
3222
 
3223
+ $post_type = get_post_type($post_id);
3224
+
3225
+ if ( class_exists('WC_Product') && function_exists('wc_get_product') && $post_type == 'product' ) {
3226
 
3227
  global $woocommerce;
3228
  global $sd_data;
3724
  $accepted_answer['url'] = get_permalink($answer->ID);
3725
  $accepted_answer['text'] = wp_strip_all_tags($answer->post_content);
3726
  $accepted_answer['dateCreated'] = get_the_date("Y-m-d\TH:i:s\Z", $answer);
3727
+ $accepted_answer['author'] = array('@type' => 'Person', 'name' => is_object($authorinfo) ? $authorinfo->data->user_nicename : 'Anonymous');
3728
 
3729
  }else{
3730
 
3734
  'url' => get_permalink($answer->ID),
3735
  'text' => wp_strip_all_tags($answer->post_content),
3736
  'dateCreated' => get_the_date("Y-m-d\TH:i:s\Z", $answer),
3737
+ 'author' => array('@type' => 'Person', 'name' => is_object($authorinfo) ? $authorinfo->data->user_nicename : 'Anonymous'),
3738
  );
3739
 
3740
  }
3967
  if((isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] == 1) && !empty($product_details)){
3968
 
3969
  $input1 = array(
3970
+ '@context' => saswp_context_url(),
3971
  '@type' => $schema_type,
3972
  '@id' => trailingslashit(saswp_get_permalink()).'#'.$schema_type,
3973
  'url' => trailingslashit(saswp_get_permalink()),
4101
  }
4102
 
4103
  if($multiple_size){
4104
+
4105
+ if($targetHeight < 675){
4106
+
4107
+ $width = array(1200, 1200, 1200);
4108
+ $height = array(900, 720, 675);
4109
+
4110
+ }else{
4111
+
4112
+ $width = array(1200, 1200, 1200);
4113
+ $height = array($targetHeight, 900, 675);
4114
+
4115
+ }
4116
+
4117
  }else{
4118
+
4119
+ if($targetHeight < 675){
4120
+
4121
+ $width = array(1200);
4122
+ $height = array(720);
4123
+
4124
+ }else{
4125
+
4126
+ $width = array(1200);
4127
+ $height = array($targetHeight);
4128
+
4129
+ }
4130
+
4131
  }
4132
 
4133
  for($i = 0; $i < count($width); $i++){
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: magazine3
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
- Stable tag: 1.9.42
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -120,6 +120,22 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
120
 
121
  == Changelog ==
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  = 1.9.42 (27 June 2020) =
124
 
125
  * Added: Project Schema #486
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.4
6
+ Stable tag: 1.9.43
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
120
 
121
  == Changelog ==
122
 
123
+ = 1.9.43 (04 July 2020) =
124
+
125
+ * Fixed: Course post is getting blank when product schema is addedd to the ip_couse post type #1101
126
+ * Fixed: Website and searchbox schema should only show on the homepage #1098
127
+ * Fixed: FAQ schema is not being displayed in homepage(AMP) when using a custom front page #1096
128
+ * Fixed: PHP Notice: Trying to get property 'data' of non-object in /output/service.php on line 3700 because of anonymous users #1094
129
+ * Fixed: NewsArticle is not a known valid target type for the itemReviewed property #1093
130
+ * Fixed: Image size is smaller than recommended #1092
131
+ * Fixed: When ACF Video URL is mapped in modified field its not working #1084
132
+ * Added: Compatibility with Recipe Card Block By WPZOOM ( https://wordpress.org/plugins/recipe-card-blocks-by-wpzoom )
133
+ * Added: Compatibility with ReciPress ( https://wordpress.org/plugins/recipress )
134
+ * Added: More nutrition information properties to recipe schema
135
+ * Added: Schema type blocks (Q&A) has been added in Gutenberg editor #842
136
+ * Added: Schema type blocks (Q&A) has been added in Elementor widget #820
137
+
138
+
139
  = 1.9.42 (27 June 2020) =
140
 
141
  * Added: Project Schema #486
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
- Version: 1.9.42
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
@@ -13,7 +13,7 @@ License: GPL2
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
- define('SASWP_VERSION', '1.9.42');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
+ Version: 1.9.43
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.9.43');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));