Schema & Structured Data for WP & AMP - Version 1.8.4

Version Description

(22 May 2019) =

  • Added: Accomodation Schema type ( House, Apartment and SingleFamilyResidence )#41
  • Added: Speakable Schema type #79
  • Added: HowTo Schema type #268
  • Added: TvSeries Schema type #108
  • Added: VideoGame Schema type #77
  • Added: MedicalCondition Schema type #58
  • Added: TouristAttraction Schema type #167
  • Added: TouristDestination Schema type #167
  • Added: PlaceOfWorship Schema type ( HinduTemple, Church and Mosque ) #167
  • Bug Fixed: [BUG REPORT] Sorry, you are not allowed to access this page ( Multisite Issue ) #286
  • Bug Fixed: Warning: count() ( Parameter must be an array or an object that implements Countable ) #273
  • Bug Fixed: About and Contact page dropdown not appearing on setup wizard ( Multisite Issue ) #282
  • Bug Fixed: PHP Error: Undefined offset #285
  • Bug Fixed: Basic issues ( Image icon should come from plugin own directory and If the logo is not there, then it should show logo mission error ) #283
  • Improvement: Product select should not have the fields on installer #266
  • Improvement: HasMap field should be there in local schema #276
Download this release

Release Info

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

Code changes from version 1.8.3 to 1.8.4

admin_section/common-function.php CHANGED
@@ -1199,7 +1199,7 @@ function saswp_admin_link($tab = '', $args = array()){
1199
  $link = admin_url( 'admin.php?page=' . $page );
1200
  }
1201
  else {
1202
- $link = network_admin_url( 'admin.php?page=' . $page );
1203
  }
1204
 
1205
  if ( $tab ) {
@@ -1639,8 +1639,8 @@ function saswp_frontend_enqueue(){
1639
  }
1640
  return $aurthor_name;
1641
  }
1642
-
1643
- function saswp_get_attachment_details_by_url($url, $post_id = '',$count='') {
1644
 
1645
  $response = array();
1646
 
1199
  $link = admin_url( 'admin.php?page=' . $page );
1200
  }
1201
  else {
1202
+ $link = admin_url( 'admin.php?page=' . $page );
1203
  }
1204
 
1205
  if ( $tab ) {
1639
  }
1640
  return $aurthor_name;
1641
  }
1642
+
1643
+ function saswp_get_attachment_details_by_url($url, $post_id = '',$count='') {
1644
 
1645
  $response = array();
1646
 
admin_section/css/main-style.css CHANGED
@@ -349,7 +349,8 @@ clear: both;
349
  display: inline-block;
350
  width: 25%;
351
  vertical-align: top;
352
-
 
353
  }
354
  .saswp-post-specific-container{
355
  display: inline-block;
@@ -366,12 +367,15 @@ clear: both;
366
  display: block;
367
  background-color: inherit;
368
  color: black;
369
- padding: 10px 16px;
370
  outline: none;
371
  text-align: left;
372
  cursor: pointer;
373
  transition: 0.3s;
374
- font-size: 17px;
 
 
 
375
  }
376
  .saswp-star-rating{
377
  cursor: pointer;
@@ -471,10 +475,11 @@ Compatibility tab css ends
471
  On/Off Buttons starts here
472
  */
473
  .saswp-switch {
474
- position: relative;
475
- display: inline-block;
476
- width: 60px;
477
- height: 36px;
 
478
  }
479
 
480
  .saswp-switch input {
@@ -490,25 +495,26 @@ On/Off Buttons starts here
490
  left: 0;
491
  right: 0;
492
  bottom: 0;
493
- background-color: #ccc;
494
- -webkit-transition: .4s;
495
  transition: .4s;
 
496
  }
497
 
498
  .saswp-slider:before {
499
- position: absolute;
500
- content: "";
501
- height: 26px;
502
- width: 26px;
503
- left: 4px;
504
- bottom: 4px;
505
- background-color: white;
506
- -webkit-transition: .4s;
507
- transition: .4s;
508
  }
509
 
510
  input:checked + .saswp-slider {
511
  background-color: #61bd3b;
 
512
  }
513
 
514
  input:focus + .saswp-slider {
@@ -516,9 +522,8 @@ input:focus + .saswp-slider {
516
  }
517
 
518
  input:checked + .saswp-slider:before {
519
- -webkit-transform: translateX(26px);
520
- -ms-transform: translateX(26px);
521
- transform: translateX(26px);
522
  }
523
 
524
  /* Rounded sliders */
@@ -533,16 +538,14 @@ input:checked + .saswp-slider:before {
533
  .saswp-tab-nav li{
534
  display: flex;
535
  align-items: center;
 
 
 
536
  }
 
537
  .saswp-tab-nav .selected{
538
  background-color: #ccc;
539
  }
540
- .saswp-tab-links{
541
- display: flex;
542
- flex-grow: 1;
543
- background: transparent;
544
- width: 113px;
545
- }
546
  .saswp-single-post-restore .saswp-switch{
547
  height: 28px;
548
  }
@@ -962,4 +965,29 @@ Google review module ends here
962
  font-size: 20px;
963
  top: -5px;
964
  text-decoration:none;
965
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  display: inline-block;
350
  width: 25%;
351
  vertical-align: top;
352
+ box-sizing: border-box;
353
+ padding-right:10px;
354
  }
355
  .saswp-post-specific-container{
356
  display: inline-block;
367
  display: block;
368
  background-color: inherit;
369
  color: black;
370
+ padding: 6px 10px;
371
  outline: none;
372
  text-align: left;
373
  cursor: pointer;
374
  transition: 0.3s;
375
+ font-size: 15px;
376
+ width: 130px;
377
+ overflow: hidden;
378
+ margin-right: 10px;
379
  }
380
  .saswp-star-rating{
381
  cursor: pointer;
475
  On/Off Buttons starts here
476
  */
477
  .saswp-switch {
478
+ position: relative;
479
+ display: inline-block;
480
+ width: 40px;
481
+ height: 22px;
482
+ border: 20px;
483
  }
484
 
485
  .saswp-switch input {
495
  left: 0;
496
  right: 0;
497
  bottom: 0;
498
+ background-color: #5a6783;
 
499
  transition: .4s;
500
+ border-radius: 20px;
501
  }
502
 
503
  .saswp-slider:before {
504
+ position: absolute;
505
+ content: "";
506
+ height: 15px;
507
+ width: 15px;
508
+ left: 4px;
509
+ bottom: 4px;
510
+ background-color: white;
511
+ transition: .4s;
512
+ border-radius: 20px;
513
  }
514
 
515
  input:checked + .saswp-slider {
516
  background-color: #61bd3b;
517
+ border-radius: 30px;
518
  }
519
 
520
  input:focus + .saswp-slider {
522
  }
523
 
524
  input:checked + .saswp-slider:before {
525
+
526
+ transform: translateX(15px);
 
527
  }
528
 
529
  /* Rounded sliders */
538
  .saswp-tab-nav li{
539
  display: flex;
540
  align-items: center;
541
+ justify-content: space-between;
542
+ margin-bottom:10px;
543
+ border-bottom: 1px solid #eee;
544
  }
545
+
546
  .saswp-tab-nav .selected{
547
  background-color: #ccc;
548
  }
 
 
 
 
 
 
549
  .saswp-single-post-restore .saswp-switch{
550
  height: 28px;
551
  }
965
  font-size: 20px;
966
  top: -5px;
967
  text-decoration:none;
968
+ }
969
+ /*** How to schema css starts here ***/
970
+
971
+ .saswp-how-to-supply-table-div,
972
+ .saswp-how-to-tool-table-div,
973
+ .saswp-how-to-step-table-div,
974
+ .saswp-tvseries-actor-table-div,
975
+ .saswp-tvseries-season-table-div,
976
+ .saswp-mc-symptom-table-div,
977
+ .saswp-mc-risk_factor-table-div,
978
+ .saswp-mc-cause-table-div
979
+ {
980
+ border: 1px solid #aaa;
981
+ margin-top: 5px;
982
+ margin-bottom: 5px;
983
+
984
+ }
985
+ .saswp-table-close{
986
+ float: right;
987
+ cursor: pointer;
988
+ }
989
+ .saswp-table-create-onajax table th, .saswp-table-create-onajax table td{
990
+ padding: 5px;
991
+ }
992
+
993
+ /*** How to schema css ends here ***/
admin_section/images/cooked-schema-wp.png ADDED
Binary file
admin_section/images/news.png ADDED
Binary file
admin_section/images/schema-setup-icon.png ADDED
Binary file
admin_section/images/woocommerce-icon.png ADDED
Binary file
admin_section/js/main-script.js CHANGED
@@ -33,7 +33,14 @@ jQuery(document).ready(function($){
33
  $(this).hide();
34
  $(this).find('select').attr('disabled', true);
35
  }
36
- });
 
 
 
 
 
 
 
37
  if(schematype == 'local_business'){
38
  $(".saswp-option-table-class tr").eq(1).show();
39
  $(".saswp-business-text-field-tr").show();
@@ -90,6 +97,14 @@ jQuery(document).ready(function($){
90
  $(this).find('select').attr('disabled', true);
91
  }
92
  });
 
 
 
 
 
 
 
 
93
  if(schematype == 'local_business'){
94
  $(".saswp-"+businesstype+'-tr').show();
95
  $(".saswp-business-text-field-tr").show();
@@ -1070,6 +1085,307 @@ jQuery(document).ready(function($){
1070
  $(document).on("click", '.saswp-skip-button', function(){
1071
  $(this).parent().parent().hide();
1072
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1073
 
1074
  $(document).on("click", '.saswp-add-custom-fields', function(){
1075
  var schema_type = $('select#schema_type option:selected').val();
33
  $(this).hide();
34
  $(this).find('select').attr('disabled', true);
35
  }
36
+ });
37
+ if(schematype == 'TechArticle' || schematype == 'Article' || schematype == 'Blogposting' || schematype == 'NewsArticle' || schematype == 'WebPage'){
38
+
39
+ $(".saswp-enable-speakable").parent().parent().show();
40
+ }else{
41
+ $(".saswp-enable-speakable").parent().parent().hide();
42
+ }
43
+
44
  if(schematype == 'local_business'){
45
  $(".saswp-option-table-class tr").eq(1).show();
46
  $(".saswp-business-text-field-tr").show();
97
  $(this).find('select').attr('disabled', true);
98
  }
99
  });
100
+
101
+ if(schematype == 'TechArticle' || schematype == 'Article' || schematype == 'Blogposting' || schematype == 'NewsArticle' || schematype == 'WebPage'){
102
+
103
+ $(".saswp-enable-speakable").parent().parent().show();
104
+ }else{
105
+ $(".saswp-enable-speakable").parent().parent().hide();
106
+ }
107
+
108
  if(schematype == 'local_business'){
109
  $(".saswp-"+businesstype+'-tr').show();
110
  $(".saswp-business-text-field-tr").show();
1085
  $(document).on("click", '.saswp-skip-button', function(){
1086
  $(this).parent().parent().hide();
1087
  });
1088
+
1089
+
1090
+ //TvSeries schema starts here
1091
+
1092
+ $(document).on("click", ".saswp-tvseries-actor", function(e){
1093
+ e.preventDefault();
1094
+
1095
+ var schema_id = $(this).attr('data-id');
1096
+ var count = $(".saswp-tvseries-actor-table-div").length;
1097
+ var index = $( ".saswp-tvseries-actor-table-div:nth-child("+count+")" ).attr('data-id');
1098
+ index = ++index;
1099
+
1100
+ if(!index){
1101
+ index = 0;
1102
+ }
1103
+
1104
+ var html = '';
1105
+
1106
+ html += '<div class="saswp-tvseries-actor-table-div" data-id="'+index+'">'
1107
+ + '<a class="saswp-table-close">X</a>'
1108
+ + '<table class="form-table saswp-tvseries-actor-table">'
1109
+ + '<tr>'
1110
+ + '<th>Actor Name</th><td><input style="width:100%" type="text" id="saswp_tvseries_actor_name_'+index+'_'+schema_id+'" name="tvseries_actor_'+schema_id+'['+index+'][saswp_tvseries_actor_name]"></td>'
1111
+ + '</tr>'
1112
+ + '</table>'
1113
+ + '</div>';
1114
+ if(html){
1115
+ $('.saswp-tvseries-actor-section[data-id="'+schema_id+'"]').append(html);
1116
+ }
1117
+
1118
+
1119
+ });
1120
+
1121
+ $(document).on("click", ".saswp-tvseries-season", function(e){
1122
+ e.preventDefault();
1123
+
1124
+ var schema_id = $(this).attr('data-id');
1125
+ var count = $(".saswp-tvseries-season-table-div").length;
1126
+ var index = $( ".saswp-tvseries-season-table-div:nth-child("+count+")" ).attr('data-id');
1127
+ index = ++index;
1128
+
1129
+ if(!index){
1130
+ index = 0;
1131
+ }
1132
+
1133
+ var html = '';
1134
+
1135
+ html += '<div class="saswp-tvseries-season-table-div" data-id="'+index+'">'
1136
+ + '<a class="saswp-table-close">X</a>'
1137
+ + '<table class="form-table saswp-tvseries-season-table">'
1138
+ + '<tr>'
1139
+ + '<th>Season</th><td><input style="width:100%" type="text" id="saswp_tvseries_season_name_'+index+'_'+schema_id+'" name="tvseries_season_'+schema_id+'['+index+'][saswp_tvseries_season_name]"></td>'
1140
+ + '</tr>'
1141
+ + '<tr>'
1142
+ + '<th>Season Published Date</th><td><input class="saswp-local-schema-datepicker-picker" style="width:100%" type="text" id="saswp_tvseries_season_published_date_'+index+'_'+schema_id+'" name="tvseries_season_'+schema_id+'['+index+'][saswp_tvseries_season_published_date]"></td>'
1143
+ + '</tr>'
1144
+ + '<tr>'
1145
+ + '<th>Number Of Episodes</th><td><input style="width:100%" type="text" id="saswp_tvseries_season_episodes_'+index+'_'+schema_id+'" name="tvseries_season_'+schema_id+'['+index+'][saswp_tvseries_season_episodes]"></td>'
1146
+ + '</tr>'
1147
+ + '</table>'
1148
+ + '</div>';
1149
+ if(html){
1150
+
1151
+ $('.saswp-tvseries-season-section[data-id="'+schema_id+'"]').append(html);
1152
+ saswp_schema_datepicker();
1153
+
1154
+ }
1155
+
1156
+
1157
+ });
1158
+
1159
+ //TvSeries schema ends here
1160
+
1161
+ //Medical condition schema starts here
1162
+
1163
+ $(document).on("click", ".saswp-mc-cause", function(e){
1164
+ e.preventDefault();
1165
+
1166
+ var schema_id = $(this).attr('data-id');
1167
+ var count = $(".saswp-mc-cause-table-div").length;
1168
+ var index = $( ".saswp-mc-cause-table-div:nth-child("+count+")" ).attr('data-id');
1169
+ index = ++index;
1170
+
1171
+ if(!index){
1172
+ index = 0;
1173
+ }
1174
+
1175
+ var html = '';
1176
+
1177
+ html += '<div class="saswp-mc-cause-table-div" data-id="'+index+'">'
1178
+ + '<a class="saswp-table-close">X</a>'
1179
+ + '<table class="form-table saswp-mc-cause-table">'
1180
+ + '<tr>'
1181
+ + '<th>Cause</th><td><input style="width:100%" type="text" id="saswp_mc_cause_name_'+index+'_'+schema_id+'" name="mc_cause_'+schema_id+'['+index+'][saswp_mc_cause_name]"></td>'
1182
+ + '</tr>'
1183
+ + '</table>'
1184
+ + '</div>';
1185
+ if(html){
1186
+ $('.saswp-mc-cause-section[data-id="'+schema_id+'"]').append(html);
1187
+ }
1188
+
1189
+
1190
+ });
1191
+
1192
+ $(document).on("click", ".saswp-mc-symptom", function(e){
1193
+ e.preventDefault();
1194
+
1195
+ var schema_id = $(this).attr('data-id');
1196
+ var count = $(".saswp-mc-symptom-table-div").length;
1197
+ var index = $( ".saswp-mc-symptom-table-div:nth-child("+count+")" ).attr('data-id');
1198
+ index = ++index;
1199
+
1200
+ if(!index){
1201
+ index = 0;
1202
+ }
1203
+
1204
+ var html = '';
1205
+
1206
+ html += '<div class="saswp-mc-symptom-table-div" data-id="'+index+'">'
1207
+ + '<a class="saswp-table-close">X</a>'
1208
+ + '<table class="form-table saswp-mc-symptom-table">'
1209
+ + '<tr>'
1210
+ + '<th>Symptom Name</th><td><input style="width:100%" type="text" id="saswp_mc_symptom_name_'+index+'_'+schema_id+'" name="mc_symptom_'+schema_id+'['+index+'][saswp_mc_symptom_name]"></td>'
1211
+ + '</tr>'
1212
+ + '</table>'
1213
+ + '</div>';
1214
+ if(html){
1215
+ $('.saswp-mc-symptom-section[data-id="'+schema_id+'"]').append(html);
1216
+ }
1217
+
1218
+
1219
+ });
1220
+
1221
+ $(document).on("click", ".saswp-mc-risk_factor", function(e){
1222
+ e.preventDefault();
1223
+
1224
+ var schema_id = $(this).attr('data-id');
1225
+ var count = $(".saswp-mc-risk_factor-table-div").length;
1226
+ var index = $( ".saswp-mc-risk_factor-table-div:nth-child("+count+")" ).attr('data-id');
1227
+ index = ++index;
1228
+
1229
+ if(!index){
1230
+ index = 0;
1231
+ }
1232
+
1233
+ var html = '';
1234
+
1235
+ html += '<div class="saswp-mc-risk_factor-table-div" data-id="'+index+'">'
1236
+ + '<a class="saswp-table-close">X</a>'
1237
+ + '<table class="form-table saswp-mc-risk_factor-table">'
1238
+ + '<tr>'
1239
+ + '<th>Risk Factor Name</th><td><input style="width:100%" type="text" id="saswp_mc_risk_factor_name_'+index+'_'+schema_id+'" name="mc_risk_factor_'+schema_id+'['+index+'][saswp_mc_risk_factor_name]"></td>'
1240
+ + '</tr>'
1241
+ + '</table>'
1242
+ + '</div>';
1243
+ if(html){
1244
+ $('.saswp-mc-risk_factor-section[data-id="'+schema_id+'"]').append(html);
1245
+ }
1246
+
1247
+
1248
+ });
1249
+
1250
+ //Medical condition schema ends here
1251
+
1252
+ //How to schema js starts here
1253
+
1254
+ $(document).on("click", ".saswp-how-to-supply", function(e){
1255
+ e.preventDefault();
1256
+
1257
+ var schema_id = $(this).attr('data-id');
1258
+ var count = $(".saswp-how-to-supply-table-div").length;
1259
+ var index = $( ".saswp-how-to-supply-table-div:nth-child("+count+")" ).attr('data-id');
1260
+ index = ++index;
1261
+
1262
+ if(!index){
1263
+ index = 0;
1264
+ }
1265
+
1266
+ var html = '';
1267
+
1268
+ html += '<div class="saswp-how-to-supply-table-div" data-id="'+index+'">'
1269
+ + '<a class="saswp-table-close">X</a>'
1270
+ + '<table class="form-table saswp-how-to-supply-table">'
1271
+ + '<tr>'
1272
+ + '<th>Supply Name</th><td><input style="width:100%" type="text" id="saswp_howto_supply_name_'+index+'_'+schema_id+'" name="howto_supply_'+schema_id+'['+index+'][saswp_howto_supply_name]"></td>'
1273
+ + '</tr>'
1274
+ + '<tr>'
1275
+ + '<th>Supply Image</th>'
1276
+ + '<td>'
1277
+ + '<fieldset>'
1278
+ + '<input style="width:80%" type="text" id="saswp_howto_supply_image_'+index+'_'+schema_id+'" name="saswp_howto_supply_image_'+index+'_'+schema_id+'">'
1279
+ + '<input type="hidden" data-id="saswp_howto_supply_image_'+index+'_'+schema_id+'_id" name="howto_supply_'+schema_id+'['+index+'][saswp_howto_supply_image_id]" id="saswp_howto_supply_image_'+index+'_'+schema_id+'_id">'
1280
+ + '<input data-id="media" style="width: 19%" class="button" id="saswp_howto_supply_image_'+index+'_'+schema_id+'_button" name="saswp_howto_supply_image_'+index+'_'+schema_id+'_button" type="button" value="Upload">'
1281
+ + '<div class="saswp_image_div_saswp_howto_supply_image_'+index+'_'+schema_id+'">'
1282
+ + '</div>'
1283
+ + '</fieldset>'
1284
+ + '</td>'
1285
+ + '</tr>'
1286
+ + '</table>'
1287
+ + '</div>';
1288
+ if(html){
1289
+ $('.saswp-how-to-supply-section[data-id="'+schema_id+'"]').append(html);
1290
+ }
1291
+
1292
+
1293
+ });
1294
+
1295
+ $(document).on("click", ".saswp-how-to-tool", function(e){
1296
+ e.preventDefault();
1297
+
1298
+ var schema_id = $(this).attr('data-id');
1299
+ var count = $(".saswp-how-to-tool-table-div").length;
1300
+ var index = $( ".saswp-how-to-tool-table-div:nth-child("+count+")" ).attr('data-id');
1301
+ index = ++index;
1302
+
1303
+ if(!index){
1304
+ index = 0;
1305
+ }
1306
+
1307
+ var html = '';
1308
+
1309
+ html += '<div class="saswp-how-to-tool-table-div" data-id="'+index+'">'
1310
+ + '<a class="saswp-table-close">X</a>'
1311
+ + '<table class="form-table saswp-how-to-tool-table">'
1312
+ + '<tr>'
1313
+ + '<th>Tool Name</th><td><input style="width:100%" type="text" id="saswp_howto_tool_name_'+index+'_'+schema_id+'" name="howto_tool_'+schema_id+'['+index+'][saswp_howto_tool_name]"></td>'
1314
+ + '</tr>'
1315
+ + '<tr>'
1316
+ + '<th>Tool Image</th>'
1317
+ + '<td>'
1318
+ + '<fieldset>'
1319
+ + '<input style="width:80%" type="text" id="saswp_howto_tool_image_'+index+'_'+schema_id+'" name="saswp_howto_tool_image_'+index+'_'+schema_id+'">'
1320
+ + '<input type="hidden" data-id="saswp_howto_tool_image_'+index+'_'+schema_id+'_id" name="howto_tool_'+schema_id+'['+index+'][saswp_howto_tool_image_id]" id="saswp_howto_tool_image_'+index+'_'+schema_id+'_id">'
1321
+ + '<input data-id="media" style="width: 19%" class="button" id="saswp_howto_tool_image_'+index+'_'+schema_id+'_button" name="saswp_howto_tool_image_'+index+'_'+schema_id+'_button" type="button" value="Upload">'
1322
+ + '<div class="saswp_image_div_saswp_howto_tool_image_'+index+'_'+schema_id+'">'
1323
+ + '</div>'
1324
+ + '</fieldset>'
1325
+ + '</td>'
1326
+ + '</tr>'
1327
+ + '</table>'
1328
+ + '</div>';
1329
+ if(html){
1330
+ $('.saswp-how-to-tool-section[data-id="'+schema_id+'"]').append(html);
1331
+ }
1332
+
1333
+
1334
+ });
1335
+
1336
+ $(document).on("click", ".saswp-how-to-step", function(e){
1337
+ e.preventDefault();
1338
+
1339
+ var schema_id = $(this).attr('data-id');
1340
+ var count = $(".saswp-how-to-step-table-div").length;
1341
+ var index = $( ".saswp-how-to-step-table-div:nth-child("+count+")" ).attr('data-id');
1342
+ index = ++index;
1343
+
1344
+ if(!index){
1345
+ index = 0;
1346
+ }
1347
+
1348
+ var html = '';
1349
+
1350
+ html+='<div class="saswp-how-to-step-table-div" data-id="'+index+'">'
1351
+ + '<a class="saswp-table-close">X</a>'
1352
+ + '<table class="form-table saswp-how-to-step-table">'
1353
+ + '<tr>'
1354
+ + '<th>Step Name</th><td><input style="width:100%" type="text" id="saswp_howto_step_name_'+index+'_'+schema_id+'" name="howto_step_'+schema_id+'['+index+'][saswp_howto_step_name]" ></td>'
1355
+ + '</tr>'
1356
+ + '<tr>'
1357
+ + '<th>HowToDirection Text</th><td><input style="width:100%" type="text" id="saswp_howto_direction_text_'+index+'_'+schema_id+'" name="howto_step_'+schema_id+'['+index+'][saswp_howto_direction_text]"></td>'
1358
+ + '</tr>'
1359
+ + '<tr>'
1360
+ + '<th>HowToTip Text</th><td><input style="width:100%" type="text" id="saswp_howto_tip_text_'+index+'_'+schema_id+'" name="howto_step_'+schema_id+'['+index+'][saswp_howto_tip_text]"></td>'
1361
+ + '</tr>'
1362
+ + '<tr>'
1363
+ + '<th>Step Image</th>'
1364
+ + '<td>'
1365
+ + '<fieldset>'
1366
+ + '<input style="width:80%" type="text" id="saswp_howto_step_image_'+index+'_'+schema_id+'" name="saswp_howto_step_image_'+schema_id+'['+index+']">'
1367
+ + '<input type="hidden" data-id="saswp_howto_step_image_'+index+'_'+schema_id+'_id" name="howto_step_'+schema_id+'['+index+'][saswp_howto_step_image_id]" id="saswp_howto_step_image_'+index+'_'+schema_id+'_id">'
1368
+ + '<input data-id="media" style="width: 19%" class="button" id="saswp_howto_step_image_'+index+'_'+schema_id+'_button" name="saswp_howto_step_image_'+index+'_'+schema_id+'_button" type="button" value="Upload">'
1369
+ + '<div class="saswp_image_div_saswp_howto_step_image_'+index+'_'+schema_id+'">'
1370
+ + '</div>'
1371
+ + '</fieldset>'
1372
+ + '</td>'
1373
+ + '</tr>'
1374
+ + '</table>'
1375
+ + '</div>';
1376
+
1377
+ if(html){
1378
+ $('.saswp-how-to-step-section[data-id="'+schema_id+'"]').append(html);
1379
+ }
1380
+
1381
+
1382
+ });
1383
+
1384
+ $(document).on("click", ".saswp-table-close", function(){
1385
+ $(this).parent().remove();
1386
+ });
1387
+
1388
+ //How to schema js ends here
1389
 
1390
  $(document).on("click", '.saswp-add-custom-fields', function(){
1391
  var schema_type = $('select#schema_type option:selected').val();
admin_section/js/saswp-add-new.js CHANGED
@@ -260,6 +260,13 @@ jQuery(document).ready(function($) {
260
  $(this).find('select').attr('disabled', true);
261
  }
262
  });
 
 
 
 
 
 
 
263
  if(schematype == 'local_business'){
264
  $(".saswp-option-table-class tr").eq(1).show();
265
  $(".saswp-business-text-field-tr").show();
@@ -313,6 +320,12 @@ jQuery(document).ready(function($) {
313
  $(this).find('select').attr('disabled', true);
314
  }
315
  });
 
 
 
 
 
 
316
  if(schematype == 'local_business'){
317
  $(".saswp-"+businesstype+'-tr').show();
318
  $(".saswp-business-text-field-tr").show();
260
  $(this).find('select').attr('disabled', true);
261
  }
262
  });
263
+ if(schematype == 'TechArticle' || schematype == 'Article' || schematype == 'Blogposting' || schematype == 'NewsArticle' || schematype == 'WebPage'){
264
+
265
+ $(".saswp-enable-speakable").parent().parent().show();
266
+ }else{
267
+ $(".saswp-enable-speakable").parent().parent().hide();
268
+ }
269
+
270
  if(schematype == 'local_business'){
271
  $(".saswp-option-table-class tr").eq(1).show();
272
  $(".saswp-business-text-field-tr").show();
320
  $(this).find('select').attr('disabled', true);
321
  }
322
  });
323
+ if(schematype == 'TechArticle' || schematype == 'Article' || schematype == 'Blogposting' || schematype == 'NewsArticle' || schematype == 'WebPage'){
324
+
325
+ $(".saswp-enable-speakable").parent().parent().show();
326
+ }else{
327
+ $(".saswp-enable-speakable").parent().parent().hide();
328
+ }
329
  if(schematype == 'local_business'){
330
  $(".saswp-"+businesstype+'-tr').show();
331
  $(".saswp-business-text-field-tr").show();
admin_section/plugin-installer/install.php CHANGED
@@ -664,15 +664,55 @@
664
 
665
 
666
  function saswp_general_setting_fields_callback(){
667
-
668
- global $sd_data;
669
- $settings = $sd_data;
670
  $saswp_kb_type ='';
671
 
672
  if(isset($sd_data['saswp_kb_type'])){
673
  $saswp_kb_type = $sd_data['saswp_kb_type'];
674
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
 
 
 
 
 
 
 
 
 
 
 
676
  $returnHtml = '<li class="saswp_fields">
677
  <label>'.esc_html__('Data Type', 'schema-and-structured-data-for-wp').'</label>
678
  <select name="sd_data[saswp_kb_type]">
@@ -680,28 +720,8 @@ function saswp_general_setting_fields_callback(){
680
  <option value="Person" '.($saswp_kb_type=='Person'? 'selected' : '').'>'.esc_html__('Person', 'schema-and-structured-data-for-wp').'</option>
681
  </select>
682
  </li>
683
- <li class="saswp_fields">
684
- <label>'.esc_html__('About', 'schema-and-structured-data-for-wp').'</label>
685
- '. wp_dropdown_pages( array(
686
- 'name' => 'sd_data[sd_about_page]',
687
- 'id' => 'sd_about_page',
688
- 'echo' => 0,
689
- 'show_option_none' => esc_attr( 'Select an item' ),
690
- 'option_none_value' => '',
691
- 'selected' => isset($settings['sd_about_page']) ? $settings['sd_about_page'] : '',
692
- )).'
693
- </li>
694
- <li class="saswp_fields">
695
- <label>'.esc_html__('Contact', 'schema-and-structured-data-for-wp').'</label>
696
- '.wp_dropdown_pages( array(
697
- 'name' => 'sd_data[sd_contact_page]',
698
- 'id' => 'sd_contact_page-select',
699
- 'echo' => 0,
700
- 'show_option_none' => esc_attr( 'Select an item' ),
701
- 'option_none_value' => '',
702
- 'selected' => isset($settings['sd_contact_page']) ? $settings['sd_contact_page'] : '',
703
- )).'
704
- </li>';
705
  return $returnHtml;
706
  }
