Schema & Structured Data for WP & AMP - Version 1.0.7

Version Description

(31 December 2018) =

  • New Feature: AudioObject schema type add to the schema type list #115
  • New Feature: Option to reset plugin's settings #104
  • New Feature: Fields to enter Aggregate Rating below schema type #95
  • New Feature: SEO Pressor plugin importer #93
  • Improvement: Changed default "Homepage" to site name in Breadcrumbs. #87
  • Improvement: Product fields have been added when selecting product schema type #94
  • Improvement: Added provider type in service schema #103
  • Improvement: On/Off button has been added to post specific schema list #99
  • Improvement: List of compatible plugins should always be shown in compatibility tab #102
  • Improvement: Inside review schema type, item reviewed should be in dropdown #97
  • Improvement: Moved FlexMLS IDX compatibilty from tool tab to compatibility tab #112
  • Improvement: Properly prepared for localization to make plugin translatable #105
  • Bug Fixed: Modify Schema : - In Local Business schema type phone number is not being added in schema markup output #114
  • Bug Fixed: Local Business -> Food Establishment -> Bakery is buggy #111
  • Bug Fixed: select 2 conflicts with avada theme #92
  • Bug Fixed: warning issues on product/apartment schema #88

  • Bug Fixed: Other bug fixed

Download this release

Release Info

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

Code changes from version 1.0.6.1 to 1.0.7

admin_section/add-schema/add_new.php CHANGED
@@ -89,6 +89,12 @@ $saswp_add_data_type_config = array(
89
  wp_enqueue_script( 'saswp_add_new', SASWP_PLUGIN_URL. $saswp_add_data_type_config['installer_dir']. '/js/saswp-add-new' . $suffix . '.js' , array( 'jquery-core' ), '0.1' );
90
  //wp_enqueue_script( 'saswp_install_script', SASWP_PLUGIN_URL. '/admin_section/js/main-script.js' , array( 'jquery-core' ), '0.1' );
91
 
 
 
 
 
 
 
92
  wp_enqueue_script( 'structure_admin', SASWP_PLUGIN_URL. $saswp_add_data_type_config['installer_dir']. '/js/structure_admin' . $suffix . '.js' , array( 'jquery' ), '0.1' );
93
 
94
  wp_localize_script( 'structure_admin', 'saswp_app_object', array(
@@ -331,7 +337,10 @@ $saswp_add_data_type_config = array(
331
  return;
332
  }
333
  if(isset($_POST['schema_type'])){
334
- $schema_type = $_POST['schema_type'];
 
 
 
335
  $user_id = get_current_user_id();
336
  $schema_post = array(
337
  'post_author' => $user_id,
@@ -342,14 +351,7 @@ $saswp_add_data_type_config = array(
342
  'post_type' => 'saswp',
343
  );
344
  $post_id = wp_insert_post($schema_post);
345
- update_post_meta( $post_id, 'schema_type', esc_attr( $schema_type ) );
346
-
347
- if ( isset( $_POST['saswp_business_type'] ) ){
348
- update_post_meta( $post_id, 'saswp_business_type', esc_attr( $_POST['saswp_business_type'] ) );
349
- }
350
- if ( isset( $_POST['saswp_business_name'] ) ){
351
- update_post_meta( $post_id, 'saswp_business_name', esc_attr( $_POST['saswp_business_name'] ) );
352
- }
353
  set_transient('saswp_last_post_id', json_encode(array('post_id'=>$post_id)));
354
  }
355
 
@@ -422,7 +424,17 @@ $saswp_add_data_type_config = array(
422
 
423
  <footer class="merlin__content__footer merlin__content__footer--fullwidth">
424
 
425
- <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=saswp' ) ); ?>" class="merlin__button merlin__button--blue merlin__button--fullwidth merlin__button--popin"><?php echo esc_html( 'Let\'s Go' ); ?></a>
 
 
 
 
 
 
 
 
 
 
426
 
427
 
428
  <ul class="merlin__drawer merlin__drawer--extras">
89
  wp_enqueue_script( 'saswp_add_new', SASWP_PLUGIN_URL. $saswp_add_data_type_config['installer_dir']. '/js/saswp-add-new' . $suffix . '.js' , array( 'jquery-core' ), '0.1' );
90
  //wp_enqueue_script( 'saswp_install_script', SASWP_PLUGIN_URL. '/admin_section/js/main-script.js' , array( 'jquery-core' ), '0.1' );
91
 
92
+ //Enque datepicker
93
+ wp_enqueue_script( 'jquery-ui-datepicker' );
94
+ wp_register_style( 'jquery-ui', SASWP_PLUGIN_URL. 'admin_section/css/jquery-ui.css' );
95
+ wp_enqueue_style( 'jquery-ui' );
96
+
97
+
98
  wp_enqueue_script( 'structure_admin', SASWP_PLUGIN_URL. $saswp_add_data_type_config['installer_dir']. '/js/structure_admin' . $suffix . '.js' , array( 'jquery' ), '0.1' );
99
 
100
  wp_localize_script( 'structure_admin', 'saswp_app_object', array(
337
  return;
338
  }
339
  if(isset($_POST['schema_type'])){
340
+ $schema_type = $_POST['schema_type'];
341
+ if($schema_type == 'local_business'){
342
+ $schema_type = 'Local Business';
343
+ }
344
  $user_id = get_current_user_id();
345
  $schema_post = array(
346
  'post_author' => $user_id,
351
  'post_type' => 'saswp',
352
  );
353
  $post_id = wp_insert_post($schema_post);
354
+
 
 
 
 
 
 
 
355
  set_transient('saswp_last_post_id', json_encode(array('post_id'=>$post_id)));
356
  }
357
 
424
 
425
  <footer class="merlin__content__footer merlin__content__footer--fullwidth">
426
 
427
+ <?php
428
+ $last_post_id = json_decode(get_transient('saswp_last_post_id'), true);
429
+
430
+ if(isset($last_post_id['post_id'])){
431
+ $lets_go = esc_url( admin_url( 'post.php?post='.$last_post_id['post_id'].'&action=edit' ) );
432
+ }else{
433
+ $lets_go = esc_url( admin_url( 'edit.php?post_type=saswp' ) );
434
+ }
435
+ ?>
436
+
437
+ <a href="<?php echo $lets_go; ?>" class="merlin__button merlin__button--blue merlin__button--fullwidth merlin__button--popin"><?php echo esc_html( 'Let\'s Go' ); ?></a>
438
 
439
 
440
  <ul class="merlin__drawer merlin__drawer--extras">
admin_section/common-function.php CHANGED
@@ -126,6 +126,10 @@
126
  header('Content-type: application/json');
127
  header('Content-disposition: attachment; filename=structuredatabackup.json');
128
  echo json_encode($export_data_all);
 
 
 
 
129
  }
130
  wp_die();
131
  }
@@ -332,6 +336,180 @@
332
 
333
  }
334
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  function saswp_import_wp_seo_schema_plugin_data(){
336
  global $KcSeoWPSchema;
337
  global $wpdb;
126
  header('Content-type: application/json');
127
  header('Content-disposition: attachment; filename=structuredatabackup.json');
128
  echo json_encode($export_data_all);
129
+ }else{
130
+ header('Content-type: application/json');
131
+ header('Content-disposition: attachment; filename=structuredatabackup.json');
132
+ echo json_encode(array('message'=> 'Data is not available'));
133
  }
134
  wp_die();
135
  }
336
 
337
  }
338
 
339
+ function saswp_import_seo_pressor_plugin_data(){
340
+
341
+ global $wpdb;
342
+ $social_fields = array();
343
+ $opening_hours = '';
344
+ $settings = WPPostsRateKeys_Settings::get_options();
345
+
346
+ if(isset($settings['seop_home_social'])){
347
+ foreach($settings['seop_home_social'] as $social){
348
+
349
+ switch ($social['social_type']) {
350
+ case 'Facebook':
351
+
352
+ $social_fields['saswp-facebook-enable'] = 1;
353
+ $social_fields['sd_facebook'] = $social['social'];
354
+
355
+ break;
356
+ case 'Twitter':
357
+
358
+ $social_fields['saswp-twitter-enable'] = 1;
359
+ $social_fields['sd_twitter'] = $social['social'];
360
+
361
+ break;
362
+ case 'Google+':
363
+ $social_fields['saswp-google-plus-enable'] = 1;
364
+ $social_fields['sd_google_plus'] = $social['social'];
365
+ break;
366
+ case 'Instagram':
367
+ $social_fields['saswp-instagram-enable'] = 1;
368
+ $social_fields['sd_instagram'] = $social['social'];
369
+ break;
370
+ case 'YouTube':
371
+ $social_fields['saswp-youtube-enable'] = 1;
372
+ $social_fields['sd_youtube'] = $social['social'];
373
+ break;
374
+ case 'LinkedIn':
375
+ $social_fields['saswp-linkedin-enable'] = 1;
376
+ $social_fields['sd_linkedin'] = $social['social'];
377
+ break;
378
+ case 'Pinterest':
379
+ $social_fields['saswp-pinterest-enable'] = 1;
380
+ $social_fields['sd_pinterest'] = $social['social'];
381
+ break;
382
+ case 'SoundCloud':
383
+ $social_fields['saswp-soundcloud-enable'] = 1;
384
+ $social_fields['sd_soundcloud'] = $social['social'];
385
+ break;
386
+ case 'Tumblr':
387
+ $social_fields['saswp-tumblr-enable'] = 1;
388
+ $social_fields['sd_tumblr'] = $social['social'];
389
+ break;
390
+
391
+ default:
392
+ break;
393
+ }
394
+
395
+ }
396
+ }
397
+
398
+ if(isset($settings['seop_operating_hour'])){
399
+ $hours = $settings['seop_operating_hour'];
400
+ if(isset($hours['Mo'])){
401
+ $opening_hours .='Mo-Mo'.' '.$hours['Mo']['from'].'-'.$hours['Mo']['to'].' ';
402
+ }
403
+ if(isset($hours['Tu'])){
404
+ $opening_hours .='Tu-Tu'.' '.$hours['Tu']['from'].'-'.$hours['Tu']['to'].' ';
405
+ }
406
+ if(isset($hours['We'])){
407
+ $opening_hours .='We-We'.' '.$hours['We']['from'].'-'.$hours['We']['to'].' ';
408
+ }
409
+ if(isset($hours['Th'])){
410
+ $opening_hours .='Th-Th'.' '.$hours['Th']['from'].'-'.$hours['Th']['to'].' ';
411
+ }
412
+ if(isset($hours['Fr'])){
413
+ $opening_hours .='Fr-Fr'.' '.$hours['Fr']['from'].'-'.$hours['Fr']['to'].' ';
414
+ }
415
+ if(isset($hours['Sa'])){
416
+ $opening_hours .='Sa-Sa'.' '.$hours['Sa']['from'].'-'.$hours['Sa']['to'].' ';
417
+ }
418
+ if(isset($hours['Su'])){
419
+ $opening_hours .='Su-Su'.' '.$hours['Su']['from'].'-'.$hours['Su']['to'];
420
+ }
421
+ }
422
+
423
+
424
+ if(isset($settings)){
425
+ $local_business_details = array();
426
+ $wpdb->query('START TRANSACTION');
427
+
428
+ $user_id = get_current_user_id();
429
+
430
+ if($settings['seop_local_name'] !=''){
431
+ $schema_post = array(
432
+ 'post_author' => $user_id,
433
+ 'post_status' => 'publish',
434
+ 'post_type' => 'saswp',
435
+ );
436
+ $schema_post['post_title'] = 'Organization (Migrated from SEO Pressor)';
437
+
438
+ if(isset($settings['seop_local_name'])){
439
+ $schema_post['post_title'] = $settings['seop_local_name'].'(Migrated from WP SEO Plugin)';
440
+ }
441
+ if(isset($settings['seop_home_logo'])){
442
+ $image_details = wp_get_attachment_image_src($settings['seop_home_logo'], 'full');
443
+
444
+ $local_business_details['local_business_logo'] = array(
445
+ 'url' =>$image_details[0],
446
+ 'id' =>$settings['site_image'],
447
+ 'height' =>$image_details[1],
448
+ 'width' =>$image_details[2],
449
+ 'thumbnail' =>$image_details[0]
450
+ );
451
+ }
452
+
453
+ if(isset($settings['seop_local_website'])){
454
+ $local_business_details['local_website'] = $settings['seop_local_website'];
455
+ }
456
+
457
+ if(isset($settings['seop_local_city'])){
458
+ $local_business_details['local_city'] = $settings['seop_local_city'];
459
+ }
460
+ if(isset($settings['seop_local_state'])){
461
+ $local_business_details['local_state'] = $settings['seop_local_state'];
462
+ }
463
+ if(isset($settings['seop_local_postcode'])){
464
+ $local_business_details['local_postal_code'] = $settings['seop_local_postcode'];
465
+ }
466
+ if(isset($settings['seop_local_address'])){
467
+ $local_business_details['local_street_address'] = $settings['seop_local_address'];
468
+ }
469
+ $post_id = wp_insert_post($schema_post);
470
+ $result = $post_id;
471
+ $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
472
+ $wpdb->get_results("UPDATE wp_posts SET guid ='".$guid."' WHERE ID ='".$post_id."'");
473
+
474
+ $data_group_array = array();
475
+ $data_group_array['group-0'] =array(
476
+ 'data_array' => array(
477
+ array(
478
+ 'key_1' => 'post_type',
479
+ 'key_2' => 'equal',
480
+ 'key_3' => 'post',
481
+ )
482
+ )
483
+ );
484
+
485
+ $saswp_meta_key = array(
486
+ 'schema_type' => 'local_business',
487
+ 'data_group_array'=>$data_group_array,
488
+ 'imported_from' => 'wp_seo_schema',
489
+ 'saswp_local_business_details' => $local_business_details,
490
+ 'saswp_dayofweek' => $opening_hours,
491
+ );
492
+
493
+ foreach ($saswp_meta_key as $key => $val){
494
+ update_post_meta($post_id, $key, $val);
495
+ }
496
+
497
+ }
498
+
499
+ $get_options = get_option('sd_data');
500
+ $merge_options = array_merge($get_options, $social_fields);
501
+ $result = update_option('sd_data', $merge_options);
502
+
503
+ if (is_wp_error($result) ){
504
+ echo esc_attr($result->get_error_message());
505
+ $wpdb->query('ROLLBACK');
506
+ }else{
507
+ $wpdb->query('COMMIT');
508
+ return true;
509
+ }
510
+ }
511
+ }
512
+
513
  function saswp_import_wp_seo_schema_plugin_data(){
514
  global $KcSeoWPSchema;
515
  global $wpdb;
admin_section/css/main-style.css CHANGED
@@ -338,7 +338,7 @@ clear: both;
338
  }
339
  .saswp-seller-div .saswp-knowledge-label{
340
  float: left;
341
- width: 230px;
342
  clear: both;
343
  }
344
  .saswp-seller-div .saswp-knowledge-field{
@@ -467,4 +467,87 @@ Compatibility tab css ends
467
  font-style: italic;
468
  color: #666;
469
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  }
339
  .saswp-seller-div .saswp-knowledge-label{
340
  float: left;
341
+
342
  clear: both;
343
  }
344
  .saswp-seller-div .saswp-knowledge-field{
467
  font-style: italic;
468
  color: #666;
469
  }
470
+ /*
471
+ On/Off Buttons starts here
472
+ */
473
+ .saswp-switch {
474
+ position: relative;
475
+ display: inline-block;
476
+ width: 60px;
477
+ height: 36px;
478
+ }
479
+
480
+ .saswp-switch input {
481
+ opacity: 0;
482
+ width: 0;
483
+ height: 0;
484
+ }
485
+
486
+ .saswp-slider {
487
+ position: absolute;
488
+ cursor: pointer;
489
+ top: 0;
490
+ left: 0;
491
+ right: 0;
492
+ bottom: 0;
493
+ background-color: #ccc;
494
+ -webkit-transition: .4s;
495
+ transition: .4s;
496
+ }
497
+
498
+ .saswp-slider:before {
499
+ position: absolute;
500
+ content: "";
501
+ height: 26px;
502
+ width: 26px;
503
+ left: 4px;
504
+ bottom: 4px;
505
+ background-color: white;
506
+ -webkit-transition: .4s;
507
+ transition: .4s;
508
+ }
509
+
510
+ input:checked + .saswp-slider {
511
+ background-color: #61bd3b;
512
+ }
513
+
514
+ input:focus + .saswp-slider {
515
+ box-shadow: 0 0 1px #2196F3;
516
+ }
517
 
518
+ input:checked + .saswp-slider:before {
519
+ -webkit-transform: translateX(26px);
520
+ -ms-transform: translateX(26px);
521
+ transform: translateX(26px);
522
+ }
523
+
524
+ /* Rounded sliders */
525
+ .saswp-slider.saswp-round {
526
+ border-radius: 34px;
527
+ }
528
+
529
+ .saswp-slider.saswp-round:before {
530
+ border-radius: 50%;
531
+ }
532
+
533
+ .saswp-tab-nav li{
534
+ display: flex;
535
+ align-items: center;
536
+ }
537
+ .saswp-tab-nav .selected{
538
+ background-color: #ccc;
539
+ }
540
+ .saswp-tab-links{
541
+ display: flex;
542
+ flex-grow: 1;
543
+ background: transparent;
544
+ }
545
+ .saswp-single-post-restore .saswp-switch{
546
+ height: 28px;
547
+ }
548
+ .saswp-single-post-restore .saswp-slider:before{
549
+ height: 20px;
550
+ }
551
+ /*
552
+ On/Off Buttons ends here
553
+ */
admin_section/fields-generator.php CHANGED
@@ -47,19 +47,23 @@ class saswp_fields_generator {
47
 
48
  switch ( $meta_field['type'] ) {
49
  case 'media':
50
- $mediavalue = $settings[$meta_field['id']];
 
 
 
 
51
  $input = sprintf(
52
  '<fieldset><input class="%s" style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
53
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
54
- . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_id" class="upload-id " name="sd_data['.esc_attr($meta_field['id']).'][id]" id="sd_data['.esc_attr($meta_field['id']).'][id]" value="'.esc_attr($mediavalue['id']).'">'
55
- . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="sd_data['.esc_attr($meta_field['id']).'][height]" id="sd_data['.esc_attr($meta_field['id']).'][height]" value="'.esc_attr($mediavalue['height']).'">'
56
- . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="sd_data['.esc_attr($meta_field['id']).'][width]" id="sd_data['.esc_attr($meta_field['id']).'][width]" value="'.esc_attr($mediavalue['width']).'">'
57
- . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" id="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" value="'.esc_attr($mediavalue['thumbnail']).'">'
58
  . '</fieldset>',
59
  $class,
60
  esc_attr($meta_field['id']),
61
  esc_attr($meta_field['name']),
62
- esc_url($mediavalue['url']),
63
  esc_attr($meta_field['id']),
64
  esc_attr($meta_field['id'])
65
  );
@@ -70,7 +74,7 @@ class saswp_fields_generator {
70
  $attribute_str .=''.$key.'="'.$attr.'"';
71
  }
72
  $hiddenvalue ="";
73
- if(array_key_exists('id', $hidden)){
74
  $hiddenvalue = $settings[$hidden['id']];
75
  }
76
  $hiddenfield="";
@@ -96,8 +100,7 @@ class saswp_fields_generator {
96
  esc_attr($meta_field['name']),
97
  $hiddenvalue == 1 ? 'checked' : '',
98
  $attribute_str
99
- );
100
-
101
  $input .=$hiddenfield;
102
  break;
103
 
@@ -108,10 +111,15 @@ class saswp_fields_generator {
108
  esc_attr($meta_field['id']),
109
  esc_attr($meta_field['name'])
110
  );
111
- foreach ( $meta_field['options'] as $key => $value ) {
 
 
 
 
 
112
  $input .= sprintf(
113
  '<option %s value="%s">%s</option>',
114
- $settings[$meta_field['id']] == $key ? 'selected' : '',
115
  $key,
116
  esc_html__( $value, 'schema-and-structured-data-for-wp' )
117
  );
@@ -120,14 +128,20 @@ class saswp_fields_generator {
120
  break;
121
  default:
122
 
 
 
 
 
 
 
123
  $input = sprintf(
124
  '<input class="%s" %s id="%s" name="%s" type="%s" value="%s">',
125
  $class,
126
  $meta_field['type'] !== 'color' ? 'style="width: 100%"' : '',
127
- esc_attr($meta_field['id']),
128
- esc_attr($meta_field['name']),
129
- esc_attr($meta_field['type']),
130
- esc_attr($settings[$meta_field['id']])
131
  );
132
 
133
  }
47
 
48
  switch ( $meta_field['type'] ) {
49
  case 'media':
50
+ $mediavalue = array();
51
+ if(isset($settings[$meta_field['id']])){
52
+ $mediavalue = $settings[$meta_field['id']];
53
+ }
54
+
55
  $input = sprintf(
56
  '<fieldset><input class="%s" style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
57
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
58
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_id" class="upload-id " name="sd_data['.esc_attr($meta_field['id']).'][id]" id="sd_data['.esc_attr($meta_field['id']).'][id]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'id', 'saswp_string')).'">'
59
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="sd_data['.esc_attr($meta_field['id']).'][height]" id="sd_data['.esc_attr($meta_field['id']).'][height]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'height', 'saswp_string')).'">'
60
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="sd_data['.esc_attr($meta_field['id']).'][width]" id="sd_data['.esc_attr($meta_field['id']).'][width]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'width', 'saswp_string')).'">'
61
+ . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" id="sd_data['.esc_attr($meta_field['id']).'][thumbnail]" value="'.esc_attr(saswp_remove_warnings($mediavalue, 'thumbnail', 'saswp_string')).'">'
62
  . '</fieldset>',
63
  $class,
64
  esc_attr($meta_field['id']),
65
  esc_attr($meta_field['name']),
66
+ esc_url(saswp_remove_warnings($mediavalue, 'url', 'saswp_string')),
67
  esc_attr($meta_field['id']),
68
  esc_attr($meta_field['id'])
69
  );
74
  $attribute_str .=''.$key.'="'.$attr.'"';
75
  }
76
  $hiddenvalue ="";
77
+ if(array_key_exists('id', $hidden) && isset($settings[$hidden['id']])){
78
  $hiddenvalue = $settings[$hidden['id']];
79
  }
80
  $hiddenfield="";
100
  esc_attr($meta_field['name']),
101
  $hiddenvalue == 1 ? 'checked' : '',
102
  $attribute_str
103
+ );
 
104
  $input .=$hiddenfield;
105
  break;
106
 
111
  esc_attr($meta_field['id']),
112
  esc_attr($meta_field['name'])
113
  );
114
+ foreach ( $meta_field['options'] as $key => $value ) {
115
+ $settings_meta_field = '';
116
+ if(isset($settings[$meta_field['id']])){
117
+ $settings_meta_field = $settings[$meta_field['id']];
118
+ }
119
+
120
  $input .= sprintf(
121
  '<option %s value="%s">%s</option>',
122
+ $settings_meta_field == $key ? 'selected' : '',
123
  $key,
124
  esc_html__( $value, 'schema-and-structured-data-for-wp' )
125
  );
128
  break;
129
  default:
130
 
131
+ $stng_meta_field = '';
132
+
133
+ if(isset($settings[$meta_field['id']])){
134
+ $stng_meta_field = $settings[$meta_field['id']];
135
+ }
136
+
137
  $input = sprintf(
138
  '<input class="%s" %s id="%s" name="%s" type="%s" value="%s">',
139
  $class,
140
  $meta_field['type'] !== 'color' ? 'style="width: 100%"' : '',
141
+ esc_attr(saswp_remove_warnings($meta_field, 'id', 'saswp_string')),
142
+ esc_attr(saswp_remove_warnings($meta_field, 'name', 'saswp_string')),
143
+ esc_attr(saswp_remove_warnings($meta_field, 'type', 'saswp_string')),
144
+ esc_attr($stng_meta_field)
145
  );
146
 
147
  }
