Schema & Structured Data for WP & AMP - Version 1.3

Version Description

(11 March 2019) =

  • Added: Event schema type added to the schema type list #157
  • Added: Compatibility with The Events Calendar plugin ( https://wordpress.org/plugins/the-events-calendar/ ) has been added in AMP. #157
  • Added: New Organization type list has been added to knowledge graph section including "NewsMediaOrganization". #147
  • Added: Compatibility with ( Tagyeem Review Plugin & Jannah News Theme ). #151
  • Bug Fixed: ItemAvailability text "onbackorder" should be converted to "PreOrder" for product schema #161
  • Bug Fixed: Bad escape sequence in string. #168
Download this release

Release Info

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

Code changes from version 1.2 to 1.3

admin_section/css/main-style.css CHANGED
@@ -8,7 +8,7 @@ and open the template in the editor.
8
  Author : Magazine3
9
  */
10
  .saswp_hide{
11
- display: none;
12
  }
13
  .saswp-general table th{
14
  width: auto;
8
  Author : Magazine3
9
  */
10
  .saswp_hide{
11
+ display: none !important;
12
  }
13
  .saswp-general table th{
14
  width: auto;
admin_section/js/main-script.js CHANGED
@@ -54,6 +54,10 @@ jQuery(document).ready(function($){
54
  $(".saswp-product-text-field-tr").show();
55
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
56
  }
 
 
 
 
57
  if(schematype == 'AudioObject'){
58
  $(".saswp-audio-text-field-tr").show();
59
  }
@@ -111,6 +115,10 @@ jQuery(document).ready(function($){
111
  $(".saswp-review-text-field-tr").show();
112
  $(".saswp-review-text-field-tr").find('select').attr('disabled', false);
113
  }
 
 
 
 
114
  saswp_enable_rating_review();
115
  }).change();
116
 
@@ -363,6 +371,15 @@ jQuery(document).ready(function($){
363
  }
364
  break;
365
 
 
 
 
 
 
 
 
 
 
366
 
367
  default:
368
  break;
@@ -371,26 +388,27 @@ jQuery(document).ready(function($){
371
  }).change();
372
 
373
  $("#saswp_kb_type").change(function(){
374
- var datatype = $(this).val();
375
- for(var i=1;i<=11;i++){
376
- if(datatype ==="Person"){
377
- if(i<6){
378
- $( ".saswp-knowledge-base li:eq('"+i+"')" ).hide();
379
- }else{
380
- $( ".saswp-knowledge-base li:eq('"+i+"')" ).show();
381
- }
382
- }else if(datatype ==="Organization"){
383
- if(i<6){
384
- $( ".saswp-knowledge-base li:eq('"+i+"')" ).show();
385
- }else{
386
- $( ".saswp-knowledge-base li:eq('"+i+"')" ).hide();
387
- }
388
- $( ".saswp-knowledge-base li:eq(11)" ).show();
389
- }else{
390
- $( ".saswp-knowledge-base li:eq('"+i+"')" ).hide();
391
- }
392
-
393
- }
 
394
  }).change();
395
 
396
 
54
  $(".saswp-product-text-field-tr").show();
55
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
56
  }
57
+ if(schematype == 'Event'){
58
+ $(".saswp-event-text-field-tr").show();
59
+ $(".saswp-option-table-class tr").find('select').attr('disabled', false);
60
+ }
61
  if(schematype == 'AudioObject'){
62
  $(".saswp-audio-text-field-tr").show();
63
  }
115
  $(".saswp-review-text-field-tr").show();
116
  $(".saswp-review-text-field-tr").find('select').attr('disabled', false);
117
  }
118
+ if(schematype == 'Event'){
119
+ $(".saswp-event-text-field-tr").show();
120
+ $(".saswp-event-text-field-tr").find('select').attr('disabled', false);
121
+ }
122
  saswp_enable_rating_review();
123
  }).change();
124
 
371
  }
372
  break;
373
 
374
+ case 'saswp-the-events-calendar-checkbox':
375
+
376
+ if ($(this).is(':checked')) {
377
+ $("#saswp-the-events-calendar").val(1);
378
+ }else{
379
+ $("#saswp-the-events-calendar").val(0);
380
+ }
381
+ break;
382
+
383
 
384
  default:
385
  break;
388
  }).change();
389
 
390
  $("#saswp_kb_type").change(function(){
391
+ var datatype = $(this).val();
392
+
393
+ $(".saswp_org_fields, .saswp_person_fields").parent().parent().addClass('saswp_hide');
394
+ $(".saswp_kg_logo").parent().parent().parent().addClass('saswp_hide');
395
+
396
+
397
+ if(datatype == 'Organization'){
398
+
399
+ $(".saswp_org_fields").parent().parent().removeClass('saswp_hide');
400
+ $(".saswp_person_fields").parent().parent().addClass('saswp_hide');
401
+ $(".saswp_kg_logo").parent().parent().parent().removeClass('saswp_hide');
402
+ $("#sd-person-image").parent().parent().parent().addClass('saswp_hide');
403
+ }
404
+ if(datatype == 'Person'){
405
+
406
+ $(".saswp_org_fields").parent().parent().addClass('saswp_hide');
407
+ $(".saswp_person_fields").parent().parent().removeClass('saswp_hide');
408
+ $(".saswp_kg_logo").parent().parent().parent().removeClass('saswp_hide');
409
+ $("#sd-person-image").parent().parent().parent().removeClass('saswp_hide');
410
+ }
411
+
412
  }).change();
413
 
414
 