707
 
664
 
665
 
666
  function saswp_general_setting_fields_callback(){
667
+
668
+ global $sd_data;
 
669
  $saswp_kb_type ='';
670
 
671
  if(isset($sd_data['saswp_kb_type'])){
672
  $saswp_kb_type = $sd_data['saswp_kb_type'];
673
  }
674
+ $about_page = '';
675
+ $contact_page = '';
676
+
677
+
678
+ $pages = get_posts( array(
679
+ 'order' => 'ASC',
680
+ 'orderby' => 'ID',
681
+ 'post_type' => 'page',
682
+ 'post_status' => 'publish',
683
+ ) );
684
+
685
+ if(!empty($pages)){
686
+
687
+ foreach ($pages as $page){
688
+
689
+ $about_page .= '<option value="'.esc_attr($page->ID).'">'.esc_attr($page->post_title).'</option>';
690
+ $contact_page .= '<option value="'.esc_attr($page->ID).'">'.esc_attr($page->post_title).'</option>';
691
+
692
+ }
693
+
694
+ }
695
+ if($about_page){
696
+
697
+ $about_page = '<li class="saswp_fields">
698
+ <label>'.esc_html__('About', 'schema-and-structured-data-for-wp').'</label>
699
+ <select name="sd_data[sd_about_page]" id="sd_about_page-select">
700
+ <option value="">Select an item</option>
701
+ '.$about_page.'
702
+ </select>
703
+ </li>';
704
+ }
705
 
706
+ if($contact_page){
707
+
708
+ $contact_page = '<li class="saswp_fields">
709
+ <label>'.esc_html__('Contact', 'schema-and-structured-data-for-wp').'</label>
710
+ <select name="sd_data[sd_contact_page]" id="sd_contact_page-select">
711
+ <option value="">Select an item</option>
712
+ '.$contact_page.'
713
+ </select>
714
+ </li>';
715
+ }
716
  $returnHtml = '<li class="saswp_fields">
717
  <label>'.esc_html__('Data Type', 'schema-and-structured-data-for-wp').'</label>
718
  <select name="sd_data[saswp_kb_type]">
720
  <option value="Person" '.($saswp_kb_type=='Person'? 'selected' : '').'>'.esc_html__('Person', 'schema-and-structured-data-for-wp').'</option>
721
  </select>
722
  </li>
723
+ '.$about_page.'
724
+ '.$contact_page.'';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
725
  return $returnHtml;
726
  }
727
 
