Schema & Structured Data for WP & AMP - Version 1.8.1

Version Description

(13 May 2019) =

  • New Feature: An option for adding own custom json schema markup on every post #257
  • Added: Compatibility with WP-PostRatings ( https://wordpress.org/plugins/wp-postratings/ )#208
  • Added: Compatibility with bbPress ( https://wordpress.org/plugins/bbpress/ )#208
  • Added: Option to minified or pretty print schema markup #166
  • Added: To show all images of the article in the structured data. #84
  • Added: Geo Location (latitude and longitude) fields in local schema #90
  • Added: Micro data cleanup option (This option cleans all the micro data on page to valid the json markup) #262
  • Added: Image preview panel on every images, When these are added. #249
  • Bug Fixed: Content url and Embed url are missing in video object of structured data #190
  • Bug Fixed: Remove unnecessary css which effect on whole wordpress admin panel #264
  • Bug Fixed: If porto theme is activated, there are validation issues in product schema type. #163
Download this release

Release Info

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

Code changes from version 1.8 to 1.8.1

admin_section/common-function.php CHANGED
@@ -1595,6 +1595,28 @@ function saswp_frontend_enqueue(){
1595
  float:left;
1596
  }
1597
  .amp-sidebar .saswp-rtng{display:block;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1598
 
1599
 
1600
  <?php
1595
  float:left;
1596
  }
1597
  .amp-sidebar .saswp-rtng{display:block;}
1598
+
1599
+ .saswp-rvw-str .half-str{
1600
+ display:inline-block;
1601
+ width: 20px;
1602
+ height: 16px;
1603
+ background-repeat: no-repeat;
1604
+ background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/half_star.png'); ?>);
1605
+ }
1606
+ .saswp-rvw-str .str-ic{
1607
+ display:inline-block;
1608
+ width: 20px;
1609
+ height: 16px;
1610
+ background-repeat: no-repeat;
1611
+ background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/full_star.png'); ?>);
1612
+ }
1613
+ .saswp-rvw-str .df-clr{
1614
+ display:inline-block;
1615
+ width: 20px;
1616
+ height: 16px;
1617
+ background-repeat: no-repeat;
1618
+ background-image: url(<?php echo esc_url(SASWP_DIR_URI.'/admin_section/images/blank_star.png'); ?>);
1619
+ }
1620
 
1621
 
1622
  <?php
admin_section/css/main-style.css CHANGED
@@ -639,23 +639,6 @@ Compatibility tab css ends
639
  /*
640
  Google review module starts here
641
  */
642
- .saswp-accordion {
643
- background-color: #eee;
644
- color: #444;
645
- cursor: pointer;
646
- padding: 6px;
647
- width: 100%;
648
- border: none;
649
- text-align: left;
650
- outline: none;
651
- font-size: 15px;
652
- transition: 0.4s;
653
- }
654
-
655
- .active, .saswp-accordion:hover {
656
- background-color: #ccc;
657
- }
658
-
659
  .saswp-panel {
660
  padding: 7px 18px;
661
  background-color: white;
@@ -964,4 +947,19 @@ Google review module ends here
964
  font-weight: 600;
965
  letter-spacing: 1px;
966
  border-radius: 5px;
967
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
639
  /*
640
  Google review module starts here
641
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
642
  .saswp-panel {
643
  padding: 7px 18px;
644
  background-color: white;
947
  font-weight: 600;
948
  letter-spacing: 1px;
949
  border-radius: 5px;
950
+ }
951
+ .saswp_image_prev{
952
+ max-width: 200px;
953
+ max-height: 200px;
954
+ float: left;
955
+ padding-left:2px;
956
+ }
957
+ .saswp_prev_close {
958
+ position: relative;
959
+ width:30px;
960
+ height:30px;
961
+ top: 12px;
962
+ font-size: 20px;
963
+ top: -5px;
964
+ text-decoration:none;
965
+ }
admin_section/fields-generator.php CHANGED
@@ -93,6 +93,16 @@ class saswp_fields_generator {
93
 
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
96
  $input = sprintf(
97
  '<fieldset><input %s class="%s" style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
98
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
@@ -100,6 +110,9 @@ class saswp_fields_generator {
100
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="sd_data['.esc_attr($meta_field['id']).'][height]" id="sd_data['.esc_attr($meta_field['id']).'][height]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'height', 'saswp_string')).'">'
101
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="sd_data['.esc_attr($meta_field['id']).'][width]" id="sd_data['.esc_attr($meta_field['id']).'][width]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'width', 'saswp_string')).'">'
102
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" id="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')).'">'
 
 
 
103
  . '</fieldset>',
104
  $attribute_str,
105
  $class,
93
 
94
  }
95
 
96
+ $image_pre = '';
97
+ if(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')){
98
+
99
+ $image_pre = '<div class="saswp_image_thumbnail">
100
+ <img class="saswp_image_prev" src="'.esc_attr(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')).'" />
101
+ <a data-id="'.esc_attr($meta_field['id']).'" href="#" class="saswp_prev_close">X</a>
102
+ </div>';
103
+
104
+ }
105
+
106
  $input = sprintf(
107
  '<fieldset><input %s class="%s" style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
108
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
110
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="sd_data['.esc_attr($meta_field['id']).'][height]" id="sd_data['.esc_attr($meta_field['id']).'][height]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'height', 'saswp_string')).'">'
111
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="sd_data['.esc_attr($meta_field['id']).'][width]" id="sd_data['.esc_attr($meta_field['id']).'][width]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'width', 'saswp_string')).'">'
112
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" id="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')).'">'
113
+ . '<div class="saswp_image_div_'.esc_attr($meta_field['id']).'">'
114
+ . $image_pre
115
+ . '</div>'
116
  . '</fieldset>',
117
  $attribute_str,
118
  $class,
admin_section/js/main-script.js CHANGED
@@ -504,6 +504,42 @@ jQuery(document).ready(function($){
504
  }
505
  break;
506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
 
508
  default:
509
  break;
@@ -565,11 +601,35 @@ jQuery(document).ready(function($){
565
  $("#sd_default_image_width").val(attachment.width);
566
  $("#sd_default_image_height").val(attachment.height);
567
 
568
- }
 
569
 
570
  })
571
  .open();
572
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
573
  //Settings page jquery ends here
574
 
575
 
@@ -823,6 +883,27 @@ jQuery(document).ready(function($){
823
  $('.saswp-local-schema-time-picker').timepicker({ 'timeFormat': 'H:i:s'});
824
  }
825
  $('.saswp-local-schema-time-picker').timepicker({ 'timeFormat': 'H:i:s'});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
826
  $(".saswp-modify_schema_post_enable").on("click", function(e){
827
  var current = $(this);
828
  current.addClass('updating-message');
@@ -831,6 +912,7 @@ jQuery(document).ready(function($){
831
  { action:"saswp_modify_schema_post_enable", post_id: saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
832
  function(response){
833
  current.remove();
 
834
  $("#post_specific .inside").append(response);
835
  current.removeClass('updating-message');
836
  saswpAddTimepicker();
@@ -906,10 +988,14 @@ jQuery(document).ready(function($){
906
  }).change();
907
 
908
  $(document).on("click", ".saswp-restore-post-schema", function(e){
909
- e.preventDefault();
910
- var current = $(this);
911
- current.addClass('updating-message');
912
- var schema_ids = JSON.parse($(".saswp-post-specific-schema-ids").val());
 
 
 
 
913
  $.post(ajaxurl,
914
  { action:"saswp_restore_schema", schema_ids:schema_ids,post_id: saswp_localize_data.post_id, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
915
  function(response){
@@ -1086,22 +1172,7 @@ jQuery(document).ready(function($){
1086
  //custom fields modify schema ends here
1087
 
1088
 
1089
- //Google review js starts here
1090
-
1091
- // var acc = document.getElementsByClassName("saswp-accordion");
1092
- // var i;
1093
- //
1094
- // for (i = 0; i < acc.length; i++) {
1095
- // acc[i].addEventListener("click", function() {
1096
- // this.classList.toggle("active");
1097
- // var panel = this.nextElementSibling;
1098
- // if (panel.style.display === "block") {
1099
- // panel.style.display = "none";
1100
- // } else {
1101
- // panel.style.display = "block";
1102
- // }
1103
- // });
1104
- // }
1105
 
1106
  $('a[href="'+saswp_localize_data.collection_post_add_url+'"]').attr( 'href', saswp_localize_data.collection_post_add_new_url);
1107
 
504
  }
505
  break;
506
 
507
+ case 'saswp-pretty-print-checkbox':
508
+
509
+ if ($(this).is(':checked')) {
510
+ $("#saswp-pretty-print").val(1);
511
+ }else{
512
+ $("#saswp-pretty-print").val(0);
513
+ }
514
+ break;
515
+
516
+ case 'saswp-wppostratings-raring-checkbox':
517
+
518
+ if ($(this).is(':checked')) {
519
+ $("#saswp-wppostratings-raring").val(1);
520
+ }else{
521
+ $("#saswp-wppostratings-raring").val(0);
522
+ }
523
+ break;
524
+
525
+ case 'saswp-bbpress-checkbox':
526
+
527
+ if ($(this).is(':checked')) {
528
+ $("#saswp-bbpress").val(1);
529
+ }else{
530
+ $("#saswp-bbpress").val(0);
531
+ }
532
+ break;
533
+
534
+ case 'saswp-microdata-cleanup-checkbox':
535
+
536
+ if ($(this).is(':checked')) {
537
+ $("#saswp-microdata-cleanup").val(1);
538
+ }else{
539
+ $("#saswp-microdata-cleanup").val(0);
540
+ }
541
+ break;
542
+
543
 
544
  default:
545
  break;
601
  $("#sd_default_image_width").val(attachment.width);
602
  $("#sd_default_image_height").val(attachment.height);
603
 
604
+ }
605
+ $(".saswp_image_div_"+id).html('<div class="saswp_image_thumbnail"><img class="saswp_image_prev" src="'+attachment.url+'"/><a data-id="'+id+'" href="#" class="saswp_prev_close">X</a></div>');
606
 
607
  })
608
  .open();
609
  });
610
+
611
+ $(document).on("click", ".saswp_prev_close", function(e){
612
+ e.preventDefault();
613
+
614
+ var id = $(this).attr('data-id');
615
+ console.log(id);
616
+ $(this).parent().remove();
617
+ $("#"+id).val('');
618
+ $("input[data-id='"+id+"_id']").val('');
619
+ $("input[data-id='"+id+"_height']").val('');
620
+ $("input[data-id='"+id+"_width']").val('');
621
+ $("input[data-id='"+id+"_thumbnail']").val('');
622
+
623
+ if(id === 'sd_default_image'){
624
+
625
+ $("#sd_default_image_width").val('');
626
+ $("#sd_default_image_height").val('');
627
+
628
+ }
629
+
630
+
631
+ });
632
+
633
  //Settings page jquery ends here
634
 
635
 
883
  $('.saswp-local-schema-time-picker').timepicker({ 'timeFormat': 'H:i:s'});
884
  }
885
  $('.saswp-local-schema-time-picker').timepicker({ 'timeFormat': 'H:i:s'});
886
+
887
+ $(".saswp_custom_schema_post_enable").on("click", function(e){
888
+
889
+ e.preventDefault();
890
+
891
+ var current = $(this);
892
+ current.addClass('updating-message');
893
+ e.preventDefault();
894
+ $.get(ajaxurl,
895
+ { action:"saswp_custom_schema_post_enable", post_id: saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
896
+ function(response){
897
+ current.remove();
898
+ $("#post_specific .inside").append(response);
899
+ current.removeClass('updating-message');
900
+ $(".saswp-modify_schema_post_enable").remove();
901
+ });
902
+
903
+
904
+
905
+ });
906
+
907
  $(".saswp-modify_schema_post_enable").on("click", function(e){
908
  var current = $(this);
909
  current.addClass('updating-message');
912
  { action:"saswp_modify_schema_post_enable", post_id: saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
913
  function(response){
914
  current.remove();
915
+ $(".saswp_custom_schema_post_enable").remove();
916
  $("#post_specific .inside").append(response);
917
  current.removeClass('updating-message');
918
  saswpAddTimepicker();
988
  }).change();
989
 
990
  $(document).on("click", ".saswp-restore-post-schema", function(e){
991
+ e.preventDefault();
992
+ var current = $(this);
993
+ current.addClass('updating-message');
994
+
995
+ if($(".saswp-post-specific-schema-ids").val()){
996
+ var schema_ids = JSON.parse($(".saswp-post-specific-schema-ids").val());
997
+ }
998
+
999
  $.post(ajaxurl,
1000
  { action:"saswp_restore_schema", schema_ids:schema_ids,post_id: saswp_localize_data.post_id, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
1001
  function(response){
1172
  //custom fields modify schema ends here
1173
 
1174
 
1175
+ //Google review js starts here
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1176
 
1177
  $('a[href="'+saswp_localize_data.collection_post_add_url+'"]').attr( 'href', saswp_localize_data.collection_post_add_new_url);
1178
 
admin_section/settings.php CHANGED
@@ -1022,6 +1022,29 @@ function saswp_import_callback(){
1022
  'name' => 'sd_data[saswp-markup-footer]',
1023
  )
1024
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1025
 
1026
  );
1027
  $field_objs->saswp_field_generator($meta_fields, $settings);
@@ -1331,6 +1354,17 @@ function saswp_compatibility_page_callback(){
1331
  'name' => 'sd_data[saswp-kk-star-raring]',
1332
  )
1333
  );
 
 
 
 
 
 
 
 
 
 
 
1334
  $woocommerce = array(
1335
  'label' => 'Woocommerce',
1336
  'id' => 'saswp-woocommerce-checkbox',
@@ -1400,6 +1434,18 @@ function saswp_compatibility_page_callback(){
1400
  'name' => 'sd_data[saswp-dw-question-answer]',
1401
  )
1402
  );
 
 
 
 
 
 
 
 
 
 
 
 
1403
 
1404
  $yoast = array(
1405
  'label' => 'Yoast SEO Plugin',
@@ -1419,6 +1465,12 @@ function saswp_compatibility_page_callback(){
1419
 
1420
  }
1421
 
 
 
 
 
 
 
1422
 
1423
  if(!is_plugin_active('wordpress-seo/wp-seo.php') && !is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')){
1424
 
@@ -1488,6 +1540,12 @@ function saswp_compatibility_page_callback(){
1488
 
1489
  }
1490
 
 
 
 
 
 
 
1491
  // if(!is_plugin_active('wp-job-manager/wp-job-manager.php')){
1492
  //
1493
  // $wpjobmanager['note'] = esc_html__('Requires selected plugin','schema-and-structured-data-for-wp');
@@ -1505,6 +1563,8 @@ function saswp_compatibility_page_callback(){
1505
 
1506
  $meta_fields = array(
1507
  $kk_star,
 
 
1508
  $woocommerce,
1509
  $woocommerce_bok,
1510
  $woocommerce_mem,
1022
  'name' => 'sd_data[saswp-markup-footer]',
1023
  )
1024
  ),
1025
+ array(
1026
+ 'label' => 'Pretty Print Schema Markup',
1027
+ 'id' => 'saswp-pretty-print-checkbox',
1028
+ 'name' => 'saswp-pretty-print-checkbox',
1029
+ 'type' => 'checkbox',
1030
+ 'class' => 'checkbox saswp-checkbox',
1031
+ 'note' => 'By default schema markup will be minified format',
1032
+ 'hidden' => array(
1033
+ 'id' => 'saswp-pretty-print',
1034
+ 'name' => 'sd_data[saswp-pretty-print]',
1035
+ )
1036
+ ),
1037
+ array(
1038
+ 'label' => 'MicroData CleanUp',
1039
+ 'id' => 'saswp-microdata-cleanup-checkbox',
1040
+ 'name' => 'saswp-microdata-cleanup-checkbox',
1041
+ 'type' => 'checkbox',
1042
+ 'class' => 'checkbox saswp-checkbox',
1043
+ 'hidden' => array(
1044
+ 'id' => 'saswp-microdata-cleanup',
1045
+ 'name' => 'sd_data[saswp-microdata-cleanup]',
1046
+ )
1047
+ ),
1048
 
1049
  );
1050
  $field_objs->saswp_field_generator($meta_fields, $settings);
1354
  'name' => 'sd_data[saswp-kk-star-raring]',
1355
  )
1356
  );
1357
+ $wppostratings = array(
1358
+ 'label' => 'WP-PostRatings',
1359
+ 'id' => 'saswp-wppostratings-raring-checkbox',
1360
+ 'name' => 'saswp-wppostratings-raring-checkbox',
1361
+ 'type' => 'checkbox',
1362
+ 'class' => 'checkbox saswp-checkbox',
1363
+ 'hidden' => array(
1364
+ 'id' => 'saswp-wppostratings-raring',
1365
+ 'name' => 'sd_data[saswp-wppostratings-raring]',
1366
+ )
1367
+ );
1368
  $woocommerce = array(
1369
  'label' => 'Woocommerce',
1370
  'id' => 'saswp-woocommerce-checkbox',
1434
  'name' => 'sd_data[saswp-dw-question-answer]',
1435
  )
1436
  );
1437
+
1438
+ $bbpress = array(
1439
+ 'label' => 'bbPress',
1440
+ 'id' => 'saswp-bbpress-checkbox',
1441
+ 'name' => 'saswp-bbpress-checkbox',
1442
+ 'type' => 'checkbox',
1443
+ 'class' => 'checkbox saswp-checkbox',
1444
+ 'hidden' => array(
1445
+ 'id' => 'saswp-bbpress',
1446
+ 'name' => 'sd_data[saswp-bbpress]',
1447
+ )
1448
+ );
1449
 
1450
  $yoast = array(
1451
  'label' => 'Yoast SEO Plugin',
1465
 
1466
  }
1467
 
1468
+ if(!is_plugin_active('bbpress/bbpress.php')){
1469
+
1470
+ $bbpress['note'] = esc_html__('Requires selected plugin','schema-and-structured-data-for-wp');
1471
+
1472
+ }
1473
+
1474
 
1475
  if(!is_plugin_active('wordpress-seo/wp-seo.php') && !is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')){
1476
 
1540
 
1541
  }
1542
 
1543
+ if(!is_plugin_active('wp-postratings/wp-postratings.php')){
1544
+
1545
+ $wppostratings['note'] = esc_html__('Requires selected plugin','schema-and-structured-data-for-wp');
1546
+
1547
+ }
1548
+
1549
  // if(!is_plugin_active('wp-job-manager/wp-job-manager.php')){
1550
  //
1551
  // $wpjobmanager['note'] = esc_html__('Requires selected plugin','schema-and-structured-data-for-wp');
1563
 
1564
  $meta_fields = array(
1565
  $kk_star,
1566
+ $wppostratings,
1567
+ $bbpress,
1568
  $woocommerce,
1569
  $woocommerce_bok,
1570
  $woocommerce_mem,
google_review/google_review.php CHANGED
@@ -77,8 +77,12 @@ class saswp_google_review{
77
  $post_id = $attr['id'];
78
 
79
  if($post_id){
80
-
81
- $schema_markup = $this->saswp_get_google_review_schema_markup($post_id);
 
 
 
 
82
  $output = $this->saswp_google_review_front_output($post_id);
83
 
84
  if($schema_markup){
@@ -161,11 +165,12 @@ class saswp_google_review{
161
 
162
  if(!empty($input1)){
163
 
 
164
  $html .= '<!-- Schema & Structured Data For Google Review v'.esc_attr(SASWP_VERSION).' - -->';
165
  $html .= "\n";
166
  $html .= '<script type="application/ld+json">';
167
  $html .= "\n";
168
- $html .= json_encode($input1);
169
  $html .= "\n";
170
  $html .= '</script>';
171
  $html .= "\n\n";
77
  $post_id = $attr['id'];
78
 
79
  if($post_id){
80
+
81
+ if(saswp_global_option()){
82
+
83
+ $schema_markup = $this->saswp_get_google_review_schema_markup($post_id);
84
+
85
+ }
86
  $output = $this->saswp_google_review_front_output($post_id);
87
 
88
  if($schema_markup){
165
 
166
  if(!empty($input1)){
167
 
168
+ $html .= "\n";
169
  $html .= '<!-- Schema & Structured Data For Google Review v'.esc_attr(SASWP_VERSION).' - -->';
170
  $html .= "\n";
171
  $html .= '<script type="application/ld+json">';
172
  $html .= "\n";
173
+ $html .= saswp_json_print_format($input1);
174
  $html .= "\n";
175
  $html .= '</script>';
176
  $html .= "\n\n";
google_review/google_review_page.php CHANGED
@@ -219,7 +219,7 @@ class saswp_google_review_page{
219
 
220
  ?>
221
  <div class="saswp-heading">
222
- <h1 class="wp-heading-inline">Google Review </h1><span class="saswp-need-help"><a target="_blank" href="http://structured-data-for-wp.com/docs/">Need Help?</a></span>
223
  </div>
224
 
225
  <div class="saswp-g-review-container">
@@ -312,19 +312,15 @@ class saswp_google_review_page{
312
 
313
  </div>
314
 
315
- <div class="saswp-channel-list">
316
-
317
-
318
- <!-- <a class="saswp-accordion">Connect Google</a> -->
319
-
320
  <div class="saswp-panel">
321
- <h3>Google Review Settings</h3>
322
  <div class="saswp-input-fields">
323
- <label>Google ID:</label><input value="<?php if(isset($post_meta['saswp_google_place_id'])){ echo $post_meta['saswp_google_place_id'][0];} ?>" type="text" id="saswp_google_place_id" name="saswp_google_place_id" placeholder="<?php echo esc_html__('Place Id', 'schema-and-structured-data-for-wp' ); ?>">
324
  </div>
325
 
326
  <div class="saswp-input-fields">
327
- <label>Languages:</label>
328
  <select name="saswp_language_list" id="saswp_language_list">
329
  <?php
330
 
@@ -347,12 +343,12 @@ class saswp_google_review_page{
347
  </div>
348
 
349
  <div class="saswp-input-fields">
350
- <label>Goolge API</label>
351
  <input value="<?php if(isset($post_meta['saswp_googel_api'])){ echo $post_meta['saswp_googel_api'][0];} ?>" type="text" id="saswp_googel_api" name="saswp_googel_api" placeholder="<?php echo esc_html__('Google API', 'schema-and-structured-data-for-wp' ); ?>">
352
  </div>
353
 
354
  <div class="saswp-input-fields">
355
- <a class="saswp_coonect_google_place btn btn-success button-primary" >Connect Google</a>
356
  </div>
357
 
358
  </div>
219
 
220
  ?>
221
  <div class="saswp-heading">
222
+ <h1 class="wp-heading-inline"><?php echo esc_html__('Google Review','schema-and-structured-data-for-wp'); ?> </h1><span class="saswp-need-help"><a target="_blank" href="http://structured-data-for-wp.com/docs/article/how-to-display-google-review/"><?php echo esc_html__('Need Help?','schema-and-structured-data-for-wp'); ?></a></span>
223
  </div>
224
 
225
  <div class="saswp-g-review-container">
312
 
313
  </div>
314
 
315
+ <div class="saswp-channel-list">
 
 
 
 
316
  <div class="saswp-panel">
317
+ <h3><?php echo esc_html__('Google Review Settings','schema-and-structured-data-for-wp'); ?></h3>
318
  <div class="saswp-input-fields">
319
+ <label><?php echo esc_html__('Place ID','schema-and-structured-data-for-wp'); ?>:</label><input value="<?php if(isset($post_meta['saswp_google_place_id'])){ echo $post_meta['saswp_google_place_id'][0];} ?>" type="text" id="saswp_google_place_id" name="saswp_google_place_id" placeholder="<?php echo esc_html__('Place Id', 'schema-and-structured-data-for-wp' ); ?>">
320
  </div>
321
 
322
  <div class="saswp-input-fields">
323
+ <label><?php echo esc_html__('Languages','schema-and-structured-data-for-wp'); ?>:</label>
324
  <select name="saswp_language_list" id="saswp_language_list">
325
  <?php
326
 
343
  </div>
344
 
345
  <div class="saswp-input-fields">
346
+ <label><?php echo esc_html__('Goolge API','schema-and-structured-data-for-wp'); ?></label>
347
  <input value="<?php if(isset($post_meta['saswp_googel_api'])){ echo $post_meta['saswp_googel_api'][0];} ?>" type="text" id="saswp_googel_api" name="saswp_googel_api" placeholder="<?php echo esc_html__('Google API', 'schema-and-structured-data-for-wp' ); ?>">
348
  </div>
349
 
350
  <div class="saswp-input-fields">
351
+ <a class="saswp_coonect_google_place btn btn-success button-primary" ><?php echo esc_html__('Connect Google','schema-and-structured-data-for-wp'); ?></a>
352
  </div>
353
 
354
  </div>
output/function.php CHANGED
@@ -3,8 +3,6 @@ function saswp_remove_amp_default_structure_data($metadata){
3
  return '';
4
  }
5
 
6
- add_action('cooked_amp_head', 'saswp_schema_markup_output');
7
-
8
  add_filter( 'amp_init', 'saswp_schema_markup_hook_on_init' );
9
  add_action( 'init', 'saswp_schema_markup_hook_on_init');
10
 
@@ -24,6 +22,20 @@ function saswp_schema_markup_hook_on_init() {
24
 
25
  remove_action( 'amp_post_template_head', 'amp_post_template_add_schemaorg_metadata',99,1);
26
  remove_action( 'amp_post_template_footer', 'amp_post_template_add_schemaorg_metadata',99,1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  }
28
  }
29
 
@@ -34,96 +46,79 @@ function saswp_schema_markup_hook_on_init() {
34
  */
35
  function saswp_schema_markup_output() {
36
 
37
- global $sd_data;
38
- global $post;
39
-
40
- $output = '';
41
- $post_specific_enable = '';
42
- $kb_website_output = array();
43
- $kb_schema_output = array();
44
- $site_navigation = array();
45
-
46
-
47
- $site_navigation = saswp_site_navigation_output();
48
- $contact_page_output = saswp_contact_page_output();
49
- $about_page_output = saswp_about_page_output();
50
- $author_output = saswp_author_output();
51
- $archive_output = saswp_archive_output();
52
-
53
- $schema_breadcrumb_output = saswp_schema_breadcrumb_output();
54
-
55
-
56
- if(saswp_remove_warnings($sd_data, 'saswp-yoast', 'saswp_string') == 1 && (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php'))){
57
- }else{
58
- $kb_website_output = saswp_kb_website_output();
59
- $kb_schema_output = saswp_kb_schema_output();
60
-
61
-
62
- }
63
 
64
- if(is_singular()){
65
-
66
- $post_specific_enable = get_option('modify_schema_post_enable_'.esc_attr($post->ID));
67
-
68
- }
69
-
70
- if($post_specific_enable =='enable'){
71
-
72
- $schema_output = saswp_post_specific_schema_output();
73
-
74
- }else{
75
-
76
- $schema_output = saswp_schema_output();
77
-
78
- }
79
-
80
-
81
- if($schema_output || $schema_breadcrumb_output || $kb_website_output || $archive_output || $author_output || $about_page_output || $contact_page_output){
82
- add_filter( 'amp_post_template_metadata', 'saswp_remove_amp_default_structure_data');
83
- }
84
 
85
- if( ( saswp_remove_warnings($sd_data, 'saswp-for-wordpress', 'saswp_string') ==''
86
- || 1 == saswp_remove_warnings($sd_data, 'saswp-for-wordpress', 'saswp_string') && saswp_non_amp() )
87
- || ( 1 == saswp_remove_warnings($sd_data, 'saswp-for-amp', 'saswp_string') && !saswp_non_amp() ) ) {
88
-
89
-
 
 
 
 
 
 
 
 
90
  if(!empty($contact_page_output)){
91
 
92
- $output .= json_encode($contact_page_output);
93
  $output .= ",";
94
  $output .= "\n\n";
95
  }
96
  if(!empty($about_page_output)){
97
 
98
- $output .= json_encode($about_page_output);
99
  $output .= ",";
100
  $output .= "\n\n";
101
  }
102
  if(!empty($author_output)){
103
 
104
- $output .= json_encode($author_output);
105
  $output .= ",";
106
  $output .= "\n\n";
107
  }
108
  if(!empty($archive_output)){
109
 
110
- $output .= json_encode($archive_output);
111
  $output .= ",";
112
  $output .= "\n\n";
113
  }
114
  if(!empty($site_navigation)){
115
 
116
- $output .= json_encode($site_navigation);
117
  $output .= ",";
118
  $output .= "\n\n";
119
  }
120
-
121
-
122
-
123
  if(isset($sd_data['saswp-defragment']) && $sd_data['saswp-defragment'] == 1){
124
 
125
  $output_schema_type_id = array();
126
 
 
 
127
  foreach($schema_output as $soutput){
128
 
129
  $output_schema_type_id[] = $soutput['@type'];
@@ -193,14 +188,14 @@ function saswp_schema_markup_output() {
193
 
194
  $final_output['@graph'][] = $soutput;
195
 
196
- $schema = json_encode($final_output);
197
  $output .= $schema;
198
  $output .= ",";
199
  $output .= "\n\n";
200
 
201
  }else{
202
 
203
- $schema = json_encode($soutput);
204
  $output .= $schema;
205
  $output .= ",";
206
  $output .= "\n\n";
@@ -208,24 +203,24 @@ function saswp_schema_markup_output() {
208
  }
209
 
210
  }
211
-
212
  if(in_array('Blogposting', $output_schema_type_id) || in_array('Article', $output_schema_type_id) || in_array('TechArticle', $output_schema_type_id) || in_array('NewsArticle', $output_schema_type_id) ){
213
  }else{
214
  if(!empty($kb_website_output)){
215
 
216
- $output .= json_encode($kb_website_output);
217
  $output .= ",";
218
  $output .= "\n\n";
219
  }
220
  if(!empty($schema_breadcrumb_output)){
221
 
222
- $output .= json_encode($schema_breadcrumb_output);
223
  $output .= ",";
224
  $output .= "\n\n";
225
  }
226
  if(!empty($kb_schema_output)){
227
 
228
- $output .= json_encode($kb_schema_output);
229
  $output .= ",";
230
  }
231
  }
@@ -235,13 +230,13 @@ function saswp_schema_markup_output() {
235
 
236
  if(!empty($kb_website_output)){
237
 
238
- $output .= json_encode($kb_website_output);
239
  $output .= ",";
240
  $output .= "\n\n";
241
  }
242
  if(!empty($schema_breadcrumb_output)){
243
 
244
- $output .= json_encode($schema_breadcrumb_output);
245
  $output .= ",";
246
  $output .= "\n\n";
247
  }
@@ -249,7 +244,7 @@ function saswp_schema_markup_output() {
249
 
250
  foreach($schema_output as $schema){
251
 
252
- $schema = json_encode($schema);
253
  $output .= $schema;
254
  $output .= ",";
255
  $output .= "\n\n";
@@ -258,12 +253,34 @@ function saswp_schema_markup_output() {
258
  }
259
  if(!empty($kb_schema_output)){
260
 
261
- $output .= json_encode($kb_schema_output);
262
  $output .= ",";
263
  }
264
 
265
- }
266
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  }
268
 
269
  if($output){
@@ -280,8 +297,7 @@ function saswp_schema_markup_output() {
280
  echo '</script>';
281
  echo "\n\n";
282
  }
283
-
284
-
285
  }
286
 
287
  add_filter('the_content', 'saswp_paywall_data_for_login');
@@ -419,21 +435,25 @@ function saswp_reading_time_and_word_count() {
419
  * @param type $id
420
  * @return type array
421
  */
422
- function saswp_extract_kk_star_ratings($id){
423
 
424
  global $sd_data;
425
-
426
  if(isset($sd_data['saswp-kk-star-raring']) && $sd_data['saswp-kk-star-raring'] == 1 && is_plugin_active('kk-star-ratings/index.php')){
427
 
428
  $best = get_option('kksr_stars');
429
- $score = get_post_meta($id, '_kksr_ratings', true) ? ((int) get_post_meta($id, '_kksr_ratings', true)) : 0;
430
- $votes = get_post_meta($id, '_kksr_casts', true) ? ((int) get_post_meta($id, '_kksr_casts', true)) : 0;
431
- $avg = $score && $votes ? round((float)(($score/$votes)*($best/5)), 1) : 0;
432
- $per = $score && $votes ? round((float)((($score/$votes)/5)*100), 2) : 0;
433
-
434
  if($votes>0){
 
 
 
 
 
435
 
436
- return compact('best', 'score', 'votes', 'avg', 'per');
437
 
438
  }else{
439
 
@@ -448,6 +468,46 @@ function saswp_extract_kk_star_ratings($id){
448
  }
449
  }
450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  /**
452
  * Gets all the comments of current post
453
  * @param type $post_id
@@ -670,9 +730,18 @@ add_action( 'init', 'saswp_remove_woocommerce_default_structured_data' );
670
  */
671
  function saswp_remove_yoast_json($data){
672
 
673
- $data = array();
674
- return $data;
675
 
 
 
 
 
 
 
 
 
 
 
676
  }
677
 
678
  add_filter('wpseo_json_ld_output', 'saswp_remove_yoast_json', 10, 1);
@@ -685,8 +754,60 @@ add_filter('wpseo_json_ld_output', 'saswp_remove_yoast_json', 10, 1);
685
  */
686
  function saswp_remove_breadcrume_seo_by_rank_math($entry){
687
 
688
- $entry = array();
689
- return $entry;
 
 
 
 
 
 
 
690
  }
691
 
692
- add_filter( 'rank_math/snippet/breadcrumb', 'saswp_remove_breadcrume_seo_by_rank_math' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  return '';
4
  }
5
 
 
 
6
  add_filter( 'amp_init', 'saswp_schema_markup_hook_on_init' );
7
  add_action( 'init', 'saswp_schema_markup_hook_on_init');
8
 
22
 
23
  remove_action( 'amp_post_template_head', 'amp_post_template_add_schemaorg_metadata',99,1);
24
  remove_action( 'amp_post_template_footer', 'amp_post_template_add_schemaorg_metadata',99,1);
25
+ add_filter( 'amp_post_template_metadata', 'saswp_remove_amp_default_structure_data');
26
+ add_action('cooked_amp_head', 'saswp_schema_markup_output');
27
+
28
+ if(isset($sd_data['saswp-wppostratings-raring']) && $sd_data['saswp-wppostratings-raring'] == 1){
29
+
30
+ add_filter('wp_postratings_schema_itemtype', '__return_false');
31
+ add_filter('wp_postratings_google_structured_data', '__return_false');
32
+
33
+ }
34
+
35
+ if(isset($sd_data['saswp-microdata-cleanup']) && $sd_data['saswp-microdata-cleanup'] == 1){
36
+ ob_start("saswp_remove_microdata");
37
+ }
38
+
39
  }
40
  }
41
 
46
  */
47
  function saswp_schema_markup_output() {
48
 
49
+ global $sd_data;
50
+ global $post;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
+ $output = '';
53
+ $post_specific_enable = '';
54
+ $schema_output = array();
55
+
56
+ $site_navigation = saswp_site_navigation_output();
57
+ $contact_page_output = saswp_contact_page_output();
58
+ $about_page_output = saswp_about_page_output();
59
+ $author_output = saswp_author_output();
60
+ $archive_output = saswp_archive_output();
61
+ $schema_breadcrumb_output = saswp_schema_breadcrumb_output();
62
+ $kb_website_output = saswp_kb_website_output();
63
+ $kb_schema_output = saswp_kb_schema_output();
64
+
65
+ if(is_singular()){
66
+
67
+ $post_specific_enable = get_option('modify_schema_post_enable_'.esc_attr($post->ID));
68
+ $custom_option = get_option('custom_schema_post_enable_'.esc_attr($post->ID));
69
+
70
+ }
 
71
 
72
+ if($post_specific_enable =='enable'){
73
+
74
+ $schema_output = saswp_post_specific_schema_output();
75
+
76
+ }else{
77
+
78
+ if($custom_option !='enable'){
79
+ $schema_output = saswp_schema_output();
80
+ }
81
+
82
+ }
83
+ if(saswp_global_option()) {
84
+
85
  if(!empty($contact_page_output)){
86
 
87
+ $output .= saswp_json_print_format($contact_page_output);
88
  $output .= ",";
89
  $output .= "\n\n";
90
  }
91
  if(!empty($about_page_output)){
92
 
93
+ $output .= saswp_json_print_format($about_page_output);
94
  $output .= ",";
95
  $output .= "\n\n";
96
  }
97
  if(!empty($author_output)){
98
 
99
+ $output .= saswp_json_print_format($author_output);
100
  $output .= ",";
101
  $output .= "\n\n";
102
  }
103
  if(!empty($archive_output)){
104
 
105
+ $output .= saswp_json_print_format($archive_output);
106
  $output .= ",";
107
  $output .= "\n\n";
108
  }
109
  if(!empty($site_navigation)){
110
 
111
+ $output .= saswp_json_print_format($site_navigation);
112
  $output .= ",";
113
  $output .= "\n\n";
114
  }
115
+
 
 
116
  if(isset($sd_data['saswp-defragment']) && $sd_data['saswp-defragment'] == 1){
117
 
118
  $output_schema_type_id = array();
119
 
120
+ if(!empty($schema_output)){
121
+
122
  foreach($schema_output as $soutput){
123
 
124
  $output_schema_type_id[] = $soutput['@type'];
188
 
189
  $final_output['@graph'][] = $soutput;
190
 
191
+ $schema = saswp_json_print_format($final_output);
192
  $output .= $schema;
193
  $output .= ",";
194
  $output .= "\n\n";
195
 
196
  }else{
197
 
198
+ $schema = saswp_json_print_format($soutput);
199
  $output .= $schema;
200
  $output .= ",";
201
  $output .= "\n\n";
203
  }
204
 
205
  }
206
+ }
207
  if(in_array('Blogposting', $output_schema_type_id) || in_array('Article', $output_schema_type_id) || in_array('TechArticle', $output_schema_type_id) || in_array('NewsArticle', $output_schema_type_id) ){
208
  }else{
209
  if(!empty($kb_website_output)){
210
 
211
+ $output .= saswp_json_print_format($kb_website_output);
212
  $output .= ",";
213
  $output .= "\n\n";
214
  }
215
  if(!empty($schema_breadcrumb_output)){
216
 
217
+ $output .= saswp_json_print_format($schema_breadcrumb_output);
218
  $output .= ",";
219
  $output .= "\n\n";
220
  }
221
  if(!empty($kb_schema_output)){
222
 
223
+ $output .= saswp_json_print_format($kb_schema_output);
224
  $output .= ",";
225
  }
226
  }
230
 
231
  if(!empty($kb_website_output)){
232
 
233
+ $output .= saswp_json_print_format($kb_website_output);
234
  $output .= ",";
235
  $output .= "\n\n";
236
  }
237
  if(!empty($schema_breadcrumb_output)){
238
 
239
+ $output .= saswp_json_print_format($schema_breadcrumb_output);
240
  $output .= ",";
241
  $output .= "\n\n";
242
  }
244
 
245
  foreach($schema_output as $schema){
246
 
247
+ $schema = saswp_json_print_format($schema);
248
  $output .= $schema;
249
  $output .= ",";
250
  $output .= "\n\n";
253
  }
254
  if(!empty($kb_schema_output)){
255
 
256
+ $output .= saswp_json_print_format($kb_schema_output);
257
  $output .= ",";
258
  }
259
 
260
+ }
261
+
262
+ if($custom_option == 'enable'){
263
+
264
+ $custom_output = get_post_meta($post->ID, 'saswp_custom_schema_field', true);
265
+
266
+ if($custom_output){
267
+
268
+ echo "\n";
269
+ echo '<!-- Schema & Structured Data For WP Custom Markup v'.esc_attr(SASWP_VERSION).' - -->';
270
+ echo "\n";
271
+ echo '<script type="application/ld+json">';
272
+ echo "\n";
273
+ echo $custom_output;
274
+ echo "\n";
275
+ echo '</script>';
276
+ echo "\n\n";
277
+
278
+ }
279
+
280
+
281
+ }
282
+
283
+
284
  }
285
 
286
  if($output){
297
  echo '</script>';
298
  echo "\n\n";
299
  }
300
+
 
301
  }
302
 
303
  add_filter('the_content', 'saswp_paywall_data_for_login');
435
  * @param type $id
436
  * @return type array
437
  */
438
+ function saswp_extract_kk_star_ratings(){
439
 
440
  global $sd_data;
441
+ $kk_star_rating = array();
442
  if(isset($sd_data['saswp-kk-star-raring']) && $sd_data['saswp-kk-star-raring'] == 1 && is_plugin_active('kk-star-ratings/index.php')){
443
 
444
  $best = get_option('kksr_stars');
445
+ $score = get_post_meta(get_the_ID(), '_kksr_ratings', true) ? ((int) get_post_meta(get_the_ID(), '_kksr_ratings', true)) : 0;
446
+ $votes = get_post_meta(get_the_ID(), '_kksr_casts', true) ? ((int) get_post_meta(get_the_ID(), '_kksr_casts', true)) : 0;
447
+ $avg = $score && $votes ? round((float)(($score/$votes)*($best/5)), 1) : 0;
448
+
 
449
  if($votes>0){
450
+
451
+ $kk_star_rating['@type'] = 'AggregateRating';
452
+ $kk_star_rating['bestRating'] = $best;
453
+ $kk_star_rating['ratingCount'] = $votes;
454
+ $kk_star_rating['ratingValue'] = $avg;
455
 
456
+ return $kk_star_rating;
457
 
458
  }else{
459
 
468
  }
469
  }
470
 
471
+
472
+ /**
473
+ * Extracting the value of wp-post-rating ratings plugins on current post
474
+ * @global type $sd_data
475
+ * @param type $id
476
+ * @return type array
477
+ */
478
+ function saswp_extract_wp_post_ratings(){
479
+
480
+ global $sd_data;
481
+
482
+ $wp_post_rating_ar = array();
483
+
484
+ if(isset($sd_data['saswp-wppostratings-raring']) && $sd_data['saswp-wppostratings-raring'] == 1 && is_plugin_active('wp-postratings/wp-postratings.php')){
485
+
486
+ $best = (int) get_option( 'postratings_max' );
487
+ $avg = get_post_meta(get_the_ID(), 'ratings_average', true);
488
+ $votes = get_post_meta(get_the_ID(), 'ratings_users', true);
489
+
490
+ if($votes>0){
491
+
492
+ $wp_post_rating_ar['@type'] = 'AggregateRating';
493
+ $wp_post_rating_ar['bestRating'] = $best;
494
+ $wp_post_rating_ar['ratingCount'] = $votes;
495
+ $wp_post_rating_ar['ratingValue'] = $avg;
496
+
497
+ return $wp_post_rating_ar;
498
+ }else{
499
+
500
+ return array();
501
+
502
+ }
503
+
504
+ }else{
505
+
506
+ return array();
507
+
508
+ }
509
+ }
510
+
511
  /**
512
  * Gets all the comments of current post
513
  * @param type $post_id
730
  */
731
  function saswp_remove_yoast_json($data){
732
 
733
+ global $sd_data;
 
734
 
735
+ if(saswp_global_option() && saswp_remove_warnings($sd_data, 'saswp-yoast', 'saswp_string') == 1){
736
+
737
+ $data = array();
738
+ return $data;
739
+
740
+ }else{
741
+
742
+ return $data;
743
+ }
744
+
745
  }
746
 
747
  add_filter('wpseo_json_ld_output', 'saswp_remove_yoast_json', 10, 1);
754
  */
755
  function saswp_remove_breadcrume_seo_by_rank_math($entry){
756
 
757
+ if(saswp_global_option()){
758
+
759
+ $entry = array();
760
+ return $entry;
761
+
762
+ }else{
763
+ return $entry;
764
+ }
765
+
766
  }
767
 
768
+ add_filter( 'rank_math/snippet/breadcrumb', 'saswp_remove_breadcrume_seo_by_rank_math' );
769
+
770
+
771
+ function saswp_json_print_format($output_array){
772
+
773
+ global $sd_data;
774
+
775
+ if(isset($sd_data['saswp-pretty-print']) && $sd_data['saswp-pretty-print'] == 1){
776
+ return json_encode($output_array, JSON_PRETTY_PRINT);
777
+ }else{
778
+ return json_encode($output_array);
779
+ }
780
+
781
+ }
782
+
783
+ function saswp_remove_microdata($content){
784
+
785
+ if(saswp_global_option()){
786
+
787
+ $content = preg_replace("/itemscope itemtype=(\"?)http(s?):\/\/schema.org\/(Article|BlogPosting|Blog|BreadcrumbList|AggregateRating|WebPage|Person|Organization|NewsArticle|Product|CreativeWork|ImageObject)(\"?)/", "", $content);
788
+ $content = preg_replace("/itemscope=(\"?)itemscope(\"?) itemtype=(\"?)http(s?):\/\/schema.org\/(Article|BlogPosting|Blog|BreadcrumbList|AggregateRating|WebPage|Person|Organization|NewsArticle|Product|CreativeWork|ImageObject)(\"?)/", "", $content);
789
+ $content = preg_replace("/vcard/", "", $content);
790
+ $content = preg_replace("/hentry/", "", $content);
791
+ }
792
+
793
+ return $content;
794
+ }
795
+
796
+
797
+ function saswp_global_option(){
798
+
799
+ global $sd_data;
800
+
801
+ if( ( saswp_remove_warnings($sd_data, 'saswp-for-wordpress', 'saswp_string') ==''
802
+ || 1 == saswp_remove_warnings($sd_data, 'saswp-for-wordpress', 'saswp_string') && saswp_non_amp() )
803
+ || ( 1 == saswp_remove_warnings($sd_data, 'saswp-for-amp', 'saswp_string') && !saswp_non_amp() ) ) {
804
+
805
+ return true;
806
+
807
+ }else{
808
+
809
+ return false;
810
+
811
+ }
812
+
813
+ }
output/output.php CHANGED
@@ -256,8 +256,7 @@ function saswp_schema_output() {
256
 
257
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
258
 
259
- $aggregateRating = array();
260
- $kkstar_aggregateRating = array();
261
  $saswp_over_all_rating = '';
262
 
263
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
@@ -277,7 +276,7 @@ function saswp_schema_output() {
277
  $saswp_review_count = "1";
278
 
279
 
280
- if($saswp_over_all_rating && $saswp_review_count && $saswp_review_item_enable ==1){
281
 
282
  $aggregateRating = array(
283
  "@type" => "AggregateRating",
@@ -286,20 +285,7 @@ function saswp_schema_output() {
286
  );
287
 
288
  }
289
-
290
- $kkstar_rating_data = saswp_extract_kk_star_ratings(get_the_ID());
291
-
292
- if(!empty($kkstar_rating_data)){
293
-
294
- $kkstar_aggregateRating = array(
295
- "@type" => "AggregateRating",
296
- "bestRating" => saswp_remove_warnings($kkstar_rating_data, 'best', 'saswp_string'),
297
- "ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
298
- "ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
299
- );
300
-
301
- }
302
-
303
  $service_object = new saswp_output_service();
304
 
305
  $extra_theme_review = array();
@@ -335,10 +321,7 @@ function saswp_schema_output() {
335
  }
336
  if(!empty($aggregateRating)){
337
  $input1['aggregateRating'] = $aggregateRating;
338
- }
339
- if(!empty($kkstar_aggregateRating)){
340
- $input1['aggregateRating'] = $kkstar_aggregateRating;
341
- }
342
  if(!empty($extra_theme_review)){
343
  $input1 = array_merge($input1, $extra_theme_review);
344
  }
@@ -349,6 +332,73 @@ function saswp_schema_output() {
349
  $input1 = apply_filters('saswp_modify_course_schema_output', $input1 );
350
  }
351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
  if( 'Blogposting' === $schema_type){
353
 
354
  $input1 = array(
@@ -379,10 +429,7 @@ function saswp_schema_output() {
379
  }
380
  if(!empty($aggregateRating)){
381
  $input1['aggregateRating'] = $aggregateRating;
382
- }
383
- if(!empty($kkstar_aggregateRating)){
384
- $input1['aggregateRating'] = $kkstar_aggregateRating;
385
- }
386
  if(!empty($extra_theme_review)){
387
  $input1 = array_merge($input1, $extra_theme_review);
388
  }
@@ -425,10 +472,7 @@ function saswp_schema_output() {
425
  }
426
  if(!empty($aggregateRating)){
427
  $input1['aggregateRating'] = $aggregateRating;
428
- }
429
- if(!empty($kkstar_aggregateRating)){
430
- $input1['aggregateRating'] = $kkstar_aggregateRating;
431
- }
432
  if(!empty($extra_theme_review)){
433
  $input1 = array_merge($input1, $extra_theme_review);
434
  }
@@ -505,10 +549,7 @@ function saswp_schema_output() {
505
  }
506
  if(!empty($aggregateRating)){
507
  $input1['aggregateRating'] = $aggregateRating;
508
- }
509
- if(!empty($kkstar_aggregateRating)){
510
- $input1['aggregateRating'] = $kkstar_aggregateRating;
511
- }
512
  if(!empty($extra_theme_review)){
513
  $input1 = array_merge($input1, $extra_theme_review);
514
  }
@@ -568,10 +609,7 @@ function saswp_schema_output() {
568
  }
569
  if(!empty($aggregateRating)){
570
  $input1['aggregateRating'] = $aggregateRating;
571
- }
572
- if(!empty($kkstar_aggregateRating)){
573
- $input1['aggregateRating'] = $kkstar_aggregateRating;
574
- }
575
  if(!empty($extra_theme_review)){
576
  $input1 = array_merge($input1, $extra_theme_review);
577
  }
@@ -596,10 +634,7 @@ function saswp_schema_output() {
596
  }
597
  if(!empty($aggregateRating)){
598
  $input1['mainEntity']['aggregateRating'] = $aggregateRating;
599
- }
600
- if(!empty($kkstar_aggregateRating)){
601
- $input1['mainEntity']['aggregateRating'] = $kkstar_aggregateRating;
602
- }
603
  if(!empty($extra_theme_review)){
604
  $input1 = array_merge($input1, $extra_theme_review);
605
  }
@@ -693,10 +728,7 @@ function saswp_schema_output() {
693
  }
694
  if(!empty($aggregateRating)){
695
  $input1['aggregateRating'] = $aggregateRating;
696
- }
697
- if(!empty($kkstar_aggregateRating)){
698
- $input1['aggregateRating'] = $kkstar_aggregateRating;
699
- }
700
  if(!empty($extra_theme_review)){
701
  $input1 = array_merge($input1, $extra_theme_review);
702
  }
@@ -846,10 +878,7 @@ function saswp_schema_output() {
846
 
847
  if(!empty($aggregateRating)){
848
  $input1['aggregateRating'] = $aggregateRating;
849
- }
850
- if(!empty($kkstar_aggregateRating)){
851
- $input1['aggregateRating'] = $kkstar_aggregateRating;
852
- }
853
  if(!empty($extra_theme_review)){
854
  $input1 = array_merge($input1, $extra_theme_review);
855
  }
@@ -923,10 +952,7 @@ function saswp_schema_output() {
923
 
924
  if(!empty($aggregateRating)){
925
  $input1['aggregateRating'] = $aggregateRating;
926
- }
927
- if(!empty($kkstar_aggregateRating)){
928
- $input1['aggregateRating'] = $kkstar_aggregateRating;
929
- }
930
  if(!empty($extra_theme_review)){
931
  $input1 = array_merge($input1, $extra_theme_review);
932
  }
@@ -1017,10 +1043,7 @@ function saswp_schema_output() {
1017
 
1018
  if(!empty($aggregateRating)){
1019
  $input1['aggregateRating'] = $aggregateRating;
1020
- }
1021
- if(!empty($kkstar_aggregateRating)){
1022
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1023
- }
1024
  if(!empty($extra_theme_review)){
1025
  $input1 = array_merge($input1, $extra_theme_review);
1026
  }
@@ -1310,8 +1333,7 @@ function saswp_schema_output() {
1310
 
1311
  if(!$description){
1312
  $description = get_bloginfo('description');
1313
- }
1314
-
1315
  $input1 = array(
1316
  '@context' => 'http://schema.org',
1317
  '@type' => 'VideoObject',
@@ -1353,10 +1375,7 @@ function saswp_schema_output() {
1353
  }
1354
  if(!empty($aggregateRating)){
1355
  $input1['aggregateRating'] = $aggregateRating;
1356
- }
1357
- if(!empty($kkstar_aggregateRating)){
1358
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1359
- }
1360
  if(!empty($extra_theme_review)){
1361
  $input1 = array_merge($input1, $extra_theme_review);
1362
  }
@@ -1430,10 +1449,7 @@ function saswp_schema_output() {
1430
 
1431
  if(!empty($aggregateRating)){
1432
  $input1['aggregateRating'] = $aggregateRating;
1433
- }
1434
- if(!empty($kkstar_aggregateRating)){
1435
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1436
- }
1437
  if(!empty($extra_theme_review)){
1438
  $input1 = array_merge($input1, $extra_theme_review);
1439
  }
@@ -1451,13 +1467,42 @@ function saswp_schema_output() {
1451
 
1452
  if(isset($business_details['local_menu'])){
1453
  $input1['hasMenu'] = esc_url($business_details['local_menu']);
1454
- }
 
 
 
 
 
 
 
 
 
1455
 
1456
  $input1 = apply_filters('saswp_modify_local_business_schema_output', $input1 );
1457
  }
1458
 
 
 
 
 
 
 
1459
 
1460
- //Check for Featured Image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1461
 
1462
  if( !empty($input1) && !isset($input1['image'])){
1463
 
@@ -1568,8 +1613,8 @@ function saswp_post_specific_schema_output() {
1568
 
1569
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
1570
 
1571
- $aggregateRating = array();
1572
- $saswp_over_all_rating ='';
1573
 
1574
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
1575
 
@@ -1585,28 +1630,16 @@ function saswp_post_specific_schema_output() {
1585
  }
1586
  $saswp_review_count = "1";
1587
 
1588
- if($saswp_over_all_rating && $saswp_review_count && $saswp_review_item_enable ==1){
 
1589
 
1590
  $aggregateRating = array(
1591
  "@type" => "AggregateRating",
1592
  "ratingValue" => esc_attr($saswp_over_all_rating),
1593
  "reviewCount" => esc_attr($saswp_review_count)
1594
- );
1595
-
1596
  }
1597
 
1598
- $kkstar_rating_data = saswp_extract_kk_star_ratings(get_the_ID());
1599
-
1600
- if(!empty($kkstar_rating_data)){
1601
-
1602
- $kkstar_aggregateRating = array(
1603
- "@type" => "AggregateRating",
1604
- "bestRating" => saswp_remove_warnings($kkstar_rating_data, 'best', 'saswp_string'),
1605
- "ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
1606
- "ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
1607
- );
1608
-
1609
- }
1610
  $extra_theme_review = array();
1611
  $service_object = new saswp_output_service();
1612
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
@@ -1700,14 +1733,29 @@ function saswp_post_specific_schema_output() {
1700
 
1701
  if(!empty($aggregateRating)){
1702
  $input1['aggregateRating'] = $aggregateRating;
1703
- }
1704
- if(!empty($kkstar_aggregateRating)){
1705
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1706
- }
1707
  if(!empty($extra_theme_review)){
1708
  $input1 = array_merge($input1, $extra_theme_review);
1709
  }
1710
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1711
  }
1712
 
1713
  if( 'Course' === $schema_type){
@@ -1732,12 +1780,7 @@ function saswp_post_specific_schema_output() {
1732
 
1733
  $input1['aggregateRating'] = $aggregateRating;
1734
 
1735
- }
1736
- if(!empty($kkstar_aggregateRating)){
1737
-
1738
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1739
-
1740
- }
1741
  if(!empty($extra_theme_review)){
1742
 
1743
  $input1 = array_merge($input1, $extra_theme_review);
@@ -1777,10 +1820,7 @@ function saswp_post_specific_schema_output() {
1777
  );
1778
  if(!empty($aggregateRating)){
1779
  $input1['aggregateRating'] = $aggregateRating;
1780
- }
1781
- if(!empty($kkstar_aggregateRating)){
1782
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1783
- }
1784
  if(!empty($extra_theme_review)){
1785
  $input1 = array_merge($input1, $extra_theme_review);
1786
  }
@@ -1807,10 +1847,7 @@ function saswp_post_specific_schema_output() {
1807
  );
1808
  if(!empty($aggregateRating)){
1809
  $input1['aggregateRating'] = $aggregateRating;
1810
- }
1811
- if(!empty($kkstar_aggregateRating)){
1812
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1813
- }
1814
  if(!empty($extra_theme_review)){
1815
  $input1 = array_merge($input1, $extra_theme_review);
1816
  }
@@ -1847,10 +1884,7 @@ function saswp_post_specific_schema_output() {
1847
 
1848
  if(!empty($aggregateRating)){
1849
  $input1['aggregateRating'] = $aggregateRating;
1850
- }
1851
- if(!empty($kkstar_aggregateRating)){
1852
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1853
- }
1854
  if(!empty($extra_theme_review)){
1855
  $input1 = array_merge($input1, $extra_theme_review);
1856
  }
@@ -1896,11 +1930,7 @@ function saswp_post_specific_schema_output() {
1896
  $input1['mainEntity']['aggregateRating'] = $aggregateRating;
1897
 
1898
  }
1899
- if(!empty($kkstar_aggregateRating)){
1900
-
1901
- $input1['mainEntity']['aggregateRating'] = $kkstar_aggregateRating;
1902
-
1903
- }
1904
  if(!empty($extra_theme_review)){
1905
 
1906
  $input1 = array_merge($input1, $extra_theme_review);
@@ -1937,12 +1967,7 @@ function saswp_post_specific_schema_output() {
1937
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_name_'.$schema_id, 'saswp_array'),
1938
  ),
1939
 
1940
- );
1941
- if(!empty($kkstar_aggregateRating)){
1942
-
1943
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1944
-
1945
- }
1946
  if(!empty($extra_theme_review)){
1947
 
1948
  $input1 = array_merge($input1, $extra_theme_review);
@@ -1979,12 +2004,7 @@ function saswp_post_specific_schema_output() {
1979
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_organization_name_'.$schema_id, 'saswp_array'),
1980
  ),
1981
 
1982
- );
1983
- if(!empty($kkstar_aggregateRating)){
1984
-
1985
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1986
-
1987
- }
1988
  if(!empty($extra_theme_review)){
1989
 
1990
  $input1 = array_merge($input1, $extra_theme_review);
@@ -2100,10 +2120,7 @@ function saswp_post_specific_schema_output() {
2100
  );
2101
  if(!empty($aggregateRating)){
2102
  $input1['aggregateRating'] = $aggregateRating;
2103
- }
2104
- if(!empty($kkstar_aggregateRating)){
2105
- $input1['aggregateRating'] = $kkstar_aggregateRating;
2106
- }
2107
  if(!empty($extra_theme_review)){
2108
  $input1 = array_merge($input1, $extra_theme_review);
2109
  }
@@ -2161,10 +2178,7 @@ function saswp_post_specific_schema_output() {
2161
 
2162
  if(!empty($aggregateRating)){
2163
  $input1['aggregateRating'] = $aggregateRating;
2164
- }
2165
- if(!empty($kkstar_aggregateRating)){
2166
- $input1['aggregateRating'] = $kkstar_aggregateRating;
2167
- }
2168
  if(!empty($extra_theme_review)){
2169
  $input1 = array_merge($input1, $extra_theme_review);
2170
  }
@@ -2247,10 +2261,7 @@ function saswp_post_specific_schema_output() {
2247
  );
2248
  if(!empty($aggregateRating)){
2249
  $input1['aggregateRating'] = $aggregateRating;
2250
- }
2251
- if(!empty($kkstar_aggregateRating)){
2252
- $input1['aggregateRating'] = $kkstar_aggregateRating;
2253
- }
2254
  }
2255
 
2256
  if( 'VideoObject' === $schema_type){
@@ -2270,6 +2281,8 @@ function saswp_post_specific_schema_output() {
2270
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2271
  'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
2272
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
 
 
2273
  'mainEntity' => array(
2274
  '@type' => 'WebPage',
2275
  '@id' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_main_entity_id_'.$schema_id, 'saswp_array'),
@@ -2297,10 +2310,7 @@ function saswp_post_specific_schema_output() {
2297
  );
2298
  if(!empty($aggregateRating)){
2299
  $input1['aggregateRating'] = $aggregateRating;
2300
- }
2301
- if(!empty($kkstar_aggregateRating)){
2302
- $input1['aggregateRating'] = $kkstar_aggregateRating;
2303
- }
2304
  if(!empty($extra_theme_review)){
2305
  $input1 = array_merge($input1, $extra_theme_review);
2306
  }
@@ -2366,10 +2376,7 @@ function saswp_post_specific_schema_output() {
2366
  }
2367
  if(!empty($aggregateRating)){
2368
  $input1['aggregateRating'] = $aggregateRating;
2369
- }
2370
- if(!empty($kkstar_aggregateRating)){
2371
- $input1['aggregateRating'] = $kkstar_aggregateRating;
2372
- }
2373
  if(!empty($extra_theme_review)){
2374
  $input1 = array_merge($input1, $extra_theme_review);
2375
  }
@@ -2662,10 +2669,7 @@ function saswp_post_specific_schema_output() {
2662
 
2663
  if(!empty($aggregateRating)){
2664
  $input1['aggregateRating'] = $aggregateRating;
2665
- }
2666
- if(!empty($kkstar_aggregateRating)){
2667
- $input1['aggregateRating'] = $kkstar_aggregateRating;
2668
- }
2669
  if(!empty($extra_theme_review)){
2670
  $input1 = array_merge($input1, $extra_theme_review);
2671
  }
@@ -2683,8 +2687,43 @@ function saswp_post_specific_schema_output() {
2683
 
2684
  if(isset($all_post_meta['local_menu_'.$schema_id][0])){
2685
  $input1['hasMenu'] = esc_url($all_post_meta['local_menu_'.$schema_id][0]);
2686
- }
 
 
 
 
 
 
 
 
 
 
 
 
2687
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2688
 
2689
  if( !empty($input1) && !isset($input1['image'])){
2690
 
@@ -2698,7 +2737,7 @@ function saswp_post_specific_schema_output() {
2698
  }
2699
  }
2700
 
2701
- $input1 = apply_filters('saswp_modify_woocommerce_membership_schema', $input1);
2702
 
2703
  if(!empty($input1)){
2704
 
256
 
257
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
258
 
259
+ $aggregateRating = array();
 
260
  $saswp_over_all_rating = '';
261
 
262
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
276
  $saswp_review_count = "1";
277
 
278
 
279
+ if($saswp_over_all_rating && $saswp_review_count && $saswp_review_item_enable ==1 && isset($sd_data['saswp-review-module']) && $sd_data['saswp-review-module'] ==1){
280
 
281
  $aggregateRating = array(
282
  "@type" => "AggregateRating",
285
  );
286
 
287
  }
288
+
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  $service_object = new saswp_output_service();
290
 
291
  $extra_theme_review = array();
321
  }
322
  if(!empty($aggregateRating)){
323
  $input1['aggregateRating'] = $aggregateRating;
324
+ }
 
 
 
325
  if(!empty($extra_theme_review)){
326
  $input1 = array_merge($input1, $extra_theme_review);
327
  }
332
  $input1 = apply_filters('saswp_modify_course_schema_output', $input1 );
333
  }
334
 
335
+
336
+ if( 'DiscussionForumPosting' === $schema_type){
337
+
338
+ if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && is_plugin_active('bbpress/bbpress.php')){
339
+ $input1 = array(
340
+ '@context' => 'http://schema.org',
341
+ '@type' => 'DiscussionForumPosting' ,
342
+ '@id' => bbp_get_topic_permalink().'/#discussionforumposting',
343
+ 'headline' => bbp_get_topic_title(get_the_ID()),
344
+ 'description' => wp_strip_all_tags(strip_shortcodes(get_the_excerpt())),
345
+ "articleSection" => bbp_get_forum_title(),
346
+ "articleBody" => wp_strip_all_tags(strip_shortcodes(get_the_content())),
347
+ 'url' => bbp_get_topic_permalink(),
348
+ 'datePublished' => esc_html($date),
349
+ 'dateModified' => esc_html($modified_date),
350
+ 'author' => array(
351
+ '@type' => 'Person',
352
+ 'name' => esc_attr($aurthor_name)
353
+ ),
354
+ 'interactionStatistic' => array(
355
+ '@type' => 'InteractionCounter',
356
+ 'interactionType' => 'http://schema.org/CommentAction',
357
+ 'userInteractionCount' => bbp_get_topic_reply_count(),
358
+ )
359
+ );
360
+
361
+ }else{
362
+
363
+ $input1 = array(
364
+ '@context' => 'http://schema.org',
365
+ '@type' => 'DiscussionForumPosting' ,
366
+ '@id' => get_permalink().'/#blogposting',
367
+ 'headline' => get_the_title(),
368
+ 'description' => strip_tags(strip_shortcodes(get_the_excerpt())),
369
+ 'url' => get_permalink(),
370
+ 'datePublished' => esc_html($date),
371
+ 'dateModified' => esc_html($modified_date),
372
+ 'author' => array(
373
+ '@type' => 'Person',
374
+ 'name' => esc_attr($aurthor_name)
375
+ )
376
+ );
377
+
378
+ }
379
+ if(!empty($publisher)){
380
+
381
+ $input1 = array_merge($input1, $publisher);
382
+
383
+ }
384
+
385
+ if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
386
+ $service = new saswp_output_service();
387
+ $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
388
+ }
389
+ if(!empty($aggregateRating)){
390
+ $input1['aggregateRating'] = $aggregateRating;
391
+ }
392
+ if(!empty($extra_theme_review)){
393
+ $input1 = array_merge($input1, $extra_theme_review);
394
+ }
395
+ if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] == 1){
396
+ $input1['comment'] = saswp_get_comments(get_the_ID());
397
+ }
398
+
399
+ $input1 = apply_filters('saswp_modify_d_forum_posting_schema_output', $input1 );
400
+ }
401
+
402
  if( 'Blogposting' === $schema_type){
403
 
404
  $input1 = array(
429
  }
430
  if(!empty($aggregateRating)){
431
  $input1['aggregateRating'] = $aggregateRating;
432
+ }
 
 
 
433
  if(!empty($extra_theme_review)){
434
  $input1 = array_merge($input1, $extra_theme_review);
435
  }
472
  }
473
  if(!empty($aggregateRating)){
474
  $input1['aggregateRating'] = $aggregateRating;
475
+ }
 
 
 
476
  if(!empty($extra_theme_review)){
477
  $input1 = array_merge($input1, $extra_theme_review);
478
  }
549
  }
550
  if(!empty($aggregateRating)){
551
  $input1['aggregateRating'] = $aggregateRating;
552
+ }
 
 
 
553
  if(!empty($extra_theme_review)){
554
  $input1 = array_merge($input1, $extra_theme_review);
555
  }
609
  }
610
  if(!empty($aggregateRating)){
611
  $input1['aggregateRating'] = $aggregateRating;
612
+ }
 
 
 
613
  if(!empty($extra_theme_review)){
614
  $input1 = array_merge($input1, $extra_theme_review);
615
  }
634
  }
635
  if(!empty($aggregateRating)){
636
  $input1['mainEntity']['aggregateRating'] = $aggregateRating;
637
+ }
 
 
 
638
  if(!empty($extra_theme_review)){
639
  $input1 = array_merge($input1, $extra_theme_review);
640
  }
728
  }
729
  if(!empty($aggregateRating)){
730
  $input1['aggregateRating'] = $aggregateRating;
731
+ }
 
 
 
732
  if(!empty($extra_theme_review)){
733
  $input1 = array_merge($input1, $extra_theme_review);
734
  }
878
 
879
  if(!empty($aggregateRating)){
880
  $input1['aggregateRating'] = $aggregateRating;
881
+ }
 
 
 
882
  if(!empty($extra_theme_review)){
883
  $input1 = array_merge($input1, $extra_theme_review);
884
  }
952
 
953
  if(!empty($aggregateRating)){
954
  $input1['aggregateRating'] = $aggregateRating;
955
+ }
 
 
 
956
  if(!empty($extra_theme_review)){
957
  $input1 = array_merge($input1, $extra_theme_review);
958
  }
1043
 
1044
  if(!empty($aggregateRating)){
1045
  $input1['aggregateRating'] = $aggregateRating;
1046
+ }
 
 
 
1047
  if(!empty($extra_theme_review)){
1048
  $input1 = array_merge($input1, $extra_theme_review);
1049
  }
1333
 
1334
  if(!$description){
1335
  $description = get_bloginfo('description');
1336
+ }
 
1337
  $input1 = array(
1338
  '@context' => 'http://schema.org',
1339
  '@type' => 'VideoObject',
1375
  }
1376
  if(!empty($aggregateRating)){
1377
  $input1['aggregateRating'] = $aggregateRating;
1378
+ }
 
 
 
1379
  if(!empty($extra_theme_review)){
1380
  $input1 = array_merge($input1, $extra_theme_review);
1381
  }
1449
 
1450
  if(!empty($aggregateRating)){
1451
  $input1['aggregateRating'] = $aggregateRating;
1452
+ }
 
 
 
1453
  if(!empty($extra_theme_review)){
1454
  $input1 = array_merge($input1, $extra_theme_review);
1455
  }
1467
 
1468
  if(isset($business_details['local_menu'])){
1469
  $input1['hasMenu'] = esc_url($business_details['local_menu']);
1470
+ }
1471
+
1472
+
1473
+ if(isset($business_details['local_latitude']) && isset($business_details['local_longitude'])){
1474
+
1475
+ $input1['geo']['@type'] = 'GeoCoordinates';
1476
+ $input1['geo']['latitude'] = $business_details['local_latitude'];
1477
+ $input1['geo']['longitude'] = $business_details['local_longitude'];
1478
+ }
1479
+
1480
 
1481
  $input1 = apply_filters('saswp_modify_local_business_schema_output', $input1 );
1482
  }
1483
 
1484
+
1485
+ if($schema_type !='Review' || (isset($sd_data['saswp-the-events-calendar']) && $sd_data['saswp-the-events-calendar'] == 0) || (isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] == 0)){
1486
+
1487
+ //kk star rating
1488
+
1489
+ $kkstar_aggregateRating = saswp_extract_kk_star_ratings();
1490
 
1491
+ if(!empty($kkstar_aggregateRating)){
1492
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
1493
+ }
1494
+
1495
+ //wp post-rating star rating
1496
+
1497
+ $wp_post_rating_ar = saswp_extract_wp_post_ratings();
1498
+
1499
+ if(!empty($wp_post_rating_ar)){
1500
+ $input1['aggregateRating'] = $wp_post_rating_ar;
1501
+ }
1502
+
1503
+ }
1504
+
1505
+ //Check for Featured Image
1506
 
1507
  if( !empty($input1) && !isset($input1['image'])){
1508
 
1613
 
1614
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
1615
 
1616
+ $aggregateRating = array();
1617
+ $saswp_over_all_rating ='';
1618
 
1619
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
1620
 
1630
  }
1631
  $saswp_review_count = "1";
1632
 
1633
+
1634
+ if($saswp_over_all_rating && $saswp_review_count && $saswp_review_item_enable ==1 && isset($sd_data['saswp-review-module']) && $sd_data['saswp-review-module'] ==1){
1635
 
1636
  $aggregateRating = array(
1637
  "@type" => "AggregateRating",
1638
  "ratingValue" => esc_attr($saswp_over_all_rating),
1639
  "reviewCount" => esc_attr($saswp_review_count)
1640
+ );
 
1641
  }
1642
 
 
 
 
 
 
 
 
 
 
 
 
 
1643
  $extra_theme_review = array();
1644
  $service_object = new saswp_output_service();
1645
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
1733
 
1734
  if(!empty($aggregateRating)){
1735
  $input1['aggregateRating'] = $aggregateRating;
1736
+ }
 
 
 
1737
  if(!empty($extra_theme_review)){
1738
  $input1 = array_merge($input1, $extra_theme_review);
1739
  }
1740
 
1741
+ }
1742
+
1743
+ if( 'DiscussionForumPosting' === $schema_type){
1744
+
1745
+ $input1 = array(
1746
+ '@context' => 'http://schema.org',
1747
+ '@type' => 'DiscussionForumPosting' ,
1748
+ '@id' => saswp_remove_warnings($all_post_meta, 'saswp_dfp_url_'.$schema_id, 'saswp_array').'/#blogposting',
1749
+ 'headline' => saswp_remove_warnings($all_post_meta, 'saswp_dfp_headline_'.$schema_id, 'saswp_array'),
1750
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_dfp_description_'.$schema_id, 'saswp_array'),
1751
+ 'url' => saswp_remove_warnings($all_post_meta, 'saswp_dfp_url_'.$schema_id, 'saswp_array'),
1752
+ 'datePublished' => isset($all_post_meta['saswp_dfp_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_dfp_date_published_'.$schema_id][0])):'',
1753
+ 'dateModified' => isset($all_post_meta['saswp_dfp_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_dfp_date_modified_'.$schema_id][0])):'',
1754
+ 'author' => array(
1755
+ '@type' => 'Person',
1756
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_dfp_author_name_'.$schema_id, 'saswp_array')
1757
+ )
1758
+ );
1759
  }
1760
 
1761
  if( 'Course' === $schema_type){
1780
 
1781
  $input1['aggregateRating'] = $aggregateRating;
1782
 
1783
+ }
 
 
 
 
 
1784
  if(!empty($extra_theme_review)){
1785
 
1786
  $input1 = array_merge($input1, $extra_theme_review);
1820
  );
1821
  if(!empty($aggregateRating)){
1822
  $input1['aggregateRating'] = $aggregateRating;
1823
+ }
 
 
 
1824
  if(!empty($extra_theme_review)){
1825
  $input1 = array_merge($input1, $extra_theme_review);
1826
  }
1847
  );
1848
  if(!empty($aggregateRating)){
1849
  $input1['aggregateRating'] = $aggregateRating;
1850
+ }
 
 
 
1851
  if(!empty($extra_theme_review)){
1852
  $input1 = array_merge($input1, $extra_theme_review);
1853
  }
1884
 
1885
  if(!empty($aggregateRating)){
1886
  $input1['aggregateRating'] = $aggregateRating;
1887
+ }
 
 
 
1888
  if(!empty($extra_theme_review)){
1889
  $input1 = array_merge($input1, $extra_theme_review);
1890
  }
1930
  $input1['mainEntity']['aggregateRating'] = $aggregateRating;
1931
 
1932
  }
1933
+
 
 
 
 
1934
  if(!empty($extra_theme_review)){
1935
 
1936
  $input1 = array_merge($input1, $extra_theme_review);
1967
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_name_'.$schema_id, 'saswp_array'),
1968
  ),
1969
 
1970
+ );
 
 
 
 
 
1971
  if(!empty($extra_theme_review)){
1972
 
1973
  $input1 = array_merge($input1, $extra_theme_review);
2004
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_organization_name_'.$schema_id, 'saswp_array'),
2005
  ),
2006
 
2007
+ );
 
 
 
 
 
2008
  if(!empty($extra_theme_review)){
2009
 
2010
  $input1 = array_merge($input1, $extra_theme_review);
2120
  );
2121
  if(!empty($aggregateRating)){
2122
  $input1['aggregateRating'] = $aggregateRating;
2123
+ }
 
 
 
2124
  if(!empty($extra_theme_review)){
2125
  $input1 = array_merge($input1, $extra_theme_review);
2126
  }
2178
 
2179
  if(!empty($aggregateRating)){
2180
  $input1['aggregateRating'] = $aggregateRating;
2181
+ }
 
 
 
2182
  if(!empty($extra_theme_review)){
2183
  $input1 = array_merge($input1, $extra_theme_review);
2184
  }
2261
  );
2262
  if(!empty($aggregateRating)){
2263
  $input1['aggregateRating'] = $aggregateRating;
2264
+ }
 
 
 
2265
  }
2266
 
2267
  if( 'VideoObject' === $schema_type){
2281
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2282
  'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
2283
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
2284
+ 'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_content_url_'.$schema_id, 'saswp_array'),
2285
+ 'embedUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_embed_url_'.$schema_id, 'saswp_array'),
2286
  'mainEntity' => array(
2287
  '@type' => 'WebPage',
2288
  '@id' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_main_entity_id_'.$schema_id, 'saswp_array'),
2310
  );
2311
  if(!empty($aggregateRating)){
2312
  $input1['aggregateRating'] = $aggregateRating;
2313
+ }
 
 
 
2314
  if(!empty($extra_theme_review)){
2315
  $input1 = array_merge($input1, $extra_theme_review);
2316
  }
2376
  }
2377
  if(!empty($aggregateRating)){
2378
  $input1['aggregateRating'] = $aggregateRating;
2379
+ }
 
 
 
2380
  if(!empty($extra_theme_review)){
2381
  $input1 = array_merge($input1, $extra_theme_review);
2382
  }
2669
 
2670
  if(!empty($aggregateRating)){
2671
  $input1['aggregateRating'] = $aggregateRating;
2672
+ }
 
 
 
2673
  if(!empty($extra_theme_review)){
2674
  $input1 = array_merge($input1, $extra_theme_review);
2675
  }
2687
 
2688
  if(isset($all_post_meta['local_menu_'.$schema_id][0])){
2689
  $input1['hasMenu'] = esc_url($all_post_meta['local_menu_'.$schema_id][0]);
2690
+ }
2691
+
2692
+ if(isset($all_post_meta['local_latitude_'.$schema_id][0]) && isset($all_post_meta['local_longitude_'.$schema_id][0])){
2693
+
2694
+ $input1['geo']['@type'] = 'GeoCoordinates';
2695
+ $input1['geo']['latitude'] = $all_post_meta['local_latitude_'.$schema_id][0];
2696
+ $input1['geo']['longitude'] = $all_post_meta['local_longitude_'.$schema_id][0];
2697
+
2698
+ }
2699
+
2700
+
2701
+
2702
+
2703
  }
2704
+
2705
+
2706
+ if($schema_type != 'Review'){
2707
+
2708
+ //kk star rating
2709
+
2710
+ $kkstar_aggregateRating = saswp_extract_kk_star_ratings();
2711
+
2712
+ if(!empty($kkstar_aggregateRating)){
2713
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
2714
+ }
2715
+
2716
+ //wp post-rating star rating
2717
+
2718
+ $wp_post_rating_ar = saswp_extract_wp_post_ratings();
2719
+
2720
+ if(!empty($wp_post_rating_ar)){
2721
+ $input1['aggregateRating'] = $wp_post_rating_ar;
2722
+ }
2723
+
2724
+
2725
+ }
2726
+
2727
 
2728
  if( !empty($input1) && !isset($input1['image'])){
2729
 
2737
  }
2738
  }
2739
 
2740
+ $input1 = apply_filters('saswp_modify_woocommerce_membership_schema', $input1);
2741
 
2742
  if(!empty($input1)){
2743
 
output/review-output.php CHANGED
@@ -24,6 +24,9 @@ Class saswp_review_output{
24
 
25
  public function saswp_display_review_box_schema(){
26
 
 
 
 
27
  global $sd_data;
28
  $author_id = get_the_author_meta('ID');
29
 
@@ -91,7 +94,7 @@ Class saswp_review_output{
91
  echo "\n";
92
  echo '<script type="application/ld+json">';
93
  echo "\n";
94
- echo json_encode($input1);
95
  echo "\n";
96
  echo '</script>';
97
  echo "\n\n";
@@ -100,7 +103,8 @@ Class saswp_review_output{
100
 
101
 
102
  }
103
-
 
104
 
105
  }
106
 
24
 
25
  public function saswp_display_review_box_schema(){
26
 
27
+
28
+ if(saswp_global_option()){
29
+
30
  global $sd_data;
31
  $author_id = get_the_author_meta('ID');
32
 
94
  echo "\n";
95
  echo '<script type="application/ld+json">';
96
  echo "\n";
97
+ echo saswp_json_print_format($input1);
98
  echo "\n";
99
  echo '</script>';
100
  echo "\n\n";
103
 
104
 
105
  }
106
+
107
+ }
108
 
109
  }
110
 
output/service.php CHANGED
@@ -70,6 +70,12 @@ Class saswp_output_service{
70
  if(isset($custom_fields['local_postal_code'])){
71
  $input1['address']['postalCode'] = $custom_fields['local_postal_code'];
72
  }
 
 
 
 
 
 
73
  if(isset($custom_fields['local_phone'])){
74
  $input1['telephone'] = $custom_fields['local_phone'];
75
  }
@@ -423,7 +429,30 @@ Class saswp_output_service{
423
  $input1['provider']['sameAs'] = $custom_fields['saswp_course_sameas'];
424
  }
425
 
426
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
 
428
  case 'Recipe':
429
  if(isset($custom_fields['saswp_recipe_url'])){
@@ -672,7 +701,13 @@ Class saswp_output_service{
672
  }
673
  if(isset($custom_fields['saswp_video_object_thumbnail_url'])){
674
  $input1['thumbnailUrl'] = $custom_fields['saswp_video_object_thumbnail_url'];
 
 
 
675
  }
 
 
 
676
  if(isset($custom_fields['saswp_video_object_main_entity_id'])){
677
  $input1['mainEntity']['@id'] = $custom_fields['saswp_video_object_main_entity_id'];
678
  }
@@ -1174,7 +1209,9 @@ Class saswp_output_service{
1174
  'local_street_address' => 'Street Address',
1175
  'local_city' => 'City',
1176
  'local_state' => 'State',
1177
- 'local_postal_code' => 'Postal Code',
 
 
1178
  'local_phone' => 'Phone',
1179
  'local_website' => 'Website',
1180
  'local_business_logo' => 'Image',
@@ -1288,6 +1325,19 @@ Class saswp_output_service{
1288
  );
1289
  break;
1290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1291
  case 'Recipe':
1292
 
1293
  $meta_field = array(
@@ -1397,7 +1447,9 @@ Class saswp_output_service{
1397
  'saswp_video_object_description' => 'Description',
1398
  'saswp_video_object_name' => 'Name',
1399
  'saswp_video_object_upload_date' => 'Upload Date',
1400
- 'saswp_video_object_thumbnail_url' => 'Thumbnail Url',
 
 
1401
  'saswp_video_object_main_entity_id' => 'Main Entity Id',
1402
  'saswp_video_object_author_name' => 'Author Name',
1403
  'saswp_video_object_author_image' => 'Author Image',
@@ -1756,21 +1808,69 @@ Class saswp_output_service{
1756
  }
1757
 
1758
 
1759
- }else{
1760
-
1761
- if(isset($sd_data['sd_default_image']['url']) && $sd_data['sd_default_image']['url'] !=''){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1762
 
1763
- $input2['image']['@type'] = 'ImageObject';
1764
- $input2['image']['@id'] = get_permalink().'#primaryimage';
1765
- $input2['image']['url'] = esc_url($sd_data['sd_default_image']['url']);
1766
- $input2['image']['width'] = esc_attr($sd_data['sd_default_image_width']);
1767
- $input2['image']['height'] = esc_attr($sd_data['sd_default_image_height']);
1768
 
1769
- }
1770
-
1771
-
1772
- }
1773
-
1774
  return $input2;
1775
  }
1776
  /**
70
  if(isset($custom_fields['local_postal_code'])){
71
  $input1['address']['postalCode'] = $custom_fields['local_postal_code'];
72
  }
73
+ if(isset($custom_fields['local_latitude'])){
74
+ $input1['geo']['latitude'] = $custom_fields['local_latitude'];
75
+ }
76
+ if(isset($custom_fields['local_longitude'])){
77
+ $input1['geo']['longitude'] = $custom_fields['local_longitude'];
78
+ }
79
  if(isset($custom_fields['local_phone'])){
80
  $input1['telephone'] = $custom_fields['local_phone'];
81
  }
429
  $input1['provider']['sameAs'] = $custom_fields['saswp_course_sameas'];
430
  }
431
 
432
+ break;
433
+
434
+ case 'DiscussionForumPosting':
435
+
436
+ if(isset($custom_fields['saswp_dfp_headline'])){
437
+ $input1['headline'] = $custom_fields['saswp_dfp_headline'];
438
+ }
439
+ if(isset($custom_fields['saswp_dfp_description'])){
440
+ $input1['description'] = $custom_fields['saswp_dfp_description'];
441
+ }
442
+ if(isset($custom_fields['saswp_dfp_url'])){
443
+ $input1['url'] = $custom_fields['saswp_dfp_url'];
444
+ }
445
+ if(isset($custom_fields['saswp_dfp_date_published'])){
446
+ $input1['datePublished'] = $custom_fields['saswp_dfp_date_published'];
447
+ }
448
+ if(isset($custom_fields['saswp_dfp_date_modified'])){
449
+ $input1['dateModified'] = $custom_fields['saswp_dfp_date_modified'];
450
+ }
451
+ if(isset($custom_fields['saswp_dfp_author_name'])){
452
+ $input1['author']['name'] = $custom_fields['saswp_dfp_author_name'];
453
+ }
454
+
455
+ break;
456
 
457
  case 'Recipe':
458
  if(isset($custom_fields['saswp_recipe_url'])){
701
  }
702
  if(isset($custom_fields['saswp_video_object_thumbnail_url'])){
703
  $input1['thumbnailUrl'] = $custom_fields['saswp_video_object_thumbnail_url'];
704
+ }
705
+ if(isset($custom_fields['saswp_video_object_content_url'])){
706
+ $input1['thumbnailUrl'] = $custom_fields['saswp_video_object_content_url'];
707
  }
708
+ if(isset($custom_fields['saswp_video_object_embed_url'])){
709
+ $input1['thumbnailUrl'] = $custom_fields['saswp_video_object_embed_url'];
710
+ }
711
  if(isset($custom_fields['saswp_video_object_main_entity_id'])){
712
  $input1['mainEntity']['@id'] = $custom_fields['saswp_video_object_main_entity_id'];
713
  }
1209
  'local_street_address' => 'Street Address',
1210
  'local_city' => 'City',
1211
  'local_state' => 'State',
1212
+ 'local_postal_code' => 'Postal Code',
1213
+ 'local_latitude' => 'Latitude',
1214
+ 'local_longitude' => 'Longitude',
1215
  'local_phone' => 'Phone',
1216
  'local_website' => 'Website',
1217
  'local_business_logo' => 'Image',
1325
  );
1326
  break;
1327
 
1328
+ case 'DiscussionForumPosting':
1329
+
1330
+ $meta_field = array(
1331
+ 'saswp_dfp_headline' => 'Headline',
1332
+ 'saswp_dfp_description' => 'Description',
1333
+ 'saswp_dfp_url' => 'URL',
1334
+ 'saswp_dfp_date_published' => 'Date Published',
1335
+ 'saswp_dfp_date_modified' => 'Date Modified',
1336
+ 'saswp_dfp_author_name' => 'Author Name',
1337
+ );
1338
+
1339
+ break;
1340
+
1341
  case 'Recipe':
1342
 
1343
  $meta_field = array(
1447
  'saswp_video_object_description' => 'Description',
1448
  'saswp_video_object_name' => 'Name',
1449
  'saswp_video_object_upload_date' => 'Upload Date',
1450
+ 'saswp_video_object_thumbnail_url' => 'Thumbnail Url',
1451
+ 'saswp_video_object_content_url' => 'Content URL',
1452
+ 'saswp_video_object_embed_url' => 'Embed Url',
1453
  'saswp_video_object_main_entity_id' => 'Main Entity Id',
1454
  'saswp_video_object_author_name' => 'Author Name',
1455
  'saswp_video_object_author_image' => 'Author Image',
1808
  }
1809
 
1810
 
1811
+ }
1812
+
1813
+ //Get All the images available on post
1814
+
1815
+ $content = get_the_content();
1816
+
1817
+ if($content){
1818
+
1819
+ $regex = '/src="([^"]*)"/';
1820
+ preg_match_all( $regex, $content, $attachments );
1821
+
1822
+ $attach_images = array();
1823
+
1824
+ if(!empty($attachments)){
1825
+ $k = 0;
1826
+ foreach ($attachments[1] as $attachment) {
1827
+
1828
+ $attach_details = getimagesize($attachment);
1829
+ if($attach_details){
1830
+
1831
+
1832
+ $attach_images['image'][$k]['@type'] = 'ImageObject';
1833
+ $attach_images['image'][$k]['url'] = esc_url($attachment);
1834
+ $attach_images['image'][$k]['width'] = esc_attr($attach_details[0]);
1835
+ $attach_images['image'][$k]['height'] = esc_attr($attach_details[1]);
1836
+
1837
+ }
1838
+
1839
+ $k++;
1840
+ }
1841
+
1842
+ }
1843
+
1844
+ if(!empty($attach_images)){
1845
+
1846
+ if(isset($input2['image'])){
1847
+
1848
+ $merged_arr = array_merge($input2['image'],$attach_images['image']);
1849
+ $input2['image'] = $merged_arr;
1850
+
1851
+ }else{
1852
+ $input2 = $attach_images;
1853
+ }
1854
+
1855
+ }
1856
+
1857
+ }
1858
+
1859
+ if(empty($input2)){
1860
+
1861
+ if(isset($sd_data['sd_default_image']['url']) && $sd_data['sd_default_image']['url'] !=''){
1862
 
1863
+ $input2['image']['@type'] = 'ImageObject';
1864
+ $input2['image']['@id'] = get_permalink().'#primaryimage';
1865
+ $input2['image']['url'] = esc_url($sd_data['sd_default_image']['url']);
1866
+ $input2['image']['width'] = esc_attr($sd_data['sd_default_image_width']);
1867
+ $input2['image']['height'] = esc_attr($sd_data['sd_default_image_height']);
1868
 
1869
+ }
1870
+
1871
+
1872
+ }
1873
+
1874
  return $input2;
1875
  }
1876
  /**
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.2
6
- Stable tag: 1.8
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -66,6 +66,21 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
66
  == Changelog ==
67
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  = 1.8 (08 May 2019) =
70
 
71
  * New Feature: Google Reviews and its schema markup (Users can list their business reviews from google reviews using place id) #61
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.2
6
+ Stable tag: 1.8.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
66
  == Changelog ==
67
 
68
 
69
+ = 1.8.1 (13 May 2019) =
70
+
71
+ * New Feature: An option for adding own custom json schema markup on every post #257
72
+ * Added: Compatibility with WP-PostRatings ( https://wordpress.org/plugins/wp-postratings/ )#208
73
+ * Added: Compatibility with bbPress ( https://wordpress.org/plugins/bbpress/ )#208
74
+ * Added: Option to minified or pretty print schema markup #166
75
+ * Added: To show all images of the article in the structured data. #84
76
+ * Added: Geo Location (latitude and longitude) fields in local schema #90
77
+ * Added: Micro data cleanup option (This option cleans all the micro data on page to valid the json markup) #262
78
+ * Added: Image preview panel on every images, When these are added. #249
79
+ * Bug Fixed: Content url and Embed url are missing in video object of structured data #190
80
+ * Bug Fixed: Remove unnecessary css which effect on whole wordpress admin panel #264
81
+ * Bug Fixed: If porto theme is activated, there are validation issues in product schema type. #163
82
+
83
+
84
  = 1.8 (08 May 2019) =
85
 
86
  * New Feature: Google Reviews and its schema markup (Users can list their business reviews from google reviews using place id) #61
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP
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.8
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.8');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
@@ -23,11 +23,7 @@ if(! defined('SASWP_ITEM_FOLDER_NAME')){
23
  define( 'SASWP_ITEM_FOLDER_NAME', $folderName );
24
  }
25
  define('SASWP_PLUGIN_URL', plugin_dir_url( __FILE__ ));
26
-
27
- //define('SASWP_EDD_SL_ITEM_ID', plugin_dir_url( __FILE__ ));
28
- define('SASWP_EDD_STORE_URL', 'http://accounts.structured-data-for-wp.com/');
29
- //define('SASWP_EDD_DATA_ITEM_NAME', 'Cooked compatibility for Schema' );
30
-
31
  // including the output file
32
  require_once SASWP_DIR_NAME .'/output/function.php';
33
  require_once SASWP_DIR_NAME .'/output/output.php';
@@ -77,6 +73,7 @@ require_once SASWP_DIR_NAME.'/output/service.php';
77
 
78
 
79
  global $sd_data;
 
80
  if(isset($sd_data['saswp-google-review']) && $sd_data['saswp-google-review'] == 1){
81
 
82
  require_once SASWP_DIR_NAME.'/google_review/google_review.php';
2
  /*
3
  Plugin Name: Schema & Structured Data for WP
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.8.1
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.8.1');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
23
  define( 'SASWP_ITEM_FOLDER_NAME', $folderName );
24
  }
25
  define('SASWP_PLUGIN_URL', plugin_dir_url( __FILE__ ));
26
+ define('SASWP_EDD_STORE_URL', 'http://structured-data-for-wp.com/');
 
 
 
 
27
  // including the output file
28
  require_once SASWP_DIR_NAME .'/output/function.php';
29
  require_once SASWP_DIR_NAME .'/output/output.php';
73
 
74
 
75
  global $sd_data;
76
+
77
  if(isset($sd_data['saswp-google-review']) && $sd_data['saswp-google-review'] == 1){
78
 
79
  require_once SASWP_DIR_NAME.'/google_review/google_review.php';
view/post_specific.php CHANGED
@@ -18,6 +18,8 @@ class saswp_post_specific {
18
 
19
  add_action( 'wp_ajax_saswp_modify_schema_post_enable', array($this,'saswp_modify_schema_post_enable'));
20
 
 
 
21
  add_action( 'wp_ajax_saswp_restore_schema', array($this,'saswp_restore_schema'));
22
 
23
  add_action( 'wp_ajax_saswp_enable_disable_schema_on_post', array($this,'saswp_enable_disable_schema_on_post'));
@@ -82,12 +84,15 @@ class saswp_post_specific {
82
  }
83
  }
84
 
85
- public function saswp_post_specifc_add_meta_boxes($post) {
86
 
 
 
87
  $post_specific_id = '';
88
  if(is_object($post)){
89
  $post_specific_id = $post->ID;
90
- }
 
91
  if(count($this->all_schema)>0 && get_post_status($post_specific_id)=='publish'){
92
 
93
  $show_post_types = get_post_types();
@@ -95,11 +100,12 @@ class saswp_post_specific {
95
  $this->screen = $show_post_types;
96
 
97
  foreach ( $this->screen as $single_screen ) {
98
- $post_title = '';
99
- if(count($this->all_schema) == 1){
100
- $all_schemas = $this->all_schema;
101
- $post_title = '('.$all_schemas[0]->post_title.')';
102
  }
 
103
  add_meta_box(
104
  'post_specific',
105
  esc_html__( 'Post Specific Schema - '.$post_title, 'schema-and-structured-data-for-wp' ),
@@ -168,7 +174,7 @@ class saswp_post_specific {
168
  }
169
 
170
  echo '<div>';
171
- echo '<div><a href="#" class="saswp-restore-post-schema button">'.esc_html__( 'Restore Default Schema', 'schema-and-structured-data-for-wp' ).'</a></div>';
172
  echo '<div class="saswp-tab saswp-post-specific-tab-wrapper">';
173
  echo '<ul class="saswp-tab-nav">';
174
  echo $tabs;
@@ -195,7 +201,7 @@ class saswp_post_specific {
195
  $this->meta_fields = $response;
196
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
197
  $tabs_fields .= '<div>';
198
- $tabs_fields .= '<div class="saswp-single-post-restore"><a href="#" class="saswp-restore-post-schema button saswp-tab-links selected" saswp-schema-type="'.esc_attr($schema_type).'">'.esc_html__( 'Restore Default Schema', 'schema-and-structured-data-for-wp' ).'</a>'
199
  . '<label class="saswp-switch" style="margin-left:10px;">'
200
  . '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($all_schema[0]->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$checked.'>'
201
  . '<span class="saswp-slider"></span>'
@@ -213,16 +219,24 @@ class saswp_post_specific {
213
 
214
  wp_nonce_field( 'post_specific_data', 'post_specific_nonce' );
215
  global $post;
216
- $option = get_option('modify_schema_post_enable_'.esc_attr($post->ID));
 
217
 
218
- if($option == 'enable'){
219
 
220
  $this->saswp_post_meta_box_fields($post);
221
 
222
- }else{
223
-
224
- echo '<a class="button saswp-modify_schema_post_enable">'.esc_html__( 'Modify Schema', 'schema-and-structured-data-for-wp' ).'</a>' ;
 
 
 
225
 
 
 
 
 
226
  }
227
 
228
  }
@@ -256,7 +270,8 @@ class saswp_post_specific {
256
 
257
  }
258
 
259
- update_option('modify_schema_post_enable_'.$post_id, 'disable');
 
260
 
261
  if($result){
262
 
@@ -269,6 +284,39 @@ class saswp_post_specific {
269
  }
270
  wp_die();
271
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
  public function saswp_modify_schema_post_enable(){
274
 
@@ -425,17 +473,29 @@ class saswp_post_specific {
425
  if(isset($media_value['width'])){
426
  $media_width =$media_value['width'];
427
  }
428
-
 
 
 
 
 
 
 
 
 
429
  $input = sprintf(
430
  '<fieldset><input style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
431
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
432
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="'.esc_attr($meta_field['id']).'_height" id="'.esc_attr($meta_field['id']).'_height" value="'.esc_attr($media_height).'">'
433
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="'.esc_attr($meta_field['id']).'_width" id="'.esc_attr($meta_field['id']).'_width" value="'.esc_attr($media_width).'">'
434
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="'.esc_attr($meta_field['id']).'_thumbnail" id="'.esc_attr($meta_field['id']).'_thumbnail" value="'.esc_attr($media_thumbnail).'">'
 
 
 
435
  .'</fieldset>',
436
  $meta_field['id'],
437
  $meta_field['id'],
438
- $meta_value,
439
  $meta_field['id'],
440
  $meta_field['id']
441
  );
@@ -629,7 +689,17 @@ class saswp_post_specific {
629
  if ( ! current_user_can( 'edit_post', $post_id ) )
630
  return $post_id;
631
 
632
- $option = get_option('modify_schema_post_enable_'.$post_id);
 
 
 
 
 
 
 
 
 
 
633
 
634
  if($option != 'enable'){
635
  return;
@@ -1031,6 +1101,18 @@ class saswp_post_specific {
1031
  'id' => 'local_postal_code_'.$schema_id,
1032
  'type' => 'text',
1033
  'default' => $business_details['local_postal_code']
 
 
 
 
 
 
 
 
 
 
 
 
1034
  ),
1035
  array(
1036
  'label' => 'Phone',
@@ -1625,6 +1707,47 @@ class saswp_post_specific {
1625
  );
1626
  break;
1627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1628
  case 'Recipe':
1629
  $meta_field = array(
1630
  array(
@@ -2323,6 +2446,18 @@ class saswp_post_specific {
2323
  'type' => 'text',
2324
  'default' => $image_details[0]
2325
  ),
 
 
 
 
 
 
 
 
 
 
 
 
2326
  array(
2327
  'label' => 'Main Entity Id',
2328
  'id' => 'saswp_video_object_main_entity_id_'.$schema_id,
18
 
19
  add_action( 'wp_ajax_saswp_modify_schema_post_enable', array($this,'saswp_modify_schema_post_enable'));
20
 
21
+ add_action( 'wp_ajax_saswp_custom_schema_post_enable', array($this,'saswp_custom_schema_post_enable'));
22
+
23
  add_action( 'wp_ajax_saswp_restore_schema', array($this,'saswp_restore_schema'));
24
 
25
  add_action( 'wp_ajax_saswp_enable_disable_schema_on_post', array($this,'saswp_enable_disable_schema_on_post'));
84
  }
85
  }
86
 
87
+ public function saswp_post_specifc_add_meta_boxes() {
88
 
89
+ global $post;
90
+
91
  $post_specific_id = '';
92
  if(is_object($post)){
93
  $post_specific_id = $post->ID;
94
+ }
95
+ $custom_option = get_option('custom_schema_post_enable_'.esc_attr($post->ID));
96
  if(count($this->all_schema)>0 && get_post_status($post_specific_id)=='publish'){
97
 
98
  $show_post_types = get_post_types();
100
  $this->screen = $show_post_types;
101
 
102
  foreach ( $this->screen as $single_screen ) {
103
+ $post_title = '';
104
+ if(count($this->all_schema) == 1 && $custom_option !='enable'){
105
+ $all_schemas = $this->all_schema;
106
+ $post_title = '('.get_post_meta($all_schemas[0]->ID, 'schema_type', true).')';
107
  }
108
+
109
  add_meta_box(
110
  'post_specific',
111
  esc_html__( 'Post Specific Schema - '.$post_title, 'schema-and-structured-data-for-wp' ),
174
  }
175
 
176
  echo '<div>';
177
+ echo '<div><a href="#" class="saswp-restore-post-schema button">'.esc_html__( 'Restore Default', 'schema-and-structured-data-for-wp' ).'</a></div>';
178
  echo '<div class="saswp-tab saswp-post-specific-tab-wrapper">';
179
  echo '<ul class="saswp-tab-nav">';
180
  echo $tabs;
201
  $this->meta_fields = $response;
202
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
203
  $tabs_fields .= '<div>';
204
+ $tabs_fields .= '<div class="saswp-single-post-restore"><a href="#" class="saswp-restore-post-schema button saswp-tab-links selected" saswp-schema-type="'.esc_attr($schema_type).'">'.esc_html__( 'Restore Default', 'schema-and-structured-data-for-wp' ).'</a>'
205
  . '<label class="saswp-switch" style="margin-left:10px;">'
206
  . '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($all_schema[0]->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$checked.'>'
207
  . '<span class="saswp-slider"></span>'
219
 
220
  wp_nonce_field( 'post_specific_data', 'post_specific_nonce' );
221
  global $post;
222
+ $modify_option = get_option('modify_schema_post_enable_'.esc_attr($post->ID));
223
+ $custom_option = get_option('custom_schema_post_enable_'.esc_attr($post->ID));
224
 
225
+ if($modify_option == 'enable'){
226
 
227
  $this->saswp_post_meta_box_fields($post);
228
 
229
+ }else if($custom_option == 'enable'){
230
+
231
+ echo '<a class="button saswp-restore-post-schema">Restore Default</a>';
232
+ echo '<textarea style="margin-left:5px;" placeholder="{ Json Markup }" id="saswp_custom_schema_field" name="saswp_custom_schema_field" rows="5" cols="100">'
233
+ . get_post_meta($post->ID, 'saswp_custom_schema_field', true)
234
+ . '</textarea>';
235
 
236
+ }else{
237
+
238
+ echo '<a class="button saswp-modify_schema_post_enable">'.esc_html__( 'Modify Current Schema', 'schema-and-structured-data-for-wp' ).'</a>' ;
239
+ echo '<a style="margin-left:5px;" class="button saswp_custom_schema_post_enable">'.esc_html__( 'Add Custom Schema', 'schema-and-structured-data-for-wp' ).'</a>' ;
240
  }
241
 
242
  }
270
 
271
  }
272
 
273
+ update_option('modify_schema_post_enable_'.$post_id, 'disable');
274
+ update_option('custom_schema_post_enable_'.$post_id, 'disable');
275
 
276
  if($result){
277
 
284
  }
285
  wp_die();
286
  }
287
+
288
+ public function saswp_custom_schema_post_enable(){
289
+
290
+ if ( ! isset( $_GET['saswp_security_nonce'] ) ){
291
+ return;
292
+ }
293
+ if ( !wp_verify_nonce( $_GET['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
294
+ return;
295
+ }
296
+
297
+ $post_id = sanitize_text_field($_GET['post_id']);
298
+ update_option('custom_schema_post_enable_'.$post_id, 'enable');
299
+
300
+ $args = array(
301
+ 'p' => $post_id, // ID of a page, post, or custom type
302
+ 'post_type' => 'any'
303
+ );
304
+
305
+ $my_posts = new WP_Query($args);
306
+
307
+ if ( $my_posts->have_posts() ) {
308
+
309
+ while ( $my_posts->have_posts() ) : $my_posts->the_post();
310
+
311
+ echo $this->saswp_post_meta_box_callback();
312
+
313
+ endwhile;
314
+
315
+ }
316
+
317
+ wp_die();
318
+
319
+ }
320
 
321
  public function saswp_modify_schema_post_enable(){
322
 
473
  if(isset($media_value['width'])){
474
  $media_width =$media_value['width'];
475
  }
476
+
477
+ $image_pre = '';
478
+ if($media_thumbnail){
479
+
480
+ $image_pre = '<div class="saswp_image_thumbnail">
481
+ <img class="saswp_image_prev" src="'.esc_attr($media_thumbnail).'" />
482
+ <a data-id="'.esc_attr($meta_field['id']).'" href="#" class="saswp_prev_close">X</a>
483
+ </div>';
484
+
485
+ }
486
  $input = sprintf(
487
  '<fieldset><input style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
488
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
489
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="'.esc_attr($meta_field['id']).'_height" id="'.esc_attr($meta_field['id']).'_height" value="'.esc_attr($media_height).'">'
490
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="'.esc_attr($meta_field['id']).'_width" id="'.esc_attr($meta_field['id']).'_width" value="'.esc_attr($media_width).'">'
491
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="'.esc_attr($meta_field['id']).'_thumbnail" id="'.esc_attr($meta_field['id']).'_thumbnail" value="'.esc_attr($media_thumbnail).'">'
492
+ . '<div class="saswp_image_div_'.esc_attr($meta_field['id']).'">'
493
+ . $image_pre
494
+ . '</div>'
495
  .'</fieldset>',
496
  $meta_field['id'],
497
  $meta_field['id'],
498
+ $media_thumbnail,
499
  $meta_field['id'],
500
  $meta_field['id']
501
  );
689
  if ( ! current_user_can( 'edit_post', $post_id ) )
690
  return $post_id;
691
 
692
+ $option = get_option('modify_schema_post_enable_'.$post_id);
693
+ $custom_option = get_option('custom_schema_post_enable_'.$post_id);
694
+
695
+ if($custom_option == 'enable'){
696
+
697
+ if(isset($_POST['saswp_custom_schema_field'])){
698
+ $custom_schema = sanitize_textarea_field($_POST['saswp_custom_schema_field']);
699
+ update_post_meta( $post_id, 'saswp_custom_schema_field', $custom_schema );
700
+ }
701
+
702
+ }
703
 
704
  if($option != 'enable'){
705
  return;
1101
  'id' => 'local_postal_code_'.$schema_id,
1102
  'type' => 'text',
1103
  'default' => $business_details['local_postal_code']
1104
+ ),
1105
+ array(
1106
+ 'label' => 'Latitude',
1107
+ 'id' => 'local_latitude_'.$schema_id,
1108
+ 'type' => 'text',
1109
+ 'default' => $business_details['local_latitude']
1110
+ ),
1111
+ array(
1112
+ 'label' => 'Longitude',
1113
+ 'id' => 'local_longitude_'.$schema_id,
1114
+ 'type' => 'text',
1115
+ 'default' => $business_details['local_longitude']
1116
  ),
1117
  array(
1118
  'label' => 'Phone',
1707
  );
1708
  break;
1709
 
1710
+ case 'DiscussionForumPosting':
1711
+ $meta_field = array(
1712
+ array(
1713
+ 'label' => 'Headline',
1714
+ 'id' => 'saswp_dfp_headline_'.$schema_id,
1715
+ 'type' => 'text',
1716
+ 'default' => get_the_title()
1717
+ ),
1718
+ array(
1719
+ 'label' => 'Description',
1720
+ 'id' => 'saswp_dfp_description_'.$schema_id,
1721
+ 'type' => 'textarea',
1722
+ 'default' => $post->post_excerpt
1723
+ ) ,
1724
+ array(
1725
+ 'label' => 'URL',
1726
+ 'id' => 'saswp_dfp_url_'.$schema_id,
1727
+ 'type' => 'text',
1728
+ 'default' => get_permalink()
1729
+ ),
1730
+ array(
1731
+ 'label' => 'Date Published',
1732
+ 'id' => 'saswp_dfp_date_published_'.$schema_id,
1733
+ 'type' => 'text',
1734
+ 'default' => get_the_date("Y-m-d")
1735
+ ),
1736
+ array(
1737
+ 'label' => 'Date Modified',
1738
+ 'id' => 'saswp_dfp_date_modified_'.$schema_id,
1739
+ 'type' => 'text',
1740
+ 'default' => get_the_modified_date("Y-m-d")
1741
+ ),
1742
+ array(
1743
+ 'label' => 'Author Name',
1744
+ 'id' => 'saswp_dfp_author_name_'.$schema_id,
1745
+ 'type' => 'text',
1746
+ 'default' => $current_user->display_name
1747
+ )
1748
+ );
1749
+ break;
1750
+
1751
  case 'Recipe':
1752
  $meta_field = array(
1753
  array(
2446
  'type' => 'text',
2447
  'default' => $image_details[0]
2448
  ),
2449
+ array(
2450
+ 'label' => 'Content Url',
2451
+ 'id' => 'saswp_video_object_content_url_'.$schema_id,
2452
+ 'type' => 'text',
2453
+ 'default' => get_permalink()
2454
+ ),
2455
+ array(
2456
+ 'label' => 'Embed Url',
2457
+ 'id' => 'saswp_video_object_embed_url_'.$schema_id,
2458
+ 'type' => 'text',
2459
+ 'default' => get_permalink()
2460
+ ),
2461
  array(
2462
  'label' => 'Main Entity Id',
2463
  'id' => 'saswp_video_object_main_entity_id_'.$schema_id,
view/schema_type.php CHANGED
@@ -661,22 +661,23 @@
661
  );
662
 
663
  $all_schema_array = array(
664
- 'Article' => 'Article',
665
- 'AudioObject' => 'AudioObject',
666
- 'Blogposting' => 'Blogposting',
667
- 'Course' => 'Course',
668
- 'Event' => 'Event',
669
- 'local_business' => 'Local Business',
670
- 'NewsArticle' => 'NewsArticle',
671
- 'Product' => 'Product',
672
- 'qanda' => 'Q&A',
673
- 'Review' => 'Review',
674
- 'Recipe' => 'Recipe',
675
- 'Service' => 'Service',
676
- 'SoftwareApplication' => 'SoftwareApplication',
677
- 'TechArticle' => 'TechArticle',
678
- 'VideoObject' => 'VideoObject',
679
- 'WebPage' => 'WebPage'
 
680
  );
681
  $all_business_type = array(
682
  'animalshelter' => 'Animal Shelter',
@@ -1090,6 +1091,19 @@
1090
  <td><?php echo esc_html__('Postal Code', 'schema-and-structured-data-for-wp' ); ?></td>
1091
  <td><input value="<?php if(isset($business_details['local_postal_code'])) {echo esc_attr($business_details['local_postal_code']); } ?>" type="text" name="local_postal_code" placeholder="<?php echo esc_html__('Postal Code', 'schema-and-structured-data-for-wp' ); ?>"></td>
1092
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
1093
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1094
  <td><?php echo esc_html__('Phone', 'schema-and-structured-data-for-wp' ); ?></td>
1095
  <td><input value="<?php if(isset($business_details['local_phone'])){echo esc_attr($business_details['local_phone']); } ?>" type="text" name="local_phone" placeholder="<?php echo esc_html__('Phone', 'schema-and-structured-data-for-wp' ); ?>"></td>
@@ -1631,6 +1645,14 @@
1631
  if ( isset( $_POST['local_postal_code'] ) ){
1632
  $local_business_details['local_postal_code'] = sanitize_text_field($_POST['local_postal_code']);
1633
  }
 
 
 
 
 
 
 
 
1634
  if ( isset( $_POST['local_phone'] ) ){
1635
  $local_business_details['local_phone'] = sanitize_text_field($_POST['local_phone']);
1636
  }
661
  );
662
 
663
  $all_schema_array = array(
664
+ 'Article' => 'Article',
665
+ 'AudioObject' => 'AudioObject',
666
+ 'Blogposting' => 'Blogposting',
667
+ 'Course' => 'Course',
668
+ 'DiscussionForumPosting' => 'DiscussionForumPosting',
669
+ 'Event' => 'Event',
670
+ 'local_business' => 'Local Business',
671
+ 'NewsArticle' => 'NewsArticle',
672
+ 'Product' => 'Product',
673
+ 'qanda' => 'Q&A',
674
+ 'Review' => 'Review',
675
+ 'Recipe' => 'Recipe',
676
+ 'Service' => 'Service',
677
+ 'SoftwareApplication' => 'SoftwareApplication',
678
+ 'TechArticle' => 'TechArticle',
679
+ 'VideoObject' => 'VideoObject',
680
+ 'WebPage' => 'WebPage'
681
  );
682
  $all_business_type = array(
683
  'animalshelter' => 'Animal Shelter',
1091
  <td><?php echo esc_html__('Postal Code', 'schema-and-structured-data-for-wp' ); ?></td>
1092
  <td><input value="<?php if(isset($business_details['local_postal_code'])) {echo esc_attr($business_details['local_postal_code']); } ?>" type="text" name="local_postal_code" placeholder="<?php echo esc_html__('Postal Code', 'schema-and-structured-data-for-wp' ); ?>"></td>
1093
  </tr>
1094
+
1095
+
1096
+ <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1097
+ <td><?php echo esc_html__('Latitude', 'schema-and-structured-data-for-wp' ); ?></td>
1098
+ <td><input value="<?php if(isset($business_details['local_latitude'])) {echo esc_attr($business_details['local_latitude']); } ?>" type="text" name="local_latitude" placeholder="<?php echo esc_html__('40.761293', 'schema-and-structured-data-for-wp' ); ?>"></td>
1099
+ </tr>
1100
+
1101
+ <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1102
+ <td><?php echo esc_html__('Longitude', 'schema-and-structured-data-for-wp' ); ?></td>
1103
+ <td><input value="<?php if(isset($business_details['local_longitude'])) {echo esc_attr($business_details['local_longitude']); } ?>" type="text" name="local_longitude" placeholder="<?php echo esc_html__('-73.982294', 'schema-and-structured-data-for-wp' ); ?>"></td>
1104
+ </tr>
1105
+
1106
+
1107
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1108
  <td><?php echo esc_html__('Phone', 'schema-and-structured-data-for-wp' ); ?></td>
1109
  <td><input value="<?php if(isset($business_details['local_phone'])){echo esc_attr($business_details['local_phone']); } ?>" type="text" name="local_phone" placeholder="<?php echo esc_html__('Phone', 'schema-and-structured-data-for-wp' ); ?>"></td>
1645
  if ( isset( $_POST['local_postal_code'] ) ){
1646
  $local_business_details['local_postal_code'] = sanitize_text_field($_POST['local_postal_code']);
1647
  }
1648
+
1649
+ if ( isset( $_POST['local_latitude'] ) ){
1650
+ $local_business_details['local_latitude'] = sanitize_text_field($_POST['local_latitude']);
1651
+ }
1652
+ if ( isset( $_POST['local_longitude'] ) ){
1653
+ $local_business_details['local_longitude'] = sanitize_text_field($_POST['local_longitude']);
1654
+ }
1655
+
1656
  if ( isset( $_POST['local_phone'] ) ){
1657
  $local_business_details['local_phone'] = sanitize_text_field($_POST['local_phone']);
1658
  }