admin_section/js/saswp-add-new.js CHANGED
@@ -266,10 +266,14 @@ jQuery(document).ready(function($) {
266
  // $("#saswp_dayofweek").attr('disabled', false);
267
  $('.select-post-type').val('show_globally').trigger('change');
268
  }
269
- if(schematype == 'Service'){
270
  $(".saswp-service-text-field-tr").show();
271
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
272
  }
 
 
 
 
273
  if(schematype == 'Product'){
274
  $(".saswp-product-text-field-tr").show();
275
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
@@ -318,6 +322,10 @@ jQuery(document).ready(function($) {
318
  $(".saswp-service-text-field-tr").show();
319
  $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
320
  }
 
 
 
 
321
  if(schematype == 'Product'){
322
  $(".saswp-product-text-field-tr").show();
323
  $(".saswp-product-text-field-tr").find('select').attr('disabled', false);
266
  // $("#saswp_dayofweek").attr('disabled', false);
267
  $('.select-post-type').val('show_globally').trigger('change');
268
  }
269
+ if(schematype == 'Service'){
270
  $(".saswp-service-text-field-tr").show();
271
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
272
  }
273
+ if(schematype == 'Event'){
274
+ $(".saswp-event-text-field-tr").show();
275
+ $(".saswp-option-table-class tr").find('select').attr('disabled', false);
276
+ }
277
  if(schematype == 'Product'){
278
  $(".saswp-product-text-field-tr").show();
279
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
322
  $(".saswp-service-text-field-tr").show();
323
  $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
324
  }
325
+ if(schematype == 'Event'){
326
+ $(".saswp-event-text-field-tr").show();
327
+ $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
328
+ }
329
  if(schematype == 'Product'){
330
  $(".saswp-product-text-field-tr").show();
331
  $(".saswp-product-text-field-tr").find('select').attr('disabled', false);
admin_section/settings.php CHANGED
@@ -5,11 +5,14 @@
5
  *
6
  */
7
  add_action( 'plugin_action_links_' . plugin_basename( SASWP_DIR_NAME_FILE ), 'saswp_plugin_action_links' );
 
8
  function saswp_plugin_action_links( $links ) {
 
9
  $nonce = wp_create_nonce( 'saswp_install_wizard_nonce' );
10
  $links[] = '<a href="' . esc_url( admin_url( 'edit.php?post_type=saswp&page=structured_data_options' ) ) . '">' . esc_html__( 'Settings', 'schema-and-structured-data-for-wp' ) . '</a>';
11
  $links[] = '<a href="'. esc_url( admin_url( 'plugins.php?page=saswp-setup-wizard' ).'&_saswp_nonce='.$nonce).'">' . esc_html__( 'Start setup wizard &raquo;', 'schema-and-structured-data-for-wp' ) . '</a>';
12
  return $links;
 
13
  }
14
 
15
  function saswp_add_menu_links() {
@@ -294,13 +297,10 @@ function saswp_schema_page_callback(){
294
  'type' => 'media',
295
  ),
296
  );
297
- echo '<h2>'.esc_html__('Default Values','schema-and-structured-data-for-wp').'</h2>';
298
  echo '<div class="saswp-schema-type-fields">';
299
  $field_objs->saswp_field_generator($meta_fields_default, $settings);
300
- echo '</div>';
301
- ?>
302
-
303
- <?php
304
  }
305
 
306
  function saswp_amp_page_callback(){
@@ -473,22 +473,44 @@ function saswp_knowledge_page_callback(){
473
  $field_objs = new saswp_fields_generator();
474
  $meta_fields = array(
475
  array(
476
- 'label' => 'Data Type',
477
- 'id' => 'saswp_kb_type',
478
- 'name' => 'sd_data[saswp_kb_type]',
479
- 'type' => 'select',
480
  'options' => array(
481
- ''=>'Select an item',
482
- 'Organization'=>'Organization',
483
- 'Person'=>'Person',
484
  )
485
  ),
486
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  array(
488
  'label' => 'Name',
489
  'id' => 'sd_name',
490
  'name' => 'sd_data[sd_name]',
491
- 'class' => 'regular-text',
492
  'type' => 'text',
493
  ),
494
 
@@ -496,32 +518,32 @@ function saswp_knowledge_page_callback(){
496
  'label' => 'Url',
497
  'id' => 'sd_url',
498
  'name' => 'sd_data[sd_url]',
499
- 'class' => 'regular-text',
500
  'type' => 'text',
501
  ),
502
- array(
503
- 'label' => 'Contact details',
504
- 'id' => 'saswp_kb_contact_1_checkbox',
505
- 'name' => 'saswp_kb_contact_1_checkbox',
506
- 'type' => 'checkbox',
507
- 'class' => 'checkbox saswp-checkbox',
508
- 'hidden' => array(
509
- 'id' => 'saswp_kb_contact_1',
510
- 'name' => 'sd_data[saswp_kb_contact_1]'
511
- )
512
- ),
513
  array(
514
  'label' => 'Telephone Number',
515
  'id' => 'saswp_kb_telephone',
516
  'name' => 'sd_data[saswp_kb_telephone]',
517
- 'class' => 'regular-text',
518
  'type' => 'text',
519
  ),
520
  array(
521
  'label' => 'Contact Type',
522
  'id' => 'saswp_contact_type',
523
  'name' => 'sd_data[saswp_contact_type]',
524
- 'class' => '',
525
  'type' => 'select',
526
  'options' => array(
527
  ''=>'Select an item',
@@ -537,26 +559,27 @@ function saswp_knowledge_page_callback(){
537
  'roadside assistance'=>'Roadside Assistance',
538
  'package tracking'=>'Package Tracking',
539
  )
540
- ),
 
541
  array(
542
  'label' => 'Name',
543
  'id' => 'sd-person-name',
544
  'name' => 'sd_data[sd-person-name]',
545
- 'class' => 'regular-text',
546
  'type' => 'text',
547
  ),
548
  array(
549
  'label' => 'Job Title',
550
  'id' => 'sd-person-job-title',
551
  'name' => 'sd_data[sd-person-job-title]',
552
- 'class' => 'regular-text',
553
  'type' => 'text',
554
  ),
555
  array(
556
  'label' => 'Image',
557
  'id' => 'sd-person-image',
558
  'name' => 'sd_data[sd-person-image][url]',
559
- 'class' => 'upload large-text',
560
  'type' => 'media',
561
  'attributes' => array(
562
  'readonly' => 'readonly'
@@ -566,21 +589,21 @@ function saswp_knowledge_page_callback(){
566
  'label' => 'Phone Number',
567
  'id' => 'sd-person-phone-number',
568
  'name' => 'sd_data[sd-person-phone-number]',
569
- 'class' => 'regular-text',
570
  'type' => 'text',
571
  ),
572
  array(
573
  'label' => 'URL',
574
  'id' => 'sd-person-url',
575
  'name' => 'sd_data[sd-person-url]',
576
- 'class' => 'regular-text',
577
  'type' => 'text',
578
  ),
579
  array(
580
  'label' => 'Logo',
581
  'id' => 'sd_logo',
582
  'name' => 'sd_data[sd_logo][url]',
583
- 'class' => 'saswp-icon upload large-text',
584
  'type' => 'media',
585
  'note' => 'According to google validation tool, Logo size must be 160*50 or 600*60',
586
  'attributes' => array(
@@ -789,10 +812,9 @@ function saswp_knowledge_page_callback(){
789
 
790
  );
791
  echo '<div class="saswp-social-fileds">';
792
- $field_objs->saswp_field_generator($social_meta_fields, $settings);
793
  echo '</div>';
794
- ?>
795
- <?php
796
  }
797
 
798
  function saswp_check_data_imported_from($plugin_post_type_name){
@@ -841,22 +863,22 @@ function saswp_import_callback(){
841
  echo '<h2>'.esc_html__('Migration','schema-and-structured-data-for-wp').'</h2>';
842
  ?>
843
  <ul>
844
- <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('Schema Plugin','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="schema" class="button saswp-import-plugins"><?php echo esc_html__('Start Importing','schema-and-structured-data-for-wp'); ?></button>
845
  <p class="saswp-imported-message"></p>
846
  <?php echo '<p>'.esc_html__($schema_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
847
  </div>
848
  </li>
849
- <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('Schema Pro','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="schema_pro" class="button saswp-import-plugins"><?php echo esc_html__('Start Importing','schema-and-structured-data-for-wp'); ?></button>
850
  <p class="saswp-imported-message"></p>
851
  <?php echo '<p>'.esc_html__($schema_pro_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
852
  </div>
853
  </li>
854
- <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('WP SEO Schema','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="wp_seo_schema" class="button saswp-import-plugins"><?php echo esc_html__('Start Importing','schema-and-structured-data-for-wp'); ?></button>
855
  <p class="saswp-imported-message"></p>
856
  <?php echo '<p>'.esc_html__($wp_seo_schema_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
857
  </div>
858
  </li>
859
- <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('SEO Pressor','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="seo_pressor" class="button saswp-import-plugins"><?php echo esc_html__('Start Importing','schema-and-structured-data-for-wp'); ?></button>
860
  <p class="saswp-imported-message"></p>
861
  <?php echo '<p>'.esc_html__($seo_pressor_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
862
  </div>
@@ -894,9 +916,7 @@ function saswp_import_callback(){
894
  }
895
 
896
  function saswp_imported_callback(){
897
- $settings = saswp_defaultSettings();
898
- ?>
899
- <?php
900
  }
901
 
902
  function saswp_review_page_callback(){
@@ -905,13 +925,13 @@ function saswp_review_page_callback(){
905
  $field_objs = new saswp_fields_generator();
906
  $meta_fields = array(
907
  array(
908
- 'label' => 'Review Module',
909
- 'id' => 'saswp-review-module-checkbox',
910
- 'name' => 'saswp-review-module-checkbox',
911
- 'type' => 'checkbox',
912
- 'class' => 'checkbox saswp-checkbox',
913
  'hidden' => array(
914
- 'id' => 'saswp-review-module',
915
  'name' => 'sd_data[saswp-review-module]',
916
  )
917
  ),
@@ -925,7 +945,7 @@ function saswp_compatibility_page_callback(){
925
  $settings = saswp_defaultSettings();
926
 
927
  $tagyeem = array(
928
- 'label' => 'Tagyeem Review',
929
  'id' => 'saswp-tagyeem-checkbox',
930
  'name' => 'saswp-tagyeem-checkbox',
931
  'type' => 'checkbox',
@@ -936,6 +956,19 @@ function saswp_compatibility_page_callback(){
936
  )
937
  );
938
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
  $kk_star = array(
940
  'label' => 'kk Star Ratings',
941
  'id' => 'saswp-kk-star-raring-checkbox',
@@ -1004,14 +1037,13 @@ function saswp_compatibility_page_callback(){
1004
  'name' => 'sd_data[saswp-yoast]',
1005
  )
1006
  );
1007
-
1008
-
1009
- if(!is_plugin_active('taqyeem/taqyeem.php')){
1010
  $tagyeem['attributes'] = array(
1011
  'disabled' => 'disabled'
1012
  );
1013
  $tagyeem['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1014
- $settings['saswp-taqyeem'] = 0;
1015
  }
1016
 
1017
 
@@ -1069,11 +1101,22 @@ function saswp_compatibility_page_callback(){
1069
  $wpjobmanager['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1070
  $settings['saswp-wp-job-manager'] = 0;
1071
  }
 
 
 
 
 
 
 
 
 
1072
 
1073
  $field_objs = new saswp_fields_generator();
1074
  $meta_fields = array(
1075
  $kk_star,
1076
- $woocommerce,
 
 
1077
  $extratheme,
1078
  $dwquestiton,
1079
  $wpjobmanager,
@@ -1087,13 +1130,13 @@ function saswp_compatibility_page_callback(){
1087
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
1088
  $meta_fields_default = array(
1089
  array(
1090
- 'label' => 'FlexMLS IDX Plugin',
1091
- 'id' => 'saswp_compativility_checkbox',
1092
- 'name' => 'saswp_compativility_checkbox',
1093
- 'type' => 'checkbox',
1094
- 'class' => 'checkbox saswp-checkbox',
1095
  'hidden' => array(
1096
- 'id' => 'saswp_compativility',
1097
  'name' => 'sd_data[saswp_compativility]',
1098
  )
1099
  ),
@@ -1102,16 +1145,16 @@ function saswp_compatibility_page_callback(){
1102
  $settings['saswp_compativility'] =0;
1103
  $meta_fields_default = array(
1104
  array(
1105
- 'label' => 'FlexMLS IDX',
1106
- 'id' => 'saswp_compativility_checkbox',
1107
- 'name' => 'saswp_compativility_checkbox',
1108
- 'type' => 'checkbox',
1109
- 'class' => 'checkbox saswp-checkbox',
1110
  'attributes' => array(
1111
  'disabled' => 'disabled'
1112
  ),
1113
  'hidden' => array(
1114
- 'id' => 'saswp_compativility',
1115
  'name' => 'sd_data[saswp_compativility]',
1116
  )
1117
  ),
@@ -1120,45 +1163,45 @@ function saswp_compatibility_page_callback(){
1120
  $meta_fields_text = array();
1121
  $meta_fields_text[] = array(
1122
  'label' => 'Name',
1123
- 'id' => 'sd-seller-name',
1124
- 'name' => 'sd_data[sd-seller-name]',
1125
  'class' => 'regular-text',
1126
- 'type' => 'text',
1127
  );
1128
  $meta_fields_text[] = array(
1129
  'label' => 'Addres',
1130
- 'id' => 'sd-seller-address',
1131
- 'name' => 'sd_data[sd-seller-address]',
1132
  'class' => 'regular-text',
1133
- 'type' => 'text',
1134
  );
1135
  $meta_fields_text[] = array(
1136
  'label' => 'Telephone',
1137
- 'id' => 'sd-seller-telephone',
1138
- 'name' => 'sd_data[sd-seller-telephone]',
1139
  'class' => 'regular-text',
1140
- 'type' => 'text',
1141
  );
1142
  $meta_fields_text[] = array(
1143
  'label' => 'Price Range',
1144
- 'id' => 'sd-seller-price-range',
1145
- 'name' => 'sd_data[sd-seller-price-range]',
1146
  'class' => 'regular-text',
1147
- 'type' => 'text',
1148
  );
1149
  $meta_fields_text[] = array(
1150
  'label' => 'URL',
1151
- 'id' => 'sd-seller-url',
1152
- 'name' => 'sd_data[sd-seller-url]',
1153
  'class' => 'regular-text',
1154
- 'type' => 'text',
1155
  );
1156
  $meta_fields_text[] = array(
1157
  'label' => 'Image',
1158
- 'id' => 'sd_seller_image',
1159
- 'name' => 'sd_data[sd_seller_image][url]',
1160
  'class' => 'saswp-sd_seller_image',
1161
- 'type' => 'media',
1162
  );
1163
 
1164
  $field_objs = new saswp_fields_generator();
5
  *
6
  */
7
  add_action( 'plugin_action_links_' . plugin_basename( SASWP_DIR_NAME_FILE ), 'saswp_plugin_action_links' );
8
+
9
  function saswp_plugin_action_links( $links ) {
10
+
11
  $nonce = wp_create_nonce( 'saswp_install_wizard_nonce' );
12
  $links[] = '<a href="' . esc_url( admin_url( 'edit.php?post_type=saswp&page=structured_data_options' ) ) . '">' . esc_html__( 'Settings', 'schema-and-structured-data-for-wp' ) . '</a>';
13
  $links[] = '<a href="'. esc_url( admin_url( 'plugins.php?page=saswp-setup-wizard' ).'&_saswp_nonce='.$nonce).'">' . esc_html__( 'Start setup wizard &raquo;', 'schema-and-structured-data-for-wp' ) . '</a>';
14
  return $links;
15
+
16
  }
17
 
18
  function saswp_add_menu_links() {
297
  'type' => 'media',
298
  ),
299
  );
300
+ echo '<h2>'.esc_html__('Default Values','schema-and-structured-data-for-wp').'</h2>';
301
  echo '<div class="saswp-schema-type-fields">';
302
  $field_objs->saswp_field_generator($meta_fields_default, $settings);
303
+ echo '</div>';
 
 
 
304
  }
305
 
306
  function saswp_amp_page_callback(){
473
  $field_objs = new saswp_fields_generator();
474
  $meta_fields = array(
475
  array(
476
+ 'label' => 'Data Type',
477
+ 'id' => 'saswp_kb_type',
478
+ 'name' => 'sd_data[saswp_kb_type]',
479
+ 'type' => 'select',
480
  'options' => array(
481
+ '' => 'Select an item',
482
+ 'Organization' => 'Organization',
483
+ 'Person' => 'Person',
484
  )
485
  ),
486
+ array(
487
+ 'label' => 'Organization Type',
488
+ 'id' => 'saswp_organization_type',
489
+ 'name' => 'sd_data[saswp_organization_type]',
490
+ 'class' => 'saswp_org_fields',
491
+ 'type' => 'select',
492
+ 'options' => array(
493
+ 'Organization' => 'Organization',
494
+ 'Airline' => 'Airline',
495
+ 'Consortium' => 'Consortium',
496
+ 'Corporation' => 'Corporation',
497
+ 'EducationalOrganization' => 'EducationalOrganization',
498
+ 'GovernmentOrganization' => 'GovernmentOrganization',
499
+ 'LibrarySystem' => 'LibrarySystem',
500
+ 'LocalBusiness' => 'LocalBusiness',
501
+ 'MedicalOrganization' => 'MedicalOrganization',
502
+ 'NewsMediaOrganization' => 'NewsMediaOrganization',
503
+ 'NGO' => 'NGO',
504
+ 'PerformingGroup' => 'PerformingGroup',
505
+ 'SportsOrganization' => 'SportsOrganization',
506
+ 'WorkersUnion' => 'WorkersUnion',
507
+ )
508
+ ),
509
  array(
510
  'label' => 'Name',
511
  'id' => 'sd_name',
512
  'name' => 'sd_data[sd_name]',
513
+ 'class' => 'regular-text saswp_org_fields',
514
  'type' => 'text',
515
  ),
516
 
518
  'label' => 'Url',
519
  'id' => 'sd_url',
520
  'name' => 'sd_data[sd_url]',
521
+ 'class' => 'regular-text saswp_org_fields',
522
  'type' => 'text',
523
  ),
524
+ // array(
525
+ // 'label' => 'Contact details',
526
+ // 'id' => 'saswp_kb_contact_1_checkbox',
527
+ // 'name' => 'saswp_kb_contact_1_checkbox',
528
+ // 'type' => 'checkbox',
529
+ // 'class' => 'checkbox saswp-checkbox saswp_org_fields',
530
+ // 'hidden' => array(
531
+ // 'id' => 'saswp_kb_contact_1',
532
+ // 'name' => 'sd_data[saswp_kb_contact_1]'
533
+ // )
534
+ // ),
535
  array(
536
  'label' => 'Telephone Number',
537
  'id' => 'saswp_kb_telephone',
538
  'name' => 'sd_data[saswp_kb_telephone]',
539
+ 'class' => 'regular-text saswp_org_fields',
540
  'type' => 'text',
541
  ),
542
  array(
543
  'label' => 'Contact Type',
544
  'id' => 'saswp_contact_type',
545
  'name' => 'sd_data[saswp_contact_type]',
546
+ 'class' => 'saswp_org_fields',
547
  'type' => 'select',
548
  'options' => array(
549
  ''=>'Select an item',
559
  'roadside assistance'=>'Roadside Assistance',
560
  'package tracking'=>'Package Tracking',
561
  )
562
+ ),
563
+
564
  array(
565
  'label' => 'Name',
566
  'id' => 'sd-person-name',
567
  'name' => 'sd_data[sd-person-name]',
568
+ 'class' => 'regular-text saswp_person_fields',
569
  'type' => 'text',
570
  ),
571
  array(
572
  'label' => 'Job Title',
573
  'id' => 'sd-person-job-title',
574
  'name' => 'sd_data[sd-person-job-title]',
575
+ 'class' => 'regular-text saswp_person_fields',
576
  'type' => 'text',
577
  ),
578
  array(
579
  'label' => 'Image',
580
  'id' => 'sd-person-image',
581
  'name' => 'sd_data[sd-person-image][url]',
582
+ 'class' => 'upload large-text saswp_person_fields',
583
  'type' => 'media',
584
  'attributes' => array(
585
  'readonly' => 'readonly'
589
  'label' => 'Phone Number',
590
  'id' => 'sd-person-phone-number',
591
  'name' => 'sd_data[sd-person-phone-number]',
592
+ 'class' => 'regular-text saswp_person_fields',
593
  'type' => 'text',
594
  ),
595
  array(
596
  'label' => 'URL',
597
  'id' => 'sd-person-url',
598
  'name' => 'sd_data[sd-person-url]',
599
+ 'class' => 'regular-text saswp_person_fields',
600
  'type' => 'text',
601
  ),
602
  array(
603
  'label' => 'Logo',
604
  'id' => 'sd_logo',
605
  'name' => 'sd_data[sd_logo][url]',
606
+ 'class' => 'saswp-icon upload large-text saswp_kg_logo',
607
  'type' => 'media',
608
  'note' => 'According to google validation tool, Logo size must be 160*50 or 600*60',
609
  'attributes' => array(
812
 
813
  );
814
  echo '<div class="saswp-social-fileds">';
815
+ $field_objs->saswp_field_generator($social_meta_fields, $settings);
816
  echo '</div>';
817
+
 
818
  }
819
 
820
  function saswp_check_data_imported_from($plugin_post_type_name){
863
  echo '<h2>'.esc_html__('Migration','schema-and-structured-data-for-wp').'</h2>';
864
  ?>
865
  <ul>
866
+ <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('Schema Plugin','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="schema" class="button saswp-import-plugins"><?php echo esc_html__('Import','schema-and-structured-data-for-wp'); ?></button>
867
  <p class="saswp-imported-message"></p>
868
  <?php echo '<p>'.esc_html__($schema_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
869
  </div>
870
  </li>
871
+ <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('Schema Pro','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="schema_pro" class="button saswp-import-plugins"><?php echo esc_html__('Import','schema-and-structured-data-for-wp'); ?></button>
872
  <p class="saswp-imported-message"></p>
873
  <?php echo '<p>'.esc_html__($schema_pro_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
874
  </div>
875
  </li>
876
+ <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('WP SEO Schema','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="wp_seo_schema" class="button saswp-import-plugins"><?php echo esc_html__('Import','schema-and-structured-data-for-wp'); ?></button>
877
  <p class="saswp-imported-message"></p>
878
  <?php echo '<p>'.esc_html__($wp_seo_schema_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
879
  </div>
880
  </li>
881
+ <li><div class="saswp-tools-field-title"><div class="saswp-tooltip"><span class="saswp-tooltiptext"><?php echo esc_html__('All the settings and data you can import from this plugin when you click start importing','schema-and-structured-data-for-wp') ?></span><strong><?php echo esc_html__('SEO Pressor','schema-and-structured-data-for-wp'); ?></strong></div><button data-id="seo_pressor" class="button saswp-import-plugins"><?php echo esc_html__('Import','schema-and-structured-data-for-wp'); ?></button>
882
  <p class="saswp-imported-message"></p>
883
  <?php echo '<p>'.esc_html__($seo_pressor_message, 'schema-and-structured-data-for-wp').'</p>'; ?>
884
  </div>
916
  }
917
 
918
  function saswp_imported_callback(){
919
+
 
 
920
  }
921
 
922
  function saswp_review_page_callback(){
925
  $field_objs = new saswp_fields_generator();
926
  $meta_fields = array(
927
  array(
928
+ 'label' => 'Review Module',
929
+ 'id' => 'saswp-review-module-checkbox',
930
+ 'name' => 'saswp-review-module-checkbox',
931
+ 'type' => 'checkbox',
932
+ 'class' => 'checkbox saswp-checkbox',
933
  'hidden' => array(
934
+ 'id' => 'saswp-review-module',
935
  'name' => 'sd_data[saswp-review-module]',
936
  )
937
  ),
945
  $settings = saswp_defaultSettings();
946
 
947
  $tagyeem = array(
948
+ 'label' => 'Tagyeem With Jannah Theme',
949
  'id' => 'saswp-tagyeem-checkbox',
950
  'name' => 'saswp-tagyeem-checkbox',
951
  'type' => 'checkbox',
956
  )
957
  );
958
 
959
+ $the_events_calendar = array(
960
+ 'label' => 'The Events Calendar',
961
+ 'id' => 'saswp-the-events-calendar-checkbox',
962
+ 'name' => 'saswp-the-events-calendar-checkbox',
963
+ 'type' => 'checkbox',
964
+ 'class' => 'checkbox saswp-checkbox',
965
+ 'hidden' => array(
966
+ 'id' => 'saswp-the-events-calendar',
967
+ 'name' => 'sd_data[saswp-the-events-calendar]',
968
+ )
969
+ );
970
+
971
+
972
  $kk_star = array(
973
  'label' => 'kk Star Ratings',
974
  'id' => 'saswp-kk-star-raring-checkbox',
1037
  'name' => 'sd_data[saswp-yoast]',
1038
  )
1039
  );
1040
+
1041
+ if(!is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah' ){
 
1042
  $tagyeem['attributes'] = array(
1043
  'disabled' => 'disabled'
1044
  );
1045
  $tagyeem['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1046
+ $settings['saswp-tagyeem'] = 0;
1047
  }
1048
 
1049
 
1101
  $wpjobmanager['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1102
  $settings['saswp-wp-job-manager'] = 0;
1103
  }
1104
+
1105
+ if(!is_plugin_active('the-events-calendar/the-events-calendar.php')){
1106
+
1107
+ $wpjobmanager['attributes'] = array(
1108
+ 'disabled' => 'disabled'
1109
+ );
1110
+ $the_events_calendar['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1111
+ $settings['saswp-wp-job-manager'] = 0;
1112
+ }
1113
 
1114
  $field_objs = new saswp_fields_generator();
1115
  $meta_fields = array(
1116
  $kk_star,
1117
+ $woocommerce,
1118
+ $the_events_calendar,
1119
+ $tagyeem,
1120
  $extratheme,
1121
  $dwquestiton,
1122
  $wpjobmanager,
1130
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
1131
  $meta_fields_default = array(
1132
  array(
1133
+ 'label' => 'FlexMLS IDX Plugin',
1134
+ 'id' => 'saswp_compativility_checkbox',
1135
+ 'name' => 'saswp_compativility_checkbox',
1136
+ 'type' => 'checkbox',
1137
+ 'class' => 'checkbox saswp-checkbox',
1138
  'hidden' => array(
1139
+ 'id' => 'saswp_compativility',
1140
  'name' => 'sd_data[saswp_compativility]',
1141
  )
1142
  ),
1145
  $settings['saswp_compativility'] =0;
1146
  $meta_fields_default = array(
1147
  array(
1148
+ 'label' => 'FlexMLS IDX',
1149
+ 'id' => 'saswp_compativility_checkbox',
1150
+ 'name' => 'saswp_compativility_checkbox',
1151
+ 'type' => 'checkbox',
1152
+ 'class' => 'checkbox saswp-checkbox',
1153
  'attributes' => array(
1154
  'disabled' => 'disabled'
1155
  ),
1156
  'hidden' => array(
1157
+ 'id' => 'saswp_compativility',
1158
  'name' => 'sd_data[saswp_compativility]',
1159
  )
1160
  ),
1163
  $meta_fields_text = array();
1164
  $meta_fields_text[] = array(
1165
  'label' => 'Name',
1166
+ 'id' => 'sd-seller-name',
1167
+ 'name' => 'sd_data[sd-seller-name]',
1168
  'class' => 'regular-text',
1169
+ 'type' => 'text',
1170
  );
1171
  $meta_fields_text[] = array(
1172
  'label' => 'Addres',
1173
+ 'id' => 'sd-seller-address',
1174
+ 'name' => 'sd_data[sd-seller-address]',
1175
  'class' => 'regular-text',
1176
+ 'type' => 'text',
1177
  );
1178
  $meta_fields_text[] = array(
1179
  'label' => 'Telephone',
1180
+ 'id' => 'sd-seller-telephone',
1181
+ 'name' => 'sd_data[sd-seller-telephone]',
1182
  'class' => 'regular-text',
1183
+ 'type' => 'text',
1184
  );
1185
  $meta_fields_text[] = array(
1186
  'label' => 'Price Range',
1187
+ 'id' => 'sd-seller-price-range',
1188
+ 'name' => 'sd_data[sd-seller-price-range]',
1189
  'class' => 'regular-text',
1190
+ 'type' => 'text',
1191
  );
1192
  $meta_fields_text[] = array(
1193
  'label' => 'URL',
1194
+ 'id' => 'sd-seller-url',
1195
+ 'name' => 'sd_data[sd-seller-url]',
1196
  'class' => 'regular-text',
1197
+ 'type' => 'text',
1198
  );
1199
  $meta_fields_text[] = array(
1200
  'label' => 'Image',
1201
+ 'id' => 'sd_seller_image',
1202
+ 'name' => 'sd_data[sd_seller_image][url]',
1203
  'class' => 'saswp-sd_seller_image',
1204
+ 'type' => 'media',
1205
  );
1206
 
1207
  $field_objs = new saswp_fields_generator();
admin_section/structure_admin.php CHANGED
@@ -10,8 +10,7 @@ function saswp_get_saved_schema_ids(){
10
  'posts_per_page' => -1,
11
  'post_status' => 'publish',
12
  )
13
- );
14
-
15
  if($all_schemas){
16
 
17
  foreach($all_schemas as $schema){
@@ -105,11 +104,13 @@ function saswp_get_all_schema_posts(){
105
 
106
  $schema_id_array = json_decode(get_transient('saswp_transient_schema_ids'), true);
107
 
 
108
  if(!$schema_id_array){
109
 
110
  $schema_id_array = saswp_get_saved_schema_ids();
111
 
112
- }
 
113
  if($schema_id_array){
114
 
115
  if(count($schema_id_array)>0){
@@ -829,17 +830,23 @@ function saswp_custom_breadcrumbs() {
829
 
830
  global $sd_data;
831
  $variables1_titles = array();
832
- $variables2_links = array();
833
  // Settings
834
- $home_title = '';
835
- $separator = '&gt;';
836
- $home_title = get_bloginfo();
 
837
 
838
  if(!$home_title){
 
839
  if(isset($sd_data['sd_name'])){
 
840
  $home_title = $sd_data['sd_name'];
 
841
  }else{
 
842
  $home_title = 'HomePage';
 
843
  }
844
  }
845
 
@@ -853,7 +860,7 @@ function saswp_custom_breadcrumbs() {
853
  // Build the breadcrums
854
  // Home page
855
  $variables1_titles[] = $home_title;
856
- $variables2_links[] = get_home_url();
857
 
858
 
859
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
@@ -865,8 +872,8 @@ function saswp_custom_breadcrumbs() {
865
  } else if ( is_author() ) {
866
  global $author;
867
 
868
- $userdata = get_userdata( $author );
869
- $author_url = get_author_posts_url($userdata->ID);
870
 
871
  // author name
872
  $variables1_titles[] = $userdata->display_name;
@@ -944,11 +951,16 @@ function saswp_custom_breadcrumbs() {
944
 
945
  if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
946
 
947
- $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
948
- $cat_id = $taxonomy_terms[0]->term_id;
949
- $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
950
- $cat_name = $taxonomy_terms[0]->name;
951
 
 
 
 
 
 
 
 
 
952
  }
953
 
954
  if(!empty($cat_id)) {
@@ -960,8 +972,8 @@ function saswp_custom_breadcrumbs() {
960
 
961
  if($post_type == 'post') {
962
 
963
- $variables1_titles[]= get_the_title();
964
- $variables2_links[] = get_permalink();
965
 
966
  }
967
 
@@ -1141,7 +1153,7 @@ function saswp_send_query_message(){
1141
  $user_data = $user->data;
1142
  $user_email = $user_data->user_email;
1143
  //php mailer variables
1144
- $sendto = 'team@magazine3.com';
1145
  $subject = "Customer Query";
1146
  $headers = 'From: '. esc_attr($user_email) . "\r\n" .
1147
  'Reply-To: ' . esc_attr($user_email) . "\r\n";
@@ -1175,8 +1187,9 @@ function saswp_import_plugin_data(){
1175
  if ( !wp_verify_nonce( $_GET['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
1176
  return;
1177
  }
 
1178
  $plugin_name = sanitize_text_field($_GET['plugin_name']);
1179
- $result = '';
1180
 
1181
  switch ($plugin_name) {
1182
 
10
  'posts_per_page' => -1,
11
  'post_status' => 'publish',
12
  )
13
+ );
 
14
  if($all_schemas){
15
 
16
  foreach($all_schemas as $schema){
104
 
105
  $schema_id_array = json_decode(get_transient('saswp_transient_schema_ids'), true);
106
 
107
+
108
  if(!$schema_id_array){
109
 
110
  $schema_id_array = saswp_get_saved_schema_ids();
111
 
112
+ }
113
+
114
  if($schema_id_array){
115
 
116
  if(count($schema_id_array)>0){
830
 
831
  global $sd_data;
832
  $variables1_titles = array();
833
+ $variables2_links = array();
834
  // Settings
835
+ $prefix = '';
836
+ $home_title = '';
837
+ $separator = '&gt;';
838
+ $home_title = get_bloginfo();
839
 
840
  if(!$home_title){
841
+
842
  if(isset($sd_data['sd_name'])){
843
+
844
  $home_title = $sd_data['sd_name'];
845
+
846
  }else{
847
+
848
  $home_title = 'HomePage';
849
+
850
  }
851
  }
852
 
860
  // Build the breadcrums
861
  // Home page
862
  $variables1_titles[] = $home_title;
863
+ $variables2_links[] = get_home_url();
864
 
865
 
866
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
872
  } else if ( is_author() ) {
873
  global $author;
874
 
875
+ $userdata = get_userdata( $author );
876
+ $author_url = get_author_posts_url($userdata->ID);
877
 
878
  // author name
879
  $variables1_titles[] = $userdata->display_name;
951
 
952
  if(empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
953
 
954
+ $taxonomy_terms = get_the_terms( $post->ID, $custom_taxonomy );
 
 
 
955
 
956
+ if($taxonomy_terms){
957
+
958
+ $cat_id = $taxonomy_terms[0]->term_id;
959
+ $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
960
+ $cat_name = $taxonomy_terms[0]->name;
961
+
962
+ }
963
+
964
  }
965
 
966
  if(!empty($cat_id)) {
972
 
973
  if($post_type == 'post') {
974
 
975
+ $variables1_titles[] = get_the_title();
976
+ $variables2_links[] = get_permalink();
977
 
978
  }
979
 
1153
  $user_data = $user->data;
1154
  $user_email = $user_data->user_email;
1155
  //php mailer variables
1156
+ $sendto = 'team@magazine3.com';
1157
  $subject = "Customer Query";
1158
  $headers = 'From: '. esc_attr($user_email) . "\r\n" .
1159
  'Reply-To: ' . esc_attr($user_email) . "\r\n";
1187
  if ( !wp_verify_nonce( $_GET['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
1188
  return;
1189
  }
1190
+
1191
  $plugin_name = sanitize_text_field($_GET['plugin_name']);
1192
+ $result = '';
1193
 
1194
  switch ($plugin_name) {
1195
 
output/flexmls.php CHANGED
@@ -13,6 +13,7 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
13
  add_action('amp_post_template_footer',array($this, 'saswp_get_flexidx_listing'));
14
  }
15
  public function saswp_get_flexidx_listing(){
 
16
  global $fmc_api;
17
 
18
  $settings = array();
@@ -243,7 +244,7 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
243
  "@context" => "http://schema.org",
244
  "@type" => ["Product", "Apartment"],
245
  "name" => $result['StandardFields']['UnparsedFirstLineAddress'],
246
- "description" => $result['StandardFields']['PublicRemarks'],
247
  "sku" => $result['StandardFields']['BuildingAreaTotal'],
248
  "brand" => get_bloginfo(),
249
  "mpn" => $result['StandardFields']['YearBuilt'],
13
  add_action('amp_post_template_footer',array($this, 'saswp_get_flexidx_listing'));
14
  }
15
  public function saswp_get_flexidx_listing(){
16
+
17
  global $fmc_api;
18
 
19
  $settings = array();
244
  "@context" => "http://schema.org",
245
  "@type" => ["Product", "Apartment"],
246
  "name" => $result['StandardFields']['UnparsedFirstLineAddress'],
247
+ "description" => isset($result['StandardFields']['PublicRemarks'])? $result['StandardFields']['PublicRemarks']:strip_tags(get_the_excerpt()),
248
  "sku" => $result['StandardFields']['BuildingAreaTotal'],
249
  "brand" => get_bloginfo(),
250
  "mpn" => $result['StandardFields']['YearBuilt'],
output/function.php CHANGED
@@ -11,8 +11,15 @@ function saswp_structured_data()
11
  }
12
  add_action('wp_head', 'saswp_data_generator');
13
 
 
 
 
 
 
 
14
  function saswp_data_generator() {
15
 
 
16
  global $sd_data;
17
  global $post;
18
 
@@ -52,7 +59,9 @@ function saswp_data_generator() {
52
 
53
  $schema_output = saswp_schema_output();
54
 
55
- }
 
 
56
  if($schema_output || $schema_breadcrumb_output || $kb_website_output || $archive_output || $author_output || $about_page_output || $contact_page_output){
57
  add_filter( 'amp_post_template_metadata', 'saswp_remove_amp_default_structure_data');
58
  }
@@ -215,6 +224,13 @@ function saswp_memberpress_form_update($form){
215
  return $form;
216
  }
217
 
 
 
 
 
 
 
 
218
  function saswp_remove_warnings($data, $index, $type){
219
 
220
  if($type == 'saswp_array'){
@@ -338,6 +354,11 @@ function saswp_get_comments($post_id){
338
 
339
  }
340
 
 
 
 
 
 
341
  function saswp_structure_data_access_scripts($data){
342
 
343
  if ( empty( $data['amp_component_scripts']['amp-access'] ) ) {
@@ -359,6 +380,12 @@ function sd_is_blog() {
359
 
360
  }
361
 
 
 
 
 
 
 
362
  function saswp_get_schema_data($schema_id, $schema_key){
363
 
364
  $details = array();
@@ -451,4 +478,25 @@ function saswp_list_items_generator(){
451
  }
452
 
453
  return $breadcrumbslist;
454
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
  add_action('wp_head', 'saswp_data_generator');
13
 
14
+
15
+ /**
16
+ * Function to show all the schema markup in the page head
17
+ * @global type $sd_data
18
+ * @global type json array
19
+ */
20
  function saswp_data_generator() {
21
 
22
+
23
  global $sd_data;
24
  global $post;
25
 
59
 
60
  $schema_output = saswp_schema_output();
61
 
62
+ }
63
+
64
+
65
  if($schema_output || $schema_breadcrumb_output || $kb_website_output || $archive_output || $author_output || $about_page_output || $contact_page_output){
66
  add_filter( 'amp_post_template_metadata', 'saswp_remove_amp_default_structure_data');
67
  }
224
  return $form;
225
  }
226
 
227
+ /**
228
+ * Function to remove the undefined index notices
229
+ * @param type $data
230
+ * @param type $index
231
+ * @param type $type
232
+ * @return string
233
+ */
234
  function saswp_remove_warnings($data, $index, $type){
235
 
236
  if($type == 'saswp_array'){
354
 
355
  }
356
 
357
+ /**
358
+ * Function to enqueue AMP script in head
359
+ * @param type $data
360
+ * @return string
361
+ */
362
  function saswp_structure_data_access_scripts($data){
363
 
364
  if ( empty( $data['amp_component_scripts']['amp-access'] ) ) {
380
 
381
  }
382
 
383
+ /**
384
+ * Function to fetch schema's post meta by its id from database using get_post_meta function
385
+ * @param type $schema_id
386
+ * @param type $schema_key
387
+ * @return type array
388
+ */
389
  function saswp_get_schema_data($schema_id, $schema_key){
390
 
391
  $details = array();
478
  }
479
 
480
  return $breadcrumbslist;
481
+ }
482
+
483
+
484
+ /**
485
+ * Remove the default WooCommerce 3 JSON/LD structured data
486
+ * @global type $sd_data
487
+ */
488
+ function saswp_remove_woocommerce_default_structured_data() {
489
+
490
+ global $sd_data;
491
+
492
+ if(isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] == 1 && is_plugin_active('woocommerce/woocommerce.php')){
493
+
494
+ remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // This removes structured data from all frontend pages
495
+ remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // This removes structured data from all Emails sent by WooCommerce
496
+
497
+
498
+ }
499
+
500
+ }
501
+
502
+ add_action( 'init', 'saswp_remove_woocommerce_default_structured_data' );
output/output.php CHANGED
@@ -112,7 +112,7 @@ function saswp_kb_schema_output() {
112
 
113
  $input = array(
114
  '@context' =>'http://schema.org',
115
- '@type' => $sd_data['saswp_kb_type'],
116
  'name' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string'),
117
  'url' => saswp_remove_warnings($sd_data, 'sd_url', 'saswp_string'),
118
  'sameAs' => $platform,
@@ -426,6 +426,89 @@ function saswp_schema_output() {
426
  }
427
  }
428
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  if( 'SoftwareApplication' === $schema_type){
430
 
431
  $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_software_schema_details');
@@ -595,6 +678,7 @@ function saswp_schema_output() {
595
  }
596
 
597
  if( 'qanda' === $schema_type){
 
598
  $service_object = new saswp_output_service();
599
  $input1 = $service_object->saswp_dw_question_answers_details(get_the_ID());
600
 
@@ -649,8 +733,11 @@ function saswp_schema_output() {
649
  );
650
  }
651
  if(!empty($product_details['product_reviews'])){
 
652
  $reviews = array();
 
653
  foreach ($product_details['product_reviews'] as $review){
 
654
  $reviews[] = array(
655
  '@type' => 'Review',
656
  'author' => $review['author'],
@@ -663,6 +750,7 @@ function saswp_schema_output() {
663
  'worstRating' => '1',
664
  )
665
  );
 
666
  }
667
  $input1['review'] = $reviews;
668
  }
@@ -731,8 +819,10 @@ function saswp_schema_output() {
731
  }
732
 
733
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
 
734
  $service = new saswp_output_service();
735
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
 
736
  }
737
  }
738
 
@@ -892,7 +982,60 @@ function saswp_schema_output() {
892
 
893
  if( 'Review' === $schema_type ){
894
 
895
- $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_review_schema_details');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
896
 
897
  if(isset($schema_data['saswp_review_schema_item_type'])){
898
 
@@ -1110,8 +1253,9 @@ function saswp_schema_output() {
1110
 
1111
 
1112
  }
1113
-
1114
-
 
1115
  }
1116
 
1117
  if( 'VideoObject' === $schema_type){
@@ -1420,7 +1564,7 @@ function saswp_post_specific_schema_output() {
1420
 
1421
 
1422
 
1423
- if( 'qanda' === $schema_type){
1424
 
1425
  if(trim(saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array')) ==''){
1426
 
@@ -1437,7 +1581,7 @@ function saswp_post_specific_schema_output() {
1437
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array'),
1438
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_description_'.$schema_id, 'saswp_array'),
1439
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_upvote_count_'.$schema_id, 'saswp_array'),
1440
- 'dateCreated' => saswp_remove_warnings($all_post_meta, 'saswp_qa_date_created_'.$schema_id, 'saswp_array'),
1441
  'author' => array('@type' => 'Person','name' =>saswp_remove_warnings($all_post_meta, 'saswp_qa_question_author_name_'.$schema_id, 'saswp_array')) ,
1442
  'answerCount' => 2 ,
1443
  'acceptedAnswer' => array(
@@ -1445,7 +1589,7 @@ function saswp_post_specific_schema_output() {
1445
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_upvote_count_'.$schema_id, 'saswp_array'),
1446
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_url_'.$schema_id, 'saswp_array'),
1447
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_text_'.$schema_id, 'saswp_array'),
1448
- 'dateCreated' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_date_created_'.$schema_id, 'saswp_array'),
1449
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_author_name_'.$schema_id, 'saswp_array')),
1450
  ) ,
1451
  'suggestedAnswer' => array(
@@ -1453,13 +1597,67 @@ function saswp_post_specific_schema_output() {
1453
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_upvote_count_'.$schema_id, 'saswp_array'),
1454
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_url_'.$schema_id, 'saswp_array'),
1455
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_text_'.$schema_id, 'saswp_array'),
1456
- 'dateCreated' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_date_created_'.$schema_id, 'saswp_array'),
1457
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_author_name_'.$schema_id, 'saswp_array')),
1458
  ) ,
1459
  )
1460
  );
1461
  }
1462
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1463
 
1464
  if( 'Course' === $schema_type){
1465
 
@@ -1469,8 +1667,8 @@ function saswp_post_specific_schema_output() {
1469
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_name_'.$schema_id, 'saswp_array'),
1470
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_course_description_'.$schema_id, 'saswp_array'),
1471
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_course_url_'.$schema_id, 'saswp_array'),
1472
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_course_date_published_'.$schema_id, 'saswp_array'),
1473
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_course_date_modified_'.$schema_id, 'saswp_array'),
1474
  'provider' => array(
1475
  '@type' => 'Organization',
1476
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_provider_name_'.$schema_id, 'saswp_array'),
@@ -1508,8 +1706,8 @@ function saswp_post_specific_schema_output() {
1508
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_description_'.$schema_id, 'saswp_array'),
1509
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_name_'.$schema_id, 'saswp_array'),
1510
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_url_'.$schema_id, 'saswp_array'),
1511
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_date_published_'.$schema_id, 'saswp_array'),
1512
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_date_modified_'.$schema_id, 'saswp_array'),
1513
  'author' => array(
1514
  '@type' => 'Person',
1515
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array')
@@ -1546,8 +1744,8 @@ function saswp_post_specific_schema_output() {
1546
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1547
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1548
  'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1549
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_published_'.$schema_id, 'saswp_array'),
1550
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_modified_'.$schema_id, 'saswp_array'),
1551
  'author' => array(
1552
  '@type' => 'Person',
1553
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array')
@@ -1564,7 +1762,8 @@ function saswp_post_specific_schema_output() {
1564
  $input1 = array_merge($input1, $extra_theme_review);
1565
  }
1566
  }
1567
- if( 'SoftwareApplication' === $schema_type){
 
1568
 
1569
  $input1 = array(
1570
  '@context' => 'http://schema.org',
@@ -1578,8 +1777,8 @@ function saswp_post_specific_schema_output() {
1578
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_'.$schema_id, 'saswp_array'),
1579
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_currency_'.$schema_id, 'saswp_array'),
1580
  ),
1581
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_date_published_'.$schema_id, 'saswp_array'),
1582
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_date_modified_'.$schema_id, 'saswp_array'),
1583
 
1584
  );
1585
 
@@ -1618,8 +1817,8 @@ function saswp_post_specific_schema_output() {
1618
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_image_'.$schema_id, 'saswp_array'),
1619
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
1620
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
1621
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_date_published_'.$schema_id, 'saswp_array'),
1622
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_date_modified_'.$schema_id, 'saswp_array'),
1623
  'author' => array(
1624
  '@type' => 'Person',
1625
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'), ),
@@ -1665,8 +1864,8 @@ function saswp_post_specific_schema_output() {
1665
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
1666
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
1667
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
1668
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_article_date_published_'.$schema_id, 'saswp_array'),
1669
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_article_date_modified_'.$schema_id, 'saswp_array'),
1670
  'author' => array(
1671
  '@type' => 'Person',
1672
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array')
@@ -1706,8 +1905,8 @@ function saswp_post_specific_schema_output() {
1706
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_image_'.$schema_id, 'saswp_array'),
1707
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
1708
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
1709
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_published_'.$schema_id, 'saswp_array'),
1710
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_modified_'.$schema_id, 'saswp_array'),
1711
  'author' => array(
1712
  '@type' => 'Person',
1713
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array')
@@ -1804,12 +2003,12 @@ function saswp_post_specific_schema_output() {
1804
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_thumbnailurl_'.$schema_id, 'saswp_array'),
1805
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_contenturl_'.$schema_id, 'saswp_array'),
1806
  'embedUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_embedurl_'.$schema_id, 'saswp_array'),
1807
- 'uploadDate' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_upload_date_'.$schema_id, 'saswp_array'),
1808
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_duration_'.$schema_id, 'saswp_array'),
1809
  ),
1810
 
1811
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_date_published_'.$schema_id, 'saswp_array'),
1812
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_date_modified_'.$schema_id, 'saswp_array'),
1813
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_description_'.$schema_id, 'saswp_array'),
1814
  'mainEntity' => array(
1815
  '@type' => 'WebPage',
@@ -1862,7 +2061,7 @@ function saswp_post_specific_schema_output() {
1862
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_price_'.$schema_id, 'saswp_array'),
1863
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_currency_'.$schema_id, 'saswp_array'),
1864
  'url' => get_permalink(),
1865
- 'priceValidUntil'=> saswp_remove_warnings($all_post_meta, 'saswp_product_schema_priceValidUntil_'.$schema_id, 'saswp_array'),
1866
  ),
1867
  'brand' => array('@type'=>'Thing',
1868
  'name'=>saswp_remove_warnings($all_post_meta, 'saswp_product_schema_brand_name_'.$schema_id, 'saswp_array'),
@@ -1910,8 +2109,8 @@ function saswp_post_specific_schema_output() {
1910
  'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_main_entity_of_page_'.$schema_id, 'saswp_array'),
1911
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_URL_'.$schema_id, 'saswp_array'),
1912
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_headline_'.$schema_id, 'saswp_array'),
1913
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_date_published_'.$schema_id, 'saswp_array'),
1914
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_date_modified_'.$schema_id, 'saswp_array'),
1915
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_description_'.$schema_id, 'saswp_array'),
1916
  'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_section_'.$schema_id, 'saswp_array'),
1917
  'articleBody' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_body_'.$schema_id, 'saswp_array'),
@@ -1962,11 +2161,11 @@ function saswp_post_specific_schema_output() {
1962
  '@type' => $schema_type,
1963
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
1964
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
1965
- 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_date_published_'.$schema_id, 'saswp_array'),
1966
- 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_date_modified_'.$schema_id, 'saswp_array'),
1967
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
1968
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
1969
- 'uploadDate' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_upload_date_'.$schema_id, 'saswp_array'),
1970
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
1971
  'mainEntity' => array(
1972
  '@type' => 'WebPage',
@@ -2074,12 +2273,20 @@ function saswp_post_specific_schema_output() {
2074
 
2075
  if( 'Review' === $schema_type ){
2076
 
 
 
 
 
 
 
2077
  $service = new saswp_output_service();
2078
 
2079
  $review_author = get_the_author();
2080
 
2081
  if(isset($all_post_meta['saswp_review_schema_author_'.$schema_id])){
 
2082
  $review_author = $all_post_meta['saswp_review_schema_author_'.$schema_id][0];
 
2083
  }
2084
 
2085
  $input1['@context'] = 'http://schema.org';
@@ -2095,7 +2302,7 @@ function saswp_post_specific_schema_output() {
2095
 
2096
  if(isset($all_post_meta['saswp_review_schema_author_sameas_'.$schema_id])){
2097
 
2098
- $input1['author']['sameAs'] = $all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0];
2099
 
2100
  }
2101
 
@@ -2498,7 +2705,8 @@ function saswp_archive_output(){
2498
  $image_id = get_post_thumbnail_id();
2499
 
2500
  $archive_image = array();
2501
- $image_details = wp_get_attachment_image_src($image_id, 'full');
 
2502
  if(!empty($image_details)){
2503
 
2504
  $archive_image['@type'] = 'ImageObject';
@@ -2520,15 +2728,15 @@ function saswp_archive_output(){
2520
  }
2521
 
2522
  $publisher_info = array(
2523
- "type" => "Organization",
2524
- "name" => $site_name,
2525
- "logo" => array(
2526
- "@type" => "ImageObject",
2527
- "name" => $site_name,
2528
- "width" => $logo['width'],
2529
- "height" => $logo['height'],
2530
- "url" => $logo['url']
2531
- )
2532
  );
2533
  $publisher_info['name'] = get_bloginfo('name');
2534
  $publisher_info['id'] = get_the_permalink();
112
 
113
  $input = array(
114
  '@context' =>'http://schema.org',
115
+ '@type' => $sd_data['saswp_organization_type'],
116
  'name' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string'),
117
  'url' => saswp_remove_warnings($sd_data, 'sd_url', 'saswp_string'),
118
  'sameAs' => $platform,
426
  }
427
  }
428
 
429
+ if( 'Event' === $schema_type){
430
+
431
+
432
+ if(!saswp_non_amp() && is_plugin_active('the-events-calendar/the-events-calendar.php') && isset($sd_data['saswp-the-events-calendar']) && $sd_data['saswp-the-events-calendar'] == 1 ){
433
+
434
+ $input1 = Tribe__Events__JSON_LD__Event::instance()->get_data();
435
+
436
+ if(!empty($input1)){
437
+
438
+ $input1 = array_values( $input1 );
439
+ $input1 = json_encode($input1);
440
+ $input1 = json_decode($input1, true);
441
+ $input1 = $input1[0];
442
+ }
443
+
444
+ }else{
445
+
446
+ if ( isset($sd_data['saswp-the-events-calendar']) && $sd_data['saswp-the-events-calendar'] == 0 ) {
447
+
448
+ $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_event_schema_details');
449
+
450
+ $input1 = array(
451
+ '@context' => 'http://schema.org',
452
+ '@type' => $schema_type ,
453
+ 'name' => saswp_remove_warnings($schema_data, 'saswp_event_schema_name', 'saswp_string'),
454
+ 'description' => saswp_remove_warnings($schema_data, 'saswp_event_schema_description', 'saswp_string'),
455
+ 'startDate' => isset($schema_data['saswp_event_schema_start_date']) && $schema_data['saswp_event_schema_start_date'] !='' ? date('Y-m-d\TH:i:s\Z',$schema_data['saswp_event_schema_start_date']):'',
456
+ 'endDate' => isset($schema_data['saswp_event_schema_end_date']) && $schema_data['saswp_event_schema_end_date'] !='' ? date('Y-m-d\TH:i:s\Z',$schema_data['saswp_event_schema_end_date']):'',
457
+ 'image' => array(
458
+ '@type' =>'ImageObject',
459
+ 'url' => isset($schema_data['saswp_event_schema_image']) ? $schema_data['saswp_event_schema_image']['url']:'' ,
460
+ 'width' => isset($schema_data['saswp_event_schema_image']) ? $schema_data['saswp_event_schema_image']['width']:'' ,
461
+ 'height' => isset($schema_data['saswp_event_schema_image']) ? $schema_data['saswp_event_schema_image']['height']:'' ,
462
+ ),
463
+ 'location' => array(
464
+ '@type' => 'Place',
465
+ 'name' => saswp_remove_warnings($schema_data, 'saswp_event_schema_location_name', 'saswp_string'),
466
+ 'address' => array(
467
+ '@type' => 'PostalAddress',
468
+ 'streetAddress' => saswp_remove_warnings($schema_data, 'saswp_event_schema_location_streetaddress', 'saswp_string'),
469
+ 'addressLocality' => saswp_remove_warnings($schema_data, 'saswp_event_schema_location_locality', 'saswp_string'),
470
+ 'postalCode' => saswp_remove_warnings($schema_data, 'saswp_event_schema_location_postalcode', 'saswp_string'),
471
+ 'addressRegion' => saswp_remove_warnings($schema_data, 'saswp_event_schema_location_region', 'saswp_string'),
472
+ )
473
+ ),
474
+ 'offers' => array(
475
+ '@type' => 'Offer',
476
+ 'url' => saswp_remove_warnings($schema_data, 'saswp_event_schema_url', 'saswp_string'),
477
+ 'price' => saswp_remove_warnings($schema_data, 'saswp_event_schema_price', 'saswp_string'),
478
+ 'priceCurrency' => saswp_remove_warnings($schema_data, 'saswp_event_schema_price_currency', 'saswp_string'),
479
+ 'availability' => saswp_remove_warnings($schema_data, 'saswp_event_schema_availability', 'saswp_string'),
480
+ 'validFrom' => isset($schema_data['saswp_event_schema_validfrom']) && $schema_data['saswp_event_schema_validfrom'] !='' ? date('Y-m-d\TH:i:s\Z',$schema_data['saswp_event_schema_validfrom']):'',
481
+ ),
482
+ 'performer' => array(
483
+ '@type' => 'PerformingGroup',
484
+ 'name' => saswp_remove_warnings($schema_data, 'saswp_event_schema_performer_name', 'saswp_string'),
485
+ ),
486
+ );
487
+
488
+ if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
489
+ $service = new saswp_output_service();
490
+ $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
491
+ }
492
+ if(!empty($aggregateRating)){
493
+ $input1['aggregateRating'] = $aggregateRating;
494
+ }
495
+ if(!empty($kkstar_aggregateRating)){
496
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
497
+ }
498
+ if(!empty($extra_theme_review)){
499
+ $input1 = array_merge($input1, $extra_theme_review);
500
+ }
501
+ if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
502
+ $input1['comment'] = saswp_get_comments(get_the_ID());
503
+ }
504
+
505
+ }
506
+
507
+ }
508
+
509
+
510
+ }
511
+
512
  if( 'SoftwareApplication' === $schema_type){
513
 
514
  $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_software_schema_details');
678
  }
679
 
680
  if( 'qanda' === $schema_type){
681
+
682
  $service_object = new saswp_output_service();
683
  $input1 = $service_object->saswp_dw_question_answers_details(get_the_ID());
684
 
733
  );
734
  }
735
  if(!empty($product_details['product_reviews'])){
736
+
737
  $reviews = array();
738
+
739
  foreach ($product_details['product_reviews'] as $review){
740
+
741
  $reviews[] = array(
742
  '@type' => 'Review',
743
  'author' => $review['author'],
750
  'worstRating' => '1',
751
  )
752
  );
753
+
754
  }
755
  $input1['review'] = $reviews;
756
  }
819
  }
820
 
821
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
822
+
823
  $service = new saswp_output_service();
824
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
825
+
826
  }
827
  }
828
 
982
 
983
  if( 'Review' === $schema_type ){
984
 
985
+
986
+ if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1 ){
987
+
988
+ remove_action( 'TieLabs/after_post_entry', 'tie_article_schemas' );
989
+
990
+ $input1 = array(
991
+ '@context' => 'http://schema.org',
992
+ '@type' => $schema_type,
993
+ 'dateCreated' => $date,
994
+ 'datePublished' => $date,
995
+ 'dateModified' => $modified_date,
996
+ 'headline' => get_the_title(),
997
+ 'name' => get_the_title(),
998
+ 'keywords' => tie_get_plain_terms( get_the_ID(), 'post_tag' ),
999
+ 'url' => get_permalink(),
1000
+ 'description' => strip_tags(get_the_excerpt()),
1001
+ 'copyrightYear' => get_the_time( 'Y' ),
1002
+ 'author' => array(
1003
+ '@type' => 'Person',
1004
+ 'name' => $aurthor_name,
1005
+ 'Image' => array(
1006
+ '@type' => 'ImageObject',
1007
+ 'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
1008
+ 'height' => saswp_remove_warnings($author_details, 'height', 'saswp_string'),
1009
+ 'width' => saswp_remove_warnings($author_details, 'width', 'saswp_string')
1010
+ ),
1011
+ ),
1012
+
1013
+ );
1014
+
1015
+ $total_score = (int) get_post_meta( get_the_ID(), 'taq_review_score', true );
1016
+
1017
+ if( ! empty( $total_score ) && $total_score > 0 ){
1018
+
1019
+ $total_score = round( ($total_score*5)/100, 1 );
1020
+
1021
+ }
1022
+
1023
+ $input1['itemReviewed'] = array(
1024
+ '@type' => 'Thing',
1025
+ 'name' => get_the_title(),
1026
+ );
1027
+
1028
+ $input1['reviewRating'] = array(
1029
+ '@type' => 'Rating',
1030
+ 'worstRating' => 1,
1031
+ 'bestRating' => 5,
1032
+ 'ratingValue' => $total_score,
1033
+ 'description' => get_post_meta( get_the_ID(), 'taq_review_summary', true ),
1034
+ );
1035
+
1036
+ } else {
1037
+
1038
+ $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_review_schema_details');
1039
 
1040
  if(isset($schema_data['saswp_review_schema_item_type'])){
1041
 
1253
 
1254
 
1255
  }
1256
+
1257
+ }
1258
+
1259
  }
1260
 
1261
  if( 'VideoObject' === $schema_type){
1564
 
1565
 
1566
 
1567
+ if( 'qanda' === $schema_type){
1568
 
1569
  if(trim(saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array')) ==''){
1570
 
1581
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array'),
1582
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_description_'.$schema_id, 'saswp_array'),
1583
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_upvote_count_'.$schema_id, 'saswp_array'),
1584
+ 'dateCreated' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_qa_date_created_'.$schema_id, 'saswp_array')),
1585
  'author' => array('@type' => 'Person','name' =>saswp_remove_warnings($all_post_meta, 'saswp_qa_question_author_name_'.$schema_id, 'saswp_array')) ,
1586
  'answerCount' => 2 ,
1587
  'acceptedAnswer' => array(
1589
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_upvote_count_'.$schema_id, 'saswp_array'),
1590
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_url_'.$schema_id, 'saswp_array'),
1591
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_text_'.$schema_id, 'saswp_array'),
1592
+ 'dateCreated' => date('Y-m-d\TH:i:s\Z',saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_date_created_'.$schema_id, 'saswp_array')),
1593
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_author_name_'.$schema_id, 'saswp_array')),
1594
  ) ,
1595
  'suggestedAnswer' => array(
1597
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_upvote_count_'.$schema_id, 'saswp_array'),
1598
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_url_'.$schema_id, 'saswp_array'),
1599
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_text_'.$schema_id, 'saswp_array'),
1600
+ 'dateCreated' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_date_created_'.$schema_id, 'saswp_array')),
1601
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_author_name_'.$schema_id, 'saswp_array')),
1602
  ) ,
1603
  )
1604
  );
1605
  }
1606
  }
1607
+
1608
+ if( 'Event' === $schema_type){
1609
+
1610
+ $event_image = get_post_meta( get_the_ID(), 'saswp_event_schema_image_'.$schema_id.'_detail',true);
1611
+
1612
+ $input1 = array(
1613
+ '@context' => 'http://schema.org',
1614
+ '@type' => $schema_type ,
1615
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_name_'.$schema_id, 'saswp_array'),
1616
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_description_'.$schema_id, 'saswp_array'),
1617
+ 'startDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_event_schema_start_date_'.$schema_id, 'saswp_array')),
1618
+ 'endDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_event_schema_end_date_'.$schema_id, 'saswp_array')),
1619
+ 'image' => array(
1620
+ '@type' =>'ImageObject',
1621
+ 'url' => isset($event_image['thumbnail']) ? $event_image['thumbnail']:'' ,
1622
+ 'width' => isset($event_image['width']) ? $event_image['width'] :'' ,
1623
+ 'height' => isset($event_image['height']) ? $event_image['height'] :'' ,
1624
+ ),
1625
+ 'location' => array(
1626
+ '@type' => 'Place',
1627
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_location_name_'.$schema_id, 'saswp_array'),
1628
+ 'address' => array(
1629
+ '@type' => 'PostalAddress',
1630
+ 'streetAddress' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_location_streetaddress_'.$schema_id, 'saswp_array'),
1631
+ 'addressLocality' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_location_locality_'.$schema_id, 'saswp_array'),
1632
+ 'postalCode' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_location_postalcode_'.$schema_id, 'saswp_array'),
1633
+ 'addressRegion' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_location_region_'.$schema_id, 'saswp_array'),
1634
+ )
1635
+ ),
1636
+ 'offers' => array(
1637
+ '@type' => 'Offer',
1638
+ 'url' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_url_'.$schema_id, 'saswp_array'),
1639
+ 'price' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_price_'.$schema_id, 'saswp_array'),
1640
+ 'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_price_currency_'.$schema_id, 'saswp_array'),
1641
+ 'availability' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_availability_'.$schema_id, 'saswp_array'),
1642
+ 'validFrom' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_event_schema_validfrom_'.$schema_id, 'saswp_array')),
1643
+ ),
1644
+ 'performer' => array(
1645
+ '@type' => 'PerformingGroup',
1646
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_performer_name_'.$schema_id, 'saswp_array'),
1647
+ ),
1648
+ );
1649
+
1650
+ if(!empty($aggregateRating)){
1651
+ $input1['aggregateRating'] = $aggregateRating;
1652
+ }
1653
+ if(!empty($kkstar_aggregateRating)){
1654
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
1655
+ }
1656
+ if(!empty($extra_theme_review)){
1657
+ $input1 = array_merge($input1, $extra_theme_review);
1658
+ }
1659
+
1660
+ }
1661
 
1662
  if( 'Course' === $schema_type){
1663
 
1667
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_name_'.$schema_id, 'saswp_array'),
1668
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_course_description_'.$schema_id, 'saswp_array'),
1669
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_course_url_'.$schema_id, 'saswp_array'),
1670
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_course_date_published_'.$schema_id, 'saswp_array')),
1671
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_course_date_modified_'.$schema_id, 'saswp_array')),
1672
  'provider' => array(
1673
  '@type' => 'Organization',
1674
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_provider_name_'.$schema_id, 'saswp_array'),
1706
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_description_'.$schema_id, 'saswp_array'),
1707
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_name_'.$schema_id, 'saswp_array'),
1708
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_url_'.$schema_id, 'saswp_array'),
1709
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_blogposting_date_published_'.$schema_id, 'saswp_array')),
1710
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_blogposting_date_modified_'.$schema_id, 'saswp_array')),
1711
  'author' => array(
1712
  '@type' => 'Person',
1713
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array')
1744
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1745
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1746
  'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1747
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_published_'.$schema_id, 'saswp_array')),
1748
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_modified_'.$schema_id, 'saswp_array')),
1749
  'author' => array(
1750
  '@type' => 'Person',
1751
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array')
1762
  $input1 = array_merge($input1, $extra_theme_review);
1763
  }
1764
  }
1765
+
1766
+ if( 'SoftwareApplication' === $schema_type){
1767
 
1768
  $input1 = array(
1769
  '@context' => 'http://schema.org',
1777
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_'.$schema_id, 'saswp_array'),
1778
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_currency_'.$schema_id, 'saswp_array'),
1779
  ),
1780
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_software_schema_date_published_'.$schema_id, 'saswp_array')),
1781
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_software_schema_date_modified_'.$schema_id, 'saswp_array')),
1782
 
1783
  );
1784
 
1817
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_image_'.$schema_id, 'saswp_array'),
1818
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
1819
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
1820
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_webpage_date_published_'.$schema_id, 'saswp_array')),
1821
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_webpage_date_modified_'.$schema_id, 'saswp_array')),
1822
  'author' => array(
1823
  '@type' => 'Person',
1824
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'), ),
1864
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
1865
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
1866
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
1867
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_article_date_published_'.$schema_id, 'saswp_array')),
1868
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_article_date_modified_'.$schema_id, 'saswp_array')),
1869
  'author' => array(
1870
  '@type' => 'Person',
1871
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array')
1905
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_image_'.$schema_id, 'saswp_array'),
1906
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
1907
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
1908
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_published_'.$schema_id, 'saswp_array')),
1909
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_modified_'.$schema_id, 'saswp_array')),
1910
  'author' => array(
1911
  '@type' => 'Person',
1912
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array')
2003
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_thumbnailurl_'.$schema_id, 'saswp_array'),
2004
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_contenturl_'.$schema_id, 'saswp_array'),
2005
  'embedUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_embedurl_'.$schema_id, 'saswp_array'),
2006
+ 'uploadDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_upload_date_'.$schema_id, 'saswp_array')),
2007
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_duration_'.$schema_id, 'saswp_array'),
2008
  ),
2009
 
2010
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_recipe_date_published_'.$schema_id, 'saswp_array')),
2011
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_recipe_date_modified_'.$schema_id, 'saswp_array')),
2012
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_description_'.$schema_id, 'saswp_array'),
2013
  'mainEntity' => array(
2014
  '@type' => 'WebPage',
2061
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_price_'.$schema_id, 'saswp_array'),
2062
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_currency_'.$schema_id, 'saswp_array'),
2063
  'url' => get_permalink(),
2064
+ 'priceValidUntil'=> date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_product_schema_priceValidUntil_'.$schema_id, 'saswp_array')),
2065
  ),
2066
  'brand' => array('@type'=>'Thing',
2067
  'name'=>saswp_remove_warnings($all_post_meta, 'saswp_product_schema_brand_name_'.$schema_id, 'saswp_array'),
2109
  'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_main_entity_of_page_'.$schema_id, 'saswp_array'),
2110
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_URL_'.$schema_id, 'saswp_array'),
2111
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_headline_'.$schema_id, 'saswp_array'),
2112
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_date_published_'.$schema_id, 'saswp_array')),
2113
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_date_modified_'.$schema_id, 'saswp_array')),
2114
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_description_'.$schema_id, 'saswp_array'),
2115
  'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_section_'.$schema_id, 'saswp_array'),
2116
  'articleBody' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_body_'.$schema_id, 'saswp_array'),
2161
  '@type' => $schema_type,
2162
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2163
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2164
+ 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_video_object_date_published_'.$schema_id, 'saswp_array')),
2165
+ 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_video_object_date_modified_'.$schema_id, 'saswp_array')),
2166
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
2167
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2168
+ 'uploadDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_video_object_upload_date_'.$schema_id, 'saswp_array')),
2169
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
2170
  'mainEntity' => array(
2171
  '@type' => 'WebPage',
2273
 
2274
  if( 'Review' === $schema_type ){
2275
 
2276
+ if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1 ){
2277
+
2278
+ remove_action( 'TieLabs/after_post_entry', 'tie_article_schemas' );
2279
+
2280
+ }
2281
+
2282
  $service = new saswp_output_service();
2283
 
2284
  $review_author = get_the_author();
2285
 
2286
  if(isset($all_post_meta['saswp_review_schema_author_'.$schema_id])){
2287
+
2288
  $review_author = $all_post_meta['saswp_review_schema_author_'.$schema_id][0];
2289
+
2290
  }
2291
 
2292
  $input1['@context'] = 'http://schema.org';
2302
 
2303
  if(isset($all_post_meta['saswp_review_schema_author_sameas_'.$schema_id])){
2304
 
2305
+ $input1['author']['sameAs'] = $all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0];
2306
 
2307
  }
2308
 
2705
  $image_id = get_post_thumbnail_id();
2706
 
2707
  $archive_image = array();
2708
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
2709
+
2710
  if(!empty($image_details)){
2711
 
2712
  $archive_image['@type'] = 'ImageObject';
2728
  }
2729
 
2730
  $publisher_info = array(
2731
+ "type" => "Organization",
2732
+ "name" => $site_name,
2733
+ "logo" => array(
2734
+ "@type" => "ImageObject",
2735
+ "name" => $site_name,
2736
+ "width" => $logo['width'],
2737
+ "height" => $logo['height'],
2738
+ "url" => $logo['url']
2739
+ )
2740
  );
2741
  $publisher_info['name'] = get_bloginfo('name');
2742
  $publisher_info['id'] = get_the_permalink();
output/review-output.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php
2
  Class saswp_review_output{
 
3
  public function __construct() {
4
  }
5
 
@@ -21,7 +22,6 @@ Class saswp_review_output{
21
 
22
  }
23
 
24
-
25
  public function saswp_get_review_box_content(){
26
 
27
  $saswp_review_details = array();
@@ -37,20 +37,20 @@ Class saswp_review_output{
37
  $saswp_over_all_rating = '';
38
 
39
  if(isset($saswp_review_details['saswp-review-item-feature'])){
40
- $saswp_review_item_feature = $saswp_review_details['saswp-review-item-feature'];
41
  }
42
  if(isset($saswp_review_details['saswp-review-item-star-rating'])){
43
- $saswp_review_item_star_rating = $saswp_review_details['saswp-review-item-star-rating'];
44
  }
45
  if(isset($saswp_review_details['saswp-review-item-title'])){
46
- $saswp_review_title = $saswp_review_details['saswp-review-item-title'];
47
  }
48
  if(isset($saswp_review_details['saswp-review-item-description-title'])){
49
- $saswp_review_description_title = $saswp_review_details['saswp-review-item-description-title'];
50
  }
51
 
52
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
53
- $saswp_over_all_rating = $saswp_review_details['saswp-review-item-over-all'];
54
  }
55
 
56
  $boxdata ='';
@@ -171,6 +171,7 @@ Class saswp_review_output{
171
  return $boxdata;
172
 
173
  }
 
174
  public function saswp_display_review_box($content){
175
 
176
  global $sd_data;
1
  <?php
2
  Class saswp_review_output{
3
+
4
  public function __construct() {
5
  }
6
 
22
 
23
  }
24
 
 
25
  public function saswp_get_review_box_content(){
26
 
27
  $saswp_review_details = array();
37
  $saswp_over_all_rating = '';
38
 
39
  if(isset($saswp_review_details['saswp-review-item-feature'])){
40
+ $saswp_review_item_feature = $saswp_review_details['saswp-review-item-feature'];
41
  }
42
  if(isset($saswp_review_details['saswp-review-item-star-rating'])){
43
+ $saswp_review_item_star_rating = $saswp_review_details['saswp-review-item-star-rating'];
44
  }
45
  if(isset($saswp_review_details['saswp-review-item-title'])){
46
+ $saswp_review_title = $saswp_review_details['saswp-review-item-title'];
47
  }
48
  if(isset($saswp_review_details['saswp-review-item-description-title'])){
49
+ $saswp_review_description_title = $saswp_review_details['saswp-review-item-description-title'];
50
  }
51
 
52
  if(isset($saswp_review_details['saswp-review-item-over-all'])){
53
+ $saswp_over_all_rating = $saswp_review_details['saswp-review-item-over-all'];
54
  }
55
 
56
  $boxdata ='';
171
  return $boxdata;
172
 
173
  }
174
+
175
  public function saswp_display_review_box($content){
176
 
177
  global $sd_data;
output/service.php CHANGED
@@ -312,6 +312,62 @@ Class saswp_output_service{
312
  }
313
  break;
314
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  case 'TechArticle':
316
 
317
  if(isset($custom_fields['saswp_tech_article_main_entity_of_page'])){
@@ -739,6 +795,7 @@ Class saswp_output_service{
739
  global $wpdb;
740
  $saswp_meta_array = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE '%{$search_string}%'", ARRAY_A ); // WPCS: unprepared SQL OK.
741
  if ( isset( $saswp_meta_array ) && ! empty( $saswp_meta_array ) ) {
 
742
  foreach ( $saswp_meta_array as $value ) {
743
  // if ( ! in_array( $value['meta_key'], $schema_post_meta_fields ) ) {
744
  $data[] = array(
@@ -747,13 +804,17 @@ Class saswp_output_service{
747
  );
748
  //}
749
  }
 
750
  }
751
 
752
  if ( is_array( $data ) && ! empty( $data ) ) {
 
753
  $result[] = array(
754
  'children' => $data,
755
  );
 
756
  }
 
757
  wp_send_json( $result );
758
 
759
  wp_die();
@@ -801,7 +862,7 @@ Class saswp_output_service{
801
 
802
  $date_on_sale = $product->get_date_on_sale_to();
803
  $product_details['product_name'] = $product->get_title();
804
- $product_details['product_description'] = $product->get_description();
805
 
806
  if(!empty($image_details)){
807
 
@@ -816,9 +877,14 @@ Class saswp_output_service{
816
 
817
  $product_details['product_image'] = '';
818
 
819
- }
820
 
821
- $product_details['product_availability'] = $product->get_stock_status();
 
 
 
 
 
822
  $product_details['product_price'] = $product->get_price();
823
  $product_details['product_sku'] = $product->get_sku();
824
 
@@ -826,6 +892,10 @@ Class saswp_output_service{
826
 
827
  $product_details['product_priceValidUntil'] = $date_on_sale->date('Y-m-d G:i:s');
828
 
 
 
 
 
829
  }
830
 
831
  $product_details['product_currency'] = get_option( 'woocommerce_currency' );
@@ -993,16 +1063,24 @@ Class saswp_output_service{
993
  public function saswp_dw_question_answers_details($post_id){
994
 
995
  global $sd_data;
996
- $dw_qa = array();
997
- $qa_page = array();
998
-
 
 
 
999
  $post_type = get_post_type($post_id);
1000
 
1001
  if($post_type =='dwqa-question' && isset($sd_data['saswp-dw-question-answer']) && $sd_data['saswp-dw-question-answer'] ==1 ){
1002
 
1003
  $post_meta = get_post_meta($post_id, $key='', true);
1004
- $best_answer_id = $post_meta['_dwqa_best_answer'][0];
1005
-
 
 
 
 
 
1006
  $userid = get_post_field( 'post_author', $post_id );
1007
  $userinfo = get_userdata($userid);
1008
 
@@ -1026,7 +1104,13 @@ Class saswp_output_service{
1026
  }
1027
 
1028
  $dw_qa['dateCreated'] = get_the_date("Y-m-d\TH:i:s\Z");
1029
- $dw_qa['author'] = array('@type' => 'Person','name' =>$userinfo->data->user_nicename);
 
 
 
 
 
 
1030
  $dw_qa['answerCount'] = $post_meta['_dwqa_answers_count'][0];
1031
 
1032
  $args = array(
@@ -1050,7 +1134,7 @@ Class saswp_output_service{
1050
  $accepted_answer['@type'] = 'Answer';
1051
  $accepted_answer['upvoteCount'] = get_post_meta( $answer->ID, '_dwqa_votes', true );
1052
  $accepted_answer['url'] = get_permalink($answer->ID);
1053
- $accepted_answer['text'] = $answer->post_content;
1054
  $accepted_answer['dateCreated'] = get_the_date("Y-m-d\TH:i:s\Z", $answer);
1055
  $accepted_answer['author'] = array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename);
1056
 
@@ -1060,7 +1144,7 @@ Class saswp_output_service{
1060
  '@type' => 'Answer',
1061
  'upvoteCount' => get_post_meta( $answer->ID, '_dwqa_votes', true ),
1062
  'url' => get_permalink($answer->ID),
1063
- 'text' => $answer->post_content,
1064
  'dateCreated' => get_the_date("Y-m-d\TH:i:s\Z", $answer),
1065
  'author' => array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename),
1066
  );
@@ -1209,6 +1293,7 @@ Class saswp_output_service{
1209
  'saswp_tech_article_organization_logo' => 'Organization Logo',
1210
  );
1211
  break;
 
1212
  case 'Course':
1213
 
1214
  $meta_field = array(
@@ -1362,16 +1447,40 @@ Class saswp_output_service{
1362
 
1363
  'saswp_software_schema_name' => 'Name',
1364
  'saswp_software_schema_description' => 'Description',
1365
- 'saswp_software_schema_operating_system' => 'Description',
1366
- 'saswp_software_schema_application_category' => 'Description',
1367
- 'saswp_software_schema_price' => 'Description',
1368
- 'saswp_software_schema_price_currency' => 'Description',
1369
  'saswp_software_schema_date_published' => 'Date Published',
1370
  'saswp_software_schema_date_modified' => 'Date Modified',
1371
  );
1372
 
1373
  break;
1374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1375
  case 'qanda':
1376
  $meta_field = array(
1377
 
@@ -1484,8 +1593,7 @@ Class saswp_output_service{
1484
 
1485
  break;
1486
 
1487
- case 'Article':
1488
-
1489
  $input1 = array(
1490
  '@context' => 'http://schema.org',
1491
  '@type' => 'Article',
312
  }
313
  break;
314
 
315
+ case 'Event':
316
+
317
+ if(isset($custom_fields['saswp_event_schema_name'])){
318
+ $input1['name'] = $custom_fields['saswp_event_schema_name'];
319
+ }
320
+ if(isset($custom_fields['saswp_event_schema_description'])){
321
+ $input1['description'] = $custom_fields['saswp_event_schema_description'];
322
+ }
323
+ if(isset($custom_fields['saswp_event_schema_location_name'])){
324
+ $input1['location']['name'] = $custom_fields['saswp_event_schema_location_name'];
325
+ }
326
+
327
+ if(isset($custom_fields['saswp_event_schema_location_streetaddress'])){
328
+ $input1['location']['address']['streetAddress'] = $custom_fields['saswp_event_schema_location_streetaddress'];
329
+ }
330
+ if(isset($custom_fields['saswp_event_schema_location_locality'])){
331
+ $input1['location']['address']['addressLocality'] = $custom_fields['saswp_event_schema_location_locality'];
332
+ }
333
+ if(isset($custom_fields['saswp_event_schema_location_region'])){
334
+ $input1['location']['address']['addressRegion'] = $custom_fields['saswp_event_schema_location_region'];
335
+ }
336
+
337
+ if(isset($custom_fields['saswp_event_schema_location_postalcode'])){
338
+ $input1['location']['address']['postalCode'] = $custom_fields['saswp_event_schema_location_postalcode'];
339
+ }
340
+ if(isset($custom_fields['saswp_event_schema_start_date'])){
341
+ $input1['startDate'] = $custom_fields['saswp_event_schema_start_date'];
342
+ }
343
+ if(isset($custom_fields['saswp_event_schema_end_date'])){
344
+ $input1['endDate'] = $custom_fields['saswp_event_schema_end_date'];
345
+ }
346
+
347
+ if(isset($custom_fields['saswp_event_schema_image'])){
348
+ $input1['image'] = $custom_fields['saswp_event_schema_image'];
349
+ }
350
+ if(isset($custom_fields['saswp_event_schema_performer_name'])){
351
+ $input1['performer']['name'] = $custom_fields['saswp_event_schema_performer_name'];
352
+ }
353
+ if(isset($custom_fields['saswp_event_schema_price'])){
354
+ $input1['offers']['price'] = $custom_fields['saswp_event_schema_price'];
355
+ }
356
+ if(isset($custom_fields['saswp_event_schema_price_currency'])){
357
+ $input1['offers']['priceCurrency'] = $custom_fields['saswp_event_schema_price_currency'];
358
+ }
359
+ if(isset($custom_fields['saswp_event_schema_availability'])){
360
+ $input1['offers']['availability'] = $custom_fields['saswp_event_schema_availability'];
361
+ }
362
+ if(isset($custom_fields['saswp_event_schema_validfrom'])){
363
+ $input1['offers']['validFrom'] = $custom_fields['saswp_event_schema_validfrom'];
364
+ }
365
+ if(isset($custom_fields['saswp_event_schema_url'])){
366
+ $input1['offers']['url'] = $custom_fields['saswp_event_schema_url'];
367
+ }
368
+
369
+ break;
370
+
371
  case 'TechArticle':
372
 
373
  if(isset($custom_fields['saswp_tech_article_main_entity_of_page'])){
795
  global $wpdb;
796
  $saswp_meta_array = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE '%{$search_string}%'", ARRAY_A ); // WPCS: unprepared SQL OK.
797
  if ( isset( $saswp_meta_array ) && ! empty( $saswp_meta_array ) ) {
798
+
799
  foreach ( $saswp_meta_array as $value ) {
800
  // if ( ! in_array( $value['meta_key'], $schema_post_meta_fields ) ) {
801
  $data[] = array(
804
  );
805
  //}
806
  }
807
+
808
  }
809
 
810
  if ( is_array( $data ) && ! empty( $data ) ) {
811
+
812
  $result[] = array(
813
  'children' => $data,
814
  );
815
+
816
  }
817
+
818
  wp_send_json( $result );
819
 
820
  wp_die();
862
 
863
  $date_on_sale = $product->get_date_on_sale_to();
864
  $product_details['product_name'] = $product->get_title();
865
+ $product_details['product_description'] = $product->get_short_description();
866
 
867
  if(!empty($image_details)){
868
 
877
 
878
  $product_details['product_image'] = '';
879
 
880
+ }
881
 
882
+ if(strtolower( $product->get_stock_status() ) == 'onbackorder'){
883
+ $product_details['product_availability'] = 'PreOrder';
884
+ }else{
885
+ $product_details['product_availability'] = $product->get_stock_status();
886
+ }
887
+
888
  $product_details['product_price'] = $product->get_price();
889
  $product_details['product_sku'] = $product->get_sku();
890
 
892
 
893
  $product_details['product_priceValidUntil'] = $date_on_sale->date('Y-m-d G:i:s');
894
 
895
+ }else{
896
+
897
+ $product_details['product_priceValidUntil'] = get_the_modified_date("Y-m-d\TH:i:s\Z");
898
+
899
  }
900
 
901
  $product_details['product_currency'] = get_option( 'woocommerce_currency' );
1063
  public function saswp_dw_question_answers_details($post_id){
1064
 
1065
  global $sd_data;
1066
+ $dw_qa = array();
1067
+ $qa_page = array();
1068
+ $best_answer_id = '';
1069
+
1070
+
1071
+
1072
  $post_type = get_post_type($post_id);
1073
 
1074
  if($post_type =='dwqa-question' && isset($sd_data['saswp-dw-question-answer']) && $sd_data['saswp-dw-question-answer'] ==1 ){
1075
 
1076
  $post_meta = get_post_meta($post_id, $key='', true);
1077
+
1078
+ if(isset($post_meta['_dwqa_best_answer'])){
1079
+
1080
+ $best_answer_id = $post_meta['_dwqa_best_answer'][0];
1081
+
1082
+ }
1083
+
1084
  $userid = get_post_field( 'post_author', $post_id );
1085
  $userinfo = get_userdata($userid);
1086
 
1104
  }
1105
 
1106
  $dw_qa['dateCreated'] = get_the_date("Y-m-d\TH:i:s\Z");
1107
+
1108
+ if($userinfo){
1109
+
1110
+ $dw_qa['author'] = array('@type' => 'Person','name' =>$userinfo->data->user_nicename);
1111
+
1112
+ }
1113
+
1114
  $dw_qa['answerCount'] = $post_meta['_dwqa_answers_count'][0];
1115
 
1116
  $args = array(
1134
  $accepted_answer['@type'] = 'Answer';
1135
  $accepted_answer['upvoteCount'] = get_post_meta( $answer->ID, '_dwqa_votes', true );
1136
  $accepted_answer['url'] = get_permalink($answer->ID);
1137
+ $accepted_answer['text'] = wp_strip_all_tags($answer->post_content);
1138
  $accepted_answer['dateCreated'] = get_the_date("Y-m-d\TH:i:s\Z", $answer);
1139
  $accepted_answer['author'] = array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename);
1140
 
1144
  '@type' => 'Answer',
1145
  'upvoteCount' => get_post_meta( $answer->ID, '_dwqa_votes', true ),
1146
  'url' => get_permalink($answer->ID),
1147
+ 'text' => wp_strip_all_tags($answer->post_content),
1148
  'dateCreated' => get_the_date("Y-m-d\TH:i:s\Z", $answer),
1149
  'author' => array('@type' => 'Person', 'name' => $authorinfo->data->user_nicename),
1150
  );
1293
  'saswp_tech_article_organization_logo' => 'Organization Logo',
1294
  );
1295
  break;
1296
+
1297
  case 'Course':
1298
 
1299
  $meta_field = array(
1447
 
1448
  'saswp_software_schema_name' => 'Name',
1449
  'saswp_software_schema_description' => 'Description',
1450
+ 'saswp_software_schema_operating_system' => 'Operating System',
1451
+ 'saswp_software_schema_application_category' => 'Application Category',
1452
+ 'saswp_software_schema_price' => 'Price',
1453
+ 'saswp_software_schema_price_currency' => 'Price Currency',
1454
  'saswp_software_schema_date_published' => 'Date Published',
1455
  'saswp_software_schema_date_modified' => 'Date Modified',
1456
  );
1457
 
1458
  break;
1459
 
1460
+ case 'Event':
1461
+
1462
+ $meta_field = array(
1463
+
1464
+ 'saswp_event_schema_name' => 'Name',
1465
+ 'saswp_event_schema_description' => 'Description',
1466
+ 'saswp_event_schema_location_name' => 'Location Name',
1467
+ 'saswp_event_schema_location_streetaddress' => 'Location Street Address',
1468
+ 'saswp_event_schema_location_locality' => 'Location Locality',
1469
+ 'saswp_event_schema_location_region' => 'Location Region',
1470
+ 'saswp_event_schema_location_postalcode' => 'PostalCode',
1471
+ 'saswp_event_schema_start_date' => 'Start Date',
1472
+ 'saswp_event_schema_end_date' => 'End Date',
1473
+ 'saswp_event_schema_image' => 'Image',
1474
+ 'saswp_event_schema_performer_name' => 'Performer Name',
1475
+ 'saswp_event_schema_price' => 'Price',
1476
+ 'saswp_event_schema_price_currency' => 'Price Currency',
1477
+ 'saswp_event_schema_availability' => 'Availability',
1478
+ 'saswp_event_schema_validfrom' => 'Valid From',
1479
+ 'saswp_event_schema_url' => 'URL',
1480
+ );
1481
+
1482
+ break;
1483
+
1484
  case 'qanda':
1485
  $meta_field = array(
1486
 
1593
 
1594
  break;
1595
 
1596
+ case 'Article':
 
1597
  $input1 = array(
1598
  '@context' => 'http://schema.org',
1599
  '@type' => 'Article',
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
- Tested up to: 5.0.2
6
- Stable tag: 1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -65,6 +65,16 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
 
 
68
  = 1.2 (22 February 2019) =
69
 
70
  * New Feature: Software Application and Course schema type added to the schema type list #115
2
  Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
+ Tested up to: 5.1
6
+ Stable tag: 1.3
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
65
 
66
  == Changelog ==
67
 
68
+
69
+ = 1.3 (11 March 2019) =
70
+
71
+ * Added: Event schema type added to the schema type list #157
72
+ * Added: Compatibility with The Events Calendar plugin ( https://wordpress.org/plugins/the-events-calendar/ ) has been added in AMP. #157
73
+ * Added: New Organization type list has been added to knowledge graph section including "NewsMediaOrganization". #147
74
+ * Added: Compatibility with ( Tagyeem Review Plugin & Jannah News Theme ). #151
75
+ * Bug Fixed: ItemAvailability text "onbackorder" should be converted to "PreOrder" for product schema #161
76
+ * Bug Fixed: Bad escape sequence in string. #168
77
+
78
  = 1.2 (22 February 2019) =
79
 
80
  * New Feature: Software Application and Course schema type added to the schema type list #115
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.2
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Mohammed Kaludi, Ahmed Kaludi
@@ -13,7 +13,7 @@ License: GPL2
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
- define('SASWP_VERSION', '1.2');
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.3
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Mohammed Kaludi, Ahmed Kaludi
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.3');
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
@@ -386,6 +386,13 @@ class saswp_post_specific {
386
  $media_value['width'] = $business_details['saswp_review_schema_image']['width'];
387
  $media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
388
  }
 
 
 
 
 
 
 
389
 
390
  $media_height ='';
391
  $media_width ='';
@@ -531,6 +538,9 @@ class saswp_post_specific {
531
  || strpos($meta_field['id'], 'priceValidUntil') !== false
532
  || strpos($meta_field['id'], 'priceValidUntil') !== false
533
  || strpos($meta_field['id'], 'priceValidUntil') !== false
 
 
 
534
  ) {
535
  $class='saswp-local-schema-datepicker-picker';
536
  }
@@ -1362,6 +1372,115 @@ class saswp_post_specific {
1362
  );
1363
  break;
1364
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1365
  case 'TechArticle':
1366
  $meta_field = array(
1367
  array(
@@ -1909,6 +2028,7 @@ class saswp_post_specific {
1909
 
1910
  case 'Review':
1911
 
 
1912
 
1913
  if(isset($_POST['saswp_review_schema_item_type_'.$schema_id])){
1914
 
386
  $media_value['width'] = $business_details['saswp_review_schema_image']['width'];
387
  $media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
388
  }
389
+ if (strpos($meta_field['id'], 'event_schema_image') !== false && empty($media_value_meta)) {
390
+
391
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_event_schema_details', true) );
392
+ $media_value['height'] = $business_details['saswp_event_schema_image']['height'];
393
+ $media_value['width'] = $business_details['saswp_event_schema_image']['width'];
394
+ $media_value['thumbnail'] = $business_details['saswp_event_schema_image']['url'];
395
+ }
396
 
397
  $media_height ='';
398
  $media_width ='';
538
  || strpos($meta_field['id'], 'priceValidUntil') !== false
539
  || strpos($meta_field['id'], 'priceValidUntil') !== false
540
  || strpos($meta_field['id'], 'priceValidUntil') !== false
541
+ || strpos($meta_field['id'], 'saswp_event_schema_start_date') !== false
542
+ || strpos($meta_field['id'], 'saswp_event_schema_end_date') !== false
543
+ || strpos($meta_field['id'], 'saswp_event_schema_validfrom') !== false
544
  ) {
545
  $class='saswp-local-schema-datepicker-picker';
546
  }
1372
  );
1373
  break;
1374
 
1375
+ case 'Event':
1376
+
1377
+ $event_schema_details = esc_sql ( get_post_meta($schema_id, 'saswp_event_schema_details', true) );
1378
+ $meta_field = array(
1379
+ array(
1380
+ 'label' => 'Name',
1381
+ 'id' => 'saswp_event_schema_name_'.$schema_id,
1382
+ 'type' => 'text',
1383
+ 'default' => $event_schema_details['saswp_event_schema_name']
1384
+ ),
1385
+ array(
1386
+ 'label' => 'Description',
1387
+ 'id' => 'saswp_event_schema_description_'.$schema_id,
1388
+ 'type' => 'textarea',
1389
+ 'default' => $event_schema_details['saswp_event_schema_description']
1390
+ ),
1391
+ array(
1392
+ 'label' => 'Location Name',
1393
+ 'id' => 'saswp_event_schema_location_name_'.$schema_id,
1394
+ 'type' => 'text',
1395
+ 'default' => $event_schema_details['saswp_event_schema_location_name']
1396
+ ),
1397
+ array(
1398
+ 'label' => 'Location Street Address',
1399
+ 'id' => 'saswp_event_schema_location_streetaddress_'.$schema_id,
1400
+ 'type' => 'text',
1401
+ 'default' => $event_schema_details['saswp_event_schema_location_streetaddress']
1402
+ ),
1403
+ array(
1404
+ 'label' => 'Location Locality',
1405
+ 'id' => 'saswp_event_schema_location_locality_'.$schema_id,
1406
+ 'type' => 'text',
1407
+ 'default' => $event_schema_details['saswp_event_schema_location_locality']
1408
+ ),
1409
+ array(
1410
+ 'label' => 'Location Region',
1411
+ 'id' => 'saswp_event_schema_location_region_'.$schema_id,
1412
+ 'type' => 'text',
1413
+ 'default' => $event_schema_details['saswp_event_schema_location_region']
1414
+ ),
1415
+ array(
1416
+ 'label' => 'Location PostalCode',
1417
+ 'id' => 'saswp_event_schema_location_postalcode_'.$schema_id,
1418
+ 'type' => 'text',
1419
+ 'default' => $event_schema_details['saswp_event_schema_location_postalcode']
1420
+ ),
1421
+ array(
1422
+ 'label' => 'Start Date',
1423
+ 'id' => 'saswp_event_schema_start_date_'.$schema_id,
1424
+ 'type' => 'text',
1425
+ 'default' => $event_schema_details['saswp_event_schema_start_date']
1426
+ ),
1427
+ array(
1428
+ 'label' => 'End Date',
1429
+ 'id' => 'saswp_event_schema_end_date_'.$schema_id,
1430
+ 'type' => 'text',
1431
+ 'default' => $event_schema_details['saswp_event_schema_end_date']
1432
+ ),
1433
+ array(
1434
+ 'label' => 'Image',
1435
+ 'id' => 'saswp_event_schema_image_'.$schema_id,
1436
+ 'type' => 'media',
1437
+ 'default' => $event_schema_details['saswp_event_schema_image']['url']
1438
+ ),
1439
+ array(
1440
+ 'label' => 'Performer Name',
1441
+ 'id' => 'saswp_event_schema_performer_name_'.$schema_id,
1442
+ 'type' => 'text',
1443
+ 'default' => $event_schema_details['saswp_event_schema_performer_name']
1444
+ ),
1445
+ array(
1446
+ 'label' => 'Price',
1447
+ 'id' => 'saswp_event_schema_price_'.$schema_id,
1448
+ 'type' => 'number',
1449
+ 'default' => $event_schema_details['saswp_event_schema_price']
1450
+ ),
1451
+ array(
1452
+ 'label' => 'Price Currency',
1453
+ 'id' => 'saswp_event_schema_price_currency_'.$schema_id,
1454
+ 'type' => 'text',
1455
+ 'default' => $event_schema_details['saswp_event_schema_price_currency']
1456
+ ),
1457
+ array(
1458
+ 'label' => 'Availability',
1459
+ 'id' => 'saswp_event_schema_availability_'.$schema_id,
1460
+ 'type' => 'select',
1461
+ 'default' => saswp_remove_warnings($event_schema_details, 'saswp_event_schema_availability', 'saswp_string'),
1462
+ 'options' => array(
1463
+ 'InStock' => 'In Stock',
1464
+ 'OutOfStock' => 'Out Of Stock',
1465
+ 'Discontinued' => 'Discontinued',
1466
+ 'PreOrder' => 'Pre Order',
1467
+ )
1468
+ ),
1469
+ array(
1470
+ 'label' => 'Valid From',
1471
+ 'id' => 'saswp_event_schema_validfrom_'.$schema_id,
1472
+ 'type' => 'text',
1473
+ 'default' => $event_schema_details['saswp_event_schema_validfrom']
1474
+ ),
1475
+ array(
1476
+ 'label' => 'URL',
1477
+ 'id' => 'saswp_event_schema_url_'.$schema_id,
1478
+ 'type' => 'text',
1479
+ 'default' => $event_schema_details['saswp_event_schema_url']
1480
+ ),
1481
+ );
1482
+ break;
1483
+
1484
  case 'TechArticle':
1485
  $meta_field = array(
1486
  array(
2028
 
2029
  case 'Review':
2030
 
2031
+ $service_schema_details = array();
2032
 
2033
  if(isset($_POST['saswp_review_schema_item_type_'.$schema_id])){
2034
 
view/schema_type.php CHANGED
@@ -370,9 +370,12 @@
370
  $attributes ='';
371
 
372
  if(isset($meta_field['attributes'])){
 
373
  foreach ($meta_field['attributes'] as $key => $attr ){
 
374
  $attributes .=''.$key.'="'.$attr.'"';
375
- }
 
376
  }
377
 
378
 
@@ -496,14 +499,14 @@
496
 
497
  function saswp_schema_type_add_meta_box() {
498
 
499
- add_meta_box(
500
- 'schema_type',
501
- esc_html__( 'Schema Type', 'schema-and-structured-data-for-wp' ),
502
- 'saswp_schema_type_meta_box_callback',
503
- 'saswp',
504
- 'advanced',
505
- 'high'
506
- );
507
 
508
  }
509
 
@@ -518,7 +521,7 @@
518
  } else {
519
  return false;
520
  }
521
- }
522
 
523
  function saswp_schema_type_meta_box_callback( $post) {
524
 
@@ -532,11 +535,13 @@
532
  $schema_type = '';
533
  $business_type = '';
534
  $custom_logo_id = '';
 
535
  $business_details = array();
536
  $logo = array();
537
  $service_details = array();
538
  $review_details = array();
539
  $product_details = array();
 
540
 
541
  if($post){
542
 
@@ -582,6 +587,12 @@
582
  $review_details = esc_sql ( get_post_meta($post->ID, 'saswp_review_schema_details', true) );
583
 
584
  break;
 
 
 
 
 
 
585
 
586
  default:
587
  break;
@@ -656,7 +667,8 @@
656
  'Article' => 'Article',
657
  'AudioObject' => 'AudioObject',
658
  'Blogposting' => 'Blogposting',
659
- 'Course' => 'Course',
 
660
  // 'JobPosting' => 'JobPosting',
661
  'local_business' => 'Local Business',
662
  'NewsArticle' => 'NewsArticle',
@@ -1477,7 +1489,109 @@
1477
  <td><input value="<?php if(isset($software_details['saswp_software_schema_rating_count'])){echo esc_attr($software_details['saswp_software_schema_rating_count']); } ?>" type="text" name="saswp_software_schema_rating_count" placeholder="<?php echo esc_html__('8864', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1478
  </tr>
1479
 
1480
- <!-- SoftwareApplication Schema type ends here -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1481
 
1482
  </table>
1483
 
@@ -1810,9 +1924,80 @@
1810
  }
1811
 
1812
  update_post_meta( $post_id, 'saswp_software_schema_details', $software_schema_details );
1813
- }
1814
- //Service schema details ends here
1815
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1816
 
1817
  }
1818
 
370
  $attributes ='';
371
 
372
  if(isset($meta_field['attributes'])){
373
+
374
  foreach ($meta_field['attributes'] as $key => $attr ){
375
+
376
  $attributes .=''.$key.'="'.$attr.'"';
377
+
378
+ }
379
  }
380
 
381
 
499
 
500
  function saswp_schema_type_add_meta_box() {
501
 
502
+ add_meta_box(
503
+ 'schema_type',
504
+ esc_html__( 'Schema Type', 'schema-and-structured-data-for-wp' ),
505
+ 'saswp_schema_type_meta_box_callback',
506
+ 'saswp',
507
+ 'advanced',
508
+ 'high'
509
+ );
510
 
511
  }
512
 
521
  } else {
522
  return false;
523
  }
524
+ }
525
 
526
  function saswp_schema_type_meta_box_callback( $post) {
527
 
535
  $schema_type = '';
536
  $business_type = '';
537
  $custom_logo_id = '';
538
+
539
  $business_details = array();
540
  $logo = array();
541
  $service_details = array();
542
  $review_details = array();
543
  $product_details = array();
544
+ $event_details = array();
545
 
546
  if($post){
547
 
587
  $review_details = esc_sql ( get_post_meta($post->ID, 'saswp_review_schema_details', true) );
588
 
589
  break;
590
+
591
+ case 'Event':
592
+
593
+ $event_details = esc_sql ( get_post_meta($post->ID, 'saswp_event_schema_details', true) );
594
+
595
+ break;
596
 
597
  default:
598
  break;
667
  'Article' => 'Article',
668
  'AudioObject' => 'AudioObject',
669
  'Blogposting' => 'Blogposting',
670
+ 'Course' => 'Course',
671
+ 'Event' => 'Event',
672
  // 'JobPosting' => 'JobPosting',
673
  'local_business' => 'Local Business',
674
  'NewsArticle' => 'NewsArticle',
1489
  <td><input value="<?php if(isset($software_details['saswp_software_schema_rating_count'])){echo esc_attr($software_details['saswp_software_schema_rating_count']); } ?>" type="text" name="saswp_software_schema_rating_count" placeholder="<?php echo esc_html__('8864', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1490
  </tr>
1491
 
1492
+ <!-- SoftwareApplication Schema type ends here -->
1493
+
1494
+ <!-- Event Schema type starts here -->
1495
+
1496
+ <tr class="saswp-event-text-field-tr">
1497
+ <td><?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?></td>
1498
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_name'])){echo esc_attr($event_details['saswp_event_schema_name']); } ?>" type="text" name="saswp_event_schema_name" placeholder="<?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1499
+ </tr>
1500
+ <tr class="saswp-event-text-field-tr">
1501
+ <td><?php echo esc_html__('Description', 'schema-and-structured-data-for-wp' ); ?></td>
1502
+ <td>
1503
+ <textarea placeholder="Description" rows="5" cols="70" name="saswp_event_schema_description"><?php if(isset($event_details['saswp_event_schema_description'])){echo $event_details['saswp_event_schema_description']; } ?></textarea>
1504
+ </td>
1505
+ </tr>
1506
+ <tr class="saswp-event-text-field-tr">
1507
+ <td><?php echo esc_html__('Location Name', 'schema-and-structured-data-for-wp' ); ?></td>
1508
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_location_name'])){echo esc_attr($event_details['saswp_event_schema_location_name']); } ?>" type="text" name="saswp_event_schema_location_name" placeholder="<?php echo esc_html__('Location Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1509
+ </tr>
1510
+
1511
+ <tr class="saswp-event-text-field-tr">
1512
+ <td><?php echo esc_html__('Location Street Address', 'schema-and-structured-data-for-wp' ); ?></td>
1513
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_location_streetaddress'])){echo esc_attr($event_details['saswp_event_schema_location_streetaddress']); } ?>" type="text" name="saswp_event_schema_location_streetaddress" placeholder="<?php echo esc_html__('Location Street Address', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1514
+ </tr>
1515
+
1516
+ <tr class="saswp-event-text-field-tr">
1517
+ <td><?php echo esc_html__('Location Locality', 'schema-and-structured-data-for-wp' ); ?></td>
1518
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_location_locality'])){echo esc_attr($event_details['saswp_event_schema_location_locality']); } ?>" type="text" name="saswp_event_schema_location_locality" placeholder="<?php echo esc_html__('Location Locality', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1519
+ </tr>
1520
+
1521
+ <tr class="saswp-event-text-field-tr">
1522
+ <td><?php echo esc_html__('Location Region', 'schema-and-structured-data-for-wp' ); ?></td>
1523
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_location_region'])){echo esc_attr($event_details['saswp_event_schema_location_region']); } ?>" type="text" name="saswp_event_schema_location_region" placeholder="<?php echo esc_html__('Location Region', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1524
+ </tr>
1525
+
1526
+ <tr class="saswp-event-text-field-tr">
1527
+ <td><?php echo esc_html__('Location PostalCode', 'schema-and-structured-data-for-wp' ); ?></td>
1528
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_location_postalcode'])){echo esc_attr($event_details['saswp_event_schema_location_postalcode']); } ?>" type="text" name="saswp_event_schema_location_postalcode" placeholder="<?php echo esc_html__('PostalCode', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1529
+ </tr>
1530
+
1531
+ <tr class="saswp-event-text-field-tr">
1532
+ <td><?php echo esc_html__('Start Date', 'schema-and-structured-data-for-wp' ); ?></td>
1533
+ <td><input class="saswp-local-schema-datepicker-picker" value="<?php if(isset($event_details['saswp_event_schema_start_date'])){echo esc_attr($event_details['saswp_event_schema_start_date']); } ?>" type="text" name="saswp_event_schema_start_date" placeholder="<?php echo esc_html__('2018-12-12', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1534
+ </tr>
1535
+
1536
+ <tr class="saswp-event-text-field-tr">
1537
+ <td><?php echo esc_html__('End Date', 'schema-and-structured-data-for-wp' ); ?></td>
1538
+ <td><input class="saswp-local-schema-datepicker-picker" value="<?php if(isset($event_details['saswp_event_schema_end_date'])){echo esc_attr($event_details['saswp_event_schema_end_date']); } ?>" type="text" name="saswp_event_schema_end_date" placeholder="<?php echo esc_html__('2018-12-12', 'schema-and-structured-data-for-wp' ); ?>" ></td>
1539
+ </tr>
1540
+
1541
+ <tr class="saswp-event-text-field-tr">
1542
+ <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
1543
+ <td style="display: flex; width: 97%">
1544
+ <input value="<?php if(isset($event_details['saswp_event_schema_image'])) { echo esc_url($event_details['saswp_event_schema_image']['url']);} else { echo esc_url(saswp_remove_warnings($logo, 0, 'saswp_string')); } ?>" id="saswp_event_schema_image" type="text" name="saswp_event_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
1545
+ <input value="<?php if(isset($event_details['saswp_event_schema_image'])) { echo esc_attr($event_details['saswp_event_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_event_schema_image_id" type="hidden" name="saswp_event_schema_image[id]">
1546
+ <input value="<?php if(isset($event_details['saswp_event_schema_image'])) { echo esc_attr($event_details['saswp_event_schema_image']['width']);} else { echo esc_attr(saswp_remove_warnings($logo, 1, 'saswp_string')); } ?>" data-id="saswp_event_schema_image_width" type="hidden" name="saswp_event_schema_image[width]">
1547
+ <input value="<?php if(isset($event_details['saswp_event_schema_image'])) { echo esc_attr($event_details['saswp_event_schema_image']['height']);} else { echo esc_attr(saswp_remove_warnings($logo, 2, 'saswp_string')); } ?>" data-id="saswp_event_schema_image_height" type="hidden" name="saswp_event_schema_image[height]">
1548
+ <input data-id="media" class="button" id="saswp_event_schema_image_button" type="button" value="Upload">
1549
+ </td>
1550
+ </tr>
1551
+
1552
+ <tr class="saswp-event-text-field-tr">
1553
+ <td><?php echo esc_html__('Performer Name', 'schema-and-structured-data-for-wp' ); ?></td>
1554
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_performer_name'])){echo esc_attr($event_details['saswp_event_schema_performer_name']); } ?>" type="text" name="saswp_event_schema_performer_name"></td>
1555
+ </tr>
1556
+
1557
+ <tr class="saswp-event-text-field-tr">
1558
+ <td><?php echo esc_html__('Price', 'schema-and-structured-data-for-wp' ); ?></td>
1559
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_price'])){echo esc_attr($event_details['saswp_event_schema_price']); } ?>" type="number" name="saswp_event_schema_price"></td>
1560
+ </tr>
1561
+
1562
+ <tr class="saswp-event-text-field-tr">
1563
+ <td><?php echo esc_html__('Price currency', 'schema-and-structured-data-for-wp' ); ?></td>
1564
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_price_currency'])){echo esc_attr($event_details['saswp_event_schema_price_currency']); } ?>" type="text" name="saswp_event_schema_price_currency"></td>
1565
+ </tr>
1566
+ <tr class="saswp-event-text-field-tr">
1567
+ <td><?php echo esc_html__('Availability', 'schema-and-structured-data-for-wp' ); ?></td>
1568
+ <td>
1569
+ <select name="saswp_event_schema_availability">
1570
+ <?php
1571
+
1572
+ foreach ($availability as $key => $value) {
1573
+ $sel = '';
1574
+ if(saswp_remove_warnings($event_details, 'saswp_event_schema_availability', 'saswp_string')==$key){
1575
+ $sel = 'selected';
1576
+ }
1577
+ echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
1578
+ }
1579
+ ?>
1580
+ </select>
1581
+ </td>
1582
+ </tr>
1583
+
1584
+ <tr class="saswp-event-text-field-tr">
1585
+ <td><?php echo esc_html__('Valid From', 'schema-and-structured-data-for-wp' ); ?></td>
1586
+ <td><input class="saswp-local-schema-datepicker-picker" value="<?php if(isset($event_details['saswp_event_schema_validfrom'])){echo esc_attr($event_details['saswp_event_schema_validfrom']); } ?>" type="text" name="saswp_event_schema_validfrom"></td>
1587
+ </tr>
1588
+
1589
+ <tr class="saswp-event-text-field-tr">
1590
+ <td><?php echo esc_html__('URL', 'schema-and-structured-data-for-wp' ); ?></td>
1591
+ <td><input value="<?php if(isset($event_details['saswp_event_schema_url'])){echo esc_attr($event_details['saswp_event_schema_url']); } ?>" type="text" name="saswp_event_schema_url"></td>
1592
+ </tr>
1593
+
1594
+ <!-- Event Schema type ends here -->
1595
 
1596
  </table>
1597
 
1924
  }
1925
 
1926
  update_post_meta( $post_id, 'saswp_software_schema_details', $software_schema_details );
1927
+ }
 
1928
 
1929
+ if($schema_type == 'Event'){
1930
+
1931
+ $event_schema_details = array();
1932
+
1933
+ if ( isset( $_POST['saswp_event_schema_name'] ) ){
1934
+ $event_schema_details['saswp_event_schema_name'] = sanitize_text_field($_POST['saswp_event_schema_name']);
1935
+ }
1936
+
1937
+ if ( isset( $_POST['saswp_event_schema_description'] ) ){
1938
+ $event_schema_details['saswp_event_schema_description'] = sanitize_textarea_field($_POST['saswp_event_schema_description']);
1939
+ }
1940
+
1941
+ if ( isset( $_POST['saswp_event_schema_location_name'] ) ){
1942
+ $event_schema_details['saswp_event_schema_location_name'] = sanitize_text_field($_POST['saswp_event_schema_location_name']);
1943
+ }
1944
+
1945
+ if ( isset( $_POST['saswp_event_schema_location_streetaddress'] ) ){
1946
+ $event_schema_details['saswp_event_schema_location_streetaddress'] = sanitize_text_field($_POST['saswp_event_schema_location_streetaddress']);
1947
+ }
1948
+
1949
+ if ( isset( $_POST['saswp_event_schema_location_locality'] ) ){
1950
+ $event_schema_details['saswp_event_schema_location_locality'] = sanitize_text_field($_POST['saswp_event_schema_location_locality']);
1951
+ }
1952
+
1953
+ if ( isset( $_POST['saswp_event_schema_location_region'] ) ){
1954
+ $event_schema_details['saswp_event_schema_location_region'] = sanitize_text_field($_POST['saswp_event_schema_location_region']);
1955
+ }
1956
+
1957
+ if ( isset( $_POST['saswp_event_schema_location_postalcode'] ) ){
1958
+ $event_schema_details['saswp_event_schema_location_postalcode'] = sanitize_text_field($_POST['saswp_event_schema_location_postalcode']);
1959
+ }
1960
+ if ( isset( $_POST['saswp_event_schema_start_date'] ) ){
1961
+ $event_schema_details['saswp_event_schema_start_date'] = sanitize_text_field($_POST['saswp_event_schema_start_date']);
1962
+ }
1963
+
1964
+ if ( isset( $_POST['saswp_event_schema_end_date'] ) ){
1965
+ $event_schema_details['saswp_event_schema_end_date'] = sanitize_text_field($_POST['saswp_event_schema_end_date']);
1966
+ }
1967
+
1968
+ if ( isset( $_POST['saswp_event_schema_performer_name'] ) ){
1969
+ $event_schema_details['saswp_event_schema_performer_name'] = sanitize_text_field($_POST['saswp_event_schema_performer_name']);
1970
+ }
1971
+
1972
+ if ( isset( $_POST['saswp_event_schema_price'] ) ){
1973
+ $event_schema_details['saswp_event_schema_price'] = sanitize_text_field($_POST['saswp_event_schema_price']);
1974
+ }
1975
+
1976
+ if ( isset( $_POST['saswp_event_schema_price_currency'] ) ){
1977
+ $event_schema_details['saswp_event_schema_price_currency'] = sanitize_text_field($_POST['saswp_event_schema_price_currency']);
1978
+ }
1979
+
1980
+ if ( isset( $_POST['saswp_event_schema_availability'] ) ){
1981
+ $event_schema_details['saswp_event_schema_availability'] = sanitize_text_field($_POST['saswp_event_schema_availability']);
1982
+ }
1983
+
1984
+ if ( isset( $_POST['saswp_event_schema_validfrom'] ) ){
1985
+ $event_schema_details['saswp_event_schema_validfrom'] = sanitize_text_field($_POST['saswp_event_schema_validfrom']);
1986
+ }
1987
+
1988
+ if ( isset( $_POST['saswp_event_schema_url'] ) ){
1989
+ $event_schema_details['saswp_event_schema_url'] = sanitize_text_field($_POST['saswp_event_schema_url']);
1990
+ }
1991
+
1992
+ if ( isset( $_POST['saswp_event_schema_image'] ) ){
1993
+ $event_schema_details['saswp_event_schema_image']['id'] = sanitize_text_field($_POST['saswp_event_schema_image']['id']);
1994
+ $event_schema_details['saswp_event_schema_image']['url'] = esc_url_raw($_POST['saswp_event_schema_image']['url']);
1995
+ $event_schema_details['saswp_event_schema_image']['width'] = sanitize_text_field($_POST['saswp_event_schema_image']['width']);
1996
+ $event_schema_details['saswp_event_schema_image']['height'] = sanitize_text_field($_POST['saswp_event_schema_image']['height']);
1997
+ }
1998
+
1999
+ update_post_meta( $post_id, 'saswp_event_schema_details', $event_schema_details );
2000
+ }
2001
 
2002
  }
2003