admin_section/settings.php CHANGED
@@ -324,7 +324,7 @@ function saswp_premium_features_callback(){ ?>
324
  <li><a target="_blank" href="http://structured-data-for-wp.com/extensions/woocommerce-compatibility-for-schema/">
325
  <div class="saswp-features-ele">
326
  <div class="saswp-ele-ic saswp-ele-1">
327
- <img src="http://structured-data-for-wp.com/wp-content/uploads/edd/2019/05/woocommerce-icon.png">
328
  </div>
329
  <div class="saswp-ele-tlt">
330
  <h3>WooCommerce Compatibility for Schema</h3>
@@ -339,7 +339,7 @@ function saswp_premium_features_callback(){ ?>
339
  <li><a target="_blank" href="http://structured-data-for-wp.com/extensions/cooked-compatibility-for-schema/">
340
  <div class="saswp-features-ele">
341
  <div class="saswp-ele-ic saswp-ele-2">
342
- <img src="http://structured-data-for-wp.com/wp-content/uploads/edd/2019/05/cooked-schema-wp.png">
343
  </div>
344
  <div class="saswp-ele-tlt">
345
  <h3>Cooked Compatibility for Schema</h3>
@@ -363,7 +363,7 @@ function saswp_services_callback(){ ?>
363
  <li><a target="_blank" href="http://structured-data-for-wp.com/services/google-news-schema-setup/">
364
  <div class="saswp-features-ele">
365
  <div class="saswp-ele-ic saswp-ele-3">
366
- <img src="http://structured-data-for-wp.com/wp-content/uploads/edd/2019/05/news.png">
367
  </div>
368
  <div class="saswp-ele-tlt">
369
  <h3>Google News Schema Setup</h3>
@@ -378,7 +378,7 @@ function saswp_services_callback(){ ?>
378
  <li><a target="_blank" href="http://structured-data-for-wp.com/services/structured-data-setup-error-clean-up/">
379
  <div class="saswp-features-ele">
380
  <div class="saswp-ele-ic saswp-ele-4">
381
- <img src="http://structured-data-for-wp.com/wp-content/uploads/edd/2019/05/schema-setup-icon.png">
382
  </div>
383
  <div class="saswp-ele-tlt">
384
  <h3>Structured Data Setup & Error Clean Up</h3>
324
  <li><a target="_blank" href="http://structured-data-for-wp.com/extensions/woocommerce-compatibility-for-schema/">
325
  <div class="saswp-features-ele">
326
  <div class="saswp-ele-ic saswp-ele-1">
327
+ <img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/woocommerce-icon.png">
328
  </div>
329
  <div class="saswp-ele-tlt">
330
  <h3>WooCommerce Compatibility for Schema</h3>
339
  <li><a target="_blank" href="http://structured-data-for-wp.com/extensions/cooked-compatibility-for-schema/">
340
  <div class="saswp-features-ele">
341
  <div class="saswp-ele-ic saswp-ele-2">
342
+ <img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/cooked-schema-wp.png">
343
  </div>
344
  <div class="saswp-ele-tlt">
345
  <h3>Cooked Compatibility for Schema</h3>
363
  <li><a target="_blank" href="http://structured-data-for-wp.com/services/google-news-schema-setup/">
364
  <div class="saswp-features-ele">
365
  <div class="saswp-ele-ic saswp-ele-3">
366
+ <img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/news.png">
367
  </div>
368
  <div class="saswp-ele-tlt">
369
  <h3>Google News Schema Setup</h3>
378
  <li><a target="_blank" href="http://structured-data-for-wp.com/services/structured-data-setup-error-clean-up/">
379
  <div class="saswp-features-ele">
380
  <div class="saswp-ele-ic saswp-ele-4">
381
+ <img src="<?php echo SASWP_PLUGIN_URL; ?>/admin_section/images/schema-setup-icon.png">
382
  </div>
383
  <div class="saswp-ele-tlt">
384
  <h3>Structured Data Setup & Error Clean Up</h3>
google_review/google_review.php CHANGED
@@ -23,8 +23,14 @@ class saswp_google_review{
23
  public function saswp_get_edit_post_link($link, $post_id, $context){
24
 
25
  $scr = get_current_screen();
26
-
27
- if ($scr->id == 'edit-saswp-google-review' && $context == 'display') {
 
 
 
 
 
 
28
 
29
  return wp_nonce_url(admin_url('admin.php?post_id='.$post_id.'&page=collection'), '_wpnonce');
30
 
23
  public function saswp_get_edit_post_link($link, $post_id, $context){
24
 
25
  $scr = get_current_screen();
26
+
27
+ $id = '';
28
+
29
+ if(is_object($scr)){
30
+ $id = $scr->id;
31
+ }
32
+
33
+ if ($id == 'edit-saswp-google-review' && $context == 'display') {
34
 
35
  return wp_nonce_url(admin_url('admin.php?post_id='.$post_id.'&page=collection'), '_wpnonce');
36
 
google_review/google_review_page.php CHANGED
@@ -209,7 +209,7 @@ class saswp_google_review_page{
209
  $place_id = trim($post_meta['saswp_google_place_id'][0]);
210
  $place = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "saswp_google_place WHERE place_id = %s", $place_id));
211
 
212
- if($place->id){
213
 
214
  $reviews = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "saswp_google_review WHERE google_place_id = %d ORDER BY time DESC", $place->id));
215
 
209
  $place_id = trim($post_meta['saswp_google_place_id'][0]);
210
  $place = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "saswp_google_place WHERE place_id = %s", $place_id));
211
 
212
+ if(is_object($place)){
213
 
214
  $reviews = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "saswp_google_review WHERE google_place_id = %d ORDER BY time DESC", $place->id));
215
 
google_review/google_review_setup.php CHANGED
@@ -195,7 +195,7 @@ function saswp_business_image($result_json) {
195
  $request_url = add_query_arg(
196
  array(
197
  'photoreference' => $result_json->photos[0]->photo_reference,
198
- 'key' => $sd_data['google_place_api_key'],
199
  'maxwidth' => '300',
200
  'maxheight' => '300',
201
  ),
195
  $request_url = add_query_arg(
196
  array(
197
  'photoreference' => $result_json->photos[0]->photo_reference,
198
+ 'key' => isset($sd_data['google_place_api_key']) ? $sd_data['google_place_api_key']:'',
199
  'maxwidth' => '300',
200
  'maxheight' => '300',
201
  ),
output/function.php CHANGED
@@ -1,6 +1,11 @@
1
  <?php
2
  function saswp_remove_amp_default_structure_data($metadata){
3
- return '';
 
 
 
 
 
4
  }
5
 
6
  add_filter( 'amp_init', 'saswp_schema_markup_hook_on_init' );
@@ -622,12 +627,12 @@ function saswp_list_items_generator(){
622
  $breadcrumbslist = array();
623
 
624
  if(is_single()){
625
-
626
  if(!empty($bc_titles) && !empty($bc_links)){
627
 
628
  for($i=0;$i<sizeof($bc_titles);$i++){
629
 
630
- if($bc_links[$i] && $bc_titles[$i]){
631
 
632
  $breadcrumbslist[] = array(
633
  '@type' => 'ListItem',
@@ -653,7 +658,7 @@ function saswp_list_items_generator(){
653
 
654
  for($i=0;$i<sizeof($bc_titles);$i++){
655
 
656
- if($bc_links[$i] && $bc_titles[$i]){
657
 
658
  $breadcrumbslist[] = array(
659
  '@type' => 'ListItem',
@@ -679,7 +684,7 @@ function saswp_list_items_generator(){
679
 
680
  for($i=0;$i<sizeof($bc_titles);$i++){
681
 
682
- if($bc_links[$i] && $bc_titles[$i]){
683
 
684
  $breadcrumbslist[] = array(
685
  '@type' => 'ListItem',
@@ -697,7 +702,7 @@ function saswp_list_items_generator(){
697
 
698
  }
699
  }
700
-
701
  return $breadcrumbslist;
702
  }
703
 
@@ -811,4 +816,4 @@ function saswp_global_option(){
811
 
812
  }
813
 
814
- }
1
  <?php
2
  function saswp_remove_amp_default_structure_data($metadata){
3
+
4
+ if(is_array($metadata)){
5
+ return array();
6
+ }else{
7
+ return '';
8
+ }
9
  }
10
 
11
  add_filter( 'amp_init', 'saswp_schema_markup_hook_on_init' );
627
  $breadcrumbslist = array();
628
 
629
  if(is_single()){
630
+
631
  if(!empty($bc_titles) && !empty($bc_links)){
632
 
633
  for($i=0;$i<sizeof($bc_titles);$i++){
634
 
635
+ if(array_key_exists($i, $bc_links) && array_key_exists($i, $bc_titles)){
636
 
637
  $breadcrumbslist[] = array(
638
  '@type' => 'ListItem',
658
 
659
  for($i=0;$i<sizeof($bc_titles);$i++){
660
 
661
+ if(array_key_exists($i, $bc_links) && array_key_exists($i, $bc_titles)){
662
 
663
  $breadcrumbslist[] = array(
664
  '@type' => 'ListItem',
684
 
685
  for($i=0;$i<sizeof($bc_titles);$i++){
686
 
687
+ if(array_key_exists($i, $bc_links) && array_key_exists($i, $bc_titles)){
688
 
689
  $breadcrumbslist[] = array(
690
  '@type' => 'ListItem',
702
 
703
  }
704
  }
705
+
706
  return $breadcrumbslist;
707
  }
708
 
816
 
817
  }
818
 
819
+ }
output/output.php CHANGED
@@ -204,8 +204,8 @@ function saswp_schema_output() {
204
  $schema_options = $schemaConditionals['schema_options'];
205
  }
206
 
207
- $schema_type = saswp_remove_warnings($schemaConditionals, 'schema_type', 'saswp_string');
208
- $schema_post_id = saswp_remove_warnings($schemaConditionals, 'post_id', 'saswp_string');
209
 
210
 
211
  $logo = '';
@@ -290,7 +290,25 @@ function saswp_schema_output() {
290
 
291
  $extra_theme_review = array();
292
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
293
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  if( 'Course' === $schema_type){
295
 
296
  $description = strip_tags(strip_shortcodes(get_the_excerpt()));
@@ -331,8 +349,7 @@ function saswp_schema_output() {
331
 
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')){
@@ -819,78 +836,19 @@ function saswp_schema_output() {
819
 
820
  }
821
  $input1['review'] = $reviews;
822
- }
823
- }else{
824
-
825
- $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_product_schema_details');
826
-
827
- $input1 = array(
828
- '@context' => 'http://schema.org',
829
- '@type' => 'Product',
830
- '@id' => get_permalink().'/#product',
831
- 'url' => get_permalink(),
832
- 'name' => saswp_remove_warnings($schema_data, 'saswp_product_schema_name', 'saswp_string'),
833
- 'sku' => saswp_remove_warnings($schema_data, 'saswp_product_schema_sku', 'saswp_string'),
834
- 'description' => saswp_remove_warnings($schema_data, 'saswp_product_schema_description', 'saswp_string'),
835
- 'image' => array(
836
- '@type' =>'ImageObject',
837
- 'url' => isset($schema_data['saswp_product_schema_image']) ? esc_url($schema_data['saswp_product_schema_image']['url']):'' ,
838
- 'width' => isset($schema_data['saswp_product_schema_image']) ? esc_attr($schema_data['saswp_product_schema_image']['width']):'' ,
839
- 'height' => isset($schema_data['saswp_product_schema_image']) ? esc_attr($schema_data['saswp_product_schema_image']['height']):'' ,
840
- ),
841
- 'offers' => array(
842
- '@type' => 'Offer',
843
- 'availability' => saswp_remove_warnings($schema_data, 'saswp_product_schema_availability', 'saswp_string'),
844
- 'itemCondition' => saswp_remove_warnings($schema_data, 'saswp_product_schema_condition', 'saswp_string'),
845
- 'price' => saswp_remove_warnings($schema_data, 'saswp_product_schema_price', 'saswp_string'),
846
- 'priceCurrency' => saswp_remove_warnings($schema_data, 'saswp_product_schema_currency', 'saswp_string'),
847
- 'url' => get_permalink(),
848
- 'priceValidUntil' => saswp_remove_warnings($schema_data, 'saswp_product_schema_priceValidUntil', 'saswp_string'),
849
- ),
850
- 'brand' => array(
851
- '@type'=>'Thing',
852
- 'name'=>saswp_remove_warnings($schema_data, 'saswp_product_schema_brand_name', 'saswp_string'),
853
- )
854
- );
855
-
856
-
857
- if(isset($schema_data['saswp_product_schema_gtin8']) && $schema_data['saswp_product_schema_gtin8'] !=''){
858
- $input1['gtin8'] = esc_attr($schema_data['saswp_product_schema_gtin8']);
859
- }
860
-
861
- if(isset($schema_data['saswp_product_schema_mpn']) && $schema_data['saswp_product_schema_mpn'] !=''){
862
- $input1['mpn'] = esc_attr($schema_data['saswp_product_schema_mpn']);
863
- }
864
-
865
- if(isset($schema_data['saswp_product_schema_isbn']) && $schema_data['saswp_product_schema_isbn'] !=''){
866
- $input1['isbn'] = esc_attr($schema_data['saswp_product_schema_isbn']);
867
- }
868
-
869
- if(isset($schema_data['saswp_product_schema_enable_rating'])){
870
-
871
- $input1['aggregateRating'] = array(
872
- "@type" => "AggregateRating",
873
- "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_product_schema_rating', 'saswp_string'),
874
- "reviewCount" => saswp_remove_warnings($schema_data, 'saswp_product_schema_review_count', 'saswp_string')
875
- );
876
- }
877
-
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
- }
885
-
886
- }
887
-
888
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
889
 
890
  $service = new saswp_output_service();
891
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
892
 
893
- }
 
 
 
 
 
894
 
895
  $input1 = apply_filters('saswp_modify_product_schema_output', $input1 );
896
  }
@@ -1468,6 +1426,9 @@ function saswp_schema_output() {
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'])){
@@ -1482,6 +1443,25 @@ function saswp_schema_output() {
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
@@ -1604,6 +1584,8 @@ function saswp_post_specific_schema_output() {
1604
 
1605
  foreach($all_schemas as $schema){
1606
 
 
 
1607
  $schema_id = $schema;
1608
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
1609
  $schema_post_id = $post->ID;
@@ -1644,7 +1626,618 @@ function saswp_post_specific_schema_output() {
1644
  $service_object = new saswp_output_service();
1645
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
1646
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1647
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1648
 
1649
  if( 'qanda' === $schema_type){
1650
 
@@ -1794,8 +2387,8 @@ function saswp_post_specific_schema_output() {
1794
  $slogo = get_post_meta( get_the_ID(), 'saswp_blogposting_organization_logo_'.$schema_id.'_detail',true);
1795
  $input1 = array(
1796
  '@context' => 'http://schema.org',
1797
- '@type' => $schema_type ,
1798
- '@id' => get_permalink().'/#blogposting',
1799
  'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_main_entity_of_page_'.$schema_id, 'saswp_array'),
1800
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_headline_'.$schema_id, 'saswp_array'),
1801
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_description_'.$schema_id, 'saswp_array'),
@@ -1818,6 +2411,19 @@ function saswp_post_specific_schema_output() {
1818
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
1819
  ),
1820
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
1821
  if(!empty($aggregateRating)){
1822
  $input1['aggregateRating'] = $aggregateRating;
1823
  }
@@ -1925,6 +2531,18 @@ function saswp_post_specific_schema_output() {
1925
 
1926
 
1927
  );
 
 
 
 
 
 
 
 
 
 
 
 
1928
  if(!empty($aggregateRating)){
1929
 
1930
  $input1['mainEntity']['aggregateRating'] = $aggregateRating;
@@ -1967,7 +2585,18 @@ function saswp_post_specific_schema_output() {
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,7 +2633,17 @@ function saswp_post_specific_schema_output() {
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);
@@ -2167,7 +2806,7 @@ function saswp_post_specific_schema_output() {
2167
  $input1['isbn'] = esc_attr($all_post_meta['saswp_product_schema_isbn_'.$schema_id][0]);
2168
  }
2169
 
2170
- if(saswp_remove_warnings($all_post_meta, 'saswp_product_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2171
 
2172
  $input1['aggregateRating'] = array(
2173
  "@type" => "AggregateRating",
@@ -2259,6 +2898,16 @@ function saswp_post_specific_schema_output() {
2259
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_organization_name_'.$schema_id, 'saswp_array'),
2260
  ),
2261
  );
 
 
 
 
 
 
 
 
 
 
2262
  if(!empty($aggregateRating)){
2263
  $input1['aggregateRating'] = $aggregateRating;
2264
  }
@@ -2658,7 +3307,7 @@ function saswp_post_specific_schema_output() {
2658
 
2659
 
2660
 
2661
- if(isset($all_post_meta['local_enable_rating_'.$schema_id])){
2662
 
2663
  $input1['aggregateRating'] = array(
2664
  "@type" => "AggregateRating",
@@ -2689,6 +3338,10 @@ function saswp_post_specific_schema_output() {
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';
@@ -2703,7 +3356,7 @@ function saswp_post_specific_schema_output() {
2703
  }
2704
 
2705
 
2706
- if($schema_type != 'Review'){
2707
 
2708
  //kk star rating
2709
 
204
  $schema_options = $schemaConditionals['schema_options'];
205
  }
206
 
207
+ $schema_type = saswp_remove_warnings($schemaConditionals, 'schema_type', 'saswp_string');
208
+ $schema_post_id = saswp_remove_warnings($schemaConditionals, 'post_id', 'saswp_string');
209
 
210
 
211
  $logo = '';
290
 
291
  $extra_theme_review = array();
292
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
293
+
294
+
295
+ if( $schema_type == 'VideoGame' ||
296
+ $schema_type == 'HowTo' ||
297
+ $schema_type == 'TVSeries' ||
298
+ $schema_type == 'MedicalCondition' ||
299
+ $schema_type == 'Apartment' ||
300
+ $schema_type == 'House' ||
301
+ $schema_type == 'TouristDestination' ||
302
+ $schema_type == 'TouristAttraction' ||
303
+ $schema_type == 'LandmarksOrHistoricalBuildings' ||
304
+ $schema_type == 'HinduTemple' ||
305
+ $schema_type == 'Church' ||
306
+ $schema_type == 'Mosque' ||
307
+ $schema_type == 'SingleFamilyResidence' ) {
308
+
309
+ $input1 = array();
310
+ }
311
+
312
  if( 'Course' === $schema_type){
313
 
314
  $description = strip_tags(strip_shortcodes(get_the_excerpt()));
349
 
350
  $input1 = apply_filters('saswp_modify_course_schema_output', $input1 );
351
  }
352
+
 
353
  if( 'DiscussionForumPosting' === $schema_type){
354
 
355
  if(isset($sd_data['saswp-bbpress']) && $sd_data['saswp-bbpress'] == 1 && is_plugin_active('bbpress/bbpress.php')){
836
 
837
  }
838
  $input1['review'] = $reviews;
839
+ }
840
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
841
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
842
 
843
  $service = new saswp_output_service();
844
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
845
 
846
+ }
847
+ }else{
848
+
849
+ $input1 = array();
850
+
851
+ }
852
 
853
  $input1 = apply_filters('saswp_modify_product_schema_output', $input1 );
854
  }
1426
  if(isset($business_details['local_menu'])){
1427
  $input1['hasMenu'] = esc_url($business_details['local_menu']);
1428
  }
1429
+ if(isset($business_details['local_hasmap'])){
1430
+ $input1['hasMap'] = esc_url($business_details['local_hasmap']);
1431
+ }
1432
 
1433
 
1434
  if(isset($business_details['local_latitude']) && isset($business_details['local_longitude'])){
1443
  }
1444
 
1445
 
1446
+ //Speakable schema
1447
+
1448
+ if($schema_type == 'TechArticle' || $schema_type == 'Article' || $schema_type == 'Blogposting' || $schema_type == 'NewsArticle' || $schema_type == 'WebPage'){
1449
+
1450
+ $speakable_status = get_post_meta($schema_post_id, 'saswp_enable_speakable_schema', true);
1451
+
1452
+ if($speakable_status){
1453
+
1454
+ $input1['speakable']['@type'] = 'SpeakableSpecification';
1455
+ $input1['speakable']['xpath'] = array(
1456
+ "/html/head/title",
1457
+ "/html/head/meta[@name='description']/@content"
1458
+ );
1459
+
1460
+ }
1461
+
1462
+
1463
+ }
1464
+
1465
  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)){
1466
 
1467
  //kk star rating
1584
 
1585
  foreach($all_schemas as $schema){
1586
 
1587
+ $input1 = array();
1588
+
1589
  $schema_id = $schema;
1590
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
1591
  $schema_post_id = $post->ID;
1626
  $service_object = new saswp_output_service();
1627
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
1628
 
1629
+ if( 'Mosque' === $schema_type){
1630
+
1631
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_mosque_schema_image_'.$schema_id.'_detail',true);
1632
+
1633
+
1634
+ $input1['@context'] = 'http://schema.org';
1635
+ $input1['@type'] = 'Mosque';
1636
+ $input1['@id'] = get_permalink().'/#Mosque';
1637
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_url_'.$schema_id, 'saswp_array');
1638
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_name_'.$schema_id, 'saswp_array');
1639
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_description_'.$schema_id, 'saswp_array');
1640
+
1641
+ if(!(empty($howto_image))){
1642
+
1643
+ $input1['image']['@type'] = 'ImageObject';
1644
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1645
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1646
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1647
+
1648
+ }
1649
+
1650
+ $input1['isAccessibleForFree'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_is_accesible_free_'.$schema_id, 'saswp_array');
1651
+ $input1['maximumAttendeeCapacity'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_maximum_a_capacity_'.$schema_id, 'saswp_array');
1652
+ $input1['hasMap'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_hasmap_'.$schema_id, 'saswp_array');
1653
+
1654
+ $input1['address']['@type'] = 'PostalAddress';
1655
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_country_'.$schema_id, 'saswp_array');
1656
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_locality_'.$schema_id, 'saswp_array');
1657
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_region_'.$schema_id, 'saswp_array');
1658
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_mosque_schema_postal_code_'.$schema_id, 'saswp_array');
1659
+
1660
+ }
1661
+
1662
+ if( 'Church' === $schema_type){
1663
+
1664
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_church_schema_image_'.$schema_id.'_detail',true);
1665
+
1666
+
1667
+ $input1['@context'] = 'http://schema.org';
1668
+ $input1['@type'] = 'Church';
1669
+ $input1['@id'] = get_permalink().'/#Church';
1670
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_url_'.$schema_id, 'saswp_array');
1671
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_name_'.$schema_id, 'saswp_array');
1672
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_description_'.$schema_id, 'saswp_array');
1673
+
1674
+ if(!(empty($howto_image))){
1675
+
1676
+ $input1['image']['@type'] = 'ImageObject';
1677
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1678
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1679
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1680
+
1681
+ }
1682
+
1683
+ $input1['isAccessibleForFree'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_is_acceesible_free_'.$schema_id, 'saswp_array');
1684
+ $input1['maximumAttendeeCapacity'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_maximum_a_capacity_'.$schema_id, 'saswp_array');
1685
+ $input1['hasMap'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_hasmap_'.$schema_id, 'saswp_array');
1686
+
1687
+ $input1['address']['@type'] = 'PostalAddress';
1688
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_country_'.$schema_id, 'saswp_array');
1689
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_locality_'.$schema_id, 'saswp_array');
1690
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_region_'.$schema_id, 'saswp_array');
1691
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_church_schema_postal_code_'.$schema_id, 'saswp_array');
1692
+
1693
+ }
1694
 
1695
+ if( 'HinduTemple' === $schema_type){
1696
+
1697
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_hindutemple_schema_image_'.$schema_id.'_detail',true);
1698
+
1699
+
1700
+ $input1['@context'] = 'http://schema.org';
1701
+ $input1['@type'] = 'HinduTemple';
1702
+ $input1['@id'] = get_permalink().'/#HinduTemple';
1703
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_url_'.$schema_id, 'saswp_array');
1704
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_name_'.$schema_id, 'saswp_array');
1705
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_description_'.$schema_id, 'saswp_array');
1706
+
1707
+ if(!(empty($howto_image))){
1708
+
1709
+ $input1['image']['@type'] = 'ImageObject';
1710
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1711
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1712
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1713
+
1714
+ }
1715
+
1716
+ $input1['isAccessibleForFree'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_is_accesible_free_'.$schema_id, 'saswp_array');
1717
+ $input1['maximumAttendeeCapacity'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_maximum_a_capacity_'.$schema_id, 'saswp_array');
1718
+ $input1['hasMap'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_hasmap_'.$schema_id, 'saswp_array');
1719
+
1720
+ $input1['address']['@type'] = 'PostalAddress';
1721
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_country_'.$schema_id, 'saswp_array');
1722
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_locality_'.$schema_id, 'saswp_array');
1723
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_region_'.$schema_id, 'saswp_array');
1724
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_hindutemple_schema_postal_code_'.$schema_id, 'saswp_array');
1725
+
1726
+ }
1727
+
1728
+ if( 'LandmarksOrHistoricalBuildings' === $schema_type){
1729
+
1730
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_lorh_schema_image_'.$schema_id.'_detail',true);
1731
+
1732
+
1733
+ $input1['@context'] = 'http://schema.org';
1734
+ $input1['@type'] = 'LandmarksOrHistoricalBuildings';
1735
+ $input1['@id'] = get_permalink().'/#LandmarksOrHistoricalBuildings';
1736
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_url_'.$schema_id, 'saswp_array');
1737
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_name_'.$schema_id, 'saswp_array');
1738
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_description_'.$schema_id, 'saswp_array');
1739
+
1740
+ if(!(empty($howto_image))){
1741
+
1742
+ $input1['image']['@type'] = 'ImageObject';
1743
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1744
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1745
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1746
+
1747
+ }
1748
+
1749
+ $input1['hasMap'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_hasmap_'.$schema_id, 'saswp_array');
1750
+ $input1['isAccessibleForFree'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_is_acceesible_free_'.$schema_id, 'saswp_array');
1751
+ $input1['maximumAttendeeCapacity'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_maximum_a_capacity_'.$schema_id, 'saswp_array');
1752
+
1753
+ $input1['address']['@type'] = 'PostalAddress';
1754
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_address_country_'.$schema_id, 'saswp_array');
1755
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_address_locality_'.$schema_id, 'saswp_array');
1756
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_address_region_'.$schema_id, 'saswp_array');
1757
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_lorh_schema_address_postal_code_'.$schema_id, 'saswp_array');
1758
+
1759
+ }
1760
+
1761
+ if( 'TouristAttraction' === $schema_type){
1762
+
1763
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_ta_schema_image_'.$schema_id.'_detail',true);
1764
+
1765
+
1766
+ $input1['@context'] = 'http://schema.org';
1767
+ $input1['@type'] = 'TouristAttraction';
1768
+ $input1['@id'] = get_permalink().'/#TouristAttraction';
1769
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_url_'.$schema_id, 'saswp_array');
1770
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_name_'.$schema_id, 'saswp_array');
1771
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_description_'.$schema_id, 'saswp_array');
1772
+
1773
+ if(!(empty($howto_image))){
1774
+
1775
+ $input1['image']['@type'] = 'ImageObject';
1776
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1777
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1778
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1779
+
1780
+ }
1781
+
1782
+ $input1['isAccessibleForFree'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_is_acceesible_free_'.$schema_id, 'saswp_array');
1783
+ // $input1['openingHours'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_opening_hours_'.$schema_id, 'saswp_array');
1784
+ // $input1['currenciesAccepted'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_currencies_accepted_'.$schema_id, 'saswp_array');
1785
+ // $input1['paymentAccepted'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_payment_accepted_'.$schema_id, 'saswp_array');
1786
+
1787
+ $input1['address']['@type'] = 'PostalAddress';
1788
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_address_country_'.$schema_id, 'saswp_array');
1789
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_address_locality_'.$schema_id, 'saswp_array');
1790
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_address_region_'.$schema_id, 'saswp_array');
1791
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_ta_schema_address_postal_code_'.$schema_id, 'saswp_array');
1792
+
1793
+ }
1794
+
1795
+ if( 'TouristDestination' === $schema_type){
1796
+
1797
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_td_schema_image_'.$schema_id.'_detail',true);
1798
+
1799
+
1800
+ $input1['@context'] = 'http://schema.org';
1801
+ $input1['@type'] = 'TouristDestination';
1802
+ $input1['@id'] = get_permalink().'/#TouristDestination';
1803
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_url_'.$schema_id, 'saswp_array');
1804
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_name_'.$schema_id, 'saswp_array');
1805
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_description_'.$schema_id, 'saswp_array');
1806
+
1807
+ if(!(empty($howto_image))){
1808
+
1809
+ $input1['image']['@type'] = 'ImageObject';
1810
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1811
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1812
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1813
+
1814
+ }
1815
+
1816
+
1817
+ $input1['address']['@type'] = 'PostalAddress';
1818
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_address_country_'.$schema_id, 'saswp_array');
1819
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_address_locality_'.$schema_id, 'saswp_array');
1820
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_address_region_'.$schema_id, 'saswp_array');
1821
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_td_schema_address_postal_code_'.$schema_id, 'saswp_array');
1822
+
1823
+ }
1824
+
1825
+ if( 'Apartment' === $schema_type){
1826
+
1827
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_apartment_schema_image_'.$schema_id.'_detail',true);
1828
+
1829
+
1830
+ $input1['@context'] = 'http://schema.org';
1831
+ $input1['@type'] = 'Apartment';
1832
+ $input1['@id'] = get_permalink().'/#Apartment';
1833
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_url_'.$schema_id, 'saswp_array');
1834
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_name_'.$schema_id, 'saswp_array');
1835
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_description_'.$schema_id, 'saswp_array');
1836
+
1837
+ if(!(empty($howto_image))){
1838
+
1839
+ $input1['image']['@type'] = 'ImageObject';
1840
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1841
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1842
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1843
+
1844
+ }
1845
+
1846
+ $input1['numberOfRooms'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_numberofrooms_'.$schema_id, 'saswp_array');
1847
+
1848
+ $input1['address']['@type'] = 'PostalAddress';
1849
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_country_'.$schema_id, 'saswp_array');
1850
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_locality_'.$schema_id, 'saswp_array');
1851
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_region_'.$schema_id, 'saswp_array');
1852
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_postalcode_'.$schema_id, 'saswp_array');
1853
+
1854
+ $input1['telephone'] = saswp_remove_warnings($all_post_meta, 'saswp_apartment_schema_telephone_'.$schema_id, 'saswp_array');
1855
+
1856
+ }
1857
+
1858
+ if( 'House' === $schema_type){
1859
+
1860
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_house_schema_image_'.$schema_id.'_detail',true);
1861
+
1862
+
1863
+ $input1['@context'] = 'http://schema.org';
1864
+ $input1['@type'] = 'House';
1865
+ $input1['@id'] = get_permalink().'/#House';
1866
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_url_'.$schema_id, 'saswp_array');
1867
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_name_'.$schema_id, 'saswp_array');
1868
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_description_'.$schema_id, 'saswp_array');
1869
+
1870
+ if(!(empty($howto_image))){
1871
+
1872
+ $input1['image']['@type'] = 'ImageObject';
1873
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1874
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1875
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1876
+
1877
+ }
1878
+
1879
+ $input1['petsAllowed'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_pets_allowed_'.$schema_id, 'saswp_array');
1880
+
1881
+ $input1['address']['@type'] = 'PostalAddress';
1882
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_country_'.$schema_id, 'saswp_array');
1883
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_locality_'.$schema_id, 'saswp_array');
1884
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_region_'.$schema_id, 'saswp_array');
1885
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_postalcode_'.$schema_id, 'saswp_array');
1886
+
1887
+ $input1['telephone'] = saswp_remove_warnings($all_post_meta, 'saswp_house_schema_telephone_'.$schema_id, 'saswp_array');
1888
+
1889
+ }
1890
+
1891
+ if( 'SingleFamilyResidence' === $schema_type){
1892
+
1893
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_sfr_schema_image_'.$schema_id.'_detail',true);
1894
+
1895
+ $input1['@context'] = 'http://schema.org';
1896
+ $input1['@type'] = 'SingleFamilyResidence';
1897
+ $input1['@id'] = get_permalink().'/#SingleFamilyResidence';
1898
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_url_'.$schema_id, 'saswp_array');
1899
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_name_'.$schema_id, 'saswp_array');
1900
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_description_'.$schema_id, 'saswp_array');
1901
+
1902
+ if(!(empty($howto_image))){
1903
+
1904
+ $input1['image']['@type'] = 'ImageObject';
1905
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1906
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1907
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1908
+
1909
+ }
1910
+ $input1['numberOfRooms'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_numberofrooms_'.$schema_id, 'saswp_array');
1911
+ $input1['petsAllowed'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_pets_allowed_'.$schema_id, 'saswp_array');
1912
+
1913
+ $input1['address']['@type'] = 'PostalAddress';
1914
+ $input1['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_country_'.$schema_id, 'saswp_array');
1915
+ $input1['address']['addressLocality'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_locality_'.$schema_id, 'saswp_array');
1916
+ $input1['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_region_'.$schema_id, 'saswp_array');
1917
+ $input1['address']['PostalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_postalcode_'.$schema_id, 'saswp_array');
1918
+
1919
+ $input1['telephone'] = saswp_remove_warnings($all_post_meta, 'saswp_sfr_schema_telephone_'.$schema_id, 'saswp_array');
1920
+
1921
+ }
1922
+
1923
+ if( 'HowTo' === $schema_type){
1924
+
1925
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_howto_schema_image_'.$schema_id.'_detail',true);
1926
+
1927
+
1928
+ $tool = esc_sql ( get_post_meta($schema_post_id, 'howto_tool_'.$schema_id, true) );
1929
+ $step = esc_sql ( get_post_meta($schema_post_id, 'howto_step_'.$schema_id, true) );
1930
+ $supply = esc_sql ( get_post_meta($schema_post_id, 'howto_supply_'.$schema_id, true) );
1931
+
1932
+
1933
+ $input1['@context'] = 'http://schema.org';
1934
+ $input1['@type'] = 'HowTo';
1935
+ $input1['@id'] = get_permalink().'/#HowTo';
1936
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_name_'.$schema_id, 'saswp_array');
1937
+ $input1['datePublished'] = isset($all_post_meta['saswp_howto_ec_schema_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_howto_ec_schema_date_published_'.$schema_id][0])):'';
1938
+ $input1['dateModified'] = isset($all_post_meta['saswp_howto_ec_schema_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_howto_ec_schema_date_modified_'.$schema_id][0])):'';
1939
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_description_'.$schema_id, 'saswp_array');
1940
+
1941
+ if(!(empty($howto_image))){
1942
+
1943
+ $input1['image']['@type'] = 'ImageObject';
1944
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
1945
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
1946
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
1947
+
1948
+ }
1949
+
1950
+ $input1['estimatedCost']['@type'] = 'MonetaryAmount';
1951
+ $input1['estimatedCost']['currency']= saswp_remove_warnings($all_post_meta, 'saswp_howto_ec_schema_currency_'.$schema_id, 'saswp_array');
1952
+ $input1['estimatedCost']['value'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_ec_schema_value_'.$schema_id, 'saswp_array');
1953
+
1954
+ $supply_arr = array();
1955
+ if(!empty($supply)){
1956
+
1957
+ foreach($supply as $val){
1958
+
1959
+ $supply_data = array();
1960
+ $supply_data['@type'] = 'HowToSupply';
1961
+ $supply_data['name'] = $val['saswp_howto_supply_name'];
1962
+
1963
+ if(isset($val['saswp_howto_supply_image_id'])){
1964
+
1965
+ $image_details = wp_get_attachment_image_src($val['saswp_howto_supply_image_id']);
1966
+
1967
+ $supply_data['image']['@type'] = 'ImageObject';
1968
+ $supply_data['image']['url'] = esc_url($image_details[0]);
1969
+ $supply_data['image']['width'] = esc_attr($image_details[1]);
1970
+ $supply_data['image']['height'] = esc_attr($image_details[2]);
1971
+
1972
+
1973
+
1974
+ }
1975
+ $supply_arr[] = $supply_data;
1976
+ }
1977
+ $input1['supply'] = $supply_arr;
1978
+ }
1979
+
1980
+ $tool_arr = array();
1981
+ if(!empty($tool)){
1982
+
1983
+ foreach($tool as $val){
1984
+
1985
+ $supply_data = array();
1986
+ $supply_data['@type'] = 'HowToTool';
1987
+ $supply_data['name'] = $val['saswp_howto_tool_name'];
1988
+
1989
+ if(isset($val['saswp_howto_tool_image_id'])){
1990
+
1991
+ $image_details = wp_get_attachment_image_src($val['saswp_howto_tool_image_id']);
1992
+
1993
+ $supply_data['image']['@type'] = 'ImageObject';
1994
+ $supply_data['image']['url'] = esc_url($image_details[0]);
1995
+ $supply_data['image']['width'] = esc_attr($image_details[1]);
1996
+ $supply_data['image']['height'] = esc_attr($image_details[2]);
1997
+
1998
+
1999
+
2000
+ }
2001
+ $tool_arr[] = $supply_data;
2002
+ }
2003
+ $input1['tool'] = $tool_arr;
2004
+ }
2005
+
2006
+ //step
2007
+
2008
+ $step_arr = array();
2009
+ if(!empty($step)){
2010
+
2011
+ foreach($step as $key => $val){
2012
+
2013
+ $supply_data = array();
2014
+ $direction = array();
2015
+ $tip = array();
2016
+
2017
+ $direction['@type'] = 'HowToDirection';
2018
+ $direction['text'] = $val['saswp_howto_direction_text'];
2019
+
2020
+ $tip['@type'] = 'HowToTip';
2021
+ $tip['text'] = $val['saswp_howto_tip_text'];
2022
+
2023
+
2024
+ $supply_data['@type'] = 'HowToStep';
2025
+ $supply_data['url'] = get_permalink().'#step'.++$key;
2026
+ $supply_data['name'] = $val['saswp_howto_step_name'];
2027
+ $supply_data['itemListElement'] = array($direction, $tip);
2028
+
2029
+ if(isset($val['saswp_howto_step_image_id'])){
2030
+
2031
+ $image_details = wp_get_attachment_image_src($val['saswp_howto_step_image_id']);
2032
+
2033
+ $supply_data['image']['@type'] = 'ImageObject';
2034
+ $supply_data['image']['url'] = esc_url($image_details[0]);
2035
+ $supply_data['image']['width'] = esc_attr($image_details[1]);
2036
+ $supply_data['image']['height'] = esc_attr($image_details[2]);
2037
+
2038
+
2039
+
2040
+ }
2041
+
2042
+ $step_arr[] = $supply_data;
2043
+
2044
+ }
2045
+
2046
+ $input1['step'] = $step_arr;
2047
+
2048
+ }
2049
+
2050
+ $input1['totalTime'] = saswp_remove_warnings($all_post_meta, 'saswp_howto_schema_totaltime_'.$schema_id, 'saswp_array');
2051
+
2052
+ }
2053
+
2054
+ if( 'TVSeries' === $schema_type){
2055
+
2056
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_tvseries_schema_image_'.$schema_id.'_detail',true);
2057
+
2058
+
2059
+ $actor = esc_sql ( get_post_meta($schema_post_id, 'tvseries_actor_'.$schema_id, true) );
2060
+ $season = esc_sql ( get_post_meta($schema_post_id, 'tvseries_season_'.$schema_id, true) );
2061
+
2062
+ $input1['@context'] = 'http://schema.org';
2063
+ $input1['@type'] = 'TVSeries';
2064
+ $input1['@id'] = get_permalink().'/#TVSeries';
2065
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_tvseries_schema_name_'.$schema_id, 'saswp_array');
2066
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_tvseries_schema_description_'.$schema_id, 'saswp_array');
2067
+
2068
+ if(!(empty($howto_image))){
2069
+
2070
+ $input1['image']['@type'] = 'ImageObject';
2071
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
2072
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
2073
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
2074
+
2075
+ }
2076
+
2077
+ $input1['author']['@type'] = 'Person';
2078
+ $input1['author']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_tvseries_schema_author_name_'.$schema_id, 'saswp_array');
2079
+
2080
+ $supply_arr = array();
2081
+ if(!empty($actor)){
2082
+
2083
+ foreach($actor as $val){
2084
+
2085
+ $supply_data = array();
2086
+ $supply_data['@type'] = 'Person';
2087
+ $supply_data['name'] = $val['saswp_tvseries_actor_name'];
2088
+
2089
+ $supply_arr[] = $supply_data;
2090
+ }
2091
+ $input1['actor'] = $supply_arr;
2092
+ }
2093
+
2094
+ $tool_arr = array();
2095
+ if(!empty($season)){
2096
+
2097
+ foreach($season as $val){
2098
+
2099
+ $supply_data = array();
2100
+ $supply_data['@type'] = 'TVSeason';
2101
+ $supply_data['datePublished'] = $val['saswp_tvseries_season_published_date'];
2102
+ $supply_data['name'] = $val['saswp_tvseries_season_name'];
2103
+ $supply_data['numberOfEpisodes'] = $val['saswp_tvseries_season_episodes'];
2104
+
2105
+ $tool_arr[] = $supply_data;
2106
+ }
2107
+ $input1['containsSeason'] = $tool_arr;
2108
+ }
2109
+
2110
+ }
2111
+
2112
+ if( 'MedicalCondition' === $schema_type){
2113
+
2114
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_mc_schema_image_'.$schema_id.'_detail',true);
2115
+
2116
+ $cause = esc_sql ( get_post_meta($schema_post_id, 'mc_cause_'.$schema_id, true));
2117
+ $symptom = esc_sql ( get_post_meta($schema_post_id, 'mc_symptom_'.$schema_id, true));
2118
+ $riskfactro = esc_sql ( get_post_meta($schema_post_id, 'mc_risk_factor_'.$schema_id, true));
2119
+
2120
+
2121
+ $input1['@context'] = 'http://schema.org';
2122
+ $input1['@type'] = 'MedicalCondition';
2123
+ $input1['@id'] = get_permalink().'/#MedicalCondition';
2124
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_mc_schema_name_'.$schema_id, 'saswp_array');
2125
+ $input1['alternateName'] = saswp_remove_warnings($all_post_meta, 'saswp_mc_schema_alternate_name_'.$schema_id, 'saswp_array');
2126
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_mc_schema_description_'.$schema_id, 'saswp_array');
2127
+
2128
+ if(!(empty($howto_image))){
2129
+
2130
+ $input1['image']['@type'] = 'ImageObject';
2131
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
2132
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
2133
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
2134
+
2135
+ }
2136
+
2137
+ $input1['associatedAnatomy']['@type'] = 'AnatomicalStructure';
2138
+ $input1['associatedAnatomy']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_mc_schema_anatomy_name_'.$schema_id, 'saswp_array');
2139
+
2140
+ $input1['code']['@type'] = 'MedicalCode';
2141
+ $input1['code']['code'] = saswp_remove_warnings($all_post_meta, 'saswp_mc_schema_medical_code_'.$schema_id, 'saswp_array');
2142
+ $input1['code']['codingSystem'] = saswp_remove_warnings($all_post_meta, 'saswp_mc_schema_coding_system_'.$schema_id, 'saswp_array');
2143
+
2144
+ $cause_arr = array();
2145
+ if(!empty($cause)){
2146
+
2147
+ foreach($cause as $val){
2148
+
2149
+ $supply_data = array();
2150
+ $supply_data['@type'] = 'MedicalCause';
2151
+ $supply_data['name'] = $val['saswp_mc_cause_name'];
2152
+
2153
+ $cause_arr[] = $supply_data;
2154
+ }
2155
+ $input1['cause'] = $cause_arr;
2156
+ }
2157
+
2158
+ $symptom_arr = array();
2159
+ if(!empty($symptom)){
2160
+
2161
+ foreach($symptom as $val){
2162
+
2163
+ $supply_data = array();
2164
+ $supply_data['@type'] = 'MedicalSymptom';
2165
+ $supply_data['name'] = $val['saswp_mc_symptom_name'];
2166
+
2167
+ $symptom_arr[] = $supply_data;
2168
+ }
2169
+ $input1['signOrSymptom'] = $symptom_arr;
2170
+ }
2171
+
2172
+ $riskfactor_arr = array();
2173
+ if(!empty($riskfactro)){
2174
+
2175
+ foreach($riskfactro as $val){
2176
+
2177
+ $supply_data = array();
2178
+ $supply_data['@type'] = 'MedicalRiskFactor';
2179
+ $supply_data['name'] = $val['saswp_mc_risk_factor_name'];
2180
+
2181
+ $riskfactor_arr[] = $supply_data;
2182
+ }
2183
+ $input1['riskFactor'] = $riskfactor_arr;
2184
+ }
2185
+
2186
+ }
2187
+
2188
+ if( 'VideoGame' === $schema_type){
2189
+
2190
+ $howto_image = get_post_meta( get_the_ID(), 'saswp_vg_schema_image_'.$schema_id.'_detail',true);
2191
+
2192
+
2193
+ $input1['@context'] = 'http://schema.org';
2194
+ $input1['@type'] = 'VideoGame';
2195
+ $input1['@id'] = get_permalink().'/#VideoGame';
2196
+ $input1['name'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_name_'.$schema_id, 'saswp_array');
2197
+ $input1['url'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_url_'.$schema_id, 'saswp_array');
2198
+ $input1['description'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_description_'.$schema_id, 'saswp_array');
2199
+
2200
+ if(!(empty($howto_image))){
2201
+
2202
+ $input1['image']['@type'] = 'ImageObject';
2203
+ $input1['image']['url'] = isset($howto_image['thumbnail']) ? esc_url($howto_image['thumbnail']):'';
2204
+ $input1['image']['height'] = isset($howto_image['width']) ? esc_attr($howto_image['width']) :'';
2205
+ $input1['image']['width'] = isset($howto_image['height']) ? esc_attr($howto_image['height']) :'';
2206
+
2207
+ }
2208
+
2209
+ $input1['operatingSystem'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_operating_system_'.$schema_id, 'saswp_array');
2210
+ $input1['applicationCategory'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_application_category_'.$schema_id, 'saswp_array');
2211
+
2212
+ $input1['author']['@type'] = 'Organization';
2213
+ $input1['author']['name'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_author_name_'.$schema_id, 'saswp_array');
2214
+
2215
+ $input1['offers']['@type'] = 'Offer';
2216
+ $input1['offers']['price'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_price_'.$schema_id, 'saswp_array');
2217
+ $input1['offers']['priceCurrency'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_price_currency_'.$schema_id, 'saswp_array');
2218
+ $input1['offers']['availability'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_price_availability_'.$schema_id, 'saswp_array');
2219
+
2220
+
2221
+ $input1['publisher'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_publisher_'.$schema_id, 'saswp_array');
2222
+ $input1['genre'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_genre_'.$schema_id, 'saswp_array');
2223
+ $input1['processorRequirements'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_processor_requirements_'.$schema_id, 'saswp_array');
2224
+ $input1['memoryRequirements'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_memory_requirements_'.$schema_id, 'saswp_array');
2225
+ $input1['storageRequirements'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_storage_requirements_'.$schema_id, 'saswp_array');
2226
+ $input1['gamePlatform'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_game_platform_'.$schema_id, 'saswp_array');
2227
+ $input1['cheatCode'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_cheat_code_'.$schema_id, 'saswp_array');
2228
+
2229
+
2230
+ if( saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_enable_rating_'.$schema_id, 'saswp_array') == 1 && saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_rating_'.$schema_id, 'saswp_array') && saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_review_count_'.$schema_id, 'saswp_array')){
2231
+
2232
+ $input1['aggregateRating']['@type'] = 'AggregateRating';
2233
+ $input1['aggregateRating']['ratingValue'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_rating_'.$schema_id, 'saswp_array');
2234
+ $input1['aggregateRating']['ratingCount'] = saswp_remove_warnings($all_post_meta, 'saswp_vg_schema_review_count_'.$schema_id, 'saswp_array');
2235
+
2236
+ }
2237
+
2238
+
2239
+
2240
+ }
2241
 
2242
  if( 'qanda' === $schema_type){
2243
 
2387
  $slogo = get_post_meta( get_the_ID(), 'saswp_blogposting_organization_logo_'.$schema_id.'_detail',true);
2388
  $input1 = array(
2389
  '@context' => 'http://schema.org',
2390
+ '@type' => 'Blogposting' ,
2391
+ '@id' => get_permalink().'/#Blogposting',
2392
  'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_main_entity_of_page_'.$schema_id, 'saswp_array'),
2393
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_headline_'.$schema_id, 'saswp_array'),
2394
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_description_'.$schema_id, 'saswp_array'),
2411
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_organization_name_'.$schema_id, 'saswp_array'),
2412
  ),
2413
  );
2414
+
2415
+
2416
+
2417
+ if(isset($all_post_meta['saswp_blogposting_speakable_'.$schema_id]) && $all_post_meta['saswp_blogposting_speakable_'.$schema_id][0] == 1 ){
2418
+
2419
+ $input1['speakable']['@type'] = 'SpeakableSpecification';
2420
+ $input1['speakable']['xpath'] = array(
2421
+ "/html/head/title",
2422
+ "/html/head/meta[@name='description']/@content"
2423
+ );
2424
+
2425
+ }
2426
+
2427
  if(!empty($aggregateRating)){
2428
  $input1['aggregateRating'] = $aggregateRating;
2429
  }
2531
 
2532
 
2533
  );
2534
+
2535
+
2536
+ if(isset($all_post_meta['saswp_webpage_speakable_'.$schema_id]) && $all_post_meta['saswp_webpage_speakable_'.$schema_id][0] == 1){
2537
+
2538
+ $input1['speakable']['@type'] = 'SpeakableSpecification';
2539
+ $input1['speakable']['xpath'] = array(
2540
+ "/html/head/title",
2541
+ "/html/head/meta[@name='description']/@content"
2542
+ );
2543
+
2544
+ }
2545
+
2546
  if(!empty($aggregateRating)){
2547
 
2548
  $input1['mainEntity']['aggregateRating'] = $aggregateRating;
2585
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_name_'.$schema_id, 'saswp_array'),
2586
  ),
2587
 
2588
+ );
2589
+
2590
+ if(isset($all_post_meta['saswp_article_speakable_'.$schema_id]) && $all_post_meta['saswp_article_speakable_'.$schema_id][0] == 1){
2591
+
2592
+ $input1['speakable']['@type'] = 'SpeakableSpecification';
2593
+ $input1['speakable']['xpath'] = array(
2594
+ "/html/head/title",
2595
+ "/html/head/meta[@name='description']/@content"
2596
+ );
2597
+
2598
+ }
2599
+
2600
  if(!empty($extra_theme_review)){
2601
 
2602
  $input1 = array_merge($input1, $extra_theme_review);
2633
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_organization_name_'.$schema_id, 'saswp_array'),
2634
  ),
2635
 
2636
+ );
2637
+
2638
+ if(isset($all_post_meta['saswp_tech_article_speakable_'.$schema_id]) && $all_post_meta['saswp_tech_article_speakable_'.$schema_id][0] == 1){
2639
+
2640
+ $input1['speakable']['@type'] = 'SpeakableSpecification';
2641
+ $input1['speakable']['xpath'] = array(
2642
+ "/html/head/title",
2643
+ "/html/head/meta[@name='description']/@content"
2644
+ );
2645
+
2646
+ }
2647
  if(!empty($extra_theme_review)){
2648
 
2649
  $input1 = array_merge($input1, $extra_theme_review);
2806
  $input1['isbn'] = esc_attr($all_post_meta['saswp_product_schema_isbn_'.$schema_id][0]);
2807
  }
2808
 
2809
+ if(saswp_remove_warnings($all_post_meta, 'saswp_product_schema_enable_rating_'.$schema_id, 'saswp_array') == 1 && saswp_remove_warnings($all_post_meta, 'saswp_product_schema_rating_'.$schema_id, 'saswp_array') && saswp_remove_warnings($all_post_meta, 'saswp_product_schema_review_count_'.$schema_id, 'saswp_array')){
2810
 
2811
  $input1['aggregateRating'] = array(
2812
  "@type" => "AggregateRating",
2898
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_organization_name_'.$schema_id, 'saswp_array'),
2899
  ),
2900
  );
2901
+
2902
+ if(isset($all_post_meta['saswp_newsarticle_speakable_'.$schema_id]) && $all_post_meta['saswp_newsarticle_speakable_'.$schema_id][0] == 1){
2903
+
2904
+ $input1['speakable']['@type'] = 'SpeakableSpecification';
2905
+ $input1['speakable']['xpath'] = array(
2906
+ "/html/head/title",
2907
+ "/html/head/meta[@name='description']/@content"
2908
+ );
2909
+
2910
+ }
2911
  if(!empty($aggregateRating)){
2912
  $input1['aggregateRating'] = $aggregateRating;
2913
  }
3307
 
3308
 
3309
 
3310
+ if(isset($all_post_meta['local_enable_rating_'.$schema_id]) && saswp_remove_warnings($all_post_meta, 'local_rating_'.$schema_id, 'saswp_array') && saswp_remove_warnings($all_post_meta, 'local_review_count_'.$schema_id, 'saswp_array')){
3311
 
3312
  $input1['aggregateRating'] = array(
3313
  "@type" => "AggregateRating",
3338
  $input1['hasMenu'] = esc_url($all_post_meta['local_menu_'.$schema_id][0]);
3339
  }
3340
 
3341
+ if(isset($all_post_meta['local_hasmap_'.$schema_id][0])){
3342
+ $input1['hasMap'] = esc_url($all_post_meta['local_hasmap_'.$schema_id][0]);
3343
+ }
3344
+
3345
  if(isset($all_post_meta['local_latitude_'.$schema_id][0]) && isset($all_post_meta['local_longitude_'.$schema_id][0])){
3346
 
3347
  $input1['geo']['@type'] = 'GeoCoordinates';
3356
  }
3357
 
3358
 
3359
+ if($schema_type != 'Review'){
3360
 
3361
  //kk star rating
3362
 
output/service.php CHANGED
@@ -91,6 +91,12 @@ Class saswp_output_service{
91
  if(isset($custom_fields['local_price_range'])){
92
  $input1['priceRange'] = $custom_fields['local_price_range'];
93
  }
 
 
 
 
 
 
94
 
95
  break;
96
 
@@ -1216,7 +1222,9 @@ Class saswp_output_service{
1216
  'local_website' => 'Website',
1217
  'local_business_logo' => 'Image',
1218
  'saswp_dayofweek' => 'Operation Days',
1219
- 'local_price_range' => 'Price Range',
 
 
1220
  );
1221
  break;
1222
 
@@ -1604,6 +1612,7 @@ Class saswp_output_service{
1604
  '@context' => 'http://schema.org',
1605
  '@type' => 'TechArticle',
1606
  '@id' => get_permalink().'/#techarticle',
 
1607
  'mainEntityOfPage' => get_permalink(),
1608
  'headline' => get_the_title(),
1609
  'description' => strip_tags(strip_shortcodes(get_the_excerpt())),
@@ -1633,6 +1642,7 @@ Class saswp_output_service{
1633
  '@context' => 'http://schema.org',
1634
  '@type' => 'Article',
1635
  '@id' => get_permalink().'/#article',
 
1636
  'mainEntityOfPage' => get_permalink(),
1637
  'headline' => get_the_title(),
1638
  'description' => strip_tags(strip_shortcodes(get_the_excerpt())),
@@ -1725,6 +1735,7 @@ Class saswp_output_service{
1725
  public function saswp_get_fetaure_image(){
1726
 
1727
  global $sd_data;
 
1728
  $input2 = array();
1729
  $image_id = get_post_thumbnail_id();
1730
  $image_details = wp_get_attachment_image_src($image_id, 'full');
@@ -1824,10 +1835,10 @@ Class saswp_output_service{
1824
  $k = 0;
1825
  foreach ($attachments[2] as $attachment) {
1826
 
1827
- $attach_details = saswp_get_attachment_details_by_url($attachment, $post->ID, $k );
1828
- if($attach_details){
1829
-
1830
-
1831
  $attach_images['image'][$k]['@type'] = 'ImageObject';
1832
  $attach_images['image'][$k]['url'] = esc_url($attachment);
1833
  $attach_images['image'][$k]['width'] = esc_attr($attach_details[0]);
@@ -1916,22 +1927,30 @@ Class saswp_output_service{
1916
  }
1917
 
1918
  }
1919
-
1920
- if($logo !='' && $height !='' && $width !=''){
1921
-
1922
- $publisher['publisher']['@type'] = 'Organization';
 
 
 
 
 
 
 
1923
  $publisher['publisher']['logo']['@type'] = 'ImageObject';
1924
  $publisher['publisher']['logo']['url'] = esc_url($logo);
1925
  $publisher['publisher']['logo']['width'] = esc_attr($width);
1926
  $publisher['publisher']['logo']['height']= esc_attr($height);
1927
- $publisher['publisher']['name'] = esc_attr($site_name);
1928
-
1929
  $default_logo['url'] = esc_url($logo);
1930
  $default_logo['height'] = esc_attr($height);
1931
  $default_logo['width'] = esc_attr($width);
1932
 
1933
- }
1934
-
 
 
1935
  if($d_logo){
1936
  return $default_logo;
1937
  }else{
91
  if(isset($custom_fields['local_price_range'])){
92
  $input1['priceRange'] = $custom_fields['local_price_range'];
93
  }
94
+ if(isset($custom_fields['local_hasmap'])){
95
+ $input1['hasMap'] = $custom_fields['local_hasmap'];
96
+ }
97
+ if(isset($custom_fields['local_menu'])){
98
+ $input1['hasMenu'] = $custom_fields['local_menu'];
99
+ }
100
 
101
  break;
102
 
1222
  'local_website' => 'Website',
1223
  'local_business_logo' => 'Image',
1224
  'saswp_dayofweek' => 'Operation Days',
1225
+ 'local_price_range' => 'Price Range',
1226
+ 'local_hasmap' => 'HasMap',
1227
+ 'local_menu' => 'Memu',
1228
  );
1229
  break;
1230
 
1612
  '@context' => 'http://schema.org',
1613
  '@type' => 'TechArticle',
1614
  '@id' => get_permalink().'/#techarticle',
1615
+ 'url' => get_permalink(),
1616
  'mainEntityOfPage' => get_permalink(),
1617
  'headline' => get_the_title(),
1618
  'description' => strip_tags(strip_shortcodes(get_the_excerpt())),
1642
  '@context' => 'http://schema.org',
1643
  '@type' => 'Article',
1644
  '@id' => get_permalink().'/#article',
1645
+ 'url' => get_permalink(),
1646
  'mainEntityOfPage' => get_permalink(),
1647
  'headline' => get_the_title(),
1648
  'description' => strip_tags(strip_shortcodes(get_the_excerpt())),
1735
  public function saswp_get_fetaure_image(){
1736
 
1737
  global $sd_data;
1738
+ global $post;
1739
  $input2 = array();
1740
  $image_id = get_post_thumbnail_id();
1741
  $image_details = wp_get_attachment_image_src($image_id, 'full');
1835
  $k = 0;
1836
  foreach ($attachments[2] as $attachment) {
1837
 
1838
+ $attach_details = saswp_get_attachment_details_by_url($attachment, $post->ID, $k );
1839
+
1840
+ if(!empty($attach_details)){
1841
+
1842
  $attach_images['image'][$k]['@type'] = 'ImageObject';
1843
  $attach_images['image'][$k]['url'] = esc_url($attachment);
1844
  $attach_images['image'][$k]['width'] = esc_attr($attach_details[0]);
1927
  }
1928
 
1929
  }
1930
+
1931
+
1932
+ if($site_name){
1933
+
1934
+
1935
+ $publisher['publisher']['@type'] = 'Organization';
1936
+ $publisher['publisher']['name'] = esc_attr($site_name);
1937
+
1938
+
1939
+ if($logo !='' && $height !='' && $width !=''){
1940
+
1941
  $publisher['publisher']['logo']['@type'] = 'ImageObject';
1942
  $publisher['publisher']['logo']['url'] = esc_url($logo);
1943
  $publisher['publisher']['logo']['width'] = esc_attr($width);
1944
  $publisher['publisher']['logo']['height']= esc_attr($height);
1945
+
 
1946
  $default_logo['url'] = esc_url($logo);
1947
  $default_logo['height'] = esc_attr($height);
1948
  $default_logo['width'] = esc_attr($width);
1949
 
1950
+ }
1951
+
1952
+ }
1953
+
1954
  if($d_logo){
1955
  return $default_logo;
1956
  }else{
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.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -66,10 +66,31 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
66
  == Changelog ==
67
 
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  = 1.8.3 (16 May 2019) =
70
 
71
  * Bug Fixed: Warning: getimagesize #271
72
 
 
73
  = 1.8.2 (13 May 2019) =
74
 
75
  * Bug Fixed: Warning: getimagesize #271
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.4
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.4 (22 May 2019) =
70
+
71
+ * Added: Accomodation Schema type ( House, Apartment and SingleFamilyResidence )#41
72
+ * Added: Speakable Schema type #79
73
+ * Added: HowTo Schema type #268
74
+ * Added: TvSeries Schema type #108
75
+ * Added: VideoGame Schema type #77
76
+ * Added: MedicalCondition Schema type #58
77
+ * Added: TouristAttraction Schema type #167
78
+ * Added: TouristDestination Schema type #167
79
+ * Added: PlaceOfWorship Schema type ( HinduTemple, Church and Mosque ) #167
80
+ * Bug Fixed: [BUG REPORT] Sorry, you are not allowed to access this page ( Multisite Issue ) #286
81
+ * Bug Fixed: Warning: count() ( Parameter must be an array or an object that implements Countable ) #273
82
+ * Bug Fixed: About and Contact page dropdown not appearing on setup wizard ( Multisite Issue ) #282
83
+ * Bug Fixed: PHP Error: Undefined offset #285
84
+ * Bug Fixed: Basic issues ( Image icon should come from plugin own directory and If the logo is not there, then it should show logo mission error ) #283
85
+ * Improvement: Product select should not have the fields on installer #266
86
+ * Improvement: HasMap field should be there in local schema #276
87
+
88
+
89
  = 1.8.3 (16 May 2019) =
90
 
91
  * Bug Fixed: Warning: getimagesize #271
92
 
93
+
94
  = 1.8.2 (13 May 2019) =
95
 
96
  * Bug Fixed: Warning: getimagesize #271
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.3
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.3');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
2
  /*
3
  Plugin Name: Schema & Structured Data for WP
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.4
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.4');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
view/post_specific.php CHANGED
@@ -7,7 +7,7 @@ class saswp_post_specific {
7
  protected $options_response = array();
8
  protected $modify_schema_post_enable = false;
9
 
10
-
11
  public function saswp_post_specific_hooks(){
12
 
13
  add_action( 'admin_init', array( $this, 'saswp_get_all_schema_list' ) );
@@ -89,11 +89,16 @@ class saswp_post_specific {
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();
99
  unset($show_post_types['adsforwp'],$show_post_types['saswp'],$show_post_types['attachment'], $show_post_types['revision'], $show_post_types['nav_menu_item'], $show_post_types['user_request'], $show_post_types['custom_css']);
@@ -101,7 +106,7 @@ class saswp_post_specific {
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
  }
@@ -119,11 +124,241 @@ class saswp_post_specific {
119
  }
120
  }
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  public function saswp_post_meta_box_fields($post){
123
 
124
- $tabs = '';
125
- $tabs_fields = '';
126
- $schema_ids = array();
 
 
 
127
 
128
  $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
129
 
@@ -143,7 +378,30 @@ class saswp_post_specific {
143
 
144
  $output = $this->saswp_saswp_post_specific( $post, $schema->ID );
145
  $schema_type = esc_sql ( get_post_meta($schema->ID, 'schema_type', true) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
 
 
 
 
 
 
 
147
  if($key==0){
148
 
149
  $tabs .='<li class="selected"><a saswp-schema-type="'.esc_attr($schema_type).'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links selected">'.esc_attr($schema->post_title).'</a>'
@@ -153,9 +411,304 @@ class saswp_post_specific {
153
  . '</li>';
154
 
155
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper">';
 
156
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
157
  $tabs_fields .= '</div>';
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }else{
160
 
161
  $tabs .='<li>'
@@ -165,9 +718,305 @@ class saswp_post_specific {
165
  . '<span class="saswp-slider"></span>'
166
  . '</li>';
167
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper saswp_hide">';
 
168
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
169
  $tabs_fields .= '</div>';
170
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  }
172
 
173
  $schema_ids[] =$schema->ID;
@@ -198,6 +1047,26 @@ class saswp_post_specific {
198
  $checked = 'checked';
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  $this->meta_fields = $response;
202
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
203
  $tabs_fields .= '<div>';
@@ -207,7 +1076,304 @@ class saswp_post_specific {
207
  . '<span class="saswp-slider"></span>'
208
  . '</div>';
209
  $tabs_fields .= '<div id="saswp_specific_'.esc_attr($all_schema[0]->ID).'" class="saswp-post-specific-wrapper">';
 
210
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  $tabs_fields .= '</div>';
212
  $tabs_fields .= '<input class="saswp-post-specific-schema-ids" type="hidden" value="'. json_encode($schema_ids).'">';
213
  $tabs_fields .= '</div>';
@@ -424,40 +1590,45 @@ class saswp_post_specific {
424
  if (strpos($meta_field['id'], 'business_logo') !== false && empty($media_value_meta)) {
425
 
426
  $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_local_business_details', true) );
427
- $media_value['height'] = $business_details['local_business_logo']['height'];
428
- $media_value['width'] = $business_details['local_business_logo']['width'];
429
- $media_value['thumbnail'] = $business_details['local_business_logo']['url'];
430
- }
431
-
432
- if (strpos($meta_field['id'], 'product_schema_image') !== false && empty($media_value_meta)) {
433
-
434
- $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_product_schema_details', true) );
435
- $media_value['height'] = $business_details['saswp_product_schema_image']['height'];
436
- $media_value['width'] = $business_details['saswp_product_schema_image']['width'];
437
- $media_value['thumbnail'] = $business_details['saswp_product_schema_image']['url'];
438
  }
439
 
 
440
  if (strpos($meta_field['id'], 'service_schema_image') !== false && empty($media_value_meta)) {
441
 
442
- $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_service_schema_details', true) );
443
- $media_value['height'] = $business_details['saswp_service_schema_image']['height'];
444
- $media_value['width'] = $business_details['saswp_service_schema_image']['width'];
445
- $media_value['thumbnail'] = $business_details['saswp_service_schema_image']['url'];
 
 
 
 
446
  }
447
 
448
  if (strpos($meta_field['id'], 'review_schema_image') !== false && empty($media_value_meta)) {
449
-
450
- $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
451
- $media_value['height'] = $business_details['saswp_review_schema_image']['height'];
452
- $media_value['width'] = $business_details['saswp_review_schema_image']['width'];
453
- $media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
 
 
454
  }
455
  if (strpos($meta_field['id'], 'event_schema_image') !== false && empty($media_value_meta)) {
456
 
457
- $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_event_schema_details', true) );
458
- $media_value['height'] = $business_details['saswp_event_schema_image']['height'];
459
- $media_value['width'] = $business_details['saswp_event_schema_image']['width'];
460
- $media_value['thumbnail'] = $business_details['saswp_event_schema_image']['url'];
 
 
461
  }
462
 
463
  $media_height = '';
@@ -678,7 +1849,7 @@ class saswp_post_specific {
678
  }
679
 
680
  public function saswp_post_specific_save_fields( $post_id ) {
681
-
682
  if ( ! isset( $_POST['post_specific_nonce'] ) )
683
  return $post_id;
684
  $nonce = $_POST['post_specific_nonce'];
@@ -704,36 +1875,157 @@ class saswp_post_specific {
704
  if($option != 'enable'){
705
  return;
706
  }
707
-
708
- $post_meta = array();
709
- $post_meta = $_POST;
 
 
 
 
 
 
 
 
 
710
 
711
- if(count($this->all_schema)>0){
712
 
713
  foreach($this->all_schema as $schema){
714
 
715
- $response = $this->saswp_get_fields_by_schema_type($schema->ID);
716
- $this->meta_fields = $response;
 
 
 
 
 
 
 
 
 
 
 
 
717
 
718
- foreach ( $this->meta_fields as $meta_field ) {
719
-
720
- if ( isset( $post_meta[ $meta_field['id'] ] ) ) {
721
-
722
- switch ( $meta_field['type'] ) {
723
-
724
- case 'media':
725
- $media_key = $meta_field['id'].'_detail';
726
- $media_height = sanitize_text_field( $post_meta[ $meta_field['id'].'_height' ] );
727
- $media_width = sanitize_text_field( $post_meta[ $meta_field['id'].'_width' ] );
728
- $media_thumbnail = sanitize_text_field( $post_meta[ $meta_field['id'].'_thumbnail' ] );
729
-
730
- $media_detail = array(
731
- 'height' => $media_height,
732
- 'width' => $media_width,
733
- 'thumbnail' => $media_thumbnail,
734
- );
735
-
736
- update_post_meta( $post_id, $media_key, $media_detail);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  break;
738
  case 'email':
739
  $post_meta[ $meta_field['id'] ] = sanitize_email( $post_meta[ $meta_field['id'] ] );
@@ -747,8 +2039,9 @@ class saswp_post_specific {
747
  } else if ( $meta_field['type'] === 'checkbox' ) {
748
  update_post_meta( $post_id, $meta_field['id'], '0' );
749
  }
750
- }
751
- }
 
752
  }
753
  }
754
 
@@ -1149,6 +2442,12 @@ class saswp_post_specific {
1149
  'id' => 'local_menu_'.$schema_id,
1150
  'type' => 'text',
1151
  'default' => $business_details['local_menu']
 
 
 
 
 
 
1152
  ),
1153
  array(
1154
  'label' => 'Serves Cuisine',
@@ -1239,7 +2538,13 @@ class saswp_post_specific {
1239
  'id' => 'saswp_blogposting_organization_logo_'.$schema_id,
1240
  'type' => 'media',
1241
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url'] : ''
1242
- )
 
 
 
 
 
 
1243
  );
1244
  break;
1245
 
@@ -1357,7 +2662,13 @@ class saswp_post_specific {
1357
  'id' => 'saswp_newsarticle_organization_logo_'.$schema_id,
1358
  'type' => 'media',
1359
  'default' => isset($sd_data['sd_logo'])? $sd_data['sd_logo']['url']:''
1360
- ),
 
 
 
 
 
 
1361
  );
1362
  break;
1363
 
@@ -1429,7 +2740,13 @@ class saswp_post_specific {
1429
  'id' => 'saswp_webpage_organization_logo_'.$schema_id,
1430
  'type' => 'media',
1431
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
1432
- ),
 
 
 
 
 
 
1433
  );
1434
  break;
1435
 
@@ -1488,7 +2805,13 @@ class saswp_post_specific {
1488
  'id' => 'saswp_article_organization_logo_'.$schema_id,
1489
  'type' => 'media',
1490
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
1491
- )
 
 
 
 
 
 
1492
  );
1493
  break;
1494
 
@@ -1656,7 +2979,13 @@ class saswp_post_specific {
1656
  'id' => 'saswp_tech_article_organization_logo_'.$schema_id,
1657
  'type' => 'media',
1658
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
1659
- )
 
 
 
 
 
 
1660
  );
1661
  break;
1662
 
@@ -1950,56 +3279,48 @@ class saswp_post_specific {
1950
  break;
1951
 
1952
  case 'Product':
1953
- $product_schema_details = esc_sql ( get_post_meta($schema_id, 'saswp_product_schema_details', true) );
1954
  $meta_field = array(
1955
 
1956
  array(
1957
  'label' => 'Name',
1958
  'id' => 'saswp_product_schema_name_'.$schema_id,
1959
- 'type' => 'text',
1960
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_name', 'saswp_string'),
1961
  ),
1962
  array(
1963
  'label' => 'Description',
1964
  'id' => 'saswp_product_schema_description_'.$schema_id,
1965
- 'type' => 'textarea',
1966
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_description', 'saswp_string'),
1967
  ),
1968
  array(
1969
  'label' => 'Image',
1970
  'id' => 'saswp_product_schema_image_'.$schema_id,
1971
- 'type' => 'media',
1972
- 'default' => $product_schema_details['saswp_product_schema_image']['url'],
1973
  ),
1974
  array(
1975
  'label' => 'Brand Name',
1976
  'id' => 'saswp_product_schema_brand_name_'.$schema_id,
1977
- 'type' => 'text',
1978
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_brand_name', 'saswp_string'),
1979
  ),
1980
  array(
1981
  'label' => 'Price',
1982
  'id' => 'saswp_product_schema_price_'.$schema_id,
1983
- 'type' => 'text',
1984
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_price', 'saswp_string'),
1985
  ),
1986
  array(
1987
  'label' => 'Price Valid Until',
1988
  'id' => 'saswp_product_schema_priceValidUntil_'.$schema_id,
1989
- 'type' => 'text',
1990
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_priceValidUntil', 'saswp_string'),
1991
  ),
1992
  array(
1993
  'label' => 'Currency',
1994
  'id' => 'saswp_product_schema_currency_'.$schema_id,
1995
- 'type' => 'text',
1996
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_currency', 'saswp_string'),
1997
  ),
1998
  array(
1999
  'label' => 'Availability',
2000
  'id' => 'saswp_product_schema_availability_'.$schema_id,
2001
- 'type' => 'select',
2002
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_availability', 'saswp_string'),
2003
  'options' => array(
2004
  'InStock' => 'In Stock',
2005
  'OutOfStock' => 'Out Of Stock',
@@ -2010,8 +3331,7 @@ class saswp_post_specific {
2010
  array(
2011
  'label' => 'Condition',
2012
  'id' => 'saswp_product_schema_condition_'.$schema_id,
2013
- 'type' => 'select',
2014
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_condition', 'saswp_string'),
2015
  'options' => array(
2016
  'NewCondition' => 'New',
2017
  'UsedCondition' => 'Used',
@@ -2022,46 +3342,39 @@ class saswp_post_specific {
2022
  array(
2023
  'label' => 'SKU',
2024
  'id' => 'saswp_product_schema_sku_'.$schema_id,
2025
- 'type' => 'text',
2026
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_sku', 'saswp_string'),
2027
  ),
2028
  array(
2029
  'label' => 'MPN',
2030
  'id' => 'saswp_product_schema_mpn_'.$schema_id,
2031
  'type' => 'text',
2032
- 'note' => 'OR',
2033
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_mpn', 'saswp_string'),
2034
  ),
2035
  array(
2036
  'label' => 'ISBN',
2037
  'id' => 'saswp_product_schema_isbn_'.$schema_id,
2038
  'type' => 'text',
2039
- 'note' => 'OR',
2040
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_isbn', 'saswp_string'),
2041
  ),
2042
  array(
2043
  'label' => 'GTIN8',
2044
  'id' => 'saswp_product_schema_gtin8_'.$schema_id,
2045
- 'type' => 'text',
2046
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_gtin8', 'saswp_string'),
2047
  ),
2048
  array(
2049
  'label' => 'Aggregate Rating',
2050
  'id' => 'saswp_product_schema_enable_rating_'.$schema_id,
2051
- 'type' => 'checkbox',
2052
- //'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_enable_rating', 'saswp_string')
2053
  ),
2054
  array(
2055
  'label' => 'Rating',
2056
  'id' => 'saswp_product_schema_rating_'.$schema_id,
2057
- 'type' => 'text',
2058
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_rating', 'saswp_string')
2059
  ),
2060
  array(
2061
  'label' => 'Number of Reviews',
2062
  'id' => 'saswp_product_schema_review_count_'.$schema_id,
2063
- 'type' => 'text',
2064
- 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_review_count', 'saswp_string')
2065
  ),
2066
 
2067
  );
@@ -2574,6 +3887,911 @@ class saswp_post_specific {
2574
  );
2575
  break;
2576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2577
  default:
2578
  break;
2579
  }
7
  protected $options_response = array();
8
  protected $modify_schema_post_enable = false;
9
 
10
+
11
  public function saswp_post_specific_hooks(){
12
 
13
  add_action( 'admin_init', array( $this, 'saswp_get_all_schema_list' ) );
89
  global $post;
90
 
91
  $post_specific_id = '';
92
+ $schema_count = 0;
93
  if(is_object($post)){
94
  $post_specific_id = $post->ID;
95
  }
96
+ if(!empty($this->all_schema)){
97
+ $schema_count = count($this->all_schema);
98
+ }
99
+
100
  $custom_option = get_option('custom_schema_post_enable_'.esc_attr($post->ID));
101
+ if($schema_count > 0 && get_post_status($post_specific_id)=='publish'){
102
 
103
  $show_post_types = get_post_types();
104
  unset($show_post_types['adsforwp'],$show_post_types['saswp'],$show_post_types['attachment'], $show_post_types['revision'], $show_post_types['nav_menu_item'], $show_post_types['user_request'], $show_post_types['custom_css']);
106
 
107
  foreach ( $this->screen as $single_screen ) {
108
  $post_title = '';
109
+ if($schema_count == 1 && $custom_option !='enable'){
110
  $all_schemas = $this->all_schema;
111
  $post_title = '('.get_post_meta($all_schemas[0]->ID, 'schema_type', true).')';
112
  }
124
  }
125
  }
126
 
127
+ public function saswp_get_dynamic_html($schema_id, $meta_name, $index, $data){
128
+
129
+
130
+ switch ($meta_name) {
131
+
132
+ case 'howto_supply':
133
+
134
+ $meta_fields = array(
135
+
136
+ array(
137
+ 'label' => 'Supply Name',
138
+ 'name' => 'saswp_howto_supply_name',
139
+ 'type' => 'text',
140
+ ),
141
+ array(
142
+ 'label' => 'Supply Image',
143
+ 'name' => 'saswp_howto_supply_image',
144
+ 'type' => 'media',
145
+ ),
146
+
147
+ );
148
+
149
+ break;
150
+
151
+ case 'howto_tool':
152
+
153
+ $meta_fields = array(
154
+
155
+ array(
156
+ 'label' => 'Tool Name',
157
+ 'name' => 'saswp_howto_tool_name',
158
+ 'type' => 'text',
159
+ ),
160
+ array(
161
+ 'label' => 'Tool Image',
162
+ 'name' => 'saswp_howto_tool_image',
163
+ 'type' => 'media',
164
+ ),
165
+
166
+ );
167
+
168
+ break;
169
+
170
+ case 'howto_step':
171
+
172
+ $meta_fields = array(
173
+
174
+ array(
175
+ 'label' => 'Step Name',
176
+ 'name' => 'saswp_howto_step_name',
177
+ 'type' => 'text',
178
+ ),
179
+ array(
180
+ 'label' => 'HowToDirection Text',
181
+ 'name' => 'saswp_howto_direction_text',
182
+ 'type' => 'text',
183
+ ),
184
+ array(
185
+ 'label' => 'HowToTip Text',
186
+ 'name' => 'saswp_howto_tip_text',
187
+ 'type' => 'text',
188
+ ),
189
+ array(
190
+ 'label' => 'Step Image',
191
+ 'name' => 'saswp_howto_step_image',
192
+ 'type' => 'media',
193
+ ),
194
+
195
+ );
196
+
197
+ break;
198
+
199
+ case 'mc_symptom':
200
+
201
+ $meta_fields = array(
202
+
203
+ array(
204
+ 'label' => 'Sign Or Symptom',
205
+ 'name' => 'saswp_mc_symptom_name',
206
+ 'type' => 'text',
207
+ )
208
+
209
+ );
210
+
211
+ break;
212
+
213
+ case 'mc_risk_factor':
214
+
215
+ $meta_fields = array(
216
+
217
+ array(
218
+ 'label' => 'Risk Factor',
219
+ 'name' => 'saswp_mc_risk_factor_name',
220
+ 'type' => 'text',
221
+ )
222
+
223
+ );
224
+
225
+ break;
226
+
227
+ case 'mc_cause':
228
+
229
+ $meta_fields = array(
230
+
231
+ array(
232
+ 'label' => 'Cause',
233
+ 'name' => 'saswp_mc_cause_name',
234
+ 'type' => 'text',
235
+ )
236
+
237
+ );
238
+
239
+ break;
240
+
241
+
242
+ case 'tvseries_actor':
243
+
244
+ $meta_fields = array(
245
+
246
+ array(
247
+ 'label' => 'Actor Name',
248
+ 'name' => 'saswp_tvseries_actor_name',
249
+ 'type' => 'text',
250
+ )
251
+
252
+ );
253
+
254
+ break;
255
+
256
+ case 'tvseries_season':
257
+
258
+ $meta_fields = array(
259
+
260
+ array(
261
+ 'label' => 'Season Name',
262
+ 'name' => 'saswp_tvseries_season_name',
263
+ 'type' => 'text',
264
+ ),
265
+ array(
266
+ 'label' => 'Season Published Date',
267
+ 'name' => 'saswp_tvseries_season_published_date',
268
+ 'type' => 'text',
269
+ ),
270
+ array(
271
+ 'label' => 'Number Of Episodes',
272
+ 'name' => 'saswp_tvseries_season_episodes',
273
+ 'type' => 'text',
274
+ )
275
+ );
276
+
277
+ break;
278
+
279
+
280
+ default:
281
+ break;
282
+ }
283
+
284
+
285
+ $output = '';
286
+ foreach ( $meta_fields as $meta_field ) {
287
+
288
+
289
+ $label = '<label for="' . $meta_field['name'] . '">' . esc_html__( $meta_field['label'], 'schema-and-structured-data-for-wp' ) . '</label>';
290
+
291
+ switch ( $meta_field['type'] ) {
292
+
293
+
294
+
295
+ case 'media':
296
+ $name = $meta_field['name'].'_'.$index.'_'.$schema_id;
297
+
298
+ $img_prev = '';
299
+ $src = '';
300
+
301
+ if(wp_get_attachment_url($data[$meta_field['name'].'_id'])){
302
+
303
+ $src = wp_get_attachment_url(esc_attr($data[$meta_field['name'].'_id']));
304
+
305
+ $img_prev = '<div class="saswp_image_thumbnail">'
306
+ . '<img class="saswp_image_prev" src="'.esc_url($src).'">'
307
+ . '<a data-id="'.$name.'" href="#" class="saswp_prev_close">X</a>'
308
+ . '</div>';
309
+
310
+ }
311
+
312
+
313
+ $input = '<fieldset>
314
+ <input style="width:79%" type="text" id="'.$name.'" name="'.$name.'" value="'.esc_url($src).'">
315
+ <input type="hidden" data-id="'.$name.'_id" name="'.$meta_name.'_'.$schema_id.'['.$index.']['.$meta_field['name'].'_id]'.'" id="'.$name.'_id" value="'.esc_attr($data[$meta_field['name'].'_id']).'">
316
+ <input data-id="media" style="width: 19%" class="button" id="'.$name.'_button" name="'.$name.'_button" type="button" value="Upload">
317
+ <div class="saswp_image_div_'.$name.'">'.$img_prev.'</div>
318
+ </fieldset>';
319
+
320
+
321
+
322
+ break;
323
+
324
+ default:
325
+
326
+ $class = '';
327
+
328
+ if (strpos($meta_field['name'].'_'.$index.'_'.$schema_id, 'published_date') !== false){
329
+
330
+ $class = 'class="saswp-local-schema-datepicker-picker"';
331
+ }
332
+
333
+ $input = sprintf(
334
+ '<input %s style="width:100%%" id="%s" name="%s" type="%s" value="%s">',
335
+ $class,
336
+ $meta_field['name'].'_'.$index.'_'.$schema_id,
337
+ $meta_name.'_'.$schema_id.'['.$index.']['.$meta_field['name'].']',
338
+ $meta_field['type'],
339
+ $data[$meta_field['name']]
340
+ );
341
+
342
+
343
+ }
344
+
345
+ $output .= '<tr><th>'.$label.'</th><td>'.$input.'</td></tr>';
346
+ }
347
+
348
+
349
+ $response = '<table class="form-table">'.$output.'</table>';
350
+ return $response;
351
+
352
+ }
353
+
354
  public function saswp_post_meta_box_fields($post){
355
 
356
+ $tabs = '';
357
+ $tabs_fields = '';
358
+ $schema_ids = array();
359
+ $howto_data = array();
360
+ $mc_data = array();
361
+ $tvseries_data = array();
362
 
363
  $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
364
 
378
 
379
  $output = $this->saswp_saswp_post_specific( $post, $schema->ID );
380
  $schema_type = esc_sql ( get_post_meta($schema->ID, 'schema_type', true) );
381
+
382
+ if($schema_type == 'HowTo'){
383
+
384
+ $howto_data['howto_tool_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'howto_tool_'.$schema->ID, true) );
385
+ $howto_data['howto_step_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'howto_step_'.$schema->ID, true) );
386
+ $howto_data['howto_supply_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'howto_supply_'.$schema->ID, true) );
387
+
388
+ }
389
+
390
+ if($schema_type == 'MedicalCondition'){
391
+
392
+ $mc_data['mc_cause_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'mc_cause_'.$schema->ID, true) );
393
+ $mc_data['mc_symptom_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'mc_symptom_'.$schema->ID, true) );
394
+ $mc_data['mc_risk_factor_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'mc_risk_factor_'.$schema->ID, true) );
395
+
396
+ }
397
 
398
+ if($schema_type == 'TVSeries'){
399
+
400
+ $tvseries_data['tvseries_actor_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'tvseries_actor_'.$schema->ID, true) );
401
+ $tvseries_data['tvseries_season_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'tvseries_season_'.$schema->ID, true) );
402
+
403
+ }
404
+
405
  if($key==0){
406
 
407
  $tabs .='<li class="selected"><a saswp-schema-type="'.esc_attr($schema_type).'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links selected">'.esc_attr($schema->post_title).'</a>'
411
  . '</li>';
412
 
413
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper">';
414
+ $tabs_fields .= '<div class="saswp-table-create-onload">';
415
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
416
  $tabs_fields .= '</div>';
417
 
418
+ //How to schema starts here
419
+ if($schema_type == 'HowTo'){
420
+
421
+ $schema_id = $schema->ID;
422
+
423
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
424
+
425
+
426
+ //supply section starts here
427
+ $tabs_fields .= '<div class="saswp-how-to-supply-section-main">';
428
+ $tabs_fields .= '<div class="saswp-how-to-supply-section" data-id="'.esc_attr($schema_id).'">';
429
+ if(isset($howto_data['howto_supply_'.$schema_id])){
430
+
431
+ $howto_supply = $howto_data['howto_supply_'.$schema_id];
432
+ $supply_html = '';
433
+
434
+ if(!empty($howto_supply)){
435
+
436
+ $i = 0;
437
+ foreach ($howto_supply as $supply){
438
+
439
+ $supply_html .= '<div class="saswp-how-to-supply-table-div" data-id="'.$i.'">';
440
+ $supply_html .= '<a class="saswp-table-close">X</a>';
441
+ $supply_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_supply', $i, $supply);
442
+ $supply_html .= '</div>';
443
+
444
+ $i++;
445
+ }
446
+
447
+ }
448
+
449
+ $tabs_fields .= $supply_html;
450
+
451
+ }
452
+ $tabs_fields .= '</div>';
453
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-supply">Add HowTo Supply</a>';
454
+ $tabs_fields .= '</div>';
455
+ //supply section ends here here
456
+
457
+ //tool section starts here
458
+ $tabs_fields .= '<div class="saswp-how-to-tool-section-main">';
459
+ $tabs_fields .= '<div class="saswp-how-to-tool-section" data-id="'.esc_attr($schema_id).'">';
460
+ if(isset($howto_data['howto_tool_'.$schema_id])){
461
+
462
+ $howto_tool = $howto_data['howto_tool_'.$schema_id];
463
+ $tool_html = '';
464
+
465
+ if(!empty($howto_tool)){
466
+
467
+ $i = 0;
468
+ foreach ($howto_tool as $tool){
469
+
470
+ $tool_html .= '<div class="saswp-how-to-tool-table-div" data-id="'.$i.'">';
471
+ $tool_html .= '<a class="saswp-table-close">X</a>';
472
+ $tool_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_tool', $i, $tool);
473
+ $tool_html .= '</div>';
474
+
475
+ $i++;
476
+ }
477
+
478
+ }
479
+
480
+ $tabs_fields .= $tool_html;
481
+
482
+ }
483
+ $tabs_fields .= '</div>';
484
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-tool">Add HowTo Tool</a>';
485
+ $tabs_fields .= '</div>';
486
+ //tool section ends here here
487
+
488
+ //step section starts here here
489
+ $tabs_fields .= '<div class="saswp-how-to-step-section-main">';
490
+ $tabs_fields .= '<div class="saswp-how-to-step-section" data-id="'.esc_attr($schema_id).'">';
491
+ if(isset($howto_data['howto_step_'.$schema_id])){
492
+
493
+ $howto_step = $howto_data['howto_step_'.$schema_id];
494
+ $step_html = '';
495
+
496
+ if(!empty($howto_step)){
497
+
498
+ $i = 0;
499
+ foreach ($howto_step as $step){
500
+
501
+ $step_html .= '<div class="saswp-how-to-step-table-div" data-id="'.$i.'">';
502
+ $step_html .= '<a class="saswp-table-close">X</a>';
503
+ $step_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_step', $i, $step);
504
+ $step_html .= '</div>';
505
+
506
+ $i++;
507
+ }
508
+
509
+ }
510
+
511
+ $tabs_fields .= $step_html;
512
+
513
+ }
514
+ $tabs_fields .= '</div>';
515
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-step">Add HowTo Step</a>';
516
+ $tabs_fields .= '</div>';
517
+ //step section ends here here
518
+
519
+
520
+ $tabs_fields .= '</div>';
521
+ }
522
+ //How to schema ends here
523
+
524
+ //Medical condition schema starts here
525
+ if($schema_type == 'MedicalCondition'){
526
+
527
+ $schema_id = $schema->ID;
528
+
529
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
530
+
531
+
532
+ //cause section starts here
533
+
534
+ $tabs_fields .= '<div class="saswp-mc-cause-section-main">';
535
+ $tabs_fields .= '<div class="saswp-mc-cause-section" data-id="'.esc_attr($schema_id).'">';
536
+ if(isset($mc_data['mc_cause_'.$schema_id])){
537
+
538
+ $mc_cause = $mc_data['mc_cause_'.$schema_id];
539
+
540
+ $cause_html = '';
541
+
542
+ if(!empty($mc_cause)){
543
+
544
+ $i = 0;
545
+ foreach ($mc_cause as $cause){
546
+
547
+ $cause_html .= '<div class="saswp-mc-cause-table-div" data-id="'.$i.'">';
548
+ $cause_html .= '<a class="saswp-table-close">X</a>';
549
+ $cause_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_cause', $i, $cause);
550
+ $cause_html .= '</div>';
551
+
552
+ $i++;
553
+ }
554
+
555
+ }
556
+
557
+ $tabs_fields .= $cause_html;
558
+
559
+ }
560
+ $tabs_fields .= '</div>';
561
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-cause">Add MC Cause</a>';
562
+ $tabs_fields .= '</div>';
563
+
564
+ //cause section ends here here
565
+
566
+ //symptom section starts here
567
+ $tabs_fields .= '<div class="saswp-mc-symptom-section-main">';
568
+ $tabs_fields .= '<div class="saswp-mc-symptom-section" data-id="'.esc_attr($schema_id).'">';
569
+ if(isset($mc_data['mc_symptom_'.$schema_id])){
570
+
571
+ $mc_symptom = $mc_data['mc_symptom_'.$schema_id];
572
+ $symptom_html = '';
573
+
574
+ if(!empty($mc_symptom)){
575
+
576
+ $i = 0;
577
+ foreach ($mc_symptom as $symptom){
578
+
579
+ $symptom_html .= '<div class="saswp-mc-symptom-table-div" data-id="'.$i.'">';
580
+ $symptom_html .= '<a class="saswp-table-close">X</a>';
581
+ $symptom_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_symptom', $i, $symptom);
582
+ $symptom_html .= '</div>';
583
+
584
+ $i++;
585
+ }
586
+
587
+ }
588
+
589
+ $tabs_fields .= $symptom_html;
590
+
591
+ }
592
+ $tabs_fields .= '</div>';
593
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-symptom">Add MC Symptom</a>';
594
+ $tabs_fields .= '</div>';
595
+ //symptom section ends here
596
+
597
+ //risk factor starts here
598
+ $tabs_fields .= '<div class="saswp-mc-risk_factor-section-main">';
599
+ $tabs_fields .= '<div class="saswp-mc-risk_factor-section" data-id="'.esc_attr($schema_id).'">';
600
+ if(isset($mc_data['mc_risk_factor_'.$schema_id])){
601
+
602
+ $mc_risk_factor = $mc_data['mc_risk_factor_'.$schema_id];
603
+ $risk_factor_html = '';
604
+
605
+ if(!empty($mc_risk_factor)){
606
+
607
+ $i = 0;
608
+ foreach ($mc_risk_factor as $risk_factor){
609
+
610
+ $risk_factor_html .= '<div class="saswp-mc-risk_factor-table-div" data-id="'.$i.'">';
611
+ $risk_factor_html .= '<a class="saswp-table-close">X</a>';
612
+ $risk_factor_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_risk_factor', $i, $risk_factor);
613
+ $risk_factor_html .= '</div>';
614
+
615
+ $i++;
616
+ }
617
+
618
+ }
619
+
620
+ $tabs_fields .= $risk_factor_html;
621
+
622
+ }
623
+ $tabs_fields .= '</div>';
624
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-risk_factor">Add MC Risk Factor</a>';
625
+ $tabs_fields .= '</div>';
626
+ //risk factor ends here
627
+
628
+ $tabs_fields .= '</div>';
629
+ }
630
+ //Medical condition schema ends here
631
+
632
+ //TVSeries schema starts herre
633
+ if($schema_type == 'TVSeries'){
634
+
635
+ $schema_id = $schema->ID;
636
+
637
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
638
+
639
+ //actor section starts here
640
+ $tabs_fields .= '<div class="saswp-tvseries-actor-section-main">';
641
+ $tabs_fields .= '<div class="saswp-tvseries-actor-section" data-id="'.esc_attr($schema_id).'">';
642
+ if(isset($tvseries_data['tvseries_actor_'.$schema_id])){
643
+
644
+ $tvseries_actor = $tvseries_data['tvseries_actor_'.$schema_id];
645
+
646
+ $actor_html = '';
647
+
648
+ if(!empty($tvseries_actor)){
649
+
650
+ $i = 0;
651
+ foreach ($tvseries_actor as $actor){
652
+
653
+ $actor_html .= '<div class="saswp-tvseries-actor-table-div" data-id="'.$i.'">';
654
+ $actor_html .= '<a class="saswp-table-close">X</a>';
655
+ $actor_html .= $this->saswp_get_dynamic_html($schema_id, 'tvseries_actor', $i, $actor);
656
+ $actor_html .= '</div>';
657
+
658
+ $i++;
659
+ }
660
+
661
+ }
662
+
663
+ $tabs_fields .= $actor_html;
664
+
665
+ }
666
+ $tabs_fields .= '</div>';
667
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-tvseries-actor">Add TVSeries Actor</a>';
668
+ $tabs_fields .= '</div>';
669
+ //actor section ends here here
670
+
671
+ //season section starts here
672
+
673
+ $tabs_fields .= '<div class="saswp-tvseries-season-section-main">';
674
+ $tabs_fields .= '<div class="saswp-tvseries-season-section" data-id="'.esc_attr($schema_id).'">';
675
+ if(isset($tvseries_data['tvseries_season_'.$schema_id])){
676
+
677
+ $tvseries_season = $tvseries_data['tvseries_season_'.$schema_id];
678
+
679
+ $season_html = '';
680
+
681
+ if(!empty($tvseries_season)){
682
+
683
+ $i = 0;
684
+ foreach ($tvseries_season as $season){
685
+
686
+ $season_html .= '<div class="saswp-tvseries-season-table-div" data-id="'.$i.'">';
687
+ $season_html .= '<a class="saswp-table-close">X</a>';
688
+ $season_html .= $this->saswp_get_dynamic_html($schema_id, 'tvseries_season', $i, $season);
689
+ $season_html .= '</div>';
690
+
691
+ $i++;
692
+ }
693
+
694
+ }
695
+
696
+ $tabs_fields .= $season_html;
697
+
698
+ }
699
+ $tabs_fields .= '</div>';
700
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-tvseries-season">Add TVSeries Season</a>';
701
+ $tabs_fields .= '</div>';
702
+
703
+ //season section ends here
704
+
705
+
706
+ $tabs_fields .= '</div>';
707
+ }
708
+ //TvSeries schema ends here
709
+
710
+ $tabs_fields .= '</div>';
711
+
712
  }else{
713
 
714
  $tabs .='<li>'
718
  . '<span class="saswp-slider"></span>'
719
  . '</li>';
720
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper saswp_hide">';
721
+ $tabs_fields .= '<div class="saswp-table-create-onload">';
722
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
723
  $tabs_fields .= '</div>';
724
 
725
+ //How to schema starts here
726
+ if($schema_type == 'HowTo'){
727
+
728
+ $schema_id = $schema->ID;
729
+
730
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
731
+
732
+
733
+ //supply section starts here
734
+ $tabs_fields .= '<div class="saswp-how-to-supply-section-main">';
735
+ $tabs_fields .= '<div class="saswp-how-to-supply-section" data-id="'.esc_attr($schema_id).'">';
736
+ if(isset($howto_data['howto_supply_'.$schema_id])){
737
+
738
+ $howto_supply = $howto_data['howto_supply_'.$schema_id];
739
+ $supply_html = '';
740
+
741
+ if(!empty($howto_supply)){
742
+
743
+ $i = 0;
744
+ foreach ($howto_supply as $supply){
745
+
746
+ $supply_html .= '<div class="saswp-how-to-supply-table-div" data-id="'.$i.'">';
747
+ $supply_html .= '<a class="saswp-table-close">X</a>';
748
+ $supply_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_supply', $i, $supply);
749
+ $supply_html .= '</div>';
750
+
751
+ $i++;
752
+ }
753
+
754
+ }
755
+
756
+ $tabs_fields .= $supply_html;
757
+
758
+ }
759
+ $tabs_fields .= '</div>';
760
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-supply">Add HowTo Supply</a>';
761
+ $tabs_fields .= '</div>';
762
+ //supply section ends here here
763
+
764
+ //tool section starts here
765
+ $tabs_fields .= '<div class="saswp-how-to-tool-section-main">';
766
+ $tabs_fields .= '<div class="saswp-how-to-tool-section" data-id="'.esc_attr($schema_id).'">';
767
+ if(isset($howto_data['howto_tool_'.$schema_id])){
768
+
769
+ $howto_tool = $howto_data['howto_tool_'.$schema_id];
770
+ $tool_html = '';
771
+
772
+ if(!empty($howto_tool)){
773
+
774
+ $i = 0;
775
+ foreach ($howto_tool as $tool){
776
+
777
+ $tool_html .= '<div class="saswp-how-to-tool-table-div" data-id="'.$i.'">';
778
+ $tool_html .= '<a class="saswp-table-close">X</a>';
779
+ $tool_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_tool', $i, $tool);
780
+ $tool_html .= '</div>';
781
+
782
+ $i++;
783
+ }
784
+
785
+ }
786
+
787
+ $tabs_fields .= $tool_html;
788
+
789
+ }
790
+ $tabs_fields .= '</div>';
791
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-tool">Add HowTo Tool</a>';
792
+ $tabs_fields .= '</div>';
793
+ //tool section ends here here
794
+
795
+ //step section starts here here
796
+ $tabs_fields .= '<div class="saswp-how-to-step-section-main">';
797
+ $tabs_fields .= '<div class="saswp-how-to-step-section" data-id="'.esc_attr($schema_id).'">';
798
+ if(isset($howto_data['howto_step_'.$schema_id])){
799
+
800
+ $howto_step = $howto_data['howto_step_'.$schema_id];
801
+ $step_html = '';
802
+
803
+ if(!empty($howto_step)){
804
+
805
+ $i = 0;
806
+ foreach ($howto_step as $step){
807
+
808
+ $step_html .= '<div class="saswp-how-to-step-table-div" data-id="'.$i.'">';
809
+ $step_html .= '<a class="saswp-table-close">X</a>';
810
+ $step_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_step', $i, $step);
811
+ $step_html .= '</div>';
812
+
813
+ $i++;
814
+ }
815
+
816
+ }
817
+
818
+ $tabs_fields .= $step_html;
819
+
820
+ }
821
+ $tabs_fields .= '</div>';
822
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-step">Add HowTo Step</a>';
823
+ $tabs_fields .= '</div>';
824
+ //step section ends here here
825
+
826
+
827
+ $tabs_fields .= '</div>';
828
+ }
829
+ //How to schema ends here
830
+
831
+ //Medical condition schema starts here
832
+ if($schema_type == 'MedicalCondition'){
833
+
834
+ $schema_id = $schema->ID;
835
+
836
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
837
+
838
+
839
+ //cause section starts here
840
+
841
+ $tabs_fields .= '<div class="saswp-mc-cause-section-main">';
842
+ $tabs_fields .= '<div class="saswp-mc-cause-section" data-id="'.esc_attr($schema_id).'">';
843
+ if(isset($mc_data['mc_cause_'.$schema_id])){
844
+
845
+ $mc_cause = $mc_data['mc_cause_'.$schema_id];
846
+
847
+ $cause_html = '';
848
+
849
+ if(!empty($mc_cause)){
850
+
851
+ $i = 0;
852
+ foreach ($mc_cause as $cause){
853
+
854
+ $cause_html .= '<div class="saswp-mc-cause-table-div" data-id="'.$i.'">';
855
+ $cause_html .= '<a class="saswp-table-close">X</a>';
856
+ $cause_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_cause', $i, $cause);
857
+ $cause_html .= '</div>';
858
+
859
+ $i++;
860
+ }
861
+
862
+ }
863
+
864
+ $tabs_fields .= $cause_html;
865
+
866
+ }
867
+ $tabs_fields .= '</div>';
868
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-cause">Add MC Cause</a>';
869
+ $tabs_fields .= '</div>';
870
+
871
+ //cause section ends here here
872
+
873
+ //symptom section starts here
874
+ $tabs_fields .= '<div class="saswp-mc-symptom-section-main">';
875
+ $tabs_fields .= '<div class="saswp-mc-symptom-section" data-id="'.esc_attr($schema_id).'">';
876
+ if(isset($mc_data['mc_symptom_'.$schema_id])){
877
+
878
+ $mc_symptom = $mc_data['mc_symptom_'.$schema_id];
879
+ $symptom_html = '';
880
+
881
+ if(!empty($mc_symptom)){
882
+
883
+ $i = 0;
884
+ foreach ($mc_symptom as $symptom){
885
+
886
+ $symptom_html .= '<div class="saswp-mc-symptom-table-div" data-id="'.$i.'">';
887
+ $symptom_html .= '<a class="saswp-table-close">X</a>';
888
+ $symptom_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_symptom', $i, $symptom);
889
+ $symptom_html .= '</div>';
890
+
891
+ $i++;
892
+ }
893
+
894
+ }
895
+
896
+ $tabs_fields .= $symptom_html;
897
+
898
+ }
899
+ $tabs_fields .= '</div>';
900
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-symptom">Add MC Symptom</a>';
901
+ $tabs_fields .= '</div>';
902
+ //symptom section ends here
903
+
904
+ //risk factor starts here
905
+ $tabs_fields .= '<div class="saswp-mc-risk_factor-section-main">';
906
+ $tabs_fields .= '<div class="saswp-mc-risk_factor-section" data-id="'.esc_attr($schema_id).'">';
907
+ if(isset($mc_data['mc_risk_factor_'.$schema_id])){
908
+
909
+ $mc_risk_factor = $mc_data['mc_risk_factor_'.$schema_id];
910
+ $risk_factor_html = '';
911
+
912
+ if(!empty($mc_risk_factor)){
913
+
914
+ $i = 0;
915
+ foreach ($mc_risk_factor as $risk_factor){
916
+
917
+ $risk_factor_html .= '<div class="saswp-mc-risk_factor-table-div" data-id="'.$i.'">';
918
+ $risk_factor_html .= '<a class="saswp-table-close">X</a>';
919
+ $risk_factor_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_risk_factor', $i, $risk_factor);
920
+ $risk_factor_html .= '</div>';
921
+
922
+ $i++;
923
+ }
924
+
925
+ }
926
+
927
+ $tabs_fields .= $risk_factor_html;
928
+
929
+ }
930
+ $tabs_fields .= '</div>';
931
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-risk_factor">Add MC Risk Factor</a>';
932
+ $tabs_fields .= '</div>';
933
+ //risk factor ends here
934
+
935
+ $tabs_fields .= '</div>';
936
+ }
937
+ //Medical condition schema ends here
938
+
939
+ //TVSeries schema starts herre
940
+ if($schema_type == 'TVSeries'){
941
+
942
+ $schema_id = $schema->ID;
943
+
944
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
945
+
946
+ //actor section starts here
947
+ $tabs_fields .= '<div class="saswp-tvseries-actor-section-main">';
948
+ $tabs_fields .= '<div class="saswp-tvseries-actor-section" data-id="'.esc_attr($schema_id).'">';
949
+ if(isset($tvseries_data['tvseries_actor_'.$schema_id])){
950
+
951
+ $tvseries_actor = $tvseries_data['tvseries_actor_'.$schema_id];
952
+
953
+ $actor_html = '';
954
+
955
+ if(!empty($tvseries_actor)){
956
+
957
+ $i = 0;
958
+ foreach ($tvseries_actor as $actor){
959
+
960
+ $actor_html .= '<div class="saswp-tvseries-actor-table-div" data-id="'.$i.'">';
961
+ $actor_html .= '<a class="saswp-table-close">X</a>';
962
+ $actor_html .= $this->saswp_get_dynamic_html($schema_id, 'tvseries_actor', $i, $actor);
963
+ $actor_html .= '</div>';
964
+
965
+ $i++;
966
+ }
967
+
968
+ }
969
+
970
+ $tabs_fields .= $actor_html;
971
+
972
+ }
973
+ $tabs_fields .= '</div>';
974
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-tvseries-actor">Add TVSeries Actor</a>';
975
+ $tabs_fields .= '</div>';
976
+ //actor section ends here here
977
+
978
+ //season section starts here
979
+
980
+ $tabs_fields .= '<div class="saswp-tvseries-season-section-main">';
981
+ $tabs_fields .= '<div class="saswp-tvseries-season-section" data-id="'.esc_attr($schema_id).'">';
982
+ if(isset($tvseries_data['tvseries_season_'.$schema_id])){
983
+
984
+ $tvseries_season = $tvseries_data['tvseries_season_'.$schema_id];
985
+
986
+ $season_html = '';
987
+
988
+ if(!empty($tvseries_season)){
989
+
990
+ $i = 0;
991
+ foreach ($tvseries_season as $season){
992
+
993
+ $season_html .= '<div class="saswp-tvseries-season-table-div" data-id="'.$i.'">';
994
+ $season_html .= '<a class="saswp-table-close">X</a>';
995
+ $season_html .= $this->saswp_get_dynamic_html($schema_id, 'tvseries_season', $i, $season);
996
+ $season_html .= '</div>';
997
+
998
+ $i++;
999
+ }
1000
+
1001
+ }
1002
+
1003
+ $tabs_fields .= $season_html;
1004
+
1005
+ }
1006
+ $tabs_fields .= '</div>';
1007
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-tvseries-season">Add TVSeries Season</a>';
1008
+ $tabs_fields .= '</div>';
1009
+
1010
+ //season section ends here
1011
+
1012
+
1013
+ $tabs_fields .= '</div>';
1014
+ }
1015
+ //TvSeries schema ends here
1016
+
1017
+
1018
+ $tabs_fields .= '</div>';
1019
+
1020
  }
1021
 
1022
  $schema_ids[] =$schema->ID;
1047
  $checked = 'checked';
1048
  }
1049
 
1050
+ if($schema_type == 'HowTo'){
1051
+
1052
+ $howto_data['howto_tool_'.$all_schema[0]->ID] = esc_sql ( get_post_meta($post->ID, 'howto_tool_'.$all_schema[0]->ID, true) );
1053
+ $howto_data['howto_step_'.$all_schema[0]->ID] = esc_sql ( get_post_meta($post->ID, 'howto_step_'.$all_schema[0]->ID, true) );
1054
+ $howto_data['howto_supply_'.$all_schema[0]->ID] = esc_sql ( get_post_meta($post->ID, 'howto_supply_'.$all_schema[0]->ID, true) );
1055
+ }
1056
+ if($schema_type == 'MedicalCondition'){
1057
+
1058
+ $mc_data['mc_cause_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'mc_cause_'.$schema->ID, true) );
1059
+ $mc_data['mc_symptom_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'mc_symptom_'.$schema->ID, true) );
1060
+ $mc_data['mc_risk_factor_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'mc_risk_factor_'.$schema->ID, true) );
1061
+
1062
+ }
1063
+ if($schema_type == 'TVSeries'){
1064
+
1065
+ $tvseries_data['tvseries_actor_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'tvseries_actor_'.$schema->ID, true) );
1066
+ $tvseries_data['tvseries_season_'.$schema->ID] = esc_sql ( get_post_meta($post->ID, 'tvseries_season_'.$schema->ID, true) );
1067
+
1068
+ }
1069
+
1070
  $this->meta_fields = $response;
1071
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
1072
  $tabs_fields .= '<div>';
1076
  . '<span class="saswp-slider"></span>'
1077
  . '</div>';
1078
  $tabs_fields .= '<div id="saswp_specific_'.esc_attr($all_schema[0]->ID).'" class="saswp-post-specific-wrapper">';
1079
+ $tabs_fields .= '<div class="saswp-table-create-onload">';
1080
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
1081
+ $tabs_fields .= '</div>';
1082
+
1083
+
1084
+ //How to schema starts here
1085
+ if($schema_type == 'HowTo'){
1086
+
1087
+ $schema_id = $schema->ID;
1088
+
1089
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
1090
+
1091
+
1092
+ //supply section starts here
1093
+ $tabs_fields .= '<div class="saswp-how-to-supply-section-main">';
1094
+ $tabs_fields .= '<div class="saswp-how-to-supply-section" data-id="'.esc_attr($schema_id).'">';
1095
+ if(isset($howto_data['howto_supply_'.$schema_id])){
1096
+
1097
+ $howto_supply = $howto_data['howto_supply_'.$schema_id];
1098
+ $supply_html = '';
1099
+
1100
+ if(!empty($howto_supply)){
1101
+
1102
+ $i = 0;
1103
+ foreach ($howto_supply as $supply){
1104
+
1105
+ $supply_html .= '<div class="saswp-how-to-supply-table-div" data-id="'.$i.'">';
1106
+ $supply_html .= '<a class="saswp-table-close">X</a>';
1107
+ $supply_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_supply', $i, $supply);
1108
+ $supply_html .= '</div>';
1109
+
1110
+ $i++;
1111
+ }
1112
+
1113
+ }
1114
+
1115
+ $tabs_fields .= $supply_html;
1116
+
1117
+ }
1118
+ $tabs_fields .= '</div>';
1119
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-supply">Add HowTo Supply</a>';
1120
+ $tabs_fields .= '</div>';
1121
+ //supply section ends here here
1122
+
1123
+ //tool section starts here
1124
+ $tabs_fields .= '<div class="saswp-how-to-tool-section-main">';
1125
+ $tabs_fields .= '<div class="saswp-how-to-tool-section" data-id="'.esc_attr($schema_id).'">';
1126
+ if(isset($howto_data['howto_tool_'.$schema_id])){
1127
+
1128
+ $howto_tool = $howto_data['howto_tool_'.$schema_id];
1129
+ $tool_html = '';
1130
+
1131
+ if(!empty($howto_tool)){
1132
+
1133
+ $i = 0;
1134
+ foreach ($howto_tool as $tool){
1135
+
1136
+ $tool_html .= '<div class="saswp-how-to-tool-table-div" data-id="'.$i.'">';
1137
+ $tool_html .= '<a class="saswp-table-close">X</a>';
1138
+ $tool_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_tool', $i, $tool);
1139
+ $tool_html .= '</div>';
1140
+
1141
+ $i++;
1142
+ }
1143
+
1144
+ }
1145
+
1146
+ $tabs_fields .= $tool_html;
1147
+
1148
+ }
1149
+ $tabs_fields .= '</div>';
1150
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-tool">Add HowTo Tool</a>';
1151
+ $tabs_fields .= '</div>';
1152
+ //tool section ends here here
1153
+
1154
+ //step section starts here here
1155
+ $tabs_fields .= '<div class="saswp-how-to-step-section-main">';
1156
+ $tabs_fields .= '<div class="saswp-how-to-step-section" data-id="'.esc_attr($schema_id).'">';
1157
+ if(isset($howto_data['howto_step_'.$schema_id])){
1158
+
1159
+ $howto_step = $howto_data['howto_step_'.$schema_id];
1160
+ $step_html = '';
1161
+
1162
+ if(!empty($howto_step)){
1163
+
1164
+ $i = 0;
1165
+ foreach ($howto_step as $step){
1166
+
1167
+ $step_html .= '<div class="saswp-how-to-step-table-div" data-id="'.$i.'">';
1168
+ $step_html .= '<a class="saswp-table-close">X</a>';
1169
+ $step_html .= $this->saswp_get_dynamic_html($schema_id, 'howto_step', $i, $step);
1170
+ $step_html .= '</div>';
1171
+
1172
+ $i++;
1173
+ }
1174
+
1175
+ }
1176
+
1177
+ $tabs_fields .= $step_html;
1178
+
1179
+ }
1180
+ $tabs_fields .= '</div>';
1181
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-how-to-step">Add HowTo Step</a>';
1182
+ $tabs_fields .= '</div>';
1183
+ //step section ends here here
1184
+
1185
+
1186
+ $tabs_fields .= '</div>';
1187
+ }
1188
+ //How to schema ends here
1189
+
1190
+ //Medical condition schema starts here
1191
+ if($schema_type == 'MedicalCondition'){
1192
+
1193
+ $schema_id = $schema->ID;
1194
+
1195
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
1196
+
1197
+
1198
+ //cause section starts here
1199
+
1200
+ $tabs_fields .= '<div class="saswp-mc-cause-section-main">';
1201
+ $tabs_fields .= '<div class="saswp-mc-cause-section" data-id="'.esc_attr($schema_id).'">';
1202
+ if(isset($mc_data['mc_cause_'.$schema_id])){
1203
+
1204
+ $mc_cause = $mc_data['mc_cause_'.$schema_id];
1205
+
1206
+ $cause_html = '';
1207
+
1208
+ if(!empty($mc_cause)){
1209
+
1210
+ $i = 0;
1211
+ foreach ($mc_cause as $cause){
1212
+
1213
+ $cause_html .= '<div class="saswp-mc-cause-table-div" data-id="'.$i.'">';
1214
+ $cause_html .= '<a class="saswp-table-close">X</a>';
1215
+ $cause_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_cause', $i, $cause);
1216
+ $cause_html .= '</div>';
1217
+
1218
+ $i++;
1219
+ }
1220
+
1221
+ }
1222
+
1223
+ $tabs_fields .= $cause_html;
1224
+
1225
+ }
1226
+ $tabs_fields .= '</div>';
1227
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-cause">Add MC Cause</a>';
1228
+ $tabs_fields .= '</div>';
1229
+
1230
+ //cause section ends here here
1231
+
1232
+ //symptom section starts here
1233
+ $tabs_fields .= '<div class="saswp-mc-symptom-section-main">';
1234
+ $tabs_fields .= '<div class="saswp-mc-symptom-section" data-id="'.esc_attr($schema_id).'">';
1235
+ if(isset($mc_data['mc_symptom_'.$schema_id])){
1236
+
1237
+ $mc_symptom = $mc_data['mc_symptom_'.$schema_id];
1238
+ $symptom_html = '';
1239
+
1240
+ if(!empty($mc_symptom)){
1241
+
1242
+ $i = 0;
1243
+ foreach ($mc_symptom as $symptom){
1244
+
1245
+ $symptom_html .= '<div class="saswp-mc-symptom-table-div" data-id="'.$i.'">';
1246
+ $symptom_html .= '<a class="saswp-table-close">X</a>';
1247
+ $symptom_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_symptom', $i, $symptom);
1248
+ $symptom_html .= '</div>';
1249
+
1250
+ $i++;
1251
+ }
1252
+
1253
+ }
1254
+
1255
+ $tabs_fields .= $symptom_html;
1256
+
1257
+ }
1258
+ $tabs_fields .= '</div>';
1259
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-symptom">Add MC Symptom</a>';
1260
+ $tabs_fields .= '</div>';
1261
+ //symptom section ends here
1262
+
1263
+ //risk factor starts here
1264
+ $tabs_fields .= '<div class="saswp-mc-risk_factor-section-main">';
1265
+ $tabs_fields .= '<div class="saswp-mc-risk_factor-section" data-id="'.esc_attr($schema_id).'">';
1266
+ if(isset($mc_data['mc_risk_factor_'.$schema_id])){
1267
+
1268
+ $mc_risk_factor = $mc_data['mc_risk_factor_'.$schema_id];
1269
+ $risk_factor_html = '';
1270
+
1271
+ if(!empty($mc_risk_factor)){
1272
+
1273
+ $i = 0;
1274
+ foreach ($mc_risk_factor as $risk_factor){
1275
+
1276
+ $risk_factor_html .= '<div class="saswp-mc-risk_factor-table-div" data-id="'.$i.'">';
1277
+ $risk_factor_html .= '<a class="saswp-table-close">X</a>';
1278
+ $risk_factor_html .= $this->saswp_get_dynamic_html($schema_id, 'mc_risk_factor', $i, $risk_factor);
1279
+ $risk_factor_html .= '</div>';
1280
+
1281
+ $i++;
1282
+ }
1283
+
1284
+ }
1285
+
1286
+ $tabs_fields .= $risk_factor_html;
1287
+
1288
+ }
1289
+ $tabs_fields .= '</div>';
1290
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-mc-risk_factor">Add MC Risk Factor</a>';
1291
+ $tabs_fields .= '</div>';
1292
+ //risk factor ends here
1293
+
1294
+ $tabs_fields .= '</div>';
1295
+ }
1296
+ //Medical condition schema ends here
1297
+
1298
+ //TVSeries schema starts herre
1299
+ if($schema_type == 'TVSeries'){
1300
+
1301
+ $schema_id = $schema->ID;
1302
+
1303
+ $tabs_fields .= '<div class="saswp-table-create-onajax">';
1304
+
1305
+ //actor section starts here
1306
+ $tabs_fields .= '<div class="saswp-tvseries-actor-section-main">';
1307
+ $tabs_fields .= '<div class="saswp-tvseries-actor-section" data-id="'.esc_attr($schema_id).'">';
1308
+ if(isset($tvseries_data['tvseries_actor_'.$schema_id])){
1309
+
1310
+ $tvseries_actor = $tvseries_data['tvseries_actor_'.$schema_id];
1311
+
1312
+ $actor_html = '';
1313
+
1314
+ if(!empty($tvseries_actor)){
1315
+
1316
+ $i = 0;
1317
+ foreach ($tvseries_actor as $actor){
1318
+
1319
+ $actor_html .= '<div class="saswp-tvseries-actor-table-div" data-id="'.$i.'">';
1320
+ $actor_html .= '<a class="saswp-table-close">X</a>';
1321
+ $actor_html .= $this->saswp_get_dynamic_html($schema_id, 'tvseries_actor', $i, $actor);
1322
+ $actor_html .= '</div>';
1323
+
1324
+ $i++;
1325
+ }
1326
+
1327
+ }
1328
+
1329
+ $tabs_fields .= $actor_html;
1330
+
1331
+ }
1332
+ $tabs_fields .= '</div>';
1333
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-tvseries-actor">Add TVSeries Actor</a>';
1334
+ $tabs_fields .= '</div>';
1335
+ //actor section ends here here
1336
+
1337
+ //season section starts here
1338
+
1339
+ $tabs_fields .= '<div class="saswp-tvseries-season-section-main">';
1340
+ $tabs_fields .= '<div class="saswp-tvseries-season-section" data-id="'.esc_attr($schema_id).'">';
1341
+ if(isset($tvseries_data['tvseries_season_'.$schema_id])){
1342
+
1343
+ $tvseries_season = $tvseries_data['tvseries_season_'.$schema_id];
1344
+
1345
+ $season_html = '';
1346
+
1347
+ if(!empty($tvseries_season)){
1348
+
1349
+ $i = 0;
1350
+ foreach ($tvseries_season as $season){
1351
+
1352
+ $season_html .= '<div class="saswp-tvseries-season-table-div" data-id="'.$i.'">';
1353
+ $season_html .= '<a class="saswp-table-close">X</a>';
1354
+ $season_html .= $this->saswp_get_dynamic_html($schema_id, 'tvseries_season', $i, $season);
1355
+ $season_html .= '</div>';
1356
+
1357
+ $i++;
1358
+ }
1359
+
1360
+ }
1361
+
1362
+ $tabs_fields .= $season_html;
1363
+
1364
+ }
1365
+ $tabs_fields .= '</div>';
1366
+ $tabs_fields .= '<a data-id="'.esc_attr($schema_id).'" class="button saswp-tvseries-season">Add TVSeries Season</a>';
1367
+ $tabs_fields .= '</div>';
1368
+
1369
+ //season section ends here
1370
+
1371
+
1372
+ $tabs_fields .= '</div>';
1373
+ }
1374
+ //TvSeries schema ends here
1375
+
1376
+
1377
  $tabs_fields .= '</div>';
1378
  $tabs_fields .= '<input class="saswp-post-specific-schema-ids" type="hidden" value="'. json_encode($schema_ids).'">';
1379
  $tabs_fields .= '</div>';
1590
  if (strpos($meta_field['id'], 'business_logo') !== false && empty($media_value_meta)) {
1591
 
1592
  $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_local_business_details', true) );
1593
+ if(array_key_exists('local_business_logo', $business_details) && is_array($business_details['local_business_logo'])){
1594
+
1595
+ $media_value['height'] = $business_details['local_business_logo']['height'];
1596
+ $media_value['width'] = $business_details['local_business_logo']['width'];
1597
+ $media_value['thumbnail'] = $business_details['local_business_logo']['url'];
1598
+
1599
+ }
 
 
 
 
1600
  }
1601
 
1602
+
1603
  if (strpos($meta_field['id'], 'service_schema_image') !== false && empty($media_value_meta)) {
1604
 
1605
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_service_schema_details', true) );
1606
+
1607
+ if(array_key_exists('saswp_service_schema_image', $business_details) && is_array($business_details['saswp_service_schema_image'])){
1608
+ $media_value['height'] = $business_details['saswp_service_schema_image']['height'];
1609
+ $media_value['width'] = $business_details['saswp_service_schema_image']['width'];
1610
+ $media_value['thumbnail'] = $business_details['saswp_service_schema_image']['url'];
1611
+ }
1612
+
1613
  }
1614
 
1615
  if (strpos($meta_field['id'], 'review_schema_image') !== false && empty($media_value_meta)) {
1616
+
1617
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
1618
+ if(array_key_exists('saswp_review_schema_image', $business_details) && is_array($business_details['saswp_review_schema_image'])){
1619
+ $media_value['height'] = $business_details['saswp_review_schema_image']['height'];
1620
+ $media_value['width'] = $business_details['saswp_review_schema_image']['width'];
1621
+ $media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
1622
+ }
1623
  }
1624
  if (strpos($meta_field['id'], 'event_schema_image') !== false && empty($media_value_meta)) {
1625
 
1626
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_event_schema_details', true) );
1627
+ if(array_key_exists('saswp_event_schema_image', $business_details) && is_array($business_details['saswp_event_schema_image'])){
1628
+ $media_value['height'] = $business_details['saswp_event_schema_image']['height'];
1629
+ $media_value['width'] = $business_details['saswp_event_schema_image']['width'];
1630
+ $media_value['thumbnail'] = $business_details['saswp_event_schema_image']['url'];
1631
+ }
1632
  }
1633
 
1634
  $media_height = '';
1849
  }
1850
 
1851
  public function saswp_post_specific_save_fields( $post_id ) {
1852
+
1853
  if ( ! isset( $_POST['post_specific_nonce'] ) )
1854
  return $post_id;
1855
  $nonce = $_POST['post_specific_nonce'];
1875
  if($option != 'enable'){
1876
  return;
1877
  }
1878
+
1879
+ $post_meta = array();
1880
+
1881
+ if(is_array($_POST)){
1882
+ $post_meta = $_POST;
1883
+ }
1884
+
1885
+ $schema_count = 0;
1886
+
1887
+ if(!empty($this->all_schema)){
1888
+ $schema_count = count($this->all_schema);
1889
+ }
1890
 
1891
+ if($schema_count > 0){
1892
 
1893
  foreach($this->all_schema as $schema){
1894
 
1895
+ //How to schema starts here
1896
+ $howto_tool = array();
1897
+ $howto_step = array();
1898
+ $howto_supply = array();
1899
+
1900
+ if( isset($_POST['howto_step_'.$schema->ID]) && is_array($_POST['howto_step_'.$schema->ID])){
1901
+
1902
+ $data = $_POST['howto_step_'.$schema->ID];
1903
+
1904
+ foreach ($data as $step){
1905
+
1906
+ $howto_step[] = array_map( 'sanitize_text_field', $step );
1907
+ }
1908
+ }
1909
 
1910
+ if(isset($_POST['howto_tool_'.$schema->ID]) && is_array($_POST['howto_tool_'.$schema->ID])){
1911
+
1912
+ $data = $_POST['howto_tool_'.$schema->ID];
1913
+
1914
+ foreach ($data as $tool){
1915
+
1916
+ $howto_tool[] = array_map( 'sanitize_text_field', $tool );
1917
+ }
1918
+
1919
+ }
1920
+ if(isset($_POST['howto_supply_'.$schema->ID]) && is_array($_POST['howto_supply_'.$schema->ID])){
1921
+
1922
+ $data = $_POST['howto_supply_'.$schema->ID];
1923
+
1924
+ foreach ($data as $supply){
1925
+
1926
+ $howto_supply[] = array_map( 'sanitize_text_field', $supply );
1927
+ }
1928
+ }
1929
+
1930
+ update_post_meta( $post_id, 'howto_step_'.$schema->ID, $howto_step);
1931
+ update_post_meta( $post_id, 'howto_tool_'.$schema->ID, $howto_tool);
1932
+ update_post_meta( $post_id, 'howto_supply_'.$schema->ID, $howto_supply);
1933
+
1934
+ //How to schema ends here
1935
+
1936
+
1937
+ //MedicalCondition schema starts here
1938
+ $mc_cause = array();
1939
+ $mc_symptom = array();
1940
+ $mc_r_factor = array();
1941
+
1942
+ if(isset($_POST['mc_cause_'.$schema->ID]) && is_array($_POST['mc_cause_'.$schema->ID])){
1943
+
1944
+ $data = $_POST['mc_cause_'.$schema->ID];
1945
+
1946
+ foreach ($data as $supply){
1947
+
1948
+ $mc_cause[] = array_map( 'sanitize_text_field', $supply );
1949
+ }
1950
+ }
1951
+ if(isset($_POST['mc_symptom_'.$schema->ID]) && is_array($_POST['mc_symptom_'.$schema->ID])){
1952
+
1953
+ $data = $_POST['mc_symptom_'.$schema->ID];
1954
+
1955
+ foreach ($data as $supply){
1956
+
1957
+ $mc_symptom[] = array_map( 'sanitize_text_field', $supply );
1958
+ }
1959
+ }
1960
+ if(isset($_POST['mc_risk_factor_'.$schema->ID]) && is_array($_POST['mc_risk_factor_'.$schema->ID])){
1961
+
1962
+ $data = $_POST['mc_risk_factor_'.$schema->ID];
1963
+
1964
+ foreach ($data as $supply){
1965
+
1966
+ $mc_r_factor[] = array_map( 'sanitize_text_field', $supply );
1967
+ }
1968
+ }
1969
+
1970
+ update_post_meta( $post_id, 'mc_cause_'.$schema->ID, $mc_cause);
1971
+ update_post_meta( $post_id, 'mc_symptom_'.$schema->ID, $mc_symptom);
1972
+ update_post_meta( $post_id, 'mc_risk_factor_'.$schema->ID, $mc_r_factor);
1973
+
1974
+ //MedicalCondition schema ends here
1975
+
1976
+
1977
+ //TVSeries schema starts here
1978
+ $tv_actor = array();
1979
+ $tv_season = array();
1980
+
1981
+ if(isset($_POST['tvseries_actor_'.$schema->ID]) && is_array($_POST['tvseries_actor_'.$schema->ID])){
1982
+
1983
+ $data = $_POST['tvseries_actor_'.$schema->ID];
1984
+
1985
+ foreach ($data as $supply){
1986
+
1987
+ $tv_actor[] = array_map( 'sanitize_text_field', $supply );
1988
+ }
1989
+ }
1990
+ if(isset($_POST['tvseries_season_'.$schema->ID]) && is_array($_POST['tvseries_season_'.$schema->ID])){
1991
+
1992
+ $data = $_POST['tvseries_season_'.$schema->ID];
1993
+
1994
+ foreach ($data as $supply){
1995
+
1996
+ $tv_season[] = array_map( 'sanitize_text_field', $supply );
1997
+ }
1998
+ }
1999
+
2000
+
2001
+ update_post_meta( $post_id, 'tvseries_actor_'.$schema->ID, $tv_actor);
2002
+ update_post_meta( $post_id, 'tvseries_season_'.$schema->ID, $tv_season);
2003
+
2004
+ //TVSeries schema ends here
2005
+
2006
+ $response = $this->saswp_get_fields_by_schema_type($schema->ID);
2007
+
2008
+ $this->meta_fields = $response;
2009
+
2010
+ foreach ( $this->meta_fields as $meta_field ) {
2011
+
2012
+ if ( isset( $post_meta[ $meta_field['id'] ] ) ) {
2013
+
2014
+ switch ( $meta_field['type'] ) {
2015
+
2016
+ case 'media':
2017
+ $media_key = $meta_field['id'].'_detail';
2018
+ $media_height = sanitize_text_field( $post_meta[ $meta_field['id'].'_height' ] );
2019
+ $media_width = sanitize_text_field( $post_meta[ $meta_field['id'].'_width' ] );
2020
+ $media_thumbnail = sanitize_text_field( $post_meta[ $meta_field['id'].'_thumbnail' ] );
2021
+
2022
+ $media_detail = array(
2023
+ 'height' => $media_height,
2024
+ 'width' => $media_width,
2025
+ 'thumbnail' => $media_thumbnail,
2026
+ );
2027
+
2028
+ update_post_meta( $post_id, $media_key, $media_detail);
2029
  break;
2030
  case 'email':
2031
  $post_meta[ $meta_field['id'] ] = sanitize_email( $post_meta[ $meta_field['id'] ] );
2039
  } else if ( $meta_field['type'] === 'checkbox' ) {
2040
  update_post_meta( $post_id, $meta_field['id'], '0' );
2041
  }
2042
+ }
2043
+
2044
+ }
2045
  }
2046
  }
2047
 
2442
  'id' => 'local_menu_'.$schema_id,
2443
  'type' => 'text',
2444
  'default' => $business_details['local_menu']
2445
+ ),
2446
+ array(
2447
+ 'label' => 'HasMap',
2448
+ 'id' => 'local_hasmap_'.$schema_id,
2449
+ 'type' => 'text',
2450
+ 'default' => $business_details['local_hasmap']
2451
  ),
2452
  array(
2453
  'label' => 'Serves Cuisine',
2538
  'id' => 'saswp_blogposting_organization_logo_'.$schema_id,
2539
  'type' => 'media',
2540
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url'] : ''
2541
+ ),
2542
+ array(
2543
+ 'label' => 'Speakable',
2544
+ 'id' => 'saswp_blogposting_speakable_'.$schema_id,
2545
+ 'type' => 'checkbox',
2546
+
2547
+ )
2548
  );
2549
  break;
2550
 
2662
  'id' => 'saswp_newsarticle_organization_logo_'.$schema_id,
2663
  'type' => 'media',
2664
  'default' => isset($sd_data['sd_logo'])? $sd_data['sd_logo']['url']:''
2665
+ ),
2666
+ array(
2667
+ 'label' => 'Speakable',
2668
+ 'id' => 'saswp_newsarticle_speakable_'.$schema_id,
2669
+ 'type' => 'checkbox',
2670
+
2671
+ )
2672
  );
2673
  break;
2674
 
2740
  'id' => 'saswp_webpage_organization_logo_'.$schema_id,
2741
  'type' => 'media',
2742
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
2743
+ ),
2744
+ array(
2745
+ 'label' => 'Speakable',
2746
+ 'id' => 'saswp_webpage_speakable_'.$schema_id,
2747
+ 'type' => 'checkbox',
2748
+
2749
+ )
2750
  );
2751
  break;
2752
 
2805
  'id' => 'saswp_article_organization_logo_'.$schema_id,
2806
  'type' => 'media',
2807
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
2808
+ ),
2809
+ array(
2810
+ 'label' => 'Speakable',
2811
+ 'id' => 'saswp_article_speakable_'.$schema_id,
2812
+ 'type' => 'checkbox',
2813
+
2814
+ )
2815
  );
2816
  break;
2817
 
2979
  'id' => 'saswp_tech_article_organization_logo_'.$schema_id,
2980
  'type' => 'media',
2981
  'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
2982
+ ),
2983
+ array(
2984
+ 'label' => 'Speakable',
2985
+ 'id' => 'saswp_tech_article_speakable_'.$schema_id,
2986
+ 'type' => 'checkbox',
2987
+
2988
+ )
2989
  );
2990
  break;
2991
 
3279
  break;
3280
 
3281
  case 'Product':
3282
+
3283
  $meta_field = array(
3284
 
3285
  array(
3286
  'label' => 'Name',
3287
  'id' => 'saswp_product_schema_name_'.$schema_id,
3288
+ 'type' => 'text',
 
3289
  ),
3290
  array(
3291
  'label' => 'Description',
3292
  'id' => 'saswp_product_schema_description_'.$schema_id,
3293
+ 'type' => 'textarea',
 
3294
  ),
3295
  array(
3296
  'label' => 'Image',
3297
  'id' => 'saswp_product_schema_image_'.$schema_id,
3298
+ 'type' => 'media',
 
3299
  ),
3300
  array(
3301
  'label' => 'Brand Name',
3302
  'id' => 'saswp_product_schema_brand_name_'.$schema_id,
3303
+ 'type' => 'text',
 
3304
  ),
3305
  array(
3306
  'label' => 'Price',
3307
  'id' => 'saswp_product_schema_price_'.$schema_id,
3308
+ 'type' => 'text',
 
3309
  ),
3310
  array(
3311
  'label' => 'Price Valid Until',
3312
  'id' => 'saswp_product_schema_priceValidUntil_'.$schema_id,
3313
+ 'type' => 'text',
 
3314
  ),
3315
  array(
3316
  'label' => 'Currency',
3317
  'id' => 'saswp_product_schema_currency_'.$schema_id,
3318
+ 'type' => 'text',
 
3319
  ),
3320
  array(
3321
  'label' => 'Availability',
3322
  'id' => 'saswp_product_schema_availability_'.$schema_id,
3323
+ 'type' => 'select',
 
3324
  'options' => array(
3325
  'InStock' => 'In Stock',
3326
  'OutOfStock' => 'Out Of Stock',
3331
  array(
3332
  'label' => 'Condition',
3333
  'id' => 'saswp_product_schema_condition_'.$schema_id,
3334
+ 'type' => 'select',
 
3335
  'options' => array(
3336
  'NewCondition' => 'New',
3337
  'UsedCondition' => 'Used',
3342
  array(
3343
  'label' => 'SKU',
3344
  'id' => 'saswp_product_schema_sku_'.$schema_id,
3345
+ 'type' => 'text',
 
3346
  ),
3347
  array(
3348
  'label' => 'MPN',
3349
  'id' => 'saswp_product_schema_mpn_'.$schema_id,
3350
  'type' => 'text',
3351
+ 'note' => 'OR',
 
3352
  ),
3353
  array(
3354
  'label' => 'ISBN',
3355
  'id' => 'saswp_product_schema_isbn_'.$schema_id,
3356
  'type' => 'text',
3357
+ 'note' => 'OR',
 
3358
  ),
3359
  array(
3360
  'label' => 'GTIN8',
3361
  'id' => 'saswp_product_schema_gtin8_'.$schema_id,
3362
+ 'type' => 'text',
 
3363
  ),
3364
  array(
3365
  'label' => 'Aggregate Rating',
3366
  'id' => 'saswp_product_schema_enable_rating_'.$schema_id,
3367
+ 'type' => 'checkbox',
 
3368
  ),
3369
  array(
3370
  'label' => 'Rating',
3371
  'id' => 'saswp_product_schema_rating_'.$schema_id,
3372
+ 'type' => 'text',
 
3373
  ),
3374
  array(
3375
  'label' => 'Number of Reviews',
3376
  'id' => 'saswp_product_schema_review_count_'.$schema_id,
3377
+ 'type' => 'text',
 
3378
  ),
3379
 
3380
  );
3887
  );
3888
  break;
3889
 
3890
+ case 'HowTo':
3891
+
3892
+ $meta_field = array(
3893
+ array(
3894
+ 'label' => 'Name',
3895
+ 'id' => 'saswp_howto_schema_name_'.$schema_id,
3896
+ 'type' => 'text',
3897
+ 'attributes' => array(
3898
+ 'placeholder' => 'Name'
3899
+ ),
3900
+ ),
3901
+ array(
3902
+ 'label' => 'Description',
3903
+ 'id' => 'saswp_howto_schema_description_'.$schema_id,
3904
+ 'type' => 'textarea',
3905
+ ),
3906
+ array(
3907
+ 'label' => 'Image',
3908
+ 'id' => 'saswp_howto_schema_image_'.$schema_id,
3909
+ 'type' => 'media',
3910
+ ),
3911
+ array(
3912
+ 'label' => 'Estimated Cost Currency',
3913
+ 'id' => 'saswp_howto_ec_schema_currency_'.$schema_id,
3914
+ 'type' => 'text',
3915
+ 'attributes' => array(
3916
+ 'placeholder' => 'USD'
3917
+ ),
3918
+ ),
3919
+ array(
3920
+ 'label' => 'Estimated Cost Value',
3921
+ 'id' => 'saswp_howto_ec_schema_value_'.$schema_id,
3922
+ 'type' => 'text',
3923
+ 'attributes' => array(
3924
+ 'placeholder' => '20'
3925
+ ),
3926
+ ),
3927
+ array(
3928
+ 'label' => 'Total Time',
3929
+ 'id' => 'saswp_howto_schema_totaltime_'.$schema_id,
3930
+ 'type' => 'text',
3931
+ 'attributes' => array(
3932
+ 'placeholder' => 'PT30M'
3933
+ ),
3934
+ ),
3935
+ array(
3936
+ 'label' => 'Date Published',
3937
+ 'id' => 'saswp_howto_ec_schema_date_published_'.$schema_id,
3938
+ 'type' => 'text',
3939
+
3940
+ ),
3941
+ array(
3942
+ 'label' => 'Date Modified',
3943
+ 'id' => 'saswp_howto_ec_schema_date_modified_'.$schema_id,
3944
+ 'type' => 'text',
3945
+ )
3946
+ );
3947
+ break;
3948
+
3949
+ case 'MedicalCondition':
3950
+
3951
+ $meta_field = array(
3952
+ array(
3953
+ 'label' => 'Name',
3954
+ 'id' => 'saswp_mc_schema_name_'.$schema_id,
3955
+ 'type' => 'text',
3956
+ 'attributes' => array(
3957
+ 'placeholder' => 'Name'
3958
+ ),
3959
+ ),
3960
+ array(
3961
+ 'label' => 'Alternate Name',
3962
+ 'id' => 'saswp_mc_schema_alternate_name_'.$schema_id,
3963
+ 'type' => 'text',
3964
+ 'attributes' => array(
3965
+ 'placeholder' => 'Alternate Name'
3966
+ ),
3967
+ ),
3968
+ array(
3969
+ 'label' => 'Description',
3970
+ 'id' => 'saswp_mc_schema_description_'.$schema_id,
3971
+ 'type' => 'textarea',
3972
+ ),
3973
+ array(
3974
+ 'label' => 'Image',
3975
+ 'id' => 'saswp_mc_schema_image_'.$schema_id,
3976
+ 'type' => 'media',
3977
+ ),
3978
+ array(
3979
+ 'label' => 'associated Anatomy Name',
3980
+ 'id' => 'saswp_mc_schema_anatomy_name_'.$schema_id,
3981
+ 'type' => 'text',
3982
+ 'attributes' => array(
3983
+ 'placeholder' => 'Name'
3984
+ ),
3985
+ ),
3986
+ array(
3987
+ 'label' => 'Medical Code',
3988
+ 'id' => 'saswp_mc_schema_medical_code_'.$schema_id,
3989
+ 'type' => 'text',
3990
+ 'attributes' => array(
3991
+ 'placeholder' => '413'
3992
+ ),
3993
+ ),
3994
+ array(
3995
+ 'label' => 'Coding System',
3996
+ 'id' => 'saswp_mc_schema_coding_system_'.$schema_id,
3997
+ 'type' => 'text',
3998
+ 'attributes' => array(
3999
+ 'placeholder' => 'ICD-9'
4000
+ ),
4001
+ ),
4002
+ array(
4003
+ 'label' => 'Diagnosis Name',
4004
+ 'id' => 'saswp_mc_schema_diagnosis_name_'.$schema_id,
4005
+ 'type' => 'text',
4006
+
4007
+ )
4008
+ );
4009
+ break;
4010
+
4011
+ case 'VideoGame':
4012
+
4013
+ $meta_field = array(
4014
+ array(
4015
+ 'label' => 'Name',
4016
+ 'id' => 'saswp_vg_schema_name_'.$schema_id,
4017
+ 'type' => 'text',
4018
+ 'attributes' => array(
4019
+ 'placeholder' => 'Name'
4020
+ ),
4021
+ ),
4022
+ array(
4023
+ 'label' => 'URL',
4024
+ 'id' => 'saswp_vg_schema_url_'.$schema_id,
4025
+ 'type' => 'text',
4026
+
4027
+ ),
4028
+ array(
4029
+ 'label' => 'Image',
4030
+ 'id' => 'saswp_vg_schema_image_'.$schema_id,
4031
+ 'type' => 'media',
4032
+
4033
+ ),
4034
+ array(
4035
+ 'label' => 'Description',
4036
+ 'id' => 'saswp_vg_schema_description_'.$schema_id,
4037
+ 'type' => 'textarea',
4038
+
4039
+ ),
4040
+ array(
4041
+ 'label' => 'Operating System',
4042
+ 'id' => 'saswp_vg_schema_operating_system_'.$schema_id,
4043
+ 'type' => 'text',
4044
+
4045
+ ),
4046
+ array(
4047
+ 'label' => 'Application Category',
4048
+ 'id' => 'saswp_vg_schema_application_category_'.$schema_id,
4049
+ 'type' => 'text',
4050
+
4051
+ ),
4052
+ array(
4053
+ 'label' => 'Author Name',
4054
+ 'id' => 'saswp_vg_schema_author_name_'.$schema_id,
4055
+ 'type' => 'text',
4056
+
4057
+ ),
4058
+ array(
4059
+ 'label' => 'Price',
4060
+ 'id' => 'saswp_vg_schema_price_'.$schema_id,
4061
+ 'type' => 'text',
4062
+
4063
+ ),
4064
+ array(
4065
+ 'label' => 'Price Currency',
4066
+ 'id' => 'saswp_vg_schema_price_currency_'.$schema_id,
4067
+ 'type' => 'text',
4068
+
4069
+ ),
4070
+ array(
4071
+ 'label' => 'Availability',
4072
+ 'id' => 'saswp_vg_schema_price_availability_'.$schema_id,
4073
+ 'type' => 'select',
4074
+ 'options' => array(
4075
+ 'InStock' => 'In Stock',
4076
+ 'OutOfStock' => 'Out Of Stock',
4077
+ 'Discontinued' => 'Discontinued',
4078
+ 'PreOrder' => 'Pre Order',
4079
+ )
4080
+ ),
4081
+ array(
4082
+ 'label' => 'Publisher',
4083
+ 'id' => 'saswp_vg_schema_publisher_'.$schema_id,
4084
+ 'type' => 'text',
4085
+
4086
+ ),
4087
+ array(
4088
+ 'label' => 'Genre',
4089
+ 'id' => 'saswp_vg_schema_genre_'.$schema_id,
4090
+ 'type' => 'text',
4091
+
4092
+ ),
4093
+ array(
4094
+ 'label' => 'Processor Requirements',
4095
+ 'id' => 'saswp_vg_schema_processor_requirements_'.$schema_id,
4096
+ 'type' => 'text',
4097
+
4098
+ ),
4099
+ array(
4100
+ 'label' => 'Memory Requirements',
4101
+ 'id' => 'saswp_vg_schema_memory_requirements_'.$schema_id,
4102
+ 'type' => 'text',
4103
+
4104
+ ),
4105
+ array(
4106
+ 'label' => 'Storage Requirements',
4107
+ 'id' => 'saswp_vg_schema_storage_requirements_'.$schema_id,
4108
+ 'type' => 'text',
4109
+
4110
+ ),
4111
+ array(
4112
+ 'label' => 'Game Platform',
4113
+ 'id' => 'saswp_vg_schema_game_platform_'.$schema_id,
4114
+ 'type' => 'text',
4115
+
4116
+ ),
4117
+ array(
4118
+ 'label' => 'Cheat Code',
4119
+ 'id' => 'saswp_vg_schema_cheat_code_'.$schema_id,
4120
+ 'type' => 'text',
4121
+
4122
+ ),
4123
+ array(
4124
+ 'label' => 'Aggregate Rating',
4125
+ 'id' => 'saswp_vg_schema_enable_rating_'.$schema_id,
4126
+ 'type' => 'checkbox',
4127
+ ),
4128
+ array(
4129
+ 'label' => 'Rating',
4130
+ 'id' => 'saswp_vg_schema_rating_'.$schema_id,
4131
+ 'type' => 'text',
4132
+ ),
4133
+ array(
4134
+ 'label' => 'Number of Reviews',
4135
+ 'id' => 'saswp_vg_schema_review_count_'.$schema_id,
4136
+ 'type' => 'text',
4137
+ ),
4138
+
4139
+ );
4140
+ break;
4141
+
4142
+ case 'TVSeries':
4143
+
4144
+ $meta_field = array(
4145
+ array(
4146
+ 'label' => 'Name',
4147
+ 'id' => 'saswp_tvseries_schema_name_'.$schema_id,
4148
+ 'type' => 'text',
4149
+ 'attributes' => array(
4150
+ 'placeholder' => 'Name'
4151
+ ),
4152
+ ),
4153
+ array(
4154
+ 'label' => 'Image',
4155
+ 'id' => 'saswp_tvseries_schema_image_'.$schema_id,
4156
+ 'type' => 'media'
4157
+ ),
4158
+ array(
4159
+ 'label' => 'Author Name',
4160
+ 'id' => 'saswp_tvseries_schema_author_name_'.$schema_id,
4161
+ 'type' => 'text',
4162
+ 'attributes' => array(
4163
+ 'placeholder' => 'Author Name'
4164
+ ),
4165
+ ),
4166
+ array(
4167
+ 'label' => 'Description',
4168
+ 'id' => 'saswp_tvseries_schema_description_'.$schema_id,
4169
+ 'type' => 'textarea'
4170
+ )
4171
+
4172
+ );
4173
+ break;
4174
+
4175
+ case 'Apartment':
4176
+
4177
+ $meta_field = array(
4178
+ array(
4179
+ 'label' => 'Name',
4180
+ 'id' => 'saswp_apartment_schema_name_'.$schema_id,
4181
+ 'type' => 'text',
4182
+ 'attributes' => array(
4183
+ 'placeholder' => 'Name'
4184
+ ),
4185
+ ),
4186
+ array(
4187
+ 'label' => 'URL',
4188
+ 'id' => 'saswp_apartment_schema_url_'.$schema_id,
4189
+ 'type' => 'text',
4190
+ 'default' => get_permalink()
4191
+ ),
4192
+ array(
4193
+ 'label' => 'Image',
4194
+ 'id' => 'saswp_apartment_schema_image_'.$schema_id,
4195
+ 'type' => 'media',
4196
+ 'default' => get_permalink()
4197
+ ),
4198
+ array(
4199
+ 'label' => 'Description',
4200
+ 'id' => 'saswp_apartment_schema_description_'.$schema_id,
4201
+ 'type' => 'textarea',
4202
+ 'attributes' => array(
4203
+ 'placeholder' => 'Description'
4204
+ ),
4205
+ ),
4206
+ array(
4207
+ 'label' => 'Number Of Rooms',
4208
+ 'id' => 'saswp_apartment_schema_numberofrooms_'.$schema_id,
4209
+ 'type' => 'text',
4210
+ 'attributes' => array(
4211
+ 'placeholder' => '5'
4212
+ ),
4213
+ ),
4214
+ array(
4215
+ 'label' => 'Country',
4216
+ 'id' => 'saswp_apartment_schema_country_'.$schema_id,
4217
+ 'type' => 'text',
4218
+ ),
4219
+ array(
4220
+ 'label' => 'Locality',
4221
+ 'id' => 'saswp_apartment_schema_locality_'.$schema_id,
4222
+ 'type' => 'text',
4223
+ ),
4224
+ array(
4225
+ 'label' => 'Region',
4226
+ 'id' => 'saswp_apartment_schema_region_'.$schema_id,
4227
+ 'type' => 'text',
4228
+ ),
4229
+ array(
4230
+ 'label' => 'Postal Code',
4231
+ 'id' => 'saswp_apartment_schema_postalcode_'.$schema_id,
4232
+ 'type' => 'text',
4233
+ ),
4234
+ array(
4235
+ 'label' => 'Telephone',
4236
+ 'id' => 'saswp_apartment_schema_telephone_'.$schema_id,
4237
+ 'type' => 'text',
4238
+ ),
4239
+
4240
+ );
4241
+ break;
4242
+ case 'House':
4243
+
4244
+ $meta_field = array(
4245
+ array(
4246
+ 'label' => 'Name',
4247
+ 'id' => 'saswp_house_schema_name_'.$schema_id,
4248
+ 'type' => 'text',
4249
+ 'attributes' => array(
4250
+ 'placeholder' => 'Name'
4251
+ ),
4252
+ ),
4253
+ array(
4254
+ 'label' => 'URL',
4255
+ 'id' => 'saswp_house_schema_url_'.$schema_id,
4256
+ 'type' => 'text',
4257
+ 'default' => get_permalink()
4258
+ ),
4259
+ array(
4260
+ 'label' => 'Image',
4261
+ 'id' => 'saswp_house_schema_image_'.$schema_id,
4262
+ 'type' => 'media',
4263
+ ),
4264
+ array(
4265
+ 'label' => 'Description',
4266
+ 'id' => 'saswp_house_schema_description_'.$schema_id,
4267
+ 'type' => 'textarea',
4268
+ 'attributes' => array(
4269
+ 'placeholder' => 'Description'
4270
+ ),
4271
+ ),
4272
+ array(
4273
+ 'label' => 'Pets Allowed',
4274
+ 'id' => 'saswp_house_schema_pets_allowed_'.$schema_id,
4275
+ 'type' => 'select',
4276
+ 'options' => array(
4277
+ 'yes' => 'Yes',
4278
+ 'no' => 'No'
4279
+ )
4280
+ ),
4281
+ array(
4282
+ 'label' => 'Country',
4283
+ 'id' => 'saswp_house_schema_country_'.$schema_id,
4284
+ 'type' => 'text',
4285
+ ),
4286
+ array(
4287
+ 'label' => 'Locality',
4288
+ 'id' => 'saswp_house_schema_locality_'.$schema_id,
4289
+ 'type' => 'text',
4290
+ ),
4291
+ array(
4292
+ 'label' => 'Region',
4293
+ 'id' => 'saswp_house_schema_region_'.$schema_id,
4294
+ 'type' => 'text',
4295
+ ),
4296
+ array(
4297
+ 'label' => 'Postal Code',
4298
+ 'id' => 'saswp_house_schema_postalcode_'.$schema_id,
4299
+ 'type' => 'text',
4300
+ ),
4301
+ array(
4302
+ 'label' => 'Telephone',
4303
+ 'id' => 'saswp_house_schema_telephone_'.$schema_id,
4304
+ 'type' => 'text',
4305
+ ),
4306
+
4307
+ );
4308
+ break;
4309
+
4310
+ case 'SingleFamilyResidence':
4311
+
4312
+ $meta_field = array(
4313
+ array(
4314
+ 'label' => 'Name',
4315
+ 'id' => 'saswp_sfr_schema_name_'.$schema_id,
4316
+ 'type' => 'text',
4317
+ 'attributes' => array(
4318
+ 'placeholder' => 'Name'
4319
+ ),
4320
+ ),
4321
+ array(
4322
+ 'label' => 'URL',
4323
+ 'id' => 'saswp_sfr_schema_url_'.$schema_id,
4324
+ 'type' => 'text',
4325
+ 'default' => get_permalink()
4326
+ ),
4327
+ array(
4328
+ 'label' => 'Image',
4329
+ 'id' => 'saswp_sfr_schema_image_'.$schema_id,
4330
+ 'type' => 'media',
4331
+ ),
4332
+ array(
4333
+ 'label' => 'Description',
4334
+ 'id' => 'saswp_sfr_schema_description_'.$schema_id,
4335
+ 'type' => 'textarea',
4336
+ 'attributes' => array(
4337
+ 'placeholder' => 'Description'
4338
+ ),
4339
+ ),
4340
+ array(
4341
+ 'label' => 'Number Of Rooms',
4342
+ 'id' => 'saswp_sfr_schema_numberofrooms_'.$schema_id,
4343
+ 'type' => 'text',
4344
+ 'attributes' => array(
4345
+ 'placeholder' => '5'
4346
+ ),
4347
+ ),
4348
+ array(
4349
+ 'label' => 'Pets Allowed',
4350
+ 'id' => 'saswp_sfr_schema_pets_allowed_'.$schema_id,
4351
+ 'type' => 'select',
4352
+ 'options' => array(
4353
+ 'yes' => 'Yes',
4354
+ 'no' => 'No'
4355
+ )
4356
+ ),
4357
+ array(
4358
+ 'label' => 'Country',
4359
+ 'id' => 'saswp_sfr_schema_country_'.$schema_id,
4360
+ 'type' => 'text',
4361
+ ),
4362
+ array(
4363
+ 'label' => 'Locality',
4364
+ 'id' => 'saswp_sfr_schema_locality_'.$schema_id,
4365
+ 'type' => 'text',
4366
+ ),
4367
+ array(
4368
+ 'label' => 'Region',
4369
+ 'id' => 'saswp_sfr_schema_region_'.$schema_id,
4370
+ 'type' => 'text',
4371
+ ),
4372
+ array(
4373
+ 'label' => 'Postal Code',
4374
+ 'id' => 'saswp_sfr_schema_postalcode_'.$schema_id,
4375
+ 'type' => 'text',
4376
+ ),
4377
+ array(
4378
+ 'label' => 'Telephone',
4379
+ 'id' => 'saswp_sfr_schema_telephone_'.$schema_id,
4380
+ 'type' => 'text',
4381
+ ),
4382
+
4383
+ );
4384
+ break;
4385
+
4386
+ case 'TouristAttraction':
4387
+
4388
+ $meta_field = array(
4389
+ array(
4390
+ 'label' => 'Name',
4391
+ 'id' => 'saswp_ta_schema_name_'.$schema_id,
4392
+ 'type' => 'text',
4393
+ 'attributes' => array(
4394
+ 'placeholder' => 'Name'
4395
+ ),
4396
+ ),
4397
+ array(
4398
+ 'label' => 'Description',
4399
+ 'id' => 'saswp_ta_schema_description_'.$schema_id,
4400
+ 'type' => 'textarea',
4401
+ 'attributes' => array(
4402
+ 'placeholder' => 'Description'
4403
+ ),
4404
+ ),
4405
+ array(
4406
+ 'label' => 'Image',
4407
+ 'id' => 'saswp_ta_schema_image_'.$schema_id,
4408
+ 'type' => 'media',
4409
+ ),
4410
+ array(
4411
+ 'label' => 'URL',
4412
+ 'id' => 'saswp_ta_schema_url_'.$schema_id,
4413
+ 'type' => 'text',
4414
+ 'default' => get_permalink()
4415
+ ),
4416
+ array(
4417
+ 'label' => 'Is Accessible For Free',
4418
+ 'id' => 'saswp_ta_schema_is_acceesible_free_'.$schema_id,
4419
+ 'type' => 'select',
4420
+ 'options' => array(
4421
+ 'true' => 'True',
4422
+ 'false' => 'False',
4423
+ ),
4424
+ ),
4425
+ array(
4426
+ 'label' => 'Address Locality',
4427
+ 'id' => 'saswp_ta_schema_locality_'.$schema_id,
4428
+ 'type' => 'text',
4429
+ ),
4430
+ array(
4431
+ 'label' => 'Address Region',
4432
+ 'id' => 'saswp_ta_schema_region_'.$schema_id,
4433
+ 'type' => 'text',
4434
+ ),
4435
+ array(
4436
+ 'label' => 'Address Country',
4437
+ 'id' => 'saswp_ta_schema_country_'.$schema_id,
4438
+ 'type' => 'text',
4439
+ ),
4440
+ array(
4441
+ 'label' => 'Address PostalCode',
4442
+ 'id' => 'saswp_ta_schema_postal_code_'.$schema_id,
4443
+ 'type' => 'text',
4444
+ ),
4445
+
4446
+ );
4447
+ break;
4448
+
4449
+ case 'TouristDestination':
4450
+
4451
+ $meta_field = array(
4452
+ array(
4453
+ 'label' => 'Name',
4454
+ 'id' => 'saswp_td_schema_name_'.$schema_id,
4455
+ 'type' => 'text',
4456
+ 'attributes' => array(
4457
+ 'placeholder' => 'Name'
4458
+ ),
4459
+ ),
4460
+ array(
4461
+ 'label' => 'Description',
4462
+ 'id' => 'saswp_td_schema_description_'.$schema_id,
4463
+ 'type' => 'textarea',
4464
+ 'attributes' => array(
4465
+ 'placeholder' => 'Description'
4466
+ ),
4467
+ ),
4468
+ array(
4469
+ 'label' => 'Image',
4470
+ 'id' => 'saswp_td_schema_image_'.$schema_id,
4471
+ 'type' => 'media',
4472
+ ),
4473
+ array(
4474
+ 'label' => 'URL',
4475
+ 'id' => 'saswp_td_schema_url_'.$schema_id,
4476
+ 'type' => 'text',
4477
+ 'default' => get_permalink()
4478
+ ),
4479
+ array(
4480
+ 'label' => 'Address Locality',
4481
+ 'id' => 'saswp_td_schema_locality_'.$schema_id,
4482
+ 'type' => 'text',
4483
+ ),
4484
+ array(
4485
+ 'label' => 'Address Region',
4486
+ 'id' => 'saswp_td_schema_region_'.$schema_id,
4487
+ 'type' => 'text',
4488
+ ),
4489
+ array(
4490
+ 'label' => 'Address Country',
4491
+ 'id' => 'saswp_td_schema_country_'.$schema_id,
4492
+ 'type' => 'text',
4493
+ ),
4494
+ array(
4495
+ 'label' => 'Address PostalCode',
4496
+ 'id' => 'saswp_td_schema_postal_code_'.$schema_id,
4497
+ 'type' => 'text',
4498
+ ),
4499
+
4500
+ );
4501
+ break;
4502
+
4503
+ case 'LandmarksOrHistoricalBuildings':
4504
+
4505
+ $meta_field = array(
4506
+ array(
4507
+ 'label' => 'Name',
4508
+ 'id' => 'saswp_lorh_schema_name_'.$schema_id,
4509
+ 'type' => 'text',
4510
+ 'attributes' => array(
4511
+ 'placeholder' => 'Name'
4512
+ ),
4513
+ ),
4514
+ array(
4515
+ 'label' => 'Description',
4516
+ 'id' => 'saswp_lorh_schema_description_'.$schema_id,
4517
+ 'type' => 'textarea',
4518
+ 'attributes' => array(
4519
+ 'placeholder' => 'Description'
4520
+ ),
4521
+ ),
4522
+ array(
4523
+ 'label' => 'Image',
4524
+ 'id' => 'saswp_lorh_schema_image_'.$schema_id,
4525
+ 'type' => 'media',
4526
+ ),
4527
+ array(
4528
+ 'label' => 'URL',
4529
+ 'id' => 'saswp_lorh_schema_url_'.$schema_id,
4530
+ 'type' => 'text',
4531
+ 'default' => get_permalink()
4532
+ ),
4533
+ array(
4534
+ 'label' => 'Has Map',
4535
+ 'id' => 'saswp_lorh_schema_hasmap_'.$schema_id,
4536
+ 'type' => 'text',
4537
+ ),
4538
+ array(
4539
+ 'label' => 'Is Accessible For Free',
4540
+ 'id' => 'saswp_lorh_schema_is_acceesible_free_'.$schema_id,
4541
+ 'type' => 'select',
4542
+ 'options' => array(
4543
+ 'true' => 'True',
4544
+ 'false' => 'False',
4545
+ )
4546
+ ),
4547
+ array(
4548
+ 'label' => 'Maximum Attendee Capacity',
4549
+ 'id' => 'saswp_lorh_schema_maximum_a_capacity_'.$schema_id,
4550
+ 'type' => 'number',
4551
+ ),
4552
+ array(
4553
+ 'label' => 'Address Locality',
4554
+ 'id' => 'saswp_lorh_schema_locality_'.$schema_id,
4555
+ 'type' => 'text',
4556
+ ),
4557
+ array(
4558
+ 'label' => 'Address Region',
4559
+ 'id' => 'saswp_lorh_schema_region_'.$schema_id,
4560
+ 'type' => 'text',
4561
+ ),
4562
+ array(
4563
+ 'label' => 'Address Country',
4564
+ 'id' => 'saswp_lorh_schema_country_'.$schema_id,
4565
+ 'type' => 'text',
4566
+ ),
4567
+ array(
4568
+ 'label' => 'Address PostalCode',
4569
+ 'id' => 'saswp_lorh_schema_postal_code_'.$schema_id,
4570
+ 'type' => 'text',
4571
+ ),
4572
+
4573
+ );
4574
+ break;
4575
+
4576
+ case 'HinduTemple':
4577
+
4578
+ $meta_field = array(
4579
+ array(
4580
+ 'label' => 'Name',
4581
+ 'id' => 'saswp_hindutemple_schema_name_'.$schema_id,
4582
+ 'type' => 'text',
4583
+ 'attributes' => array(
4584
+ 'placeholder' => 'Name'
4585
+ ),
4586
+ ),
4587
+ array(
4588
+ 'label' => 'Description',
4589
+ 'id' => 'saswp_hindutemple_schema_description_'.$schema_id,
4590
+ 'type' => 'textarea',
4591
+ 'attributes' => array(
4592
+ 'placeholder' => 'Description'
4593
+ ),
4594
+ ),
4595
+ array(
4596
+ 'label' => 'Image',
4597
+ 'id' => 'saswp_hindutemple_schema_image_'.$schema_id,
4598
+ 'type' => 'media',
4599
+ ),
4600
+ array(
4601
+ 'label' => 'URL',
4602
+ 'id' => 'saswp_hindutemple_schema_url_'.$schema_id,
4603
+ 'type' => 'text',
4604
+ 'default' => get_permalink()
4605
+ ),
4606
+ array(
4607
+ 'label' => 'Has Map',
4608
+ 'id' => 'saswp_hindutemple_schema_hasmap_'.$schema_id,
4609
+ 'type' => 'text',
4610
+ ),
4611
+ array(
4612
+ 'label' => 'Is Accessible For Free',
4613
+ 'id' => 'saswp_hindutemple_schema_is_accesible_free_'.$schema_id,
4614
+ 'type' => 'select',
4615
+ 'options' => array(
4616
+ 'true' => 'True',
4617
+ 'false' => 'False',
4618
+ )
4619
+ ),
4620
+ array(
4621
+ 'label' => 'Maximum Attendee Capacity',
4622
+ 'id' => 'saswp_hindutemple_schema_maximum_a_capacity_'.$schema_id,
4623
+ 'type' => 'text',
4624
+ ),
4625
+ array(
4626
+ 'label' => 'Address Locality',
4627
+ 'id' => 'saswp_hindutemple_schema_locality_'.$schema_id,
4628
+ 'type' => 'text',
4629
+ ),
4630
+ array(
4631
+ 'label' => 'Address Region',
4632
+ 'id' => 'saswp_hindutemple_schema_region_'.$schema_id,
4633
+ 'type' => 'text',
4634
+ ),
4635
+ array(
4636
+ 'label' => 'Address Country',
4637
+ 'id' => 'saswp_hindutemple_schema_country_'.$schema_id,
4638
+ 'type' => 'text',
4639
+ ),
4640
+ array(
4641
+ 'label' => 'Address PostalCode',
4642
+ 'id' => 'saswp_hindutemple_schema_postal_code_'.$schema_id,
4643
+ 'type' => 'text',
4644
+ ),
4645
+
4646
+ );
4647
+ break;
4648
+
4649
+ case 'Church':
4650
+
4651
+ $meta_field = array(
4652
+ array(
4653
+ 'label' => 'Name',
4654
+ 'id' => 'saswp_church_schema_name_'.$schema_id,
4655
+ 'type' => 'text',
4656
+ 'attributes' => array(
4657
+ 'placeholder' => 'Name'
4658
+ ),
4659
+ ),
4660
+ array(
4661
+ 'label' => 'Description',
4662
+ 'id' => 'saswp_church_schema_description_'.$schema_id,
4663
+ 'type' => 'textarea',
4664
+ 'attributes' => array(
4665
+ 'placeholder' => 'Description'
4666
+ ),
4667
+ ),
4668
+ array(
4669
+ 'label' => 'Image',
4670
+ 'id' => 'saswp_church_schema_image_'.$schema_id,
4671
+ 'type' => 'media',
4672
+ ),
4673
+ array(
4674
+ 'label' => 'URL',
4675
+ 'id' => 'saswp_church_schema_url_'.$schema_id,
4676
+ 'type' => 'text',
4677
+ 'default' => get_permalink()
4678
+ ),
4679
+ array(
4680
+ 'label' => 'Has Map',
4681
+ 'id' => 'saswp_church_schema_hasmap_'.$schema_id,
4682
+ 'type' => 'text',
4683
+ ),
4684
+ array(
4685
+ 'label' => 'Is Accessible For Free',
4686
+ 'id' => 'saswp_church_schema_is_accesible_free_'.$schema_id,
4687
+ 'type' => 'select',
4688
+ 'options' => array(
4689
+ 'true' => 'True',
4690
+ 'false' => 'False',
4691
+ )
4692
+ ),
4693
+ array(
4694
+ 'label' => 'Maximum Attendee Capacity',
4695
+ 'id' => 'saswp_church_schema_maximum_a_capacity_'.$schema_id,
4696
+ 'type' => 'text',
4697
+ ),
4698
+ array(
4699
+ 'label' => 'Address Locality',
4700
+ 'id' => 'saswp_church_schema_locality_'.$schema_id,
4701
+ 'type' => 'text',
4702
+ ),
4703
+ array(
4704
+ 'label' => 'Address Region',
4705
+ 'id' => 'saswp_church_schema_region_'.$schema_id,
4706
+ 'type' => 'text',
4707
+ ),
4708
+ array(
4709
+ 'label' => 'Address Country',
4710
+ 'id' => 'saswp_church_schema_country_'.$schema_id,
4711
+ 'type' => 'text',
4712
+ ),
4713
+ array(
4714
+ 'label' => 'Address PostalCode',
4715
+ 'id' => 'saswp_church_schema_postal_code_'.$schema_id,
4716
+ 'type' => 'text',
4717
+ ),
4718
+
4719
+ );
4720
+ break;
4721
+
4722
+ case 'Mosque':
4723
+
4724
+ $meta_field = array(
4725
+ array(
4726
+ 'label' => 'Name',
4727
+ 'id' => 'saswp_mosque_schema_name_'.$schema_id,
4728
+ 'type' => 'text',
4729
+ 'attributes' => array(
4730
+ 'placeholder' => 'Name'
4731
+ ),
4732
+ ),
4733
+ array(
4734
+ 'label' => 'Description',
4735
+ 'id' => 'saswp_mosque_schema_description_'.$schema_id,
4736
+ 'type' => 'textarea',
4737
+ 'attributes' => array(
4738
+ 'placeholder' => 'Description'
4739
+ ),
4740
+ ),
4741
+ array(
4742
+ 'label' => 'Image',
4743
+ 'id' => 'saswp_mosque_schema_image_'.$schema_id,
4744
+ 'type' => 'media',
4745
+ ),
4746
+ array(
4747
+ 'label' => 'URL',
4748
+ 'id' => 'saswp_mosque_schema_url_'.$schema_id,
4749
+ 'type' => 'text',
4750
+ 'default' => get_permalink()
4751
+ ),
4752
+ array(
4753
+ 'label' => 'Has Map',
4754
+ 'id' => 'saswp_mosque_schema_hasmap_'.$schema_id,
4755
+ 'type' => 'text',
4756
+ ),
4757
+ array(
4758
+ 'label' => 'Is Accessible For Free',
4759
+ 'id' => 'saswp_mosque_schema_is_accesible_free_'.$schema_id,
4760
+ 'type' => 'select',
4761
+ 'options' => array(
4762
+ 'true' => 'True',
4763
+ 'false' => 'False',
4764
+ )
4765
+ ),
4766
+ array(
4767
+ 'label' => 'Maximum Attendee Capacity',
4768
+ 'id' => 'saswp_mosque_schema_maximum_a_capacity_'.$schema_id,
4769
+ 'type' => 'text',
4770
+ ),
4771
+ array(
4772
+ 'label' => 'Address Locality',
4773
+ 'id' => 'saswp_mosque_schema_locality_'.$schema_id,
4774
+ 'type' => 'text',
4775
+ ),
4776
+ array(
4777
+ 'label' => 'Address Region',
4778
+ 'id' => 'saswp_mosque_schema_region_'.$schema_id,
4779
+ 'type' => 'text',
4780
+ ),
4781
+ array(
4782
+ 'label' => 'Address Country',
4783
+ 'id' => 'saswp_mosque_schema_country_'.$schema_id,
4784
+ 'type' => 'text',
4785
+ ),
4786
+ array(
4787
+ 'label' => 'Address PostalCode',
4788
+ 'id' => 'saswp_mosque_schema_postal_code_'.$schema_id,
4789
+ 'type' => 'text',
4790
+ ),
4791
+
4792
+ );
4793
+ break;
4794
+
4795
  default:
4796
  break;
4797
  }
view/schema_type.php CHANGED
@@ -359,10 +359,12 @@
359
  $output = '';
360
  $item = sanitize_text_field($_GET['item']);
361
  $schema_id = sanitize_text_field($_GET['schema_id']);
362
- $post_id = sanitize_text_field($_GET['post_id']);
363
- $post_specific = sanitize_text_field($_GET['post_specific']);
364
 
365
-
 
 
 
366
  $meta_fields = saswp_item_reviewed_fields($item, $post_specific, $schema_id);
367
 
368
 
@@ -534,6 +536,7 @@
534
  $schema_type = '';
535
  $business_type = '';
536
  $custom_logo_id = '';
 
537
 
538
  $business_details = array();
539
  $logo = array();
@@ -594,6 +597,9 @@
594
  break;
595
 
596
  default:
 
 
 
597
  break;
598
  }
599
 
@@ -661,23 +667,59 @@
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',
@@ -841,13 +883,27 @@
841
  <td><select class="saswp-schame-type-select" id="schema_type" name="schema_type">
842
  <?php
843
 
844
- foreach ($all_schema_array as $key => $value) {
845
- $sel = '';
846
- if($schema_type==$key){
847
- $sel = 'selected';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
848
  }
849
- echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
850
- }
851
  ?>
852
  </select>
853
 
@@ -858,7 +914,7 @@
858
  <?php } ?>
859
 
860
  </td>
861
- </tr>
862
  <tr class="saswp-business-type-tr" <?php echo $style_business_type; ?>>
863
  <td>
864
  <?php echo esc_html__('Business Type', 'schema-and-structured-data-for-wp' ); ?>
@@ -1139,9 +1195,14 @@
1139
  <td><input value="<?php if(isset($business_details['local_menu'])){echo esc_attr($business_details['local_menu']); } ?>" type="text" name="local_menu" placeholder="<?php echo esc_html__('http://www.example.com/menu', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1140
  </tr>
1141
 
 
 
 
 
 
1142
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1143
  <td><?php echo esc_html__('Serves Cuisine ', 'schema-and-structured-data-for-wp' ); ?></td>
1144
- <td><input value="<?php echo esc_attr($business_details['local_serves_cuisine']); ?>" type="text" name="local_serves_cuisine" placeholder="<?php echo esc_html__('American, Chinese', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1145
  </tr>
1146
 
1147
 
@@ -1261,7 +1322,7 @@
1261
  <td><?php echo esc_html__('Item Reviewed Type', 'schema-and-structured-data-for-wp' ); ?></td>
1262
  <td>
1263
 
1264
- <select data-id="<?php echo esc_attr($post->ID); ?>" name="saswp_review_schema_item_type" class="saswp-item-reviewed">
1265
  <?php
1266
  foreach ($item_reviewed as $key => $value) {
1267
  $sel = '';
@@ -1292,128 +1353,7 @@
1292
 
1293
 
1294
  <!-- Review Schema type ends here -->
1295
-
1296
- <!-- Product Schema type starts here -->
1297
-
1298
- <tr class="saswp-product-text-field-tr">
1299
- <td><?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?></td>
1300
- <td><input value="<?php if(isset($product_details['saswp_product_schema_name'])){echo esc_attr($product_details['saswp_product_schema_name']); } ?>" type="text" name="saswp_product_schema_name" placeholder="<?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1301
- </tr>
1302
- <tr class="saswp-product-text-field-tr">
1303
- <td><?php echo esc_html__('Description', 'schema-and-structured-data-for-wp' ); ?></td>
1304
- <td><textarea placeholder="Description" rows="3" cols="70" name="saswp_product_schema_description"><?php if(isset($product_details['saswp_product_schema_description'])){echo esc_attr($product_details['saswp_product_schema_description']); } ?></textarea></td>
1305
- </tr>
1306
- <tr class="saswp-product-text-field-tr">
1307
- <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
1308
- <td style="display: flex; width: 97%">
1309
- <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_url($product_details['saswp_product_schema_image']['url']);} else { echo esc_url(saswp_remove_warnings($logo, 0, 'saswp_string')); } ?>" id="saswp_product_schema_image" type="text" name="saswp_product_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
1310
- <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_attr($product_details['saswp_product_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_product_schema_image_id" type="hidden" name="saswp_product_schema_image[id]">
1311
- <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_attr($product_details['saswp_product_schema_image']['width']);} else { echo esc_attr(saswp_remove_warnings($logo, 1, 'saswp_string')); } ?>" data-id="saswp_product_schema_image_width" type="hidden" name="saswp_product_schema_image[width]">
1312
- <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_attr($product_details['saswp_product_schema_image']['height']);} else { echo esc_attr(saswp_remove_warnings($logo, 2, 'saswp_string')); } ?>" data-id="saswp_product_schema_image_height" type="hidden" name="saswp_product_schema_image[height]">
1313
- <input data-id="media" class="button" id="saswp_product_schema_image_button" type="button" value="Upload">
1314
- </td>
1315
- </tr>
1316
-
1317
- <tr class="saswp-product-text-field-tr">
1318
- <td><?php echo esc_html__('Brand Name', 'schema-and-structured-data-for-wp' ); ?></td>
1319
- <td><input value="<?php if(isset($product_details['saswp_product_schema_brand_name'])){echo esc_attr($product_details['saswp_product_schema_brand_name']); } ?>" type="text" name="saswp_product_schema_brand_name" placeholder="<?php echo esc_html__('Brand Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1320
- </tr>
1321
-
1322
- <tr class="saswp-product-text-field-tr">
1323
- <td><?php echo esc_html__('Price', 'schema-and-structured-data-for-wp' ); ?></td>
1324
- <td><input value="<?php if(isset($product_details['saswp_product_schema_price'])){echo esc_attr($product_details['saswp_product_schema_price']); } ?>" type="text" name="saswp_product_schema_price" placeholder="<?php echo esc_html__('Eg. 95.00', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1325
- </tr>
1326
-
1327
- <tr class="saswp-product-text-field-tr">
1328
- <td><?php echo esc_html__('Price Valid Until', 'schema-and-structured-data-for-wp' ); ?></td>
1329
- <td><input class="saswp-local-schema-datepicker-picker" value="<?php if(isset($product_details['saswp_product_schema_priceValidUntil'])){echo esc_attr($product_details['saswp_product_schema_priceValidUntil']); } ?>" type="text" name="saswp_product_schema_priceValidUntil"></td>
1330
- </tr>
1331
-
1332
- <tr class="saswp-product-text-field-tr">
1333
- <td><?php echo esc_html__('Currency', 'schema-and-structured-data-for-wp' ); ?></td>
1334
- <td><input value="<?php if(isset($product_details['saswp_product_schema_currency'])){echo esc_attr($product_details['saswp_product_schema_currency']); } ?>" type="text" name="saswp_product_schema_currency" placeholder="<?php echo esc_html__('Eg: GBP, RMB, USD', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1335
- </tr>
1336
-
1337
- <tr class="saswp-product-text-field-tr">
1338
- <td><?php echo esc_html__('Availability', 'schema-and-structured-data-for-wp' ); ?></td>
1339
- <td>
1340
- <select name="saswp_product_schema_availability">
1341
- <?php
1342
-
1343
- foreach ($availability as $key => $value) {
1344
- $sel = '';
1345
- if(saswp_remove_warnings($product_details, 'saswp_product_schema_availability', 'saswp_string')==$key){
1346
- $sel = 'selected';
1347
- }
1348
- echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
1349
- }
1350
- ?>
1351
- </select>
1352
- </td>
1353
- </tr>
1354
-
1355
- <tr class="saswp-product-text-field-tr">
1356
- <td><?php echo esc_html__('Item Condition', 'schema-and-structured-data-for-wp' ); ?></td>
1357
- <td>
1358
- <select name="saswp_product_schema_condition">
1359
- <?php
1360
-
1361
- foreach ($item_condition as $key => $value) {
1362
- $sel = '';
1363
- if(saswp_remove_warnings($product_details, 'saswp_product_schema_condition', 'saswp_string')==$key){
1364
- $sel = 'selected';
1365
- }
1366
- echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
1367
- }
1368
- ?>
1369
- </select>
1370
- </td>
1371
- </tr>
1372
-
1373
- <tr class="saswp-product-text-field-tr">
1374
- <td><?php echo esc_html__('SKU', 'schema-and-structured-data-for-wp' ); ?></td>
1375
- <td><input value="<?php if(isset($product_details['saswp_product_schema_sku'])){echo esc_attr($product_details['saswp_product_schema_sku']); } ?>" type="text" name="saswp_product_schema_sku" ></td>
1376
- </tr>
1377
-
1378
- <tr class="saswp-product-text-field-tr">
1379
- <td><?php echo esc_html__('MPN', 'schema-and-structured-data-for-wp' ); ?></td>
1380
- <td><input value="<?php if(isset($product_details['saswp_product_schema_mpn'])){echo esc_attr($product_details['saswp_product_schema_mpn']); } ?>" type="text" name="saswp_product_schema_mpn" >
1381
- <span>OR</span>
1382
- </td>
1383
- </tr>
1384
-
1385
- <tr class="saswp-product-text-field-tr">
1386
- <td><?php echo esc_html__('ISBN', 'schema-and-structured-data-for-wp' ); ?></td>
1387
- <td><input value="<?php if(isset($product_details['saswp_product_schema_isbn'])){echo esc_attr($product_details['saswp_product_schema_isbn']); } ?>" type="text" name="saswp_product_schema_isbn" >
1388
- <span>OR</span>
1389
- </td>
1390
- </tr>
1391
- <tr class="saswp-product-text-field-tr">
1392
- <td><?php echo esc_html__('GTIN8', 'schema-and-structured-data-for-wp' ); ?></td>
1393
- <td><input value="<?php if(isset($product_details['saswp_product_schema_gtin8'])){echo esc_attr($product_details['saswp_product_schema_gtin8']); } ?>" type="text" name="saswp_product_schema_gtin8" >
1394
- </td>
1395
- </tr>
1396
-
1397
-
1398
-
1399
- <tr class="saswp-product-text-field-tr">
1400
- <td><?php echo esc_html__('Aggregate Rating', 'schema-and-structured-data-for-wp' ); ?></td>
1401
- <td>
1402
- <input class="saswp-enable-rating-review-product" type="checkbox" name="saswp_product_schema_enable_rating" value="1" <?php if(isset($product_details['saswp_product_schema_enable_rating'])){echo 'checked'; }else{ echo ''; } ?>>
1403
- </td>
1404
- </tr>
1405
-
1406
- <tr class="saswp-product-text-field-tr saswp-rating-review-product">
1407
- <td><?php echo esc_html__('Rating', 'schema-and-structured-data-for-wp' ); ?></td>
1408
- <td><input value="<?php if(isset($product_details['saswp_product_schema_rating'])){echo esc_attr($product_details['saswp_product_schema_rating']); } ?>" type="text" name="saswp_product_schema_rating" placeholder="<?php echo esc_html__('5.0', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1409
- </tr>
1410
- <tr class="saswp-product-text-field-tr saswp-rating-review-product">
1411
- <td><?php echo esc_html__('Number of Reviews', 'schema-and-structured-data-for-wp' ); ?></td>
1412
- <td><input value="<?php if(isset($product_details['saswp_product_schema_review_count'])){echo esc_attr($product_details['saswp_product_schema_review_count']); } ?>" type="text" name="saswp_product_schema_review_count" placeholder="<?php echo esc_html__('10', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1413
- </tr>
1414
-
1415
- <!-- Product Schema type ends here -->
1416
-
1417
  <!-- AudioObject Schema type starts here -->
1418
 
1419
  <tr class="saswp-audio-text-field-tr">
@@ -1599,6 +1539,15 @@
1599
 
1600
  <!-- Event Schema type ends here -->
1601
 
 
 
 
 
 
 
 
 
 
1602
  </table>
1603
 
1604
  </div>
@@ -1678,6 +1627,10 @@
1678
  $local_business_details['local_menu'] = sanitize_text_field($_POST['local_menu']);
1679
  }
1680
 
 
 
 
 
1681
  if ( isset( $_POST['local_serves_cuisine'] ) ){
1682
  $local_business_details['local_serves_cuisine'] = sanitize_text_field($_POST['local_serves_cuisine']);
1683
  }
@@ -1823,69 +1776,7 @@
1823
 
1824
 
1825
  }
1826
-
1827
- if($schema_type =='Product'){
1828
-
1829
- if ( isset( $_POST['saswp_product_schema_name'] ) ){
1830
- $product_schema_details['saswp_product_schema_name'] = sanitize_text_field($_POST['saswp_product_schema_name']);
1831
- }
1832
- if ( isset( $_POST['saswp_product_schema_description'] ) ){
1833
- $product_schema_details['saswp_product_schema_description'] = sanitize_textarea_field($_POST['saswp_product_schema_description']);
1834
- }
1835
- if ( isset( $_POST['saswp_product_schema_image'] ) ){
1836
- $product_schema_details['saswp_product_schema_image']['id'] = sanitize_text_field($_POST['saswp_product_schema_image']['id']);
1837
- $product_schema_details['saswp_product_schema_image']['url'] = esc_url_raw($_POST['saswp_product_schema_image']['url']);
1838
- $product_schema_details['saswp_product_schema_image']['width'] = sanitize_text_field($_POST['saswp_product_schema_image']['width']);
1839
- $product_schema_details['saswp_product_schema_image']['height'] = sanitize_text_field($_POST['saswp_product_schema_image']['height']);
1840
- }
1841
-
1842
- if ( isset( $_POST['saswp_product_schema_brand_name'] ) ){
1843
- $product_schema_details['saswp_product_schema_brand_name'] = sanitize_text_field($_POST['saswp_product_schema_brand_name']);
1844
- }
1845
- if ( isset( $_POST['saswp_product_schema_price'] ) ){
1846
- $product_schema_details['saswp_product_schema_price'] = sanitize_text_field($_POST['saswp_product_schema_price']);
1847
- }
1848
- if ( isset( $_POST['saswp_product_schema_currency'] ) ){
1849
- $product_schema_details['saswp_product_schema_currency'] = sanitize_text_field($_POST['saswp_product_schema_currency']);
1850
- }
1851
- if ( isset( $_POST['saswp_product_schema_availability'] ) ){
1852
- $product_schema_details['saswp_product_schema_availability'] = sanitize_text_field($_POST['saswp_product_schema_availability']);
1853
- }
1854
- if ( isset( $_POST['saswp_product_schema_condition'] ) ){
1855
- $product_schema_details['saswp_product_schema_condition'] = sanitize_text_field($_POST['saswp_product_schema_condition']);
1856
- }
1857
-
1858
-
1859
- if ( isset( $_POST['saswp_product_schema_sku'] ) ){
1860
- $product_schema_details['saswp_product_schema_sku'] = sanitize_text_field($_POST['saswp_product_schema_sku']);
1861
- }
1862
- if ( isset( $_POST['saswp_product_schema_mpn'] ) ){
1863
- $product_schema_details['saswp_product_schema_mpn'] = sanitize_text_field($_POST['saswp_product_schema_mpn']);
1864
- }
1865
- if ( isset( $_POST['saswp_product_schema_isbn'] ) ){
1866
- $product_schema_details['saswp_product_schema_isbn'] = sanitize_text_field($_POST['saswp_product_schema_isbn']);
1867
- }
1868
- if ( isset( $_POST['saswp_product_schema_gtin8'] ) ){
1869
- $product_schema_details['saswp_product_schema_gtin8'] = sanitize_text_field($_POST['saswp_product_schema_gtin8']);
1870
- }
1871
- if ( isset( $_POST['saswp_product_schema_priceValidUntil'] ) ){
1872
- $product_schema_details['saswp_product_schema_priceValidUntil'] = sanitize_text_field($_POST['saswp_product_schema_priceValidUntil']);
1873
- }
1874
-
1875
- if ( isset( $_POST['saswp_product_schema_enable_rating'] ) ){
1876
- $product_schema_details['saswp_product_schema_enable_rating'] = sanitize_text_field($_POST['saswp_product_schema_enable_rating']);
1877
- }
1878
- if ( isset( $_POST['saswp_product_schema_rating'] ) ){
1879
- $product_schema_details['saswp_product_schema_rating'] = sanitize_text_field($_POST['saswp_product_schema_rating']);
1880
- }
1881
- if ( isset( $_POST['saswp_product_schema_review_count'] ) ){
1882
- $product_schema_details['saswp_product_schema_review_count'] = sanitize_text_field($_POST['saswp_product_schema_review_count']);
1883
- }
1884
-
1885
- update_post_meta( $post_id, 'saswp_product_schema_details', $product_schema_details );
1886
-
1887
- }
1888
-
1889
  if($schema_type == 'AudioObject' ){
1890
 
1891
  if ( isset( $_POST['saswp_audio_schema_name'] ) ){
@@ -2016,6 +1907,17 @@
2016
 
2017
  update_post_meta( $post_id, 'saswp_event_schema_details', $event_schema_details );
2018
  }
 
 
 
 
 
 
 
 
 
 
 
2019
 
2020
  }
2021
 
359
  $output = '';
360
  $item = sanitize_text_field($_GET['item']);
361
  $schema_id = sanitize_text_field($_GET['schema_id']);
362
+ $post_id = sanitize_text_field($_GET['post_id']);
 
363
 
364
+ if(isset($_GET['post_specific'])){
365
+ $post_specific = sanitize_text_field($_GET['post_specific']);
366
+ }
367
+
368
  $meta_fields = saswp_item_reviewed_fields($item, $post_specific, $schema_id);
369
 
370
 
536
  $schema_type = '';
537
  $business_type = '';
538
  $custom_logo_id = '';
539
+ $speakable = '';
540
 
541
  $business_details = array();
542
  $logo = array();
597
  break;
598
 
599
  default:
600
+
601
+ $speakable = esc_sql ( get_post_meta($post->ID, 'saswp_enable_speakable_schema', true) );
602
+
603
  break;
604
  }
605
 
667
  );
668
 
669
  $all_schema_array = array(
670
+
671
+ 'Accommodation' => array(
672
+ 'Apartment' => 'Apartment',
673
+ 'House' => 'House',
674
+ 'SingleFamilyResidence' => 'SingleFamilyResidence',
675
+ ),
676
+ 'CreativeWork' => array(
677
+ 'Article' => 'Article',
678
+ 'Blogposting' => 'Blogposting',
679
+ 'Course' => 'Course',
680
+ 'DiscussionForumPosting' => 'DiscussionForumPosting',
681
+ 'HowTo' => 'HowTo',
682
+ 'NewsArticle' => 'NewsArticle',
683
+ 'qanda' => 'Q&A',
684
+ 'Review' => 'Review',
685
+ 'Recipe' => 'Recipe',
686
+ 'TVSeries' => 'TVSeries',
687
+ 'SoftwareApplication' => 'SoftwareApplication',
688
+ 'TechArticle' => 'TechArticle',
689
+ 'WebPage' => 'WebPage'
690
+ ),
691
+ 'Event' => array(
692
+ 'Event' => 'Event',
693
+ ),
694
+ 'Game' => array(
695
+ 'VideoGame' => 'VideoGame'
696
+ ),
697
+ 'Intangible' => array(
698
+ 'Service' => 'Service',
699
+ ),
700
+ 'Media' => array(
701
+ 'AudioObject' => 'AudioObject',
702
+ 'VideoObject' => 'VideoObject'
703
+ ),
704
+ 'Medical' => array(
705
+ 'MedicalCondition' => 'MedicalCondition',
706
+ ),
707
+ 'Organization' => array(
708
+ 'local_business' => 'Local Business',
709
+ ),
710
+ 'Product' => array(
711
+ 'Product' => 'Product',
712
+ ),
713
+ 'Place' => array(
714
+ 'TouristAttraction' => 'TouristAttraction',
715
+ 'TouristDestination' => 'TouristDestination',
716
+ 'LandmarksOrHistoricalBuildings' => 'LandmarksOrHistoricalBuildings',
717
+ ),
718
+ 'PlaceOfWorship' => array(
719
+ 'HinduTemple' => 'HinduTemple',
720
+ 'Church' => 'Church',
721
+ 'Mosque' => 'Mosque',
722
+ )
723
  );
724
  $all_business_type = array(
725
  'animalshelter' => 'Animal Shelter',
883
  <td><select class="saswp-schame-type-select" id="schema_type" name="schema_type">
884
  <?php
885
 
886
+ if(!empty($all_schema_array)){
887
+
888
+ foreach ($all_schema_array as $parent_type => $type) {
889
+
890
+ $option_html = '';
891
+
892
+ foreach($type as $key => $value){
893
+ $sel = '';
894
+ if($schema_type == $key){
895
+ $sel = 'selected';
896
+ }
897
+ $option_html.= "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
898
+
899
+ }
900
+
901
+ echo '<optgroup label="'.$parent_type.'">';
902
+ echo $option_html;
903
+ echo '</optgroup>';
904
  }
905
+
906
+ }
907
  ?>
908
  </select>
909
 
914
  <?php } ?>
915
 
916
  </td>
917
+ </tr>
918
  <tr class="saswp-business-type-tr" <?php echo $style_business_type; ?>>
919
  <td>
920
  <?php echo esc_html__('Business Type', 'schema-and-structured-data-for-wp' ); ?>
1195
  <td><input value="<?php if(isset($business_details['local_menu'])){echo esc_attr($business_details['local_menu']); } ?>" type="text" name="local_menu" placeholder="<?php echo esc_html__('http://www.example.com/menu', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1196
  </tr>
1197
 
1198
+ <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1199
+ <td><?php echo esc_html__('HasMap', 'schema-and-structured-data-for-wp' ); ?></td>
1200
+ <td><input value="<?php if(isset($business_details['local_hasmap'])){echo esc_attr($business_details['local_hasmap']); } ?>" type="text" name="local_hasmap" placeholder="https://goo.gl/maps/tb9hzMLNp942" ></td>
1201
+ </tr>
1202
+
1203
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
1204
  <td><?php echo esc_html__('Serves Cuisine ', 'schema-and-structured-data-for-wp' ); ?></td>
1205
+ <td><input value="<?php isset($business_details['local_serves_cuisine'])? esc_attr($business_details['local_serves_cuisine']): ''; ?>" type="text" name="local_serves_cuisine" placeholder="<?php echo esc_html__('American, Chinese', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1206
  </tr>
1207
 
1208
 
1322
  <td><?php echo esc_html__('Item Reviewed Type', 'schema-and-structured-data-for-wp' ); ?></td>
1323
  <td>
1324
 
1325
+ <select data-id="<?php if(is_object($post)){ echo esc_attr($post->ID); } ?>" name="saswp_review_schema_item_type" class="saswp-item-reviewed">
1326
  <?php
1327
  foreach ($item_reviewed as $key => $value) {
1328
  $sel = '';
1353
 
1354
 
1355
  <!-- Review Schema type ends here -->
1356
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1357
  <!-- AudioObject Schema type starts here -->
1358
 
1359
  <tr class="saswp-audio-text-field-tr">
1539
 
1540
  <!-- Event Schema type ends here -->
1541
 
1542
+
1543
+ <tr>
1544
+ <td>
1545
+ <label for="saswp-speakable"><?php echo esc_html__( 'Speakable ' ,'schema-and-structured-data-for-wp');?></label>
1546
+ </td>
1547
+ <td>
1548
+ <input class="saswp-enable-speakable" type="checkbox" name="saswp_enable_speakable_schema" value="1" <?php if(isset($speakable) && $speakable == 1){echo 'checked'; }else{ echo ''; } ?>>
1549
+ </td>
1550
+ </tr>
1551
  </table>
1552
 
1553
  </div>
1627
  $local_business_details['local_menu'] = sanitize_text_field($_POST['local_menu']);
1628
  }
1629
 
1630
+ if ( isset( $_POST['local_hasmap'] ) ){
1631
+ $local_business_details['local_hasmap'] = sanitize_text_field($_POST['local_hasmap']);
1632
+ }
1633
+
1634
  if ( isset( $_POST['local_serves_cuisine'] ) ){
1635
  $local_business_details['local_serves_cuisine'] = sanitize_text_field($_POST['local_serves_cuisine']);
1636
  }
1776
 
1777
 
1778
  }
1779
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1780
  if($schema_type == 'AudioObject' ){
1781
 
1782
  if ( isset( $_POST['saswp_audio_schema_name'] ) ){
1907
 
1908
  update_post_meta( $post_id, 'saswp_event_schema_details', $event_schema_details );
1909
  }
1910
+
1911
+ if ( isset( $_POST['saswp_enable_speakable_schema'] ) ){
1912
+
1913
+ update_post_meta( $post_id, 'saswp_enable_speakable_schema', sanitize_text_field($_POST['saswp_enable_speakable_schema']) );
1914
+
1915
+ }else{
1916
+
1917
+ update_post_meta( $post_id, 'saswp_enable_speakable_schema', '0' );
1918
+
1919
+ }
1920
+
1921
 
1922
  }
1923