admin_section/js/main-script.js CHANGED
@@ -38,7 +38,7 @@ jQuery(document).ready(function($){
38
  $(".saswp-option-table-class tr").eq(1).show();
39
  $(".saswp-business-text-field-tr").show();
40
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
41
- $("#saswp_dayofweek").attr('disabled', false);
42
  $('.select-post-type').val('show_globally').trigger('change');
43
  }
44
  if(schematype == 'Service'){
@@ -46,12 +46,22 @@ jQuery(document).ready(function($){
46
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
47
  }
48
  if(schematype == 'Review'){
49
- $(".saswp-review-text-field-tr").show();
 
 
 
 
 
50
  }
 
 
 
 
51
  $(".saswp-schem-type-note").addClass('saswp_hide');
52
  if(schematype == 'qanda'){
53
  $(".saswp-schem-type-note").removeClass('saswp_hide');
54
  }
 
55
  });
56
 
57
  $("#saswp_business_type").change(function(){
@@ -68,16 +78,24 @@ jQuery(document).ready(function($){
68
  $(".saswp-"+businesstype+'-tr').show();
69
  $(".saswp-business-text-field-tr").show();
70
  $(".saswp-"+businesstype+'-tr').find('select').attr('disabled', false);
71
- $("#saswp_dayofweek").attr('disabled', false);
72
  }
73
  if(schematype == 'Service'){
74
  $(".saswp-service-text-field-tr").show();
75
  $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
76
  }
 
 
 
 
 
 
 
77
  if(schematype == 'Review'){
78
- $(".saswp-review-text-field-tr").show();
 
79
  }
80
-
81
  }).change();
82
 
83
 
@@ -343,6 +361,56 @@ jQuery(document).ready(function($){
343
  });
344
  //Settings page jquery ends here
345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
  //query form send starts here
347
 
348
  $(".saswp-send-query").on("click", function(e){
@@ -379,6 +447,7 @@ jQuery(document).ready(function($){
379
  $(".saswp-import-plugins").on("click", function(e){
380
  e.preventDefault();
381
  var current_selection = $(this);
 
382
  var plugin_name = $(this).attr('data-id');
383
  $.get(ajaxurl,
384
  { action:"saswp_import_plugin_data", plugin_name:plugin_name, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
@@ -390,7 +459,8 @@ jQuery(document).ready(function($){
390
  }else{
391
  $(current_selection).parent().find(".saswp-imported-message").addClass('saswp-error');
392
  $(current_selection).parent().find(".saswp-imported-message").text(response['message']);
393
- }
 
394
  },'json');
395
  });
396
 
@@ -436,21 +506,30 @@ jQuery(document).ready(function($){
436
  $('.saswp-local-schema-time-picker').timepicker({ 'timeFormat': 'H:i:s'});
437
  $(".saswp-modify_schema_post_enable").on("click", function(e){
438
  var current = $(this);
 
439
  e.preventDefault();
440
  $.get(ajaxurl,
441
  { action:"saswp_modify_schema_post_enable", post_id: saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
442
  function(response){
443
  current.remove();
444
  $("#post_specific .inside").append(response);
445
- saswpAddTimepicker();
 
 
 
446
  });
 
447
  });
 
 
 
 
 
 
 
 
 
448
 
449
- $('.saswp-local-schema-datepicker-picker').datepicker({
450
- dateFormat: "yy-mm-dd",
451
- minDate: 0
452
-
453
- });
454
 
455
  //Review js starts here
456
 
@@ -507,7 +586,9 @@ jQuery(document).ready(function($){
507
  }).change();
508
 
509
  $(document).on("click", ".saswp-restore-post-schema", function(e){
510
- e.preventDefault();
 
 
511
  var schema_ids = JSON.parse($(".saswp-post-specific-schema-ids").val());
512
  $.post(ajaxurl,
513
  { action:"saswp_restore_schema", schema_ids:schema_ids,post_id: saswp_localize_data.post_id, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
@@ -517,7 +598,8 @@ jQuery(document).ready(function($){
517
  }else{
518
  alert(response['msg']);
519
  setTimeout(function(){ location.reload(); }, 1000);
520
- }
 
521
  },'json');
522
  });
523
 
@@ -529,7 +611,10 @@ jQuery(document).ready(function($){
529
  $(".saswp-post-specific-wrapper").hide();
530
  $("#"+attr).show();
531
  $('div.saswp-tab ul.saswp-tab-nav a').removeClass('selected');
532
- $(this).addClass('selected');
 
 
 
533
  });
534
 
535
  //Importer from schema plugin ends here
@@ -599,8 +684,10 @@ jQuery(document).ready(function($){
599
  }
600
  });
601
  saswpCustomSelect2();
602
- function saswpCustomSelect2(){
603
- $('.saswp-custom-fields-select2').select2({
 
 
604
  ajax: {
605
  type: "POST",
606
  url: ajaxurl, // AJAX URL is predefined in WordPress admin
@@ -621,8 +708,38 @@ jQuery(document).ready(function($){
621
  cache: true
622
  },
623
  minimumInputLength: 2 // the minimum of symbols to input before perform a search
624
- });
 
 
 
625
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
626
 
627
  //custom fields modify schema ends here
628
 
38
  $(".saswp-option-table-class tr").eq(1).show();
39
  $(".saswp-business-text-field-tr").show();
40
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
41
+ // $("#saswp_dayofweek").attr('disabled', false);
42
  $('.select-post-type').val('show_globally').trigger('change');
43
  }
44
  if(schematype == 'Service'){
46
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
47
  }
48
  if(schematype == 'Review'){
49
+ $(".saswp-review-text-field-tr").show();
50
+ $(".saswp-option-table-class tr").find('select').attr('disabled', false);
51
+ }
52
+ if(schematype == 'Product'){
53
+ $(".saswp-product-text-field-tr").show();
54
+ $(".saswp-option-table-class tr").find('select').attr('disabled', false);
55
  }
56
+ if(schematype == 'AudioObject'){
57
+ $(".saswp-audio-text-field-tr").show();
58
+ }
59
+
60
  $(".saswp-schem-type-note").addClass('saswp_hide');
61
  if(schematype == 'qanda'){
62
  $(".saswp-schem-type-note").removeClass('saswp_hide');
63
  }
64
+ saswp_enable_rating_review();
65
  });
66
 
67
  $("#saswp_business_type").change(function(){
78
  $(".saswp-"+businesstype+'-tr').show();
79
  $(".saswp-business-text-field-tr").show();
80
  $(".saswp-"+businesstype+'-tr').find('select').attr('disabled', false);
81
+ // $("#saswp_dayofweek").attr('disabled', false);
82
  }
83
  if(schematype == 'Service'){
84
  $(".saswp-service-text-field-tr").show();
85
  $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
86
  }
87
+ if(schematype == 'Product'){
88
+ $(".saswp-product-text-field-tr").show();
89
+ $(".saswp-product-text-field-tr").find('select').attr('disabled', false);
90
+ }
91
+ if(schematype == 'AudioObject'){
92
+ $(".saswp-audio-text-field-tr").show();
93
+ }
94
  if(schematype == 'Review'){
95
+ $(".saswp-review-text-field-tr").show();
96
+ $(".saswp-review-text-field-tr").find('select').attr('disabled', false);
97
  }
98
+ saswp_enable_rating_review();
99
  }).change();
100
 
101
 
361
  });
362
  //Settings page jquery ends here
363
 
364
+
365
+ $(document).on("change",".saswp-schema-type-toggle", function(e){
366
+ var schema_id = $(this).attr("data-schema-id");
367
+ var post_id = $(this).attr("data-post-id");
368
+ if($(this).is(':checked')){
369
+ var status = 1;
370
+ }else{
371
+ var status = 0;
372
+ }
373
+ $.ajax({
374
+ type: "POST",
375
+ url:ajaxurl,
376
+ dataType: "json",
377
+ data:{action:"saswp_enable_disable_schema_on_post",status:status, schema_id:schema_id, post_id:post_id, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
378
+ success:function(response){
379
+ },
380
+ error: function(response){
381
+ console.log(response);
382
+ }
383
+ });
384
+
385
+ });
386
+
387
+
388
+ $(document).on("click",".saswp-reset-data", function(e){
389
+ e.preventDefault();
390
+
391
+ var saswp_confirm = confirm("Are you sure?");
392
+
393
+ if(saswp_confirm == true){
394
+
395
+ $.ajax({
396
+ type: "POST",
397
+ url:ajaxurl,
398
+ dataType: "json",
399
+ data:{action:"saswp_reset_all_settings", saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
400
+ success:function(response){
401
+ setTimeout(function(){ location.reload(); }, 1000);
402
+ },
403
+ error: function(response){
404
+ console.log(response);
405
+ }
406
+ });
407
+
408
+ }
409
+
410
+
411
+ });
412
+
413
+
414
  //query form send starts here
415
 
416
  $(".saswp-send-query").on("click", function(e){
447
  $(".saswp-import-plugins").on("click", function(e){
448
  e.preventDefault();
449
  var current_selection = $(this);
450
+ current_selection.addClass('updating-message');
451
  var plugin_name = $(this).attr('data-id');
452
  $.get(ajaxurl,
453
  { action:"saswp_import_plugin_data", plugin_name:plugin_name, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
459
  }else{
460
  $(current_selection).parent().find(".saswp-imported-message").addClass('saswp-error');
461
  $(current_selection).parent().find(".saswp-imported-message").text(response['message']);
462
+ }
463
+ current_selection.removeClass('updating-message');
464
  },'json');
465
  });
466
 
506
  $('.saswp-local-schema-time-picker').timepicker({ 'timeFormat': 'H:i:s'});
507
  $(".saswp-modify_schema_post_enable").on("click", function(e){
508
  var current = $(this);
509
+ current.addClass('updating-message');
510
  e.preventDefault();
511
  $.get(ajaxurl,
512
  { action:"saswp_modify_schema_post_enable", post_id: saswp_localize_data.post_id,saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
513
  function(response){
514
  current.remove();
515
  $("#post_specific .inside").append(response);
516
+ current.removeClass('updating-message');
517
+ saswpAddTimepicker();
518
+ saswp_schema_datepicker();
519
+ saswp_enable_rating_review();
520
  });
521
+
522
  });
523
+ saswp_schema_datepicker();
524
+ function saswp_schema_datepicker(){
525
+
526
+ $('.saswp-local-schema-datepicker-picker').datepicker({
527
+ dateFormat: "yy-mm-dd",
528
+ minDate: 0
529
+ });
530
+ }
531
+
532
 
 
 
 
 
 
533
 
534
  //Review js starts here
535
 
586
  }).change();
587
 
588
  $(document).on("click", ".saswp-restore-post-schema", function(e){
589
+ e.preventDefault();
590
+ var current = $(this);
591
+ current.addClass('updating-message');
592
  var schema_ids = JSON.parse($(".saswp-post-specific-schema-ids").val());
593
  $.post(ajaxurl,
594
  { action:"saswp_restore_schema", schema_ids:schema_ids,post_id: saswp_localize_data.post_id, saswp_security_nonce:saswp_localize_data.saswp_security_nonce},
598
  }else{
599
  alert(response['msg']);
600
  setTimeout(function(){ location.reload(); }, 1000);
601
+ }
602
+ current.removeClass('updating-message');
603
  },'json');
604
  });
605
 
611
  $(".saswp-post-specific-wrapper").hide();
612
  $("#"+attr).show();
613
  $('div.saswp-tab ul.saswp-tab-nav a').removeClass('selected');
614
+ $('div.saswp-tab ul.saswp-tab-nav li').removeClass('selected');
615
+ $(this).addClass('selected');
616
+ $(this).parent().addClass('selected');
617
+ saswp_enable_rating_review();
618
  });
619
 
620
  //Importer from schema plugin ends here
684
  }
685
  });
686
  saswpCustomSelect2();
687
+ function saswpCustomSelect2(){
688
+ if(saswp_app_object.post_type == 'saswp' || saswp_app_object.page_now =='saswp'){
689
+
690
+ $('.saswp-custom-fields-select2').select2({
691
  ajax: {
692
  type: "POST",
693
  url: ajaxurl, // AJAX URL is predefined in WordPress admin
708
  cache: true
709
  },
710
  minimumInputLength: 2 // the minimum of symbols to input before perform a search
711
+ });
712
+
713
+ }
714
+
715
  }
716
+
717
+ function saswp_enable_rating_review(){
718
+ var schema_type ="";
719
+ if($('select#schema_type option:selected').val()){
720
+ schema_type = $('select#schema_type option:selected').val();
721
+ }
722
+ if($(".saswp-tab-links.selected").attr('saswp-schema-type')){
723
+ schema_type = $(".saswp-tab-links.selected").attr('saswp-schema-type');
724
+ }
725
+
726
+ if(schema_type){
727
+ $(".saswp-enable-rating-review-"+schema_type.toLowerCase()).change(function(){
728
+
729
+ if($(this).is(':checked')){
730
+ $(this).parent().parent().siblings('.saswp-rating-review-'+schema_type.toLowerCase()).show();
731
+ }else{
732
+ $(this).parent().parent().siblings('.saswp-rating-review-'+schema_type.toLowerCase()).hide();
733
+ }
734
+
735
+ }).change();
736
+ }
737
+
738
+ }
739
+ saswp_enable_rating_review();
740
+
741
+
742
+
743
 
744
  //custom fields modify schema ends here
745
 
admin_section/js/saswp-add-new.js CHANGED
@@ -118,7 +118,7 @@ var Merlin = (function($){
118
  action: "saswp_add_new_save_steps_data",
119
  wpnonce: saswp_add_new_params.wpnonce,
120
  }
121
- jQuery('ul.merlin__drawer--import-content').find('input, select').each(function(key, fields){
122
 
123
  switch(jQuery(this).attr('type')){
124
  case 'text':
@@ -131,12 +131,15 @@ var Merlin = (function($){
131
  }else{
132
  params[jQuery(this).attr('name')] = 0;
133
  }
134
- break;
135
- default:
136
- params[jQuery(this).attr('name')] = jQuery(this).val();
 
 
 
137
  break;
138
  }
139
- });
140
  jQuery.post(saswp_add_new_params.ajaxurl, params, ajax_callback).fail(ajax_callback);
141
  }
142
 
@@ -260,21 +263,29 @@ jQuery(document).ready(function($) {
260
  $(".saswp-option-table-class tr").eq(1).show();
261
  $(".saswp-business-text-field-tr").show();
262
  $(".saswp-option-table-class tr").find('select').attr('disabled', false);
263
- $("#saswp_dayofweek").attr('disabled', false);
264
  $('.select-post-type').val('show_globally').trigger('change');
265
  }
266
  if(schematype == 'Service'){
267
  $(".saswp-service-text-field-tr").show();
268
- $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
269
  }
270
- if(schematype == 'Review'){
271
- $(".saswp-review-text-field-tr").show();
 
 
 
 
 
 
 
 
272
  }
273
  $(".saswp-schem-type-note").addClass('saswp_hide');
274
  if(schematype == 'qanda'){
275
  $(".saswp-schem-type-note").removeClass('saswp_hide');
276
  }
277
-
278
  }).change();
279
 
280
  $("#saswp_business_type").change(function(){
@@ -291,17 +302,36 @@ jQuery(document).ready(function($) {
291
  $(".saswp-"+businesstype+'-tr').show();
292
  $(".saswp-business-text-field-tr").show();
293
  $(".saswp-"+businesstype+'-tr').find('select').attr('disabled', false);
294
- $("#saswp_dayofweek").attr('disabled', false);
295
  }
296
  if(schematype == 'Service'){
297
  $(".saswp-service-text-field-tr").show();
298
  $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
299
  }
 
 
 
 
 
 
 
300
  if(schematype == 'Review'){
301
- $(".saswp-review-text-field-tr").show();
302
- }
 
 
303
  }).change();
304
 
 
 
 
 
 
 
 
 
 
 
305
  $("input[data-id=media]").click(function(e) { // Application Icon upload
306
  e.preventDefault();
307
  var button = $(this);
@@ -327,6 +357,30 @@ jQuery(document).ready(function($) {
327
 
328
  $('#saswp-dayofweek-opens-time').timepicker({ 'timeFormat': 'H:i:s'});
329
  $('#saswp-dayofweek-closes-time').timepicker({ 'timeFormat': 'H:i:s'});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
330
 
331
 
332
  });
118
  action: "saswp_add_new_save_steps_data",
119
  wpnonce: saswp_add_new_params.wpnonce,
120
  }
121
+ jQuery('ul.merlin__drawer--import-content').find('input, select, textarea').each(function(key, fields){
122
 
123
  switch(jQuery(this).attr('type')){
124
  case 'text':
131
  }else{
132
  params[jQuery(this).attr('name')] = 0;
133
  }
134
+ break;
135
+
136
+ default:
137
+ if(jQuery(this).prop('disabled')== false){
138
+ params[jQuery(this).attr('name')] = jQuery(this).val();
139
+ }
140
  break;
141
  }
142
+ });
143
  jQuery.post(saswp_add_new_params.ajaxurl, params, ajax_callback).fail(ajax_callback);
144
  }
145
 
263
  $(".saswp-option-table-class tr").eq(1).show();
264
  $(".saswp-business-text-field-tr").show();
265
  $(".saswp-option-table-class 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 == 'Product'){
274
+ $(".saswp-product-text-field-tr").show();
275
+ $(".saswp-option-table-class tr").find('select').attr('disabled', false);
276
+ }
277
+ if(schematype == 'AudioObject'){
278
+ $(".saswp-audio-text-field-tr").show();
279
+ }
280
+ if(schematype == 'Review'){
281
+ $(".saswp-review-text-field-tr").show();
282
+ $(".saswp-option-table-class tr").find('select').attr('disabled', false);
283
  }
284
  $(".saswp-schem-type-note").addClass('saswp_hide');
285
  if(schematype == 'qanda'){
286
  $(".saswp-schem-type-note").removeClass('saswp_hide');
287
  }
288
+ saswp_enable_rating_review();
289
  }).change();
290
 
291
  $("#saswp_business_type").change(function(){
302
  $(".saswp-"+businesstype+'-tr').show();
303
  $(".saswp-business-text-field-tr").show();
304
  $(".saswp-"+businesstype+'-tr').find('select').attr('disabled', false);
305
+ // $("#saswp_dayofweek").attr('disabled', false);
306
  }
307
  if(schematype == 'Service'){
308
  $(".saswp-service-text-field-tr").show();
309
  $(".saswp-service-text-field-tr").find('select').attr('disabled', false);
310
  }
311
+ if(schematype == 'Product'){
312
+ $(".saswp-product-text-field-tr").show();
313
+ $(".saswp-product-text-field-tr").find('select').attr('disabled', false);
314
+ }
315
+ if(schematype == 'AudioObject'){
316
+ $(".saswp-audio-text-field-tr").show();
317
+ }
318
  if(schematype == 'Review'){
319
+ $(".saswp-review-text-field-tr").show();
320
+ $(".saswp-review-text-field-tr").find('select').attr('disabled', false);
321
+ }
322
+ saswp_enable_rating_review();
323
  }).change();
324
 
325
+ saswp_schema_datepicker();
326
+ function saswp_schema_datepicker(){
327
+
328
+ $('.saswp-local-schema-datepicker-picker').datepicker({
329
+ dateFormat: "yy-mm-dd",
330
+ minDate: 0
331
+ });
332
+ }
333
+
334
+
335
  $("input[data-id=media]").click(function(e) { // Application Icon upload
336
  e.preventDefault();
337
  var button = $(this);
357
 
358
  $('#saswp-dayofweek-opens-time').timepicker({ 'timeFormat': 'H:i:s'});
359
  $('#saswp-dayofweek-closes-time').timepicker({ 'timeFormat': 'H:i:s'});
360
+
361
+ function saswp_enable_rating_review(){
362
+ var schema_type ="";
363
+ if($('select#schema_type option:selected').val()){
364
+ schema_type = $('select#schema_type option:selected').val();
365
+ }
366
+ if($(".saswp-tab-links.selected").attr('saswp-schema-type')){
367
+ schema_type = $(".saswp-tab-links.selected").attr('saswp-schema-type');
368
+ }
369
+
370
+ if(schema_type){
371
+ $(".saswp-enable-rating-review-"+schema_type.toLowerCase()).change(function(){
372
+
373
+ if($(this).is(':checked')){
374
+ $(this).parent().parent().siblings('.saswp-rating-review-'+schema_type.toLowerCase()).show();
375
+ }else{
376
+ $(this).parent().parent().siblings('.saswp-rating-review-'+schema_type.toLowerCase()).hide();
377
+ }
378
+
379
+ }).change();
380
+ }
381
+
382
+ }
383
+ saswp_enable_rating_review();
384
 
385
 
386
  });
admin_section/settings.php CHANGED
@@ -768,9 +768,15 @@ function saswp_import_callback(){
768
  $schema_message = '';
769
  $schema_pro_message = '';
770
  $wp_seo_schema_message = '';
 
771
  $schema_plugin = saswp_check_data_imported_from('schema');
772
  $schema_pro_plugin = saswp_check_data_imported_from('schema_pro');
773
  $wp_seo_schema_plugin = saswp_check_data_imported_from('wp_seo_schema');
 
 
 
 
 
774
  if($schema_plugin->post_count !=0){
775
  $schema_message =$message;
776
  }
@@ -799,6 +805,12 @@ function saswp_import_callback(){
799
  <?php echo $wp_seo_schema_message; ?>
800
  </div>
801
  </li>
 
 
 
 
 
 
802
  </ul>
803
  <?php
804
  echo '<h2>'.esc_html__('Import / Export','schema-and-structured-data-for-wp').'</h2>';
@@ -814,9 +826,146 @@ function saswp_import_callback(){
814
  </div>
815
  </li>
816
  </ul>
817
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
 
819
- $settings = saswp_defaultSettings();
820
 
821
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
822
  $meta_fields_default = array(
@@ -894,129 +1043,19 @@ function saswp_import_callback(){
894
  'class' => 'saswp-sd_seller_image',
895
  'type' => 'media',
896
  );
897
- echo '<h2>'.esc_html__('Compatibility','schema-and-structured-data-for-wp').'</h2>';
898
- $field_objs = new saswp_fields_generator();
899
- echo '<div class="saswp-compativility-div">';
900
- $field_objs->saswp_field_generator($meta_fields_default, $settings);
901
- echo '</div>';
902
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
903
  echo '<div class="saswp-seller-div">';
904
  echo '<strong>'.esc_html__('Real estate agent info :','schema-and-structured-data-for-wp').'</strong>';
905
  $field_objs->saswp_field_generator($meta_fields_text, $settings);
906
  echo '</div>';
907
  }
908
-
909
- }
910
-
911
- function saswp_imported_callback(){
912
- $settings = saswp_defaultSettings();
913
- ?>
914
- <?php
915
- }
916
-
917
- function saswp_review_page_callback(){
918
 
919
- $settings = saswp_defaultSettings();
920
- $field_objs = new saswp_fields_generator();
921
- $meta_fields = array(
922
- array(
923
- 'label' => 'Review Module',
924
- 'id' => 'saswp-review-module-checkbox',
925
- 'name' => 'saswp-review-module-checkbox',
926
- 'type' => 'checkbox',
927
- 'class' => 'checkbox saswp-checkbox',
928
- 'hidden' => array(
929
- 'id' => 'saswp-review-module',
930
- 'name' => 'sd_data[saswp-review-module]',
931
- )
932
- ),
933
-
934
- );
935
- //echo '<h2>'.esc_html__('Set Up','schema-and-structured-data-for-wp').'</h2>';
936
- $field_objs->saswp_field_generator($meta_fields, $settings);
937
-
938
- }
939
- function saswp_compatibility_page_callback(){
940
 
941
- $settings = saswp_defaultSettings();
942
 
943
- //KK Star rating
944
- $field_objs = new saswp_fields_generator();
945
- $meta_fields = array(
946
- array(
947
- 'label' => 'kk Star Ratings',
948
- 'id' => 'saswp-kk-star-raring-checkbox',
949
- 'name' => 'saswp-kk-star-raring-checkbox',
950
- 'type' => 'checkbox',
951
- 'class' => 'checkbox saswp-checkbox',
952
- 'hidden' => array(
953
- 'id' => 'saswp-kk-star-raring',
954
- 'name' => 'sd_data[saswp-kk-star-raring]',
955
- )
956
- ),
957
-
958
- );
959
- if(is_plugin_active('kk-star-ratings/index.php')){
960
- $field_objs->saswp_field_generator($meta_fields, $settings);
961
- }
962
- //Woocommerce
963
- $meta_fields = array(
964
- array(
965
- 'label' => 'Woocommerce',
966
- 'id' => 'saswp-woocommerce-checkbox',
967
- 'name' => 'saswp-woocommerce-checkbox',
968
- 'type' => 'checkbox',
969
- 'class' => 'checkbox saswp-checkbox',
970
- 'hidden' => array(
971
- 'id' => 'saswp-woocommerce',
972
- 'name' => 'sd_data[saswp-woocommerce]',
973
- )
974
- ),
975
-
976
- );
977
- if(is_plugin_active('woocommerce/woocommerce.php')){
978
- $field_objs->saswp_field_generator($meta_fields, $settings);
979
- }
980
- //Extra theme by elegant themes
981
- $meta_fields = array(
982
- array(
983
- 'label' => 'Extra Theme By Elegant',
984
- 'id' => 'saswp-extra-checkbox',
985
- 'name' => 'saswp-extra-checkbox',
986
- 'type' => 'checkbox',
987
- 'class' => 'checkbox saswp-checkbox',
988
- 'hidden' => array(
989
- 'id' => 'saswp-extra',
990
- 'name' => 'sd_data[saswp-extra]',
991
- )
992
- ),
993
-
994
- );
995
-
996
- if(get_template() == 'Extra'){
997
- $field_objs->saswp_field_generator($meta_fields, $settings);
998
- }
999
-
1000
- //DW Question Answer
1001
- $meta_fields = array(
1002
- array(
1003
- 'label' => 'DW Question Answer',
1004
- 'id' => 'saswp-dw-question-answer-checkbox',
1005
- 'name' => 'saswp-dw-question-answer-checkbox',
1006
- 'type' => 'checkbox',
1007
- 'class' => 'checkbox saswp-checkbox',
1008
- 'hidden' => array(
1009
- 'id' => 'saswp-dw-question-answer',
1010
- 'name' => 'sd_data[saswp-dw-question-answer]',
1011
- )
1012
- ),
1013
-
1014
- );
1015
-
1016
- if(is_plugin_active('dw-question-answer/dw-question-answer.php')){
1017
- $field_objs->saswp_field_generator($meta_fields, $settings);
1018
- }
1019
-
1020
  }
1021
 
1022
 
768
  $schema_message = '';
769
  $schema_pro_message = '';
770
  $wp_seo_schema_message = '';
771
+ $seo_pressor_message = '';
772
  $schema_plugin = saswp_check_data_imported_from('schema');
773
  $schema_pro_plugin = saswp_check_data_imported_from('schema_pro');
774
  $wp_seo_schema_plugin = saswp_check_data_imported_from('wp_seo_schema');
775
+ $seo_pressor = saswp_check_data_imported_from('seo_pressor');
776
+
777
+ if($seo_pressor->post_count !=0){
778
+ $seo_pressor_message =$message;
779
+ }
780
  if($schema_plugin->post_count !=0){
781
  $schema_message =$message;
782
  }
805
  <?php echo $wp_seo_schema_message; ?>
806
  </div>
807
  </li>
808
+ <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>
809
+ <p class="saswp-imported-message"></p>
810
+ <?php echo $seo_pressor_message; ?>
811
+ </div>
812
+ </li>
813
+
814
  </ul>
815
  <?php
816
  echo '<h2>'.esc_html__('Import / Export','schema-and-structured-data-for-wp').'</h2>';
826
  </div>
827
  </li>
828
  </ul>
829
+ <?php
830
+ echo '<h2>'.esc_html__('Reset','schema-and-structured-data-for-wp').'</h2>';
831
+ ?>
832
+ <ul>
833
+ <li>
834
+ <div class="saswp-tools-field-title"><div class="saswp-tooltip"><strong><?php echo esc_html__('Reset Plugin','schema-and-structured-data-for-wp'); ?></strong></div><a href="#"class="button saswp-reset-data"><?php echo esc_html__('Reset','schema-and-structured-data-for-wp'); ?></a>
835
+ <p>This will reset your settings and schema types</p>
836
+ </div>
837
+ </li>
838
+
839
+ </ul>
840
+ <?php
841
+
842
+ }
843
+
844
+ function saswp_imported_callback(){
845
+ $settings = saswp_defaultSettings();
846
+ ?>
847
+ <?php
848
+ }
849
+
850
+ function saswp_review_page_callback(){
851
+
852
+ $settings = saswp_defaultSettings();
853
+ $field_objs = new saswp_fields_generator();
854
+ $meta_fields = array(
855
+ array(
856
+ 'label' => 'Review Module',
857
+ 'id' => 'saswp-review-module-checkbox',
858
+ 'name' => 'saswp-review-module-checkbox',
859
+ 'type' => 'checkbox',
860
+ 'class' => 'checkbox saswp-checkbox',
861
+ 'hidden' => array(
862
+ 'id' => 'saswp-review-module',
863
+ 'name' => 'sd_data[saswp-review-module]',
864
+ )
865
+ ),
866
+
867
+ );
868
+ $field_objs->saswp_field_generator($meta_fields, $settings);
869
+
870
+ }
871
+ function saswp_compatibility_page_callback(){
872
+
873
+ $settings = saswp_defaultSettings();
874
+ $kk_star = array(
875
+ 'label' => 'kk Star Ratings',
876
+ 'id' => 'saswp-kk-star-raring-checkbox',
877
+ 'name' => 'saswp-kk-star-raring-checkbox',
878
+ 'type' => 'checkbox',
879
+ 'class' => 'checkbox saswp-checkbox',
880
+ 'hidden' => array(
881
+ 'id' => 'saswp-kk-star-raring',
882
+ 'name' => 'sd_data[saswp-kk-star-raring]',
883
+ )
884
+ );
885
+ $woocommerce = array(
886
+ 'label' => 'Woocommerce',
887
+ 'id' => 'saswp-woocommerce-checkbox',
888
+ 'name' => 'saswp-woocommerce-checkbox',
889
+ 'type' => 'checkbox',
890
+ 'class' => 'checkbox saswp-checkbox',
891
+ 'hidden' => array(
892
+ 'id' => 'saswp-woocommerce',
893
+ 'name' => 'sd_data[saswp-woocommerce]',
894
+ )
895
+ );
896
+ $extratheme = array(
897
+ 'label' => 'Extra Theme By Elegant',
898
+ 'id' => 'saswp-extra-checkbox',
899
+ 'name' => 'saswp-extra-checkbox',
900
+ 'type' => 'checkbox',
901
+ 'class' => 'checkbox saswp-checkbox',
902
+ 'hidden' => array(
903
+ 'id' => 'saswp-extra',
904
+ 'name' => 'sd_data[saswp-extra]',
905
+ )
906
+ );
907
+ $dwquestiton = array(
908
+ 'label' => 'DW Question Answer',
909
+ 'id' => 'saswp-dw-question-answer-checkbox',
910
+ 'name' => 'saswp-dw-question-answer-checkbox',
911
+ 'type' => 'checkbox',
912
+ 'class' => 'checkbox saswp-checkbox',
913
+ 'hidden' => array(
914
+ 'id' => 'saswp-dw-question-answer',
915
+ 'name' => 'sd_data[saswp-dw-question-answer]',
916
+ )
917
+ );
918
+
919
+
920
+ if(!is_plugin_active('kk-star-ratings/index.php')){
921
+ $kk_star['attributes'] = array(
922
+ 'disabled' => 'disabled'
923
+ );
924
+ $kk_star['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
925
+ $settings['saswp-kk-star-raring'] = 0;
926
+ }
927
+
928
+
929
+ if(!is_plugin_active('woocommerce/woocommerce.php')){
930
+
931
+ $woocommerce['attributes'] = array(
932
+ 'disabled' => 'disabled'
933
+ );
934
+ $woocommerce['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
935
+ $settings['saswp-woocommerce'] = 0;
936
+
937
+ }
938
+
939
+ if(get_template() != 'Extra'){
940
+
941
+ $extratheme['attributes'] = array(
942
+ 'disabled' => 'disabled'
943
+ );
944
+ $extratheme['note'] = esc_html__('Theme is not activated','schema-and-structured-data-for-wp');
945
+ $settings['saswp-extra'] = 0;
946
+ }
947
+
948
+
949
+ if(!is_plugin_active('dw-question-answer/dw-question-answer.php')){
950
+
951
+ $dwquestiton['attributes'] = array(
952
+ 'disabled' => 'disabled'
953
+ );
954
+ $dwquestiton['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
955
+ $settings['saswp-dw-question-answer'] = 0;
956
+ }
957
+
958
+ $field_objs = new saswp_fields_generator();
959
+ $meta_fields = array(
960
+ $kk_star,
961
+ $woocommerce,
962
+ $extratheme,
963
+ $dwquestiton,
964
+
965
+ );
966
+
967
+ $field_objs->saswp_field_generator($meta_fields, $settings);
968
 
 
969
 
970
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
971
  $meta_fields_default = array(
1043
  'class' => 'saswp-sd_seller_image',
1044
  'type' => 'media',
1045
  );
1046
+
1047
+ $field_objs = new saswp_fields_generator();
1048
+ $field_objs->saswp_field_generator($meta_fields_default, $settings);
 
 
1049
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
1050
  echo '<div class="saswp-seller-div">';
1051
  echo '<strong>'.esc_html__('Real estate agent info :','schema-and-structured-data-for-wp').'</strong>';
1052
  $field_objs->saswp_field_generator($meta_fields_text, $settings);
1053
  echo '</div>';
1054
  }
 
 
 
 
 
 
 
 
 
 
1055
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1056
 
 
1057
 
1058
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  }
1060
 
1061
 
admin_section/structure_admin.php CHANGED
@@ -1,4 +1,35 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  //FrontEnd
3
  function saswp_get_all_schema_posts(){
4
  $post_idArray = array();
@@ -494,17 +525,25 @@ function saswp_change_add_new_url() {
494
  * Hooked to the wp_print_scripts action, with a late priority (100),
495
  * so that it is after the script was enqueued.
496
  */
497
- function saswp_dequeue_script() {
498
- if(get_post_type() == 'saswp'){
499
- wp_dequeue_script( 'avada-fusion-options' );
500
- }
501
- }
502
- add_action( 'wp_print_scripts', 'saswp_dequeue_script', 100 );
503
 
504
  add_action( 'admin_enqueue_scripts', 'saswp_style_script_include' );
505
- function saswp_style_script_include() {
 
 
506
  global $pagenow, $typenow;
 
507
  if (is_admin()) {
 
 
 
 
 
508
  wp_register_script( 'structure_admin', plugin_dir_url(__FILE__) . '/js/structure_admin.js', array( 'jquery'), SASWP_VERSION, true );
509
  $post_type='';
510
  $current_screen = get_Current_screen();
@@ -525,7 +564,8 @@ add_action( 'wp_print_scripts', 'saswp_dequeue_script', 100 );
525
  $data_array = array(
526
  'ajax_url' => admin_url( 'admin-ajax.php' ),
527
  'post_found_status' => $post_found_status,
528
- 'post_type' =>$post_type,
 
529
  );
530
  wp_localize_script( 'structure_admin', 'saswp_app_object', $data_array );
531
  wp_enqueue_script('structure_admin');
@@ -539,10 +579,10 @@ add_action( 'wp_print_scripts', 'saswp_dequeue_script', 100 );
539
  wp_enqueue_style( 'jquery-ui' );
540
 
541
  //Enque select 2 script starts here
542
-
543
- wp_enqueue_style('saswp-select2-style', SASWP_PLUGIN_URL. 'admin_section/css/select2.min.css' , false, SASWP_VERSION);
544
- wp_enqueue_script('saswp-select2-script', SASWP_PLUGIN_URL. 'admin_section/js/select2.min.js', false, SASWP_VERSION);
545
-
546
  //Enque select 2 script ends here
547
  }
548
  }
@@ -611,7 +651,7 @@ function saswp_custom_breadcrumbs() {
611
  $variables2_links = array();
612
  // Settings
613
  $separator = '&gt;';
614
- $home_title = esc_html__('Homepage', 'schema-and-structured-data-for-wp' );
615
 
616
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
617
  $custom_taxonomy = 'product_cat';
@@ -780,8 +820,9 @@ function saswp_custom_breadcrumbs() {
780
 
781
  $variables1_titles[] = $get_term_name;
782
  $variables2_links[] = $term_link;
783
- }
784
- $sd_data['titles']= $variables1_titles;
 
785
  $sd_data['links']= $variables2_links;
786
 
787
  }
@@ -909,6 +950,10 @@ function saswp_import_plugin_data(){
909
  case 'wp_seo_schema':
910
  if ( is_plugin_active('wp-seo-structured-data-schema/wp-seo-structured-data-schema.php')) {
911
  $result = saswp_import_wp_seo_schema_plugin_data();
 
 
 
 
912
  }
913
  break;
914
 
1
  <?php
2
+ function saswp_reset_all_settings(){
3
+
4
+ if ( ! isset( $_POST['saswp_security_nonce'] ) ){
5
+ return;
6
+ }
7
+ if ( !wp_verify_nonce( $_POST['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
8
+ return;
9
+ }
10
+ $result ='';
11
+
12
+ update_option( 'sd_data', array());
13
+ $allposts= get_posts( array('post_type'=>'saswp','numberposts'=>-1) );
14
+ foreach ($allposts as $eachpost) {
15
+ $result = wp_delete_post( $eachpost->ID, true );
16
+ }
17
+
18
+ if($result){
19
+ echo json_encode(array('status'=>'t'));
20
+ }else{
21
+ echo json_encode(array('status'=>'f'));
22
+ }
23
+ wp_die();
24
+ }
25
+
26
+ add_action('wp_ajax_saswp_reset_all_settings', 'saswp_reset_all_settings');
27
+
28
+ function saswp_load_plugin_textdomain() {
29
+ load_plugin_textdomain( 'schema-and-structured-data-for-wp', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
30
+ }
31
+ add_action( 'plugins_loaded', 'saswp_load_plugin_textdomain' );
32
+
33
  //FrontEnd
34
  function saswp_get_all_schema_posts(){
35
  $post_idArray = array();
525
  * Hooked to the wp_print_scripts action, with a late priority (100),
526
  * so that it is after the script was enqueued.
527
  */
528
+ //function saswp_dequeue_script() {
529
+ // if(get_post_type() == 'saswp'){
530
+ // wp_dequeue_script( 'avada-fusion-options' );
531
+ // }
532
+ //}
533
+ //add_action( 'wp_print_scripts', 'saswp_dequeue_script', 100 );
534
 
535
  add_action( 'admin_enqueue_scripts', 'saswp_style_script_include' );
536
+
537
+
538
+ function saswp_style_script_include($hook) {
539
  global $pagenow, $typenow;
540
+
541
  if (is_admin()) {
542
+
543
+ if($hook == 'saswp' || get_post_type() == 'saswp'){
544
+ wp_dequeue_script( 'avada-fusion-options' );
545
+ }
546
+
547
  wp_register_script( 'structure_admin', plugin_dir_url(__FILE__) . '/js/structure_admin.js', array( 'jquery'), SASWP_VERSION, true );
548
  $post_type='';
549
  $current_screen = get_Current_screen();
564
  $data_array = array(
565
  'ajax_url' => admin_url( 'admin-ajax.php' ),
566
  'post_found_status' => $post_found_status,
567
+ 'post_type' =>$post_type,
568
+ 'page_now' => $hook,
569
  );
570
  wp_localize_script( 'structure_admin', 'saswp_app_object', $data_array );
571
  wp_enqueue_script('structure_admin');
579
  wp_enqueue_style( 'jquery-ui' );
580
 
581
  //Enque select 2 script starts here
582
+ if($hook == 'saswp' || get_post_type() == 'saswp'){
583
+ wp_enqueue_style('saswp-select2-style', SASWP_PLUGIN_URL. 'admin_section/css/select2.min.css' , false, SASWP_VERSION);
584
+ wp_enqueue_script('saswp-select2-script', SASWP_PLUGIN_URL. 'admin_section/js/select2.min.js', false, SASWP_VERSION);
585
+ }
586
  //Enque select 2 script ends here
587
  }
588
  }
651
  $variables2_links = array();
652
  // Settings
653
  $separator = '&gt;';
654
+ $home_title = get_bloginfo();
655
 
656
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
657
  $custom_taxonomy = 'product_cat';
820
 
821
  $variables1_titles[] = $get_term_name;
822
  $variables2_links[] = $term_link;
823
+ }
824
+
825
+ $sd_data['titles']= $variables1_titles;
826
  $sd_data['links']= $variables2_links;
827
 
828
  }
950
  case 'wp_seo_schema':
951
  if ( is_plugin_active('wp-seo-structured-data-schema/wp-seo-structured-data-schema.php')) {
952
  $result = saswp_import_wp_seo_schema_plugin_data();
953
+ }
954
+ case 'seo_pressor':
955
+ if ( is_plugin_active('seo-pressor/seo-pressor.php')) {
956
+ $result = saswp_import_seo_pressor_plugin_data();
957
  }
958
  break;
959
 
output/flexmls.php CHANGED
@@ -205,7 +205,7 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
205
  $sellerimage ='';
206
  $selleraddress ='';
207
  $sellertelephone ='';
208
- $sellerpricerange ='';
209
 
210
  if(isset($sd_data['saswp_compativility']) && $sd_data['saswp_compativility']==1){
211
 
@@ -231,7 +231,7 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
231
  $link_to_details_criteria = $this->search_criteria;
232
  $link_to_details = flexmlsConnect::make_nice_address_url($result['StandardFields'], $link_to_details_criteria, 'fmc_tag');
233
  $photos = array();
234
- if($result['StandardFields']['Photos']){
235
  foreach ($result['StandardFields']['Photos'] as $photo){
236
  $photos[] = array(
237
  'url' => $photo['UriThumb']
@@ -243,11 +243,35 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
243
  "@context" => "http://schema.org",
244
  "@type" => ["Product", "Apartment"],
245
  "name" => $result['StandardFields']['UnparsedFirstLineAddress'],
246
- "url" => $link_to_details,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  "offers" => array(
248
  "priceCurrency" => "USD",
249
  "price" => $result['StandardFields']['ListPrice'],
250
  "availability" => 'InStock',
 
 
251
  "seller" => array(
252
  array(
253
  "@type" => "RealEstateAgent",
205
  $sellerimage ='';
206
  $selleraddress ='';
207
  $sellertelephone ='';
208
+ $sellerpricerange ='';
209
 
210
  if(isset($sd_data['saswp_compativility']) && $sd_data['saswp_compativility']==1){
211
 
231
  $link_to_details_criteria = $this->search_criteria;
232
  $link_to_details = flexmlsConnect::make_nice_address_url($result['StandardFields'], $link_to_details_criteria, 'fmc_tag');
233
  $photos = array();
234
+ if(isset($result['StandardFields'])){
235
  foreach ($result['StandardFields']['Photos'] as $photo){
236
  $photos[] = array(
237
  'url' => $photo['UriThumb']
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'],
250
+ "url" => $link_to_details,
251
+ "aggregateRating" => array(
252
+ "@type"=> "AggregateRating",
253
+ "ratingValue" => '5.0',
254
+ "reviewCount" => '1'
255
+ ),
256
+ "review" => array(
257
+ '@type' => 'Review',
258
+ 'author' => get_the_author(),
259
+ 'datePublished' => $result['StandardFields']['ListingUpdateTimestamp'],
260
+ //'description' => '',
261
+ 'reviewRating' => array(
262
+ '@type' => 'Rating',
263
+ 'bestRating' => '5.0',
264
+ 'ratingValue' => '5.0',
265
+ 'worstRating' => '1.0',
266
+ )
267
+ ),
268
+ "image" => $result['StandardFields']['Photos'][0]['Uri300'],
269
  "offers" => array(
270
  "priceCurrency" => "USD",
271
  "price" => $result['StandardFields']['ListPrice'],
272
  "availability" => 'InStock',
273
+ "url" => $link_to_details,
274
+ "priceValidUntil"=> $result['StandardFields']['ListingUpdateTimestamp'],
275
  "seller" => array(
276
  array(
277
  "@type" => "RealEstateAgent",
output/function.php CHANGED
@@ -34,7 +34,7 @@ function saswp_data_generator() {
34
 
35
  $kb_schema_output = saswp_kb_schema_output();
36
 
37
- if( ( 1 == $sd_data['saswp-for-wordpress'] && saswp_non_amp() ) || ( 1 == $sd_data['saswp-for-amp'] && !saswp_non_amp() ) ) {
38
 
39
 
40
  if(!empty($contact_page_output)){
34
 
35
  $kb_schema_output = saswp_kb_schema_output();
36
 
37
+ if( ( saswp_remove_warnings($sd_data, 'saswp-for-wordpress', 'saswp_string') =='' || 1 == saswp_remove_warnings($sd_data, 'saswp-for-wordpress', 'saswp_string') && saswp_non_amp() ) || ( 1 == saswp_remove_warnings($sd_data, 'saswp-for-amp', 'saswp_string') && !saswp_non_amp() ) ) {
38
 
39
 
40
  if(!empty($contact_page_output)){
output/output.php CHANGED
@@ -2,7 +2,8 @@
2
  if (! defined('ABSPATH') ) exit;
3
 
4
  function saswp_kb_schema_output() {
5
- global $sd_data;
 
6
  // social profile
7
  $sd_social_profile = array();
8
 
@@ -66,12 +67,20 @@ function saswp_kb_schema_output() {
66
  // Organization Schema
67
 
68
 
69
- if ( $sd_data['saswp_kb_type'] == 'Organization' ) {
70
- $logo = $sd_data['sd_logo']['url'];
71
- $contact_1 = $sd_data['saswp_contact_type'];
72
- $telephone_1 = $sd_data['saswp_kb_telephone'];
73
- $height = $sd_data['sd_logo']['height'];
74
- $width = $sd_data['sd_logo']['width'];
 
 
 
 
 
 
 
 
75
 
76
  if( '' == $logo && empty($logo) && isset($sd_data['sd_default_image'])){
77
  $logo = $sd_data['sd_default_image']['url'];
@@ -106,8 +115,8 @@ function saswp_kb_schema_output() {
106
  $input = array(
107
  '@context' =>'http://schema.org',
108
  '@type' => $sd_data['saswp_kb_type'],
109
- 'name' => $sd_data['sd_name'],
110
- 'url' => $sd_data['sd_url'],
111
  'sameAs' => $platform,
112
  'logo' => array(
113
  '@type' => 'ImageObject',
@@ -123,10 +132,17 @@ function saswp_kb_schema_output() {
123
  }
124
  // Person
125
 
126
- if ( $sd_data['saswp_kb_type'] == 'Person' ) {
127
- $image = $sd_data['sd-person-image']['url'];
128
- $height = $sd_data['sd-person-image']['height'];
129
- $width = $sd_data['sd-person-image']['width'];
 
 
 
 
 
 
 
130
  if( '' == $image && empty($image) && isset($sd_data['sd_default_image'])){
131
  $image = $sd_data['sd_default_image']['url'];
132
  }
@@ -144,7 +160,7 @@ function saswp_kb_schema_output() {
144
  '@type' => $sd_data['saswp_kb_type'],
145
  'name' => $sd_data['sd-person-name'],
146
  'url' => $sd_data['sd-person-url'],
147
- 'Image' => array(
148
  '@type' => 'ImageObject',
149
  'url' => $image,
150
  'width' => $width,
@@ -177,8 +193,12 @@ function saswp_schema_output() {
177
  $site_name ='';
178
  $schema_options = $schemaConditionals['schema_options'];
179
  $schema_type = $schemaConditionals['schema_type'];
180
- $schema_post_id = $schemaConditionals['post_id'];
181
- $logo = $sd_data['sd_logo']['url'];
 
 
 
 
182
 
183
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
184
  $site_name = $sd_data['sd_name'];
@@ -293,7 +313,54 @@ function saswp_schema_output() {
293
  $input1['comment'] = saswp_get_comments(get_the_ID());
294
  }
295
 
296
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
 
298
  if( 'WebPage' === $schema_type){
299
 
@@ -460,24 +527,7 @@ function saswp_schema_output() {
460
  }
461
 
462
  if( 'Product' === $schema_type){
463
-
464
- $input1 = array(
465
- '@context' => 'http://schema.org',
466
- '@type' => $schema_type ,
467
- 'url' => get_permalink(),
468
- 'name' => get_the_title(),
469
- 'description' => get_the_excerpt(),
470
- );
471
- if(!empty($aggregateRating)){
472
- $input1['aggregateRating'] = $aggregateRating;
473
- }
474
- if(!empty($kkstar_aggregateRating)){
475
- $input1['aggregateRating'] = $kkstar_aggregateRating;
476
- }
477
- if(!empty($extra_theme_review)){
478
- $input1 = array_merge($input1, $extra_theme_review);
479
- }
480
-
481
  $service = new saswp_output_service();
482
  $product_details = $service->saswp_woocommerce_product_details(get_the_ID());
483
 
@@ -513,7 +563,7 @@ function saswp_schema_output() {
513
  if(isset($product_details['product_brand']) && $product_details['product_brand'] !=''){
514
  $input1['brand'] = array('@type'=>'Thing','name'=>$product_details['product_brand']);
515
  }
516
- if(isset($product_details['product_review_count']) && isset($product_details['product_average_rating'])){
517
  $input1['aggregateRating'] = array(
518
  '@type' => 'AggregateRating',
519
  'ratingValue' => $product_details['product_average_rating'],
@@ -538,6 +588,68 @@ function saswp_schema_output() {
538
  }
539
  $input1['review'] = $reviews;
540
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
541
  }
542
 
543
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
@@ -616,10 +728,10 @@ function saswp_schema_output() {
616
 
617
  $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_service_schema_details');
618
 
619
- $area_served_str = $schema_data['saswp_service_schema_area_served'];
620
  $area_served_arr = explode(',', $area_served_str);
621
 
622
- $service_offer_str = $schema_data['saswp_service_schema_service_offer'];
623
  $service_offer_arr = explode(',', $service_offer_str);
624
 
625
  $input1 = array(
@@ -629,8 +741,13 @@ function saswp_schema_output() {
629
  'serviceType' => saswp_remove_warnings($schema_data, 'saswp_service_schema_type', 'saswp_string'),
630
  'provider' => array(
631
  '@type' => saswp_remove_warnings($schema_data, 'saswp_service_schema_provider_type', 'saswp_string'),
632
- 'name' => saswp_remove_warnings($schema_data, 'saswp_service_schema_provider_name', 'saswp_string'),
633
- 'image' => $schema_data['saswp_service_schema_image']['url'],
 
 
 
 
 
634
  '@id' => get_permalink(),
635
  'address' => array(
636
  '@type' => 'PostalAddress',
@@ -666,7 +783,17 @@ function saswp_schema_output() {
666
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
667
  $service = new saswp_output_service();
668
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
669
- }
 
 
 
 
 
 
 
 
 
 
670
  if(!empty($aggregateRating)){
671
  $input1['aggregateRating'] = $aggregateRating;
672
  }
@@ -681,16 +808,26 @@ function saswp_schema_output() {
681
  if( 'Review' === $schema_type ){
682
 
683
  $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_review_schema_details');
 
 
 
 
684
 
685
  $input1 = array(
686
  '@context' => 'http://schema.org',
687
  '@type' => $schema_type ,
688
  'url' => get_permalink(),
689
- 'description' => saswp_remove_warnings($schema_data, 'saswp_review_schema_description', 'saswp_string'),
 
690
  'itemReviewed' => array(
691
  '@type' => saswp_remove_warnings($schema_data, 'saswp_review_schema_item_type', 'saswp_string'),
692
  'name' => saswp_remove_warnings($schema_data, 'saswp_review_schema_name', 'saswp_string'),
693
- 'image' => $schema_data['saswp_review_schema_image']['url'],
 
 
 
 
 
694
  'priceRange' => saswp_remove_warnings($schema_data, 'saswp_review_schema_price_range', 'saswp_string'),
695
  'address' => array(
696
  '@type' => 'PostalAddress',
@@ -706,13 +843,13 @@ function saswp_schema_output() {
706
  'dateModified' => $modified_date,
707
  'author' => array(
708
  '@type' => 'Person',
709
- 'name' => $aurthor_name,
710
- 'Image' => array(
711
- '@type' => 'ImageObject',
712
- 'url' => $author_details['url'],
713
- 'height' => $author_details['height'],
714
- 'width' => $author_details['width']
715
- ),
716
  ),
717
  'Publisher' => array(
718
  '@type' => 'Organization',
@@ -733,12 +870,15 @@ function saswp_schema_output() {
733
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
734
  }
735
 
736
- if(!empty($aggregateRating)){
737
- $input1['aggregateRating'] = $aggregateRating;
 
 
 
 
 
738
  }
739
- if(!empty($kkstar_aggregateRating)){
740
- $input1['aggregateRating'] = $kkstar_aggregateRating;
741
- }
742
  }
743
 
744
  if( 'VideoObject' === $schema_type){
@@ -844,7 +984,19 @@ function saswp_schema_output() {
844
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
845
  $service = new saswp_output_service();
846
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
847
- }
 
 
 
 
 
 
 
 
 
 
 
 
848
  if(!empty($aggregateRating)){
849
  $input1['aggregateRating'] = $aggregateRating;
850
  }
@@ -872,7 +1024,8 @@ function saswp_schema_output() {
872
  }
873
 
874
  //Check for Featured Image
875
- if( !empty($input1)){
 
876
 
877
  if( is_array($image_details) ){
878
  if(isset($image_details[1]) ){
@@ -886,10 +1039,10 @@ function saswp_schema_output() {
886
  '@type' =>'ImageObject',
887
  'url' =>$image_details[0],
888
  'width' =>$width,
889
- 'height' =>$height,
890
  ),
891
  );
892
- $input = array_merge($input1,$input2);
893
  }
894
  else{
895
  $input2 = array(
@@ -900,7 +1053,7 @@ function saswp_schema_output() {
900
  'height' => $height,
901
  ),
902
  );
903
- $input = array_merge($input1,$input2);
904
  }
905
 
906
  }
@@ -922,12 +1075,12 @@ function saswp_schema_output() {
922
  "cssSelector" => $paywall_class_name
923
  )
924
  );
925
- $input = array_merge($input,$paywallData);
926
  }
927
  }
928
 
929
- if(!empty($input)){
930
- $all_schema_output[] = $input;
931
  }
932
  }
933
  }
@@ -945,13 +1098,16 @@ function saswp_post_specific_schema_output() {
945
  )
946
  );
947
  $all_schema_output = array();
 
 
 
948
  foreach($all_schemas as $schema){
949
  $schema_id = $schema->ID;
950
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
951
  $schema_post_id = $post->ID;
952
  $all_post_meta = esc_sql ( get_post_meta($schema_post_id, $key='', true) );
953
 
954
- if(is_singular()){
955
 
956
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
957
  $aggregateRating = array();
@@ -1024,7 +1180,7 @@ function saswp_post_specific_schema_output() {
1024
  }
1025
  }
1026
 
1027
- if( 'Blogposting' === $schema_type){
1028
 
1029
  $logo = get_post_meta( get_the_ID(), 'saswp_blogposting_organization_logo_'.$schema_id.'_detail',true);
1030
  $input1 = array(
@@ -1063,6 +1219,35 @@ function saswp_post_specific_schema_output() {
1063
  $input1 = array_merge($input1, $extra_theme_review);
1064
  }
1065
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1066
 
1067
  if( 'WebPage' === $schema_type){
1068
  $logo = get_post_meta( get_the_ID(), 'saswp_webpage_organization_logo_'.$schema_id.'_detail',true);
@@ -1239,24 +1424,7 @@ function saswp_post_specific_schema_output() {
1239
  }
1240
 
1241
  if( 'Product' === $schema_type){
1242
-
1243
- $input1 = array(
1244
- '@context' => 'http://schema.org',
1245
- '@type' => $schema_type ,
1246
- 'url' => saswp_remove_warnings($all_post_meta, 'saswp_product_url_'.$schema_id, 'saswp_array'),
1247
- 'name' => saswp_remove_warnings($all_post_meta, 'saswp_product_name_'.$schema_id, 'saswp_array'),
1248
- 'description' => saswp_remove_warnings($all_post_meta, 'saswp_product_description_'.$schema_id, 'saswp_array'),
1249
-
1250
- );
1251
- if(!empty($aggregateRating)){
1252
- $input1['aggregateRating'] = $aggregateRating;
1253
- }
1254
- if(!empty($kkstar_aggregateRating)){
1255
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1256
- }
1257
- if(!empty($extra_theme_review)){
1258
- $input1 = array_merge($input1, $extra_theme_review);
1259
- }
1260
  $service = new saswp_output_service();
1261
  $product_details = $service->saswp_woocommerce_product_details($post->ID);
1262
  if((isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] ==1) && !empty($product_details)){
@@ -1290,7 +1458,7 @@ function saswp_post_specific_schema_output() {
1290
  if(isset($all_post_meta['saswp_product_brand_'.$schema_id])){
1291
  $input1['brand'] = array('@type'=>'Thing','name'=>$all_post_meta['saswp_product_brand_'.$schema_id][0]);
1292
  }
1293
- if(isset($product_details['product_review_count']) && isset($product_details['product_average_rating'])){
1294
  $input1['aggregateRating'] = array(
1295
  '@type' => 'AggregateRating',
1296
  'ratingValue' => $product_details['product_average_rating'],
@@ -1315,6 +1483,65 @@ function saswp_post_specific_schema_output() {
1315
  }
1316
  $input1['review'] = $reviews;
1317
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1318
  }
1319
  }
1320
 
@@ -1471,7 +1698,14 @@ function saswp_post_specific_schema_output() {
1471
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_name_'.$schema_id, 'saswp_array'),
1472
  'itemListElement' => $serviceOffer
1473
  );
1474
-
 
 
 
 
 
 
 
1475
  if(!empty($aggregateRating)){
1476
  $input1['aggregateRating'] = $aggregateRating;
1477
  }
@@ -1484,12 +1718,18 @@ function saswp_post_specific_schema_output() {
1484
  }
1485
 
1486
  if( 'Review' === $schema_type ){
1487
-
 
 
 
 
 
1488
  $input1 = array(
1489
  '@context' => 'http://schema.org',
1490
  '@type' => 'Review' ,
1491
  'url' => get_permalink(),
1492
- 'description' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_description_'.$schema_id, 'saswp_array'),
 
1493
  'itemReviewed' => array(
1494
  '@type' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_item_type_'.$schema_id, 'saswp_array'),
1495
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_name_'.$schema_id, 'saswp_array'),
@@ -1510,7 +1750,7 @@ function saswp_post_specific_schema_output() {
1510
  'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_date_modified_'.$schema_id, 'saswp_array'),
1511
  'author' => array(
1512
  '@type' => 'Person',
1513
- 'name' => get_the_author(),
1514
  ),
1515
  'Publisher' => array(
1516
  '@type' => 'Organization',
@@ -1526,13 +1766,15 @@ function saswp_post_specific_schema_output() {
1526
 
1527
  );
1528
 
1529
-
1530
- if(!empty($aggregateRating)){
1531
- $input1['aggregateRating'] = $aggregateRating;
1532
- }
1533
- if(!empty($kkstar_aggregateRating)){
1534
- $input1['aggregateRating'] = $kkstar_aggregateRating;
1535
- }
 
 
1536
  }
1537
 
1538
  if( 'local_business' === $schema_type){
@@ -1562,10 +1804,21 @@ function saswp_post_specific_schema_output() {
1562
  "addressRegion" => saswp_remove_warnings($all_post_meta, 'local_state_'.$schema_id, 'saswp_array'),
1563
  "postalCode" => saswp_remove_warnings($all_post_meta, 'local_postal_code_'.$schema_id, 'saswp_array'),
1564
  ),
1565
- 'telephone' => saswp_remove_warnings($all_post_meta, 'saswp_article_organization_name_'.$schema_id, 'saswp_array'),
1566
  'openingHours' => $operation_days,
1567
  );
1568
 
 
 
 
 
 
 
 
 
 
 
 
1569
  if(!empty($aggregateRating)){
1570
  $input1['aggregateRating'] = $aggregateRating;
1571
  }
@@ -1596,7 +1849,7 @@ function saswp_post_specific_schema_output() {
1596
  $image_details = wp_get_attachment_image_src($image_id, 'full');
1597
  global $sd_data;
1598
 
1599
- if(!empty($input1)){
1600
 
1601
  if( is_array($image_details) ){
1602
  if(isset($image_details[1]) ){
@@ -1613,7 +1866,7 @@ function saswp_post_specific_schema_output() {
1613
  'height' =>$height,
1614
  ),
1615
  );
1616
- $input = array_merge($input1,$input2);
1617
  }else{
1618
  $input2 = array(
1619
  'image' =>array(
@@ -1623,12 +1876,12 @@ function saswp_post_specific_schema_output() {
1623
  'height' => $sd_data['sd_logo']['height'],
1624
  ),
1625
  );
1626
- $input = array_merge($input1,$input2);
1627
  }
1628
 
1629
  }
1630
- if(!empty($input)){
1631
- $all_schema_output[] = $input;
1632
  }
1633
  }
1634
  }
@@ -1758,8 +2011,10 @@ function saswp_archive_output(){
1758
  $height ='';
1759
  $width ='';
1760
  $site_name ='';
1761
-
1762
- $logo = $sd_data['sd_logo']['url'];
 
 
1763
 
1764
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
1765
  $site_name = $sd_data['sd_name'];
@@ -1903,7 +2158,7 @@ function saswp_about_page_output()
1903
  if(isset($image_details['url'])){
1904
  $image_url = $image_details['url'];
1905
  }
1906
- $about_page = $sd_data['sd_about_page'];
1907
 
1908
  if((isset($sd_data['sd_about_page'])) && $sd_data['sd_about_page'] == get_the_ID()){
1909
  $logo = $sd_data['sd_logo']['url'];
@@ -1963,7 +2218,7 @@ function saswp_contact_page_output()
1963
  if(isset($image_details['url'])){
1964
  $image_url = $image_details['url'];
1965
  }
1966
- $contact_page = $sd_data['sd_contact_page'];
1967
  if(isset($sd_data['sd_contact_page']) && $sd_data['sd_contact_page'] == get_the_ID()){
1968
 
1969
  $logo = $sd_data['sd_logo']['url'];
2
  if (! defined('ABSPATH') ) exit;
3
 
4
  function saswp_kb_schema_output() {
5
+ global $sd_data;
6
+ $input = array();
7
  // social profile
8
  $sd_social_profile = array();
9
 
67
  // Organization Schema
68
 
69
 
70
+ if ( saswp_remove_warnings($sd_data, 'saswp_kb_type', 'saswp_string') == 'Organization' ) {
71
+ $logo ='';
72
+ $height ='';
73
+ $width ='';
74
+ if(isset($sd_data['sd_logo'])){
75
+ $logo = $sd_data['sd_logo']['url'];
76
+ }
77
+ $contact_1 = saswp_remove_warnings($sd_data, 'saswp_contact_type', 'saswp_string');
78
+ $telephone_1 = saswp_remove_warnings($sd_data, 'saswp_kb_telephone', 'saswp_string');
79
+
80
+ if(isset($sd_data['sd_logo'])){
81
+ $height = $sd_data['sd_logo']['height'];
82
+ $width = $sd_data['sd_logo']['width'];
83
+ }
84
 
85
  if( '' == $logo && empty($logo) && isset($sd_data['sd_default_image'])){
86
  $logo = $sd_data['sd_default_image']['url'];
115
  $input = array(
116
  '@context' =>'http://schema.org',
117
  '@type' => $sd_data['saswp_kb_type'],
118
+ 'name' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string'),
119
+ 'url' => saswp_remove_warnings($sd_data, 'sd_url', 'saswp_string'),
120
  'sameAs' => $platform,
121
  'logo' => array(
122
  '@type' => 'ImageObject',
132
  }
133
  // Person
134
 
135
+ if ( saswp_remove_warnings($sd_data, 'saswp_kb_type', 'saswp_string') == 'Person' ) {
136
+ $image ='';
137
+ $height ='';
138
+ $width ='';
139
+
140
+ if(isset($sd_data['sd-person-image'])){
141
+ $image = $sd_data['sd-person-image']['url'];
142
+ $height = $sd_data['sd-person-image']['height'];
143
+ $width = $sd_data['sd-person-image']['width'];
144
+ }
145
+
146
  if( '' == $image && empty($image) && isset($sd_data['sd_default_image'])){
147
  $image = $sd_data['sd_default_image']['url'];
148
  }
160
  '@type' => $sd_data['saswp_kb_type'],
161
  'name' => $sd_data['sd-person-name'],
162
  'url' => $sd_data['sd-person-url'],
163
+ 'image' => array(
164
  '@type' => 'ImageObject',
165
  'url' => $image,
166
  'width' => $width,
193
  $site_name ='';
194
  $schema_options = $schemaConditionals['schema_options'];
195
  $schema_type = $schemaConditionals['schema_type'];
196
+ $schema_post_id = $schemaConditionals['post_id'];
197
+
198
+ if(isset($sd_data['sd_logo'])){
199
+ $logo = $sd_data['sd_logo']['url'];
200
+ }
201
+
202
 
203
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
204
  $site_name = $sd_data['sd_name'];
313
  $input1['comment'] = saswp_get_comments(get_the_ID());
314
  }
315
 
316
+ }
317
+
318
+ if( 'AudioObject' === $schema_type){
319
+
320
+ $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_audio_schema_details');
321
+
322
+ $input1 = array(
323
+ '@context' => 'http://schema.org',
324
+ '@type' => $schema_type ,
325
+ 'name' => $schema_data['saswp_audio_schema_name'],
326
+ 'description' => $schema_data['saswp_audio_schema_description'],
327
+ 'contentUrl' => $schema_data['saswp_audio_schema_contenturl'],
328
+ 'duration' => $schema_data['saswp_audio_schema_duration'],
329
+ 'encodingFormat' => $schema_data['saswp_audio_schema_encoding_format'],
330
+ 'datePublished' => $date,
331
+ 'dateModified' => $modified_date,
332
+ 'author' => array(
333
+ '@type' => 'Person',
334
+ 'name' => $aurthor_name
335
+ ),
336
+ 'Publisher' => array(
337
+ '@type' => 'Organization',
338
+ 'logo' => array(
339
+ '@type' => 'ImageObject',
340
+ 'url' => $logo,
341
+ 'width' => $width,
342
+ 'height' => $height,
343
+ ),
344
+ 'name' => $site_name,
345
+ ),
346
+ );
347
+ if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
348
+ $service = new saswp_output_service();
349
+ $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
350
+ }
351
+ if(!empty($aggregateRating)){
352
+ $input1['aggregateRating'] = $aggregateRating;
353
+ }
354
+ if(!empty($kkstar_aggregateRating)){
355
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
356
+ }
357
+ if(!empty($extra_theme_review)){
358
+ $input1 = array_merge($input1, $extra_theme_review);
359
+ }
360
+ if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
361
+ $input1['comment'] = saswp_get_comments(get_the_ID());
362
+ }
363
+ }
364
 
365
  if( 'WebPage' === $schema_type){
366
 
527
  }
528
 
529
  if( 'Product' === $schema_type){
530
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  $service = new saswp_output_service();
532
  $product_details = $service->saswp_woocommerce_product_details(get_the_ID());
533
 
563
  if(isset($product_details['product_brand']) && $product_details['product_brand'] !=''){
564
  $input1['brand'] = array('@type'=>'Thing','name'=>$product_details['product_brand']);
565
  }
566
+ if(isset($product_details['product_review_count']) && $product_details['product_review_count'] >0 && isset($product_details['product_average_rating']) && $product_details['product_average_rating'] >0){
567
  $input1['aggregateRating'] = array(
568
  '@type' => 'AggregateRating',
569
  'ratingValue' => $product_details['product_average_rating'],
588
  }
589
  $input1['review'] = $reviews;
590
  }
591
+ }else{
592
+
593
+ $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_product_schema_details');
594
+
595
+ $input1 = array(
596
+ '@context' => 'http://schema.org',
597
+ '@type' => 'Product',
598
+ 'url' => get_permalink(),
599
+ 'name' => saswp_remove_warnings($schema_data, 'saswp_product_schema_name', 'saswp_string'),
600
+ 'sku' => saswp_remove_warnings($schema_data, 'saswp_product_schema_sku', 'saswp_string'),
601
+ 'description' => saswp_remove_warnings($schema_data, 'saswp_product_schema_description', 'saswp_string'),
602
+ 'image' =>array(
603
+ '@type' =>'ImageObject',
604
+ 'url' =>$schema_data['saswp_product_schema_image']['url'],
605
+ 'width' =>$schema_data['saswp_product_schema_image']['width'],
606
+ 'height' =>$schema_data['saswp_product_schema_image']['height'],
607
+ ),
608
+ 'offers' => array(
609
+ '@type' => 'Offer',
610
+ 'availability' => saswp_remove_warnings($schema_data, 'saswp_product_schema_availability', 'saswp_string'),
611
+ 'itemCondition'=> saswp_remove_warnings($schema_data, 'saswp_product_schema_condition', 'saswp_string'),
612
+ 'price' => saswp_remove_warnings($schema_data, 'saswp_product_schema_price', 'saswp_string'),
613
+ 'priceCurrency' => saswp_remove_warnings($schema_data, 'saswp_product_schema_currency', 'saswp_string'),
614
+ 'url' => get_permalink(),
615
+ 'priceValidUntil'=> saswp_remove_warnings($schema_data, 'saswp_product_schema_priceValidUntil', 'saswp_string'),
616
+ ),
617
+ 'brand' => array('@type'=>'Thing',
618
+ 'name'=>saswp_remove_warnings($schema_data, 'saswp_product_schema_brand_name', 'saswp_string'),
619
+ )
620
+ );
621
+
622
+
623
+ if(isset($schema_data['saswp_product_schema_gtin8']) && $schema_data['saswp_product_schema_gtin8'] !=''){
624
+ $input1['gtin8'] = $schema_data['saswp_product_schema_gtin8'];
625
+ }
626
+ if(isset($schema_data['saswp_product_schema_mpn']) && $schema_data['saswp_product_schema_mpn'] !=''){
627
+ $input1['mpn'] = $schema_data['saswp_product_schema_mpn'];
628
+ }
629
+ if(isset($schema_data['saswp_product_schema_isbn']) && $schema_data['saswp_product_schema_isbn'] !=''){
630
+ $input1['isbn'] = $schema_data['saswp_product_schema_isbn'];
631
+ }
632
+
633
+ if(isset($schema_data['saswp_product_schema_enable_rating'])){
634
+
635
+ $input1['aggregateRating'] = array(
636
+ "@type"=> "AggregateRating",
637
+ "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_product_schema_rating', 'saswp_string'),
638
+ "reviewCount" => saswp_remove_warnings($schema_data, 'saswp_product_schema_review_count', 'saswp_string')
639
+ );
640
+ }
641
+
642
+
643
+ if(!empty($aggregateRating)){
644
+ $input1['aggregateRating'] = $aggregateRating;
645
+ }
646
+ if(!empty($kkstar_aggregateRating)){
647
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
648
+ }
649
+ if(!empty($extra_theme_review)){
650
+ $input1 = array_merge($input1, $extra_theme_review);
651
+ }
652
+
653
  }
654
 
655
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
728
 
729
  $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_service_schema_details');
730
 
731
+ $area_served_str = saswp_remove_warnings($schema_data, 'saswp_service_schema_area_served', 'saswp_string');
732
  $area_served_arr = explode(',', $area_served_str);
733
 
734
+ $service_offer_str = saswp_remove_warnings($schema_data, 'saswp_service_schema_service_offer', 'saswp_string');
735
  $service_offer_arr = explode(',', $service_offer_str);
736
 
737
  $input1 = array(
741
  'serviceType' => saswp_remove_warnings($schema_data, 'saswp_service_schema_type', 'saswp_string'),
742
  'provider' => array(
743
  '@type' => saswp_remove_warnings($schema_data, 'saswp_service_schema_provider_type', 'saswp_string'),
744
+ 'name' => saswp_remove_warnings($schema_data, 'saswp_service_schema_provider_name', 'saswp_string'),
745
+ 'image' => array(
746
+ '@type' =>'ImageObject',
747
+ 'url' =>$schema_data['saswp_service_schema_image']['url'],
748
+ 'width' =>$schema_data['saswp_service_schema_image']['width'],
749
+ 'height' =>$schema_data['saswp_service_schema_image']['height'],
750
+ ),
751
  '@id' => get_permalink(),
752
  'address' => array(
753
  '@type' => 'PostalAddress',
783
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
784
  $service = new saswp_output_service();
785
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
786
+ }
787
+
788
+ if(isset($schema_data['saswp_service_schema_enable_rating'])){
789
+
790
+ $input1['aggregateRating'] = array(
791
+ "@type"=> "AggregateRating",
792
+ "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_service_schema_rating', 'saswp_string'),
793
+ "reviewCount" => saswp_remove_warnings($schema_data, 'saswp_service_schema_review_count', 'saswp_string')
794
+ );
795
+ }
796
+
797
  if(!empty($aggregateRating)){
798
  $input1['aggregateRating'] = $aggregateRating;
799
  }
808
  if( 'Review' === $schema_type ){
809
 
810
  $schema_data = saswp_get_schema_data($schema_post_id, 'saswp_review_schema_details');
811
+ $review_author = get_the_author();
812
+ if(isset($schema_data['saswp_review_schema_author'])){
813
+ $review_author = $schema_data['saswp_review_schema_author'];
814
+ }
815
 
816
  $input1 = array(
817
  '@context' => 'http://schema.org',
818
  '@type' => $schema_type ,
819
  'url' => get_permalink(),
820
+ 'description' => get_the_excerpt(),
821
+ 'reviewBody' => saswp_remove_warnings($schema_data, 'saswp_review_schema_description', 'saswp_string'),
822
  'itemReviewed' => array(
823
  '@type' => saswp_remove_warnings($schema_data, 'saswp_review_schema_item_type', 'saswp_string'),
824
  'name' => saswp_remove_warnings($schema_data, 'saswp_review_schema_name', 'saswp_string'),
825
+ 'image' => array(
826
+ '@type' =>'ImageObject',
827
+ 'url' =>$schema_data['saswp_review_schema_image']['url'],
828
+ 'width' =>$schema_data['saswp_review_schema_image']['width'],
829
+ 'height' =>$schema_data['saswp_review_schema_image']['height'],
830
+ ),
831
  'priceRange' => saswp_remove_warnings($schema_data, 'saswp_review_schema_price_range', 'saswp_string'),
832
  'address' => array(
833
  '@type' => 'PostalAddress',
843
  'dateModified' => $modified_date,
844
  'author' => array(
845
  '@type' => 'Person',
846
+ 'name' => $review_author,
847
+ // 'Image' => array(
848
+ // '@type' => 'ImageObject',
849
+ // 'url' => $author_details['url'],
850
+ // 'height' => $author_details['height'],
851
+ // 'width' => $author_details['width']
852
+ // ),
853
  ),
854
  'Publisher' => array(
855
  '@type' => 'Organization',
870
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
871
  }
872
 
873
+ if(isset($schema_data['saswp_review_schema_enable_rating'])){
874
+
875
+ $input1['reviewRating'] = array(
876
+ "@type"=> "Rating",
877
+ "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_review_schema_rating', 'saswp_string'),
878
+ "bestRating" => saswp_remove_warnings($schema_data, 'saswp_review_schema_review_count', 'saswp_string')
879
+ );
880
  }
881
+
 
 
882
  }
883
 
884
  if( 'VideoObject' === $schema_type){
984
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
985
  $service = new saswp_output_service();
986
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
987
+ }
988
+
989
+
990
+ if(isset($business_details['local_enable_rating'])){
991
+
992
+ $input1['aggregateRating'] = array(
993
+ "@type"=> "AggregateRating",
994
+ "ratingValue" => saswp_remove_warnings($business_details, 'local_rating', 'saswp_string'),
995
+ "reviewCount" => saswp_remove_warnings($business_details, 'local_review_count', 'saswp_string')
996
+ );
997
+ }
998
+
999
+
1000
  if(!empty($aggregateRating)){
1001
  $input1['aggregateRating'] = $aggregateRating;
1002
  }
1024
  }
1025
 
1026
  //Check for Featured Image
1027
+
1028
+ if( !empty($input1) && !isset($input1['image'])){
1029
 
1030
  if( is_array($image_details) ){
1031
  if(isset($image_details[1]) ){
1039
  '@type' =>'ImageObject',
1040
  'url' =>$image_details[0],
1041
  'width' =>$width,
1042
+ 'height' =>$height,
1043
  ),
1044
  );
1045
+ $input1 = array_merge($input1,$input2);
1046
  }
1047
  else{
1048
  $input2 = array(
1053
  'height' => $height,
1054
  ),
1055
  );
1056
+ $input1 = array_merge($input1,$input2);
1057
  }
1058
 
1059
  }
1075
  "cssSelector" => $paywall_class_name
1076
  )
1077
  );
1078
+ $input1 = array_merge($input1,$paywallData);
1079
  }
1080
  }
1081
 
1082
+ if(!empty($input1)){
1083
+ $all_schema_output[] = $input1;
1084
  }
1085
  }
1086
  }
1098
  )
1099
  );
1100
  $all_schema_output = array();
1101
+
1102
+ $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
1103
+
1104
  foreach($all_schemas as $schema){
1105
  $schema_id = $schema->ID;
1106
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
1107
  $schema_post_id = $post->ID;
1108
  $all_post_meta = esc_sql ( get_post_meta($schema_post_id, $key='', true) );
1109
 
1110
+ if(is_singular() && isset($schema_enable[$schema_id]) && $schema_enable[$schema_id] == 1 ){
1111
 
1112
  $saswp_review_details = esc_sql ( get_post_meta(get_the_ID(), 'saswp_review_details', true));
1113
  $aggregateRating = array();
1180
  }
1181
  }
1182
 
1183
+ if( 'Blogposting' === $schema_type){
1184
 
1185
  $logo = get_post_meta( get_the_ID(), 'saswp_blogposting_organization_logo_'.$schema_id.'_detail',true);
1186
  $input1 = array(
1219
  $input1 = array_merge($input1, $extra_theme_review);
1220
  }
1221
  }
1222
+
1223
+ if( 'AudioObject' === $schema_type){
1224
+
1225
+ $input1 = array(
1226
+ '@context' => 'http://schema.org',
1227
+ '@type' => $schema_type,
1228
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_name_'.$schema_id, 'saswp_array'),
1229
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_description_'.$schema_id, 'saswp_array'),
1230
+ 'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1231
+ 'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1232
+ 'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1233
+ 'datePublished' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_published_'.$schema_id, 'saswp_array'),
1234
+ 'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_modified_'.$schema_id, 'saswp_array'),
1235
+ 'author' => array(
1236
+ '@type' => 'Person',
1237
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array')
1238
+ ),
1239
+
1240
+ );
1241
+ if(!empty($aggregateRating)){
1242
+ $input1['aggregateRating'] = $aggregateRating;
1243
+ }
1244
+ if(!empty($kkstar_aggregateRating)){
1245
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
1246
+ }
1247
+ if(!empty($extra_theme_review)){
1248
+ $input1 = array_merge($input1, $extra_theme_review);
1249
+ }
1250
+ }
1251
 
1252
  if( 'WebPage' === $schema_type){
1253
  $logo = get_post_meta( get_the_ID(), 'saswp_webpage_organization_logo_'.$schema_id.'_detail',true);
1424
  }
1425
 
1426
  if( 'Product' === $schema_type){
1427
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1428
  $service = new saswp_output_service();
1429
  $product_details = $service->saswp_woocommerce_product_details($post->ID);
1430
  if((isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] ==1) && !empty($product_details)){
1458
  if(isset($all_post_meta['saswp_product_brand_'.$schema_id])){
1459
  $input1['brand'] = array('@type'=>'Thing','name'=>$all_post_meta['saswp_product_brand_'.$schema_id][0]);
1460
  }
1461
+ if(isset($product_details['product_review_count']) && $product_details['product_review_count'] >0 && isset($product_details['product_average_rating']) && $product_details['product_average_rating'] > 0){
1462
  $input1['aggregateRating'] = array(
1463
  '@type' => 'AggregateRating',
1464
  'ratingValue' => $product_details['product_average_rating'],
1483
  }
1484
  $input1['review'] = $reviews;
1485
  }
1486
+ }else{
1487
+ $product_image = get_post_meta( get_the_ID(), 'saswp_product_schema_image_'.$schema_id.'_detail',true);
1488
+ $input1 = array(
1489
+ '@context' => 'http://schema.org',
1490
+ '@type' => 'Product',
1491
+ 'url' => get_permalink(),
1492
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_name_'.$schema_id, 'saswp_array'),
1493
+ 'sku' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_sku_'.$schema_id, 'saswp_array'),
1494
+ 'description' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_description_'.$schema_id, 'saswp_array'),
1495
+ 'image' =>array(
1496
+ '@type' =>'ImageObject',
1497
+ 'url' =>saswp_remove_warnings($product_image, 'thumbnail', 'saswp_string'),
1498
+ 'width' =>saswp_remove_warnings($product_image, 'width', 'saswp_string'),
1499
+ 'height' =>saswp_remove_warnings($product_image, 'height', 'saswp_string'),
1500
+ ),
1501
+ 'offers' => array(
1502
+ '@type' => 'Offer',
1503
+ 'availability' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_availability_'.$schema_id, 'saswp_array'),
1504
+ 'itemCondition'=> saswp_remove_warnings($all_post_meta, 'saswp_product_schema_condition_'.$schema_id, 'saswp_array'),
1505
+ 'price' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_price_'.$schema_id, 'saswp_array'),
1506
+ 'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_currency_'.$schema_id, 'saswp_array'),
1507
+ 'url' => get_permalink(),
1508
+ 'priceValidUntil'=> saswp_remove_warnings($all_post_meta, 'saswp_product_schema_priceValidUntil_'.$schema_id, 'saswp_array'),
1509
+ ),
1510
+ 'brand' => array('@type'=>'Thing',
1511
+ 'name'=>saswp_remove_warnings($all_post_meta, 'saswp_product_schema_brand_name_'.$schema_id, 'saswp_array'),
1512
+ )
1513
+ );
1514
+
1515
+ if(isset($all_post_meta['saswp_product_schema_gtin8_'.$schema_id])){
1516
+ $input1['gtin8'] = $all_post_meta['saswp_product_schema_gtin8_'.$schema_id][0];
1517
+ }
1518
+ if(isset($all_post_meta['saswp_product_schema_mpn_'.$schema_id])){
1519
+ $input1['mpn'] = $all_post_meta['saswp_product_schema_mpn_'.$schema_id][0];
1520
+ }
1521
+ if(isset($all_post_meta['saswp_product_schema_isbn_'.$schema_id])){
1522
+ $input1['isbn'] = $all_post_meta['saswp_product_schema_isbn_'.$schema_id][0];
1523
+ }
1524
+
1525
+ if(saswp_remove_warnings($all_post_meta, 'saswp_product_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
1526
+
1527
+ $input1['aggregateRating'] = array(
1528
+ "@type"=> "AggregateRating",
1529
+ "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_rating_'.$schema_id, 'saswp_array'),
1530
+ "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_review_count_'.$schema_id, 'saswp_array')
1531
+ );
1532
+ }
1533
+
1534
+
1535
+ if(!empty($aggregateRating)){
1536
+ $input1['aggregateRating'] = $aggregateRating;
1537
+ }
1538
+ if(!empty($kkstar_aggregateRating)){
1539
+ $input1['aggregateRating'] = $kkstar_aggregateRating;
1540
+ }
1541
+ if(!empty($extra_theme_review)){
1542
+ $input1 = array_merge($input1, $extra_theme_review);
1543
+ }
1544
+
1545
  }
1546
  }
1547
 
1698
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_name_'.$schema_id, 'saswp_array'),
1699
  'itemListElement' => $serviceOffer
1700
  );
1701
+
1702
+ if(saswp_remove_warnings($all_post_meta, 'saswp_service_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
1703
+ $input1['aggregateRating'] = array(
1704
+ "@type"=> "AggregateRating",
1705
+ "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_rating_'.$schema_id, 'saswp_array'),
1706
+ "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_review_count_'.$schema_id, 'saswp_array')
1707
+ );
1708
+ }
1709
  if(!empty($aggregateRating)){
1710
  $input1['aggregateRating'] = $aggregateRating;
1711
  }
1718
  }
1719
 
1720
  if( 'Review' === $schema_type ){
1721
+ $review_author = get_the_author();
1722
+
1723
+ if(isset($all_post_meta['saswp_review_schema_author_'.$schema_id])){
1724
+ $review_author = $all_post_meta['saswp_review_schema_author_'.$schema_id][0];
1725
+ }
1726
+
1727
  $input1 = array(
1728
  '@context' => 'http://schema.org',
1729
  '@type' => 'Review' ,
1730
  'url' => get_permalink(),
1731
+ 'description' => get_the_excerpt(),
1732
+ 'reviewBody' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_description_'.$schema_id, 'saswp_array'),
1733
  'itemReviewed' => array(
1734
  '@type' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_item_type_'.$schema_id, 'saswp_array'),
1735
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_name_'.$schema_id, 'saswp_array'),
1750
  'dateModified' => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_date_modified_'.$schema_id, 'saswp_array'),
1751
  'author' => array(
1752
  '@type' => 'Person',
1753
+ 'name' => $review_author,
1754
  ),
1755
  'Publisher' => array(
1756
  '@type' => 'Organization',
1766
 
1767
  );
1768
 
1769
+ if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
1770
+
1771
+ $input1['reviewRating'] = array(
1772
+ "@type"=> "Rating",
1773
+ "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_rating_'.$schema_id, 'saswp_array'),
1774
+ "bestRating" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_review_count_'.$schema_id, 'saswp_array')
1775
+ );
1776
+ }
1777
+
1778
  }
1779
 
1780
  if( 'local_business' === $schema_type){
1804
  "addressRegion" => saswp_remove_warnings($all_post_meta, 'local_state_'.$schema_id, 'saswp_array'),
1805
  "postalCode" => saswp_remove_warnings($all_post_meta, 'local_postal_code_'.$schema_id, 'saswp_array'),
1806
  ),
1807
+ 'telephone' => saswp_remove_warnings($all_post_meta, 'local_phone_'.$schema_id, 'saswp_array'),
1808
  'openingHours' => $operation_days,
1809
  );
1810
 
1811
+
1812
+
1813
+ if(isset($all_post_meta['local_enable_rating_'.$schema_id])){
1814
+
1815
+ $input1['aggregateRating'] = array(
1816
+ "@type"=> "AggregateRating",
1817
+ "ratingValue" => saswp_remove_warnings($all_post_meta, 'local_rating_'.$schema_id, 'saswp_array'),
1818
+ "reviewCount" => saswp_remove_warnings($all_post_meta, 'local_review_count_'.$schema_id, 'saswp_array')
1819
+ );
1820
+ }
1821
+
1822
  if(!empty($aggregateRating)){
1823
  $input1['aggregateRating'] = $aggregateRating;
1824
  }
1849
  $image_details = wp_get_attachment_image_src($image_id, 'full');
1850
  global $sd_data;
1851
 
1852
+ if(!empty($input1) && !isset($input1['image'])){
1853
 
1854
  if( is_array($image_details) ){
1855
  if(isset($image_details[1]) ){
1866
  'height' =>$height,
1867
  ),
1868
  );
1869
+ $input1 = array_merge($input1,$input2);
1870
  }else{
1871
  $input2 = array(
1872
  'image' =>array(
1876
  'height' => $sd_data['sd_logo']['height'],
1877
  ),
1878
  );
1879
+ $input1 = array_merge($input1,$input2);
1880
  }
1881
 
1882
  }
1883
+ if(!empty($input1)){
1884
+ $all_schema_output[] = $input1;
1885
  }
1886
  }
1887
  }
2011
  $height ='';
2012
  $width ='';
2013
  $site_name ='';
2014
+
2015
+ if(isset($sd_data['sd_logo'])){
2016
+ $logo = $sd_data['sd_logo']['url'];
2017
+ }
2018
 
2019
  if(isset($sd_data['sd_name']) && $sd_data['sd_name'] !=''){
2020
  $site_name = $sd_data['sd_name'];
2158
  if(isset($image_details['url'])){
2159
  $image_url = $image_details['url'];
2160
  }
2161
+ $about_page = saswp_remove_warnings($sd_data, 'sd_about_page', 'saswp_string');
2162
 
2163
  if((isset($sd_data['sd_about_page'])) && $sd_data['sd_about_page'] == get_the_ID()){
2164
  $logo = $sd_data['sd_logo']['url'];
2218
  if(isset($image_details['url'])){
2219
  $image_url = $image_details['url'];
2220
  }
2221
+ $contact_page = saswp_remove_warnings($sd_data, 'sd_contact_page', 'saswp_string');
2222
  if(isset($sd_data['sd_contact_page']) && $sd_data['sd_contact_page'] == get_the_ID()){
2223
 
2224
  $logo = $sd_data['sd_logo']['url'];
output/review-output.php CHANGED
@@ -151,8 +151,12 @@ Class saswp_review_output{
151
  $saswp_review_item_enable = 0;
152
  if(isset($saswp_review_details['saswp-review-item-enable'])){
153
  $saswp_review_item_enable = $saswp_review_details['saswp-review-item-enable'];
154
- }
155
- if($sd_data['saswp-review-module']==0 || $saswp_review_item_enable ==0){
 
 
 
 
156
  return $content;
157
  }
158
  $result = $this->saswp_get_review_box_content();
151
  $saswp_review_item_enable = 0;
152
  if(isset($saswp_review_details['saswp-review-item-enable'])){
153
  $saswp_review_item_enable = $saswp_review_details['saswp-review-item-enable'];
154
+ }
155
+ $review_module = 0;
156
+ if(isset($sd_data['saswp-review-module'])){
157
+ $review_module = $sd_data['saswp-review-module'];
158
+ }
159
+ if($review_module==0 || $saswp_review_item_enable ==0){
160
  return $content;
161
  }
162
  $result = $this->saswp_get_review_box_content();
output/service.php CHANGED
@@ -105,6 +105,36 @@ Class saswp_output_service{
105
  }
106
 
107
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
 
109
  case 'NewsArticle':
110
 
@@ -1010,6 +1040,22 @@ Class saswp_output_service{
1010
 
1011
  break;
1012
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1013
  case 'qanda':
1014
  $meta_field = array(
1015
 
105
  }
106
 
107
  break;
108
+
109
+ case 'AudioObject':
110
+
111
+ if(isset($custom_fields['saswp_audio_schema_name'])){
112
+ $input1['name'] = $custom_fields['saswp_audio_schema_name'];
113
+ }
114
+ if(isset($custom_fields['saswp_audio_schema_description'])){
115
+ $input1['description'] = $custom_fields['saswp_audio_schema_description'];
116
+ }
117
+ if(isset($custom_fields['saswp_audio_schema_contenturl'])){
118
+ $input1['contentUrl'] = $custom_fields['saswp_audio_schema_contenturl'];
119
+ }
120
+ if(isset($custom_fields['saswp_audio_schema_duration'])){
121
+ $input1['duration'] = $custom_fields['saswp_audio_schema_duration'];
122
+ }
123
+ if(isset($custom_fields['saswp_audio_schema_encoding_format'])){
124
+ $input1['encodingFormat'] = $custom_fields['saswp_audio_schema_encoding_format'];
125
+ }
126
+
127
+ if(isset($custom_fields['saswp_audio_schema_date_published'])){
128
+ $input1['datePublished'] = $custom_fields['saswp_audio_schema_date_published'];
129
+ }
130
+ if(isset($custom_fields['saswp_audio_schema_date_modified'])){
131
+ $input1['dateModified'] = $custom_fields['saswp_audio_schema_date_modified'];
132
+ }
133
+ if(isset($custom_fields['saswp_audio_schema_author_name'])){
134
+ $input1['author']['name'] = $custom_fields['saswp_audio_author_name'];
135
+ }
136
+
137
+ break;
138
 
139
  case 'NewsArticle':
140
 
1040
 
1041
  break;
1042
 
1043
+ case 'AudioObject':
1044
+
1045
+ $meta_field = array(
1046
+
1047
+ 'saswp_audio_schema_name' => 'Name',
1048
+ 'saswp_audio_schema_description' => 'Description',
1049
+ 'saswp_audio_schema_contenturl' => 'Content Url',
1050
+ 'saswp_audio_schema_duration' => 'Duration',
1051
+ 'saswp_audio_schema_encoding_format' => 'Encoding Format',
1052
+ 'saswp_audio_schema_date_published' => 'Date Published',
1053
+ 'saswp_audio_schema_date_modified' => 'Date Modified',
1054
+ 'saswp_audio_schema_author_name' => 'Author',
1055
+ );
1056
+
1057
+ break;
1058
+
1059
  case 'qanda':
1060
  $meta_field = array(
1061
 
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.1
6
- Stable tag: 1.0.6.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -65,6 +65,28 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
65
 
66
  == Changelog ==
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  = 1.0.6.1 (22 December 2018) =
69
 
70
  * Bug Fixed: Errors with WP5.2 #107
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.0.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.0.7 (31 December 2018) =
69
+
70
+ * New Feature: AudioObject schema type add to the schema type list #115
71
+ * New Feature: Option to reset plugin's settings #104
72
+ * New Feature: Fields to enter Aggregate Rating below schema type #95
73
+ * New Feature: SEO Pressor plugin importer #93
74
+ * Improvement: Changed default "Homepage" to site name in Breadcrumbs. #87
75
+ * Improvement: Product fields have been added when selecting product schema type #94
76
+ * Improvement: Added provider type in service schema #103
77
+ * Improvement: On/Off button has been added to post specific schema list #99
78
+ * Improvement: List of compatible plugins should always be shown in compatibility tab #102
79
+ * Improvement: Inside review schema type, item reviewed should be in dropdown #97
80
+ * Improvement: Moved FlexMLS IDX compatibilty from tool tab to compatibility tab #112
81
+ * Improvement: Properly prepared for localization to make plugin translatable #105
82
+ * Bug Fixed: Modify Schema : - In Local Business schema type phone number is not being added in schema markup output #114
83
+ * Bug Fixed: Local Business -> Food Establishment -> Bakery is buggy #111
84
+ * Bug Fixed: select 2 conflicts with avada theme #92
85
+ * Bug Fixed: warning issues on product/apartment schema #88
86
+
87
+
88
+ * Bug Fixed: Other bug fixed
89
+
90
  = 1.0.6.1 (22 December 2018) =
91
 
92
  * Bug Fixed: Errors with WP5.2 #107
structured-data-for-wp.php CHANGED
@@ -2,8 +2,9 @@
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.0.6.1
6
  Text Domain: schema-and-structured-data-for-wp
 
7
  Author: Mohammed Kaludi, Ahmed Kaludi
8
  Author URI: http://structured-data-for-wp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -12,7 +13,7 @@ License: GPL2
12
  // Exit if accessed directly.
13
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
- define('SASWP_VERSION', '1.0.6.1');
16
  define('SASWP_DIR_NAME_FILE', __FILE__ );
17
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
18
  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.0.7
6
  Text Domain: schema-and-structured-data-for-wp
7
+ Domain Path: /languages
8
  Author: Mohammed Kaludi, Ahmed Kaludi
9
  Author URI: http://structured-data-for-wp.com/
10
  Donate link: https://www.paypal.me/Kaludi/25
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.0.7');
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
@@ -18,7 +18,30 @@ class saswp_post_specific {
18
  add_action( 'wp_ajax_saswp_modify_schema_post_enable', array($this,'saswp_modify_schema_post_enable'));
19
 
20
  add_action( 'wp_ajax_saswp_restore_schema', array($this,'saswp_restore_schema'));
 
 
21
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  public function saswp_get_all_schema_list(){
23
 
24
  if($this->all_schema == null){
@@ -71,18 +94,36 @@ class saswp_post_specific {
71
  $tabs = '';
72
  $tabs_fields = '';
73
  $schema_ids = array();
 
 
 
74
  if(count($this->all_schema)>1){
75
  foreach($this->all_schema as $key => $schema){
 
 
 
 
 
76
  $response = $this->saswp_get_fields_by_schema_type($schema->ID);
77
  $this->meta_fields = $response;
78
- $output = $this->saswp_saswp_post_specific( $post, $schema->ID );
 
79
  if($key==0){
80
- $tabs .='<li><a data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links selected">'.esc_attr($schema->post_title).'</a></li>';
 
 
 
 
81
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper">';
82
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
83
  $tabs_fields .= '</div>';
84
  }else{
85
- $tabs .='<li><a data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links">'.esc_attr($schema->post_title).'</a></li>';
 
 
 
 
 
86
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper saswp_hide">';
87
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
88
  $tabs_fields .= '</div>';
@@ -105,16 +146,25 @@ class saswp_post_specific {
105
  echo '</div>';
106
 
107
  }else{
108
-
109
  $all_schema = $this->all_schema;
110
  $response = $this->saswp_get_fields_by_schema_type($all_schema[0]->ID);
111
 
112
  $schema_ids[] =$all_schema[0]->ID;
 
 
 
 
 
113
 
114
  $this->meta_fields = $response;
115
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
116
  $tabs_fields .= '<div>';
117
- $tabs_fields .= '<div><a href="#" class="saswp-restore-post-schema button">'.esc_html__( 'Restore Default Schema', 'schema-and-structured-data-for-wp' ).'</a></div>';
 
 
 
 
118
  $tabs_fields .= '<div id="saswp_specific_'.esc_attr($all_schema[0]->ID).'" class="saswp-post-specific-wrapper">';
119
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
120
  $tabs_fields .= '</div>';
@@ -192,7 +242,11 @@ class saswp_post_specific {
192
  $image_id = get_post_thumbnail_id();
193
  $image_details = wp_get_attachment_image_src($image_id, 'full');
194
  if(empty($image_details[0]) || $image_details[0] === NULL ){
195
- $image_details[0] = $sd_data['sd_logo']['url'];
 
 
 
 
196
  }
197
  $current_user = wp_get_current_user();
198
  $author_details = get_avatar_data($current_user->ID);
@@ -229,10 +283,13 @@ class saswp_post_specific {
229
  $media_value['thumbnail'] = $author_details['url'];
230
  }
231
  if (strpos($meta_field['id'], 'organization_logo') !== false && empty($media_value_meta)) {
232
-
233
- $media_value['height'] = $sd_data['sd_logo']['height'];
234
- $media_value['width'] = $sd_data['sd_logo']['width'];
235
- $media_value['thumbnail'] = $sd_data['sd_logo']['url'];
 
 
 
236
  }
237
  if (strpos($meta_field['id'], 'business_logo') !== false && empty($media_value_meta)) {
238
 
@@ -241,6 +298,30 @@ class saswp_post_specific {
241
  $media_value['width'] = $business_details['local_business_logo']['width'];
242
  $media_value['thumbnail'] = $business_details['local_business_logo']['url'];
243
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
  $media_height ='';
246
  $media_width ='';
@@ -318,6 +399,21 @@ class saswp_post_specific {
318
  $input .= '</select>';
319
  break;
320
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  case 'multiselect':
322
  $input = sprintf(
323
  '<select multiple id="%s" name="%s[]">',
@@ -360,7 +456,16 @@ class saswp_post_specific {
360
  if (strpos($meta_field['id'], 'closes_time') !== false || strpos($meta_field['id'], 'opens_time') !== false){
361
  $class='saswp-local-schema-time-picker';
362
  }
363
- if (strpos($meta_field['id'], 'date_modified') !== false || strpos($meta_field['id'], 'date_published') !== false || strpos($meta_field['id'], 'video_upload_date') !== false|| strpos($meta_field['id'], 'qa_date_created') !== false || strpos($meta_field['id'], 'accepted_answer_date_created') !== false || strpos($meta_field['id'], 'suggested_answer_date_created') !== false || strpos($meta_field['id'], 'priceValidUntil') !== false) {
 
 
 
 
 
 
 
 
 
364
  $class='saswp-local-schema-datepicker-picker';
365
  }
366
 
@@ -382,7 +487,25 @@ class saswp_post_specific {
382
  default:
383
 
384
  }
385
- $output .= '<tr><th>'.$label.'</th><td>'.$input.'</td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
386
  }
387
  return $output;
388
  }
@@ -610,7 +733,10 @@ class saswp_post_specific {
610
  $image_id = get_post_thumbnail_id();
611
  $image_details = wp_get_attachment_image_src($image_id, 'full');
612
  if(empty($image_details[0]) || $image_details[0] === NULL ){
613
- $image_details[0] = $sd_data['sd_logo']['url'];
 
 
 
614
  }
615
  $current_user = wp_get_current_user();
616
  $author_details = get_avatar_data($current_user->ID);
@@ -794,6 +920,24 @@ class saswp_post_specific {
794
  'type' => 'text',
795
  'default' => $business_details['local_price_range']
796
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  );
798
 
799
  break;
@@ -852,13 +996,13 @@ class saswp_post_specific {
852
  'label' => 'Organization Name',
853
  'id' => 'saswp_blogposting_organization_name_'.$schema_id,
854
  'type' => 'text',
855
- 'default' => $sd_data['sd_name']
856
- ),
857
  array(
858
  'label' => 'Organization Logo',
859
  'id' => 'saswp_blogposting_organization_logo_'.$schema_id,
860
  'type' => 'media',
861
- 'default' => $sd_data['sd_logo']['url']
862
  )
863
  );
864
  break;
@@ -961,19 +1105,19 @@ class saswp_post_specific {
961
  'label' => 'Author Image',
962
  'id' => 'saswp_newsarticle_author_image_'.$schema_id,
963
  'type' => 'media',
964
- 'default' => $author_details['url']
965
  ),
966
  array(
967
  'label' => 'Organization Name',
968
  'id' => 'saswp_newsarticle_organization_name_'.$schema_id,
969
  'type' => 'text',
970
- 'default'=>$sd_data['sd_name']
971
  ),
972
  array(
973
  'label' => 'Organization Logo',
974
  'id' => 'saswp_newsarticle_organization_logo_'.$schema_id,
975
  'type' => 'media',
976
- 'default' => $sd_data['sd_logo']['url']
977
  ),
978
  );
979
  break;
@@ -1039,13 +1183,13 @@ class saswp_post_specific {
1039
  'label' => 'Organization Name',
1040
  'id' => 'saswp_webpage_organization_name_'.$schema_id,
1041
  'type' => 'text',
1042
- 'default' => $sd_data['sd_name']
1043
  ),
1044
  array(
1045
  'label' => 'Organization Logo',
1046
  'id' => 'saswp_webpage_organization_logo_'.$schema_id,
1047
  'type' => 'media',
1048
- 'default' => $sd_data['sd_logo']['url']
1049
  ),
1050
  );
1051
  break;
@@ -1098,13 +1242,13 @@ class saswp_post_specific {
1098
  'label' => 'Organization Name',
1099
  'id' => 'saswp_article_organization_name_'.$schema_id,
1100
  'type' => 'text',
1101
- 'default' => $sd_data['sd_name']
1102
  ),
1103
  array(
1104
  'label' => 'Organization Logo',
1105
  'id' => 'saswp_article_organization_logo_'.$schema_id,
1106
  'type' => 'media',
1107
- 'default' => $sd_data['sd_logo']['url']
1108
  )
1109
  );
1110
  break;
@@ -1163,7 +1307,7 @@ class saswp_post_specific {
1163
  'label' => 'Organization Name',
1164
  'id' => 'saswp_recipe_organization_name_'.$schema_id,
1165
  'type' => 'text',
1166
- 'default' => $sd_data['sd_name']
1167
  ),
1168
  array(
1169
  'label' => 'Organization Logo',
@@ -1310,97 +1454,125 @@ class saswp_post_specific {
1310
  );
1311
  break;
1312
 
1313
- case 'Product':
1314
-
1315
-
1316
-
1317
-
1318
  $meta_field = array(
1319
- array(
1320
- 'label' => 'URL',
1321
- 'id' => 'saswp_product_url_'.$schema_id,
1322
- 'type' => 'text',
1323
- 'default' => get_permalink()
1324
- ),
1325
  array(
1326
  'label' => 'Name',
1327
- 'id' => 'saswp_product_name_'.$schema_id,
1328
  'type' => 'text',
1329
- 'default' => get_the_title(),
1330
  ),
1331
  array(
1332
  'label' => 'Description',
1333
- 'id' => 'saswp_product_description_'.$schema_id,
1334
  'type' => 'textarea',
1335
- 'default' => $post->post_excerpt
1336
- ),
1337
- );
1338
-
1339
- if(get_post_type() == 'product'){
1340
-
1341
- $meta_field[] = array(
1342
  'label' => 'Image',
1343
- 'id' => 'saswp_product_image_'.$schema_id,
1344
  'type' => 'media',
1345
- 'default' => ''
1346
- );
1347
- $meta_field[] = array(
1348
- 'label' => 'Availability',
1349
- 'id' => 'saswp_product_availability_'.$schema_id,
1350
- 'type' => 'text',
1351
- 'default' => ''
1352
- );
1353
- $meta_field[] = array(
1354
  'label' => 'Price',
1355
- 'id' => 'saswp_product_price_'.$schema_id,
1356
  'type' => 'text',
1357
- 'default' => ''
1358
- );
1359
- $meta_field[] = array(
1360
- 'label' => 'Price Currency',
1361
- 'id' => 'saswp_product_currency_'.$schema_id,
1362
- 'type' => 'text',
1363
- 'default' => ''
1364
- );
1365
- $meta_field[] = array(
1366
- 'label' => 'SKU',
1367
- 'id' => 'saswp_product_sku_'.$schema_id,
1368
  'type' => 'text',
1369
- 'default' => ''
1370
- );
1371
- $meta_field[] = array(
1372
- 'label' => 'Brand',
1373
- 'id' => 'saswp_product_brand_'.$schema_id,
1374
  'type' => 'text',
1375
- 'default' => ''
1376
- );
1377
- $meta_field[] = array(
1378
- 'label' => 'Price Valid Until',
1379
- 'id' => 'saswp_product_priceValidUntil_'.$schema_id,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1380
  'type' => 'text',
1381
- 'default' => ''
1382
- );
1383
- $meta_field[] = array(
1384
  'label' => 'MPN',
1385
- 'id' => 'saswp_product_mpn_'.$schema_id,
1386
  'type' => 'text',
1387
  'note' => 'OR',
1388
- 'default' => ''
1389
- );
1390
- $meta_field[] = array(
1391
  'label' => 'ISBN',
1392
- 'id' => 'saswp_product_isbn_'.$schema_id,
1393
  'type' => 'text',
1394
  'note' => 'OR',
1395
- 'default' => ''
1396
- );
1397
- $meta_field[] = array(
1398
  'label' => 'GTIN8',
1399
- 'id' => 'saswp_product_gtin8_'.$schema_id,
1400
  'type' => 'text',
1401
- 'default' => ''
1402
- );
1403
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1404
  break;
1405
 
1406
  case 'Service':
@@ -1410,19 +1582,19 @@ class saswp_post_specific {
1410
  'label' => 'Name',
1411
  'id' => 'saswp_service_schema_name_'.$schema_id,
1412
  'type' => 'text',
1413
- 'default' => $service_schema_details['saswp_service_schema_name']
1414
  ),
1415
  array(
1416
  'label' => 'Service Type',
1417
  'id' => 'saswp_service_schema_type_'.$schema_id,
1418
  'type' => 'text',
1419
- 'default' => $service_schema_details['saswp_service_schema_type']
1420
  ),
1421
  array(
1422
  'label' => 'Provider Name',
1423
  'id' => 'saswp_service_schema_provider_name_'.$schema_id,
1424
  'type' => 'text',
1425
- 'default' => $service_schema_details['saswp_service_schema_provider_name']
1426
  ),
1427
  array(
1428
  'label' => 'Provider Type',
@@ -1439,7 +1611,7 @@ class saswp_post_specific {
1439
  'PerformingGroup' => 'Performing Group',
1440
  'SportsOrganization' => 'Sports Organization',
1441
  ),
1442
- 'default' => $service_schema_details['saswp_service_schema_provider_type']
1443
  ),
1444
  array(
1445
  'label' => 'Image',
@@ -1451,37 +1623,37 @@ class saswp_post_specific {
1451
  'label' => 'Locality',
1452
  'id' => 'saswp_service_schema_locality_'.$schema_id,
1453
  'type' => 'text',
1454
- 'default' => $service_schema_details['saswp_service_schema_locality']
1455
  ),
1456
  array(
1457
  'label' => 'Postal Code',
1458
  'id' => 'saswp_service_schema_postal_code_'.$schema_id,
1459
  'type' => 'text',
1460
- 'default' => $service_schema_details['saswp_service_schema_postal_code']
1461
  ),
1462
  array(
1463
  'label' => 'Telephone',
1464
  'id' => 'saswp_service_schema_telephone_'.$schema_id,
1465
  'type' => 'text',
1466
- 'default' => $service_schema_details['saswp_service_schema_telephone']
1467
  ),
1468
  array(
1469
  'label' => 'Price Range',
1470
  'id' => 'saswp_service_schema_price_range_'.$schema_id,
1471
  'type' => 'text',
1472
- 'default' => $service_schema_details['saswp_service_schema_price_range']
1473
  ),
1474
  array(
1475
  'label' => 'Description',
1476
  'id' => 'saswp_service_schema_description_'.$schema_id,
1477
  'type' => 'textarea',
1478
- 'default' => $service_schema_details['saswp_service_schema_description']
1479
  ),
1480
  array(
1481
  'label' => 'Area Served (City)',
1482
  'id' => 'saswp_service_schema_area_served_'.$schema_id,
1483
  'type' => 'textarea',
1484
- 'default' => $service_schema_details['saswp_service_schema_area_served'],
1485
  'note' => 'Note: Enter all the City name in comma separated',
1486
  'attributes' => array(
1487
  'placeholder' => 'New York, Los Angeles'
@@ -1491,12 +1663,34 @@ class saswp_post_specific {
1491
  'label' => 'Service Offer',
1492
  'id' => 'saswp_service_schema_service_offer_'.$schema_id,
1493
  'type' => 'textarea',
1494
- 'default' => $service_schema_details['saswp_service_schema_service_offer'],
1495
  'note' => 'Note: Enter all the service offer in comma separated',
1496
  'attributes' => array(
1497
  'placeholder' => 'Apartment light cleaning, carpet cleaning'
1498
  ),
1499
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1500
  );
1501
  break;
1502
 
@@ -1506,20 +1700,42 @@ class saswp_post_specific {
1506
  array(
1507
  'label' => 'Item Reviewed Type',
1508
  'id' => 'saswp_review_schema_item_type_'.$schema_id,
1509
- 'type' => 'text',
1510
- 'default' => $service_schema_details['saswp_review_schema_item_type']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1511
  ),
1512
  array(
1513
  'label' => 'Name',
1514
  'id' => 'saswp_review_schema_name_'.$schema_id,
1515
  'type' => 'text',
1516
- 'default' => $service_schema_details['saswp_review_schema_name']
1517
  ),
1518
  array(
1519
- 'label' => 'Description',
1520
  'id' => 'saswp_review_schema_description_'.$schema_id,
1521
  'type' => 'textarea',
1522
- 'default' => $service_schema_details['saswp_review_schema_description']
1523
  ),
1524
  array(
1525
  'label' => 'Date Published',
@@ -1539,49 +1755,132 @@ class saswp_post_specific {
1539
  'type' => 'media',
1540
  'default' => $service_schema_details['saswp_review_schema_image']['url']
1541
  ),
 
 
 
 
 
 
1542
  array(
1543
  'label' => 'Price Range',
1544
  'id' => 'saswp_review_schema_price_range_'.$schema_id,
1545
  'type' => 'text',
1546
- 'default' => $service_schema_details['saswp_review_schema_price_range']
1547
  ),
1548
  array(
1549
  'label' => 'Street Address',
1550
  'id' => 'saswp_review_schema_street_address_'.$schema_id,
1551
  'type' => 'text',
1552
- 'default' => $service_schema_details['saswp_review_schema_street_address']
1553
  ),
1554
  array(
1555
  'label' => 'Address Locality',
1556
  'id' => 'saswp_review_schema_locality_'.$schema_id,
1557
  'type' => 'text',
1558
- 'default' => $service_schema_details['saswp_review_schema_locality']
1559
  ),
1560
  array(
1561
  'label' => 'Address Region',
1562
  'id' => 'saswp_review_schema_region_'.$schema_id,
1563
  'type' => 'text',
1564
- 'default' => $service_schema_details['saswp_review_schema_region']
1565
  ),
1566
  array(
1567
  'label' => 'Postal Code',
1568
  'id' => 'saswp_review_schema_postal_code_'.$schema_id,
1569
  'type' => 'text',
1570
- 'default' => $service_schema_details['saswp_review_schema_postal_code']
1571
  ),
1572
  array(
1573
  'label' => 'Address Country',
1574
  'id' => 'saswp_review_schema_country_'.$schema_id,
1575
  'type' => 'text',
1576
- 'default' => $service_schema_details['saswp_review_schema_country'],
1577
  ),
1578
  array(
1579
  'label' => 'Telephone',
1580
  'id' => 'saswp_review_schema_telephone_'.$schema_id,
1581
  'type' => 'text',
1582
- 'default' => $service_schema_details['saswp_review_schema_telephone'],
1583
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
  ),
 
1585
  );
1586
  break;
1587
 
18
  add_action( 'wp_ajax_saswp_modify_schema_post_enable', array($this,'saswp_modify_schema_post_enable'));
19
 
20
  add_action( 'wp_ajax_saswp_restore_schema', array($this,'saswp_restore_schema'));
21
+
22
+ add_action( 'wp_ajax_saswp_enable_disable_schema_on_post', array($this,'saswp_enable_disable_schema_on_post'));
23
  }
24
+ public function saswp_enable_disable_schema_on_post(){
25
+
26
+ if ( ! isset( $_POST['saswp_security_nonce'] ) ){
27
+ return;
28
+ }
29
+ if ( !wp_verify_nonce( $_POST['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
30
+ return;
31
+ }
32
+ $schema_enable = array();
33
+ $post_id = sanitize_text_field($_POST['post_id']);
34
+ $schema_id = sanitize_text_field($_POST['schema_id']);
35
+ $status = sanitize_text_field($_POST['status']);
36
+
37
+ $schema_enable = get_post_meta($post_id, 'saswp_enable_disable_schema', true);
38
+ $schema_enable[$schema_id] = $status;
39
+ update_post_meta( $post_id, 'saswp_enable_disable_schema', $schema_enable);
40
+ echo json_encode(array('status'=>'t'));
41
+ wp_die();
42
+
43
+ }
44
+
45
  public function saswp_get_all_schema_list(){
46
 
47
  if($this->all_schema == null){
94
  $tabs = '';
95
  $tabs_fields = '';
96
  $schema_ids = array();
97
+
98
+ $schema_enable = get_post_meta($post->ID, 'saswp_enable_disable_schema', true);
99
+
100
  if(count($this->all_schema)>1){
101
  foreach($this->all_schema as $key => $schema){
102
+
103
+ $checked = '';
104
+ if(isset($schema_enable[$schema->ID]) && $schema_enable[$schema->ID] == 1){
105
+ $checked = 'checked';
106
+ }
107
  $response = $this->saswp_get_fields_by_schema_type($schema->ID);
108
  $this->meta_fields = $response;
109
+ $output = $this->saswp_saswp_post_specific( $post, $schema->ID );
110
+ $schema_type = esc_sql ( get_post_meta($schema->ID, 'schema_type', true) );
111
  if($key==0){
112
+ $tabs .='<li class="selected"><a saswp-schema-type="'.$schema_type.'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links selected">'.esc_attr($schema->post_title).'</a>'
113
+ . '<label class="saswp-switch">'
114
+ . '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($schema->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$checked.'>'
115
+ . '<span class="saswp-slider"></span>'
116
+ . '</li>';
117
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper">';
118
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
119
  $tabs_fields .= '</div>';
120
  }else{
121
+ $tabs .='<li>'
122
+ . '<a saswp-schema-type="'.$schema_type.'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links">'.esc_attr($schema->post_title).'</a>'
123
+ . '<label class="saswp-switch">'
124
+ . '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($schema->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$checked.'>'
125
+ . '<span class="saswp-slider"></span>'
126
+ . '</li>';
127
  $tabs_fields .= '<div data-id="'.esc_attr($schema->ID).'" id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-post-specific-wrapper saswp_hide">';
128
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
129
  $tabs_fields .= '</div>';
146
  echo '</div>';
147
 
148
  }else{
149
+
150
  $all_schema = $this->all_schema;
151
  $response = $this->saswp_get_fields_by_schema_type($all_schema[0]->ID);
152
 
153
  $schema_ids[] =$all_schema[0]->ID;
154
+ $schema_type = esc_sql ( get_post_meta($all_schema[0]->ID, 'schema_type', true) );
155
+ $checked = '';
156
+ if(isset($schema_enable[$all_schema[0]->ID]) && $schema_enable[$all_schema[0]->ID] == 1){
157
+ $checked = 'checked';
158
+ }
159
 
160
  $this->meta_fields = $response;
161
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
162
  $tabs_fields .= '<div>';
163
+ $tabs_fields .= '<div class="saswp-single-post-restore"><a href="#" class="saswp-restore-post-schema button saswp-tab-links selected" saswp-schema-type="'.$schema_type.'">'.esc_html__( 'Restore Default Schema', 'schema-and-structured-data-for-wp' ).'</a>'
164
+ . '<label class="saswp-switch" style="margin-left:10px;">'
165
+ . '<input type="checkbox" class="saswp-schema-type-toggle" value="1" data-schema-id="'.esc_attr($all_schema[0]->ID).'" data-post-id="'.esc_attr($post->ID).'" '.$checked.'>'
166
+ . '<span class="saswp-slider"></span>'
167
+ . '</div>';
168
  $tabs_fields .= '<div id="saswp_specific_'.esc_attr($all_schema[0]->ID).'" class="saswp-post-specific-wrapper">';
169
  $tabs_fields .= '<table class="form-table"><tbody>' . $output . '</tbody></table>';
170
  $tabs_fields .= '</div>';
242
  $image_id = get_post_thumbnail_id();
243
  $image_details = wp_get_attachment_image_src($image_id, 'full');
244
  if(empty($image_details[0]) || $image_details[0] === NULL ){
245
+
246
+ if(isset($sd_data['sd_logo'])){
247
+ $image_details[0] = $sd_data['sd_logo']['url'];
248
+ }
249
+
250
  }
251
  $current_user = wp_get_current_user();
252
  $author_details = get_avatar_data($current_user->ID);
283
  $media_value['thumbnail'] = $author_details['url'];
284
  }
285
  if (strpos($meta_field['id'], 'organization_logo') !== false && empty($media_value_meta)) {
286
+
287
+ if(isset($sd_data['sd_logo'])){
288
+ $media_value['height'] = $sd_data['sd_logo']['height'];
289
+ $media_value['width'] = $sd_data['sd_logo']['width'];
290
+ $media_value['thumbnail'] = $sd_data['sd_logo']['url'];
291
+ }
292
+
293
  }
294
  if (strpos($meta_field['id'], 'business_logo') !== false && empty($media_value_meta)) {
295
 
298
  $media_value['width'] = $business_details['local_business_logo']['width'];
299
  $media_value['thumbnail'] = $business_details['local_business_logo']['url'];
300
  }
301
+
302
+ if (strpos($meta_field['id'], 'product_schema_image') !== false && empty($media_value_meta)) {
303
+
304
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_product_schema_details', true) );
305
+ $media_value['height'] = $business_details['saswp_product_schema_image']['height'];
306
+ $media_value['width'] = $business_details['saswp_product_schema_image']['width'];
307
+ $media_value['thumbnail'] = $business_details['saswp_product_schema_image']['url'];
308
+ }
309
+
310
+ if (strpos($meta_field['id'], 'service_schema_image') !== false && empty($media_value_meta)) {
311
+
312
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_service_schema_details', true) );
313
+ $media_value['height'] = $business_details['saswp_service_schema_image']['height'];
314
+ $media_value['width'] = $business_details['saswp_service_schema_image']['width'];
315
+ $media_value['thumbnail'] = $business_details['saswp_service_schema_image']['url'];
316
+ }
317
+
318
+ if (strpos($meta_field['id'], 'review_schema_image') !== false && empty($media_value_meta)) {
319
+
320
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
321
+ $media_value['height'] = $business_details['saswp_review_schema_image']['height'];
322
+ $media_value['width'] = $business_details['saswp_review_schema_image']['width'];
323
+ $media_value['thumbnail'] = $business_details['saswp_review_schema_image']['url'];
324
+ }
325
 
326
  $media_height ='';
327
  $media_width ='';
399
  $input .= '</select>';
400
  break;
401
 
402
+ case 'checkbox':
403
+
404
+ $rating_class = 'class="saswp-enable-rating-review-'.strtolower($schema_type).'"';
405
+
406
+
407
+
408
+ $input = sprintf(
409
+ '<input %s %s id="%s" name="%s" type="checkbox" value="1">',
410
+ $rating_class,
411
+ $meta_value === '1' ? 'checked' : '',
412
+ $meta_field['id'],
413
+ $meta_field['id']
414
+ );
415
+ break;
416
+
417
  case 'multiselect':
418
  $input = sprintf(
419
  '<select multiple id="%s" name="%s[]">',
456
  if (strpos($meta_field['id'], 'closes_time') !== false || strpos($meta_field['id'], 'opens_time') !== false){
457
  $class='saswp-local-schema-time-picker';
458
  }
459
+ if (strpos($meta_field['id'], 'date_modified') !== false
460
+ || strpos($meta_field['id'], 'date_published') !== false
461
+ || strpos($meta_field['id'], 'video_upload_date') !== false
462
+ || strpos($meta_field['id'], 'qa_date_created') !== false
463
+ || strpos($meta_field['id'], 'accepted_answer_date_created') !== false
464
+ || strpos($meta_field['id'], 'suggested_answer_date_created') !== false
465
+ || strpos($meta_field['id'], 'priceValidUntil') !== false
466
+ || strpos($meta_field['id'], 'priceValidUntil') !== false
467
+ || strpos($meta_field['id'], 'priceValidUntil') !== false
468
+ ) {
469
  $class='saswp-local-schema-datepicker-picker';
470
  }
471
 
487
  default:
488
 
489
  }
490
+
491
+
492
+ if($meta_field['id'] == 'saswp_service_schema_rating_'.$schema_id ||
493
+ $meta_field['id'] == 'saswp_product_schema_rating_'.$schema_id ||
494
+ $meta_field['id'] == 'saswp_review_schema_rating_'.$schema_id ||
495
+ $meta_field['id'] == 'local_rating_'.$schema_id ||
496
+
497
+ $meta_field['id'] == 'saswp_service_schema_review_count_'.$schema_id ||
498
+ $meta_field['id'] == 'saswp_product_schema_review_count_'.$schema_id ||
499
+ $meta_field['id'] == 'saswp_review_schema_review_count_'.$schema_id ||
500
+ $meta_field['id'] == 'local_review_count_'.$schema_id
501
+
502
+ )
503
+ {
504
+ $output .= '<tr class="saswp-rating-review-'.strtolower($schema_type).'"><th>'.$label.'</th><td>'.$input.'</td></tr>';
505
+ }else{
506
+ $output .= '<tr><th>'.$label.'</th><td>'.$input.'</td></tr>';
507
+ }
508
+
509
  }
510
  return $output;
511
  }
733
  $image_id = get_post_thumbnail_id();
734
  $image_details = wp_get_attachment_image_src($image_id, 'full');
735
  if(empty($image_details[0]) || $image_details[0] === NULL ){
736
+
737
+ if(isset($sd_data['sd_logo'])){
738
+ $image_details[0] = $sd_data['sd_logo']['url'];
739
+ }
740
  }
741
  $current_user = wp_get_current_user();
742
  $author_details = get_avatar_data($current_user->ID);
920
  'type' => 'text',
921
  'default' => $business_details['local_price_range']
922
  ),
923
+ array(
924
+ 'label' => 'Aggregate Rating',
925
+ 'id' => 'local_enable_rating_'.$schema_id,
926
+ 'type' => 'checkbox',
927
+ // 'default' => saswp_remove_warnings($business_details, 'local_enable_rating', 'saswp_string')
928
+ ),
929
+ array(
930
+ 'label' => 'Rating',
931
+ 'id' => 'local_rating_'.$schema_id,
932
+ 'type' => 'text',
933
+ 'default' => saswp_remove_warnings($business_details, 'local_rating', 'saswp_string')
934
+ ),
935
+ array(
936
+ 'label' => 'Number of Reviews',
937
+ 'id' => 'local_review_count_'.$schema_id,
938
+ 'type' => 'text',
939
+ 'default' => saswp_remove_warnings($business_details, 'local_review_count', 'saswp_string')
940
+ ),
941
  );
942
 
943
  break;
996
  'label' => 'Organization Name',
997
  'id' => 'saswp_blogposting_organization_name_'.$schema_id,
998
  'type' => 'text',
999
+ 'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
1000
+ ),
1001
  array(
1002
  'label' => 'Organization Logo',
1003
  'id' => 'saswp_blogposting_organization_logo_'.$schema_id,
1004
  'type' => 'media',
1005
+ 'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url'] : ''
1006
  )
1007
  );
1008
  break;
1105
  'label' => 'Author Image',
1106
  'id' => 'saswp_newsarticle_author_image_'.$schema_id,
1107
  'type' => 'media',
1108
+ 'default' => isset($author_details['url']) ? $author_details['url']: ''
1109
  ),
1110
  array(
1111
  'label' => 'Organization Name',
1112
  'id' => 'saswp_newsarticle_organization_name_'.$schema_id,
1113
  'type' => 'text',
1114
+ 'default'=> saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
1115
  ),
1116
  array(
1117
  'label' => 'Organization Logo',
1118
  'id' => 'saswp_newsarticle_organization_logo_'.$schema_id,
1119
  'type' => 'media',
1120
+ 'default' => isset($sd_data['sd_logo'])? $sd_data['sd_logo']['url']:''
1121
  ),
1122
  );
1123
  break;
1183
  'label' => 'Organization Name',
1184
  'id' => 'saswp_webpage_organization_name_'.$schema_id,
1185
  'type' => 'text',
1186
+ 'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
1187
  ),
1188
  array(
1189
  'label' => 'Organization Logo',
1190
  'id' => 'saswp_webpage_organization_logo_'.$schema_id,
1191
  'type' => 'media',
1192
+ 'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
1193
  ),
1194
  );
1195
  break;
1242
  'label' => 'Organization Name',
1243
  'id' => 'saswp_article_organization_name_'.$schema_id,
1244
  'type' => 'text',
1245
+ 'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
1246
  ),
1247
  array(
1248
  'label' => 'Organization Logo',
1249
  'id' => 'saswp_article_organization_logo_'.$schema_id,
1250
  'type' => 'media',
1251
+ 'default' => isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:''
1252
  )
1253
  );
1254
  break;
1307
  'label' => 'Organization Name',
1308
  'id' => 'saswp_recipe_organization_name_'.$schema_id,
1309
  'type' => 'text',
1310
+ 'default' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string')
1311
  ),
1312
  array(
1313
  'label' => 'Organization Logo',
1454
  );
1455
  break;
1456
 
1457
+ case 'Product':
1458
+ $product_schema_details = esc_sql ( get_post_meta($schema_id, 'saswp_product_schema_details', true) );
 
 
 
1459
  $meta_field = array(
1460
+
 
 
 
 
 
1461
  array(
1462
  'label' => 'Name',
1463
+ 'id' => 'saswp_product_schema_name_'.$schema_id,
1464
  'type' => 'text',
1465
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_name', 'saswp_string'),
1466
  ),
1467
  array(
1468
  'label' => 'Description',
1469
+ 'id' => 'saswp_product_schema_description_'.$schema_id,
1470
  'type' => 'textarea',
1471
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_description', 'saswp_string'),
1472
+ ),
1473
+ array(
 
 
 
 
1474
  'label' => 'Image',
1475
+ 'id' => 'saswp_product_schema_image_'.$schema_id,
1476
  'type' => 'media',
1477
+ 'default' => $product_schema_details['saswp_product_schema_image']['url'],
1478
+ ),
1479
+ array(
1480
+ 'label' => 'Brand Name',
1481
+ 'id' => 'saswp_product_schema_brand_name_'.$schema_id,
1482
+ 'type' => 'text',
1483
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_brand_name', 'saswp_string'),
1484
+ ),
1485
+ array(
1486
  'label' => 'Price',
1487
+ 'id' => 'saswp_product_schema_price_'.$schema_id,
1488
  'type' => 'text',
1489
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_price', 'saswp_string'),
1490
+ ),
1491
+ array(
1492
+ 'label' => 'Price Valid Until',
1493
+ 'id' => 'saswp_product_schema_priceValidUntil_'.$schema_id,
 
 
 
 
 
 
1494
  'type' => 'text',
1495
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_priceValidUntil', 'saswp_string'),
1496
+ ),
1497
+ array(
1498
+ 'label' => 'Currency',
1499
+ 'id' => 'saswp_product_schema_currency_'.$schema_id,
1500
  'type' => 'text',
1501
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_currency', 'saswp_string'),
1502
+ ),
1503
+ array(
1504
+ 'label' => 'Availability',
1505
+ 'id' => 'saswp_product_schema_availability_'.$schema_id,
1506
+ 'type' => 'select',
1507
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_availability', 'saswp_string'),
1508
+ 'options' => array(
1509
+ 'InStock' => 'In Stock',
1510
+ 'OutOfStock' => 'Out Of Stock',
1511
+ 'Discontinued' => 'Discontinued',
1512
+ 'PreOrder' => 'Pre Order',
1513
+ )
1514
+ ),
1515
+ array(
1516
+ 'label' => 'Condition',
1517
+ 'id' => 'saswp_product_schema_condition_'.$schema_id,
1518
+ 'type' => 'select',
1519
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_condition', 'saswp_string'),
1520
+ 'options' => array(
1521
+ 'NewCondition' => 'New',
1522
+ 'UsedCondition' => 'Used',
1523
+ 'RefurbishedCondition' => 'Refurbished',
1524
+ 'DamagedCondition' => 'Damaged',
1525
+ ),
1526
+ ),
1527
+ array(
1528
+ 'label' => 'SKU',
1529
+ 'id' => 'saswp_product_schema_sku_'.$schema_id,
1530
  'type' => 'text',
1531
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_sku', 'saswp_string'),
1532
+ ),
1533
+ array(
1534
  'label' => 'MPN',
1535
+ 'id' => 'saswp_product_schema_mpn_'.$schema_id,
1536
  'type' => 'text',
1537
  'note' => 'OR',
1538
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_mpn', 'saswp_string'),
1539
+ ),
1540
+ array(
1541
  'label' => 'ISBN',
1542
+ 'id' => 'saswp_product_schema_isbn_'.$schema_id,
1543
  'type' => 'text',
1544
  'note' => 'OR',
1545
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_isbn', 'saswp_string'),
1546
+ ),
1547
+ array(
1548
  'label' => 'GTIN8',
1549
+ 'id' => 'saswp_product_schema_gtin8_'.$schema_id,
1550
  'type' => 'text',
1551
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_gtin8', 'saswp_string'),
1552
+ ),
1553
+ array(
1554
+ 'label' => 'Aggregate Rating',
1555
+ 'id' => 'saswp_product_schema_enable_rating_'.$schema_id,
1556
+ 'type' => 'checkbox',
1557
+ //'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_enable_rating', 'saswp_string')
1558
+ ),
1559
+ array(
1560
+ 'label' => 'Rating',
1561
+ 'id' => 'saswp_product_schema_rating_'.$schema_id,
1562
+ 'type' => 'text',
1563
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_rating', 'saswp_string')
1564
+ ),
1565
+ array(
1566
+ 'label' => 'Number of Reviews',
1567
+ 'id' => 'saswp_product_schema_review_count_'.$schema_id,
1568
+ 'type' => 'text',
1569
+ 'default' => saswp_remove_warnings($product_schema_details, 'saswp_product_schema_review_count', 'saswp_string')
1570
+ ),
1571
+
1572
+ );
1573
+
1574
+
1575
+
1576
  break;
1577
 
1578
  case 'Service':
1582
  'label' => 'Name',
1583
  'id' => 'saswp_service_schema_name_'.$schema_id,
1584
  'type' => 'text',
1585
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_name', 'saswp_string')
1586
  ),
1587
  array(
1588
  'label' => 'Service Type',
1589
  'id' => 'saswp_service_schema_type_'.$schema_id,
1590
  'type' => 'text',
1591
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_type', 'saswp_string')
1592
  ),
1593
  array(
1594
  'label' => 'Provider Name',
1595
  'id' => 'saswp_service_schema_provider_name_'.$schema_id,
1596
  'type' => 'text',
1597
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_provider_name', 'saswp_string')
1598
  ),
1599
  array(
1600
  'label' => 'Provider Type',
1611
  'PerformingGroup' => 'Performing Group',
1612
  'SportsOrganization' => 'Sports Organization',
1613
  ),
1614
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_provider_type', 'saswp_string')
1615
  ),
1616
  array(
1617
  'label' => 'Image',
1623
  'label' => 'Locality',
1624
  'id' => 'saswp_service_schema_locality_'.$schema_id,
1625
  'type' => 'text',
1626
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_locality', 'saswp_string')
1627
  ),
1628
  array(
1629
  'label' => 'Postal Code',
1630
  'id' => 'saswp_service_schema_postal_code_'.$schema_id,
1631
  'type' => 'text',
1632
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_postal_code', 'saswp_string')
1633
  ),
1634
  array(
1635
  'label' => 'Telephone',
1636
  'id' => 'saswp_service_schema_telephone_'.$schema_id,
1637
  'type' => 'text',
1638
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_telephone', 'saswp_string')
1639
  ),
1640
  array(
1641
  'label' => 'Price Range',
1642
  'id' => 'saswp_service_schema_price_range_'.$schema_id,
1643
  'type' => 'text',
1644
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_price_range', 'saswp_string')
1645
  ),
1646
  array(
1647
  'label' => 'Description',
1648
  'id' => 'saswp_service_schema_description_'.$schema_id,
1649
  'type' => 'textarea',
1650
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_description', 'saswp_string')
1651
  ),
1652
  array(
1653
  'label' => 'Area Served (City)',
1654
  'id' => 'saswp_service_schema_area_served_'.$schema_id,
1655
  'type' => 'textarea',
1656
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_area_served', 'saswp_string'),
1657
  'note' => 'Note: Enter all the City name in comma separated',
1658
  'attributes' => array(
1659
  'placeholder' => 'New York, Los Angeles'
1663
  'label' => 'Service Offer',
1664
  'id' => 'saswp_service_schema_service_offer_'.$schema_id,
1665
  'type' => 'textarea',
1666
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_service_offer', 'saswp_string'),
1667
  'note' => 'Note: Enter all the service offer in comma separated',
1668
  'attributes' => array(
1669
  'placeholder' => 'Apartment light cleaning, carpet cleaning'
1670
  ),
1671
+ ),
1672
+
1673
+ array(
1674
+ 'label' => 'Aggregate Rating',
1675
+ 'id' => 'saswp_service_schema_enable_rating_'.$schema_id,
1676
+ 'type' => 'checkbox',
1677
+ // 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_enable_rating', 'saswp_string')
1678
+ ),
1679
+ array(
1680
+ 'label' => 'Rating',
1681
+ 'id' => 'saswp_service_schema_rating_'.$schema_id,
1682
+ 'type' => 'text',
1683
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_rating', 'saswp_string')
1684
+ ),
1685
+ array(
1686
+ 'label' => 'Number of Reviews',
1687
+ 'id' => 'saswp_service_schema_review_count_'.$schema_id,
1688
+ 'type' => 'text',
1689
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_service_schema_review_count', 'saswp_string')
1690
+ ),
1691
+
1692
+
1693
+
1694
  );
1695
  break;
1696
 
1700
  array(
1701
  'label' => 'Item Reviewed Type',
1702
  'id' => 'saswp_review_schema_item_type_'.$schema_id,
1703
+ 'type' => 'select',
1704
+ 'options' => array(
1705
+ 'Article' => 'Article',
1706
+ 'adultentertainment' => 'Adult Entertainment',
1707
+ 'Blog' => 'Blog',
1708
+ 'Book' => 'Book',
1709
+ 'casino' => 'Casino',
1710
+ 'Diet' => 'Diet',
1711
+ 'Episode' => 'Episode',
1712
+ 'ExercisePlan' => 'Exercise Plan',
1713
+ 'Game' => 'Game',
1714
+ 'Movie' => 'Movie',
1715
+ 'MusicPlaylist' => 'Music Playlist',
1716
+ 'MusicRecording' => 'MusicRecording',
1717
+ 'Photograph' => 'Photograph',
1718
+ 'Recipe' => 'Recipe',
1719
+ 'Restaurant' => 'Restaurant',
1720
+ 'Series' => 'Series',
1721
+ 'SoftwareApplication' => 'Software Application',
1722
+ 'VisualArtwork' => 'Visual Artwork',
1723
+ 'Webpage' => 'Webpage',
1724
+ 'WebSite' => 'WebSite',
1725
+ ),
1726
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_item_type', 'saswp_string')
1727
  ),
1728
  array(
1729
  'label' => 'Name',
1730
  'id' => 'saswp_review_schema_name_'.$schema_id,
1731
  'type' => 'text',
1732
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_name', 'saswp_string')
1733
  ),
1734
  array(
1735
+ 'label' => 'Review Body',
1736
  'id' => 'saswp_review_schema_description_'.$schema_id,
1737
  'type' => 'textarea',
1738
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_description', 'saswp_string')
1739
  ),
1740
  array(
1741
  'label' => 'Date Published',
1755
  'type' => 'media',
1756
  'default' => $service_schema_details['saswp_review_schema_image']['url']
1757
  ),
1758
+ array(
1759
+ 'label' => 'Author',
1760
+ 'id' => 'saswp_review_schema_author_'.$schema_id,
1761
+ 'type' => 'text',
1762
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_author', 'saswp_string')
1763
+ ),
1764
  array(
1765
  'label' => 'Price Range',
1766
  'id' => 'saswp_review_schema_price_range_'.$schema_id,
1767
  'type' => 'text',
1768
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_price_range', 'saswp_string')
1769
  ),
1770
  array(
1771
  'label' => 'Street Address',
1772
  'id' => 'saswp_review_schema_street_address_'.$schema_id,
1773
  'type' => 'text',
1774
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_street_address', 'saswp_string')
1775
  ),
1776
  array(
1777
  'label' => 'Address Locality',
1778
  'id' => 'saswp_review_schema_locality_'.$schema_id,
1779
  'type' => 'text',
1780
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_locality', 'saswp_string')
1781
  ),
1782
  array(
1783
  'label' => 'Address Region',
1784
  'id' => 'saswp_review_schema_region_'.$schema_id,
1785
  'type' => 'text',
1786
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_region', 'saswp_string')
1787
  ),
1788
  array(
1789
  'label' => 'Postal Code',
1790
  'id' => 'saswp_review_schema_postal_code_'.$schema_id,
1791
  'type' => 'text',
1792
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_postal_code', 'saswp_string')
1793
  ),
1794
  array(
1795
  'label' => 'Address Country',
1796
  'id' => 'saswp_review_schema_country_'.$schema_id,
1797
  'type' => 'text',
1798
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_country', 'saswp_string'),
1799
  ),
1800
  array(
1801
  'label' => 'Telephone',
1802
  'id' => 'saswp_review_schema_telephone_'.$schema_id,
1803
  'type' => 'text',
1804
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_telephone', 'saswp_string'),
1805
 
1806
+ ),
1807
+
1808
+ array(
1809
+ 'label' => 'Review Rating',
1810
+ 'id' => 'saswp_review_schema_enable_rating_'.$schema_id,
1811
+ 'type' => 'checkbox',
1812
+ // 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_enable_rating', 'saswp_string')
1813
+ ),
1814
+ array(
1815
+ 'label' => 'Rating Value',
1816
+ 'id' => 'saswp_review_schema_rating_'.$schema_id,
1817
+ 'type' => 'text',
1818
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_rating', 'saswp_string')
1819
+ ),
1820
+ array(
1821
+ 'label' => 'Best Rating',
1822
+ 'id' => 'saswp_review_schema_review_count_'.$schema_id,
1823
+ 'type' => 'text',
1824
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_review_schema_review_count', 'saswp_string')
1825
+ ),
1826
+
1827
+
1828
+ );
1829
+ break;
1830
+
1831
+ case 'AudioObject':
1832
+ $service_schema_details = esc_sql ( get_post_meta($schema_id, 'saswp_audio_schema_details', true) );
1833
+ $meta_field = array(
1834
+
1835
+ array(
1836
+ 'label' => 'Name',
1837
+ 'id' => 'saswp_audio_schema_name_'.$schema_id,
1838
+ 'type' => 'text',
1839
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_audio_schema_name', 'saswp_string')
1840
+ ),
1841
+ array(
1842
+ 'label' => 'Description',
1843
+ 'id' => 'saswp_audio_schema_description_'.$schema_id,
1844
+ 'type' => 'textarea',
1845
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_audio_schema_description', 'saswp_string')
1846
+ ),
1847
+ array(
1848
+ 'label' => 'Content Url',
1849
+ 'id' => 'saswp_audio_schema_contenturl_'.$schema_id,
1850
+ 'type' => 'text',
1851
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_audio_schema_contenturl', 'saswp_string')
1852
+ ),
1853
+ array(
1854
+ 'label' => 'Duration',
1855
+ 'id' => 'saswp_audio_schema_duration_'.$schema_id,
1856
+ 'type' => 'text',
1857
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_audio_schema_duration', 'saswp_string')
1858
+ ),
1859
+ array(
1860
+ 'label' => 'Encoding Format',
1861
+ 'id' => 'saswp_audio_schema_encoding_format_'.$schema_id,
1862
+ 'type' => 'text',
1863
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_audio_schema_encoding_format', 'saswp_string')
1864
+ ),
1865
+ array(
1866
+ 'label' => 'Date Published',
1867
+ 'id' => 'saswp_audio_schema_date_published_'.$schema_id,
1868
+ 'type' => 'text',
1869
+ 'default' => get_the_date("Y-m-d")
1870
+ ),
1871
+ array(
1872
+ 'label' => 'Date Modified',
1873
+ 'id' => 'saswp_audio_schema_date_modified_'.$schema_id,
1874
+ 'type' => 'text',
1875
+ 'default' => get_the_modified_date("Y-m-d")
1876
+ ),
1877
+ array(
1878
+ 'label' => 'Author',
1879
+ 'id' => 'saswp_audio_schema_author_name_'.$schema_id,
1880
+ 'type' => 'text',
1881
+ 'default' => saswp_remove_warnings($service_schema_details, 'saswp_audio_author_name', 'saswp_string')
1882
  ),
1883
+
1884
  );
1885
  break;
1886
 
view/review.php CHANGED
@@ -14,7 +14,7 @@ class saswp_metaboxes_review {
14
  $review_post_id = $post->ID;
15
  }
16
 
17
- if(get_post_status($review_post_id)=='publish' && $sd_data['saswp-review-module']==1){
18
 
19
  $show_post_types = get_post_types();
20
  unset($show_post_types['adsforwp'],$show_post_types['saswp'],$show_post_types['attachment'], $show_post_types['revision'], $show_post_types['nav_menu_item'], $show_post_types['user_request'], $show_post_types['custom_css']);
14
  $review_post_id = $post->ID;
15
  }
16
 
17
+ if(get_post_status($review_post_id)=='publish' && saswp_remove_warnings($sd_data, 'saswp-review-module', 'saswp_string')==1){
18
 
19
  $show_post_types = get_post_types();
20
  unset($show_post_types['adsforwp'],$show_post_types['saswp'],$show_post_types['attachment'], $show_post_types['revision'], $show_post_types['nav_menu_item'], $show_post_types['user_request'], $show_post_types['custom_css']);
view/schema_type.php CHANGED
@@ -33,6 +33,11 @@
33
  $schema_type ='';
34
  $business_type ='';
35
  $business_details ='';
 
 
 
 
 
36
  if($post){
37
  $schema_type = esc_sql ( get_post_meta($post->ID, 'schema_type', true) );
38
  $business_type = esc_sql ( get_post_meta($post->ID, 'saswp_business_type', true) );
@@ -40,17 +45,18 @@
40
  $business_details = esc_sql ( get_post_meta($post->ID, 'saswp_local_business_details', true) );
41
  $service_details = esc_sql ( get_post_meta($post->ID, 'saswp_service_schema_details', true) );
42
  $review_details = esc_sql ( get_post_meta($post->ID, 'saswp_review_schema_details', true) );
43
- $dayoftheweek = get_post_meta($post->ID, 'saswp_dayofweek', true);
 
 
44
  $custom_logo_id = get_theme_mod( 'custom_logo' );
45
- $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
46
-
 
 
47
  if($schema_type != 'local_business'){
48
  $style_business_type = 'style="display:none"';
49
  $style_business_name = 'style="display:none"';
50
- }
51
- if($schema_type != 'Service'){
52
- // $style_service_name = 'style="display:none"';
53
- }
54
  }
55
 
56
  $provider_type = array(
@@ -64,30 +70,57 @@
64
  'PerformingGroup' => 'Performing Group',
65
  'SportsOrganization' => 'Sports Organization',
66
  );
67
-
68
- $all_dayofweek_array = array(
69
- 'monday' => 'Monday',
70
- 'tuesday' => 'Tuesday',
71
- 'wednesday' => 'Wednesday',
72
- 'thursday' => 'Thursday',
73
- 'friday' => 'Friday',
74
- 'saturday' => 'Saturday',
75
- 'sunday' => 'Sunday',
76
- );
77
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  $all_schema_array = array(
 
 
80
  'Blogposting' => 'Blogposting',
 
81
  'NewsArticle' => 'NewsArticle',
82
- 'WebPage' => 'WebPage',
83
- 'Article' => 'Article',
84
- 'Recipe' => 'Recipe',
85
  'Product' => 'Product',
86
- 'Service' => 'Service',
87
- 'Review' => 'Review',
88
  'qanda' => 'Q&A',
 
 
 
89
  'VideoObject' => 'VideoObject',
90
- 'local_business' => 'Local Business'
91
  );
92
  $all_business_type = array(
93
  'animalshelter' => 'Animal Shelter',
@@ -510,10 +543,10 @@
510
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
511
  <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
512
  <td style="display: flex; width: 97%">
513
- <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_url($business_details['local_business_logo']['url']);} else { echo esc_url($logo[0]); } ?>" id="local_business_logo" type="text" name="local_business_logo[url]" placeholder="<?php echo esc_html__('Logo', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
514
  <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_attr($business_details['local_business_logo']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="local_business_logo_id" type="hidden" name="local_business_logo[id]">
515
- <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_attr($business_details['local_business_logo']['width']);} else { echo esc_attr($logo[1]); } ?>" data-id="local_business_logo_width" type="hidden" name="local_business_logo[width]">
516
- <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_attr($business_details['local_business_logo']['height']);} else { echo esc_attr($logo[2]); } ?>" data-id="local_business_logo_height" type="hidden" name="local_business_logo[height]">
517
  <input data-id="media" class="button" id="local_business_logo_button" type="button" value="Upload"></td>
518
  </tr>
519
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
@@ -528,6 +561,23 @@
528
  <td><?php echo esc_html__('Price Range', 'schema-and-structured-data-for-wp' ); ?></td>
529
  <td><input value="<?php if(isset($business_details['local_price_range'])){echo esc_attr($business_details['local_price_range']); } ?>" type="text" name="local_price_range" placeholder="<?php echo esc_html__('$10-$50 or $$$ ', 'schema-and-structured-data-for-wp' ); ?>" ></td>
530
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  <!-- Service Schema type starts here -->
532
 
533
  <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
@@ -553,7 +603,7 @@
553
 
554
  foreach ($provider_type as $key => $value) {
555
  $sel = '';
556
- if($service_details['saswp_service_schema_provider_type']==$key){
557
  $sel = 'selected';
558
  }
559
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
@@ -566,10 +616,10 @@
566
  <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
567
  <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
568
  <td style="display: flex; width: 97%">
569
- <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_url($service_details['saswp_service_schema_image']['url']);} else { echo esc_url($logo[0]); } ?>" id="saswp_service_schema_image" type="text" name="saswp_service_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
570
  <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_attr($service_details['saswp_service_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_service_schema_image_id" type="hidden" name="saswp_service_schema_image[id]">
571
- <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_attr($service_details['saswp_service_schema_image']['width']);} else { echo esc_attr($logo[1]); } ?>" data-id="saswp_service_schema_image_width" type="hidden" name="saswp_service_schema_image[width]">
572
- <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_attr($service_details['saswp_service_schema_image']['height']);} else { echo esc_attr($logo[2]); } ?>" data-id="saswp_service_schema_image_height" type="hidden" name="saswp_service_schema_image[height]">
573
  <input data-id="media" class="button" id="saswp_service_schema_image_button" type="button" value="Upload"></td>
574
  </tr>
575
  <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
@@ -601,30 +651,66 @@
601
  <td><textarea placeholder="Apartment light cleaning, Carpet cleaning" rows="3" cols="70" name="saswp_service_schema_service_offer"><?php if(isset($service_details['saswp_service_schema_service_offer'])){echo esc_attr($service_details['saswp_service_schema_service_offer']); } ?></textarea><p>Note: Enter all the service offer in comma separated</p></td>
602
  </tr>
603
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
604
  <!-- Service Schema type ends here -->
605
 
606
  <!-- Review Schema type starts here -->
607
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
608
  <td><?php echo esc_html__('Item Reviewed Type', 'schema-and-structured-data-for-wp' ); ?></td>
609
- <td><input value="<?php if(isset($review_details['saswp_review_schema_item_type'])){echo esc_attr($review_details['saswp_review_schema_item_type']); } ?>" type="text" name="saswp_review_schema_item_type" placeholder="<?php echo esc_html__('Restaurant', 'schema-and-structured-data-for-wp' ); ?>" ></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  </tr>
611
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
612
  <td><?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?></td>
613
  <td><input value="<?php if(isset($review_details['saswp_review_schema_name'])){echo esc_attr($review_details['saswp_review_schema_name']); } ?>" type="text" name="saswp_review_schema_name" placeholder="<?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
614
  </tr>
615
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
616
- <td><?php echo esc_html__('Description', 'schema-and-structured-data-for-wp' ); ?></td>
617
- <td><textarea placeholder="Description" rows="3" cols="70" name="saswp_review_schema_description"><?php if(isset($review_details['saswp_review_schema_description'])){echo esc_attr($review_details['saswp_review_schema_description']); } ?></textarea></td>
618
  </tr>
619
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
620
  <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
621
  <td style="display: flex; width: 97%">
622
- <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_url($review_details['saswp_review_schema_image']['url']);} else { echo esc_url($logo[0]); } ?>" id="saswp_review_schema_image" type="text" name="saswp_review_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
623
  <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_attr($review_details['saswp_review_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_review_schema_image_id" type="hidden" name="saswp_review_schema_image[id]">
624
- <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_attr($review_details['saswp_review_schema_image']['width']);} else { echo esc_attr($logo[1]); } ?>" data-id="saswp_review_schema_image_width" type="hidden" name="saswp_review_schema_image[width]">
625
- <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_attr($review_details['saswp_review_schema_image']['height']);} else { echo esc_attr($logo[2]); } ?>" data-id="saswp_review_schema_image_height" type="hidden" name="saswp_review_schema_image[height]">
626
  <input data-id="media" class="button" id="saswp_review_schema_image_button" type="button" value="Upload"></td>
627
  </tr>
 
 
 
 
628
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
629
  <td><?php echo esc_html__('Price Range', 'schema-and-structured-data-for-wp' ); ?></td>
630
  <td><input value="<?php if(isset($review_details['saswp_review_schema_price_range'])){echo esc_attr($review_details['saswp_review_schema_price_range']); } ?>" type="text" name="saswp_review_schema_price_range" placeholder="<?php echo esc_html__('Price Range', 'schema-and-structured-data-for-wp' ); ?>" ></td>
@@ -654,7 +740,179 @@
654
  <td><input value="<?php if(isset($review_details['saswp_review_schema_telephone'])){echo esc_attr($review_details['saswp_review_schema_telephone']); } ?>" type="text" name="saswp_review_schema_telephone" placeholder="<?php echo esc_html__('Telephone', 'schema-and-structured-data-for-wp' ); ?>" ></td>
655
  </tr>
656
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  <!-- Review Schema type ends here -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
658
  </table>
659
 
660
  </div>
@@ -719,13 +977,26 @@
719
  if ( isset( $_POST['local_price_range'] ) ){
720
  $local_business_details['local_price_range'] = sanitize_text_field($_POST['local_price_range']);
721
  }
 
 
 
 
 
 
 
 
 
 
 
722
 
723
  update_post_meta( $post_id, 'saswp_local_business_details', $local_business_details );
724
 
725
  //Service schema details starts here
726
  $service_schema_details = array();
727
  $review_schema_details = array();
728
- $schema_type = $_POST['schema_type'];
 
 
729
 
730
  if($schema_type =='Service'){
731
  if ( isset( $_POST['saswp_service_schema_name'] ) ){
@@ -766,9 +1037,19 @@
766
  }
767
  if ( isset( $_POST['saswp_service_schema_service_offer'] ) ){
768
  $service_schema_details['saswp_service_schema_service_offer'] = sanitize_textarea_field($_POST['saswp_service_schema_service_offer']);
769
- }
770
- update_post_meta( $post_id, 'saswp_service_schema_details', $service_schema_details );
771
- }
 
 
 
 
 
 
 
 
 
 
772
 
773
 
774
  if($schema_type =='Review'){
@@ -787,6 +1068,9 @@
787
  $review_schema_details['saswp_review_schema_image']['width'] = sanitize_text_field($_POST['saswp_review_schema_image']['width']);
788
  $review_schema_details['saswp_review_schema_image']['height'] = sanitize_text_field($_POST['saswp_review_schema_image']['height']);
789
  }
 
 
 
790
  if ( isset( $_POST['saswp_review_schema_price_range'] ) ){
791
  $review_schema_details['saswp_review_schema_price_range'] = sanitize_text_field($_POST['saswp_review_schema_price_range']);
792
  }
@@ -807,9 +1091,104 @@
807
  }
808
  if ( isset( $_POST['saswp_review_schema_telephone'] ) ){
809
  $review_schema_details['saswp_review_schema_telephone'] = sanitize_text_field($_POST['saswp_review_schema_telephone']);
810
- }
 
 
 
 
 
 
 
 
 
 
 
811
  update_post_meta( $post_id, 'saswp_review_schema_details', $review_schema_details );
812
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
813
  //Service schema details ends here
814
 
815
 
33
  $schema_type ='';
34
  $business_type ='';
35
  $business_details ='';
36
+ $custom_logo_id ='';
37
+ $logo = array();
38
+ $service_details = array();
39
+ $review_details = array();
40
+ $product_details = array();
41
  if($post){
42
  $schema_type = esc_sql ( get_post_meta($post->ID, 'schema_type', true) );
43
  $business_type = esc_sql ( get_post_meta($post->ID, 'saswp_business_type', true) );
45
  $business_details = esc_sql ( get_post_meta($post->ID, 'saswp_local_business_details', true) );
46
  $service_details = esc_sql ( get_post_meta($post->ID, 'saswp_service_schema_details', true) );
47
  $review_details = esc_sql ( get_post_meta($post->ID, 'saswp_review_schema_details', true) );
48
+ $product_details = esc_sql ( get_post_meta($post->ID, 'saswp_product_schema_details', true) );
49
+ $audio_details = esc_sql ( get_post_meta($post->ID, 'saswp_audio_schema_details', true) );
50
+ $dayoftheweek = get_post_meta($post->ID, 'saswp_dayofweek', true);
51
  $custom_logo_id = get_theme_mod( 'custom_logo' );
52
+ if($custom_logo_id){
53
+ $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
54
+ }
55
+
56
  if($schema_type != 'local_business'){
57
  $style_business_type = 'style="display:none"';
58
  $style_business_name = 'style="display:none"';
59
+ }
 
 
 
60
  }
61
 
62
  $provider_type = array(
70
  'PerformingGroup' => 'Performing Group',
71
  'SportsOrganization' => 'Sports Organization',
72
  );
73
+
74
+ $availability = array(
75
+ 'InStock' => 'In Stock',
76
+ 'OutOfStock' => 'Out Of Stock',
77
+ 'Discontinued' => 'Discontinued',
78
+ 'PreOrder' => 'Pre Order',
79
+ );
80
+
81
+ $item_condition = array(
82
+ 'NewCondition' => 'New',
83
+ 'UsedCondition' => 'Used',
84
+ 'RefurbishedCondition' => 'Refurbished',
85
+ 'DamagedCondition' => 'Damaged',
86
+ );
87
+
88
+ $item_reviewed = array(
89
+ 'Article' => 'Article',
90
+ 'adultentertainment' => 'Adult Entertainment',
91
+ 'Blog' => 'Blog',
92
+ 'Book' => 'Book',
93
+ 'casino' => 'Casino',
94
+ 'Diet' => 'Diet',
95
+ 'Episode' => 'Episode',
96
+ 'ExercisePlan' => 'Exercise Plan',
97
+ 'Game' => 'Game',
98
+ 'Movie' => 'Movie',
99
+ 'MusicPlaylist' => 'Music Playlist',
100
+ 'MusicRecording' => 'MusicRecording',
101
+ 'Photograph' => 'Photograph',
102
+ 'Recipe' => 'Recipe',
103
+ 'Restaurant' => 'Restaurant',
104
+ 'Series' => 'Series',
105
+ 'SoftwareApplication' => 'Software Application',
106
+ 'VisualArtwork' => 'Visual Artwork',
107
+ 'Webpage' => 'Webpage',
108
+ 'WebSite' => 'WebSite',
109
+ );
110
 
111
  $all_schema_array = array(
112
+ 'Article' => 'Article',
113
+ 'AudioObject' => 'AudioObject',
114
  'Blogposting' => 'Blogposting',
115
+ 'local_business' => 'Local Business',
116
  'NewsArticle' => 'NewsArticle',
 
 
 
117
  'Product' => 'Product',
 
 
118
  'qanda' => 'Q&A',
119
+ 'Review' => 'Review',
120
+ 'Recipe' => 'Recipe',
121
+ 'Service' => 'Service',
122
  'VideoObject' => 'VideoObject',
123
+ 'WebPage' => 'WebPage'
124
  );
125
  $all_business_type = array(
126
  'animalshelter' => 'Animal Shelter',
543
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
544
  <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
545
  <td style="display: flex; width: 97%">
546
+ <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_url($business_details['local_business_logo']['url']);} else { echo esc_url(saswp_remove_warnings($logo, 0, 'saswp_string')); } ?>" id="local_business_logo" type="text" name="local_business_logo[url]" placeholder="<?php echo esc_html__('Logo', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
547
  <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_attr($business_details['local_business_logo']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="local_business_logo_id" type="hidden" name="local_business_logo[id]">
548
+ <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_attr($business_details['local_business_logo']['width']);} else { echo esc_attr(saswp_remove_warnings($logo, 1, 'saswp_string')); } ?>" data-id="local_business_logo_width" type="hidden" name="local_business_logo[width]">
549
+ <input value="<?php if(isset($business_details['local_business_logo'])) { echo esc_attr($business_details['local_business_logo']['height']);} else { echo esc_attr(saswp_remove_warnings($logo, 2, 'saswp_string')); } ?>" data-id="local_business_logo_height" type="hidden" name="local_business_logo[height]">
550
  <input data-id="media" class="button" id="local_business_logo_button" type="button" value="Upload"></td>
551
  </tr>
552
  <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
561
  <td><?php echo esc_html__('Price Range', 'schema-and-structured-data-for-wp' ); ?></td>
562
  <td><input value="<?php if(isset($business_details['local_price_range'])){echo esc_attr($business_details['local_price_range']); } ?>" type="text" name="local_price_range" placeholder="<?php echo esc_html__('$10-$50 or $$$ ', 'schema-and-structured-data-for-wp' ); ?>" ></td>
563
  </tr>
564
+
565
+
566
+ <tr class="saswp-business-text-field-tr" <?php echo $style_business_type; ?>>
567
+ <td><?php echo esc_html__('Aggregate Rating', 'schema-and-structured-data-for-wp' ); ?></td>
568
+ <td>
569
+ <input class="saswp-enable-rating-review-local_business" type="checkbox" name="local_enable_rating" value="1" <?php if(isset($business_details['local_enable_rating'])){echo 'checked'; }else{ echo ''; } ?>>
570
+ </td>
571
+ </tr>
572
+ <tr class="saswp-business-text-field-tr saswp-rating-review-local_business">
573
+ <td><?php echo esc_html__('Rating', 'schema-and-structured-data-for-wp' ); ?></td>
574
+ <td><input value="<?php if(isset($business_details['local_rating'])){echo esc_attr($business_details['local_rating']); } ?>" type="text" name="local_rating" placeholder="<?php echo esc_html__('5.0', 'schema-and-structured-data-for-wp' ); ?>" ></td>
575
+ </tr>
576
+ <tr class="saswp-business-text-field-tr saswp-rating-review-local_business" <?php echo $style_business_type; ?>>
577
+ <td><?php echo esc_html__('Number of Reviews', 'schema-and-structured-data-for-wp' ); ?></td>
578
+ <td><input value="<?php if(isset($business_details['local_review_count'])){echo esc_attr($business_details['local_review_count']); } ?>" type="text" name="local_review_count" placeholder="<?php echo esc_html__('10', 'schema-and-structured-data-for-wp' ); ?>" ></td>
579
+ </tr>
580
+
581
  <!-- Service Schema type starts here -->
582
 
583
  <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
603
 
604
  foreach ($provider_type as $key => $value) {
605
  $sel = '';
606
+ if(saswp_remove_warnings($service_details, 'saswp_service_schema_provider_type', 'saswp_string')==$key){
607
  $sel = 'selected';
608
  }
609
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
616
  <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
617
  <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
618
  <td style="display: flex; width: 97%">
619
+ <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_url($service_details['saswp_service_schema_image']['url']);} else { echo esc_url(saswp_remove_warnings($logo, 0, 'saswp_string')); } ?>" id="saswp_service_schema_image" type="text" name="saswp_service_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
620
  <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_attr($service_details['saswp_service_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_service_schema_image_id" type="hidden" name="saswp_service_schema_image[id]">
621
+ <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_attr($service_details['saswp_service_schema_image']['width']);} else { echo esc_attr(saswp_remove_warnings($logo, 1, 'saswp_string')); } ?>" data-id="saswp_service_schema_image_width" type="hidden" name="saswp_service_schema_image[width]">
622
+ <input value="<?php if(isset($service_details['saswp_service_schema_image'])) { echo esc_attr($service_details['saswp_service_schema_image']['height']);} else { echo esc_attr(saswp_remove_warnings($logo, 2, 'saswp_string')); } ?>" data-id="saswp_service_schema_image_height" type="hidden" name="saswp_service_schema_image[height]">
623
  <input data-id="media" class="button" id="saswp_service_schema_image_button" type="button" value="Upload"></td>
624
  </tr>
625
  <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
651
  <td><textarea placeholder="Apartment light cleaning, Carpet cleaning" rows="3" cols="70" name="saswp_service_schema_service_offer"><?php if(isset($service_details['saswp_service_schema_service_offer'])){echo esc_attr($service_details['saswp_service_schema_service_offer']); } ?></textarea><p>Note: Enter all the service offer in comma separated</p></td>
652
  </tr>
653
 
654
+
655
+
656
+ <tr class="saswp-service-text-field-tr" <?php echo $style_service_name; ?>>
657
+ <td><?php echo esc_html__('Aggregate Rating', 'schema-and-structured-data-for-wp' ); ?></td>
658
+ <td>
659
+ <input class="saswp-enable-rating-review-service" type="checkbox" name="saswp_service_schema_enable_rating" value="1" <?php if(isset($service_details['saswp_service_schema_enable_rating'])){echo 'checked'; }else{ echo ''; } ?>>
660
+ </td>
661
+ </tr>
662
+
663
+ <tr class="saswp-service-text-field-tr saswp-rating-review-service" <?php echo $style_service_name; ?>>
664
+ <td><?php echo esc_html__('Rating', 'schema-and-structured-data-for-wp' ); ?></td>
665
+ <td><input value="<?php if(isset($service_details['saswp_service_schema_rating'])){echo esc_attr($service_details['saswp_service_schema_rating']); } ?>" type="text" name="saswp_service_schema_rating" placeholder="<?php echo esc_html__('5.0', 'schema-and-structured-data-for-wp' ); ?>" ></td>
666
+ </tr>
667
+ <tr class="saswp-service-text-field-tr saswp-rating-review-service" <?php echo $style_business_type; ?>>
668
+ <td><?php echo esc_html__('Number of Reviews', 'schema-and-structured-data-for-wp' ); ?></td>
669
+ <td><input value="<?php if(isset($service_details['saswp_service_schema_review_count'])){echo esc_attr($service_details['saswp_service_schema_review_count']); } ?>" type="text" name="saswp_service_schema_review_count" placeholder="<?php echo esc_html__('10', 'schema-and-structured-data-for-wp' ); ?>" ></td>
670
+ </tr>
671
+
672
+
673
  <!-- Service Schema type ends here -->
674
 
675
  <!-- Review Schema type starts here -->
676
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
677
  <td><?php echo esc_html__('Item Reviewed Type', 'schema-and-structured-data-for-wp' ); ?></td>
678
+ <td>
679
+
680
+ <select name="saswp_review_schema_item_type">
681
+ <?php
682
+ foreach ($item_reviewed as $key => $value) {
683
+ $sel = '';
684
+ if(saswp_remove_warnings($review_details, 'saswp_review_schema_item_type', 'saswp_string')==$key){
685
+ $sel = 'selected';
686
+ }
687
+ echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
688
+ }
689
+ ?>
690
+ </select>
691
+ </td>
692
  </tr>
693
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
694
  <td><?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?></td>
695
  <td><input value="<?php if(isset($review_details['saswp_review_schema_name'])){echo esc_attr($review_details['saswp_review_schema_name']); } ?>" type="text" name="saswp_review_schema_name" placeholder="<?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
696
  </tr>
697
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
698
+ <td><?php echo esc_html__('Review Body', 'schema-and-structured-data-for-wp' ); ?></td>
699
+ <td><textarea placeholder="Review Body" rows="3" cols="70" name="saswp_review_schema_description"><?php if(isset($review_details['saswp_review_schema_description'])){echo esc_attr($review_details['saswp_review_schema_description']); } ?></textarea></td>
700
  </tr>
701
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
702
  <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
703
  <td style="display: flex; width: 97%">
704
+ <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_url($review_details['saswp_review_schema_image']['url']);} else { echo esc_url(saswp_remove_warnings($logo, 0, 'saswp_string')); } ?>" id="saswp_review_schema_image" type="text" name="saswp_review_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
705
  <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_attr($review_details['saswp_review_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_review_schema_image_id" type="hidden" name="saswp_review_schema_image[id]">
706
+ <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_attr($review_details['saswp_review_schema_image']['width']);} else { echo esc_attr(saswp_remove_warnings($logo, 1, 'saswp_string')); } ?>" data-id="saswp_review_schema_image_width" type="hidden" name="saswp_review_schema_image[width]">
707
+ <input value="<?php if(isset($review_details['saswp_review_schema_image'])) { echo esc_attr($review_details['saswp_review_schema_image']['height']);} else { echo esc_attr(saswp_remove_warnings($logo, 2, 'saswp_string')); } ?>" data-id="saswp_review_schema_image_height" type="hidden" name="saswp_review_schema_image[height]">
708
  <input data-id="media" class="button" id="saswp_review_schema_image_button" type="button" value="Upload"></td>
709
  </tr>
710
+ <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
711
+ <td><?php echo esc_html__('Author', 'schema-and-structured-data-for-wp' ); ?></td>
712
+ <td><input value="<?php if(isset($review_details['saswp_review_schema_author'])){echo esc_attr($review_details['saswp_review_schema_author']); } ?>" type="text" name="saswp_review_schema_author" placeholder="<?php echo esc_html__('Author', 'schema-and-structured-data-for-wp' ); ?>" ></td>
713
+ </tr>
714
  <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
715
  <td><?php echo esc_html__('Price Range', 'schema-and-structured-data-for-wp' ); ?></td>
716
  <td><input value="<?php if(isset($review_details['saswp_review_schema_price_range'])){echo esc_attr($review_details['saswp_review_schema_price_range']); } ?>" type="text" name="saswp_review_schema_price_range" placeholder="<?php echo esc_html__('Price Range', 'schema-and-structured-data-for-wp' ); ?>" ></td>
740
  <td><input value="<?php if(isset($review_details['saswp_review_schema_telephone'])){echo esc_attr($review_details['saswp_review_schema_telephone']); } ?>" type="text" name="saswp_review_schema_telephone" placeholder="<?php echo esc_html__('Telephone', 'schema-and-structured-data-for-wp' ); ?>" ></td>
741
  </tr>
742
 
743
+
744
+
745
+ <tr class="saswp-review-text-field-tr" <?php echo $style_review_name; ?>>
746
+ <td><?php echo esc_html__('Review Rating', 'schema-and-structured-data-for-wp' ); ?></td>
747
+ <td>
748
+ <input class="saswp-enable-rating-review-review" type="checkbox" name="saswp_review_schema_enable_rating" value="1" <?php if(isset($review_details['saswp_review_schema_enable_rating'])){echo 'checked'; }else{ echo ''; } ?>>
749
+ </td>
750
+ </tr>
751
+ <tr class="saswp-review-text-field-tr saswp-rating-review-review" <?php echo $style_review_name; ?>>
752
+ <td><?php echo esc_html__('Rating Value', 'schema-and-structured-data-for-wp' ); ?></td>
753
+ <td><input value="<?php if(isset($review_details['saswp_review_schema_rating'])){echo esc_attr($review_details['saswp_review_schema_rating']); } ?>" type="text" name="saswp_review_schema_rating" placeholder="<?php echo esc_html__('5.0', 'schema-and-structured-data-for-wp' ); ?>" ></td>
754
+ </tr>
755
+ <tr class="saswp-review-text-field-tr saswp-rating-review-review" <?php echo $style_business_type; ?>>
756
+ <td><?php echo esc_html__('Best Rating', 'schema-and-structured-data-for-wp' ); ?></td>
757
+ <td><input value="<?php if(isset($review_details['saswp_review_schema_review_count'])){echo esc_attr($review_details['saswp_review_schema_review_count']); } ?>" type="text" name="saswp_review_schema_review_count" placeholder="<?php echo esc_html__('5.0', 'schema-and-structured-data-for-wp' ); ?>" ></td>
758
+ </tr>
759
+
760
+
761
  <!-- Review Schema type ends here -->
762
+
763
+ <!-- Product Schema type starts here -->
764
+
765
+ <tr class="saswp-product-text-field-tr">
766
+ <td><?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?></td>
767
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_name'])){echo esc_attr($product_details['saswp_product_schema_name']); } ?>" type="text" name="saswp_product_schema_name" placeholder="<?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
768
+ </tr>
769
+ <tr class="saswp-product-text-field-tr">
770
+ <td><?php echo esc_html__('Description', 'schema-and-structured-data-for-wp' ); ?></td>
771
+ <td><textarea placeholder="Description" rows="3" cols="70" name="saswp_product_schema_description"><?php if(isset($product_details['saswp_product_schema_description'])){echo esc_attr($product_details['saswp_product_schema_description']); } ?></textarea></td>
772
+ </tr>
773
+ <tr class="saswp-product-text-field-tr">
774
+ <td><?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?></td>
775
+ <td style="display: flex; width: 97%">
776
+ <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_url($product_details['saswp_product_schema_image']['url']);} else { echo esc_url(saswp_remove_warnings($logo, 0, 'saswp_string')); } ?>" id="saswp_product_schema_image" type="text" name="saswp_product_schema_image[url]" placeholder="<?php echo esc_html__('Image', 'schema-and-structured-data-for-wp' ); ?>" readonly="readonly" style="background: #FFF;">
777
+ <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_attr($product_details['saswp_product_schema_image']['id']);} else { echo esc_attr($custom_logo_id); }?>" data-id="saswp_product_schema_image_id" type="hidden" name="saswp_product_schema_image[id]">
778
+ <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_attr($product_details['saswp_product_schema_image']['width']);} else { echo esc_attr(saswp_remove_warnings($logo, 1, 'saswp_string')); } ?>" data-id="saswp_product_schema_image_width" type="hidden" name="saswp_product_schema_image[width]">
779
+ <input value="<?php if(isset($product_details['saswp_product_schema_image'])) { echo esc_attr($product_details['saswp_product_schema_image']['height']);} else { echo esc_attr(saswp_remove_warnings($logo, 2, 'saswp_string')); } ?>" data-id="saswp_product_schema_image_height" type="hidden" name="saswp_product_schema_image[height]">
780
+ <input data-id="media" class="button" id="saswp_product_schema_image_button" type="button" value="Upload">
781
+ </td>
782
+ </tr>
783
+
784
+ <tr class="saswp-product-text-field-tr">
785
+ <td><?php echo esc_html__('Brand Name', 'schema-and-structured-data-for-wp' ); ?></td>
786
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_brand_name'])){echo esc_attr($product_details['saswp_product_schema_brand_name']); } ?>" type="text" name="saswp_product_schema_brand_name" placeholder="<?php echo esc_html__('Brand Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
787
+ </tr>
788
+
789
+ <tr class="saswp-product-text-field-tr">
790
+ <td><?php echo esc_html__('Price', 'schema-and-structured-data-for-wp' ); ?></td>
791
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_price'])){echo esc_attr($product_details['saswp_product_schema_price']); } ?>" type="text" name="saswp_product_schema_price" placeholder="<?php echo esc_html__('Eg. 95.00', 'schema-and-structured-data-for-wp' ); ?>" ></td>
792
+ </tr>
793
+
794
+ <tr class="saswp-product-text-field-tr">
795
+ <td><?php echo esc_html__('Price Valid Until', 'schema-and-structured-data-for-wp' ); ?></td>
796
+ <td><input class="saswp-local-schema-datepicker-picker" value="<?php if(isset($product_details['saswp_product_schema_priceValidUntil'])){echo esc_attr($product_details['saswp_product_schema_priceValidUntil']); } ?>" type="text" name="saswp_product_schema_priceValidUntil"></td>
797
+ </tr>
798
+
799
+ <tr class="saswp-product-text-field-tr">
800
+ <td><?php echo esc_html__('Currency', 'schema-and-structured-data-for-wp' ); ?></td>
801
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_currency'])){echo esc_attr($product_details['saswp_product_schema_currency']); } ?>" type="text" name="saswp_product_schema_currency" placeholder="<?php echo esc_html__('Eg: GBP, RMB, USD', 'schema-and-structured-data-for-wp' ); ?>" ></td>
802
+ </tr>
803
+
804
+ <tr class="saswp-product-text-field-tr">
805
+ <td><?php echo esc_html__('Availability', 'schema-and-structured-data-for-wp' ); ?></td>
806
+ <td>
807
+ <select name="saswp_product_schema_availability">
808
+ <?php
809
+
810
+ foreach ($availability as $key => $value) {
811
+ $sel = '';
812
+ if(saswp_remove_warnings($product_details, 'saswp_product_schema_availability', 'saswp_string')==$key){
813
+ $sel = 'selected';
814
+ }
815
+ echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
816
+ }
817
+ ?>
818
+ </select>
819
+ </td>
820
+ </tr>
821
+
822
+ <tr class="saswp-product-text-field-tr">
823
+ <td><?php echo esc_html__('Item Condition', 'schema-and-structured-data-for-wp' ); ?></td>
824
+ <td>
825
+ <select name="saswp_product_schema_condition">
826
+ <?php
827
+
828
+ foreach ($item_condition as $key => $value) {
829
+ $sel = '';
830
+ if(saswp_remove_warnings($product_details, 'saswp_product_schema_condition', 'saswp_string')==$key){
831
+ $sel = 'selected';
832
+ }
833
+ echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
834
+ }
835
+ ?>
836
+ </select>
837
+ </td>
838
+ </tr>
839
+
840
+ <tr class="saswp-product-text-field-tr">
841
+ <td><?php echo esc_html__('SKU', 'schema-and-structured-data-for-wp' ); ?></td>
842
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_sku'])){echo esc_attr($product_details['saswp_product_schema_sku']); } ?>" type="text" name="saswp_product_schema_sku" ></td>
843
+ </tr>
844
+
845
+ <tr class="saswp-product-text-field-tr">
846
+ <td><?php echo esc_html__('MPN', 'schema-and-structured-data-for-wp' ); ?></td>
847
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_mpn'])){echo esc_attr($product_details['saswp_product_schema_mpn']); } ?>" type="text" name="saswp_product_schema_mpn" >
848
+ <span>OR</span>
849
+ </td>
850
+ </tr>
851
+
852
+ <tr class="saswp-product-text-field-tr">
853
+ <td><?php echo esc_html__('ISBN', 'schema-and-structured-data-for-wp' ); ?></td>
854
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_isbn'])){echo esc_attr($product_details['saswp_product_schema_isbn']); } ?>" type="text" name="saswp_product_schema_isbn" >
855
+ <span>OR</span>
856
+ </td>
857
+ </tr>
858
+ <tr class="saswp-product-text-field-tr">
859
+ <td><?php echo esc_html__('GTIN8', 'schema-and-structured-data-for-wp' ); ?></td>
860
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_gtin8'])){echo esc_attr($product_details['saswp_product_schema_gtin8']); } ?>" type="text" name="saswp_product_schema_gtin8" >
861
+ </td>
862
+ </tr>
863
+
864
+
865
+
866
+ <tr class="saswp-product-text-field-tr">
867
+ <td><?php echo esc_html__('Aggregate Rating', 'schema-and-structured-data-for-wp' ); ?></td>
868
+ <td>
869
+ <input class="saswp-enable-rating-review-product" type="checkbox" name="saswp_product_schema_enable_rating" value="1" <?php if(isset($product_details['saswp_product_schema_enable_rating'])){echo 'checked'; }else{ echo ''; } ?>>
870
+ </td>
871
+ </tr>
872
+
873
+ <tr class="saswp-product-text-field-tr saswp-rating-review-product">
874
+ <td><?php echo esc_html__('Rating', 'schema-and-structured-data-for-wp' ); ?></td>
875
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_rating'])){echo esc_attr($product_details['saswp_product_schema_rating']); } ?>" type="text" name="saswp_product_schema_rating" placeholder="<?php echo esc_html__('5.0', 'schema-and-structured-data-for-wp' ); ?>" ></td>
876
+ </tr>
877
+ <tr class="saswp-product-text-field-tr saswp-rating-review-product">
878
+ <td><?php echo esc_html__('Number of Reviews', 'schema-and-structured-data-for-wp' ); ?></td>
879
+ <td><input value="<?php if(isset($product_details['saswp_product_schema_review_count'])){echo esc_attr($product_details['saswp_product_schema_review_count']); } ?>" type="text" name="saswp_product_schema_review_count" placeholder="<?php echo esc_html__('10', 'schema-and-structured-data-for-wp' ); ?>" ></td>
880
+ </tr>
881
+
882
+ <!-- Product Schema type ends here -->
883
+
884
+ <!-- AudioObject Schema type starts here -->
885
+
886
+ <tr class="saswp-audio-text-field-tr">
887
+ <td><?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?></td>
888
+ <td><input value="<?php if(isset($audio_details['saswp_audio_schema_name'])){echo esc_attr($audio_details['saswp_audio_schema_name']); } ?>" type="text" name="saswp_audio_schema_name" placeholder="<?php echo esc_html__('Name', 'schema-and-structured-data-for-wp' ); ?>" ></td>
889
+ </tr>
890
+
891
+ <tr class="saswp-audio-text-field-tr">
892
+ <td><?php echo esc_html__('Description', 'schema-and-structured-data-for-wp' ); ?></td>
893
+ <td>
894
+ <textarea placeholder="Description" rows="5" cols="70" name="saswp_audio_schema_description"><?php if(isset($audio_details['saswp_audio_schema_description'])){echo $audio_details['saswp_audio_schema_description']; } ?></textarea>
895
+ </td>
896
+ </tr>
897
+
898
+ <tr class="saswp-audio-text-field-tr">
899
+ <td><?php echo esc_html__('Content Url', 'schema-and-structured-data-for-wp' ); ?></td>
900
+ <td><input value="<?php if(isset($audio_details['saswp_audio_schema_contenturl'])){echo esc_attr($audio_details['saswp_audio_schema_contenturl']); } ?>" type="text" name="saswp_audio_schema_contenturl" placeholder="<?php echo esc_html__('Content Url', 'schema-and-structured-data-for-wp' ); ?>" ></td>
901
+ </tr>
902
+
903
+ <tr class="saswp-audio-text-field-tr">
904
+ <td><?php echo esc_html__('Duration', 'schema-and-structured-data-for-wp' ); ?></td>
905
+ <td><input value="<?php if(isset($audio_details['saswp_audio_schema_duration'])){echo esc_attr($audio_details['saswp_audio_schema_duration']); } ?>" type="text" name="saswp_audio_schema_duration" placeholder="<?php echo esc_html__('T0M15S', 'schema-and-structured-data-for-wp' ); ?>" ></td>
906
+ </tr>
907
+
908
+ <tr class="saswp-audio-text-field-tr">
909
+ <td><?php echo esc_html__('Encoding Format', 'schema-and-structured-data-for-wp' ); ?></td>
910
+ <td><input value="<?php if(isset($audio_details['saswp_audio_schema_encoding_format'])){echo esc_attr($audio_details['saswp_audio_schema_encoding_format']); } ?>" type="text" name="saswp_audio_schema_encoding_format" placeholder="<?php echo esc_html__('audio/mpeg', 'schema-and-structured-data-for-wp' ); ?>" ></td>
911
+ </tr>
912
+
913
+ <!-- AudioObject Schema type ends here -->
914
+
915
+
916
  </table>
917
 
918
  </div>
977
  if ( isset( $_POST['local_price_range'] ) ){
978
  $local_business_details['local_price_range'] = sanitize_text_field($_POST['local_price_range']);
979
  }
980
+
981
+ if ( isset( $_POST['local_enable_rating'] ) ){
982
+ $local_business_details['local_enable_rating'] = sanitize_text_field($_POST['local_enable_rating']);
983
+ }
984
+ if ( isset( $_POST['local_rating'] ) ){
985
+ $local_business_details['local_rating'] = sanitize_text_field($_POST['local_rating']);
986
+ }
987
+ if ( isset( $_POST['local_review_count'] ) ){
988
+ $local_business_details['local_review_count'] = sanitize_text_field($_POST['local_review_count']);
989
+ }
990
+
991
 
992
  update_post_meta( $post_id, 'saswp_local_business_details', $local_business_details );
993
 
994
  //Service schema details starts here
995
  $service_schema_details = array();
996
  $review_schema_details = array();
997
+ $product_schema_details = array();
998
+ $audio_schema_details = array();
999
+ $schema_type = sanitize_text_field($_POST['schema_type']);
1000
 
1001
  if($schema_type =='Service'){
1002
  if ( isset( $_POST['saswp_service_schema_name'] ) ){
1037
  }
1038
  if ( isset( $_POST['saswp_service_schema_service_offer'] ) ){
1039
  $service_schema_details['saswp_service_schema_service_offer'] = sanitize_textarea_field($_POST['saswp_service_schema_service_offer']);
1040
+ }
1041
+
1042
+ if ( isset( $_POST['saswp_service_schema_enable_rating'] ) ){
1043
+ $service_schema_details['saswp_service_schema_enable_rating'] = sanitize_text_field($_POST['saswp_service_schema_enable_rating']);
1044
+ }
1045
+ if ( isset( $_POST['saswp_service_schema_rating'] ) ){
1046
+ $service_schema_details['saswp_service_schema_rating'] = sanitize_text_field($_POST['saswp_service_schema_rating']);
1047
+ }
1048
+ if ( isset( $_POST['saswp_service_schema_review_count'] ) ){
1049
+ $service_schema_details['saswp_service_schema_review_count'] = sanitize_text_field($_POST['saswp_service_schema_review_count']);
1050
+ }
1051
+ update_post_meta( $post_id, 'saswp_service_schema_details', $service_schema_details );
1052
+ }
1053
 
1054
 
1055
  if($schema_type =='Review'){
1068
  $review_schema_details['saswp_review_schema_image']['width'] = sanitize_text_field($_POST['saswp_review_schema_image']['width']);
1069
  $review_schema_details['saswp_review_schema_image']['height'] = sanitize_text_field($_POST['saswp_review_schema_image']['height']);
1070
  }
1071
+ if ( isset( $_POST['saswp_review_schema_author'] ) ){
1072
+ $review_schema_details['saswp_review_schema_author'] = sanitize_text_field($_POST['saswp_review_schema_author']);
1073
+ }
1074
  if ( isset( $_POST['saswp_review_schema_price_range'] ) ){
1075
  $review_schema_details['saswp_review_schema_price_range'] = sanitize_text_field($_POST['saswp_review_schema_price_range']);
1076
  }
1091
  }
1092
  if ( isset( $_POST['saswp_review_schema_telephone'] ) ){
1093
  $review_schema_details['saswp_review_schema_telephone'] = sanitize_text_field($_POST['saswp_review_schema_telephone']);
1094
+ }
1095
+
1096
+ if ( isset( $_POST['saswp_review_schema_enable_rating'] ) ){
1097
+ $review_schema_details['saswp_review_schema_enable_rating'] = sanitize_text_field($_POST['saswp_review_schema_enable_rating']);
1098
+ }
1099
+ if ( isset( $_POST['saswp_review_schema_rating'] ) ){
1100
+ $review_schema_details['saswp_review_schema_rating'] = sanitize_text_field($_POST['saswp_review_schema_rating']);
1101
+ }
1102
+ if ( isset( $_POST['saswp_review_schema_review_count'] ) ){
1103
+ $review_schema_details['saswp_review_schema_review_count'] = sanitize_text_field($_POST['saswp_review_schema_review_count']);
1104
+ }
1105
+
1106
  update_post_meta( $post_id, 'saswp_review_schema_details', $review_schema_details );
1107
+ }
1108
+
1109
+ if($schema_type =='Product'){
1110
+
1111
+ if ( isset( $_POST['saswp_product_schema_name'] ) ){
1112
+ $product_schema_details['saswp_product_schema_name'] = sanitize_text_field($_POST['saswp_product_schema_name']);
1113
+ }
1114
+ if ( isset( $_POST['saswp_product_schema_description'] ) ){
1115
+ $product_schema_details['saswp_product_schema_description'] = sanitize_textarea_field($_POST['saswp_product_schema_description']);
1116
+ }
1117
+ if ( isset( $_POST['saswp_product_schema_image'] ) ){
1118
+ $product_schema_details['saswp_product_schema_image']['id'] = sanitize_text_field($_POST['saswp_product_schema_image']['id']);
1119
+ $product_schema_details['saswp_product_schema_image']['url'] = esc_url_raw($_POST['saswp_product_schema_image']['url']);
1120
+ $product_schema_details['saswp_product_schema_image']['width'] = sanitize_text_field($_POST['saswp_product_schema_image']['width']);
1121
+ $product_schema_details['saswp_product_schema_image']['height'] = sanitize_text_field($_POST['saswp_product_schema_image']['height']);
1122
+ }
1123
+
1124
+ if ( isset( $_POST['saswp_product_schema_brand_name'] ) ){
1125
+ $product_schema_details['saswp_product_schema_brand_name'] = sanitize_text_field($_POST['saswp_product_schema_brand_name']);
1126
+ }
1127
+ if ( isset( $_POST['saswp_product_schema_price'] ) ){
1128
+ $product_schema_details['saswp_product_schema_price'] = sanitize_text_field($_POST['saswp_product_schema_price']);
1129
+ }
1130
+ if ( isset( $_POST['saswp_product_schema_currency'] ) ){
1131
+ $product_schema_details['saswp_product_schema_currency'] = sanitize_text_field($_POST['saswp_product_schema_currency']);
1132
+ }
1133
+ if ( isset( $_POST['saswp_product_schema_availability'] ) ){
1134
+ $product_schema_details['saswp_product_schema_availability'] = sanitize_text_field($_POST['saswp_product_schema_availability']);
1135
+ }
1136
+ if ( isset( $_POST['saswp_product_schema_condition'] ) ){
1137
+ $product_schema_details['saswp_product_schema_condition'] = sanitize_text_field($_POST['saswp_product_schema_condition']);
1138
+ }
1139
+
1140
+
1141
+ if ( isset( $_POST['saswp_product_schema_sku'] ) ){
1142
+ $product_schema_details['saswp_product_schema_sku'] = sanitize_text_field($_POST['saswp_product_schema_sku']);
1143
+ }
1144
+ if ( isset( $_POST['saswp_product_schema_mpn'] ) ){
1145
+ $product_schema_details['saswp_product_schema_mpn'] = sanitize_text_field($_POST['saswp_product_schema_mpn']);
1146
+ }
1147
+ if ( isset( $_POST['saswp_product_schema_isbn'] ) ){
1148
+ $product_schema_details['saswp_product_schema_isbn'] = sanitize_text_field($_POST['saswp_product_schema_isbn']);
1149
+ }
1150
+ if ( isset( $_POST['saswp_product_schema_gtin8'] ) ){
1151
+ $product_schema_details['saswp_product_schema_gtin8'] = sanitize_text_field($_POST['saswp_product_schema_gtin8']);
1152
+ }
1153
+ if ( isset( $_POST['saswp_product_schema_priceValidUntil'] ) ){
1154
+ $product_schema_details['saswp_product_schema_priceValidUntil'] = sanitize_text_field($_POST['saswp_product_schema_priceValidUntil']);
1155
+ }
1156
+
1157
+ if ( isset( $_POST['saswp_product_schema_enable_rating'] ) ){
1158
+ $product_schema_details['saswp_product_schema_enable_rating'] = sanitize_text_field($_POST['saswp_product_schema_enable_rating']);
1159
+ }
1160
+ if ( isset( $_POST['saswp_product_schema_rating'] ) ){
1161
+ $product_schema_details['saswp_product_schema_rating'] = sanitize_text_field($_POST['saswp_product_schema_rating']);
1162
+ }
1163
+ if ( isset( $_POST['saswp_product_schema_review_count'] ) ){
1164
+ $product_schema_details['saswp_product_schema_review_count'] = sanitize_text_field($_POST['saswp_product_schema_review_count']);
1165
+ }
1166
+
1167
+ update_post_meta( $post_id, 'saswp_product_schema_details', $product_schema_details );
1168
+ }
1169
+
1170
+ if($schema_type =='AudioObject'){
1171
+
1172
+ if ( isset( $_POST['saswp_audio_schema_name'] ) ){
1173
+ $audio_schema_details['saswp_audio_schema_name'] = sanitize_text_field($_POST['saswp_audio_schema_name']);
1174
+ }
1175
+ if ( isset( $_POST['saswp_audio_schema_description'] ) ){
1176
+ $audio_schema_details['saswp_audio_schema_description'] = sanitize_textarea_field($_POST['saswp_audio_schema_description']);
1177
+ }
1178
+ if ( isset( $_POST['saswp_audio_schema_contenturl'] ) ){
1179
+ $audio_schema_details['saswp_audio_schema_contenturl'] = esc_url_raw($_POST['saswp_audio_schema_contenturl']);
1180
+ }
1181
+ if ( isset( $_POST['saswp_audio_schema_duration'] ) ){
1182
+ $audio_schema_details['saswp_audio_schema_duration'] = sanitize_text_field($_POST['saswp_audio_schema_duration']);
1183
+ }
1184
+ if ( isset( $_POST['saswp_audio_schema_encoding_format'] ) ){
1185
+ $audio_schema_details['saswp_audio_schema_encoding_format'] = sanitize_text_field($_POST['saswp_audio_schema_encoding_format']);
1186
+ }
1187
+
1188
+ update_post_meta( $post_id, 'saswp_audio_schema_details', $audio_schema_details );
1189
+
1190
+
1191
+ }
1192
  //Service schema details ends here
1193
 
1194