Schema & Structured Data for WP & AMP - Version 1.4

Version Description

(25 March 2019) =

  • Bug Fixed: Security improvement.
Download this release

Release Info

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

Code changes from version 1.3.1 to 1.4

admin_section/add-schema/add_new.php CHANGED
@@ -20,12 +20,12 @@ $saswp_add_data_type_config = array(
20
  1=>array(
21
  'title'=>esc_html__('Select Schema', 'schema-and-structured-data-for-wp'),
22
  'description'=>esc_html__('Where would you like to enable the schema?','schema-and-structured-data-for-wp'),
23
- 'fields'=>saswp_add_new_schema_type_selection(),
24
  ),
25
  2=>array(
26
  'title'=>esc_html__('Placement', 'schema-and-structured-data-for-wp'),
27
  'description'=>esc_html__('Where would you like this to be displayed?','schema-and-structured-data-for-wp'),
28
- 'fields'=>saswp_add_new_placement_selection(),
29
  ),
30
  3=>array(
31
  'title'=>esc_html__('Enjoy', 'schema-and-structured-data-for-wp'),
@@ -34,7 +34,7 @@ $saswp_add_data_type_config = array(
34
  ),
35
 
36
  ),
37
- 'current_step' =>array(
38
  'title'=>'',
39
  'step_id'=>1
40
  )
@@ -49,20 +49,20 @@ $saswp_add_data_type_config = array(
49
  function saswp_add_new_init(){
50
  // Exit if the user does not have proper permissions
51
  if(! current_user_can( 'manage_options' ) ) {
52
- return ;
53
  }
54
- if(!isset($_GET['_wpnonce'])){
55
-
56
- return ;
57
-
58
  }else{
59
 
60
- $wp_nonce = $_GET['_wpnonce'];
 
61
  if( wp_verify_nonce($wp_nonce, '_wpnonce')){
62
 
63
  saswp_add_new_steps_call();
64
 
65
- }
66
 
67
  }
68
 
@@ -207,9 +207,7 @@ $saswp_add_data_type_config = array(
207
  <h1><?php echo esc_attr($stepDetails['title']); ?></h1>
208
 
209
  <p><?php echo isset($stepDetails['description'])? $stepDetails['description'] : ''; ?></p>
210
-
211
-
212
-
213
  </div>
214
  <form action="" method="post">
215
 
@@ -245,6 +243,7 @@ $saswp_add_data_type_config = array(
245
 
246
  global $saswp_add_data_type_config;
247
  $stepDetails = $saswp_add_data_type_config['steps'][$saswp_add_data_type_config['current_step']['step_id']];
 
248
  ?>
249
 
250
  <div class="merlin__content--transition">
@@ -257,6 +256,7 @@ $saswp_add_data_type_config = array(
257
  <h1><?php echo esc_attr($stepDetails['title']); ?></h1>
258
  <p><?php echo isset($stepDetails['description'])? $stepDetails['description'] : ''; ?></p>
259
  </div>
 
260
  <form action="" method="post">
261
 
262
  <div id="saswp_amp_select" class="postbox">
@@ -363,12 +363,14 @@ $saswp_add_data_type_config = array(
363
  if ( ! isset( $_POST['wpnonce'] ) ){
364
  return;
365
  }
 
366
  if ( !wp_verify_nonce( $_POST['wpnonce'], 'saswp_add_new_nonce' ) ){
367
  return;
368
- }
 
369
  if(isset($_POST['schema_type'])){
370
 
371
- $schema_type = $_POST['schema_type'];
372
 
373
  if($schema_type == 'local_business'){
374
 
@@ -380,11 +382,11 @@ $saswp_add_data_type_config = array(
380
 
381
  $schema_post = array(
382
  'post_author' => $user_id,
383
- 'post_date' => date("Y-m-d"),
384
- 'post_title' => ucfirst($schema_type),
385
  'post_status' => 'publish',
386
- 'post_name' => ucfirst($schema_type),
387
- 'post_type' => 'saswp',
388
  );
389
 
390
  $post_id = wp_insert_post($schema_post);
@@ -400,21 +402,23 @@ $saswp_add_data_type_config = array(
400
  $temp_condition_array = array();
401
  $show_globally = false;
402
  $post_data_group_array = $_POST['data_group_array'];
 
403
 
404
- foreach($post_data_group_array as $groups){
405
-
406
- foreach($groups['data_array'] as $group ){
407
-
408
- if(array_search('show_globally', $group))
409
- {
410
-
411
- $temp_condition_array[0] = $group;
412
- $show_globally = true;
413
-
414
- }
415
-
416
- }
417
- }
 
418
 
419
  if($show_globally){
420
 
@@ -446,6 +450,7 @@ $saswp_add_data_type_config = array(
446
  <a href="<?php echo esc_url( saswp_add_new_step_next_link() ); ?>" class="merlin__button merlin__button--skip"><?php echo esc_html__( 'Skip', 'schema-and-structured-data-for-wp' ); ?></a>
447
  <?php
448
  }
 
449
  function saswp_add_new_finish_page() {
450
 
451
  global $saswp_add_data_type_config;
@@ -479,9 +484,9 @@ $saswp_add_data_type_config = array(
479
  $last_post_id = json_decode(get_transient('saswp_last_post_id'), true);
480
 
481
  if(isset($last_post_id['post_id'])){
482
- $lets_go = esc_url( admin_url( 'post.php?post='.$last_post_id['post_id'].'&action=edit' ) );
483
  }else{
484
- $lets_go = esc_url( admin_url( 'edit.php?post_type=saswp' ) );
485
  }
486
  ?>
487
 
@@ -502,6 +507,7 @@ $saswp_add_data_type_config = array(
502
  }
503
 
504
  function saswp_add_new_loading_spinner(){
 
505
  global $saswp_add_data_type_config;
506
  $spinner = SASWP_DIR_NAME. $saswp_add_data_type_config['installer_dir']. '/images/spinner.php';
507
 
@@ -510,6 +516,7 @@ $saswp_add_data_type_config = array(
510
  }
511
 
512
  function saswp_add_new_svg_sprite() {
 
513
  global $saswp_add_data_type_config;
514
  // Define SVG sprite file.
515
  $svg = SASWP_DIR_NAME. $saswp_add_data_type_config['installer_dir'] . '/images/sprite.svg' ;
@@ -531,6 +538,7 @@ $saswp_add_data_type_config = array(
531
  }
532
 
533
  function saswp_add_new_install_header() {
 
534
  global $saswp_add_data_type_config;
535
 
536
  // Get the current step.
@@ -630,9 +638,9 @@ $saswp_add_data_type_config = array(
630
 
631
  $array = array(
632
  'svg' => array(
633
- 'class' => array(),
634
  'aria-hidden' => array(),
635
- 'role' => array(),
636
  ),
637
  'use' => array(
638
  'xlink:href' => array(),
@@ -669,15 +677,5 @@ $saswp_add_data_type_config = array(
669
 
670
  </ol>
671
  <?php
672
- }
673
-
674
-
675
- function saswp_add_new_schema_type_selection(){
676
-
677
- }
678
- function saswp_add_new_placement_selection(){
679
-
680
- }
681
-
682
-
683
  ?>
20
  1=>array(
21
  'title'=>esc_html__('Select Schema', 'schema-and-structured-data-for-wp'),
22
  'description'=>esc_html__('Where would you like to enable the schema?','schema-and-structured-data-for-wp'),
23
+
24
  ),
25
  2=>array(
26
  'title'=>esc_html__('Placement', 'schema-and-structured-data-for-wp'),
27
  'description'=>esc_html__('Where would you like this to be displayed?','schema-and-structured-data-for-wp'),
28
+
29
  ),
30
  3=>array(
31
  'title'=>esc_html__('Enjoy', 'schema-and-structured-data-for-wp'),
34
  ),
35
 
36
  ),
37
+ 'current_step' => array(
38
  'title'=>'',
39
  'step_id'=>1
40
  )
49
  function saswp_add_new_init(){
50
  // Exit if the user does not have proper permissions
51
  if(! current_user_can( 'manage_options' ) ) {
52
+ return ;
53
  }
54
+
55
+ if(!isset($_GET['_wpnonce'])){
56
+ return ;
 
57
  }else{
58
 
59
+ $wp_nonce = $_GET['_wpnonce'];
60
+
61
  if( wp_verify_nonce($wp_nonce, '_wpnonce')){
62
 
63
  saswp_add_new_steps_call();
64
 
65
+ }
66
 
67
  }
68
 
207
  <h1><?php echo esc_attr($stepDetails['title']); ?></h1>
208
 
209
  <p><?php echo isset($stepDetails['description'])? $stepDetails['description'] : ''; ?></p>
210
+
 
 
211
  </div>
212
  <form action="" method="post">
213
 
243
 
244
  global $saswp_add_data_type_config;
245
  $stepDetails = $saswp_add_data_type_config['steps'][$saswp_add_data_type_config['current_step']['step_id']];
246
+
247
  ?>
248
 
249
  <div class="merlin__content--transition">
256
  <h1><?php echo esc_attr($stepDetails['title']); ?></h1>
257
  <p><?php echo isset($stepDetails['description'])? $stepDetails['description'] : ''; ?></p>
258
  </div>
259
+
260
  <form action="" method="post">
261
 
262
  <div id="saswp_amp_select" class="postbox">
363
  if ( ! isset( $_POST['wpnonce'] ) ){
364
  return;
365
  }
366
+
367
  if ( !wp_verify_nonce( $_POST['wpnonce'], 'saswp_add_new_nonce' ) ){
368
  return;
369
+ }
370
+
371
  if(isset($_POST['schema_type'])){
372
 
373
+ $schema_type = sanitize_text_field($_POST['schema_type']);
374
 
375
  if($schema_type == 'local_business'){
376
 
382
 
383
  $schema_post = array(
384
  'post_author' => $user_id,
385
+ 'post_date' => date("Y-m-d"),
386
+ 'post_title' => ucfirst($schema_type),
387
  'post_status' => 'publish',
388
+ 'post_name' => ucfirst($schema_type),
389
+ 'post_type' => 'saswp',
390
  );
391
 
392
  $post_id = wp_insert_post($schema_post);
402
  $temp_condition_array = array();
403
  $show_globally = false;
404
  $post_data_group_array = $_POST['data_group_array'];
405
+ if(is_array($post_data_group_array)){
406
 
407
+ foreach($post_data_group_array as $groups){
408
+
409
+ foreach($groups['data_array'] as $group ){
410
+
411
+ if(array_search('show_globally', $group))
412
+ {
413
+
414
+ $temp_condition_array[0] = $group;
415
+ $show_globally = true;
416
+
417
+ }
418
+
419
+ }
420
+ }
421
+ }
422
 
423
  if($show_globally){
424
 
450
  <a href="<?php echo esc_url( saswp_add_new_step_next_link() ); ?>" class="merlin__button merlin__button--skip"><?php echo esc_html__( 'Skip', 'schema-and-structured-data-for-wp' ); ?></a>
451
  <?php
452
  }
453
+
454
  function saswp_add_new_finish_page() {
455
 
456
  global $saswp_add_data_type_config;
484
  $last_post_id = json_decode(get_transient('saswp_last_post_id'), true);
485
 
486
  if(isset($last_post_id['post_id'])){
487
+ $lets_go = esc_url( admin_url( 'post.php?post='.$last_post_id['post_id'].'&action=edit' ) );
488
  }else{
489
+ $lets_go = esc_url( admin_url( 'edit.php?post_type=saswp' ) );
490
  }
491
  ?>
492
 
507
  }
508
 
509
  function saswp_add_new_loading_spinner(){
510
+
511
  global $saswp_add_data_type_config;
512
  $spinner = SASWP_DIR_NAME. $saswp_add_data_type_config['installer_dir']. '/images/spinner.php';
513
 
516
  }
517
 
518
  function saswp_add_new_svg_sprite() {
519
+
520
  global $saswp_add_data_type_config;
521
  // Define SVG sprite file.
522
  $svg = SASWP_DIR_NAME. $saswp_add_data_type_config['installer_dir'] . '/images/sprite.svg' ;
538
  }
539
 
540
  function saswp_add_new_install_header() {
541
+
542
  global $saswp_add_data_type_config;
543
 
544
  // Get the current step.
638
 
639
  $array = array(
640
  'svg' => array(
641
+ 'class' => array(),
642
  'aria-hidden' => array(),
643
+ 'role' => array(),
644
  ),
645
  'use' => array(
646
  'xlink:href' => array(),
677
 
678
  </ol>
679
  <?php
680
+ }
 
 
 
 
 
 
 
 
 
 
681
  ?>
admin_section/ajax-selectbox.php CHANGED
@@ -108,9 +108,11 @@ function saswp_ajax_select_creator($data = '', $saved_data= '', $current_number
108
  );
109
 
110
  $templates = get_page_templates();
111
- foreach($templates as $k => $v)
112
- {
 
113
  $choices[$v] = $k;
 
114
  }
115
 
116
  break;
@@ -123,9 +125,8 @@ function saswp_ajax_select_creator($data = '', $saved_data= '', $current_number
123
 
124
  if( $post_types )
125
  {
126
- foreach( $post_types as $post_type )
127
- {
128
-
129
  $posts = get_posts(array(
130
 
131
  'numberposts' => '-1',
@@ -135,17 +136,16 @@ function saswp_ajax_select_creator($data = '', $saved_data= '', $current_number
135
 
136
  ));
137
 
138
- if( $posts)
139
- {
140
  $choices[$post_type] = array();
141
 
142
- foreach($posts as $post)
143
- {
144
  $title = apply_filters( 'the_title', $post->post_title, $post->ID );
145
-
146
  // status
147
- if($post->post_status != "publish")
148
- {
149
  $title .= " ($post->post_status)";
150
  }
151
 
@@ -191,9 +191,10 @@ function saswp_ajax_select_creator($data = '', $saved_data= '', $current_number
191
 
192
  $choices = $wp_roles->get_names();
193
 
194
- if( is_multisite() )
195
- {
196
  $choices['super_admin'] = esc_html__('Super Admin','schema-and-structured-data-for-wp');
 
197
  }
198
 
199
  break;
@@ -299,7 +300,9 @@ function saswp_create_ajax_select_taxonomy($selectedParentValue = '',$selectedVa
299
  if( $_SERVER['REQUEST_METHOD']=='POST'){
300
 
301
  $is_ajax = true;
302
-
 
 
303
  if(wp_verify_nonce($_POST["saswp_call_nonce"],'saswp_select_action_nonce')){
304
 
305
  if(isset($_POST['id'])){
@@ -350,6 +353,7 @@ function saswp_create_ajax_select_taxonomy($selectedParentValue = '',$selectedVa
350
 
351
  }
352
  $choices .= '<option value="'.esc_attr($taxonomy->slug).'" '.esc_attr($sel).'>'.esc_html__($taxonomy->name,'schema-and-structured-data-for-wp').'</option>';
 
353
  }
354
 
355
  $allowed_html = saswp_expanded_allowed_tags();
108
  );
109
 
110
  $templates = get_page_templates();
111
+
112
+ foreach($templates as $k => $v){
113
+
114
  $choices[$v] = $k;
115
+
116
  }
117
 
118
  break;
125
 
126
  if( $post_types )
127
  {
128
+ foreach( $post_types as $post_type ){
129
+
 
130
  $posts = get_posts(array(
131
 
132
  'numberposts' => '-1',
136
 
137
  ));
138
 
139
+ if( $posts){
140
+
141
  $choices[$post_type] = array();
142
 
143
+ foreach($posts as $post){
144
+
145
  $title = apply_filters( 'the_title', $post->post_title, $post->ID );
 
146
  // status
147
+ if($post->post_status != "publish"){
148
+
149
  $title .= " ($post->post_status)";
150
  }
151
 
191
 
192
  $choices = $wp_roles->get_names();
193
 
194
+ if( is_multisite() ){
195
+
196
  $choices['super_admin'] = esc_html__('Super Admin','schema-and-structured-data-for-wp');
197
+
198
  }
199
 
200
  break;
300
  if( $_SERVER['REQUEST_METHOD']=='POST'){
301
 
302
  $is_ajax = true;
303
+ if(! current_user_can( 'manage_options' ) ) {
304
+ exit;
305
+ }
306
  if(wp_verify_nonce($_POST["saswp_call_nonce"],'saswp_select_action_nonce')){
307
 
308
  if(isset($_POST['id'])){
353
 
354
  }
355
  $choices .= '<option value="'.esc_attr($taxonomy->slug).'" '.esc_attr($sel).'>'.esc_html__($taxonomy->name,'schema-and-structured-data-for-wp').'</option>';
356
+
357
  }
358
 
359
  $allowed_html = saswp_expanded_allowed_tags();
admin_section/common-function.php CHANGED
@@ -11,7 +11,8 @@
11
  $url = get_option('saswp-file-upload_url');
12
  global $wpdb;
13
  $result ='';
14
-
 
15
  if($url){
16
 
17
  $json_data = file_get_contents($url);
@@ -20,18 +21,19 @@
20
 
21
  $sd_data = $json_array['sd_data'];
22
  $schema_post = array();
23
-
24
 
25
  if($all_schema_post){
26
  // begin transaction
27
  $wpdb->query('START TRANSACTION');
 
28
 
29
  foreach($all_schema_post as $schema_post){
30
 
31
  $post_id = wp_insert_post($schema_post['post']);
32
  $result = $post_id;
33
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
34
- $wpdb->get_results("UPDATE wp_posts SET guid ='".$guid."' WHERE ID ='".$post_id."'");
35
 
36
  if ( isset( $schema_post['schema_type'] ) ){
37
  update_post_meta( $post_id, 'schema_type', esc_attr( $schema_post['schema_type'] ) );
@@ -51,13 +53,16 @@
51
  if ( isset( $schema_post['data_group_array'] ) ){
52
  update_post_meta( $post_id, 'data_group_array', $schema_post['data_group_array'] );
53
  }
 
 
 
54
  }
55
  }
56
  update_option('sd_data', $sd_data);
57
  update_option('saswp-file-upload_url','');
58
  }
59
- if (is_wp_error($result) ){
60
- echo esc_attr($result->get_error_message());
61
  $wpdb->query('ROLLBACK');
62
  }else{
63
  $wpdb->query('COMMIT');
@@ -165,6 +170,7 @@
165
  function saswp_import_schema_plugin_data(){
166
 
167
  $schema_post = array();
 
168
  global $wpdb;
169
  $user_id = get_current_user_id();
170
 
@@ -179,6 +185,7 @@
179
  if($all_schema_post){
180
  // begin transaction
181
  $wpdb->query('START TRANSACTION');
 
182
  foreach($all_schema_post as $schema){
183
 
184
  $schema_post = array(
@@ -210,7 +217,7 @@
210
  $post_id = wp_insert_post($schema_post);
211
  $result = $post_id;
212
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
213
- $wpdb->get_results("UPDATE wp_posts SET guid ='".$guid."' WHERE ID ='".$post_id."'");
214
 
215
  $schema_post_meta = get_post_meta($schema->ID, $key='', true );
216
  $schema_post_types = get_post_meta($schema->ID, $key='_schema_post_types', true );
@@ -254,6 +261,9 @@
254
  foreach ($saswp_meta_key as $key => $val){
255
  update_post_meta($post_id, $key, $val);
256
  }
 
 
 
257
  }
258
 
259
  //Importing settings starts here
@@ -352,8 +362,8 @@
352
  update_option('sd_data', $saswp_plugin_options);
353
  //Importing settings ends here
354
 
355
- if (is_wp_error($result) ){
356
- echo esc_attr($result->get_error_message());
357
  $wpdb->query('ROLLBACK');
358
  }else{
359
  $wpdb->query('COMMIT');
@@ -456,7 +466,7 @@
456
 
457
  $local_business_details = array();
458
  $wpdb->query('START TRANSACTION');
459
-
460
  $user_id = get_current_user_id();
461
 
462
  if($settings['seop_local_name'] !=''){
@@ -506,7 +516,7 @@
506
  $post_id = wp_insert_post($schema_post);
507
  $result = $post_id;
508
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
509
- $wpdb->get_results("UPDATE wp_posts SET guid ='".$guid."' WHERE ID ='".$post_id."'");
510
 
511
  $data_group_array = array();
512
 
@@ -531,15 +541,17 @@
531
  foreach ($saswp_meta_key as $key => $val){
532
  update_post_meta($post_id, $key, $val);
533
  }
534
-
 
 
535
  }
536
 
537
  $get_options = get_option('sd_data');
538
  $merge_options = array_merge($get_options, $social_fields);
539
  $result = update_option('sd_data', $merge_options);
540
 
541
- if (is_wp_error($result) ){
542
- echo esc_attr($result->get_error_message());
543
  $wpdb->query('ROLLBACK');
544
  }else{
545
  $wpdb->query('COMMIT');
@@ -559,7 +571,7 @@
559
  $saswp_plugin_options = array();
560
  $local_business_details = array();
561
  $wpdb->query('START TRANSACTION');
562
-
563
  $user_id = get_current_user_id();
564
 
565
  if($settings['site_type'] !='Organization'){
@@ -617,7 +629,7 @@
617
  $post_id = wp_insert_post($schema_post);
618
  $result = $post_id;
619
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
620
- $wpdb->get_results("UPDATE wp_posts SET guid ='".$guid."' WHERE ID ='".$post_id."'");
621
 
622
  $data_group_array = array();
623
 
@@ -641,6 +653,9 @@
641
  foreach ($saswp_meta_key as $key => $val){
642
  update_post_meta($post_id, $key, $val);
643
  }
 
 
 
644
 
645
  }
646
 
@@ -693,8 +708,8 @@
693
  $merge_options = array_merge($get_options, $saswp_plugin_options);
694
  $result = update_option('sd_data', $merge_options);
695
 
696
- if (is_wp_error($result) ){
697
- echo esc_attr($result->get_error_message());
698
  $wpdb->query('ROLLBACK');
699
  }else{
700
  $wpdb->query('COMMIT');
@@ -721,6 +736,7 @@
721
  if($all_schema_post){
722
  // begin transaction
723
  $wpdb->query('START TRANSACTION');
 
724
  foreach($all_schema_post as $schema){
725
 
726
  $schema_post = array(
@@ -751,7 +767,7 @@
751
  $post_id = wp_insert_post($schema_post);
752
  $result = $post_id;
753
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
754
- $wpdb->get_results("UPDATE wp_posts SET guid ='".$guid."' WHERE ID ='".$post_id."'");
755
 
756
  $schema_post_meta = get_post_meta($schema->ID, $key='', true );
757
  $schema_post_types = get_post_meta($schema->ID, $key='bsf-aiosrs-schema-type', true );
@@ -1009,8 +1025,10 @@
1009
  update_post_meta($post_id, $key, $val);
1010
 
1011
  }
1012
-
1013
- }
 
 
1014
  //Importing settings starts here
1015
 
1016
  $schema_pro_general_settings = get_option('wp-schema-pro-general-settings');
@@ -1094,8 +1112,8 @@
1094
  update_option('sd_data', $merge_options);
1095
 
1096
 
1097
- if (is_wp_error($result) ){
1098
- echo esc_attr($result->get_error_message());
1099
  $wpdb->query('ROLLBACK');
1100
  }else{
1101
  $wpdb->query('COMMIT');
11
  $url = get_option('saswp-file-upload_url');
12
  global $wpdb;
13
  $result ='';
14
+ $errorDesc = array();
15
+
16
  if($url){
17
 
18
  $json_data = file_get_contents($url);
21
 
22
  $sd_data = $json_array['sd_data'];
23
  $schema_post = array();
24
+
25
 
26
  if($all_schema_post){
27
  // begin transaction
28
  $wpdb->query('START TRANSACTION');
29
+
30
 
31
  foreach($all_schema_post as $schema_post){
32
 
33
  $post_id = wp_insert_post($schema_post['post']);
34
  $result = $post_id;
35
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
36
+ $wpdb->query("UPDATE ".$wpdb->prefix."posts SET guid ='".esc_sql($guid)."' WHERE ID ='".esc_sql($post_id)."'");
37
 
38
  if ( isset( $schema_post['schema_type'] ) ){
39
  update_post_meta( $post_id, 'schema_type', esc_attr( $schema_post['schema_type'] ) );
53
  if ( isset( $schema_post['data_group_array'] ) ){
54
  update_post_meta( $post_id, 'data_group_array', $schema_post['data_group_array'] );
55
  }
56
+ if(is_wp_error($result)){
57
+ $errorDesc[] = $result->get_error_message();
58
+ }
59
  }
60
  }
61
  update_option('sd_data', $sd_data);
62
  update_option('saswp-file-upload_url','');
63
  }
64
+ if ( count($errorDesc) ){
65
+ echo implode("\n<br/>", $errorDesc);
66
  $wpdb->query('ROLLBACK');
67
  }else{
68
  $wpdb->query('COMMIT');
170
  function saswp_import_schema_plugin_data(){
171
 
172
  $schema_post = array();
173
+ $errorDesc = array();
174
  global $wpdb;
175
  $user_id = get_current_user_id();
176
 
185
  if($all_schema_post){
186
  // begin transaction
187
  $wpdb->query('START TRANSACTION');
188
+
189
  foreach($all_schema_post as $schema){
190
 
191
  $schema_post = array(
217
  $post_id = wp_insert_post($schema_post);
218
  $result = $post_id;
219
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
220
+ $wpdb->query("UPDATE ".$wpdb->prefix."posts SET guid ='".esc_sql($guid)."' WHERE ID ='".esc_sql($post_id)."'");
221
 
222
  $schema_post_meta = get_post_meta($schema->ID, $key='', true );
223
  $schema_post_types = get_post_meta($schema->ID, $key='_schema_post_types', true );
261
  foreach ($saswp_meta_key as $key => $val){
262
  update_post_meta($post_id, $key, $val);
263
  }
264
+ if(is_wp_error($result)){
265
+ $errorDesc[] = $result->get_error_message();
266
+ }
267
  }
268
 
269
  //Importing settings starts here
362
  update_option('sd_data', $saswp_plugin_options);
363
  //Importing settings ends here
364
 
365
+ if ( count($errorDesc) ){
366
+ echo implode("\n<br/>", $errorDesc);
367
  $wpdb->query('ROLLBACK');
368
  }else{
369
  $wpdb->query('COMMIT');
466
 
467
  $local_business_details = array();
468
  $wpdb->query('START TRANSACTION');
469
+ $errorDesc = array();
470
  $user_id = get_current_user_id();
471
 
472
  if($settings['seop_local_name'] !=''){
516
  $post_id = wp_insert_post($schema_post);
517
  $result = $post_id;
518
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
519
+ $wpdb->query("UPDATE ".$wpdb->prefix."posts SET guid ='".esc_sql($guid)."' WHERE ID ='".esc_sql($post_id)."'");
520
 
521
  $data_group_array = array();
522
 
541
  foreach ($saswp_meta_key as $key => $val){
542
  update_post_meta($post_id, $key, $val);
543
  }
544
+ if(is_wp_error($result)){
545
+ $errorDesc[] = $result->get_error_message();
546
+ }
547
  }
548
 
549
  $get_options = get_option('sd_data');
550
  $merge_options = array_merge($get_options, $social_fields);
551
  $result = update_option('sd_data', $merge_options);
552
 
553
+ if ( count($errorDesc) ){
554
+ echo implode("\n<br/>", $errorDesc);
555
  $wpdb->query('ROLLBACK');
556
  }else{
557
  $wpdb->query('COMMIT');
571
  $saswp_plugin_options = array();
572
  $local_business_details = array();
573
  $wpdb->query('START TRANSACTION');
574
+ $errorDesc = array();
575
  $user_id = get_current_user_id();
576
 
577
  if($settings['site_type'] !='Organization'){
629
  $post_id = wp_insert_post($schema_post);
630
  $result = $post_id;
631
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
632
+ $wpdb->query("UPDATE ".$wpdb->prefix."posts SET guid ='".esc_sql($guid)."' WHERE ID ='".esc_sql($post_id)."'");
633
 
634
  $data_group_array = array();
635
 
653
  foreach ($saswp_meta_key as $key => $val){
654
  update_post_meta($post_id, $key, $val);
655
  }
656
+ if(is_wp_error($result)){
657
+ $errorDesc[] = $result->get_error_message();
658
+ }
659
 
660
  }
661
 
708
  $merge_options = array_merge($get_options, $saswp_plugin_options);
709
  $result = update_option('sd_data', $merge_options);
710
 
711
+ if ( count($errorDesc) ){
712
+ echo implode("\n<br/>", $errorDesc);
713
  $wpdb->query('ROLLBACK');
714
  }else{
715
  $wpdb->query('COMMIT');
736
  if($all_schema_post){
737
  // begin transaction
738
  $wpdb->query('START TRANSACTION');
739
+ $errorDesc = array();
740
  foreach($all_schema_post as $schema){
741
 
742
  $schema_post = array(
767
  $post_id = wp_insert_post($schema_post);
768
  $result = $post_id;
769
  $guid = get_option('siteurl') .'/?post_type=saswp&p='.$post_id;
770
+ $wpdb->get_results("UPDATE ".$wpdb->prefix."posts SET guid ='".esc_sql($guid)."' WHERE ID ='".esc_sql($post_id)."'");
771
 
772
  $schema_post_meta = get_post_meta($schema->ID, $key='', true );
773
  $schema_post_types = get_post_meta($schema->ID, $key='bsf-aiosrs-schema-type', true );
1025
  update_post_meta($post_id, $key, $val);
1026
 
1027
  }
1028
+ if(is_wp_error($result)){
1029
+ $errorDesc[] = $result->get_error_message();
1030
+ }
1031
+ }
1032
  //Importing settings starts here
1033
 
1034
  $schema_pro_general_settings = get_option('wp-schema-pro-general-settings');
1112
  update_option('sd_data', $merge_options);
1113
 
1114
 
1115
+ if ( count($errorDesc) ){
1116
+ echo implode("\n<br/>", $errorDesc);
1117
  $wpdb->query('ROLLBACK');
1118
  }else{
1119
  $wpdb->query('COMMIT');
admin_section/css/main-style.css CHANGED
@@ -8,7 +8,7 @@ and open the template in the editor.
8
  Author : Magazine3
9
  */
10
  .saswp_hide{
11
- display: none !important;
12
  }
13
  .saswp-general table th{
14
  width: auto;
@@ -73,10 +73,8 @@ and open the template in the editor.
73
  display:inline-block;
74
  width:100%
75
  }
76
- .saswp-settings-list li{
77
-
78
- padding-left:0px;
79
- display: contents;
80
  }
81
  .saswp-settings-list li div label{
82
  font-weight: 600;
@@ -556,3 +554,9 @@ On/Off Buttons ends here
556
  .saswp-wdi-rate-stars svg:hover{fill:#ffb900}
557
  .saswp-wdi-rate-stars svg:hover ~ svg{fill:none;}
558
 
 
 
 
 
 
 
8
  Author : Magazine3
9
  */
10
  .saswp_hide{
11
+ display: none;
12
  }
13
  .saswp-general table th{
14
  width: auto;
73
  display:inline-block;
74
  width:100%
75
  }
76
+ .saswp-settings-list li{
77
+ padding-left:0px;
 
 
78
  }
79
  .saswp-settings-list li div label{
80
  font-weight: 600;
554
  .saswp-wdi-rate-stars svg:hover{fill:#ffb900}
555
  .saswp-wdi-rate-stars svg:hover ~ svg{fill:none;}
556
 
557
+ .option-table-class {width:100%;}
558
+ .option-table-class tr td {padding: 10px 10px 10px 10px ;}
559
+ .option-table-class tr > td{width: 30%;}
560
+ .option-table-class tr td:last-child{width: 60%;}
561
+ .option-table-class input[type="text"], select{width:100%;}
562
+
admin_section/js/main-script.js CHANGED
@@ -880,6 +880,17 @@ jQuery(document).ready(function($){
880
 
881
  }
882
  saswp_enable_rating_review();
 
883
  //custom fields modify schema ends here
 
 
 
 
 
 
 
 
 
 
884
 
885
  });
880
 
881
  }
882
  saswp_enable_rating_review();
883
+
884
  //custom fields modify schema ends here
885
+
886
+
887
+ //Adding settings button beside add schema type button on schema type list page
888
+
889
+ if ('saswp' == saswp_app_object.post_type && saswp_app_object.page_now == 'edit.php') {
890
+
891
+ jQuery(jQuery(".wrap a")[0]).after("<a href='"+saswp_app_object.saswp_settings_url+"' id='' class='page-title-action'>Settings</a>");
892
+
893
+ }
894
+
895
 
896
  });
admin_section/newsletter.php CHANGED
@@ -34,9 +34,9 @@
34
  if (!array_key_exists($tab, $tour)) {
35
  $show_pointer = true;
36
  $displayID = '#menu-posts-saswp'; // Define ID used on page html element where we want to display pointer
37
- $content = '<h3>' . sprintf (__('Thanks for using Structured Data!', 'schema-and-structured-data-for-wp'), self::DISPLAY_VERSION) . '</h3>';
38
- $content .= __('<p>Do you want the latest on <b>Structured Data update</b> before others and some best resources on monetization in a single email? - Free just for users of Structured Data!</p>', 'schema-and-structured-data-for-wp');
39
- $content .= __('
40
  <style type="text/css">
41
  .wp-pointer-buttons{ padding:0; overflow: hidden; }
42
  .wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #0085ba;} .wp-pointer-content .button-primary{ display:none} #afw_mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
@@ -62,7 +62,7 @@
62
  <input type="submit" value="Subscribe" name="subscribe" id="pointer-close" class="button mc-newsletter-sent" style=" background: #0085ba; border-color: #006799; padding: 0px 16px; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px; margin-top: 1px; color: #fff; box-shadow: 0 1px 0 #006799;">
63
  </div>
64
  </form>
65
- </div>','schema-and-structured-data-for-wp');
66
  $options = array (
67
  'content' => $content,
68
  'position' => array ('edge' => 'left', 'align' => 'left')
34
  if (!array_key_exists($tab, $tour)) {
35
  $show_pointer = true;
36
  $displayID = '#menu-posts-saswp'; // Define ID used on page html element where we want to display pointer
37
+ $content = '<h3>' . sprintf (esc_html__('Thanks for using Structured Data!', 'schema-and-structured-data-for-wp'), self::DISPLAY_VERSION) . '</h3>';
38
+ $content .= '<p>'.esc_html__('Do you want the latest on','schema-and-structured-data-for-wp').' <b>'.esc_html__('Structured Data update','schema-and-structured-data-for-wp').'</b> '.esc_html__('before others and some best resources on monetization in a single email? - Free just for users of Structured Data!', 'schema-and-structured-data-for-wp').'</p>';
39
+ $content .= '
40
  <style type="text/css">
41
  .wp-pointer-buttons{ padding:0; overflow: hidden; }
42
  .wp-pointer-content .button-secondary{ left: -25px;background: transparent;top: 5px; border: 0;position: relative; padding: 0; box-shadow: none;margin: 0;color: #0085ba;} .wp-pointer-content .button-primary{ display:none} #afw_mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }
62
  <input type="submit" value="Subscribe" name="subscribe" id="pointer-close" class="button mc-newsletter-sent" style=" background: #0085ba; border-color: #006799; padding: 0px 16px; text-shadow: 0 -1px 1px #006799,1px 0 1px #006799,0 1px 1px #006799,-1px 0 1px #006799; height: 30px; margin-top: 1px; color: #fff; box-shadow: 0 1px 0 #006799;">
63
  </div>
64
  </form>
65
+ </div>';
66
  $options = array (
67
  'content' => $content,
68
  'position' => array ('edge' => 'left', 'align' => 'left')
admin_section/plugin-installer/install.php CHANGED
@@ -366,7 +366,9 @@
366
 
367
 
368
  function saswp_save_steps_data(){
369
-
 
 
370
  if ( ! isset( $_POST['wpnonce'] ) ){
371
  return;
372
  }
366
 
367
 
368
  function saswp_save_steps_data(){
369
+ if(! current_user_can( 'manage_options' ) ) {
370
+ return ;
371
+ }
372
  if ( ! isset( $_POST['wpnonce'] ) ){
373
  return;
374
  }
admin_section/settings.php CHANGED
@@ -44,6 +44,7 @@ function saswp_admin_interface_render(){
44
  <h1 class="wp-heading-inline"> <?php echo esc_html__( 'Schema & Structured Data For WP', 'schema-and-structured-data-for-wp' ); ?> <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=saswp' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Schema Types', 'schema-and-structured-data-for-wp' ); ?></a></h1><br>
45
  <div>
46
  <h2 class="nav-tab-wrapper saswp-tabs">
 
47
  <?php
48
 
49
  echo '<a href="' . esc_url(saswp_admin_link('general')) . '" class="nav-tab ' . esc_attr( $tab == 'general' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . esc_html__('General','schema-and-structured-data-for-wp') . '</a>';
@@ -154,6 +155,7 @@ function saswp_admin_interface_render(){
154
  add_action('admin_init', 'saswp_settings_init');
155
 
156
  function saswp_settings_init(){
 
157
  register_setting( 'sd_data_group', 'sd_data', 'saswp_handle_file_upload' );
158
  add_settings_section('saswp_general_section', __return_false(), '__return_false', 'saswp_general_section');
159
 
@@ -250,23 +252,26 @@ function saswp_custom_upload_mimes($mimes = array()) {
250
 
251
  add_action('upload_mimes', 'saswp_custom_upload_mimes');
252
 
253
- function saswp_handle_file_upload($option)
254
- {
255
- if(!empty($_FILES["saswp_import_backup"]["tmp_name"]))
256
- {
257
  $urls = wp_handle_upload($_FILES["saswp_import_backup"], array('test_form' => FALSE));
258
  $url = $urls["url"];
259
  update_option('saswp-file-upload_url',esc_url($url));
 
260
  }
261
 
262
  return $option;
 
263
  }
264
 
265
 
266
  function saswp_schema_page_callback(){
267
  // Get Settings
268
  $settings = saswp_defaultSettings();
269
- $field_objs = new saswp_fields_generator();
 
270
  $meta_fields_default = array(
271
  array(
272
  'label' => 'Default Image',
@@ -304,6 +309,7 @@ function saswp_schema_page_callback(){
304
  }
305
 
306
  function saswp_amp_page_callback(){
 
307
  $settings = saswp_defaultSettings();
308
  $field_objs = new saswp_fields_generator();
309
 
@@ -351,6 +357,7 @@ function saswp_amp_page_callback(){
351
  }
352
 
353
  function saswp_general_page_callback(){
 
354
  $settings = saswp_defaultSettings();
355
 
356
  $meta_fields_default = array(
@@ -449,12 +456,12 @@ function saswp_general_page_callback(){
449
  <div style="width:75%; float:right;">
450
  <label for="sd_contact_page-select">
451
  <?php echo wp_dropdown_pages( array(
452
- 'name' => 'sd_data[sd_contact_page]',
453
- 'id' => 'sd_contact_page-select',
454
- 'echo' => 0,
455
- 'show_option_none' => esc_html( 'Select an item', 'schema-and-structured-data-for-wp' ),
456
  'option_none_value' => '',
457
- 'selected' => isset($settings['sd_contact_page']) ? $settings['sd_contact_page'] : '',
458
  )); ?>
459
  </label>
460
  </div>
@@ -463,14 +470,19 @@ function saswp_general_page_callback(){
463
  </ul>
464
  </div>
465
  <?php
 
466
  $field_objs = new saswp_fields_generator();
 
467
  echo '<div class="saswp-archive-div">';
468
  $field_objs->saswp_field_generator($meta_fields_default, $settings);
469
  echo '</div>';
 
470
  }
471
- function saswp_knowledge_page_callback(){
 
472
  $settings = saswp_defaultSettings();
473
  $field_objs = new saswp_fields_generator();
 
474
  $meta_fields = array(
475
  array(
476
  'label' => 'Data Type',
@@ -508,104 +520,93 @@ function saswp_knowledge_page_callback(){
508
  ),
509
  array(
510
  'label' => 'Name',
511
- 'id' => 'sd_name',
512
- 'name' => 'sd_data[sd_name]',
513
  'class' => 'regular-text saswp_org_fields',
514
- 'type' => 'text',
515
  ),
516
 
517
  array(
518
  'label' => 'Url',
519
- 'id' => 'sd_url',
520
- 'name' => 'sd_data[sd_url]',
521
  'class' => 'regular-text saswp_org_fields',
522
- 'type' => 'text',
523
  ),
524
- // array(
525
- // 'label' => 'Contact details',
526
- // 'id' => 'saswp_kb_contact_1_checkbox',
527
- // 'name' => 'saswp_kb_contact_1_checkbox',
528
- // 'type' => 'checkbox',
529
- // 'class' => 'checkbox saswp-checkbox saswp_org_fields',
530
- // 'hidden' => array(
531
- // 'id' => 'saswp_kb_contact_1',
532
- // 'name' => 'sd_data[saswp_kb_contact_1]'
533
- // )
534
- // ),
535
  array(
536
  'label' => 'Telephone Number',
537
- 'id' => 'saswp_kb_telephone',
538
- 'name' => 'sd_data[saswp_kb_telephone]',
539
  'class' => 'regular-text saswp_org_fields',
540
- 'type' => 'text',
541
  ),
542
  array(
543
  'label' => 'Contact Type',
544
- 'id' => 'saswp_contact_type',
545
- 'name' => 'sd_data[saswp_contact_type]',
546
  'class' => 'saswp_org_fields',
547
- 'type' => 'select',
548
  'options' => array(
549
- ''=>'Select an item',
550
- 'customer support'=>'Customer Support',
551
- 'technical support'=>'Technical Support',
552
- 'billing support'=>'Billing Support',
553
- 'bill payment'=>'Bill payment',
554
- 'sales'=>'Sales',
555
- 'reservations'=>'Reservations',
556
- 'credit card support'=>'Credit Card Support',
557
- 'emergency'=>'Emergency',
558
- 'baggage tracking'=>'Baggage Tracking',
559
- 'roadside assistance'=>'Roadside Assistance',
560
- 'package tracking'=>'Package Tracking',
561
  )
562
  ),
563
 
564
  array(
565
  'label' => 'Name',
566
- 'id' => 'sd-person-name',
567
- 'name' => 'sd_data[sd-person-name]',
568
  'class' => 'regular-text saswp_person_fields',
569
- 'type' => 'text',
570
  ),
571
  array(
572
  'label' => 'Job Title',
573
- 'id' => 'sd-person-job-title',
574
- 'name' => 'sd_data[sd-person-job-title]',
575
  'class' => 'regular-text saswp_person_fields',
576
- 'type' => 'text',
577
  ),
578
  array(
579
- 'label' => 'Image',
580
- 'id' => 'sd-person-image',
581
- 'name' => 'sd_data[sd-person-image][url]',
582
- 'class' => 'upload large-text saswp_person_fields',
583
- 'type' => 'media',
584
  'attributes' => array(
585
  'readonly' => 'readonly'
586
  )
587
  ),
588
  array(
589
- 'label' => 'Phone Number',
590
- 'id' => 'sd-person-phone-number',
591
- 'name' => 'sd_data[sd-person-phone-number]',
592
- 'class' => 'regular-text saswp_person_fields',
593
- 'type' => 'text',
594
  ),
595
  array(
596
  'label' => 'URL',
597
- 'id' => 'sd-person-url',
598
- 'name' => 'sd_data[sd-person-url]',
599
  'class' => 'regular-text saswp_person_fields',
600
- 'type' => 'text',
601
  ),
602
  array(
603
  'label' => 'Logo',
604
- 'id' => 'sd_logo',
605
- 'name' => 'sd_data[sd_logo][url]',
606
  'class' => 'saswp-icon upload large-text saswp_kg_logo',
607
- 'type' => 'media',
608
- 'note' => 'According to google validation tool, Logo size must be 160*50 or 600*60',
609
  'attributes' => array(
610
  'readonly' => 'readonly'
611
  )
@@ -621,190 +622,190 @@ function saswp_knowledge_page_callback(){
621
  echo '<h2>'.esc_html__( 'Social Fields', 'schema-and-structured-data-for-wp' ).'</h2>';
622
  $social_meta_fields = array(
623
  array(
624
- 'label' => 'Facebook',
625
- 'id' => 'saswp-facebook-enable-checkbox',
626
- 'name' => 'saswp-facebook-enable-checkbox',
627
- 'type' => 'checkbox',
628
- 'class' => 'checkbox saswp-checkbox',
629
  'hidden' => array(
630
- 'id' => 'saswp-facebook-enable',
631
  'name' => 'sd_data[saswp-facebook-enable]',
632
  )
633
  ),
634
  array(
635
  'label' => '',
636
- 'id' => 'sd_facebook',
637
- 'name' => 'sd_data[sd_facebook]',
638
  'class' => 'regular-text',
639
- 'type' => 'text',
640
  'attributes' => array(
641
  'placeholder' => 'https://'
642
  )
643
  ),
644
  array(
645
- 'label' => 'Twitter',
646
- 'id' => 'saswp-twitter-enable-checkbox',
647
- 'name' => 'saswp-twitter-enable-checkbox',
648
- 'type' => 'checkbox',
649
- 'class' => 'checkbox saswp-checkbox',
650
  'hidden' => array(
651
- 'id' => 'saswp-twitter-enable',
652
  'name' => 'sd_data[saswp-twitter-enable]',
653
  )
654
  ),
655
  array(
656
- 'label' => '',
657
- 'id' => 'sd_twitter',
658
- 'name' => 'sd_data[sd_twitter]',
659
- 'class' => 'regular-text',
660
- 'type' => 'text',
661
  'attributes' => array(
662
  'placeholder' => 'https://'
663
  )
664
  ),
665
  array(
666
- 'label' => 'Google+',
667
- 'id' => 'saswp-google-plus-enable-checkbox',
668
- 'name' => 'saswp-google-plus-enable-checkbox',
669
- 'type' => 'checkbox',
670
- 'class' => 'checkbox saswp-checkbox',
671
  'hidden' => array(
672
- 'id' => 'saswp-google-plus-enable',
673
  'name' => 'sd_data[saswp-google-plus-enable]',
674
  )
675
  ),
676
  array(
677
- 'label' => '',
678
- 'id' => 'sd_google_plus',
679
- 'name' => 'sd_data[sd_google_plus]',
680
- 'class' => 'regular-text',
681
- 'type' => 'text',
682
  'attributes' => array(
683
  'placeholder' => 'https://'
684
  )
685
  ),
686
  array(
687
- 'label' => 'Instagram',
688
- 'id' => 'saswp-instagram-enable-checkbox',
689
- 'name' => 'saswp-instagram-enable-checkbox',
690
- 'type' => 'checkbox',
691
- 'class' => 'checkbox saswp-checkbox',
692
  'hidden' => array(
693
- 'id' => 'saswp-instagram-enable',
694
  'name' => 'sd_data[saswp-instagram-enable]',
695
  )
696
  ),
697
  array(
698
- 'label' => '',
699
- 'id' => 'sd_instagram',
700
- 'name' => 'sd_data[sd_instagram]',
701
- 'class' => 'regular-text',
702
- 'type' => 'text',
703
  'attributes' => array(
704
  'placeholder' => 'https://'
705
  )
706
  ),
707
  array(
708
- 'label' => 'Youtube',
709
- 'id' => 'saswp-youtube-enable-checkbox',
710
- 'name' => 'saswp-youtube-enable-checkbox',
711
- 'type' => 'checkbox',
712
- 'class' => 'checkbox saswp-checkbox',
713
  'hidden' => array(
714
- 'id' => 'saswp-youtube-enable',
715
  'name' => 'sd_data[saswp-youtube-enable]',
716
  )
717
  ),
718
  array(
719
- 'label' => '',
720
- 'id' => 'sd_youtube',
721
- 'name' => 'sd_data[sd_youtube]',
722
- 'class' => 'regular-text',
723
- 'type' => 'text',
724
  'attributes' => array(
725
  'placeholder' => 'https://'
726
  )
727
  ),
728
  array(
729
- 'label' => 'LinkedIn',
730
- 'id' => 'saswp-linkedin-enable-checkbox',
731
- 'name' => 'saswp-linkedin-enable-checkbox',
732
- 'type' => 'checkbox',
733
- 'class' => 'checkbox saswp-checkbox',
734
  'hidden' => array(
735
- 'id' => 'saswp-linkedin-enable',
736
  'name' => 'sd_data[saswp-linkedin-enable]',
737
  )
738
  ),
739
  array(
740
- 'label' => '',
741
- 'id' => 'sd_linkedin',
742
- 'name' => 'sd_data[sd_linkedin]',
743
- 'class' => 'regular-text',
744
- 'type' => 'text',
745
  'attributes' => array(
746
  'placeholder' => 'https://'
747
  )
748
  ),
749
  array(
750
- 'label' => 'Pinterest',
751
- 'id' => 'saswp-pinterest-enable-checkbox',
752
- 'name' => 'saswp-pinterest-enable-checkbox',
753
- 'type' => 'checkbox',
754
- 'class' => 'checkbox saswp-checkbox',
755
  'hidden' => array(
756
- 'id' => 'saswp-pinterest-enable',
757
  'name' => 'sd_data[saswp-pinterest-enable]',
758
  )
759
  ),
760
  array(
761
- 'label' => '',
762
- 'id' => 'sd_pinterest',
763
- 'name' => 'sd_data[sd_pinterest]',
764
- 'class' => 'regular-text',
765
- 'type' => 'text',
766
  'attributes' => array(
767
  'placeholder' => 'https://'
768
  )
769
  ),
770
  array(
771
- 'label' => 'SoundCloud',
772
- 'id' => 'saswp-soundcloud-enable-checkbox',
773
- 'name' => 'saswp-soundcloud-enable-checkbox',
774
- 'type' => 'checkbox',
775
- 'class' => 'checkbox saswp-checkbox',
776
  'hidden' => array(
777
- 'id' => 'saswp-soundcloud-enable',
778
  'name' => 'sd_data[saswp-soundcloud-enable]',
779
  )
780
  ),
781
  array(
782
- 'label' => '',
783
- 'id' => 'sd_soundcloud',
784
- 'name' => 'sd_data[sd_soundcloud]',
785
- 'class' => 'regular-text',
786
- 'type' => 'text',
787
  'attributes' => array(
788
  'placeholder' => 'https://'
789
  )
790
  ),
791
  array(
792
- 'label' => 'Tumblr',
793
- 'id' => 'saswp-tumblr-enable-checkbox',
794
- 'name' => 'saswp-tumblr-enable-checkbox',
795
- 'type' => 'checkbox',
796
- 'class' => 'checkbox saswp-checkbox',
797
  'hidden' => array(
798
  'id' => 'saswp-tumblr-enable',
799
  'name' => 'sd_data[saswp-tumblr-enable]',
800
  )
801
  ),
802
  array(
803
- 'label' => '',
804
- 'id' => 'sd_tumblr',
805
- 'name' => 'sd_data[sd_tumblr]',
806
- 'class' => 'regular-text',
807
- 'type' => 'text',
808
  'attributes' => array(
809
  'placeholder' => 'https://'
810
  )
@@ -818,13 +819,16 @@ function saswp_knowledge_page_callback(){
818
  }
819
 
820
  function saswp_check_data_imported_from($plugin_post_type_name){
 
821
  $cc_args = array(
822
  'posts_per_page' => -1,
823
  'post_type' => 'saswp',
824
  'meta_key' => 'imported_from',
825
- 'meta_value' => $plugin_post_type_name,
826
- );
 
827
  $imported_from = new WP_Query( $cc_args );
 
828
  return $imported_from;
829
  }
830
  function saswp_import_callback(){
@@ -915,9 +919,7 @@ function saswp_import_callback(){
915
 
916
  }
917
 
918
- function saswp_imported_callback(){
919
-
920
- }
921
 
922
  function saswp_review_page_callback(){
923
 
@@ -1039,28 +1041,34 @@ function saswp_compatibility_page_callback(){
1039
  );
1040
 
1041
  if(!is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah' ){
 
1042
  $tagyeem['attributes'] = array(
1043
  'disabled' => 'disabled'
1044
  );
1045
  $tagyeem['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1046
  $settings['saswp-tagyeem'] = 0;
 
1047
  }
1048
 
1049
 
1050
  if(!is_plugin_active('wordpress-seo/wp-seo.php') && !is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')){
 
1051
  $yoast['attributes'] = array(
1052
  'disabled' => 'disabled'
1053
  );
1054
  $yoast['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1055
  $settings['saswp-yoast'] = 0;
 
1056
  }
1057
 
1058
  if(!is_plugin_active('kk-star-ratings/index.php')){
 
1059
  $kk_star['attributes'] = array(
1060
  'disabled' => 'disabled'
1061
  );
1062
  $kk_star['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1063
  $settings['saswp-kk-star-raring'] = 0;
 
1064
  }
1065
 
1066
 
@@ -1081,6 +1089,7 @@ function saswp_compatibility_page_callback(){
1081
  );
1082
  $extratheme['note'] = esc_html__('Theme is not activated','schema-and-structured-data-for-wp');
1083
  $settings['saswp-extra'] = 0;
 
1084
  }
1085
 
1086
 
@@ -1205,12 +1214,16 @@ function saswp_compatibility_page_callback(){
1205
  );
1206
 
1207
  $field_objs = new saswp_fields_generator();
1208
- $field_objs->saswp_field_generator($meta_fields_default, $settings);
 
1209
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
1210
- echo '<div class="saswp-seller-div">';
1211
- echo '<strong>'.esc_html__('Real estate agent info :','schema-and-structured-data-for-wp').'</strong>';
1212
- $field_objs->saswp_field_generator($meta_fields_text, $settings);
1213
- echo '</div>';
 
 
 
1214
  }
1215
 
1216
 
@@ -1257,7 +1270,7 @@ function saswp_support_page_callback(){
1257
  * Enqueue CSS and JS
1258
  */
1259
  function saswp_enqueue_style_js( $hook ) {
1260
-
1261
  // Color picker CSS
1262
  // @refer https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
1263
  wp_enqueue_style( 'wp-color-picker' );
@@ -1267,7 +1280,7 @@ function saswp_enqueue_style_js( $hook ) {
1267
 
1268
  wp_register_script( 'saswp-main-js', SASWP_PLUGIN_URL . 'admin_section/js/main-script.js', array('jquery'), SASWP_VERSION , true );
1269
 
1270
- $data = array(
1271
  'post_id' => get_the_ID(),
1272
  'ajax_url' => admin_url( 'admin-ajax.php' ),
1273
  'saswp_security_nonce' => wp_create_nonce('saswp_ajax_check_nonce'),
44
  <h1 class="wp-heading-inline"> <?php echo esc_html__( 'Schema & Structured Data For WP', 'schema-and-structured-data-for-wp' ); ?> <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=saswp' ) ); ?>" class="page-title-action"><?php echo esc_html__( 'Schema Types', 'schema-and-structured-data-for-wp' ); ?></a></h1><br>
45
  <div>
46
  <h2 class="nav-tab-wrapper saswp-tabs">
47
+
48
  <?php
49
 
50
  echo '<a href="' . esc_url(saswp_admin_link('general')) . '" class="nav-tab ' . esc_attr( $tab == 'general' ? 'nav-tab-active' : '') . '"><span class=""></span> ' . esc_html__('General','schema-and-structured-data-for-wp') . '</a>';
155
  add_action('admin_init', 'saswp_settings_init');
156
 
157
  function saswp_settings_init(){
158
+
159
  register_setting( 'sd_data_group', 'sd_data', 'saswp_handle_file_upload' );
160
  add_settings_section('saswp_general_section', __return_false(), '__return_false', 'saswp_general_section');
161
 
252
 
253
  add_action('upload_mimes', 'saswp_custom_upload_mimes');
254
 
255
+ function saswp_handle_file_upload($option){
256
+
257
+ if(!empty($_FILES["saswp_import_backup"]["tmp_name"])){
258
+
259
  $urls = wp_handle_upload($_FILES["saswp_import_backup"], array('test_form' => FALSE));
260
  $url = $urls["url"];
261
  update_option('saswp-file-upload_url',esc_url($url));
262
+
263
  }
264
 
265
  return $option;
266
+
267
  }
268
 
269
 
270
  function saswp_schema_page_callback(){
271
  // Get Settings
272
  $settings = saswp_defaultSettings();
273
+ $field_objs = new saswp_fields_generator();
274
+
275
  $meta_fields_default = array(
276
  array(
277
  'label' => 'Default Image',
309
  }
310
 
311
  function saswp_amp_page_callback(){
312
+
313
  $settings = saswp_defaultSettings();
314
  $field_objs = new saswp_fields_generator();
315
 
357
  }
358
 
359
  function saswp_general_page_callback(){
360
+
361
  $settings = saswp_defaultSettings();
362
 
363
  $meta_fields_default = array(
456
  <div style="width:75%; float:right;">
457
  <label for="sd_contact_page-select">
458
  <?php echo wp_dropdown_pages( array(
459
+ 'name' => 'sd_data[sd_contact_page]',
460
+ 'id' => 'sd_contact_page-select',
461
+ 'echo' => 0,
462
+ 'show_option_none' => esc_html( 'Select an item', 'schema-and-structured-data-for-wp' ),
463
  'option_none_value' => '',
464
+ 'selected' => isset($settings['sd_contact_page']) ? $settings['sd_contact_page'] : '',
465
  )); ?>
466
  </label>
467
  </div>
470
  </ul>
471
  </div>
472
  <?php
473
+
474
  $field_objs = new saswp_fields_generator();
475
+
476
  echo '<div class="saswp-archive-div">';
477
  $field_objs->saswp_field_generator($meta_fields_default, $settings);
478
  echo '</div>';
479
+
480
  }
481
+ function saswp_knowledge_page_callback(){
482
+
483
  $settings = saswp_defaultSettings();
484
  $field_objs = new saswp_fields_generator();
485
+
486
  $meta_fields = array(
487
  array(
488
  'label' => 'Data Type',
520
  ),
521
  array(
522
  'label' => 'Name',
523
+ 'id' => 'sd_name',
524
+ 'name' => 'sd_data[sd_name]',
525
  'class' => 'regular-text saswp_org_fields',
526
+ 'type' => 'text',
527
  ),
528
 
529
  array(
530
  'label' => 'Url',
531
+ 'id' => 'sd_url',
532
+ 'name' => 'sd_data[sd_url]',
533
  'class' => 'regular-text saswp_org_fields',
534
+ 'type' => 'text',
535
  ),
 
 
 
 
 
 
 
 
 
 
 
536
  array(
537
  'label' => 'Telephone Number',
538
+ 'id' => 'saswp_kb_telephone',
539
+ 'name' => 'sd_data[saswp_kb_telephone]',
540
  'class' => 'regular-text saswp_org_fields',
541
+ 'type' => 'text',
542
  ),
543
  array(
544
  'label' => 'Contact Type',
545
+ 'id' => 'saswp_contact_type',
546
+ 'name' => 'sd_data[saswp_contact_type]',
547
  'class' => 'saswp_org_fields',
548
+ 'type' => 'select',
549
  'options' => array(
550
+ '' => 'Select an item',
551
+ 'customer support' => 'Customer Support',
552
+ 'technical support' => 'Technical Support',
553
+ 'billing support' => 'Billing Support',
554
+ 'bill payment' => 'Bill payment',
555
+ 'sales' => 'Sales',
556
+ 'reservations' => 'Reservations',
557
+ 'credit card support' => 'Credit Card Support',
558
+ 'emergency' => 'Emergency',
559
+ 'baggage tracking' => 'Baggage Tracking',
560
+ 'roadside assistance' => 'Roadside Assistance',
561
+ 'package tracking' => 'Package Tracking',
562
  )
563
  ),
564
 
565
  array(
566
  'label' => 'Name',
567
+ 'id' => 'sd-person-name',
568
+ 'name' => 'sd_data[sd-person-name]',
569
  'class' => 'regular-text saswp_person_fields',
570
+ 'type' => 'text',
571
  ),
572
  array(
573
  'label' => 'Job Title',
574
+ 'id' => 'sd-person-job-title',
575
+ 'name' => 'sd_data[sd-person-job-title]',
576
  'class' => 'regular-text saswp_person_fields',
577
+ 'type' => 'text',
578
  ),
579
  array(
580
+ 'label' => 'Image',
581
+ 'id' => 'sd-person-image',
582
+ 'name' => 'sd_data[sd-person-image][url]',
583
+ 'class' => 'upload large-text saswp_person_fields',
584
+ 'type' => 'media',
585
  'attributes' => array(
586
  'readonly' => 'readonly'
587
  )
588
  ),
589
  array(
590
+ 'label' => 'Phone Number',
591
+ 'id' => 'sd-person-phone-number',
592
+ 'name' => 'sd_data[sd-person-phone-number]',
593
+ 'class' => 'regular-text saswp_person_fields',
594
+ 'type' => 'text',
595
  ),
596
  array(
597
  'label' => 'URL',
598
+ 'id' => 'sd-person-url',
599
+ 'name' => 'sd_data[sd-person-url]',
600
  'class' => 'regular-text saswp_person_fields',
601
+ 'type' => 'text',
602
  ),
603
  array(
604
  'label' => 'Logo',
605
+ 'id' => 'sd_logo',
606
+ 'name' => 'sd_data[sd_logo][url]',
607
  'class' => 'saswp-icon upload large-text saswp_kg_logo',
608
+ 'type' => 'media',
609
+ 'note' => 'According to google validation tool, Logo size must be 160*50 or 600*60',
610
  'attributes' => array(
611
  'readonly' => 'readonly'
612
  )
622
  echo '<h2>'.esc_html__( 'Social Fields', 'schema-and-structured-data-for-wp' ).'</h2>';
623
  $social_meta_fields = array(
624
  array(
625
+ 'label' => 'Facebook',
626
+ 'id' => 'saswp-facebook-enable-checkbox',
627
+ 'name' => 'saswp-facebook-enable-checkbox',
628
+ 'type' => 'checkbox',
629
+ 'class' => 'checkbox saswp-checkbox',
630
  'hidden' => array(
631
+ 'id' => 'saswp-facebook-enable',
632
  'name' => 'sd_data[saswp-facebook-enable]',
633
  )
634
  ),
635
  array(
636
  'label' => '',
637
+ 'id' => 'sd_facebook',
638
+ 'name' => 'sd_data[sd_facebook]',
639
  'class' => 'regular-text',
640
+ 'type' => 'text',
641
  'attributes' => array(
642
  'placeholder' => 'https://'
643
  )
644
  ),
645
  array(
646
+ 'label' => 'Twitter',
647
+ 'id' => 'saswp-twitter-enable-checkbox',
648
+ 'name' => 'saswp-twitter-enable-checkbox',
649
+ 'type' => 'checkbox',
650
+ 'class' => 'checkbox saswp-checkbox',
651
  'hidden' => array(
652
+ 'id' => 'saswp-twitter-enable',
653
  'name' => 'sd_data[saswp-twitter-enable]',
654
  )
655
  ),
656
  array(
657
+ 'label' => '',
658
+ 'id' => 'sd_twitter',
659
+ 'name' => 'sd_data[sd_twitter]',
660
+ 'class' => 'regular-text',
661
+ 'type' => 'text',
662
  'attributes' => array(
663
  'placeholder' => 'https://'
664
  )
665
  ),
666
  array(
667
+ 'label' => 'Google+',
668
+ 'id' => 'saswp-google-plus-enable-checkbox',
669
+ 'name' => 'saswp-google-plus-enable-checkbox',
670
+ 'type' => 'checkbox',
671
+ 'class' => 'checkbox saswp-checkbox',
672
  'hidden' => array(
673
+ 'id' => 'saswp-google-plus-enable',
674
  'name' => 'sd_data[saswp-google-plus-enable]',
675
  )
676
  ),
677
  array(
678
+ 'label' => '',
679
+ 'id' => 'sd_google_plus',
680
+ 'name' => 'sd_data[sd_google_plus]',
681
+ 'class' => 'regular-text',
682
+ 'type' => 'text',
683
  'attributes' => array(
684
  'placeholder' => 'https://'
685
  )
686
  ),
687
  array(
688
+ 'label' => 'Instagram',
689
+ 'id' => 'saswp-instagram-enable-checkbox',
690
+ 'name' => 'saswp-instagram-enable-checkbox',
691
+ 'type' => 'checkbox',
692
+ 'class' => 'checkbox saswp-checkbox',
693
  'hidden' => array(
694
+ 'id' => 'saswp-instagram-enable',
695
  'name' => 'sd_data[saswp-instagram-enable]',
696
  )
697
  ),
698
  array(
699
+ 'label' => '',
700
+ 'id' => 'sd_instagram',
701
+ 'name' => 'sd_data[sd_instagram]',
702
+ 'class' => 'regular-text',
703
+ 'type' => 'text',
704
  'attributes' => array(
705
  'placeholder' => 'https://'
706
  )
707
  ),
708
  array(
709
+ 'label' => 'Youtube',
710
+ 'id' => 'saswp-youtube-enable-checkbox',
711
+ 'name' => 'saswp-youtube-enable-checkbox',
712
+ 'type' => 'checkbox',
713
+ 'class' => 'checkbox saswp-checkbox',
714
  'hidden' => array(
715
+ 'id' => 'saswp-youtube-enable',
716
  'name' => 'sd_data[saswp-youtube-enable]',
717
  )
718
  ),
719
  array(
720
+ 'label' => '',
721
+ 'id' => 'sd_youtube',
722
+ 'name' => 'sd_data[sd_youtube]',
723
+ 'class' => 'regular-text',
724
+ 'type' => 'text',
725
  'attributes' => array(
726
  'placeholder' => 'https://'
727
  )
728
  ),
729
  array(
730
+ 'label' => 'LinkedIn',
731
+ 'id' => 'saswp-linkedin-enable-checkbox',
732
+ 'name' => 'saswp-linkedin-enable-checkbox',
733
+ 'type' => 'checkbox',
734
+ 'class' => 'checkbox saswp-checkbox',
735
  'hidden' => array(
736
+ 'id' => 'saswp-linkedin-enable',
737
  'name' => 'sd_data[saswp-linkedin-enable]',
738
  )
739
  ),
740
  array(
741
+ 'label' => '',
742
+ 'id' => 'sd_linkedin',
743
+ 'name' => 'sd_data[sd_linkedin]',
744
+ 'class' => 'regular-text',
745
+ 'type' => 'text',
746
  'attributes' => array(
747
  'placeholder' => 'https://'
748
  )
749
  ),
750
  array(
751
+ 'label' => 'Pinterest',
752
+ 'id' => 'saswp-pinterest-enable-checkbox',
753
+ 'name' => 'saswp-pinterest-enable-checkbox',
754
+ 'type' => 'checkbox',
755
+ 'class' => 'checkbox saswp-checkbox',
756
  'hidden' => array(
757
+ 'id' => 'saswp-pinterest-enable',
758
  'name' => 'sd_data[saswp-pinterest-enable]',
759
  )
760
  ),
761
  array(
762
+ 'label' => '',
763
+ 'id' => 'sd_pinterest',
764
+ 'name' => 'sd_data[sd_pinterest]',
765
+ 'class' => 'regular-text',
766
+ 'type' => 'text',
767
  'attributes' => array(
768
  'placeholder' => 'https://'
769
  )
770
  ),
771
  array(
772
+ 'label' => 'SoundCloud',
773
+ 'id' => 'saswp-soundcloud-enable-checkbox',
774
+ 'name' => 'saswp-soundcloud-enable-checkbox',
775
+ 'type' => 'checkbox',
776
+ 'class' => 'checkbox saswp-checkbox',
777
  'hidden' => array(
778
+ 'id' => 'saswp-soundcloud-enable',
779
  'name' => 'sd_data[saswp-soundcloud-enable]',
780
  )
781
  ),
782
  array(
783
+ 'label' => '',
784
+ 'id' => 'sd_soundcloud',
785
+ 'name' => 'sd_data[sd_soundcloud]',
786
+ 'class' => 'regular-text',
787
+ 'type' => 'text',
788
  'attributes' => array(
789
  'placeholder' => 'https://'
790
  )
791
  ),
792
  array(
793
+ 'label' => 'Tumblr',
794
+ 'id' => 'saswp-tumblr-enable-checkbox',
795
+ 'name' => 'saswp-tumblr-enable-checkbox',
796
+ 'type' => 'checkbox',
797
+ 'class' => 'checkbox saswp-checkbox',
798
  'hidden' => array(
799
  'id' => 'saswp-tumblr-enable',
800
  'name' => 'sd_data[saswp-tumblr-enable]',
801
  )
802
  ),
803
  array(
804
+ 'label' => '',
805
+ 'id' => 'sd_tumblr',
806
+ 'name' => 'sd_data[sd_tumblr]',
807
+ 'class' => 'regular-text',
808
+ 'type' => 'text',
809
  'attributes' => array(
810
  'placeholder' => 'https://'
811
  )
819
  }
820
 
821
  function saswp_check_data_imported_from($plugin_post_type_name){
822
+
823
  $cc_args = array(
824
  'posts_per_page' => -1,
825
  'post_type' => 'saswp',
826
  'meta_key' => 'imported_from',
827
+ 'meta_value' => $plugin_post_type_name,
828
+ );
829
+
830
  $imported_from = new WP_Query( $cc_args );
831
+
832
  return $imported_from;
833
  }
834
  function saswp_import_callback(){
919
 
920
  }
921
 
922
+
 
 
923
 
924
  function saswp_review_page_callback(){
925
 
1041
  );
1042
 
1043
  if(!is_plugin_active('taqyeem/taqyeem.php') || get_template() != 'jannah' ){
1044
+
1045
  $tagyeem['attributes'] = array(
1046
  'disabled' => 'disabled'
1047
  );
1048
  $tagyeem['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1049
  $settings['saswp-tagyeem'] = 0;
1050
+
1051
  }
1052
 
1053
 
1054
  if(!is_plugin_active('wordpress-seo/wp-seo.php') && !is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')){
1055
+
1056
  $yoast['attributes'] = array(
1057
  'disabled' => 'disabled'
1058
  );
1059
  $yoast['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1060
  $settings['saswp-yoast'] = 0;
1061
+
1062
  }
1063
 
1064
  if(!is_plugin_active('kk-star-ratings/index.php')){
1065
+
1066
  $kk_star['attributes'] = array(
1067
  'disabled' => 'disabled'
1068
  );
1069
  $kk_star['note'] = esc_html__('Plugin is not activated','schema-and-structured-data-for-wp');
1070
  $settings['saswp-kk-star-raring'] = 0;
1071
+
1072
  }
1073
 
1074
 
1089
  );
1090
  $extratheme['note'] = esc_html__('Theme is not activated','schema-and-structured-data-for-wp');
1091
  $settings['saswp-extra'] = 0;
1092
+
1093
  }
1094
 
1095
 
1214
  );
1215
 
1216
  $field_objs = new saswp_fields_generator();
1217
+ $field_objs->saswp_field_generator($meta_fields_default, $settings);
1218
+
1219
  if ( is_plugin_active('flexmls-idx/flexmls_connect.php')) {
1220
+
1221
+ echo '<div class="saswp-seller-div">';
1222
+ echo '<strong>'.esc_html__('Real estate agent info :','schema-and-structured-data-for-wp').'</strong>';
1223
+
1224
+ $field_objs->saswp_field_generator($meta_fields_text, $settings);
1225
+
1226
+ echo '</div>';
1227
  }
1228
 
1229
 
1270
  * Enqueue CSS and JS
1271
  */
1272
  function saswp_enqueue_style_js( $hook ) {
1273
+
1274
  // Color picker CSS
1275
  // @refer https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/
1276
  wp_enqueue_style( 'wp-color-picker' );
1280
 
1281
  wp_register_script( 'saswp-main-js', SASWP_PLUGIN_URL . 'admin_section/js/main-script.js', array('jquery'), SASWP_VERSION , true );
1282
 
1283
+ $data = array(
1284
  'post_id' => get_the_ID(),
1285
  'ajax_url' => admin_url( 'admin-ajax.php' ),
1286
  'saswp_security_nonce' => wp_create_nonce('saswp_ajax_check_nonce'),
admin_section/structure_admin.php CHANGED
@@ -7,8 +7,8 @@ function saswp_get_saved_schema_ids(){
7
  $all_schemas = get_posts(
8
  array(
9
  'post_type' => 'saswp',
10
- 'posts_per_page' => -1,
11
- 'post_status' => 'publish',
12
  )
13
  );
14
  if($all_schemas){
@@ -81,9 +81,9 @@ function saswp_reset_all_settings(){
81
  }
82
 
83
  if($result){
84
- echo json_encode(array('status'=>'t'));
85
  }else{
86
- echo json_encode(array('status'=>'f'));
87
  }
88
  wp_die();
89
  }
@@ -113,7 +113,7 @@ function saswp_get_all_schema_posts(){
113
 
114
  if($schema_id_array){
115
 
116
- if(count($schema_id_array)>0){
117
 
118
  $returnData = array();
119
 
@@ -129,9 +129,9 @@ function saswp_get_all_schema_posts(){
129
 
130
  foreach ($resultset as $result){
131
 
132
- $data = array_filter($result);
133
  $number_of_fields = count($data);
134
- $checker = 0;
135
 
136
  if ( $number_of_fields > 0 ) {
137
 
@@ -150,17 +150,17 @@ function saswp_get_all_schema_posts(){
150
  $condition_array[] = $checker;
151
 
152
  }
153
- $array_is_true = in_array(true,$condition_array);
154
 
155
  if($array_is_true){
156
 
157
- $unique_checker = 1;
158
 
159
  }
160
 
161
  }else{
162
 
163
- $unique_checker ='notset';
164
 
165
  }
166
 
@@ -203,6 +203,7 @@ function saswp_get_all_schema_posts(){
203
  function saswp_generate_field_data( $post_id ){
204
 
205
  $data_group_array = get_post_meta( $post_id, 'data_group_array', true);
 
206
  $output = array();
207
 
208
  if($data_group_array){
@@ -213,7 +214,8 @@ function saswp_generate_field_data( $post_id ){
213
 
214
  }
215
 
216
- }
 
217
  return $output;
218
 
219
  }
@@ -225,10 +227,10 @@ function saswp_comparison_logic_checker($input){
225
  $type = $input['key_1'];
226
  $comparison = $input['key_2'];
227
  $data = $input['key_3'];
228
- $result = '';
229
 
230
  // Get all the users registered
231
- $user = wp_get_current_user();
232
 
233
  switch ($type) {
234
 
@@ -241,14 +243,22 @@ function saswp_comparison_logic_checker($input){
241
  // Posts Type
242
  case 'post_type':
243
 
244
- $current_post_type ='';
 
245
  if(is_singular()){
246
- $current_post_type = $post->post_type;
247
- }
 
 
 
248
  if ( $comparison == 'equal' ) {
 
249
  if ( $current_post_type == $data ) {
 
250
  $result = true;
 
251
  }
 
252
  }
253
  if ( $comparison == 'not_equal') {
254
  if ( $current_post_type != $data ) {
@@ -724,10 +734,11 @@ add_action( 'wp_print_scripts', 'saswp_dequeue_script', 100 );
724
  }
725
  $data_array = array(
726
 
727
- 'ajax_url' => admin_url( 'admin-ajax.php' ),
728
- 'post_found_status' => $post_found_status,
729
- 'post_type' => $post_type,
730
- 'page_now' => $hook,
 
731
 
732
  );
733
 
7
  $all_schemas = get_posts(
8
  array(
9
  'post_type' => 'saswp',
10
+ 'posts_per_page' => -1,
11
+ 'post_status' => 'publish',
12
  )
13
  );
14
  if($all_schemas){
81
  }
82
 
83
  if($result){
84
+ echo json_encode(array('status'=>'t'));
85
  }else{
86
+ echo json_encode(array('status'=>'f'));
87
  }
88
  wp_die();
89
  }
113
 
114
  if($schema_id_array){
115
 
116
+ if(count($schema_id_array)>0){
117
 
118
  $returnData = array();
119
 
129
 
130
  foreach ($resultset as $result){
131
 
132
+ $data = array_filter($result);
133
  $number_of_fields = count($data);
134
+ $checker = 0;
135
 
136
  if ( $number_of_fields > 0 ) {
137
 
150
  $condition_array[] = $checker;
151
 
152
  }
153
+ $array_is_true = in_array(true,$condition_array);
154
 
155
  if($array_is_true){
156
 
157
+ $unique_checker = 1;
158
 
159
  }
160
 
161
  }else{
162
 
163
+ $unique_checker = 'notset';
164
 
165
  }
166
 
203
  function saswp_generate_field_data( $post_id ){
204
 
205
  $data_group_array = get_post_meta( $post_id, 'data_group_array', true);
206
+
207
  $output = array();
208
 
209
  if($data_group_array){
214
 
215
  }
216
 
217
+ }
218
+
219
  return $output;
220
 
221
  }
227
  $type = $input['key_1'];
228
  $comparison = $input['key_2'];
229
  $data = $input['key_3'];
230
+ $result = '';
231
 
232
  // Get all the users registered
233
+ $user = wp_get_current_user();
234
 
235
  switch ($type) {
236
 
243
  // Posts Type
244
  case 'post_type':
245
 
246
+ $current_post_type = '';
247
+
248
  if(is_singular()){
249
+
250
+ $current_post_type = $post->post_type;
251
+
252
+ }
253
+
254
  if ( $comparison == 'equal' ) {
255
+
256
  if ( $current_post_type == $data ) {
257
+
258
  $result = true;
259
+
260
  }
261
+
262
  }
263
  if ( $comparison == 'not_equal') {
264
  if ( $current_post_type != $data ) {
734
  }
735
  $data_array = array(
736
 
737
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
738
+ 'post_found_status' => $post_found_status,
739
+ 'post_type' => $post_type,
740
+ 'page_now' => $hook,
741
+ 'saswp_settings_url' => esc_url(admin_url('edit.php?post_type=saswp&page=structured_data_options'))
742
 
743
  );
744
 
output/flexmls.php CHANGED
@@ -3,13 +3,13 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
3
 
4
  public $shorcode = array();
5
  protected $search_criteria;
 
6
  function __construct() {
7
  global $fmc_api;
8
  parent::__construct($fmc_api);
9
 
10
  add_filter('the_content', array($this,'saswp_content'),9);
11
- add_action('wp_footer', array($this, 'saswp_get_flexidx_listing'));
12
- add_action('wp_footer', array($this, 'saswp_get_flexidx_listing'));
13
  add_action('amp_post_template_footer',array($this, 'saswp_get_flexidx_listing'));
14
  }
15
  public function saswp_get_flexidx_listing(){
@@ -104,18 +104,24 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
104
  }
105
 
106
  $apply_property_type = ($source == 'location') ? true : false;
 
107
  if ($source == 'agent') {
 
108
  $pure_conditions['ListAgentId'] = $agent;
 
109
  }
110
  // parse location search settings
111
  $locations = flexmlsConnect::parse_location_search_string($locations);
112
  if($locations){
 
113
  foreach ($locations as $loc) {
 
114
  if(array_key_exists($loc['f'], $pure_conditions)) {
115
  $pure_conditions[$loc['f']] .= ',' . $loc['v'];
116
  } else {
117
  $pure_conditions[$loc['f']] = $loc['v'];
118
  }
 
119
  }
120
  }
121
 
@@ -178,14 +184,22 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
178
  echo "\n";
179
  echo '<script type="application/ld+json">';
180
  echo "\n";
181
- echo "[";
182
- foreach ($results as $result){
183
- if($count > 1){
184
- echo json_encode($this->saswp_generate_schema_markup($result)).',';
185
- }else{
186
- echo json_encode($this->saswp_generate_schema_markup($result));
187
- }
188
- $count --;
 
 
 
 
 
 
 
 
189
  }
190
  echo ']';
191
  echo "\n";
@@ -194,21 +208,25 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
194
 
195
  }
196
  public function saswp_content($content){
 
197
  preg_match_all("/[[]idx_listing_summary(.*?)[]]/", $content,$matches);
198
 
199
  $this->shorcode = $matches;
 
200
  return $content;
 
201
  }
202
- public function saswp_generate_schema_markup($result){
 
203
  global $sd_data;
204
- $sellername ='';
205
- $sellerurl ='';
206
- $sellerimage ='';
207
- $selleraddress ='';
208
- $sellertelephone ='';
209
- $sellerpricerange ='';
210
 
211
- if(isset($sd_data['saswp_compativility']) && $sd_data['saswp_compativility']==1){
212
 
213
  if(isset($sd_data['sd-seller-name'])){
214
  $sellername =$sd_data['sd-seller-name'];
@@ -231,24 +249,30 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
231
 
232
  $link_to_details_criteria = $this->search_criteria;
233
  $link_to_details = flexmlsConnect::make_nice_address_url($result['StandardFields'], $link_to_details_criteria, 'fmc_tag');
 
234
  $photos = array();
 
235
  if(isset($result['StandardFields'])){
 
236
  foreach ($result['StandardFields']['Photos'] as $photo){
 
237
  $photos[] = array(
238
  'url' => $photo['UriThumb']
239
- );
 
240
  }
241
- }
 
242
  $input = array();
243
  $input = array(
244
  "@context" => "http://schema.org",
245
  "@type" => ["Product", "Apartment"],
246
- "name" => $result['StandardFields']['UnparsedFirstLineAddress'],
247
  "description" => isset($result['StandardFields']['PublicRemarks'])? $result['StandardFields']['PublicRemarks']:strip_tags(get_the_excerpt()),
248
- "sku" => $result['StandardFields']['BuildingAreaTotal'],
249
  "brand" => get_bloginfo(),
250
- "mpn" => $result['StandardFields']['YearBuilt'],
251
- "url" => $link_to_details,
252
  "aggregateRating" => array(
253
  "@type"=> "AggregateRating",
254
  "ratingValue" => '5.0',
@@ -257,8 +281,7 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
257
  "review" => array(
258
  '@type' => 'Review',
259
  'author' => get_the_author(),
260
- 'datePublished' => $result['StandardFields']['ListingUpdateTimestamp'],
261
- //'description' => '',
262
  'reviewRating' => array(
263
  '@type' => 'Rating',
264
  'bestRating' => '5.0',
@@ -266,30 +289,30 @@ class saswp_flexmls_list extends flexmlsConnectPageCore{
266
  'worstRating' => '1.0',
267
  )
268
  ),
269
- "image" => $result['StandardFields']['Photos'][0]['Uri300'],
270
  "offers" => array(
271
- "priceCurrency" => "USD",
272
- "price" => $result['StandardFields']['ListPrice'],
273
- "availability" => 'InStock',
274
- "url" => $link_to_details,
275
- "priceValidUntil"=> $result['StandardFields']['ListingUpdateTimestamp'],
276
- "seller" => array(
277
  array(
278
- "@type" => "RealEstateAgent",
279
- "name" => $sellername,
280
- "url" => $sellerurl,
281
- "image" => $sellerimage,
282
- "address" => $selleraddress,
283
- "priceRange" => $sellerpricerange,
284
- "telephone" => $sellertelephone,
285
  )
286
  ),
287
  ),
288
- 'address' => $result['StandardFields']['StreetNumber'].' '. $result['StandardFields']['StreetName'].' '.$result['StandardFields']['StreetSuffix'] .' '.$result['StandardFields']['City'].' '. $result['StandardFields']['PostalCode'],
289
  'geo' => array(
290
- "@type" => "GeoCoordinates",
291
- "address" => $result['StandardFields']['UnparsedFirstLineAddress'],
292
- "addressCountry" => $result['StandardFields']['UnparsedFirstLineAddress'],
293
  ),
294
 
295
  'photos' => $photos,
3
 
4
  public $shorcode = array();
5
  protected $search_criteria;
6
+
7
  function __construct() {
8
  global $fmc_api;
9
  parent::__construct($fmc_api);
10
 
11
  add_filter('the_content', array($this,'saswp_content'),9);
12
+ add_action('wp_footer', array($this, 'saswp_get_flexidx_listing'));
 
13
  add_action('amp_post_template_footer',array($this, 'saswp_get_flexidx_listing'));
14
  }
15
  public function saswp_get_flexidx_listing(){
104
  }
105
 
106
  $apply_property_type = ($source == 'location') ? true : false;
107
+
108
  if ($source == 'agent') {
109
+
110
  $pure_conditions['ListAgentId'] = $agent;
111
+
112
  }
113
  // parse location search settings
114
  $locations = flexmlsConnect::parse_location_search_string($locations);
115
  if($locations){
116
+
117
  foreach ($locations as $loc) {
118
+
119
  if(array_key_exists($loc['f'], $pure_conditions)) {
120
  $pure_conditions[$loc['f']] .= ',' . $loc['v'];
121
  } else {
122
  $pure_conditions[$loc['f']] = $loc['v'];
123
  }
124
+
125
  }
126
  }
127
 
184
  echo "\n";
185
  echo '<script type="application/ld+json">';
186
  echo "\n";
187
+ echo "[";
188
+
189
+ foreach ($results as $result){
190
+
191
+ if($count > 1){
192
+
193
+ echo json_encode($this->saswp_generate_schema_markup($result)).',';
194
+
195
+ }else{
196
+
197
+ echo json_encode($this->saswp_generate_schema_markup($result));
198
+
199
+ }
200
+
201
+ $count --;
202
+
203
  }
204
  echo ']';
205
  echo "\n";
208
 
209
  }
210
  public function saswp_content($content){
211
+
212
  preg_match_all("/[[]idx_listing_summary(.*?)[]]/", $content,$matches);
213
 
214
  $this->shorcode = $matches;
215
+
216
  return $content;
217
+
218
  }
219
+ public function saswp_generate_schema_markup($result){
220
+
221
  global $sd_data;
222
+ $sellername = '';
223
+ $sellerurl = '';
224
+ $sellerimage = '';
225
+ $selleraddress = '';
226
+ $sellertelephone = '';
227
+ $sellerpricerange = '';
228
 
229
+ if(isset($sd_data['saswp_compativility']) && $sd_data['saswp_compativility'] == 1){
230
 
231
  if(isset($sd_data['sd-seller-name'])){
232
  $sellername =$sd_data['sd-seller-name'];
249
 
250
  $link_to_details_criteria = $this->search_criteria;
251
  $link_to_details = flexmlsConnect::make_nice_address_url($result['StandardFields'], $link_to_details_criteria, 'fmc_tag');
252
+
253
  $photos = array();
254
+
255
  if(isset($result['StandardFields'])){
256
+
257
  foreach ($result['StandardFields']['Photos'] as $photo){
258
+
259
  $photos[] = array(
260
  'url' => $photo['UriThumb']
261
+ );
262
+
263
  }
264
+ }
265
+
266
  $input = array();
267
  $input = array(
268
  "@context" => "http://schema.org",
269
  "@type" => ["Product", "Apartment"],
270
+ "name" => esc_attr($result['StandardFields']['UnparsedFirstLineAddress']),
271
  "description" => isset($result['StandardFields']['PublicRemarks'])? $result['StandardFields']['PublicRemarks']:strip_tags(get_the_excerpt()),
272
+ "sku" => esc_attr($result['StandardFields']['BuildingAreaTotal']),
273
  "brand" => get_bloginfo(),
274
+ "mpn" => esc_attr($result['StandardFields']['YearBuilt']),
275
+ "url" => esc_url($link_to_details),
276
  "aggregateRating" => array(
277
  "@type"=> "AggregateRating",
278
  "ratingValue" => '5.0',
281
  "review" => array(
282
  '@type' => 'Review',
283
  'author' => get_the_author(),
284
+ 'datePublished' => $result['StandardFields']['ListingUpdateTimestamp'],
 
285
  'reviewRating' => array(
286
  '@type' => 'Rating',
287
  'bestRating' => '5.0',
289
  'worstRating' => '1.0',
290
  )
291
  ),
292
+ "image" => esc_url($result['StandardFields']['Photos'][0]['Uri300']),
293
  "offers" => array(
294
+ "priceCurrency" => "USD",
295
+ "price" => esc_attr($result['StandardFields']['ListPrice']),
296
+ "availability" => 'InStock',
297
+ "url" => esc_url($link_to_details),
298
+ "priceValidUntil" => $result['StandardFields']['ListingUpdateTimestamp'],
299
+ "seller" => array(
300
  array(
301
+ "@type" => "RealEstateAgent",
302
+ "name" => esc_attr($sellername),
303
+ "url" => esc_url($sellerurl),
304
+ "image" => esc_attr($sellerimage),
305
+ "address" => esc_attr($selleraddress),
306
+ "priceRange" => esc_attr($sellerpricerange),
307
+ "telephone" => esc_attr($sellertelephone),
308
  )
309
  ),
310
  ),
311
+ 'address' => esc_attr($result['StandardFields']['StreetNumber']).' '. esc_attr($result['StandardFields']['StreetName']).' '.esc_attr($result['StandardFields']['StreetSuffix']) .' '.esc_attr($result['StandardFields']['City']).' '. esc_attr($result['StandardFields']['PostalCode']),
312
  'geo' => array(
313
+ "@type" => "GeoCoordinates",
314
+ "address" => esc_attr($result['StandardFields']['UnparsedFirstLineAddress']),
315
+ "addressCountry" => esc_attr($result['StandardFields']['UnparsedFirstLineAddress']),
316
  ),
317
 
318
  'photos' => $photos,
output/function.php CHANGED
@@ -141,7 +141,7 @@ function saswp_data_generator() {
141
  echo "\n";
142
  echo '<script type="application/ld+json">';
143
  echo "\n";
144
- echo html_entity_decode(esc_html($filter_string));
145
  echo "\n";
146
  echo '</script>';
147
  echo "\n\n";
@@ -151,11 +151,14 @@ add_filter('the_content', 'saswp_paywall_data_for_login');
151
 
152
  function saswp_paywall_data_for_login($content){
153
 
 
 
154
  if( saswp_non_amp() ){
155
 
156
  return $content;
157
 
158
  }
 
159
  remove_filter('the_content', 'MeprAppCtrl::page_route', 60);
160
  $Conditionals = saswp_get_all_schema_posts();
161
 
@@ -163,8 +166,9 @@ function saswp_paywall_data_for_login($content){
163
  return $content;
164
  }else{
165
 
166
- $paywallenable ='';
167
- $className ='paywall';
 
168
  foreach($Conditionals as $schemaConditionals){
169
 
170
  $schema_options = $schemaConditionals['schema_options'];
@@ -186,18 +190,16 @@ function saswp_paywall_data_for_login($content){
186
  if($paywallenable){
187
 
188
  if(strpos($content, '<!--more-->')!==false && !is_user_logged_in()){
189
-
190
- global $wp;
191
- $redirect = home_url( $wp->request );
192
  $breakedContent = explode("<!--more-->", $content);
193
- $content = $breakedContent[0].'<a href="'.wp_login_url( $redirect ) .'">'.esc_html__( 'Login', 'schema-and-structured-data-for-wp' ).'</a>';
194
 
195
  }elseif(strpos($content, '<!--more-->')!==false && is_user_logged_in()){
196
-
197
- global $wp;
198
- $redirect = home_url( $wp->request );
199
  $breakedContent = explode("<!--more-->", $content);
200
- $content = $breakedContent[0].'<div class="'.$className.'">'.$breakedContent[1].'</div>';
201
 
202
  }
203
 
@@ -218,7 +220,7 @@ function saswp_memberpress_form_update($form){
218
  },11);
219
  global $wp;
220
  $redirect = home_url( $wp->request );
221
- $form = '<a class="amp-mem-login" href="'.wp_login_url( $redirect ) .'">'.esc_html__( 'Login', 'schema-and-structured-data-for-wp' ).'</a>';
222
  }
223
 
224
  return $form;
@@ -236,7 +238,7 @@ function saswp_remove_warnings($data, $index, $type){
236
  if($type == 'saswp_array'){
237
 
238
  if(isset($data[$index])){
239
- return $data[$index][0];
240
  }else{
241
  return '';
242
  }
@@ -245,7 +247,7 @@ function saswp_remove_warnings($data, $index, $type){
245
  if($type == 'saswp_string'){
246
 
247
  if(isset($data[$index])){
248
- return $data[$index];
249
  }else{
250
  return '';
251
  }
@@ -271,7 +273,7 @@ function saswp_reading_time_and_word_count() {
271
  // How many seconds (total)?
272
  $seconds = floor( $word_count / $words_per_second );
273
 
274
- return array('word_count' => $word_count, 'timerequired' => $seconds);
275
  }
276
 
277
  /**
@@ -339,12 +341,12 @@ function saswp_get_comments($post_id){
339
 
340
  $comments[] = array (
341
  '@type' => 'Comment',
342
- 'dateCreated' => $comment->comment_date,
343
- 'description' => $comment->comment_content,
344
- 'author' => array (
345
- '@type' => 'Person',
346
- 'name' => $comment->comment_author,
347
- 'url' => $comment->comment_author_url,
348
  ),
349
  );
350
  }
@@ -489,7 +491,7 @@ function saswp_remove_woocommerce_default_structured_data() {
489
 
490
  global $sd_data;
491
 
492
- if(isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] == 1 && is_plugin_active('woocommerce/woocommerce.php')){
493
 
494
  remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // This removes structured data from all frontend pages
495
  remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // This removes structured data from all Emails sent by WooCommerce
141
  echo "\n";
142
  echo '<script type="application/ld+json">';
143
  echo "\n";
144
+ echo $filter_string;
145
  echo "\n";
146
  echo '</script>';
147
  echo "\n\n";
151
 
152
  function saswp_paywall_data_for_login($content){
153
 
154
+ global $wp;
155
+
156
  if( saswp_non_amp() ){
157
 
158
  return $content;
159
 
160
  }
161
+
162
  remove_filter('the_content', 'MeprAppCtrl::page_route', 60);
163
  $Conditionals = saswp_get_all_schema_posts();
164
 
166
  return $content;
167
  }else{
168
 
169
+ $paywallenable = '';
170
+ $className = 'paywall';
171
+
172
  foreach($Conditionals as $schemaConditionals){
173
 
174
  $schema_options = $schemaConditionals['schema_options'];
190
  if($paywallenable){
191
 
192
  if(strpos($content, '<!--more-->')!==false && !is_user_logged_in()){
193
+
194
+ $redirect = home_url( $wp->request );
 
195
  $breakedContent = explode("<!--more-->", $content);
196
+ $content = $breakedContent[0].'<a href="'.esc_url(wp_login_url( $redirect )) .'">'.esc_html__( 'Login', 'schema-and-structured-data-for-wp' ).'</a>';
197
 
198
  }elseif(strpos($content, '<!--more-->')!==false && is_user_logged_in()){
199
+
200
+ $redirect = home_url( $wp->request );
 
201
  $breakedContent = explode("<!--more-->", $content);
202
+ $content = $breakedContent[0].'<div class="'.esc_attr($className).'">'.esc_attr($breakedContent[1]).'</div>';
203
 
204
  }
205
 
220
  },11);
221
  global $wp;
222
  $redirect = home_url( $wp->request );
223
+ $form = '<a class="amp-mem-login" href="'.esc_url(wp_login_url( $redirect )) .'">'.esc_html__( 'Login', 'schema-and-structured-data-for-wp' ).'</a>';
224
  }
225
 
226
  return $form;
238
  if($type == 'saswp_array'){
239
 
240
  if(isset($data[$index])){
241
+ return esc_attr($data[$index][0]);
242
  }else{
243
  return '';
244
  }
247
  if($type == 'saswp_string'){
248
 
249
  if(isset($data[$index])){
250
+ return esc_attr($data[$index]);
251
  }else{
252
  return '';
253
  }
273
  // How many seconds (total)?
274
  $seconds = floor( $word_count / $words_per_second );
275
 
276
+ return array('word_count' => esc_attr($word_count), 'timerequired' => esc_attr($seconds));
277
  }
278
 
279
  /**
341
 
342
  $comments[] = array (
343
  '@type' => 'Comment',
344
+ 'dateCreated' => esc_html($comment->comment_date),
345
+ 'description' => esc_attr($comment->comment_content),
346
+ 'author' => array (
347
+ '@type' => 'Person',
348
+ 'name' => esc_attr($comment->comment_author),
349
+ 'url' => esc_url($comment->comment_author_url),
350
  ),
351
  );
352
  }
491
 
492
  global $sd_data;
493
 
494
+ if(isset($sd_data['saswp-woocommerce']) && $sd_data['saswp-woocommerce'] == 1 && class_exists('WooCommerce')){
495
 
496
  remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // This removes structured data from all frontend pages
497
  remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // This removes structured data from all Emails sent by WooCommerce
output/output.php CHANGED
@@ -9,10 +9,11 @@ function saswp_kb_schema_output() {
9
 
10
  global $sd_data;
11
  $input = array();
12
- // social profile
13
  $sd_social_profile = array();
14
 
15
  $sd_facebook = array();
 
16
  if(isset($sd_data['sd_facebook']) && !empty($sd_data['sd_facebook'])){
17
  $sd_facebook[] = $sd_data['sd_facebook'];
18
  $sd_social_profile[] = $sd_facebook;
@@ -65,6 +66,7 @@ function saswp_kb_schema_output() {
65
  }
66
 
67
  $platform = array();
 
68
  foreach ($sd_social_profile as $key => $value) {
69
  $platform[] = $value;
70
  }
@@ -104,15 +106,15 @@ function saswp_kb_schema_output() {
104
 
105
  'contactPoint' => array(
106
  '@type' => 'ContactPoint',
107
- 'contactType' => $contact_1,
108
- 'telephone' => $telephone_1,
109
  )
110
 
111
  );
112
 
113
  $input = array(
114
  '@context' =>'http://schema.org',
115
- '@type' => isset($sd_data['saswp_organization_type'])? $sd_data['saswp_organization_type']:'Organization',
116
  'name' => saswp_remove_warnings($sd_data, 'sd_name', 'saswp_string'),
117
  'url' => saswp_remove_warnings($sd_data, 'sd_url', 'saswp_string'),
118
  'sameAs' => $platform,
@@ -121,17 +123,14 @@ function saswp_kb_schema_output() {
121
  if($logo !='' && $width !='' && $height !=''){
122
 
123
  $input['logo']['@type'] = 'ImageObject';
124
- $input['logo']['url'] = $logo;
125
- $input['logo']['width'] = $width;
126
- $input['logo']['height'] = $height;
127
 
128
  }
129
-
130
- if ( isset($sd_data['saswp_kb_contact_1'] ) && $sd_data['saswp_kb_contact_1'] ) {
131
-
132
- $input = array_merge($input, $contact_info);
133
-
134
- }
135
  }
136
  // Person
137
 
@@ -163,16 +162,16 @@ function saswp_kb_schema_output() {
163
 
164
  $input = array(
165
  '@context' => 'http://schema.org',
166
- '@type' => $sd_data['saswp_kb_type'],
167
- 'name' => $sd_data['sd-person-name'],
168
- 'url' => $sd_data['sd-person-url'],
169
  'image' => array(
170
  '@type' => 'ImageObject',
171
- 'url' => $image,
172
- 'width' => $width,
173
- 'height' => $height,
174
  ),
175
- 'telephone' => $sd_data['sd-person-phone-number'],
176
  );
177
  }
178
 
@@ -300,11 +299,7 @@ function saswp_schema_output() {
300
 
301
  $extra_theme_review = array();
302
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
303
-
304
- // $tagyeem_review = array();
305
- // $tagyeem_review = $service_object->saswp_tagyeem_review_details(get_the_ID());
306
-
307
-
308
  if( 'Course' === $schema_type){
309
 
310
  $input1 = array(
@@ -313,8 +308,8 @@ function saswp_schema_output() {
313
  'name' => get_the_title(),
314
  'description' => strip_tags(get_the_excerpt()),
315
  'url' => get_permalink(),
316
- 'datePublished' => $date,
317
- 'dateModified' => $modified_date,
318
  'provider' => array(
319
  '@type' => 'Organization',
320
  'name' => get_bloginfo(),
@@ -352,11 +347,11 @@ function saswp_schema_output() {
352
  'description' => strip_tags(get_the_excerpt()),
353
  'name' => get_the_title(),
354
  'url' => get_permalink(),
355
- 'datePublished' => $date,
356
- 'dateModified' => $modified_date,
357
  'author' => array(
358
  '@type' => 'Person',
359
- 'name' => $aurthor_name
360
  )
361
  );
362
  if(!empty($publisher)){
@@ -378,7 +373,7 @@ function saswp_schema_output() {
378
  if(!empty($extra_theme_review)){
379
  $input1 = array_merge($input1, $extra_theme_review);
380
  }
381
- if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] ==1){
382
  $input1['comment'] = saswp_get_comments(get_the_ID());
383
  }
384
 
@@ -400,14 +395,15 @@ function saswp_schema_output() {
400
  'dateModified' => $modified_date,
401
  'author' => array(
402
  '@type' => 'Person',
403
- 'name' => $aurthor_name
404
  ),
405
  );
406
  if(!empty($publisher)){
407
 
408
  $input1 = array_merge($input1, $publisher);
409
 
410
- }
 
411
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
412
  $service = new saswp_output_service();
413
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
@@ -456,9 +452,9 @@ function saswp_schema_output() {
456
  'endDate' => isset($schema_data['saswp_event_schema_end_date']) && $schema_data['saswp_event_schema_end_date'] !='' ? date('Y-m-d\TH:i:s\Z',$schema_data['saswp_event_schema_end_date']):'',
457
  'image' => array(
458
  '@type' =>'ImageObject',
459
- 'url' => isset($schema_data['saswp_event_schema_image']) ? $schema_data['saswp_event_schema_image']['url']:'' ,
460
- 'width' => isset($schema_data['saswp_event_schema_image']) ? $schema_data['saswp_event_schema_image']['width']:'' ,
461
- 'height' => isset($schema_data['saswp_event_schema_image']) ? $schema_data['saswp_event_schema_image']['height']:'' ,
462
  ),
463
  'location' => array(
464
  '@type' => 'Place',
@@ -529,15 +525,15 @@ function saswp_schema_output() {
529
  'dateModified' => $modified_date,
530
  'author' => array(
531
  '@type' => 'Person',
532
- 'name' => $aurthor_name
533
  ),
534
  );
535
 
536
  if(isset($schema_data['saswp_software_schema_rating']) && $schema_data['saswp_software_schema_rating'] >0 && isset($schema_data['saswp_software_schema_rating_count']) && $schema_data['saswp_software_schema_rating_count'] >0 && $schema_data['saswp_software_schema_enable_rating'] == 1){
537
  $input1['aggregateRating'] = array(
538
  '@type' => 'AggregateRating',
539
- 'ratingValue' => $schema_data['saswp_software_schema_rating'],
540
- 'ratingCount' => (int)$schema_data['saswp_software_schema_rating_count'],
541
  );
542
  }
543
 
@@ -632,15 +628,15 @@ function saswp_schema_output() {
632
  '@type' => $schema_type ,
633
  'url' => get_permalink(),
634
  'name' => get_the_title(),
635
- 'datePublished' => $date,
636
- 'dateModified' => $modified_date,
637
  'description' => strip_tags(get_the_excerpt()),
638
  'mainEntity' => array(
639
  '@type' => 'WebPage',
640
  '@id' => get_permalink(),
641
  'author' => array(
642
  '@type' => 'Person',
643
- 'name' => $aurthor_name,
644
  'Image' => array(
645
  '@type' => 'ImageObject',
646
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
@@ -714,22 +710,22 @@ function saswp_schema_output() {
714
 
715
  );
716
  if(isset($product_details['product_gtin8']) && $product_details['product_gtin8'] !=''){
717
- $input1['gtin8'] = $product_details['product_gtin8'];
718
  }
719
  if(isset($product_details['product_mpn']) && $product_details['product_mpn'] !=''){
720
- $input1['mpn'] = $product_details['product_mpn'];
721
  }
722
  if(isset($product_details['product_isbn']) && $product_details['product_isbn'] !=''){
723
- $input1['isbn'] = $product_details['product_isbn'];
724
  }
725
  if(isset($product_details['product_brand']) && $product_details['product_brand'] !=''){
726
- $input1['brand'] = array('@type'=>'Thing','name'=>$product_details['product_brand']);
727
  }
728
  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){
729
  $input1['aggregateRating'] = array(
730
  '@type' => 'AggregateRating',
731
- 'ratingValue' => $product_details['product_average_rating'],
732
- 'reviewCount' => (int)$product_details['product_review_count'],
733
  );
734
  }
735
  if(!empty($product_details['product_reviews'])){
@@ -740,13 +736,13 @@ function saswp_schema_output() {
740
 
741
  $reviews[] = array(
742
  '@type' => 'Review',
743
- 'author' => $review['author'],
744
- 'datePublished' => $review['datePublished'],
745
  'description' => $review['description'],
746
  'reviewRating' => array(
747
  '@type' => 'Rating',
748
  'bestRating' => '5',
749
- 'ratingValue' => $review['reviewRating'],
750
  'worstRating' => '1',
751
  )
752
  );
@@ -767,39 +763,42 @@ function saswp_schema_output() {
767
  'description' => saswp_remove_warnings($schema_data, 'saswp_product_schema_description', 'saswp_string'),
768
  'image' => array(
769
  '@type' =>'ImageObject',
770
- 'url' => isset($schema_data['saswp_product_schema_image']) ? $schema_data['saswp_product_schema_image']['url']:'' ,
771
- 'width' => isset($schema_data['saswp_product_schema_image']) ? $schema_data['saswp_product_schema_image']['width']:'' ,
772
- 'height' => isset($schema_data['saswp_product_schema_image']) ? $schema_data['saswp_product_schema_image']['height']:'' ,
773
- ),
774
  'offers' => array(
775
- '@type' => 'Offer',
776
- 'availability' => saswp_remove_warnings($schema_data, 'saswp_product_schema_availability', 'saswp_string'),
777
- 'itemCondition'=> saswp_remove_warnings($schema_data, 'saswp_product_schema_condition', 'saswp_string'),
778
- 'price' => saswp_remove_warnings($schema_data, 'saswp_product_schema_price', 'saswp_string'),
779
- 'priceCurrency' => saswp_remove_warnings($schema_data, 'saswp_product_schema_currency', 'saswp_string'),
780
- 'url' => get_permalink(),
781
- 'priceValidUntil'=> saswp_remove_warnings($schema_data, 'saswp_product_schema_priceValidUntil', 'saswp_string'),
782
  ),
783
- 'brand' => array('@type'=>'Thing',
 
784
  'name'=>saswp_remove_warnings($schema_data, 'saswp_product_schema_brand_name', 'saswp_string'),
785
  )
786
  );
787
 
788
 
789
  if(isset($schema_data['saswp_product_schema_gtin8']) && $schema_data['saswp_product_schema_gtin8'] !=''){
790
- $input1['gtin8'] = $schema_data['saswp_product_schema_gtin8'];
791
  }
 
792
  if(isset($schema_data['saswp_product_schema_mpn']) && $schema_data['saswp_product_schema_mpn'] !=''){
793
- $input1['mpn'] = $schema_data['saswp_product_schema_mpn'];
794
  }
 
795
  if(isset($schema_data['saswp_product_schema_isbn']) && $schema_data['saswp_product_schema_isbn'] !=''){
796
- $input1['isbn'] = $schema_data['saswp_product_schema_isbn'];
797
  }
798
 
799
  if(isset($schema_data['saswp_product_schema_enable_rating'])){
800
 
801
  $input1['aggregateRating'] = array(
802
- "@type"=> "AggregateRating",
803
  "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_product_schema_rating', 'saswp_string'),
804
  "reviewCount" => saswp_remove_warnings($schema_data, 'saswp_product_schema_review_count', 'saswp_string')
805
  );
@@ -843,8 +842,8 @@ function saswp_schema_output() {
843
  'url' => get_permalink(),
844
  'headline' => get_the_title(),
845
  'mainEntityOfPage' => get_the_permalink(),
846
- 'datePublished' => $date,
847
- 'dateModified' => $modified_date,
848
  'description' => strip_tags(get_the_excerpt()),
849
  'articleSection' => $article_section,
850
  'articleBody' => strip_tags(get_the_excerpt()),
@@ -858,7 +857,7 @@ function saswp_schema_output() {
858
  ),
859
  'author' => array(
860
  '@type' => 'Person',
861
- 'name' => $aurthor_name,
862
  'Image' => array(
863
  '@type' => 'ImageObject',
864
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
@@ -911,13 +910,13 @@ function saswp_schema_output() {
911
  'name' => saswp_remove_warnings($schema_data, 'saswp_service_schema_provider_name', 'saswp_string'),
912
  'image' => array(
913
  '@type' =>'ImageObject',
914
- 'url' =>isset($schema_data['saswp_service_schema_image']) ? $schema_data['saswp_service_schema_image']['url']:'' ,
915
- 'width' =>isset($schema_data['saswp_service_schema_image']) ? $schema_data['saswp_service_schema_image']['width']:'' ,
916
- 'height' =>isset($schema_data['saswp_service_schema_image']) ? $schema_data['saswp_service_schema_image']['height']:'' ,
917
  ),
918
  '@id' => get_permalink(),
919
  'address' => array(
920
- '@type' => 'PostalAddress',
921
  'addressLocality' => saswp_remove_warnings($schema_data, 'saswp_service_schema_locality', 'saswp_string'),
922
  'postalCode' => saswp_remove_warnings($schema_data, 'saswp_service_schema_postal_code', 'saswp_string'),
923
  'telephone' => saswp_remove_warnings($schema_data, 'saswp_service_schema_telephone', 'saswp_string')
@@ -955,9 +954,11 @@ function saswp_schema_output() {
955
  'itemListElement' => $serviceOffer
956
  );
957
 
958
- if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
 
959
  $service = new saswp_output_service();
960
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
 
961
  }
962
 
963
  if(isset($schema_data['saswp_service_schema_enable_rating'])){
@@ -989,10 +990,10 @@ function saswp_schema_output() {
989
 
990
  $input1 = array(
991
  '@context' => 'http://schema.org',
992
- '@type' => $schema_type,
993
- 'dateCreated' => $date,
994
- 'datePublished' => $date,
995
- 'dateModified' => $modified_date,
996
  'headline' => get_the_title(),
997
  'name' => get_the_title(),
998
  'keywords' => tie_get_plain_terms( get_the_ID(), 'post_tag' ),
@@ -1001,7 +1002,7 @@ function saswp_schema_output() {
1001
  'copyrightYear' => get_the_time( 'Y' ),
1002
  'author' => array(
1003
  '@type' => 'Person',
1004
- 'name' => $aurthor_name,
1005
  'Image' => array(
1006
  '@type' => 'ImageObject',
1007
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
@@ -1029,7 +1030,7 @@ function saswp_schema_output() {
1029
  '@type' => 'Rating',
1030
  'worstRating' => 1,
1031
  'bestRating' => 5,
1032
- 'ratingValue' => $total_score,
1033
  'description' => get_post_meta( get_the_ID(), 'taq_review_summary', true ),
1034
  );
1035
 
@@ -1049,19 +1050,19 @@ function saswp_schema_output() {
1049
  }
1050
 
1051
  $input1['@context'] = 'http://schema.org';
1052
- $input1['@type'] = $schema_type;
1053
  $input1['url'] = get_permalink();
1054
- $input1['datePublished'] = $date;
1055
- $input1['dateModified'] = $modified_date;
1056
 
1057
  if($review_author){
1058
 
1059
  $input1['author']['@type'] = 'Person';
1060
- $input1['author']['name'] = $review_author;
1061
 
1062
  if(isset($schema_data['saswp_review_schema_author_sameas'])){
1063
 
1064
- $input1['author']['sameAs'] = $schema_data['saswp_review_schema_author_sameas'];
1065
 
1066
  }
1067
 
@@ -1083,48 +1084,34 @@ function saswp_schema_output() {
1083
  }
1084
 
1085
  if(isset($schema_data['saswp_review_schema_item_type'])){
1086
- $input1['itemReviewed']['@type'] = $schema_data['saswp_review_schema_item_type'];
1087
  }
1088
  if(isset($schema_data['saswp_review_schema_name'])){
1089
- $input1['itemReviewed']['name'] = $schema_data['saswp_review_schema_name'];
1090
  }
1091
  if(isset($schema_data['saswp_review_schema_url'])){
1092
- $input1['itemReviewed']['url'] = $schema_data['saswp_review_schema_url'];
1093
- }
1094
-
1095
- if(isset($schema_data['saswp_review_schema_price_range'])){
1096
-
1097
- $input1['itemReviewed']['priceRange'] = $schema_data['saswp_review_schema_price_range'];
1098
-
1099
- }
1100
-
1101
- if(isset($schema_data['saswp_review_schema_telephone'])){
1102
-
1103
- $input1['itemReviewed']['telephone'] = $schema_data['saswp_review_schema_telephone'];
1104
-
1105
- }
1106
-
1107
- if(isset($schema_data['saswp_review_schema_servescuisine'])){
1108
-
1109
- $input1['itemReviewed']['servesCuisine'] = $schema_data['saswp_review_schema_servescuisine'];
1110
-
1111
- }
1112
- if(isset($schema_data['saswp_review_schema_menu'])){
1113
-
1114
- $input1['itemReviewed']['hasMenu'] = $schema_data['saswp_review_schema_menu'];
1115
-
1116
  }
1117
-
1118
- if(isset($schema_data['saswp_review_schema_itemreviewed_sameas'])){
1119
-
1120
- $input1['itemReviewed']['sameAs'] = $schema_data['saswp_review_schema_itemreviewed_sameas'];
1121
-
1122
  }
1123
 
1124
 
1125
  if(isset($schema_data['saswp_review_schema_director'])){
1126
 
1127
- $input1['itemReviewed']['director'] = $schema_data['saswp_review_schema_director'];
1128
 
1129
  }
1130
  if(isset($schema_data['saswp_review_schema_date_created'])){
@@ -1137,20 +1124,20 @@ function saswp_schema_output() {
1137
  if(isset($schema_data['saswp_review_schema_image'])){
1138
 
1139
  $input1['itemReviewed']['image']['@type'] = 'ImageObject';
1140
- $input1['itemReviewed']['image']['url'] = $schema_data['saswp_review_schema_image'];
1141
- $input1['itemReviewed']['image']['width'] = $schema_data['saswp_review_schema_image_detail']['width'];
1142
- $input1['itemReviewed']['image']['height']= $schema_data['saswp_review_schema_image_detail']['height'];
1143
 
1144
  }
1145
 
1146
  if(saswp_remove_warnings($schema_data, 'saswp_review_schema_street_address', 'saswp_string') !='' || saswp_remove_warnings($schema_data, 'saswp_review_schema_locality', 'saswp_string') !=''){
1147
 
1148
- $input1['itemReviewed']['address']['@type'] = 'PostalAddress';
1149
- $input1['itemReviewed']['address']['streetAddress'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_street_address', 'saswp_string');
1150
  $input1['itemReviewed']['address']['addressLocality'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_locality', 'saswp_string');
1151
- $input1['itemReviewed']['address']['addressRegion'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_region', 'saswp_string');
1152
- $input1['itemReviewed']['address']['postalCode'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_postal_code', 'saswp_string');
1153
- $input1['itemReviewed']['address']['addressCountry'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_country', 'saswp_string');
1154
 
1155
  }
1156
 
@@ -1181,8 +1168,9 @@ function saswp_schema_output() {
1181
  if($review_author) {
1182
 
1183
  $input1['itemReviewed']['author']['@type'] = 'Person';
1184
- $input1['itemReviewed']['author']['name'] = $review_author;
1185
- $input1['itemReviewed']['author']['sameAs'] = $schema_data['saswp_review_schema_author_sameas'];
 
1186
  }
1187
 
1188
  break;
@@ -1240,15 +1228,17 @@ function saswp_schema_output() {
1240
  if(isset($schema_data['saswp_review_schema_enable_rating']) && saswp_remove_warnings($schema_data, 'saswp_review_schema_rating', 'saswp_string') !='' && saswp_remove_warnings($schema_data, 'saswp_review_schema_review_count', 'saswp_string') !=''){
1241
 
1242
  $input1['reviewRating'] = array(
1243
- "@type"=> "Rating",
1244
- "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_review_schema_rating', 'saswp_string'),
1245
- "bestRating" => saswp_remove_warnings($schema_data, 'saswp_review_schema_review_count', 'saswp_string'),
1246
  );
1247
  }
1248
 
1249
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
 
1250
  $service = new saswp_output_service();
1251
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
 
1252
  }
1253
 
1254
 
@@ -1266,22 +1256,22 @@ function saswp_schema_output() {
1266
 
1267
  $input1 = array(
1268
  '@context' => 'http://schema.org',
1269
- '@type' => $schema_type,
1270
  'url' => get_permalink(),
1271
  'headline' => get_the_title(),
1272
- 'datePublished' => $date,
1273
- 'dateModified' => $modified_date,
1274
  'description' => strip_tags(get_the_excerpt()),
1275
  'name' => get_the_title(),
1276
- 'uploadDate' => $date,
1277
- 'thumbnailUrl' => $image_details[0],
1278
  'mainEntity' => array(
1279
  '@type' => 'WebPage',
1280
  '@id' => get_permalink(),
1281
  ),
1282
  'author' => array(
1283
  '@type' => 'Person',
1284
- 'name' => $aurthor_name,
1285
  'Image' => array(
1286
  '@type' => 'ImageObject',
1287
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
@@ -1334,30 +1324,32 @@ function saswp_schema_output() {
1334
 
1335
  $input1 = array(
1336
  '@context' => 'http://schema.org',
1337
- '@type' => $local_business ,
1338
  'name' => saswp_remove_warnings($business_details, 'local_business_name', 'saswp_string'),
1339
  'url' => get_permalink(),
1340
  'description' => strip_tags(get_the_excerpt()),
1341
  'image' => array(
1342
  '@type' => 'ImageObject',
1343
- 'url' => isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['url']:'',
1344
- 'width' => isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['width']:'',
1345
- 'height' => isset($business_details['local_business_logo']) ? $business_details['local_business_logo']['height']:'',
1346
  ),
1347
  'address' => array(
1348
- "@type" => "PostalAddress",
1349
- "streetAddress" => saswp_remove_warnings($business_details, 'local_street_address', 'saswp_string'),
1350
- "addressLocality"=> saswp_remove_warnings($business_details, 'local_city', 'saswp_string'),
1351
- "addressRegion" => saswp_remove_warnings($business_details, 'local_state', 'saswp_string'),
1352
- "postalCode" => saswp_remove_warnings($business_details, 'local_postal_code', 'saswp_string'),
1353
  ),
1354
  'telephone' => saswp_remove_warnings($business_details, 'local_phone', 'saswp_string'),
1355
- 'openingHours' => $dayoftheweek,
1356
 
1357
  );
1358
- if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
1359
- $service = new saswp_output_service();
1360
- $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
 
 
1361
  }
1362
 
1363
 
@@ -1385,32 +1377,22 @@ function saswp_schema_output() {
1385
  $input1 = array_merge($input1, $extra_theme_review);
1386
  }
1387
  if(isset($business_details['local_price_range'])){
1388
- $input1['priceRange'] = $business_details['local_price_range'];
1389
  }
1390
 
1391
  if(isset($business_details['local_accepts_reservations'])){
1392
- $input1['acceptsReservations'] = $business_details['local_accepts_reservations'];
1393
  }
1394
 
1395
  if(isset($business_details['local_serves_cuisine'])){
1396
- $input1['servesCuisine'] = $business_details['local_serves_cuisine'];
1397
  }
1398
 
1399
  if(isset($business_details['local_menu'])){
1400
- $input1['hasMenu'] = $business_details['local_menu'];
1401
  }
1402
  }
1403
 
1404
- // if( 'JobPosting' === $schema_type){
1405
- // global $post;
1406
- // $service_object = new saswp_output_service();
1407
- // $input1 = $service_object->saswp_wp_job_manager_details($post);
1408
- //
1409
- // if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
1410
- // $service = new saswp_output_service();
1411
- // $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
1412
- // }
1413
- // }
1414
 
1415
  //Check for Featured Image
1416
 
@@ -1426,7 +1408,7 @@ function saswp_schema_output() {
1426
  }
1427
  }
1428
 
1429
- if(isset($schema_options['notAccessibleForFree'])==1){
1430
 
1431
  add_filter( 'amp_post_template_data', 'saswp_structure_data_access_scripts');
1432
 
@@ -1442,9 +1424,9 @@ function saswp_schema_output() {
1442
  }
1443
  $paywallData = array("isAccessibleForFree"=> $isAccessibleForFree,
1444
  "hasPart"=>array(
1445
- "@type" => "WebPageElement",
1446
- "isAccessibleForFree" => $isAccessibleForFree,
1447
- "cssSelector" => $paywall_class_name
1448
  )
1449
  );
1450
 
@@ -1472,10 +1454,10 @@ function saswp_post_specific_schema_output() {
1472
  global $sd_data;
1473
 
1474
 
1475
- $logo ='';
1476
- $height ='';
1477
- $width ='';
1478
- $site_name ='';
1479
 
1480
  $service_object = new saswp_output_service();
1481
  $default_logo = $service_object->saswp_get_publisher(true);
@@ -1500,7 +1482,7 @@ function saswp_post_specific_schema_output() {
1500
 
1501
  if(!$all_schemas){
1502
 
1503
- $all_schemas = saswp_get_saved_schema_ids();
1504
 
1505
  }
1506
 
@@ -1539,9 +1521,9 @@ function saswp_post_specific_schema_output() {
1539
  if($saswp_over_all_rating && $saswp_review_count && $saswp_review_item_enable ==1){
1540
 
1541
  $aggregateRating = array(
1542
- "@type"=> "AggregateRating",
1543
- "ratingValue" => $saswp_over_all_rating,
1544
- "reviewCount" => $saswp_review_count
1545
  );
1546
 
1547
  }
@@ -1551,7 +1533,7 @@ function saswp_post_specific_schema_output() {
1551
  if(!empty($kkstar_rating_data)){
1552
 
1553
  $kkstar_aggregateRating = array(
1554
- "@type"=> "AggregateRating",
1555
  "bestRating" => saswp_remove_warnings($kkstar_rating_data, 'best', 'saswp_string'),
1556
  "ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
1557
  "ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
@@ -1564,7 +1546,7 @@ function saswp_post_specific_schema_output() {
1564
 
1565
 
1566
 
1567
- if( 'qanda' === $schema_type){
1568
 
1569
  if(trim(saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array')) ==''){
1570
 
@@ -1575,13 +1557,13 @@ function saswp_post_specific_schema_output() {
1575
 
1576
  $input1 = array(
1577
  '@context' => 'http://schema.org',
1578
- '@type' => 'QAPage' ,
1579
  'mainEntity' => array(
1580
  '@type' => 'Question' ,
1581
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array'),
1582
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_description_'.$schema_id, 'saswp_array'),
1583
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_upvote_count_'.$schema_id, 'saswp_array'),
1584
- 'dateCreated' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_qa_date_created_'.$schema_id, 'saswp_array')),
1585
  'author' => array('@type' => 'Person','name' =>saswp_remove_warnings($all_post_meta, 'saswp_qa_question_author_name_'.$schema_id, 'saswp_array')) ,
1586
  'answerCount' => 2 ,
1587
  'acceptedAnswer' => array(
@@ -1589,7 +1571,7 @@ function saswp_post_specific_schema_output() {
1589
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_upvote_count_'.$schema_id, 'saswp_array'),
1590
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_url_'.$schema_id, 'saswp_array'),
1591
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_text_'.$schema_id, 'saswp_array'),
1592
- 'dateCreated' => date('Y-m-d\TH:i:s\Z',saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_date_created_'.$schema_id, 'saswp_array')),
1593
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_author_name_'.$schema_id, 'saswp_array')),
1594
  ) ,
1595
  'suggestedAnswer' => array(
@@ -1597,7 +1579,7 @@ function saswp_post_specific_schema_output() {
1597
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_upvote_count_'.$schema_id, 'saswp_array'),
1598
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_url_'.$schema_id, 'saswp_array'),
1599
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_text_'.$schema_id, 'saswp_array'),
1600
- 'dateCreated' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_date_created_'.$schema_id, 'saswp_array')),
1601
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_author_name_'.$schema_id, 'saswp_array')),
1602
  ) ,
1603
  )
@@ -1605,22 +1587,22 @@ function saswp_post_specific_schema_output() {
1605
  }
1606
  }
1607
 
1608
- if( 'Event' === $schema_type){
1609
 
1610
  $event_image = get_post_meta( get_the_ID(), 'saswp_event_schema_image_'.$schema_id.'_detail',true);
1611
 
1612
  $input1 = array(
1613
  '@context' => 'http://schema.org',
1614
- '@type' => $schema_type ,
1615
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_name_'.$schema_id, 'saswp_array'),
1616
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_description_'.$schema_id, 'saswp_array'),
1617
- 'startDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_event_schema_start_date_'.$schema_id, 'saswp_array')),
1618
- 'endDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_event_schema_end_date_'.$schema_id, 'saswp_array')),
1619
  'image' => array(
1620
  '@type' =>'ImageObject',
1621
- 'url' => isset($event_image['thumbnail']) ? $event_image['thumbnail']:'' ,
1622
- 'width' => isset($event_image['width']) ? $event_image['width'] :'' ,
1623
- 'height' => isset($event_image['height']) ? $event_image['height'] :'' ,
1624
  ),
1625
  'location' => array(
1626
  '@type' => 'Place',
@@ -1639,7 +1621,7 @@ function saswp_post_specific_schema_output() {
1639
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_price_'.$schema_id, 'saswp_array'),
1640
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_price_currency_'.$schema_id, 'saswp_array'),
1641
  'availability' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_availability_'.$schema_id, 'saswp_array'),
1642
- 'validFrom' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_event_schema_validfrom_'.$schema_id, 'saswp_array')),
1643
  ),
1644
  'performer' => array(
1645
  '@type' => 'PerformingGroup',
@@ -1659,16 +1641,16 @@ function saswp_post_specific_schema_output() {
1659
 
1660
  }
1661
 
1662
- if( 'Course' === $schema_type){
1663
 
1664
  $input1 = array(
1665
  '@context' => 'http://schema.org',
1666
- '@type' => $schema_type ,
1667
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_name_'.$schema_id, 'saswp_array'),
1668
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_course_description_'.$schema_id, 'saswp_array'),
1669
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_course_url_'.$schema_id, 'saswp_array'),
1670
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_course_date_published_'.$schema_id, 'saswp_array')),
1671
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_course_date_modified_'.$schema_id, 'saswp_array')),
1672
  'provider' => array(
1673
  '@type' => 'Organization',
1674
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_provider_name_'.$schema_id, 'saswp_array'),
@@ -1706,8 +1688,8 @@ function saswp_post_specific_schema_output() {
1706
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_description_'.$schema_id, 'saswp_array'),
1707
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_name_'.$schema_id, 'saswp_array'),
1708
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_url_'.$schema_id, 'saswp_array'),
1709
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_blogposting_date_published_'.$schema_id, 'saswp_array')),
1710
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_blogposting_date_modified_'.$schema_id, 'saswp_array')),
1711
  'author' => array(
1712
  '@type' => 'Person',
1713
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array')
@@ -1744,8 +1726,8 @@ function saswp_post_specific_schema_output() {
1744
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1745
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1746
  'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1747
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_published_'.$schema_id, 'saswp_array')),
1748
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_date_modified_'.$schema_id, 'saswp_array')),
1749
  'author' => array(
1750
  '@type' => 'Person',
1751
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array')
@@ -1767,7 +1749,7 @@ function saswp_post_specific_schema_output() {
1767
 
1768
  $input1 = array(
1769
  '@context' => 'http://schema.org',
1770
- '@type' => $schema_type,
1771
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_name_'.$schema_id, 'saswp_array'),
1772
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_description_'.$schema_id, 'saswp_array'),
1773
  'operatingSystem' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_operating_system_'.$schema_id, 'saswp_array'),
@@ -1777,15 +1759,15 @@ function saswp_post_specific_schema_output() {
1777
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_'.$schema_id, 'saswp_array'),
1778
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_currency_'.$schema_id, 'saswp_array'),
1779
  ),
1780
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_software_schema_date_published_'.$schema_id, 'saswp_array')),
1781
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_software_schema_date_modified_'.$schema_id, 'saswp_array')),
1782
 
1783
  );
1784
 
1785
  if(saswp_remove_warnings($all_post_meta, 'saswp_software_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
1786
 
1787
  $input1['aggregateRating'] = array(
1788
- "@type"=> "AggregateRating",
1789
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_rating_'.$schema_id, 'saswp_array'),
1790
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_rating_count_'.$schema_id, 'saswp_array')
1791
  );
@@ -1807,7 +1789,7 @@ function saswp_post_specific_schema_output() {
1807
  $slogo = get_post_meta( get_the_ID(), 'saswp_webpage_organization_logo_'.$schema_id.'_detail',true);
1808
  $input1 = array(
1809
  '@context' => 'http://schema.org',
1810
- '@type' => $schema_type ,
1811
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_name_'.$schema_id, 'saswp_array'),
1812
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_url_'.$schema_id, 'saswp_array'),
1813
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
@@ -1817,8 +1799,8 @@ function saswp_post_specific_schema_output() {
1817
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_image_'.$schema_id, 'saswp_array'),
1818
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
1819
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
1820
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_webpage_date_published_'.$schema_id, 'saswp_array')),
1821
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_webpage_date_modified_'.$schema_id, 'saswp_array')),
1822
  'author' => array(
1823
  '@type' => 'Person',
1824
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'), ),
@@ -1864,8 +1846,8 @@ function saswp_post_specific_schema_output() {
1864
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
1865
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
1866
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
1867
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_article_date_published_'.$schema_id, 'saswp_array')),
1868
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_article_date_modified_'.$schema_id, 'saswp_array')),
1869
  'author' => array(
1870
  '@type' => 'Person',
1871
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array')
@@ -1905,8 +1887,8 @@ function saswp_post_specific_schema_output() {
1905
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_image_'.$schema_id, 'saswp_array'),
1906
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
1907
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
1908
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_published_'.$schema_id, 'saswp_array')),
1909
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_tech_article_date_modified_'.$schema_id, 'saswp_array')),
1910
  'author' => array(
1911
  '@type' => 'Person',
1912
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array')
@@ -1945,10 +1927,19 @@ function saswp_post_specific_schema_output() {
1945
 
1946
  if(isset($all_post_meta['saswp_recipe_ingredient_'.$schema_id])){
1947
 
1948
- $explod = explode(';', $all_post_meta['saswp_recipe_ingredient_'.$schema_id][0]);
1949
- foreach ($explod as $val){
1950
- $ingredient[] = $val;
1951
- }
 
 
 
 
 
 
 
 
 
1952
 
1953
  }
1954
 
@@ -1956,14 +1947,18 @@ function saswp_post_specific_schema_output() {
1956
 
1957
  $explod = explode(';', $all_post_meta['saswp_recipe_instructions_'.$schema_id][0]);
1958
 
1959
- foreach ($explod as $val){
 
 
1960
 
1961
- $instruction[] = array(
1962
- '@type' => "HowToStep",
1963
- 'text' => $val,
1964
- );
1965
-
1966
- }
 
 
1967
 
1968
  }
1969
 
@@ -1998,17 +1993,17 @@ function saswp_post_specific_schema_output() {
1998
  'recipeIngredient' => $ingredient,
1999
  'recipeInstructions' => $instruction,
2000
  'video' => array(
2001
- 'name' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_name_'.$schema_id, 'saswp_array'),
2002
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_description_'.$schema_id, 'saswp_array'),
2003
- 'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_thumbnailurl_'.$schema_id, 'saswp_array'),
2004
- 'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_contenturl_'.$schema_id, 'saswp_array'),
2005
- 'embedUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_embedurl_'.$schema_id, 'saswp_array'),
2006
- 'uploadDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_upload_date_'.$schema_id, 'saswp_array')),
2007
- 'duration' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_duration_'.$schema_id, 'saswp_array'),
2008
  ),
2009
 
2010
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_recipe_date_published_'.$schema_id, 'saswp_array')),
2011
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_recipe_date_modified_'.$schema_id, 'saswp_array')),
2012
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_description_'.$schema_id, 'saswp_array'),
2013
  'mainEntity' => array(
2014
  '@type' => 'WebPage',
@@ -2049,39 +2044,39 @@ function saswp_post_specific_schema_output() {
2049
  'sku' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_sku_'.$schema_id, 'saswp_array'),
2050
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_description_'.$schema_id, 'saswp_array'),
2051
  'image' =>array(
2052
- '@type' =>'ImageObject',
2053
- 'url' =>saswp_remove_warnings($product_image, 'thumbnail', 'saswp_string'),
2054
- 'width' =>saswp_remove_warnings($product_image, 'width', 'saswp_string'),
2055
- 'height' =>saswp_remove_warnings($product_image, 'height', 'saswp_string'),
2056
  ),
2057
  'offers' => array(
2058
- '@type' => 'Offer',
2059
- 'availability' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_availability_'.$schema_id, 'saswp_array'),
2060
- 'itemCondition'=> saswp_remove_warnings($all_post_meta, 'saswp_product_schema_condition_'.$schema_id, 'saswp_array'),
2061
- 'price' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_price_'.$schema_id, 'saswp_array'),
2062
- 'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_currency_'.$schema_id, 'saswp_array'),
2063
- 'url' => get_permalink(),
2064
- 'priceValidUntil'=> date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_product_schema_priceValidUntil_'.$schema_id, 'saswp_array')),
2065
  ),
2066
- 'brand' => array('@type'=>'Thing',
2067
- 'name'=>saswp_remove_warnings($all_post_meta, 'saswp_product_schema_brand_name_'.$schema_id, 'saswp_array'),
2068
  )
2069
  );
2070
 
2071
  if(isset($all_post_meta['saswp_product_schema_gtin8_'.$schema_id])){
2072
- $input1['gtin8'] = $all_post_meta['saswp_product_schema_gtin8_'.$schema_id][0];
2073
  }
2074
  if(isset($all_post_meta['saswp_product_schema_mpn_'.$schema_id])){
2075
- $input1['mpn'] = $all_post_meta['saswp_product_schema_mpn_'.$schema_id][0];
2076
  }
2077
  if(isset($all_post_meta['saswp_product_schema_isbn_'.$schema_id])){
2078
- $input1['isbn'] = $all_post_meta['saswp_product_schema_isbn_'.$schema_id][0];
2079
  }
2080
 
2081
  if(saswp_remove_warnings($all_post_meta, 'saswp_product_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2082
 
2083
  $input1['aggregateRating'] = array(
2084
- "@type"=> "AggregateRating",
2085
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_rating_'.$schema_id, 'saswp_array'),
2086
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_review_count_'.$schema_id, 'saswp_array')
2087
  );
@@ -2105,12 +2100,12 @@ function saswp_post_specific_schema_output() {
2105
 
2106
  $input1 = array(
2107
  '@context' => 'http://schema.org',
2108
- '@type' => $schema_type ,
2109
  'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_main_entity_of_page_'.$schema_id, 'saswp_array'),
2110
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_URL_'.$schema_id, 'saswp_array'),
2111
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_headline_'.$schema_id, 'saswp_array'),
2112
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_date_published_'.$schema_id, 'saswp_array')),
2113
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_date_modified_'.$schema_id, 'saswp_array')),
2114
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_description_'.$schema_id, 'saswp_array'),
2115
  'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_section_'.$schema_id, 'saswp_array'),
2116
  'articleBody' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_body_'.$schema_id, 'saswp_array'),
@@ -2144,7 +2139,7 @@ function saswp_post_specific_schema_output() {
2144
  ),
2145
  );
2146
  if(!empty($aggregateRating)){
2147
- $input1['aggregateRating'] = $aggregateRating;
2148
  }
2149
  if(!empty($kkstar_aggregateRating)){
2150
  $input1['aggregateRating'] = $kkstar_aggregateRating;
@@ -2158,14 +2153,14 @@ function saswp_post_specific_schema_output() {
2158
 
2159
  $input1 = array(
2160
  '@context' => 'http://schema.org',
2161
- '@type' => $schema_type,
2162
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2163
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2164
- 'datePublished' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_video_object_date_published_'.$schema_id, 'saswp_array')),
2165
- 'dateModified' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_video_object_date_modified_'.$schema_id, 'saswp_array')),
2166
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
2167
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2168
- 'uploadDate' => date('Y-m-d\TH:i:s\Z', saswp_remove_warnings($all_post_meta, 'saswp_video_object_upload_date_'.$schema_id, 'saswp_array')),
2169
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
2170
  'mainEntity' => array(
2171
  '@type' => 'WebPage',
@@ -2223,7 +2218,7 @@ function saswp_post_specific_schema_output() {
2223
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_image_'.$schema_id, 'saswp_array'),
2224
  '@id' => get_permalink(),
2225
  'address' => array(
2226
- '@type' => 'PostalAddress',
2227
  'addressLocality' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_locality_'.$schema_id, 'saswp_array'),
2228
  'postalCode' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_postal_code_'.$schema_id, 'saswp_array'),
2229
  'telephone' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_telephone_'.$schema_id, 'saswp_array')
@@ -2248,14 +2243,14 @@ function saswp_post_specific_schema_output() {
2248
  }
2249
  $input1['areaServed'] = $areaServed;
2250
  $input1['hasOfferCatalog'] = array(
2251
- '@type' => 'OfferCatalog',
2252
- 'name' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_name_'.$schema_id, 'saswp_array'),
2253
  'itemListElement' => $serviceOffer
2254
  );
2255
 
2256
  if(saswp_remove_warnings($all_post_meta, 'saswp_service_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2257
  $input1['aggregateRating'] = array(
2258
- "@type"=> "AggregateRating",
2259
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_rating_'.$schema_id, 'saswp_array'),
2260
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_review_count_'.$schema_id, 'saswp_array')
2261
  );
@@ -2290,7 +2285,7 @@ function saswp_post_specific_schema_output() {
2290
  }
2291
 
2292
  $input1['@context'] = 'http://schema.org';
2293
- $input1['@type'] = $schema_type;
2294
  $input1['url'] = get_permalink();
2295
  $input1['datePublished'] = get_the_date("Y-m-d\TH:i:s\Z");
2296
  $input1['dateModified'] = get_the_modified_date("Y-m-d\TH:i:s\Z");
@@ -2298,11 +2293,11 @@ function saswp_post_specific_schema_output() {
2298
  if($review_author){
2299
 
2300
  $input1['author']['@type'] = 'Person';
2301
- $input1['author']['name'] = $review_author;
2302
 
2303
  if(isset($all_post_meta['saswp_review_schema_author_sameas_'.$schema_id])){
2304
 
2305
- $input1['author']['sameAs'] = $all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0];
2306
 
2307
  }
2308
 
@@ -2311,11 +2306,11 @@ function saswp_post_specific_schema_output() {
2311
  if($site_name && $logo && $width && $height){
2312
 
2313
  $input1['Publisher']['@type'] = 'Organization';
2314
- $input1['Publisher']['name'] = $site_name;
2315
  $input1['Publisher']['logo']['@type'] = 'ImageObject';
2316
- $input1['Publisher']['logo']['url'] = $logo;
2317
- $input1['Publisher']['logo']['width'] = $width;
2318
- $input1['Publisher']['logo']['height'] = $height;
2319
 
2320
  }
2321
 
@@ -2329,54 +2324,54 @@ function saswp_post_specific_schema_output() {
2329
  }
2330
 
2331
  if(isset($all_post_meta['saswp_review_schema_item_type_'.$schema_id])){
2332
- $input1['itemReviewed']['@type'] = $all_post_meta['saswp_review_schema_item_type_'.$schema_id][0];
2333
  }
2334
  if(isset($all_post_meta['saswp_review_schema_name_'.$schema_id])){
2335
- $input1['itemReviewed']['name'] = $all_post_meta['saswp_review_schema_name_'.$schema_id][0];
2336
  }
2337
  if(isset($all_post_meta['saswp_review_schema_url_'.$schema_id])){
2338
- $input1['itemReviewed']['url'] = $all_post_meta['saswp_review_schema_url_'.$schema_id][0];
2339
  }
2340
 
2341
  if(isset($all_post_meta['saswp_review_schema_price_range_'.$schema_id])){
2342
 
2343
- $input1['itemReviewed']['priceRange'] = $all_post_meta['saswp_review_schema_price_range_'.$schema_id][0];
2344
 
2345
  }
2346
 
2347
  if(isset($all_post_meta['saswp_review_schema_telephone_'.$schema_id])){
2348
 
2349
- $input1['itemReviewed']['telephone'] = $all_post_meta['saswp_review_schema_telephone_'.$schema_id][0];
2350
 
2351
  }
2352
 
2353
  if(isset($all_post_meta['saswp_review_schema_servescuisine_'.$schema_id])){
2354
 
2355
- $input1['itemReviewed']['servesCuisine'] = $all_post_meta['saswp_review_schema_servescuisine_'.$schema_id][0];
2356
 
2357
  }
2358
 
2359
  if(isset($all_post_meta['saswp_review_schema_menu_'.$schema_id])){
2360
 
2361
- $input1['itemReviewed']['hasMenu'] = $all_post_meta['saswp_review_schema_menu_'.$schema_id][0];
2362
 
2363
  }
2364
 
2365
  if(isset($all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id])){
2366
 
2367
- $input1['itemReviewed']['sameAs'] = $all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id][0];
2368
 
2369
  }
2370
 
2371
 
2372
  if(isset($all_post_meta['saswp_review_schema_director_'.$schema_id])){
2373
 
2374
- $input1['itemReviewed']['director'] = $all_post_meta['saswp_review_schema_director_'.$schema_id][0];
2375
 
2376
  }
2377
  if(isset($all_post_meta['saswp_review_schema_date_created_'.$schema_id])){
2378
 
2379
- $input1['itemReviewed']['dateCreated'] = date_format(date_create($all_post_meta['saswp_review_schema_date_created_'.$schema_id][0]), "Y-m-d\TH:i:s\Z");
2380
 
2381
  }
2382
 
@@ -2384,10 +2379,10 @@ function saswp_post_specific_schema_output() {
2384
 
2385
  if(!empty($review_image)){
2386
 
2387
- $input1['itemReviewed']['image']['@type'] = 'ImageObject';
2388
- $input1['itemReviewed']['image']['url'] = $review_image['thumbnail'];
2389
- $input1['itemReviewed']['image']['width'] = $review_image['width'];
2390
- $input1['itemReviewed']['image']['height']= $review_image['height'];
2391
 
2392
  }
2393
 
@@ -2400,13 +2395,9 @@ function saswp_post_specific_schema_output() {
2400
  $input1['itemReviewed']['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_review_schema_region_'.$schema_id, 'saswp_array');
2401
  $input1['itemReviewed']['address']['postalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_review_schema_postal_code_'.$schema_id, 'saswp_array');
2402
  $input1['itemReviewed']['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_review_schema_country_'.$schema_id, 'saswp_array');
2403
-
2404
-
2405
  }
2406
-
2407
-
2408
-
2409
-
2410
  switch ($all_post_meta['saswp_review_schema_item_type_'.$schema_id][0]) {
2411
 
2412
  case 'Article':
@@ -2430,9 +2421,9 @@ function saswp_post_specific_schema_output() {
2430
  }
2431
  if($review_author) {
2432
 
2433
- $input1['itemReviewed']['author']['@type'] = 'Person';
2434
- $input1['itemReviewed']['author']['name'] = $review_author;
2435
- $input1['itemReviewed']['author']['sameAs'] = $all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0];
2436
 
2437
  }
2438
 
@@ -2453,8 +2444,7 @@ function saswp_post_specific_schema_output() {
2453
 
2454
  $input1['author']['sameAs'] = get_permalink();
2455
 
2456
- }
2457
-
2458
 
2459
  break;
2460
  case 'MusicPlaylist':
@@ -2490,9 +2480,9 @@ function saswp_post_specific_schema_output() {
2490
  if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2491
 
2492
  $input1['reviewRating'] = array(
2493
- "@type"=> "Rating",
2494
- "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_rating_'.$schema_id, 'saswp_array'),
2495
- "bestRating" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_review_count_'.$schema_id, 'saswp_array')
2496
  );
2497
  }
2498
  unset($input1['aggregateRating']);
@@ -2502,7 +2492,7 @@ function saswp_post_specific_schema_output() {
2502
  if( 'local_business' === $schema_type){
2503
 
2504
  $operation_days = explode( "rn", esc_html( stripslashes(saswp_remove_warnings($all_post_meta, 'saswp_dayofweek_'.$schema_id, 'saswp_array'))) );;
2505
- $business_sub_name ='';
2506
  $business_type = saswp_remove_warnings($all_post_meta, 'saswp_business_type_'.$schema_id, 'saswp_array');
2507
  $post_specific_obj = new saswp_post_specific();
2508
  $check_business_type = $post_specific_obj->saswp_get_sub_business_array($business_type);
@@ -2538,11 +2528,11 @@ function saswp_post_specific_schema_output() {
2538
  'height' => saswp_remove_warnings($local_image, 'height', 'saswp_string'),
2539
  ),
2540
  'address' => array(
2541
- "@type" => "PostalAddress",
2542
- "streetAddress" => saswp_remove_warnings($all_post_meta, 'local_street_address_'.$schema_id, 'saswp_array'),
2543
- "addressLocality"=> saswp_remove_warnings($all_post_meta, 'local_city_'.$schema_id, 'saswp_array'),
2544
- "addressRegion" => saswp_remove_warnings($all_post_meta, 'local_state_'.$schema_id, 'saswp_array'),
2545
- "postalCode" => saswp_remove_warnings($all_post_meta, 'local_postal_code_'.$schema_id, 'saswp_array'),
2546
  ),
2547
  'telephone' => saswp_remove_warnings($all_post_meta, 'local_phone_'.$schema_id, 'saswp_array'),
2548
  'openingHours' => $operation_days,
@@ -2553,7 +2543,7 @@ function saswp_post_specific_schema_output() {
2553
  if(isset($all_post_meta['local_enable_rating_'.$schema_id])){
2554
 
2555
  $input1['aggregateRating'] = array(
2556
- "@type"=> "AggregateRating",
2557
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'local_rating_'.$schema_id, 'saswp_array'),
2558
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'local_review_count_'.$schema_id, 'saswp_array')
2559
  );
@@ -2569,19 +2559,19 @@ function saswp_post_specific_schema_output() {
2569
  $input1 = array_merge($input1, $extra_theme_review);
2570
  }
2571
  if(isset($all_post_meta['local_price_range_'.$schema_id][0])){
2572
- $input1['priceRange'] = $all_post_meta['local_price_range_'.$schema_id][0];
2573
  }
2574
 
2575
  if(isset($all_post_meta['local_accepts_reservations_'.$schema_id][0])){
2576
- $input1['acceptsReservations'] = $all_post_meta['local_price_accepts_reservations_'.$schema_id][0];
2577
  }
2578
 
2579
  if(isset($all_post_meta['local_serves_cuisine_'.$schema_id][0])){
2580
- $input1['servesCuisine'] = $all_post_meta['local_serves_cuisine_'.$schema_id][0];
2581
  }
2582
 
2583
  if(isset($all_post_meta['local_menu_'.$schema_id][0])){
2584
- $input1['hasMenu'] = $all_post_meta['local_menu_'.$schema_id][0];
2585
  }
2586
  }
2587
 
@@ -2598,7 +2588,9 @@ function saswp_post_specific_schema_output() {
2598
  }
2599
 
2600
  if(!empty($input1)){
2601
- $all_schema_output[] = $input1;
 
 
2602
  }
2603
  }
2604
  }
@@ -2661,7 +2653,7 @@ function saswp_kb_website_output(){
2661
  'name' => $site_name,
2662
  'potentialAction' => array(
2663
  '@type' => 'SearchAction',
2664
- 'target' => $site_url.'/?s={search_term_string}',
2665
  'query-input' => 'required name=search_term_string',
2666
  )
2667
  );
@@ -2710,18 +2702,18 @@ function saswp_archive_output(){
2710
  if(!empty($image_details)){
2711
 
2712
  $archive_image['@type'] = 'ImageObject';
2713
- $archive_image['url'] = $image_details[0];
2714
- $archive_image['width'] = $image_details[1];
2715
- $archive_image['height'] = $image_details[2];
2716
 
2717
  }else{
2718
 
2719
  if(isset($sd_data['sd_default_image'])){
2720
 
2721
  $archive_image['@type'] = 'ImageObject';
2722
- $archive_image['url'] = $sd_data['sd_default_image']['url'];
2723
- $archive_image['width'] = $sd_data['sd_default_image_width'];
2724
- $archive_image['height'] = $sd_data['sd_default_image_height'];
2725
  }
2726
 
2727
 
@@ -2729,21 +2721,22 @@ function saswp_archive_output(){
2729
 
2730
  $publisher_info = array(
2731
  "type" => "Organization",
2732
- "name" => $site_name,
2733
  "logo" => array(
2734
  "@type" => "ImageObject",
2735
- "name" => $site_name,
2736
- "width" => $logo['width'],
2737
- "height" => $logo['height'],
2738
- "url" => $logo['url']
2739
  )
2740
  );
 
2741
  $publisher_info['name'] = get_bloginfo('name');
2742
  $publisher_info['id'] = get_the_permalink();
2743
 
2744
  $category_posts[] = array(
2745
 
2746
- '@type' => $schema_type,
2747
  'headline' => get_the_title(),
2748
  'url' => get_the_permalink(),
2749
  'datePublished' => get_the_date('c'),
@@ -2767,9 +2760,9 @@ function saswp_archive_output(){
2767
  (
2768
  '@context' => 'http://schema.org/',
2769
  '@type' => "CollectionPage",
2770
- 'headline' => $category_headline,
2771
  'description' => strip_tags(category_description()),
2772
- 'url' => $category_link,
2773
  'sameAs' => '',
2774
  'hasPart' => $category_posts
2775
  );
@@ -2964,8 +2957,8 @@ function saswp_site_navigation_output(){
2964
  "@context" => "https://schema.org",
2965
  "@type" => "SiteNavigationElement",
2966
  "@id" => trailingslashit(get_home_url()).$type,
2967
- "name" => $items->title,
2968
- "url" => $items->url
2969
  );
2970
 
2971
  }
@@ -2982,8 +2975,8 @@ function saswp_site_navigation_output(){
2982
  "@context" => "https://schema.org",
2983
  "@type" => "SiteNavigationElement",
2984
  "@id" => trailingslashit(get_home_url()).$type,
2985
- "name" => $items->title,
2986
- "url" => $items->url
2987
  );
2988
 
2989
  }
9
 
10
  global $sd_data;
11
  $input = array();
12
+ // Social profile
13
  $sd_social_profile = array();
14
 
15
  $sd_facebook = array();
16
+
17
  if(isset($sd_data['sd_facebook']) && !empty($sd_data['sd_facebook'])){
18
  $sd_facebook[] = $sd_data['sd_facebook'];
19
  $sd_social_profile[] = $sd_facebook;
66
  }
67
 
68
  $platform = array();
69
+
70
  foreach ($sd_social_profile as $key => $value) {
71
  $platform[] = $value;
72
  }
106
 
107
  'contactPoint' => array(
108
  '@type' => 'ContactPoint',
109
+ 'contactType' => esc_attr($contact_1),
110
+ 'telephone' => esc_attr($telephone_1),
111
  )
112
 
113
  );
114
 
115
  $input = array(
116
  '@context' =>'http://schema.org',
117
+ '@type' => esc_attr($sd_data['saswp_organization_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,
123
  if($logo !='' && $width !='' && $height !=''){
124
 
125
  $input['logo']['@type'] = 'ImageObject';
126
+ $input['logo']['url'] = esc_url($logo);
127
+ $input['logo']['width'] = esc_attr($width);
128
+ $input['logo']['height'] = esc_attr($height);
129
 
130
  }
131
+
132
+ $input = array_merge($input, $contact_info);
133
+
 
 
 
134
  }
135
  // Person
136
 
162
 
163
  $input = array(
164
  '@context' => 'http://schema.org',
165
+ '@type' => esc_attr($sd_data['saswp_kb_type']),
166
+ 'name' => esc_attr($sd_data['sd-person-name']),
167
+ 'url' => esc_url($sd_data['sd-person-url']),
168
  'image' => array(
169
  '@type' => 'ImageObject',
170
+ 'url' => esc_url($image),
171
+ 'width' => esc_attr($width),
172
+ 'height' => esc_attr($height),
173
  ),
174
+ 'telephone' => esc_attr($sd_data['sd-person-phone-number']),
175
  );
176
  }
177
 
299
 
300
  $extra_theme_review = array();
301
  $extra_theme_review = $service_object->saswp_extra_theme_review_details(get_the_ID());
302
+
 
 
 
 
303
  if( 'Course' === $schema_type){
304
 
305
  $input1 = array(
308
  'name' => get_the_title(),
309
  'description' => strip_tags(get_the_excerpt()),
310
  'url' => get_permalink(),
311
+ 'datePublished' => esc_html($date),
312
+ 'dateModified' => esc_html($modified_date),
313
  'provider' => array(
314
  '@type' => 'Organization',
315
  'name' => get_bloginfo(),
347
  'description' => strip_tags(get_the_excerpt()),
348
  'name' => get_the_title(),
349
  'url' => get_permalink(),
350
+ 'datePublished' => esc_html($date),
351
+ 'dateModified' => esc_html($modified_date),
352
  'author' => array(
353
  '@type' => 'Person',
354
+ 'name' => esc_attr($aurthor_name)
355
  )
356
  );
357
  if(!empty($publisher)){
373
  if(!empty($extra_theme_review)){
374
  $input1 = array_merge($input1, $extra_theme_review);
375
  }
376
+ if(isset($sd_data['saswp_comments_schema']) && $sd_data['saswp_comments_schema'] == 1){
377
  $input1['comment'] = saswp_get_comments(get_the_ID());
378
  }
379
 
395
  'dateModified' => $modified_date,
396
  'author' => array(
397
  '@type' => 'Person',
398
+ 'name' => esc_attr($aurthor_name)
399
  ),
400
  );
401
  if(!empty($publisher)){
402
 
403
  $input1 = array_merge($input1, $publisher);
404
 
405
+ }
406
+
407
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
408
  $service = new saswp_output_service();
409
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
452
  'endDate' => isset($schema_data['saswp_event_schema_end_date']) && $schema_data['saswp_event_schema_end_date'] !='' ? date('Y-m-d\TH:i:s\Z',$schema_data['saswp_event_schema_end_date']):'',
453
  'image' => array(
454
  '@type' =>'ImageObject',
455
+ 'url' => isset($schema_data['saswp_event_schema_image']) ? esc_url($schema_data['saswp_event_schema_image']['url']):'' ,
456
+ 'width' => isset($schema_data['saswp_event_schema_image']) ? esc_attr($schema_data['saswp_event_schema_image']['width']):'' ,
457
+ 'height' => isset($schema_data['saswp_event_schema_image']) ? esc_attr($schema_data['saswp_event_schema_image']['height']):'' ,
458
  ),
459
  'location' => array(
460
  '@type' => 'Place',
525
  'dateModified' => $modified_date,
526
  'author' => array(
527
  '@type' => 'Person',
528
+ 'name' => esc_attr($aurthor_name)
529
  ),
530
  );
531
 
532
  if(isset($schema_data['saswp_software_schema_rating']) && $schema_data['saswp_software_schema_rating'] >0 && isset($schema_data['saswp_software_schema_rating_count']) && $schema_data['saswp_software_schema_rating_count'] >0 && $schema_data['saswp_software_schema_enable_rating'] == 1){
533
  $input1['aggregateRating'] = array(
534
  '@type' => 'AggregateRating',
535
+ 'ratingValue' => esc_attr($schema_data['saswp_software_schema_rating']),
536
+ 'ratingCount' => (int)esc_attr($schema_data['saswp_software_schema_rating_count']),
537
  );
538
  }
539
 
628
  '@type' => $schema_type ,
629
  'url' => get_permalink(),
630
  'name' => get_the_title(),
631
+ 'datePublished' => esc_html($date),
632
+ 'dateModified' => esc_html($modified_date),
633
  'description' => strip_tags(get_the_excerpt()),
634
  'mainEntity' => array(
635
  '@type' => 'WebPage',
636
  '@id' => get_permalink(),
637
  'author' => array(
638
  '@type' => 'Person',
639
+ 'name' => esc_attr($aurthor_name),
640
  'Image' => array(
641
  '@type' => 'ImageObject',
642
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
710
 
711
  );
712
  if(isset($product_details['product_gtin8']) && $product_details['product_gtin8'] !=''){
713
+ $input1['gtin8'] = esc_attr($product_details['product_gtin8']);
714
  }
715
  if(isset($product_details['product_mpn']) && $product_details['product_mpn'] !=''){
716
+ $input1['mpn'] = esc_attr($product_details['product_mpn']);
717
  }
718
  if(isset($product_details['product_isbn']) && $product_details['product_isbn'] !=''){
719
+ $input1['isbn'] = esc_attr($product_details['product_isbn']);
720
  }
721
  if(isset($product_details['product_brand']) && $product_details['product_brand'] !=''){
722
+ $input1['brand'] = array('@type'=>'Thing','name'=> esc_attr($product_details['product_brand']));
723
  }
724
  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){
725
  $input1['aggregateRating'] = array(
726
  '@type' => 'AggregateRating',
727
+ 'ratingValue' => esc_attr($product_details['product_average_rating']),
728
+ 'reviewCount' => (int)esc_attr($product_details['product_review_count']),
729
  );
730
  }
731
  if(!empty($product_details['product_reviews'])){
736
 
737
  $reviews[] = array(
738
  '@type' => 'Review',
739
+ 'author' => esc_attr($review['author']),
740
+ 'datePublished' => esc_html($review['datePublished']),
741
  'description' => $review['description'],
742
  'reviewRating' => array(
743
  '@type' => 'Rating',
744
  'bestRating' => '5',
745
+ 'ratingValue' => esc_attr($review['reviewRating']),
746
  'worstRating' => '1',
747
  )
748
  );
763
  'description' => saswp_remove_warnings($schema_data, 'saswp_product_schema_description', 'saswp_string'),
764
  'image' => array(
765
  '@type' =>'ImageObject',
766
+ 'url' => isset($schema_data['saswp_product_schema_image']) ? esc_url($schema_data['saswp_product_schema_image']['url']):'' ,
767
+ 'width' => isset($schema_data['saswp_product_schema_image']) ? esc_attr($schema_data['saswp_product_schema_image']['width']):'' ,
768
+ 'height' => isset($schema_data['saswp_product_schema_image']) ? esc_attr($schema_data['saswp_product_schema_image']['height']):'' ,
769
+ ),
770
  'offers' => array(
771
+ '@type' => 'Offer',
772
+ 'availability' => saswp_remove_warnings($schema_data, 'saswp_product_schema_availability', 'saswp_string'),
773
+ 'itemCondition' => saswp_remove_warnings($schema_data, 'saswp_product_schema_condition', 'saswp_string'),
774
+ 'price' => saswp_remove_warnings($schema_data, 'saswp_product_schema_price', 'saswp_string'),
775
+ 'priceCurrency' => saswp_remove_warnings($schema_data, 'saswp_product_schema_currency', 'saswp_string'),
776
+ 'url' => get_permalink(),
777
+ 'priceValidUntil' => saswp_remove_warnings($schema_data, 'saswp_product_schema_priceValidUntil', 'saswp_string'),
778
  ),
779
+ 'brand' => array(
780
+ '@type'=>'Thing',
781
  'name'=>saswp_remove_warnings($schema_data, 'saswp_product_schema_brand_name', 'saswp_string'),
782
  )
783
  );
784
 
785
 
786
  if(isset($schema_data['saswp_product_schema_gtin8']) && $schema_data['saswp_product_schema_gtin8'] !=''){
787
+ $input1['gtin8'] = esc_attr($schema_data['saswp_product_schema_gtin8']);
788
  }
789
+
790
  if(isset($schema_data['saswp_product_schema_mpn']) && $schema_data['saswp_product_schema_mpn'] !=''){
791
+ $input1['mpn'] = esc_attr($schema_data['saswp_product_schema_mpn']);
792
  }
793
+
794
  if(isset($schema_data['saswp_product_schema_isbn']) && $schema_data['saswp_product_schema_isbn'] !=''){
795
+ $input1['isbn'] = esc_attr($schema_data['saswp_product_schema_isbn']);
796
  }
797
 
798
  if(isset($schema_data['saswp_product_schema_enable_rating'])){
799
 
800
  $input1['aggregateRating'] = array(
801
+ "@type" => "AggregateRating",
802
  "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_product_schema_rating', 'saswp_string'),
803
  "reviewCount" => saswp_remove_warnings($schema_data, 'saswp_product_schema_review_count', 'saswp_string')
804
  );
842
  'url' => get_permalink(),
843
  'headline' => get_the_title(),
844
  'mainEntityOfPage' => get_the_permalink(),
845
+ 'datePublished' => esc_html($date),
846
+ 'dateModified' => esc_html($modified_date),
847
  'description' => strip_tags(get_the_excerpt()),
848
  'articleSection' => $article_section,
849
  'articleBody' => strip_tags(get_the_excerpt()),
857
  ),
858
  'author' => array(
859
  '@type' => 'Person',
860
+ 'name' => esc_attr($aurthor_name),
861
  'Image' => array(
862
  '@type' => 'ImageObject',
863
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
910
  'name' => saswp_remove_warnings($schema_data, 'saswp_service_schema_provider_name', 'saswp_string'),
911
  'image' => array(
912
  '@type' =>'ImageObject',
913
+ 'url' =>isset($schema_data['saswp_service_schema_image']) ? esc_url($schema_data['saswp_service_schema_image']['url']):'' ,
914
+ 'width' =>isset($schema_data['saswp_service_schema_image']) ? esc_attr($schema_data['saswp_service_schema_image']['width']):'' ,
915
+ 'height' =>isset($schema_data['saswp_service_schema_image']) ? esc_attr($schema_data['saswp_service_schema_image']['height']):'' ,
916
  ),
917
  '@id' => get_permalink(),
918
  'address' => array(
919
+ '@type' => 'PostalAddress',
920
  'addressLocality' => saswp_remove_warnings($schema_data, 'saswp_service_schema_locality', 'saswp_string'),
921
  'postalCode' => saswp_remove_warnings($schema_data, 'saswp_service_schema_postal_code', 'saswp_string'),
922
  'telephone' => saswp_remove_warnings($schema_data, 'saswp_service_schema_telephone', 'saswp_string')
954
  'itemListElement' => $serviceOffer
955
  );
956
 
957
+ if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] == 1){
958
+
959
  $service = new saswp_output_service();
960
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
961
+
962
  }
963
 
964
  if(isset($schema_data['saswp_service_schema_enable_rating'])){
990
 
991
  $input1 = array(
992
  '@context' => 'http://schema.org',
993
+ '@type' => 'Review',
994
+ 'dateCreated' => esc_html($date),
995
+ 'datePublished' => esc_html($date),
996
+ 'dateModified' => esc_html($modified_date),
997
  'headline' => get_the_title(),
998
  'name' => get_the_title(),
999
  'keywords' => tie_get_plain_terms( get_the_ID(), 'post_tag' ),
1002
  'copyrightYear' => get_the_time( 'Y' ),
1003
  'author' => array(
1004
  '@type' => 'Person',
1005
+ 'name' => esc_attr($aurthor_name),
1006
  'Image' => array(
1007
  '@type' => 'ImageObject',
1008
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
1030
  '@type' => 'Rating',
1031
  'worstRating' => 1,
1032
  'bestRating' => 5,
1033
+ 'ratingValue' => esc_attr($total_score),
1034
  'description' => get_post_meta( get_the_ID(), 'taq_review_summary', true ),
1035
  );
1036
 
1050
  }
1051
 
1052
  $input1['@context'] = 'http://schema.org';
1053
+ $input1['@type'] = esc_attr($schema_type);
1054
  $input1['url'] = get_permalink();
1055
+ $input1['datePublished'] = esc_html($date);
1056
+ $input1['dateModified'] = esc_html($modified_date);
1057
 
1058
  if($review_author){
1059
 
1060
  $input1['author']['@type'] = 'Person';
1061
+ $input1['author']['name'] = esc_attr($review_author);
1062
 
1063
  if(isset($schema_data['saswp_review_schema_author_sameas'])){
1064
 
1065
+ $input1['author']['sameAs'] = esc_url($schema_data['saswp_review_schema_author_sameas']);
1066
 
1067
  }
1068
 
1084
  }
1085
 
1086
  if(isset($schema_data['saswp_review_schema_item_type'])){
1087
+ $input1['itemReviewed']['@type'] = esc_attr($schema_data['saswp_review_schema_item_type']);
1088
  }
1089
  if(isset($schema_data['saswp_review_schema_name'])){
1090
+ $input1['itemReviewed']['name'] = esc_attr($schema_data['saswp_review_schema_name']);
1091
  }
1092
  if(isset($schema_data['saswp_review_schema_url'])){
1093
+ $input1['itemReviewed']['url'] = esc_url($schema_data['saswp_review_schema_url']);
1094
+ }
1095
+ if(isset($schema_data['saswp_review_schema_price_range'])){
1096
+ $input1['itemReviewed']['priceRange'] = esc_attr($schema_data['saswp_review_schema_price_range']);
1097
+ }
1098
+ if(isset($schema_data['saswp_review_schema_telephone'])){
1099
+ $input1['itemReviewed']['telephone'] = esc_attr($schema_data['saswp_review_schema_telephone']);
1100
+ }
1101
+ if(isset($schema_data['saswp_review_schema_servescuisine'])){
1102
+ $input1['itemReviewed']['servesCuisine'] = esc_attr($schema_data['saswp_review_schema_servescuisine']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1103
  }
1104
+ if(isset($schema_data['saswp_review_schema_menu'])){
1105
+ $input1['itemReviewed']['hasMenu'] = esc_url($schema_data['saswp_review_schema_menu']);
1106
+ }
1107
+ if(isset($schema_data['saswp_review_schema_itemreviewed_sameas'])){
1108
+ $input1['itemReviewed']['sameAs'] = esc_url($schema_data['saswp_review_schema_itemreviewed_sameas']);
1109
  }
1110
 
1111
 
1112
  if(isset($schema_data['saswp_review_schema_director'])){
1113
 
1114
+ $input1['itemReviewed']['director'] = esc_attr($schema_data['saswp_review_schema_director']);
1115
 
1116
  }
1117
  if(isset($schema_data['saswp_review_schema_date_created'])){
1124
  if(isset($schema_data['saswp_review_schema_image'])){
1125
 
1126
  $input1['itemReviewed']['image']['@type'] = 'ImageObject';
1127
+ $input1['itemReviewed']['image']['url'] = esc_url($schema_data['saswp_review_schema_image']);
1128
+ $input1['itemReviewed']['image']['width'] = esc_attr($schema_data['saswp_review_schema_image_detail']['width']);
1129
+ $input1['itemReviewed']['image']['height']= esc_attr($schema_data['saswp_review_schema_image_detail']['height']);
1130
 
1131
  }
1132
 
1133
  if(saswp_remove_warnings($schema_data, 'saswp_review_schema_street_address', 'saswp_string') !='' || saswp_remove_warnings($schema_data, 'saswp_review_schema_locality', 'saswp_string') !=''){
1134
 
1135
+ $input1['itemReviewed']['address']['@type'] = 'PostalAddress';
1136
+ $input1['itemReviewed']['address']['streetAddress'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_street_address', 'saswp_string');
1137
  $input1['itemReviewed']['address']['addressLocality'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_locality', 'saswp_string');
1138
+ $input1['itemReviewed']['address']['addressRegion'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_region', 'saswp_string');
1139
+ $input1['itemReviewed']['address']['postalCode'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_postal_code', 'saswp_string');
1140
+ $input1['itemReviewed']['address']['addressCountry'] = saswp_remove_warnings($schema_data, 'saswp_review_schema_country', 'saswp_string');
1141
 
1142
  }
1143
 
1168
  if($review_author) {
1169
 
1170
  $input1['itemReviewed']['author']['@type'] = 'Person';
1171
+ $input1['itemReviewed']['author']['name'] = esc_attr($review_author);
1172
+ $input1['itemReviewed']['author']['sameAs'] = esc_url($schema_data['saswp_review_schema_author_sameas']);
1173
+
1174
  }
1175
 
1176
  break;
1228
  if(isset($schema_data['saswp_review_schema_enable_rating']) && saswp_remove_warnings($schema_data, 'saswp_review_schema_rating', 'saswp_string') !='' && saswp_remove_warnings($schema_data, 'saswp_review_schema_review_count', 'saswp_string') !=''){
1229
 
1230
  $input1['reviewRating'] = array(
1231
+ "@type" => "Rating",
1232
+ "ratingValue" => saswp_remove_warnings($schema_data, 'saswp_review_schema_rating', 'saswp_string'),
1233
+ "bestRating" => saswp_remove_warnings($schema_data, 'saswp_review_schema_review_count', 'saswp_string'),
1234
  );
1235
  }
1236
 
1237
  if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] ==1){
1238
+
1239
  $service = new saswp_output_service();
1240
  $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
1241
+
1242
  }
1243
 
1244
 
1256
 
1257
  $input1 = array(
1258
  '@context' => 'http://schema.org',
1259
+ '@type' => 'VideoObject',
1260
  'url' => get_permalink(),
1261
  'headline' => get_the_title(),
1262
+ 'datePublished' => esc_html($date),
1263
+ 'dateModified' => esc_html($modified_date),
1264
  'description' => strip_tags(get_the_excerpt()),
1265
  'name' => get_the_title(),
1266
+ 'uploadDate' => esc_html($date),
1267
+ 'thumbnailUrl' => esc_url($image_details[0]),
1268
  'mainEntity' => array(
1269
  '@type' => 'WebPage',
1270
  '@id' => get_permalink(),
1271
  ),
1272
  'author' => array(
1273
  '@type' => 'Person',
1274
+ 'name' => esc_attr($aurthor_name),
1275
  'Image' => array(
1276
  '@type' => 'ImageObject',
1277
  'url' => saswp_remove_warnings($author_details, 'url', 'saswp_string'),
1324
 
1325
  $input1 = array(
1326
  '@context' => 'http://schema.org',
1327
+ '@type' => esc_attr($local_business),
1328
  'name' => saswp_remove_warnings($business_details, 'local_business_name', 'saswp_string'),
1329
  'url' => get_permalink(),
1330
  'description' => strip_tags(get_the_excerpt()),
1331
  'image' => array(
1332
  '@type' => 'ImageObject',
1333
+ 'url' => isset($business_details['local_business_logo']) ? esc_url($business_details['local_business_logo']['url']):'',
1334
+ 'width' => isset($business_details['local_business_logo']) ? esc_attr($business_details['local_business_logo']['width']):'',
1335
+ 'height' => isset($business_details['local_business_logo']) ? esc_attr($business_details['local_business_logo']['height']):'',
1336
  ),
1337
  'address' => array(
1338
+ "@type" => "PostalAddress",
1339
+ "streetAddress" => saswp_remove_warnings($business_details, 'local_street_address', 'saswp_string'),
1340
+ "addressLocality" => saswp_remove_warnings($business_details, 'local_city', 'saswp_string'),
1341
+ "addressRegion" => saswp_remove_warnings($business_details, 'local_state', 'saswp_string'),
1342
+ "postalCode" => saswp_remove_warnings($business_details, 'local_postal_code', 'saswp_string'),
1343
  ),
1344
  'telephone' => saswp_remove_warnings($business_details, 'local_phone', 'saswp_string'),
1345
+ 'openingHours' => $dayoftheweek,
1346
 
1347
  );
1348
+ if(isset($schema_options['enable_custom_field']) && $schema_options['enable_custom_field'] == 1){
1349
+
1350
+ $service = new saswp_output_service();
1351
+ $input1 = $service->saswp_replace_with_custom_fields_value($input1, $schema_post_id);
1352
+
1353
  }
1354
 
1355
 
1377
  $input1 = array_merge($input1, $extra_theme_review);
1378
  }
1379
  if(isset($business_details['local_price_range'])){
1380
+ $input1['priceRange'] = esc_attr($business_details['local_price_range']);
1381
  }
1382
 
1383
  if(isset($business_details['local_accepts_reservations'])){
1384
+ $input1['acceptsReservations'] = esc_attr($business_details['local_accepts_reservations']);
1385
  }
1386
 
1387
  if(isset($business_details['local_serves_cuisine'])){
1388
+ $input1['servesCuisine'] = esc_attr($business_details['local_serves_cuisine']);
1389
  }
1390
 
1391
  if(isset($business_details['local_menu'])){
1392
+ $input1['hasMenu'] = esc_url($business_details['local_menu']);
1393
  }
1394
  }
1395
 
 
 
 
 
 
 
 
 
 
 
1396
 
1397
  //Check for Featured Image
1398
 
1408
  }
1409
  }
1410
 
1411
+ if(isset($schema_options['notAccessibleForFree']) == 1){
1412
 
1413
  add_filter( 'amp_post_template_data', 'saswp_structure_data_access_scripts');
1414
 
1424
  }
1425
  $paywallData = array("isAccessibleForFree"=> $isAccessibleForFree,
1426
  "hasPart"=>array(
1427
+ "@type" => "WebPageElement",
1428
+ "isAccessibleForFree" => esc_attr($isAccessibleForFree),
1429
+ "cssSelector" => esc_attr($paywall_class_name)
1430
  )
1431
  );
1432
 
1454
  global $sd_data;
1455
 
1456
 
1457
+ $logo = '';
1458
+ $height = '';
1459
+ $width = '';
1460
+ $site_name = '';
1461
 
1462
  $service_object = new saswp_output_service();
1463
  $default_logo = $service_object->saswp_get_publisher(true);
1482
 
1483
  if(!$all_schemas){
1484
 
1485
+ $all_schemas = saswp_get_saved_schema_ids();
1486
 
1487
  }
1488
 
1521
  if($saswp_over_all_rating && $saswp_review_count && $saswp_review_item_enable ==1){
1522
 
1523
  $aggregateRating = array(
1524
+ "@type" => "AggregateRating",
1525
+ "ratingValue" => esc_attr($saswp_over_all_rating),
1526
+ "reviewCount" => esc_attr($saswp_review_count)
1527
  );
1528
 
1529
  }
1533
  if(!empty($kkstar_rating_data)){
1534
 
1535
  $kkstar_aggregateRating = array(
1536
+ "@type" => "AggregateRating",
1537
  "bestRating" => saswp_remove_warnings($kkstar_rating_data, 'best', 'saswp_string'),
1538
  "ratingCount" => saswp_remove_warnings($kkstar_rating_data, 'votes', 'saswp_string'),
1539
  "ratingValue" => saswp_remove_warnings($kkstar_rating_data, 'avg', 'saswp_string')
1546
 
1547
 
1548
 
1549
+ if( 'qanda' === $schema_type){
1550
 
1551
  if(trim(saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array')) ==''){
1552
 
1557
 
1558
  $input1 = array(
1559
  '@context' => 'http://schema.org',
1560
+ '@type' => 'QAPage',
1561
  'mainEntity' => array(
1562
  '@type' => 'Question' ,
1563
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_title_'.$schema_id, 'saswp_array'),
1564
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_question_description_'.$schema_id, 'saswp_array'),
1565
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_upvote_count_'.$schema_id, 'saswp_array'),
1566
+ 'dateCreated' => isset($all_post_meta['saswp_qa_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_date_created_'.$schema_id][0])):'',
1567
  'author' => array('@type' => 'Person','name' =>saswp_remove_warnings($all_post_meta, 'saswp_qa_question_author_name_'.$schema_id, 'saswp_array')) ,
1568
  'answerCount' => 2 ,
1569
  'acceptedAnswer' => array(
1571
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_upvote_count_'.$schema_id, 'saswp_array'),
1572
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_url_'.$schema_id, 'saswp_array'),
1573
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_answer_text_'.$schema_id, 'saswp_array'),
1574
+ 'dateCreated' => isset($all_post_meta['saswp_qa_accepted_answer_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_accepted_answer_date_created_'.$schema_id][0])):'',
1575
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_accepted_author_name_'.$schema_id, 'saswp_array')),
1576
  ) ,
1577
  'suggestedAnswer' => array(
1579
  'upvoteCount' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_upvote_count_'.$schema_id, 'saswp_array'),
1580
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_url_'.$schema_id, 'saswp_array'),
1581
  'text' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_answer_text_'.$schema_id, 'saswp_array'),
1582
+ 'dateCreated' => isset($all_post_meta['saswp_qa_suggested_answer_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_qa_suggested_answer_date_created_'.$schema_id][0])):'',
1583
  'author' => array('@type' => 'Person', 'name' => saswp_remove_warnings($all_post_meta, 'saswp_qa_suggested_author_name_'.$schema_id, 'saswp_array')),
1584
  ) ,
1585
  )
1587
  }
1588
  }
1589
 
1590
+ if( 'Event' === $schema_type){
1591
 
1592
  $event_image = get_post_meta( get_the_ID(), 'saswp_event_schema_image_'.$schema_id.'_detail',true);
1593
 
1594
  $input1 = array(
1595
  '@context' => 'http://schema.org',
1596
+ '@type' => 'Event' ,
1597
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_name_'.$schema_id, 'saswp_array'),
1598
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_description_'.$schema_id, 'saswp_array'),
1599
+ 'startDate' => isset($all_post_meta['saswp_event_schema_start_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_event_schema_start_date_'.$schema_id][0])):'',
1600
+ 'endDate' => isset($all_post_meta['saswp_event_schema_end_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_event_schema_end_date_'.$schema_id][0])):'',
1601
  'image' => array(
1602
  '@type' =>'ImageObject',
1603
+ 'url' => isset($event_image['thumbnail']) ? esc_url($event_image['thumbnail']):'' ,
1604
+ 'width' => isset($event_image['width']) ? esc_attr($event_image['width']) :'' ,
1605
+ 'height' => isset($event_image['height']) ? esc_attr($event_image['height']) :'' ,
1606
  ),
1607
  'location' => array(
1608
  '@type' => 'Place',
1621
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_price_'.$schema_id, 'saswp_array'),
1622
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_price_currency_'.$schema_id, 'saswp_array'),
1623
  'availability' => saswp_remove_warnings($all_post_meta, 'saswp_event_schema_availability_'.$schema_id, 'saswp_array'),
1624
+ 'validFrom' => isset($all_post_meta['saswp_event_schema_validfrom_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_event_schema_validfrom_'.$schema_id][0])):'',
1625
  ),
1626
  'performer' => array(
1627
  '@type' => 'PerformingGroup',
1641
 
1642
  }
1643
 
1644
+ if( 'Course' === $schema_type){
1645
 
1646
  $input1 = array(
1647
  '@context' => 'http://schema.org',
1648
+ '@type' => 'Course' ,
1649
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_name_'.$schema_id, 'saswp_array'),
1650
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_course_description_'.$schema_id, 'saswp_array'),
1651
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_course_url_'.$schema_id, 'saswp_array'),
1652
+ 'datePublished' => isset($all_post_meta['saswp_course_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_course_date_published_'.$schema_id][0])):'',
1653
+ 'dateModified' => isset($all_post_meta['saswp_course_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_course_date_modified_'.$schema_id][0])):'',
1654
  'provider' => array(
1655
  '@type' => 'Organization',
1656
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_course_provider_name_'.$schema_id, 'saswp_array'),
1688
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_description_'.$schema_id, 'saswp_array'),
1689
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_name_'.$schema_id, 'saswp_array'),
1690
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_url_'.$schema_id, 'saswp_array'),
1691
+ 'datePublished' => isset($all_post_meta['saswp_blogposting_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_blogposting_date_published_'.$schema_id][0])):'',
1692
+ 'dateModified' => isset($all_post_meta['saswp_blogposting_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_blogposting_date_modified_'.$schema_id][0])):'',
1693
  'author' => array(
1694
  '@type' => 'Person',
1695
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_blogposting_author_name_'.$schema_id, 'saswp_array')
1726
  'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_contenturl_'.$schema_id, 'saswp_array'),
1727
  'duration' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_duration_'.$schema_id, 'saswp_array'),
1728
  'encodingFormat' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_encoding_format_'.$schema_id, 'saswp_array'),
1729
+ 'datePublished' => isset($all_post_meta['saswp_audio_schema_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_audio_schema_date_published_'.$schema_id][0])):'',
1730
+ 'dateModified' => isset($all_post_meta['saswp_audio_schema_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_audio_schema_date_modified_'.$schema_id][0])):'',
1731
  'author' => array(
1732
  '@type' => 'Person',
1733
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_audio_schema_author_name_'.$schema_id, 'saswp_array')
1749
 
1750
  $input1 = array(
1751
  '@context' => 'http://schema.org',
1752
+ '@type' => 'SoftwareApplication',
1753
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_name_'.$schema_id, 'saswp_array'),
1754
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_description_'.$schema_id, 'saswp_array'),
1755
  'operatingSystem' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_operating_system_'.$schema_id, 'saswp_array'),
1759
  'price' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_'.$schema_id, 'saswp_array'),
1760
  'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_price_currency_'.$schema_id, 'saswp_array'),
1761
  ),
1762
+ 'datePublished' => isset($all_post_meta['saswp_software_schema_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_software_schema_date_published_'.$schema_id][0])):'',
1763
+ 'dateModified' => isset($all_post_meta['saswp_software_schema_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_software_schema_date_modified_'.$schema_id][0])):'',
1764
 
1765
  );
1766
 
1767
  if(saswp_remove_warnings($all_post_meta, 'saswp_software_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
1768
 
1769
  $input1['aggregateRating'] = array(
1770
+ "@type" => "AggregateRating",
1771
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_rating_'.$schema_id, 'saswp_array'),
1772
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_software_schema_rating_count_'.$schema_id, 'saswp_array')
1773
  );
1789
  $slogo = get_post_meta( get_the_ID(), 'saswp_webpage_organization_logo_'.$schema_id.'_detail',true);
1790
  $input1 = array(
1791
  '@context' => 'http://schema.org',
1792
+ '@type' => 'WebPage' ,
1793
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_name_'.$schema_id, 'saswp_array'),
1794
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_url_'.$schema_id, 'saswp_array'),
1795
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
1799
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_image_'.$schema_id, 'saswp_array'),
1800
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_headline_'.$schema_id, 'saswp_array'),
1801
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_description_'.$schema_id, 'saswp_array'),
1802
+ 'datePublished' => isset($all_post_meta['saswp_webpage_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_webpage_date_published_'.$schema_id][0])):'',
1803
+ 'dateModified' => isset($all_post_meta['saswp_webpage_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_webpage_date_modified_'.$schema_id][0])):'',
1804
  'author' => array(
1805
  '@type' => 'Person',
1806
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_webpage_author_name_'.$schema_id, 'saswp_array'), ),
1846
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_article_image_'.$schema_id, 'saswp_array'),
1847
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_article_headline_'.$schema_id, 'saswp_array'),
1848
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_article_description_'.$schema_id, 'saswp_array'),
1849
+ 'datePublished' => isset($all_post_meta['saswp_article_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_article_date_published_'.$schema_id][0])):'',
1850
+ 'dateModified' => isset($all_post_meta['saswp_article_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_article_date_modified_'.$schema_id][0])):'',
1851
  'author' => array(
1852
  '@type' => 'Person',
1853
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_article_author_name_'.$schema_id, 'saswp_array')
1887
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_image_'.$schema_id, 'saswp_array'),
1888
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_headline_'.$schema_id, 'saswp_array'),
1889
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_description_'.$schema_id, 'saswp_array'),
1890
+ 'datePublished' => isset($all_post_meta['saswp_tech_article_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_tech_article_date_published_'.$schema_id][0])):'',
1891
+ 'dateModified' => isset($all_post_meta['saswp_tech_article_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_tech_article_date_modified_'.$schema_id][0])):'',
1892
  'author' => array(
1893
  '@type' => 'Person',
1894
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_tech_article_author_name_'.$schema_id, 'saswp_array')
1927
 
1928
  if(isset($all_post_meta['saswp_recipe_ingredient_'.$schema_id])){
1929
 
1930
+ $explod = explode(';', $all_post_meta['saswp_recipe_ingredient_'.$schema_id][0]);
1931
+
1932
+ if($explod){
1933
+
1934
+ foreach ($explod as $val){
1935
+
1936
+ $ingredient[] = $val;
1937
+
1938
+ }
1939
+
1940
+ }
1941
+
1942
+
1943
 
1944
  }
1945
 
1947
 
1948
  $explod = explode(';', $all_post_meta['saswp_recipe_instructions_'.$schema_id][0]);
1949
 
1950
+ if($explod){
1951
+
1952
+ foreach ($explod as $val){
1953
 
1954
+ $instruction[] = array(
1955
+ '@type' => "HowToStep",
1956
+ 'text' => $val,
1957
+ );
1958
+
1959
+ }
1960
+
1961
+ }
1962
 
1963
  }
1964
 
1993
  'recipeIngredient' => $ingredient,
1994
  'recipeInstructions' => $instruction,
1995
  'video' => array(
1996
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_name_'.$schema_id, 'saswp_array'),
1997
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_description_'.$schema_id, 'saswp_array'),
1998
+ 'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_thumbnailurl_'.$schema_id, 'saswp_array'),
1999
+ 'contentUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_contenturl_'.$schema_id, 'saswp_array'),
2000
+ 'embedUrl' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_embedurl_'.$schema_id, 'saswp_array'),
2001
+ 'uploadDate' => isset($all_post_meta['saswp_recipe_video_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_video_upload_date_'.$schema_id][0])):'',
2002
+ 'duration' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_video_duration_'.$schema_id, 'saswp_array'),
2003
  ),
2004
 
2005
+ 'datePublished' => isset($all_post_meta['saswp_recipe_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_published_'.$schema_id][0])):'',
2006
+ 'dateModified' => isset($all_post_meta['saswp_recipe_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_recipe_date_modified_'.$schema_id][0])):'',
2007
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_recipe_description_'.$schema_id, 'saswp_array'),
2008
  'mainEntity' => array(
2009
  '@type' => 'WebPage',
2044
  'sku' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_sku_'.$schema_id, 'saswp_array'),
2045
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_description_'.$schema_id, 'saswp_array'),
2046
  'image' =>array(
2047
+ '@type' => 'ImageObject',
2048
+ 'url' => saswp_remove_warnings($product_image, 'thumbnail', 'saswp_string'),
2049
+ 'width' => saswp_remove_warnings($product_image, 'width', 'saswp_string'),
2050
+ 'height' => saswp_remove_warnings($product_image, 'height', 'saswp_string'),
2051
  ),
2052
  'offers' => array(
2053
+ '@type' => 'Offer',
2054
+ 'availability' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_availability_'.$schema_id, 'saswp_array'),
2055
+ 'itemCondition' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_condition_'.$schema_id, 'saswp_array'),
2056
+ 'price' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_price_'.$schema_id, 'saswp_array'),
2057
+ 'priceCurrency' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_currency_'.$schema_id, 'saswp_array'),
2058
+ 'url' => get_permalink(),
2059
+ 'priceValidUntil' => isset($all_post_meta['saswp_product_schema_priceValidUntil_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_product_schema_priceValidUntil_'.$schema_id][0])):'',
2060
  ),
2061
+ 'brand' => array('@type' => 'Thing',
2062
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_brand_name_'.$schema_id, 'saswp_array'),
2063
  )
2064
  );
2065
 
2066
  if(isset($all_post_meta['saswp_product_schema_gtin8_'.$schema_id])){
2067
+ $input1['gtin8'] = esc_attr($all_post_meta['saswp_product_schema_gtin8_'.$schema_id][0]);
2068
  }
2069
  if(isset($all_post_meta['saswp_product_schema_mpn_'.$schema_id])){
2070
+ $input1['mpn'] = esc_attr($all_post_meta['saswp_product_schema_mpn_'.$schema_id][0]);
2071
  }
2072
  if(isset($all_post_meta['saswp_product_schema_isbn_'.$schema_id])){
2073
+ $input1['isbn'] = esc_attr($all_post_meta['saswp_product_schema_isbn_'.$schema_id][0]);
2074
  }
2075
 
2076
  if(saswp_remove_warnings($all_post_meta, 'saswp_product_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2077
 
2078
  $input1['aggregateRating'] = array(
2079
+ "@type" => "AggregateRating",
2080
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_rating_'.$schema_id, 'saswp_array'),
2081
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_product_schema_review_count_'.$schema_id, 'saswp_array')
2082
  );
2100
 
2101
  $input1 = array(
2102
  '@context' => 'http://schema.org',
2103
+ '@type' => 'NewsArticle' ,
2104
  'mainEntityOfPage' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_main_entity_of_page_'.$schema_id, 'saswp_array'),
2105
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_URL_'.$schema_id, 'saswp_array'),
2106
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_headline_'.$schema_id, 'saswp_array'),
2107
+ 'datePublished' => isset($all_post_meta['saswp_newsarticle_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_newsarticle_date_published_'.$schema_id][0])):'',
2108
+ 'dateModified' => isset($all_post_meta['saswp_newsarticle_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_newsarticle_date_modified_'.$schema_id][0])):'',
2109
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_description_'.$schema_id, 'saswp_array'),
2110
  'articleSection' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_section_'.$schema_id, 'saswp_array'),
2111
  'articleBody' => saswp_remove_warnings($all_post_meta, 'saswp_newsarticle_body_'.$schema_id, 'saswp_array'),
2139
  ),
2140
  );
2141
  if(!empty($aggregateRating)){
2142
+ $input1['aggregateRating'] = $aggregateRating;
2143
  }
2144
  if(!empty($kkstar_aggregateRating)){
2145
  $input1['aggregateRating'] = $kkstar_aggregateRating;
2153
 
2154
  $input1 = array(
2155
  '@context' => 'http://schema.org',
2156
+ '@type' => 'VideoObject',
2157
  'url' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_url_'.$schema_id, 'saswp_array'),
2158
  'headline' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_headline_'.$schema_id, 'saswp_array'),
2159
+ 'datePublished' => isset($all_post_meta['saswp_video_object_date_published_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_date_published_'.$schema_id][0])):'',
2160
+ 'dateModified' => isset($all_post_meta['saswp_video_object_date_modified_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_date_modified_'.$schema_id][0])):'',
2161
  'description' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_description_'.$schema_id, 'saswp_array'),
2162
  'name' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_name_'.$schema_id, 'saswp_array'),
2163
+ 'uploadDate' => isset($all_post_meta['saswp_video_object_upload_date_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_video_object_upload_date_'.$schema_id][0])):'',
2164
  'thumbnailUrl' => saswp_remove_warnings($all_post_meta, 'saswp_video_object_thumbnail_url_'.$schema_id, 'saswp_array'),
2165
  'mainEntity' => array(
2166
  '@type' => 'WebPage',
2218
  'image' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_image_'.$schema_id, 'saswp_array'),
2219
  '@id' => get_permalink(),
2220
  'address' => array(
2221
+ '@type' => 'PostalAddress',
2222
  'addressLocality' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_locality_'.$schema_id, 'saswp_array'),
2223
  'postalCode' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_postal_code_'.$schema_id, 'saswp_array'),
2224
  'telephone' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_telephone_'.$schema_id, 'saswp_array')
2243
  }
2244
  $input1['areaServed'] = $areaServed;
2245
  $input1['hasOfferCatalog'] = array(
2246
+ '@type' => 'OfferCatalog',
2247
+ 'name' => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_name_'.$schema_id, 'saswp_array'),
2248
  'itemListElement' => $serviceOffer
2249
  );
2250
 
2251
  if(saswp_remove_warnings($all_post_meta, 'saswp_service_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2252
  $input1['aggregateRating'] = array(
2253
+ "@type" => "AggregateRating",
2254
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_rating_'.$schema_id, 'saswp_array'),
2255
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'saswp_service_schema_review_count_'.$schema_id, 'saswp_array')
2256
  );
2285
  }
2286
 
2287
  $input1['@context'] = 'http://schema.org';
2288
+ $input1['@type'] = 'Review';
2289
  $input1['url'] = get_permalink();
2290
  $input1['datePublished'] = get_the_date("Y-m-d\TH:i:s\Z");
2291
  $input1['dateModified'] = get_the_modified_date("Y-m-d\TH:i:s\Z");
2293
  if($review_author){
2294
 
2295
  $input1['author']['@type'] = 'Person';
2296
+ $input1['author']['name'] = esc_attr($review_author);
2297
 
2298
  if(isset($all_post_meta['saswp_review_schema_author_sameas_'.$schema_id])){
2299
 
2300
+ $input1['author']['sameAs'] = esc_url($all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0]);
2301
 
2302
  }
2303
 
2306
  if($site_name && $logo && $width && $height){
2307
 
2308
  $input1['Publisher']['@type'] = 'Organization';
2309
+ $input1['Publisher']['name'] = esc_attr($site_name);
2310
  $input1['Publisher']['logo']['@type'] = 'ImageObject';
2311
+ $input1['Publisher']['logo']['url'] = esc_url($logo);
2312
+ $input1['Publisher']['logo']['width'] = esc_attr($width);
2313
+ $input1['Publisher']['logo']['height'] = esc_attr($height);
2314
 
2315
  }
2316
 
2324
  }
2325
 
2326
  if(isset($all_post_meta['saswp_review_schema_item_type_'.$schema_id])){
2327
+ $input1['itemReviewed']['@type'] = esc_attr($all_post_meta['saswp_review_schema_item_type_'.$schema_id][0]);
2328
  }
2329
  if(isset($all_post_meta['saswp_review_schema_name_'.$schema_id])){
2330
+ $input1['itemReviewed']['name'] = esc_attr($all_post_meta['saswp_review_schema_name_'.$schema_id][0]);
2331
  }
2332
  if(isset($all_post_meta['saswp_review_schema_url_'.$schema_id])){
2333
+ $input1['itemReviewed']['url'] = esc_url($all_post_meta['saswp_review_schema_url_'.$schema_id][0]);
2334
  }
2335
 
2336
  if(isset($all_post_meta['saswp_review_schema_price_range_'.$schema_id])){
2337
 
2338
+ $input1['itemReviewed']['priceRange'] = esc_attr($all_post_meta['saswp_review_schema_price_range_'.$schema_id][0]);
2339
 
2340
  }
2341
 
2342
  if(isset($all_post_meta['saswp_review_schema_telephone_'.$schema_id])){
2343
 
2344
+ $input1['itemReviewed']['telephone'] = esc_attr($all_post_meta['saswp_review_schema_telephone_'.$schema_id][0]);
2345
 
2346
  }
2347
 
2348
  if(isset($all_post_meta['saswp_review_schema_servescuisine_'.$schema_id])){
2349
 
2350
+ $input1['itemReviewed']['servesCuisine'] = esc_attr($all_post_meta['saswp_review_schema_servescuisine_'.$schema_id][0]);
2351
 
2352
  }
2353
 
2354
  if(isset($all_post_meta['saswp_review_schema_menu_'.$schema_id])){
2355
 
2356
+ $input1['itemReviewed']['hasMenu'] = esc_url($all_post_meta['saswp_review_schema_menu_'.$schema_id][0]);
2357
 
2358
  }
2359
 
2360
  if(isset($all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id])){
2361
 
2362
+ $input1['itemReviewed']['sameAs'] = esc_url($all_post_meta['saswp_review_schema_itemreviewed_sameas_'.$schema_id][0]);
2363
 
2364
  }
2365
 
2366
 
2367
  if(isset($all_post_meta['saswp_review_schema_director_'.$schema_id])){
2368
 
2369
+ $input1['itemReviewed']['director'] = esc_attr($all_post_meta['saswp_review_schema_director_'.$schema_id][0]);
2370
 
2371
  }
2372
  if(isset($all_post_meta['saswp_review_schema_date_created_'.$schema_id])){
2373
 
2374
+ $input1['itemReviewed']['dateCreated'] = isset($all_post_meta['saswp_review_schema_date_created_'.$schema_id])?date('Y-m-d\TH:i:s\Z',strtotime($all_post_meta['saswp_review_schema_date_created_'.$schema_id][0])):'';
2375
 
2376
  }
2377
 
2379
 
2380
  if(!empty($review_image)){
2381
 
2382
+ $input1['itemReviewed']['image']['@type'] = 'ImageObject';
2383
+ $input1['itemReviewed']['image']['url'] = esc_url($review_image['thumbnail']);
2384
+ $input1['itemReviewed']['image']['width'] = esc_attr($review_image['width']);
2385
+ $input1['itemReviewed']['image']['height'] = esc_attr($review_image['height']);
2386
 
2387
  }
2388
 
2395
  $input1['itemReviewed']['address']['addressRegion'] = saswp_remove_warnings($all_post_meta, 'saswp_review_schema_region_'.$schema_id, 'saswp_array');
2396
  $input1['itemReviewed']['address']['postalCode'] = saswp_remove_warnings($all_post_meta, 'saswp_review_schema_postal_code_'.$schema_id, 'saswp_array');
2397
  $input1['itemReviewed']['address']['addressCountry'] = saswp_remove_warnings($all_post_meta, 'saswp_review_schema_country_'.$schema_id, 'saswp_array');
2398
+
 
2399
  }
2400
+
 
 
 
2401
  switch ($all_post_meta['saswp_review_schema_item_type_'.$schema_id][0]) {
2402
 
2403
  case 'Article':
2421
  }
2422
  if($review_author) {
2423
 
2424
+ $input1['itemReviewed']['author']['@type'] = 'Person';
2425
+ $input1['itemReviewed']['author']['name'] = esc_attr($review_author);
2426
+ $input1['itemReviewed']['author']['sameAs'] = esc_url($all_post_meta['saswp_review_schema_author_sameas_'.$schema_id][0]);
2427
 
2428
  }
2429
 
2444
 
2445
  $input1['author']['sameAs'] = get_permalink();
2446
 
2447
+ }
 
2448
 
2449
  break;
2450
  case 'MusicPlaylist':
2480
  if(saswp_remove_warnings($all_post_meta, 'saswp_review_schema_enable_rating_'.$schema_id, 'saswp_array') == 1){
2481
 
2482
  $input1['reviewRating'] = array(
2483
+ "@type" => "Rating",
2484
+ "ratingValue" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_rating_'.$schema_id, 'saswp_array'),
2485
+ "bestRating" => saswp_remove_warnings($all_post_meta, 'saswp_review_schema_review_count_'.$schema_id, 'saswp_array')
2486
  );
2487
  }
2488
  unset($input1['aggregateRating']);
2492
  if( 'local_business' === $schema_type){
2493
 
2494
  $operation_days = explode( "rn", esc_html( stripslashes(saswp_remove_warnings($all_post_meta, 'saswp_dayofweek_'.$schema_id, 'saswp_array'))) );;
2495
+ $business_sub_name = '';
2496
  $business_type = saswp_remove_warnings($all_post_meta, 'saswp_business_type_'.$schema_id, 'saswp_array');
2497
  $post_specific_obj = new saswp_post_specific();
2498
  $check_business_type = $post_specific_obj->saswp_get_sub_business_array($business_type);
2528
  'height' => saswp_remove_warnings($local_image, 'height', 'saswp_string'),
2529
  ),
2530
  'address' => array(
2531
+ "@type" => "PostalAddress",
2532
+ "streetAddress" => saswp_remove_warnings($all_post_meta, 'local_street_address_'.$schema_id, 'saswp_array'),
2533
+ "addressLocality" => saswp_remove_warnings($all_post_meta, 'local_city_'.$schema_id, 'saswp_array'),
2534
+ "addressRegion" => saswp_remove_warnings($all_post_meta, 'local_state_'.$schema_id, 'saswp_array'),
2535
+ "postalCode" => saswp_remove_warnings($all_post_meta, 'local_postal_code_'.$schema_id, 'saswp_array'),
2536
  ),
2537
  'telephone' => saswp_remove_warnings($all_post_meta, 'local_phone_'.$schema_id, 'saswp_array'),
2538
  'openingHours' => $operation_days,
2543
  if(isset($all_post_meta['local_enable_rating_'.$schema_id])){
2544
 
2545
  $input1['aggregateRating'] = array(
2546
+ "@type" => "AggregateRating",
2547
  "ratingValue" => saswp_remove_warnings($all_post_meta, 'local_rating_'.$schema_id, 'saswp_array'),
2548
  "reviewCount" => saswp_remove_warnings($all_post_meta, 'local_review_count_'.$schema_id, 'saswp_array')
2549
  );
2559
  $input1 = array_merge($input1, $extra_theme_review);
2560
  }
2561
  if(isset($all_post_meta['local_price_range_'.$schema_id][0])){
2562
+ $input1['priceRange'] = esc_attr($all_post_meta['local_price_range_'.$schema_id][0]);
2563
  }
2564
 
2565
  if(isset($all_post_meta['local_accepts_reservations_'.$schema_id][0])){
2566
+ $input1['acceptsReservations'] = esc_attr($all_post_meta['local_price_accepts_reservations_'.$schema_id][0]);
2567
  }
2568
 
2569
  if(isset($all_post_meta['local_serves_cuisine_'.$schema_id][0])){
2570
+ $input1['servesCuisine'] = esc_attr($all_post_meta['local_serves_cuisine_'.$schema_id][0]);
2571
  }
2572
 
2573
  if(isset($all_post_meta['local_menu_'.$schema_id][0])){
2574
+ $input1['hasMenu'] = esc_url($all_post_meta['local_menu_'.$schema_id][0]);
2575
  }
2576
  }
2577
 
2588
  }
2589
 
2590
  if(!empty($input1)){
2591
+
2592
+ $all_schema_output[] = $input1;
2593
+
2594
  }
2595
  }
2596
  }
2653
  'name' => $site_name,
2654
  'potentialAction' => array(
2655
  '@type' => 'SearchAction',
2656
+ 'target' => esc_url($site_url.'/?s={search_term_string}'),
2657
  'query-input' => 'required name=search_term_string',
2658
  )
2659
  );
2702
  if(!empty($image_details)){
2703
 
2704
  $archive_image['@type'] = 'ImageObject';
2705
+ $archive_image['url'] = esc_url($image_details[0]);
2706
+ $archive_image['width'] = esc_attr($image_details[1]);
2707
+ $archive_image['height'] = esc_attr($image_details[2]);
2708
 
2709
  }else{
2710
 
2711
  if(isset($sd_data['sd_default_image'])){
2712
 
2713
  $archive_image['@type'] = 'ImageObject';
2714
+ $archive_image['url'] = esc_url($sd_data['sd_default_image']['url']);
2715
+ $archive_image['width'] = esc_attr($sd_data['sd_default_image_width']);
2716
+ $archive_image['height'] = esc_attr($sd_data['sd_default_image_height']);
2717
  }
2718
 
2719
 
2721
 
2722
  $publisher_info = array(
2723
  "type" => "Organization",
2724
+ "name" => esc_attr($site_name),
2725
  "logo" => array(
2726
  "@type" => "ImageObject",
2727
+ "name" => esc_attr($site_name),
2728
+ "width" => esc_attr($logo['width']),
2729
+ "height" => esc_attr($logo['height']),
2730
+ "url" => esc_url($logo['url'])
2731
  )
2732
  );
2733
+
2734
  $publisher_info['name'] = get_bloginfo('name');
2735
  $publisher_info['id'] = get_the_permalink();
2736
 
2737
  $category_posts[] = array(
2738
 
2739
+ '@type' => esc_attr($schema_type),
2740
  'headline' => get_the_title(),
2741
  'url' => get_the_permalink(),
2742
  'datePublished' => get_the_date('c'),
2760
  (
2761
  '@context' => 'http://schema.org/',
2762
  '@type' => "CollectionPage",
2763
+ 'headline' => esc_attr($category_headline),
2764
  'description' => strip_tags(category_description()),
2765
+ 'url' => esc_url($category_link),
2766
  'sameAs' => '',
2767
  'hasPart' => $category_posts
2768
  );
2957
  "@context" => "https://schema.org",
2958
  "@type" => "SiteNavigationElement",
2959
  "@id" => trailingslashit(get_home_url()).$type,
2960
+ "name" => esc_attr($items->title),
2961
+ "url" => esc_url($items->url)
2962
  );
2963
 
2964
  }
2975
  "@context" => "https://schema.org",
2976
  "@type" => "SiteNavigationElement",
2977
  "@id" => trailingslashit(get_home_url()).$type,
2978
+ "name" => esc_attr($items->title),
2979
+ "url" => esc_url($items->url)
2980
  );
2981
 
2982
  }
output/service.php CHANGED
@@ -765,8 +765,7 @@ Class saswp_output_service{
765
  return;
766
  }
767
 
768
- $schema_type = isset( $_POST['schema_type'] ) ? sanitize_text_field( $_POST['schema_type'] ) : '';
769
- $post_id = isset( $_POST['post_id'] ) ? sanitize_text_field( $_POST['post_id'] ) : '';
770
  $meta_fields = $this->saswp_get_all_schema_type_fields($schema_type);
771
 
772
  wp_send_json( $meta_fields );
@@ -918,9 +917,9 @@ Class saswp_output_service{
918
 
919
  }
920
 
921
- $product_details['product_review_count'] = $product->get_review_count();
922
  $product_details['product_average_rating'] = $product->get_average_rating();
923
- $product_details['product_reviews'] = $reviews_arr;
924
 
925
  }
926
 
@@ -928,17 +927,6 @@ Class saswp_output_service{
928
  return $product_details;
929
  }
930
 
931
- // public function saswp_tagyeem_review_details($post_id){
932
- //
933
- // global $sd_data;
934
- //
935
- // if(isset($sd_data['saswp-tagyeem']) && $sd_data['saswp-tagyeem'] == 1){
936
- //
937
- //
938
- //
939
- // }
940
- //
941
- // }
942
  /**
943
  * This function gets the review details in schema markup from the current post which has extra theme enabled
944
  * Extra Theme ( https://www.elegantthemes.com/preview/Extra/ )
@@ -991,68 +979,7 @@ Class saswp_output_service{
991
  return $review_data;
992
 
993
  }
994
-
995
- // public function saswp_wp_job_manager_details($post = null){
996
- //
997
- // $post = get_post( $post );
998
- //
999
- // if ( ! $post || 'job_listing' !== $post->post_type ) {
1000
- // return false;
1001
- // }
1002
- //
1003
- // $data = array();
1004
- // $data['@context'] = 'http://schema.org/';
1005
- // $data['@type'] = 'JobPosting';
1006
- // $data['datePosted'] = get_post_time( 'c', false, $post );
1007
- //
1008
- // $job_expires = get_post_meta( $post->ID, '_job_expires', true );
1009
- // if ( ! empty( $job_expires ) ) {
1010
- // $data['validThrough'] = date( 'c', strtotime( $job_expires ) );
1011
- // }
1012
- //
1013
- // $data['title'] = wp_strip_all_tags( wpjm_get_the_job_title( $post ) );
1014
- // $data['description'] = wpjm_get_the_job_description( $post );
1015
- //
1016
- // $employment_types = wpjm_get_job_employment_types();
1017
- // if ( ! empty( $employment_types ) ) {
1018
- // $data['employmentType'] = $employment_types;
1019
- // }
1020
- //
1021
- // $data['hiringOrganization'] = array();
1022
- // $data['hiringOrganization']['@type'] = 'Organization';
1023
- // $data['hiringOrganization']['name'] = get_the_company_name( $post );
1024
- //
1025
- // $company_website = get_the_company_website( $post );
1026
- // if ( $company_website ) {
1027
- // $data['hiringOrganization']['sameAs'] = $company_website;
1028
- // $data['hiringOrganization']['url'] = $company_website;
1029
- // }
1030
- //
1031
- // $company_logo = get_the_company_logo( $post, 'full' );
1032
- // if ( $company_logo ) {
1033
- // $data['hiringOrganization']['logo'] = $company_logo;
1034
- // }
1035
- //
1036
- // $data['identifier'] = array();
1037
- // $data['identifier']['@type'] = 'PropertyValue';
1038
- // $data['identifier']['name'] = get_the_company_name( $post );
1039
- // $data['identifier']['value'] = get_the_guid( $post );
1040
- //
1041
- // $location = get_the_job_location( $post );
1042
- // if ( ! empty( $location ) ) {
1043
- // $data['jobLocation'] = array();
1044
- // $data['jobLocation']['@type'] = 'Place';
1045
- // $data['jobLocation']['address'] = wpjm_get_job_listing_location_structured_data( $post );
1046
- // if ( empty( $data['jobLocation']['address'] ) ) {
1047
- // $data['jobLocation']['address'] = $location;
1048
- // }
1049
- // }
1050
- //
1051
- // //return $data;
1052
- //
1053
- // }
1054
-
1055
-
1056
  /**
1057
  * This function gets all the question and answers in schema markup from the current question type post create by
1058
  * DW Question & Answer ( https://wordpress.org/plugins/dw-question-answer/ )
@@ -1174,7 +1101,7 @@ Class saswp_output_service{
1174
 
1175
  $meta_field = array();
1176
 
1177
- if($schema_type ==''){
1178
 
1179
  $schema_type = get_post_meta( $id, 'schema_type', true);
1180
 
@@ -1517,9 +1444,10 @@ Class saswp_output_service{
1517
  */
1518
  public function saswp_schema_markup_generator($schema_type){
1519
 
1520
- global $post;
 
 
1521
 
1522
- global $sd_data;
1523
  $logo = '';
1524
  $height = '';
1525
  $width = '';
@@ -1549,8 +1477,7 @@ Class saswp_output_service{
1549
 
1550
  $author_id = get_the_author_meta('ID');
1551
  $image_id = get_post_thumbnail_id();
1552
- $image_details = wp_get_attachment_image_src($image_id, 'full');
1553
- $author_details = get_avatar_data($author_id);
1554
  $date = get_the_date("Y-m-d\TH:i:s\Z");
1555
  $modified_date = get_the_modified_date("Y-m-d\TH:i:s\Z");
1556
  $aurthor_name = '';
@@ -1572,21 +1499,21 @@ Class saswp_output_service{
1572
  'mainEntityOfPage' => get_permalink(),
1573
  'headline' => get_the_title(),
1574
  'description' => strip_tags(get_the_excerpt()),
1575
- 'datePublished' => $date,
1576
- 'dateModified' => $modified_date,
1577
  'author' => array(
1578
  '@type' => 'Person',
1579
- 'name' => $aurthor_name
1580
  ),
1581
  'Publisher' => array(
1582
  '@type' => 'Organization',
1583
  'logo' => array(
1584
  '@type' => 'ImageObject',
1585
- 'url' => $logo,
1586
- 'width' => $width,
1587
- 'height' => $height,
1588
  ),
1589
- 'name' => $site_name,
1590
  ),
1591
 
1592
  );
@@ -1600,21 +1527,21 @@ Class saswp_output_service{
1600
  'mainEntityOfPage' => get_permalink(),
1601
  'headline' => get_the_title(),
1602
  'description' => strip_tags(get_the_excerpt()),
1603
- 'datePublished' => $date,
1604
- 'dateModified' => $modified_date,
1605
  'author' => array(
1606
  '@type' => 'Person',
1607
- 'name' => $aurthor_name
1608
  ),
1609
  'Publisher' => array(
1610
  '@type' => 'Organization',
1611
  'logo' => array(
1612
  '@type' => 'ImageObject',
1613
- 'url' => $logo,
1614
- 'width' => $width,
1615
- 'height' => $height,
1616
  ),
1617
- 'name' => $site_name,
1618
  ),
1619
 
1620
  );
@@ -1629,30 +1556,30 @@ Class saswp_output_service{
1629
 
1630
  $input1 = array(
1631
  '@context' => 'http://schema.org',
1632
- '@type' => $schema_type ,
1633
  'name' => get_the_title(),
1634
  'url' => get_permalink(),
1635
  'description' => strip_tags(get_the_excerpt()),
1636
  'mainEntity' => array(
1637
  '@type' => 'Article',
1638
  'mainEntityOfPage' => get_permalink(),
1639
- 'image' => $image_details[0],
1640
  'headline' => get_the_title(),
1641
  'description' => strip_tags(get_the_excerpt()),
1642
- 'datePublished' => $date,
1643
- 'dateModified' => $modified_date,
1644
  'author' => array(
1645
  '@type' => 'Person',
1646
- 'name' => $aurthor_name, ),
1647
  'Publisher' => array(
1648
  '@type' => 'Organization',
1649
  'logo' => array(
1650
  '@type' => 'ImageObject',
1651
- 'url' => $logo,
1652
- 'width' => $width,
1653
- 'height' => $height,
1654
  ),
1655
- 'name' => $site_name,
1656
  ),
1657
 
1658
  ),
@@ -1708,18 +1635,18 @@ Class saswp_output_service{
1708
  }
1709
 
1710
  $input2['image']['@type'] = 'ImageObject';
1711
- $input2['image']['url'] = $image_details[0];
1712
- $input2['image']['width'] = $width;
1713
- $input2['image']['height'] = $height;
1714
 
1715
  }else{
1716
 
1717
  if(isset($sd_data['sd_default_image']['url']) && $sd_data['sd_default_image']['url'] !=''){
1718
 
1719
  $input2['image']['@type'] = 'ImageObject';
1720
- $input2['image']['url'] = $sd_data['sd_default_image']['url'];
1721
- $input2['image']['width'] = $sd_data['sd_default_image_width'];
1722
- $input2['image']['height'] = $sd_data['sd_default_image_height'];
1723
 
1724
  }
1725
 
@@ -1740,10 +1667,11 @@ Class saswp_output_service{
1740
 
1741
  $publisher = array();
1742
  $default_logo = array();
 
1743
 
1744
- $logo = isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:'';
1745
- $height = isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['height']:'';
1746
- $width = isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['width']:'';
1747
  $site_name = isset($sd_data['sd_name']) && $sd_data['sd_name'] !='' ? $sd_data['sd_name']:get_bloginfo();
1748
 
1749
  if($logo =='' && $height =='' && $width ==''){
@@ -1755,24 +1683,35 @@ Class saswp_output_service{
1755
  );
1756
 
1757
  $custom_logo_id = get_theme_mod( 'custom_logo' );
1758
- $custom_logo = wp_get_attachment_image_src( $custom_logo_id, $sizes);
1759
- $logo = $custom_logo[0];
1760
- $height = $custom_logo[1];
1761
- $width = $custom_logo[2];
 
 
 
 
 
 
 
 
 
 
 
1762
  }
1763
 
1764
  if($logo !='' && $height !='' && $width !=''){
1765
 
1766
  $publisher['Publisher']['@type'] = 'Organization';
1767
  $publisher['Publisher']['logo']['@type'] = 'ImageObject';
1768
- $publisher['Publisher']['logo']['url'] = $logo;
1769
- $publisher['Publisher']['logo']['width'] = $width;
1770
- $publisher['Publisher']['logo']['height']= $height;
1771
- $publisher['Publisher']['name'] = $site_name;
1772
 
1773
- $default_logo['url'] = $logo;
1774
- $default_logo['height'] = $height;
1775
- $default_logo['width'] = $width;
1776
 
1777
  }
1778
 
765
  return;
766
  }
767
 
768
+ $schema_type = isset( $_POST['schema_type'] ) ? sanitize_text_field( $_POST['schema_type'] ) : '';
 
769
  $meta_fields = $this->saswp_get_all_schema_type_fields($schema_type);
770
 
771
  wp_send_json( $meta_fields );
917
 
918
  }
919
 
920
+ $product_details['product_review_count'] = $product->get_review_count();
921
  $product_details['product_average_rating'] = $product->get_average_rating();
922
+ $product_details['product_reviews'] = $reviews_arr;
923
 
924
  }
925
 
927
  return $product_details;
928
  }
929
 
 
 
 
 
 
 
 
 
 
 
 
930
  /**
931
  * This function gets the review details in schema markup from the current post which has extra theme enabled
932
  * Extra Theme ( https://www.elegantthemes.com/preview/Extra/ )
979
  return $review_data;
980
 
981
  }
982
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
983
  /**
984
  * This function gets all the question and answers in schema markup from the current question type post create by
985
  * DW Question & Answer ( https://wordpress.org/plugins/dw-question-answer/ )
1101
 
1102
  $meta_field = array();
1103
 
1104
+ if($schema_type == ''){
1105
 
1106
  $schema_type = get_post_meta( $id, 'schema_type', true);
1107
 
1444
  */
1445
  public function saswp_schema_markup_generator($schema_type){
1446
 
1447
+ global $post;
1448
+
1449
+ global $sd_data;
1450
 
 
1451
  $logo = '';
1452
  $height = '';
1453
  $width = '';
1477
 
1478
  $author_id = get_the_author_meta('ID');
1479
  $image_id = get_post_thumbnail_id();
1480
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
 
1481
  $date = get_the_date("Y-m-d\TH:i:s\Z");
1482
  $modified_date = get_the_modified_date("Y-m-d\TH:i:s\Z");
1483
  $aurthor_name = '';
1499
  'mainEntityOfPage' => get_permalink(),
1500
  'headline' => get_the_title(),
1501
  'description' => strip_tags(get_the_excerpt()),
1502
+ 'datePublished' => esc_html($date),
1503
+ 'dateModified' => esc_html($modified_date),
1504
  'author' => array(
1505
  '@type' => 'Person',
1506
+ 'name' => esc_attr($aurthor_name)
1507
  ),
1508
  'Publisher' => array(
1509
  '@type' => 'Organization',
1510
  'logo' => array(
1511
  '@type' => 'ImageObject',
1512
+ 'url' => esc_url($logo),
1513
+ 'width' => esc_attr($width),
1514
+ 'height' => esc_attr($height),
1515
  ),
1516
+ 'name' => esc_attr($site_name),
1517
  ),
1518
 
1519
  );
1527
  'mainEntityOfPage' => get_permalink(),
1528
  'headline' => get_the_title(),
1529
  'description' => strip_tags(get_the_excerpt()),
1530
+ 'datePublished' => esc_html($date),
1531
+ 'dateModified' => esc_html($modified_date),
1532
  'author' => array(
1533
  '@type' => 'Person',
1534
+ 'name' => esc_attr($aurthor_name)
1535
  ),
1536
  'Publisher' => array(
1537
  '@type' => 'Organization',
1538
  'logo' => array(
1539
  '@type' => 'ImageObject',
1540
+ 'url' => esc_url($logo),
1541
+ 'width' => esc_attr($width),
1542
+ 'height' => esc_attr($height),
1543
  ),
1544
+ 'name' => esc_attr($site_name),
1545
  ),
1546
 
1547
  );
1556
 
1557
  $input1 = array(
1558
  '@context' => 'http://schema.org',
1559
+ '@type' => 'WebPage' ,
1560
  'name' => get_the_title(),
1561
  'url' => get_permalink(),
1562
  'description' => strip_tags(get_the_excerpt()),
1563
  'mainEntity' => array(
1564
  '@type' => 'Article',
1565
  'mainEntityOfPage' => get_permalink(),
1566
+ 'image' => esc_url($image_details[0]),
1567
  'headline' => get_the_title(),
1568
  'description' => strip_tags(get_the_excerpt()),
1569
+ 'datePublished' => esc_html($date),
1570
+ 'dateModified' => esc_html($modified_date),
1571
  'author' => array(
1572
  '@type' => 'Person',
1573
+ 'name' => esc_attr($aurthor_name), ),
1574
  'Publisher' => array(
1575
  '@type' => 'Organization',
1576
  'logo' => array(
1577
  '@type' => 'ImageObject',
1578
+ 'url' => esc_url($logo),
1579
+ 'width' => esc_attr($width),
1580
+ 'height' => esc_attr($height),
1581
  ),
1582
+ 'name' => esc_attr($site_name),
1583
  ),
1584
 
1585
  ),
1635
  }
1636
 
1637
  $input2['image']['@type'] = 'ImageObject';
1638
+ $input2['image']['url'] = esc_url($image_details[0]);
1639
+ $input2['image']['width'] = esc_attr($width);
1640
+ $input2['image']['height'] = esc_attr($height);
1641
 
1642
  }else{
1643
 
1644
  if(isset($sd_data['sd_default_image']['url']) && $sd_data['sd_default_image']['url'] !=''){
1645
 
1646
  $input2['image']['@type'] = 'ImageObject';
1647
+ $input2['image']['url'] = esc_url($sd_data['sd_default_image']['url']);
1648
+ $input2['image']['width'] = esc_attr($sd_data['sd_default_image_width']);
1649
+ $input2['image']['height'] = esc_attr($sd_data['sd_default_image_height']);
1650
 
1651
  }
1652
 
1667
 
1668
  $publisher = array();
1669
  $default_logo = array();
1670
+ $custom_logo = array();
1671
 
1672
+ $logo = isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['url']:'';
1673
+ $height = isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['height']:'';
1674
+ $width = isset($sd_data['sd_logo']) ? $sd_data['sd_logo']['width']:'';
1675
  $site_name = isset($sd_data['sd_name']) && $sd_data['sd_name'] !='' ? $sd_data['sd_name']:get_bloginfo();
1676
 
1677
  if($logo =='' && $height =='' && $width ==''){
1683
  );
1684
 
1685
  $custom_logo_id = get_theme_mod( 'custom_logo' );
1686
+
1687
+ if($custom_logo_id){
1688
+
1689
+ $custom_logo = wp_get_attachment_image_src( $custom_logo_id, $sizes);
1690
+
1691
+ }
1692
+
1693
+ if(isset($custom_logo)){
1694
+
1695
+ $logo = $custom_logo[0];
1696
+ $height = $custom_logo[1];
1697
+ $width = $custom_logo[2];
1698
+
1699
+ }
1700
+
1701
  }
1702
 
1703
  if($logo !='' && $height !='' && $width !=''){
1704
 
1705
  $publisher['Publisher']['@type'] = 'Organization';
1706
  $publisher['Publisher']['logo']['@type'] = 'ImageObject';
1707
+ $publisher['Publisher']['logo']['url'] = esc_url($logo);
1708
+ $publisher['Publisher']['logo']['width'] = esc_attr($width);
1709
+ $publisher['Publisher']['logo']['height']= esc_attr($height);
1710
+ $publisher['Publisher']['name'] = esc_attr($site_name);
1711
 
1712
+ $default_logo['url'] = esc_url($logo);
1713
+ $default_logo['height'] = esc_attr($height);
1714
+ $default_logo['width'] = esc_attr($width);
1715
 
1716
  }
1717
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: magazine3
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.1
6
- Stable tag: 1.3.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -66,11 +66,13 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
66
  == Changelog ==
67
 
68
 
69
- = 1.3.1 (12 March 2019) =
70
 
 
71
 
72
- * Bug Fixed: Organization schema type has null value
73
 
 
74
 
75
  = 1.3 (11 March 2019) =
76
 
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.1
6
+ Stable tag: 1.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
66
  == Changelog ==
67
 
68
 
69
+ = 1.4 (25 March 2019) =
70
 
71
+ * Bug Fixed: Security improvement.
72
 
73
+ = 1.3.1 (12 March 2019) =
74
 
75
+ * Bug Fixed: Organization schema type has null value
76
 
77
  = 1.3 (11 March 2019) =
78
 
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP
4
  Description: Schema & Structured Data adds Google Rich Snippets markup according to Schema.org guidelines to structure your site for SEO. (AMP Compatible)
5
- Version: 1.3.1
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
@@ -13,7 +13,7 @@ License: GPL2
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
- define('SASWP_VERSION', '1.3.1');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
@@ -81,6 +81,7 @@ function saswp_admin_notice_activation_hook() {
81
  update_option( "saswp_activation_date", date("Y-m-d"));
82
 
83
  }
 
84
  add_action( 'admin_notices', 'saswp_admin_notice' );
85
 
86
  function saswp_admin_notice(){
@@ -143,7 +144,6 @@ function saswp_admin_notice(){
143
  </p>
144
  </div>
145
 
146
-
147
  <?php
148
 
149
  }
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.4
6
  Text Domain: schema-and-structured-data-for-wp
7
  Domain Path: /languages
8
  Author: Magazine3
13
  // Exit if accessed directly.
14
  if ( ! defined( 'ABSPATH' ) ) exit;
15
 
16
+ define('SASWP_VERSION', '1.4');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
81
  update_option( "saswp_activation_date", date("Y-m-d"));
82
 
83
  }
84
+
85
  add_action( 'admin_notices', 'saswp_admin_notice' );
86
 
87
  function saswp_admin_notice(){
144
  </p>
145
  </div>
146
 
 
147
  <?php
148
 
149
  }
view/help.php CHANGED
@@ -15,9 +15,9 @@ function saswp_help_meta_box()
15
  );
16
  }
17
 
18
- function saswp_help_meta_box_cb()
19
- {
20
- echo '<a href="admin.php?page=structured_data_options&tab=help">'.esc_html__('Need Help', 'schema-and-structured-data-for-wp').'</a>';
21
  }
22
 
23
  /**
@@ -27,35 +27,7 @@ function saswp_disable_new_posts() {
27
  // Hide sidebar link
28
  global $submenu;
29
  unset($submenu['edit.php?post_type=saswp'][10]);
30
-
31
- // Hide link on listing page
32
- if (isset($_GET['post_type']) && $_GET['post_type'] == 'saswp') {
33
- return '<style type="text/css">
34
- #favorite-actions, .add-new-h2, .tablenav { display:none; }
35
- </style>';
36
- }
37
  }
38
  add_action('admin_menu', 'saswp_disable_new_posts');
39
-
40
-
41
- add_action('admin_head-edit.php','saswp_addCustomImportButton');
42
- function saswp_addCustomImportButton()
43
- {
44
- global $current_screen;
45
-
46
- // Not our post type, exit earlier
47
- // You can remove this if condition if you don't have any specific post type to restrict to.
48
- if ('saswp' != $current_screen->post_type) {
49
- return;
50
- }
51
-
52
- ?>
53
- <script type="text/javascript">
54
- jQuery(document).ready( function($)
55
- {
56
- jQuery(jQuery(".wrap a")[0]).after("<a href='<?php echo esc_url(admin_url('edit.php?post_type=saswp&page=structured_data_options')) ?>' id='' class='page-title-action'>Settings</a>");
57
- });
58
- </script>
59
- <?php
60
- }
61
 
15
  );
16
  }
17
 
18
+ function saswp_help_meta_box_cb(){
19
+
20
+ echo '<a href="'.esc_url(admin_url('admin.php?page=structured_data_options&tab=help')).'">'.esc_html__('Need Help', 'schema-and-structured-data-for-wp').'</a>';
21
  }
22
 
23
  /**
27
  // Hide sidebar link
28
  global $submenu;
29
  unset($submenu['edit.php?post_type=saswp'][10]);
30
+
 
 
 
 
 
 
31
  }
32
  add_action('admin_menu', 'saswp_disable_new_posts');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
view/paywall.php CHANGED
@@ -28,17 +28,14 @@
28
  function saswp_schema_options_meta_box_callback( $post) {
29
 
30
  wp_nonce_field( 'saswp_schema_options_nonce', 'saswp_schema_options_nonce' );
 
31
  $schema_options = esc_sql ( get_post_meta($post->ID, 'schema_options', true) );
32
- $custom_fields = esc_sql ( get_post_meta($post->ID, 'saswp_custom_fields', true) );
 
33
  ?>
34
- <style type="text/css">
35
- .option-table-class {width:100%;}
36
- .option-table-class tr td {padding: 10px 10px 10px 10px ;}
37
- .option-table-class tr > td{width: 30%;}
38
- .option-table-class tr td:last-child{width: 60%;}
39
- .option-table-class input[type="text"], select{width:100%;}
40
- </style>
41
  <div class="misc-pub-section">
 
42
  <table class="option-table-class">
43
  <tbody>
44
  <tr>
@@ -77,23 +74,32 @@
77
  <?php
78
 
79
  if(!empty($custom_fields)){
 
80
  $schema_type = esc_sql ( get_post_meta($post->ID, 'schema_type', true) );
81
- $service = new saswp_output_service();
 
82
  $meta_fields = $service->saswp_get_all_schema_type_fields($schema_type);
83
 
84
  foreach($custom_fields as $fieldkey => $fieldval){
85
 
86
- $option ='';
87
  echo '<tr>';
88
  echo '<td><select class="saswp-custom-fields-name">';
 
89
  foreach ($meta_fields as $key =>$val){
 
90
  if( $fieldkey == $key){
 
91
  $option .='<option value="'.esc_attr($key).'" selected>'.esc_attr($val).'</option>';
 
92
  }else{
 
93
  $option .='<option value="'.esc_attr($key).'">'.esc_attr($val).'</option>';
 
94
  }
95
 
96
  }
 
97
  echo $option;
98
  echo '</select></td>';
99
 
@@ -106,12 +112,13 @@
106
  }
107
 
108
  }
 
109
  ?>
110
 
111
 
112
  </table>
113
  <table class="option-table-class">
114
- <tr><td></td><td><a style="float:right;" class="button button-primary saswp-add-custom-fields">Add Field</a></td></tr>
115
  </table>
116
 
117
  </div>
@@ -122,15 +129,17 @@
122
  }
123
 
124
  function saswp_schema_options_add_meta_box_save( $post_id ) {
 
125
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
126
  if ( ! isset( $_POST['saswp_schema_options_nonce'] ) || ! wp_verify_nonce( $_POST['saswp_schema_options_nonce'], 'saswp_schema_options_nonce' ) ) return;
127
  if ( ! current_user_can( 'edit_post', $post_id ) ) return;
128
 
129
- $notAccessibleForFree ='';
130
- $isAccessibleForFree ='';
131
- $paywall_class_name ='';
132
- $enable_custom_field ='';
133
- $custom_fields ='';
 
134
  if ( isset( $_POST['notAccessibleForFree'] ) )
135
  $notAccessibleForFree = sanitize_text_field($_POST['notAccessibleForFree']);
136
  if ( isset( $_POST['isAccessibleForFree'] ) )
@@ -143,11 +152,12 @@
143
  $custom_fields = array_map ('sanitize_text_field', $_POST['saswp_custom_fields']);
144
 
145
  $saswp_schema_options = array(
146
- 'isAccessibleForFree'=>$isAccessibleForFree,
147
- 'notAccessibleForFree'=>$notAccessibleForFree,
148
- 'paywall_class_name'=>$paywall_class_name,
149
- 'enable_custom_field' => $enable_custom_field
150
- );
 
151
  update_post_meta( $post_id, 'schema_options', $saswp_schema_options);
152
  update_post_meta( $post_id, 'saswp_custom_fields', $custom_fields);
153
 
28
  function saswp_schema_options_meta_box_callback( $post) {
29
 
30
  wp_nonce_field( 'saswp_schema_options_nonce', 'saswp_schema_options_nonce' );
31
+
32
  $schema_options = esc_sql ( get_post_meta($post->ID, 'schema_options', true) );
33
+ $custom_fields = esc_sql ( get_post_meta($post->ID, 'saswp_custom_fields', true) );
34
+
35
  ?>
36
+
 
 
 
 
 
 
37
  <div class="misc-pub-section">
38
+
39
  <table class="option-table-class">
40
  <tbody>
41
  <tr>
74
  <?php
75
 
76
  if(!empty($custom_fields)){
77
+
78
  $schema_type = esc_sql ( get_post_meta($post->ID, 'schema_type', true) );
79
+
80
+ $service = new saswp_output_service();
81
  $meta_fields = $service->saswp_get_all_schema_type_fields($schema_type);
82
 
83
  foreach($custom_fields as $fieldkey => $fieldval){
84
 
85
+ $option = '';
86
  echo '<tr>';
87
  echo '<td><select class="saswp-custom-fields-name">';
88
+
89
  foreach ($meta_fields as $key =>$val){
90
+
91
  if( $fieldkey == $key){
92
+
93
  $option .='<option value="'.esc_attr($key).'" selected>'.esc_attr($val).'</option>';
94
+
95
  }else{
96
+
97
  $option .='<option value="'.esc_attr($key).'">'.esc_attr($val).'</option>';
98
+
99
  }
100
 
101
  }
102
+
103
  echo $option;
104
  echo '</select></td>';
105
 
112
  }
113
 
114
  }
115
+
116
  ?>
117
 
118
 
119
  </table>
120
  <table class="option-table-class">
121
+ <tr><td></td><td><a style="float:right;" class="button button-primary saswp-add-custom-fields"><?php echo esc_html__( 'Add Field', 'schema-and-structured-data-for-wp' ); ?></a></td></tr>
122
  </table>
123
 
124
  </div>
129
  }
130
 
131
  function saswp_schema_options_add_meta_box_save( $post_id ) {
132
+
133
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
134
  if ( ! isset( $_POST['saswp_schema_options_nonce'] ) || ! wp_verify_nonce( $_POST['saswp_schema_options_nonce'], 'saswp_schema_options_nonce' ) ) return;
135
  if ( ! current_user_can( 'edit_post', $post_id ) ) return;
136
 
137
+ $notAccessibleForFree = '';
138
+ $isAccessibleForFree = '';
139
+ $paywall_class_name = '';
140
+ $enable_custom_field = '';
141
+ $custom_fields = '';
142
+
143
  if ( isset( $_POST['notAccessibleForFree'] ) )
144
  $notAccessibleForFree = sanitize_text_field($_POST['notAccessibleForFree']);
145
  if ( isset( $_POST['isAccessibleForFree'] ) )
152
  $custom_fields = array_map ('sanitize_text_field', $_POST['saswp_custom_fields']);
153
 
154
  $saswp_schema_options = array(
155
+ 'isAccessibleForFree' => $isAccessibleForFree,
156
+ 'notAccessibleForFree' => $notAccessibleForFree,
157
+ 'paywall_class_name' => $paywall_class_name,
158
+ 'enable_custom_field' => $enable_custom_field
159
+ );
160
+
161
  update_post_meta( $post_id, 'schema_options', $saswp_schema_options);
162
  update_post_meta( $post_id, 'saswp_custom_fields', $custom_fields);
163
 
view/post_specific.php CHANGED
@@ -7,10 +7,7 @@ class saswp_post_specific {
7
  protected $options_response = array();
8
  protected $modify_schema_post_enable = false;
9
 
10
- public function __construct() {
11
-
12
- }
13
-
14
  public function saswp_post_specific_hooks(){
15
 
16
  $this->saswp_get_all_schema_list();
@@ -99,7 +96,7 @@ class saswp_post_specific {
99
  }
100
  add_meta_box(
101
  'post_specific',
102
- __( 'Post Specific Schema '.$post_title, 'schema-and-structured-data-for-wp' ),
103
  array( $this, 'saswp_post_meta_box_callback' ),
104
  $single_screen,
105
  'advanced',
@@ -138,7 +135,7 @@ class saswp_post_specific {
138
 
139
  if($key==0){
140
 
141
- $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>'
142
  . '<label class="saswp-switch">'
143
  . '<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.'>'
144
  . '<span class="saswp-slider"></span>'
@@ -151,7 +148,7 @@ class saswp_post_specific {
151
  }else{
152
 
153
  $tabs .='<li>'
154
- . '<a saswp-schema-type="'.$schema_type.'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links">'.esc_attr($schema->post_title).'</a>'
155
  . '<label class="saswp-switch">'
156
  . '<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.'>'
157
  . '<span class="saswp-slider"></span>'
@@ -183,7 +180,7 @@ class saswp_post_specific {
183
  $all_schema = $this->all_schema;
184
  $response = $this->saswp_get_fields_by_schema_type($all_schema[0]->ID);
185
 
186
- $schema_ids[] =$all_schema[0]->ID;
187
  $schema_type = esc_sql ( get_post_meta($all_schema[0]->ID, 'schema_type', true) );
188
  $checked = '';
189
  if(isset($schema_enable[$all_schema[0]->ID]) && $schema_enable[$all_schema[0]->ID] == 1){
@@ -193,7 +190,7 @@ class saswp_post_specific {
193
  $this->meta_fields = $response;
194
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
195
  $tabs_fields .= '<div>';
196
- $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>'
197
  . '<label class="saswp-switch" style="margin-left:10px;">'
198
  . '<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.'>'
199
  . '<span class="saswp-slider"></span>'
@@ -219,7 +216,7 @@ class saswp_post_specific {
219
 
220
  }else{
221
 
222
- echo '<a class="button saswp-modify_schema_post_enable">Modify Schema</a>' ;
223
 
224
  }
225
 
@@ -228,33 +225,42 @@ class saswp_post_specific {
228
  public function saswp_restore_schema(){
229
 
230
  if ( ! isset( $_POST['saswp_security_nonce'] ) ){
231
- return;
232
  }
233
  if ( !wp_verify_nonce( $_POST['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
234
  return;
235
  }
 
236
  $result = '';
237
  $post_id = sanitize_text_field($_POST['post_id']);
238
- $schema_ids = $_POST['schema_ids'];
239
-
240
- foreach($schema_ids as $id){
241
 
242
- $meta_field = $this->saswp_get_fields_by_schema_type($id);
 
 
243
 
244
- foreach($meta_field as $field){
245
-
246
- $result = delete_post_meta($post_id, $field['id']);
247
-
248
- }
249
 
250
- }
251
-
 
 
252
  update_option('modify_schema_post_enable_'.$post_id, 'disable');
253
 
254
- if($result){
 
255
  echo json_encode(array('status'=> 't', 'msg'=>esc_html__( 'Schema has been restored', 'schema-and-structured-data-for-wp' )));
 
256
  }else{
 
257
  echo json_encode(array('status'=> 'f', 'msg'=>esc_html__( 'Schema has already been restored', 'schema-and-structured-data-for-wp' )));
 
258
  }
259
  wp_die();
260
  }
@@ -316,23 +322,28 @@ class saswp_post_specific {
316
 
317
  foreach ( $this->meta_fields as $meta_field ) {
318
 
319
- $input ='';
320
- $attributes ='';
321
 
322
- $label = '<label for="' . $meta_field['id'] . '">' . $meta_field['label'] . '</label>';
323
  $meta_value = get_post_meta( $post->ID, $meta_field['id'], true );
324
 
325
  if ( empty( $meta_value ) && isset($meta_field['default'])) {
326
 
327
  $meta_value = $meta_field['default'];
328
  }
 
329
  if(isset($meta_field['attributes'])){
 
330
  foreach ($meta_field['attributes'] as $key => $attr ){
 
331
  $attributes .=''.$key.'="'.$attr.'"';
332
  }
 
333
  }
334
 
335
  switch ( $meta_field['type'] ) {
 
336
  case 'media':
337
  $media_value = array();
338
  $media_key = $meta_field['id'].'_detail';
@@ -394,9 +405,9 @@ class saswp_post_specific {
394
  $media_value['thumbnail'] = $business_details['saswp_event_schema_image']['url'];
395
  }
396
 
397
- $media_height ='';
398
- $media_width ='';
399
- $media_thumbnail ='';
400
 
401
  if(isset($media_value['thumbnail'])){
402
  $media_thumbnail =$media_value['thumbnail'];
@@ -411,7 +422,6 @@ class saswp_post_specific {
411
  $input = sprintf(
412
  '<fieldset><input style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
413
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
414
- // . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_id" class="upload-id " name="'.esc_attr($meta_field['id']).'_id" id="'.esc_attr($meta_field['id']).'_id" value="'.esc_attr($media_value['id']).'">'
415
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="'.esc_attr($meta_field['id']).'_height" id="'.esc_attr($meta_field['id']).'_height" value="'.esc_attr($media_height).'">'
416
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="'.esc_attr($meta_field['id']).'_width" id="'.esc_attr($meta_field['id']).'_width" value="'.esc_attr($media_width).'">'
417
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="'.esc_attr($meta_field['id']).'_thumbnail" id="'.esc_attr($meta_field['id']).'_thumbnail" value="'.esc_attr($media_thumbnail).'">'
@@ -461,12 +471,13 @@ class saswp_post_specific {
461
  $meta_field['id']
462
  );
463
  foreach ( $meta_field['options'] as $key => $value ) {
 
464
  $meta_field_value = !is_numeric( $key ) ? $key : $value;
465
  $input .= sprintf(
466
  '<option %s value="%s">%s</option>',
467
  $meta_value === $meta_field_value ? 'selected' : '',
468
  $meta_field_value,
469
- $value
470
  );
471
  }
472
  $input .= '</select>';
@@ -494,11 +505,16 @@ class saswp_post_specific {
494
  $meta_field['id']
495
  );
496
  foreach ( $meta_field['options'] as $key => $value ) {
497
- $meta_field_selected='';
 
 
498
  if(isset($meta_value)){
499
- if(in_array($key, $meta_value)){
500
- $meta_field_selected = 'selected';
501
- }
 
 
 
502
  }
503
  $input .= sprintf(
504
  '<option %s value="%s">%s</option>',
@@ -520,7 +536,9 @@ class saswp_post_specific {
520
  $meta_value
521
  );
522
  if(isset($meta_field['note'])){
523
- $input .='<p>'.$meta_field['note'].'</p>';
 
 
524
  }
525
  break;
526
  case 'text':
@@ -601,14 +619,17 @@ class saswp_post_specific {
601
  return $post_id;
602
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
603
  return $post_id;
604
-
 
 
605
  $option = get_option('modify_schema_post_enable_'.$post_id);
606
 
607
  if($option != 'enable'){
608
  return;
609
  }
610
-
611
-
 
612
 
613
  if(count($this->all_schema)>0){
614
 
@@ -619,31 +640,33 @@ class saswp_post_specific {
619
 
620
  foreach ( $this->meta_fields as $meta_field ) {
621
 
622
- if ( isset( $_POST[ $meta_field['id'] ] ) ) {
623
 
624
  switch ( $meta_field['type'] ) {
625
 
626
  case 'media':
627
  $media_key = $meta_field['id'].'_detail';
628
- $media_height = sanitize_text_field( $_POST[ $meta_field['id'].'_height' ] );
629
- $media_width = sanitize_text_field( $_POST[ $meta_field['id'].'_width' ] );
630
- $media_thumbnail = sanitize_text_field( $_POST[ $meta_field['id'].'_thumbnail' ] );
 
631
  $media_detail = array(
632
- 'height' =>$media_height,
633
- 'width' =>$media_width,
634
- 'thumbnail' =>$media_thumbnail,
635
- );
 
636
  update_post_meta( $post_id, $media_key, $media_detail);
637
  break;
638
  case 'email':
639
- $_POST[ $meta_field['id'] ] = sanitize_email( $_POST[ $meta_field['id'] ] );
640
  break;
641
  case 'text':
642
- $_POST[ $meta_field['id'] ] = sanitize_text_field( $_POST[ $meta_field['id'] ] );
643
  break;
644
 
645
  }
646
- update_post_meta( $post_id, $meta_field['id'], $_POST[ $meta_field['id'] ] );
647
  } else if ( $meta_field['type'] === 'checkbox' ) {
648
  update_post_meta( $post_id, $meta_field['id'], '0' );
649
  }
@@ -828,8 +851,15 @@ class saswp_post_specific {
828
  global $post;
829
  global $sd_data;
830
 
 
 
831
  $image_id = get_post_thumbnail_id();
832
- $image_details = wp_get_attachment_image_src($image_id, 'full');
 
 
 
 
 
833
 
834
  if(empty($image_details[0]) || $image_details[0] === NULL ){
835
 
@@ -842,10 +872,10 @@ class saswp_post_specific {
842
  $author_details = get_avatar_data($current_user->ID);
843
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
844
 
845
- $business_type = esc_sql ( get_post_meta($schema_id, 'saswp_business_type', true) );
846
- $business_name = esc_sql ( get_post_meta($schema_id, 'saswp_business_name', true) );
847
- $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_local_business_details', true) );
848
- $dayoftheweek = get_post_meta ($schema_id, 'saswp_dayofweek', true);
849
 
850
  $saswp_business_type_key = 'saswp_business_type_'.$schema_id;
851
  $saved_business_type = get_post_meta( $post->ID, $saswp_business_type_key, true );
@@ -858,6 +888,7 @@ class saswp_post_specific {
858
  $business_name = $saved_saswp_business_name;
859
  }
860
  $meta_field = array();
 
861
  switch ($schema_type) {
862
 
863
  case 'local_business':
@@ -2032,7 +2063,7 @@ class saswp_post_specific {
2032
 
2033
  if(isset($_POST['saswp_review_schema_item_type_'.$schema_id])){
2034
 
2035
- $reviewed_field = item_reviewed_fields(sanitize_text_field($_POST['saswp_review_schema_item_type_'.$schema_id]), $post_specific=1, $schema_id);
2036
 
2037
 
2038
  }else{
@@ -2041,12 +2072,12 @@ class saswp_post_specific {
2041
 
2042
  if($item_type_by_post){
2043
 
2044
- $reviewed_field = item_reviewed_fields($item_type_by_post, $post_specific=1, $schema_id);
2045
 
2046
  }else{
2047
 
2048
  $service_schema_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
2049
- $reviewed_field = item_reviewed_fields($service_schema_details['saswp_review_schema_item_type'], $post_specific=1, $schema_id);
2050
 
2051
  }
2052
 
7
  protected $options_response = array();
8
  protected $modify_schema_post_enable = false;
9
 
10
+
 
 
 
11
  public function saswp_post_specific_hooks(){
12
 
13
  $this->saswp_get_all_schema_list();
96
  }
97
  add_meta_box(
98
  'post_specific',
99
+ esc_html__( 'Post Specific Schema - '.$post_title, 'schema-and-structured-data-for-wp' ),
100
  array( $this, 'saswp_post_meta_box_callback' ),
101
  $single_screen,
102
  'advanced',
135
 
136
  if($key==0){
137
 
138
+ $tabs .='<li class="selected"><a saswp-schema-type="'.esc_attr($schema_type).'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links selected">'.esc_attr($schema->post_title).'</a>'
139
  . '<label class="saswp-switch">'
140
  . '<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.'>'
141
  . '<span class="saswp-slider"></span>'
148
  }else{
149
 
150
  $tabs .='<li>'
151
+ . '<a saswp-schema-type="'.esc_attr($schema_type).'" data-id="saswp_specific_'.esc_attr($schema->ID).'" class="saswp-tab-links">'.esc_attr($schema->post_title).'</a>'
152
  . '<label class="saswp-switch">'
153
  . '<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.'>'
154
  . '<span class="saswp-slider"></span>'
180
  $all_schema = $this->all_schema;
181
  $response = $this->saswp_get_fields_by_schema_type($all_schema[0]->ID);
182
 
183
+ $schema_ids[] = $all_schema[0]->ID;
184
  $schema_type = esc_sql ( get_post_meta($all_schema[0]->ID, 'schema_type', true) );
185
  $checked = '';
186
  if(isset($schema_enable[$all_schema[0]->ID]) && $schema_enable[$all_schema[0]->ID] == 1){
190
  $this->meta_fields = $response;
191
  $output = $this->saswp_saswp_post_specific( $post, $all_schema[0]->ID );
192
  $tabs_fields .= '<div>';
193
+ $tabs_fields .= '<div class="saswp-single-post-restore"><a href="#" class="saswp-restore-post-schema button saswp-tab-links selected" saswp-schema-type="'.esc_attr($schema_type).'">'.esc_html__( 'Restore Default Schema', 'schema-and-structured-data-for-wp' ).'</a>'
194
  . '<label class="saswp-switch" style="margin-left:10px;">'
195
  . '<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.'>'
196
  . '<span class="saswp-slider"></span>'
216
 
217
  }else{
218
 
219
+ echo '<a class="button saswp-modify_schema_post_enable">'.esc_html__( 'Modify Schema', 'schema-and-structured-data-for-wp' ).'</a>' ;
220
 
221
  }
222
 
225
  public function saswp_restore_schema(){
226
 
227
  if ( ! isset( $_POST['saswp_security_nonce'] ) ){
228
+ return;
229
  }
230
  if ( !wp_verify_nonce( $_POST['saswp_security_nonce'], 'saswp_ajax_check_nonce' ) ){
231
  return;
232
  }
233
+
234
  $result = '';
235
  $post_id = sanitize_text_field($_POST['post_id']);
236
+ $schema_ids = array_map( 'sanitize_text_field', $_POST['schema_ids'] );
237
+
238
+ if($schema_ids){
239
 
240
+ foreach($schema_ids as $id){
241
+
242
+ $meta_field = $this->saswp_get_fields_by_schema_type($id);
243
 
244
+ foreach($meta_field as $field){
245
+
246
+ $result = delete_post_meta($post_id, $field['id']);
247
+
248
+ }
249
 
250
+ }
251
+
252
+ }
253
+
254
  update_option('modify_schema_post_enable_'.$post_id, 'disable');
255
 
256
+ if($result){
257
+
258
  echo json_encode(array('status'=> 't', 'msg'=>esc_html__( 'Schema has been restored', 'schema-and-structured-data-for-wp' )));
259
+
260
  }else{
261
+
262
  echo json_encode(array('status'=> 'f', 'msg'=>esc_html__( 'Schema has already been restored', 'schema-and-structured-data-for-wp' )));
263
+
264
  }
265
  wp_die();
266
  }
322
 
323
  foreach ( $this->meta_fields as $meta_field ) {
324
 
325
+ $input = '';
326
+ $attributes = '';
327
 
328
+ $label = '<label for="' . $meta_field['id'] . '">' . esc_html__( $meta_field['label'], 'schema-and-structured-data-for-wp' ). '</label>';
329
  $meta_value = get_post_meta( $post->ID, $meta_field['id'], true );
330
 
331
  if ( empty( $meta_value ) && isset($meta_field['default'])) {
332
 
333
  $meta_value = $meta_field['default'];
334
  }
335
+
336
  if(isset($meta_field['attributes'])){
337
+
338
  foreach ($meta_field['attributes'] as $key => $attr ){
339
+
340
  $attributes .=''.$key.'="'.$attr.'"';
341
  }
342
+
343
  }
344
 
345
  switch ( $meta_field['type'] ) {
346
+
347
  case 'media':
348
  $media_value = array();
349
  $media_key = $meta_field['id'].'_detail';
405
  $media_value['thumbnail'] = $business_details['saswp_event_schema_image']['url'];
406
  }
407
 
408
+ $media_height = '';
409
+ $media_width = '';
410
+ $media_thumbnail = '';
411
 
412
  if(isset($media_value['thumbnail'])){
413
  $media_thumbnail =$media_value['thumbnail'];
422
  $input = sprintf(
423
  '<fieldset><input style="width: 80%%" id="%s" name="%s" type="text" value="%s">'
424
  . '<input data-id="media" style="width: 19%%" class="button" id="%s_button" name="%s_button" type="button" value="Upload" />'
 
425
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_height" class="upload-height" name="'.esc_attr($meta_field['id']).'_height" id="'.esc_attr($meta_field['id']).'_height" value="'.esc_attr($media_height).'">'
426
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_width" class="upload-width" name="'.esc_attr($meta_field['id']).'_width" id="'.esc_attr($meta_field['id']).'_width" value="'.esc_attr($media_width).'">'
427
  . '<input type="hidden" data-id="'.esc_attr($meta_field['id']).'_thumbnail" class="upload-thumbnail" name="'.esc_attr($meta_field['id']).'_thumbnail" id="'.esc_attr($meta_field['id']).'_thumbnail" value="'.esc_attr($media_thumbnail).'">'
471
  $meta_field['id']
472
  );
473
  foreach ( $meta_field['options'] as $key => $value ) {
474
+
475
  $meta_field_value = !is_numeric( $key ) ? $key : $value;
476
  $input .= sprintf(
477
  '<option %s value="%s">%s</option>',
478
  $meta_value === $meta_field_value ? 'selected' : '',
479
  $meta_field_value,
480
+ esc_html__($value, 'schema-and-structured-data-for-wp' )
481
  );
482
  }
483
  $input .= '</select>';
505
  $meta_field['id']
506
  );
507
  foreach ( $meta_field['options'] as $key => $value ) {
508
+
509
+ $meta_field_selected = '';
510
+
511
  if(isset($meta_value)){
512
+
513
+ if(in_array($key, $meta_value)){
514
+
515
+ $meta_field_selected = 'selected';
516
+
517
+ }
518
  }
519
  $input .= sprintf(
520
  '<option %s value="%s">%s</option>',
536
  $meta_value
537
  );
538
  if(isset($meta_field['note'])){
539
+
540
+ $input .='<p>'.esc_attr($meta_field['note']).'</p>';
541
+
542
  }
543
  break;
544
  case 'text':
619
  return $post_id;
620
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
621
  return $post_id;
622
+ if ( ! current_user_can( 'edit_post', $post_id ) )
623
+ return $post_id;
624
+
625
  $option = get_option('modify_schema_post_enable_'.$post_id);
626
 
627
  if($option != 'enable'){
628
  return;
629
  }
630
+
631
+ $post_meta = array();
632
+ $post_meta = $_POST;
633
 
634
  if(count($this->all_schema)>0){
635
 
640
 
641
  foreach ( $this->meta_fields as $meta_field ) {
642
 
643
+ if ( isset( $post_meta[ $meta_field['id'] ] ) ) {
644
 
645
  switch ( $meta_field['type'] ) {
646
 
647
  case 'media':
648
  $media_key = $meta_field['id'].'_detail';
649
+ $media_height = sanitize_text_field( $post_meta[ $meta_field['id'].'_height' ] );
650
+ $media_width = sanitize_text_field( $post_meta[ $meta_field['id'].'_width' ] );
651
+ $media_thumbnail = sanitize_text_field( $post_meta[ $meta_field['id'].'_thumbnail' ] );
652
+
653
  $media_detail = array(
654
+ 'height' => $media_height,
655
+ 'width' => $media_width,
656
+ 'thumbnail' => $media_thumbnail,
657
+ );
658
+
659
  update_post_meta( $post_id, $media_key, $media_detail);
660
  break;
661
  case 'email':
662
+ $post_meta[ $meta_field['id'] ] = sanitize_email( $post_meta[ $meta_field['id'] ] );
663
  break;
664
  case 'text':
665
+ $post_meta[ $meta_field['id'] ] = sanitize_text_field( $post_meta[ $meta_field['id'] ] );
666
  break;
667
 
668
  }
669
+ update_post_meta( $post_id, $meta_field['id'], $post_meta[ $meta_field['id'] ] );
670
  } else if ( $meta_field['type'] === 'checkbox' ) {
671
  update_post_meta( $post_id, $meta_field['id'], '0' );
672
  }
851
  global $post;
852
  global $sd_data;
853
 
854
+ $image_details = array();
855
+
856
  $image_id = get_post_thumbnail_id();
857
+
858
+ if($image_id){
859
+
860
+ $image_details = wp_get_attachment_image_src($image_id, 'full');
861
+
862
+ }
863
 
864
  if(empty($image_details[0]) || $image_details[0] === NULL ){
865
 
872
  $author_details = get_avatar_data($current_user->ID);
873
  $schema_type = esc_sql ( get_post_meta($schema_id, 'schema_type', true) );
874
 
875
+ $business_type = esc_sql ( get_post_meta($schema_id, 'saswp_business_type', true) );
876
+ $business_name = esc_sql ( get_post_meta($schema_id, 'saswp_business_name', true) );
877
+ $business_details = esc_sql ( get_post_meta($schema_id, 'saswp_local_business_details', true) );
878
+ $dayoftheweek = get_post_meta ($schema_id, 'saswp_dayofweek', true);
879
 
880
  $saswp_business_type_key = 'saswp_business_type_'.$schema_id;
881
  $saved_business_type = get_post_meta( $post->ID, $saswp_business_type_key, true );
888
  $business_name = $saved_saswp_business_name;
889
  }
890
  $meta_field = array();
891
+
892
  switch ($schema_type) {
893
 
894
  case 'local_business':
2063
 
2064
  if(isset($_POST['saswp_review_schema_item_type_'.$schema_id])){
2065
 
2066
+ $reviewed_field = saswp_item_reviewed_fields(sanitize_text_field($_POST['saswp_review_schema_item_type_'.$schema_id]), $post_specific=1, $schema_id);
2067
 
2068
 
2069
  }else{
2072
 
2073
  if($item_type_by_post){
2074
 
2075
+ $reviewed_field = saswp_item_reviewed_fields($item_type_by_post, $post_specific=1, $schema_id);
2076
 
2077
  }else{
2078
 
2079
  $service_schema_details = esc_sql ( get_post_meta($schema_id, 'saswp_review_schema_details', true) );
2080
+ $reviewed_field = saswp_item_reviewed_fields($service_schema_details['saswp_review_schema_item_type'], $post_specific=1, $schema_id);
2081
 
2082
  }
2083
 
view/review.php CHANGED
@@ -1,10 +1,13 @@
1
  <?php
2
  class saswp_metaboxes_review {
 
3
  private $screen = array();
4
 
5
- public function __construct() {
 
6
  add_action( 'add_meta_boxes', array( $this, 'saswp_review_add_meta_box' ) );
7
  add_action( 'save_post', array( $this, 'saswp_review_save' ) );
 
8
  }
9
  function saswp_review_add_meta_box($post) {
10
 
@@ -33,7 +36,7 @@ class saswp_metaboxes_review {
33
  $single_screen,
34
  'advanced',
35
  'default'
36
- );
37
 
38
  }
39
 
@@ -54,15 +57,17 @@ class saswp_metaboxes_review {
54
  function saswp_meta_box_callback( $post) {
55
 
56
  wp_nonce_field( 'saswp_review_nonce', 'saswp_review_nonce' );
57
- $saswp_review_details = esc_sql ( get_post_meta($post->ID, 'saswp_review_details', true));
58
- $saswp_review_item_feature = array();
59
  $saswp_review_item_star_rating = array();
60
 
 
 
61
  if(isset($saswp_review_details['saswp-review-item-feature'])){
62
- $saswp_review_item_feature = $saswp_review_details['saswp-review-item-feature'];
63
  }
64
  if(isset($saswp_review_details['saswp-review-item-star-rating'])){
65
- $saswp_review_item_star_rating = $saswp_review_details['saswp-review-item-star-rating'];
66
  }
67
 
68
  ?>
@@ -98,6 +103,7 @@ class saswp_metaboxes_review {
98
 
99
  <?php
100
  if(!empty($saswp_review_item_feature)){
 
101
  for ($i=0; $i<count($saswp_review_item_feature); $i++){
102
  ?>
103
  <tr class="saswp-review-item-tr">
@@ -107,7 +113,8 @@ class saswp_metaboxes_review {
107
  <td><input step="0.1" min="0" max="5" type="number" name="saswp-review-item-star-rating[]" value="<?php echo esc_attr($saswp_review_item_star_rating[$i]); ?>"></td>
108
  <td><a type="button" class="saswp-remove-review-item button">x</a></td>
109
  </tr>
110
- <?php
 
111
  }
112
  }
113
  ?>
@@ -200,8 +207,7 @@ class saswp_metaboxes_review {
200
  $saswp_review_details['saswp-review-item-enable'] = sanitize_text_field($_POST['saswp-review-item-enable']);
201
  }
202
  if(isset($_POST['saswp-review-item-description'])){
203
- update_post_meta( $post_id, 'saswp-review-item-description', wp_kses_post( wp_unslash( $_POST['saswp-review-item-description'] )) );
204
-
205
  }
206
  if(isset($_POST['saswp-review-item-props'])){
207
  update_post_meta( $post_id, 'saswp-review-item-props', wp_kses_post( wp_unslash( $_POST['saswp-review-item-props'] )) );
1
  <?php
2
  class saswp_metaboxes_review {
3
+
4
  private $screen = array();
5
 
6
+ public function __construct() {
7
+
8
  add_action( 'add_meta_boxes', array( $this, 'saswp_review_add_meta_box' ) );
9
  add_action( 'save_post', array( $this, 'saswp_review_save' ) );
10
+
11
  }
12
  function saswp_review_add_meta_box($post) {
13
 
36
  $single_screen,
37
  'advanced',
38
  'default'
39
+ );
40
 
41
  }
42
 
57
  function saswp_meta_box_callback( $post) {
58
 
59
  wp_nonce_field( 'saswp_review_nonce', 'saswp_review_nonce' );
60
+
61
+ $saswp_review_item_feature = array();
62
  $saswp_review_item_star_rating = array();
63
 
64
+ $saswp_review_details = esc_sql ( get_post_meta($post->ID, 'saswp_review_details', true));
65
+
66
  if(isset($saswp_review_details['saswp-review-item-feature'])){
67
+ $saswp_review_item_feature = $saswp_review_details['saswp-review-item-feature'];
68
  }
69
  if(isset($saswp_review_details['saswp-review-item-star-rating'])){
70
+ $saswp_review_item_star_rating = $saswp_review_details['saswp-review-item-star-rating'];
71
  }
72
 
73
  ?>
103
 
104
  <?php
105
  if(!empty($saswp_review_item_feature)){
106
+
107
  for ($i=0; $i<count($saswp_review_item_feature); $i++){
108
  ?>
109
  <tr class="saswp-review-item-tr">
113
  <td><input step="0.1" min="0" max="5" type="number" name="saswp-review-item-star-rating[]" value="<?php echo esc_attr($saswp_review_item_star_rating[$i]); ?>"></td>
114
  <td><a type="button" class="saswp-remove-review-item button">x</a></td>
115
  </tr>
116
+ <?php
117
+
118
  }
119
  }
120
  ?>
207
  $saswp_review_details['saswp-review-item-enable'] = sanitize_text_field($_POST['saswp-review-item-enable']);
208
  }
209
  if(isset($_POST['saswp-review-item-description'])){
210
+ update_post_meta( $post_id, 'saswp-review-item-description', wp_kses_post( wp_unslash( $_POST['saswp-review-item-description'] )) );
 
211
  }
212
  if(isset($_POST['saswp-review-item-props'])){
213
  update_post_meta( $post_id, 'saswp-review-item-props', wp_kses_post( wp_unslash( $_POST['saswp-review-item-props'] )) );
view/schema_type.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- function item_reviewed_fields($item, $post_specific = null, $schema_id = null){
3
 
4
  $post_fix = '';
5
 
@@ -11,101 +11,101 @@
11
 
12
  $reviewed_field = array(
13
  array(
14
- 'label' => 'Name',
15
- 'id' => 'saswp_review_schema_name'.$post_fix,
16
- 'type' => 'text',
17
- 'default' => '',
18
  'attributes' => array(
19
  'placeholder' => 'Name'
20
  )
21
 
22
  ),
23
  array(
24
- 'label' => 'Review Body',
25
- 'id' => 'saswp_review_schema_description'.$post_fix,
26
- 'type' => 'textarea',
27
- 'default' => '',
28
  'attributes' => array(
29
  'placeholder' => 'Review Body'
30
  )
31
  ),
32
  array(
33
- 'label' => 'Image',
34
- 'id' => 'saswp_review_schema_image'.$post_fix,
35
- 'type' => 'media',
36
- 'default' => '',
37
  'attributes' => array(
38
  'placeholder' => 'Image'
39
  )
40
  ),
41
  array(
42
- 'label' => 'Author',
43
- 'id' => 'saswp_review_schema_author'.$post_fix,
44
- 'type' => 'text',
45
- 'default' => '',
46
  'attributes' => array(
47
  'placeholder' => 'Author'
48
  )
49
  ),
50
  array(
51
- 'label' => 'Price Range',
52
- 'id' => 'saswp_review_schema_price_range'.$post_fix,
53
- 'type' => 'text',
54
- 'default' => '',
55
  'attributes' => array(
56
  'placeholder' => '$$$ or 55$-100$'
57
  )
58
  ),
59
  array(
60
- 'label' => 'Street Address',
61
- 'id' => 'saswp_review_schema_street_address'.$post_fix,
62
- 'type' => 'text',
63
- 'default' => '',
64
  'attributes' => array(
65
  'placeholder' => 'Street Address'
66
  )
67
  ),
68
  array(
69
- 'label' => 'Address Locality',
70
- 'id' => 'saswp_review_schema_locality'.$post_fix,
71
- 'type' => 'text',
72
- 'default' => '',
73
  'attributes' => array(
74
  'placeholder' => 'Address Locality'
75
  )
76
  ),
77
  array(
78
- 'label' => 'Address Region',
79
- 'id' => 'saswp_review_schema_region'.$post_fix,
80
- 'type' => 'text',
81
- 'default' => '',
82
  'attributes' => array(
83
  'placeholder' => 'Address Region'
84
  )
85
  ),
86
  array(
87
- 'label' => 'Postal Code',
88
- 'id' => 'saswp_review_schema_postal_code'.$post_fix,
89
- 'type' => 'text',
90
- 'default' => '',
91
  'attributes' => array(
92
  'placeholder' => 'Postal Code'
93
  )
94
  ),
95
  array(
96
- 'label' => 'Address Country',
97
- 'id' => 'saswp_review_schema_country'.$post_fix,
98
- 'type' => 'text',
99
- 'default' => '',
100
  'attributes' => array(
101
  'placeholder' => 'Country'
102
  )
103
  ),
104
  array(
105
- 'label' => 'Telephone',
106
- 'id' => 'saswp_review_schema_telephone'.$post_fix,
107
- 'type' => 'text',
108
- 'default' => '',
109
  'attributes' => array(
110
  'placeholder' => '123456789'
111
  )
@@ -129,15 +129,15 @@
129
 
130
  $reviewed_field = array(
131
  array(
132
- 'label' => 'Name',
133
- 'id' => 'saswp_review_schema_name'.$post_fix,
134
- 'type' => 'text',
135
  'default' => $site_name = get_bloginfo()
136
  ),
137
  array(
138
- 'label' => 'Url',
139
- 'id' => 'saswp_review_schema_url'.$post_fix,
140
- 'type' => 'text',
141
  'default' => get_site_url()
142
  )
143
  );
@@ -147,46 +147,46 @@
147
 
148
  $reviewed_field = array(
149
  array(
150
- 'label' => 'Name',
151
- 'id' => 'saswp_review_schema_name'.$post_fix,
152
- 'type' => 'text',
153
- 'default' => '',
154
  'attributes' => array(
155
  'placeholder' => 'Name'
156
  )
157
  ),
158
  array(
159
- 'label' => 'Author',
160
- 'id' => 'saswp_review_schema_author'.$post_fix,
161
- 'type' => 'text',
162
- 'default' => '',
163
  'attributes' => array(
164
  'placeholder' => 'Author'
165
  )
166
  ),
167
  array(
168
- 'label' => 'ISBN',
169
- 'id' => 'saswp_review_schema_isbn'.$post_fix,
170
- 'type' => 'text',
171
- 'default' => '',
172
  'attributes' => array(
173
  'placeholder' => 'ISBN'
174
  )
175
  ),
176
  array(
177
- 'label' => 'URL',
178
- 'id' => 'saswp_review_schema_author_sameas'.$post_fix,
179
- 'type' => 'text',
180
- 'default' => '',
181
  'attributes' => array(
182
  'placeholder' => 'URL'
183
  )
184
  ),
185
  array(
186
- 'label' => 'Review Body',
187
- 'id' => 'saswp_review_schema_description'.$post_fix,
188
- 'type' => 'textarea',
189
- 'default' => '',
190
  'attributes' => array(
191
  'placeholder' => 'Review Body'
192
  )
@@ -219,55 +219,55 @@
219
  case 'Movie':
220
  $reviewed_field = array(
221
  array(
222
- 'label' => 'Name',
223
- 'id' => 'saswp_review_schema_name'.$post_fix,
224
- 'type' => 'text',
225
- 'default' => '',
226
  'attributes' => array(
227
  'placeholder' => 'Name'
228
  )
229
  ),
230
  array(
231
- 'label' => 'Date Created',
232
- 'id' => 'saswp_review_schema_date_created'.$post_fix,
233
- 'type' => 'text',
234
- 'default' => '',
235
  'attributes' => array(
236
  'placeholder' => '2017-05-17'
237
  )
238
  ),
239
  array(
240
- 'label' => 'Image',
241
- 'id' => 'saswp_review_schema_image'.$post_fix,
242
- 'type' => 'media',
243
- 'default' => '',
244
- 'attributes' => array(
245
  'placeholder' => 'Image'
246
  )
247
  ),
248
  array(
249
- 'label' => 'Director',
250
- 'id' => 'saswp_review_schema_director'.$post_fix,
251
- 'type' => 'text',
252
- 'default' => '',
253
  'attributes' => array(
254
  'placeholder' => 'Director'
255
  )
256
  ),
257
  array(
258
- 'label' => 'URL',
259
- 'id' => 'saswp_review_schema_itemreviewed_sameas'.$post_fix,
260
- 'type' => 'text',
261
- 'default' => '',
262
  'attributes' => array(
263
  'placeholder' => 'URL'
264
  )
265
  ),
266
  array(
267
- 'label' => 'Review Body',
268
- 'id' => 'saswp_review_schema_description'.$post_fix,
269
- 'type' => 'textarea',
270
- 'default' => '',
271
  'attributes' => array(
272
  'placeholder' => 'Review Body'
273
  )
@@ -289,19 +289,19 @@
289
  break;
290
  case 'Restaurant':
291
  $reviewed_field[] = array(
292
- 'label' => 'Serves Cuisine',
293
- 'id' => 'saswp_review_schema_servescuisine'.$post_fix,
294
- 'type' => 'text',
295
- 'default' => '',
296
  'attributes' => array(
297
  'placeholder' => 'Serves Cuisine'
298
  )
299
  );
300
  $reviewed_field[] = array(
301
- 'label' => 'Menu',
302
- 'id' => 'saswp_review_schema_menu'.$post_fix,
303
- 'type' => 'text',
304
- 'default' => '',
305
  'attributes' => array(
306
  'placeholder' => 'https://example.com/menu'
307
  )
@@ -322,15 +322,15 @@
322
  case 'WebSite':
323
  $reviewed_field = array(
324
  array(
325
- 'label' => 'Name',
326
- 'id' => 'saswp_review_schema_name'.$post_fix,
327
- 'type' => 'text',
328
  'default' => $site_name = get_bloginfo()
329
  ),
330
  array(
331
- 'label' => 'Url',
332
- 'id' => 'saswp_review_schema_url'.$post_fix,
333
- 'type' => 'text',
334
  'default' => get_site_url()
335
  )
336
  );
@@ -361,7 +361,7 @@
361
  $post_specific = sanitize_text_field($_GET['post_specific']);
362
 
363
 
364
- $meta_fields = item_reviewed_fields($item, $post_specific, $schema_id);
365
 
366
 
367
  foreach ($meta_fields as $meta_field){
@@ -458,8 +458,8 @@
458
  $input = sprintf(
459
  '<textarea %s style="width: 100%%" id="%s" name="%s" rows="5">%s</textarea>',
460
  $attributes,
461
- $meta_field['id'],
462
- $meta_field['id'],
463
  $meta_value
464
  );
465
  break;
@@ -606,12 +606,12 @@
606
 
607
  }
608
 
609
- if($schema_type != 'local_business'){
610
 
611
  $style_business_type = 'style="display:none"';
612
  $style_business_name = 'style="display:none"';
613
 
614
- }
615
  }
616
 
617
  $provider_type = array(
@@ -653,11 +653,9 @@
653
  'Movie' => 'Movie',
654
  'MusicPlaylist' => 'Music Playlist',
655
  'MusicRecording' => 'MusicRecording',
656
- 'Photograph' => 'Photograph',
657
- //'Recipe' => 'Recipe',
658
  'Restaurant' => 'Restaurant',
659
- 'Series' => 'Series',
660
- //'SoftwareApplication' => 'Software Application',
661
  'VisualArtwork' => 'Visual Artwork',
662
  'WebPage' => 'WebPage',
663
  'WebSite' => 'WebSite',
@@ -668,8 +666,7 @@
668
  'AudioObject' => 'AudioObject',
669
  'Blogposting' => 'Blogposting',
670
  'Course' => 'Course',
671
- 'Event' => 'Event',
672
- // 'JobPosting' => 'JobPosting',
673
  'local_business' => 'Local Business',
674
  'NewsArticle' => 'NewsArticle',
675
  'Product' => 'Product',
@@ -855,17 +852,11 @@
855
  </select>
856
 
857
  <?php if($schema_type == 'qanda') { ?>
858
- <span class="saswp-schem-type-note">Note: Currently supported with DW Question & Answer <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">Link</a></span>
859
  <?php }else{ ?>
860
- <span class="saswp-schem-type-note saswp_hide">Note: Currently supported with DW Question & Answer <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/">Link</a></span>
861
  <?php } ?>
862
-
863
- <?php if($schema_type == 'JobPosting') { ?>
864
- <!--<span class="saswp-job-posting-note">Note: Currently supported with WP Job Manager <a target="_blank" href="https://wordpress.org/plugins/wp-job-manager/">Link</a></span>-->
865
- <?php }else{ ?>
866
- <!--<span class="saswp-job-posting-note saswp_hide">Note: Currently supported with WP Job Manager <a target="_blank" href="https://wordpress.org/plugins/wp-job-manager/">Link</a></span>-->
867
- <?php } ?>
868
-
869
  </td>
870
  </tr>
871
  <tr class="saswp-business-type-tr" <?php echo $style_business_type; ?>>
@@ -932,7 +923,7 @@
932
 
933
  foreach ($all_entertainment_array as $key => $value) {
934
  $sel = '';
935
- if($business_name==$key){
936
  $sel = 'selected';
937
  }
938
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
@@ -950,7 +941,7 @@
950
 
951
  foreach ($all_financial_array as $key => $value) {
952
  $sel = '';
953
- if($business_name==$key){
954
  $sel = 'selected';
955
  }
956
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
@@ -1121,7 +1112,7 @@
1121
  <td><?php echo esc_html__('Operation Days', 'schema-and-structured-data-for-wp' ); ?></td>
1122
  <td>
1123
  <textarea id="saswp_dayofweek" placeholder="Mo-Sa 11:00-14:30 <?="\n"?>Mo-Th 17:00-21:30 <?="\n"?>Fr-Sa 17:00-22:00" rows="5" cols="70" name="saswp_dayofweek"><?php if(isset($dayoftheweek)){echo $dayoftheweek; } ?></textarea>
1124
- <p>Note: Enter days and time in given format.</p>
1125
  </td>
1126
  </tr>
1127
 
@@ -1180,11 +1171,13 @@
1180
  <?php
1181
 
1182
  foreach ($provider_type as $key => $value) {
 
1183
  $sel = '';
1184
  if(saswp_remove_warnings($service_details, 'saswp_service_schema_provider_type', 'saswp_string')==$key){
1185
  $sel = 'selected';
1186
  }
1187
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
 
1188
  }
1189
  ?>
1190
  </select>
@@ -1680,16 +1673,17 @@
1680
  update_post_meta( $post_id, 'saswp_local_business_details', $local_business_details );
1681
 
1682
 
1683
- $service_schema_details = array();
1684
- $review_schema_details = array();
1685
- $product_schema_details = array();
1686
- $audio_schema_details = array();
1687
  $software_schema_details = array();
1688
 
1689
  $schema_type = sanitize_text_field($_POST['schema_type']);
1690
 
1691
  if($schema_type =='Service'){
1692
- if ( isset( $_POST['saswp_service_schema_name'] ) ){
 
1693
  $service_schema_details['saswp_service_schema_name'] = sanitize_text_field($_POST['saswp_service_schema_name']);
1694
  }
1695
  if ( isset( $_POST['saswp_service_schema_type'] ) ){
@@ -1702,9 +1696,9 @@
1702
  $service_schema_details['saswp_service_schema_provider_type'] = sanitize_text_field($_POST['saswp_service_schema_provider_type']);
1703
  }
1704
  if ( isset( $_POST['saswp_service_schema_image'] ) ){
1705
- $service_schema_details['saswp_service_schema_image']['id'] = sanitize_text_field($_POST['saswp_service_schema_image']['id']);
1706
- $service_schema_details['saswp_service_schema_image']['url'] = esc_url_raw($_POST['saswp_service_schema_image']['url']);
1707
- $service_schema_details['saswp_service_schema_image']['width'] = sanitize_text_field($_POST['saswp_service_schema_image']['width']);
1708
  $service_schema_details['saswp_service_schema_image']['height'] = sanitize_text_field($_POST['saswp_service_schema_image']['height']);
1709
  }
1710
  if ( isset( $_POST['saswp_service_schema_locality'] ) ){
@@ -1729,7 +1723,7 @@
1729
  $service_schema_details['saswp_service_schema_service_offer'] = sanitize_textarea_field($_POST['saswp_service_schema_service_offer']);
1730
  }
1731
 
1732
- if ( isset( $_POST['saswp_service_schema_enable_rating'] ) ){
1733
  $service_schema_details['saswp_service_schema_enable_rating'] = sanitize_text_field($_POST['saswp_service_schema_enable_rating']);
1734
  }
1735
  if ( isset( $_POST['saswp_service_schema_rating'] ) ){
@@ -1749,7 +1743,7 @@
1749
  }
1750
 
1751
  $item = sanitize_text_field($_POST['saswp_review_schema_item_type']);
1752
- $meta_fields = item_reviewed_fields($item);
1753
 
1754
  foreach ( $meta_fields as $meta_field ) {
1755
 
@@ -1816,10 +1810,10 @@
1816
  $product_schema_details['saswp_product_schema_description'] = sanitize_textarea_field($_POST['saswp_product_schema_description']);
1817
  }
1818
  if ( isset( $_POST['saswp_product_schema_image'] ) ){
1819
- $product_schema_details['saswp_product_schema_image']['id'] = sanitize_text_field($_POST['saswp_product_schema_image']['id']);
1820
- $product_schema_details['saswp_product_schema_image']['url'] = esc_url_raw($_POST['saswp_product_schema_image']['url']);
1821
- $product_schema_details['saswp_product_schema_image']['width'] = sanitize_text_field($_POST['saswp_product_schema_image']['width']);
1822
- $product_schema_details['saswp_product_schema_image']['height'] = sanitize_text_field($_POST['saswp_product_schema_image']['height']);
1823
  }
1824
 
1825
  if ( isset( $_POST['saswp_product_schema_brand_name'] ) ){
@@ -1869,9 +1863,9 @@
1869
 
1870
  }
1871
 
1872
- if($schema_type =='AudioObject'){
1873
 
1874
- if ( isset( $_POST['saswp_audio_schema_name'] ) ){
1875
  $audio_schema_details['saswp_audio_schema_name'] = sanitize_text_field($_POST['saswp_audio_schema_name']);
1876
  }
1877
  if ( isset( $_POST['saswp_audio_schema_description'] ) ){
@@ -1892,7 +1886,7 @@
1892
 
1893
  }
1894
 
1895
- if($schema_type =='SoftwareApplication'){
1896
 
1897
  if ( isset( $_POST['saswp_software_schema_name'] ) ){
1898
  $software_schema_details['saswp_software_schema_name'] = sanitize_text_field($_POST['saswp_software_schema_name']);
@@ -1990,9 +1984,10 @@
1990
  }
1991
 
1992
  if ( isset( $_POST['saswp_event_schema_image'] ) ){
1993
- $event_schema_details['saswp_event_schema_image']['id'] = sanitize_text_field($_POST['saswp_event_schema_image']['id']);
1994
- $event_schema_details['saswp_event_schema_image']['url'] = esc_url_raw($_POST['saswp_event_schema_image']['url']);
1995
- $event_schema_details['saswp_event_schema_image']['width'] = sanitize_text_field($_POST['saswp_event_schema_image']['width']);
 
1996
  $event_schema_details['saswp_event_schema_image']['height'] = sanitize_text_field($_POST['saswp_event_schema_image']['height']);
1997
  }
1998
 
1
  <?php
2
+ function saswp_item_reviewed_fields($item, $post_specific = null, $schema_id = null){
3
 
4
  $post_fix = '';
5
 
11
 
12
  $reviewed_field = array(
13
  array(
14
+ 'label' => 'Name',
15
+ 'id' => 'saswp_review_schema_name'.$post_fix,
16
+ 'type' => 'text',
17
+ 'default' => '',
18
  'attributes' => array(
19
  'placeholder' => 'Name'
20
  )
21
 
22
  ),
23
  array(
24
+ 'label' => 'Review Body',
25
+ 'id' => 'saswp_review_schema_description'.$post_fix,
26
+ 'type' => 'textarea',
27
+ 'default' => '',
28
  'attributes' => array(
29
  'placeholder' => 'Review Body'
30
  )
31
  ),
32
  array(
33
+ 'label' => 'Image',
34
+ 'id' => 'saswp_review_schema_image'.$post_fix,
35
+ 'type' => 'media',
36
+ 'default' => '',
37
  'attributes' => array(
38
  'placeholder' => 'Image'
39
  )
40
  ),
41
  array(
42
+ 'label' => 'Author',
43
+ 'id' => 'saswp_review_schema_author'.$post_fix,
44
+ 'type' => 'text',
45
+ 'default' => '',
46
  'attributes' => array(
47
  'placeholder' => 'Author'
48
  )
49
  ),
50
  array(
51
+ 'label' => 'Price Range',
52
+ 'id' => 'saswp_review_schema_price_range'.$post_fix,
53
+ 'type' => 'text',
54
+ 'default' => '',
55
  'attributes' => array(
56
  'placeholder' => '$$$ or 55$-100$'
57
  )
58
  ),
59
  array(
60
+ 'label' => 'Street Address',
61
+ 'id' => 'saswp_review_schema_street_address'.$post_fix,
62
+ 'type' => 'text',
63
+ 'default' => '',
64
  'attributes' => array(
65
  'placeholder' => 'Street Address'
66
  )
67
  ),
68
  array(
69
+ 'label' => 'Address Locality',
70
+ 'id' => 'saswp_review_schema_locality'.$post_fix,
71
+ 'type' => 'text',
72
+ 'default' => '',
73
  'attributes' => array(
74
  'placeholder' => 'Address Locality'
75
  )
76
  ),
77
  array(
78
+ 'label' => 'Address Region',
79
+ 'id' => 'saswp_review_schema_region'.$post_fix,
80
+ 'type' => 'text',
81
+ 'default' => '',
82
  'attributes' => array(
83
  'placeholder' => 'Address Region'
84
  )
85
  ),
86
  array(
87
+ 'label' => 'Postal Code',
88
+ 'id' => 'saswp_review_schema_postal_code'.$post_fix,
89
+ 'type' => 'text',
90
+ 'default' => '',
91
  'attributes' => array(
92
  'placeholder' => 'Postal Code'
93
  )
94
  ),
95
  array(
96
+ 'label' => 'Address Country',
97
+ 'id' => 'saswp_review_schema_country'.$post_fix,
98
+ 'type' => 'text',
99
+ 'default' => '',
100
  'attributes' => array(
101
  'placeholder' => 'Country'
102
  )
103
  ),
104
  array(
105
+ 'label' => 'Telephone',
106
+ 'id' => 'saswp_review_schema_telephone'.$post_fix,
107
+ 'type' => 'text',
108
+ 'default' => '',
109
  'attributes' => array(
110
  'placeholder' => '123456789'
111
  )
129
 
130
  $reviewed_field = array(
131
  array(
132
+ 'label' => 'Name',
133
+ 'id' => 'saswp_review_schema_name'.$post_fix,
134
+ 'type' => 'text',
135
  'default' => $site_name = get_bloginfo()
136
  ),
137
  array(
138
+ 'label' => 'Url',
139
+ 'id' => 'saswp_review_schema_url'.$post_fix,
140
+ 'type' => 'text',
141
  'default' => get_site_url()
142
  )
143
  );
147
 
148
  $reviewed_field = array(
149
  array(
150
+ 'label' => 'Name',
151
+ 'id' => 'saswp_review_schema_name'.$post_fix,
152
+ 'type' => 'text',
153
+ 'default' => '',
154
  'attributes' => array(
155
  'placeholder' => 'Name'
156
  )
157
  ),
158
  array(
159
+ 'label' => 'Author',
160
+ 'id' => 'saswp_review_schema_author'.$post_fix,
161
+ 'type' => 'text',
162
+ 'default' => '',
163
  'attributes' => array(
164
  'placeholder' => 'Author'
165
  )
166
  ),
167
  array(
168
+ 'label' => 'ISBN',
169
+ 'id' => 'saswp_review_schema_isbn'.$post_fix,
170
+ 'type' => 'text',
171
+ 'default' => '',
172
  'attributes' => array(
173
  'placeholder' => 'ISBN'
174
  )
175
  ),
176
  array(
177
+ 'label' => 'URL',
178
+ 'id' => 'saswp_review_schema_author_sameas'.$post_fix,
179
+ 'type' => 'text',
180
+ 'default' => '',
181
  'attributes' => array(
182
  'placeholder' => 'URL'
183
  )
184
  ),
185
  array(
186
+ 'label' => 'Review Body',
187
+ 'id' => 'saswp_review_schema_description'.$post_fix,
188
+ 'type' => 'textarea',
189
+ 'default' => '',
190
  'attributes' => array(
191
  'placeholder' => 'Review Body'
192
  )
219
  case 'Movie':
220
  $reviewed_field = array(
221
  array(
222
+ 'label' => 'Name',
223
+ 'id' => 'saswp_review_schema_name'.$post_fix,
224
+ 'type' => 'text',
225
+ 'default' => '',
226
  'attributes' => array(
227
  'placeholder' => 'Name'
228
  )
229
  ),
230
  array(
231
+ 'label' => 'Date Created',
232
+ 'id' => 'saswp_review_schema_date_created'.$post_fix,
233
+ 'type' => 'text',
234
+ 'default' => '',
235
  'attributes' => array(
236
  'placeholder' => '2017-05-17'
237
  )
238
  ),
239
  array(
240
+ 'label' => 'Image',
241
+ 'id' => 'saswp_review_schema_image'.$post_fix,
242
+ 'type' => 'media',
243
+ 'default' => '',
244
+ 'attributes' => array(
245
  'placeholder' => 'Image'
246
  )
247
  ),
248
  array(
249
+ 'label' => 'Director',
250
+ 'id' => 'saswp_review_schema_director'.$post_fix,
251
+ 'type' => 'text',
252
+ 'default' => '',
253
  'attributes' => array(
254
  'placeholder' => 'Director'
255
  )
256
  ),
257
  array(
258
+ 'label' => 'URL',
259
+ 'id' => 'saswp_review_schema_itemreviewed_sameas'.$post_fix,
260
+ 'type' => 'text',
261
+ 'default' => '',
262
  'attributes' => array(
263
  'placeholder' => 'URL'
264
  )
265
  ),
266
  array(
267
+ 'label' => 'Review Body',
268
+ 'id' => 'saswp_review_schema_description'.$post_fix,
269
+ 'type' => 'textarea',
270
+ 'default' => '',
271
  'attributes' => array(
272
  'placeholder' => 'Review Body'
273
  )
289
  break;
290
  case 'Restaurant':
291
  $reviewed_field[] = array(
292
+ 'label' => 'Serves Cuisine',
293
+ 'id' => 'saswp_review_schema_servescuisine'.$post_fix,
294
+ 'type' => 'text',
295
+ 'default' => '',
296
  'attributes' => array(
297
  'placeholder' => 'Serves Cuisine'
298
  )
299
  );
300
  $reviewed_field[] = array(
301
+ 'label' => 'Menu',
302
+ 'id' => 'saswp_review_schema_menu'.$post_fix,
303
+ 'type' => 'text',
304
+ 'default' => '',
305
  'attributes' => array(
306
  'placeholder' => 'https://example.com/menu'
307
  )
322
  case 'WebSite':
323
  $reviewed_field = array(
324
  array(
325
+ 'label' => 'Name',
326
+ 'id' => 'saswp_review_schema_name'.$post_fix,
327
+ 'type' => 'text',
328
  'default' => $site_name = get_bloginfo()
329
  ),
330
  array(
331
+ 'label' => 'Url',
332
+ 'id' => 'saswp_review_schema_url'.$post_fix,
333
+ 'type' => 'text',
334
  'default' => get_site_url()
335
  )
336
  );
361
  $post_specific = sanitize_text_field($_GET['post_specific']);
362
 
363
 
364
+ $meta_fields = saswp_item_reviewed_fields($item, $post_specific, $schema_id);
365
 
366
 
367
  foreach ($meta_fields as $meta_field){
458
  $input = sprintf(
459
  '<textarea %s style="width: 100%%" id="%s" name="%s" rows="5">%s</textarea>',
460
  $attributes,
461
+ esc_attr($meta_field['id']),
462
+ esc_attr($meta_field['id']),
463
  $meta_value
464
  );
465
  break;
606
 
607
  }
608
 
609
+ if($schema_type != 'local_business'){
610
 
611
  $style_business_type = 'style="display:none"';
612
  $style_business_name = 'style="display:none"';
613
 
614
+ }
615
  }
616
 
617
  $provider_type = array(
653
  'Movie' => 'Movie',
654
  'MusicPlaylist' => 'Music Playlist',
655
  'MusicRecording' => 'MusicRecording',
656
+ 'Photograph' => 'Photograph',
 
657
  'Restaurant' => 'Restaurant',
658
+ 'Series' => 'Series',
 
659
  'VisualArtwork' => 'Visual Artwork',
660
  'WebPage' => 'WebPage',
661
  'WebSite' => 'WebSite',
666
  'AudioObject' => 'AudioObject',
667
  'Blogposting' => 'Blogposting',
668
  'Course' => 'Course',
669
+ 'Event' => 'Event',
 
670
  'local_business' => 'Local Business',
671
  'NewsArticle' => 'NewsArticle',
672
  'Product' => 'Product',
852
  </select>
853
 
854
  <?php if($schema_type == 'qanda') { ?>
855
+ <span class="saswp-schem-type-note"><?php echo esc_html__('Note: Currently supported with DW Question & Answer', 'schema-and-structured-data-for-wp' ); ?> <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/"><?php echo esc_html__('Link', 'schema-and-structured-data-for-wp' ); ?></a></span>
856
  <?php }else{ ?>
857
+ <span class="saswp-schem-type-note saswp_hide"><?php echo esc_html__('Note: Currently supported with DW Question & Answer', 'schema-and-structured-data-for-wp' ); ?> <a target="_blank" href="https://wordpress.org/plugins/dw-question-answer/"><?php echo esc_html__('Link', 'schema-and-structured-data-for-wp' ); ?></a></span>
858
  <?php } ?>
859
+
 
 
 
 
 
 
860
  </td>
861
  </tr>
862
  <tr class="saswp-business-type-tr" <?php echo $style_business_type; ?>>
923
 
924
  foreach ($all_entertainment_array as $key => $value) {
925
  $sel = '';
926
+ if($business_name == $key){
927
  $sel = 'selected';
928
  }
929
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
941
 
942
  foreach ($all_financial_array as $key => $value) {
943
  $sel = '';
944
+ if($business_name == $key){
945
  $sel = 'selected';
946
  }
947
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
1112
  <td><?php echo esc_html__('Operation Days', 'schema-and-structured-data-for-wp' ); ?></td>
1113
  <td>
1114
  <textarea id="saswp_dayofweek" placeholder="Mo-Sa 11:00-14:30 <?="\n"?>Mo-Th 17:00-21:30 <?="\n"?>Fr-Sa 17:00-22:00" rows="5" cols="70" name="saswp_dayofweek"><?php if(isset($dayoftheweek)){echo $dayoftheweek; } ?></textarea>
1115
+ <p><?php echo esc_html__( 'Note: Enter days and time in given format', 'schema-and-structured-data-for-wp' ); ?></p>
1116
  </td>
1117
  </tr>
1118
 
1171
  <?php
1172
 
1173
  foreach ($provider_type as $key => $value) {
1174
+
1175
  $sel = '';
1176
  if(saswp_remove_warnings($service_details, 'saswp_service_schema_provider_type', 'saswp_string')==$key){
1177
  $sel = 'selected';
1178
  }
1179
  echo "<option value='".esc_attr($key)."' ".esc_attr($sel).">".esc_html__($value, 'schema-and-structured-data-for-wp' )."</option>";
1180
+
1181
  }
1182
  ?>
1183
  </select>
1673
  update_post_meta( $post_id, 'saswp_local_business_details', $local_business_details );
1674
 
1675
 
1676
+ $service_schema_details = array();
1677
+ $review_schema_details = array();
1678
+ $product_schema_details = array();
1679
+ $audio_schema_details = array();
1680
  $software_schema_details = array();
1681
 
1682
  $schema_type = sanitize_text_field($_POST['schema_type']);
1683
 
1684
  if($schema_type =='Service'){
1685
+
1686
+ if ( isset( $_POST['saswp_service_schema_name'] ) ){
1687
  $service_schema_details['saswp_service_schema_name'] = sanitize_text_field($_POST['saswp_service_schema_name']);
1688
  }
1689
  if ( isset( $_POST['saswp_service_schema_type'] ) ){
1696
  $service_schema_details['saswp_service_schema_provider_type'] = sanitize_text_field($_POST['saswp_service_schema_provider_type']);
1697
  }
1698
  if ( isset( $_POST['saswp_service_schema_image'] ) ){
1699
+ $service_schema_details['saswp_service_schema_image']['id'] = sanitize_text_field($_POST['saswp_service_schema_image']['id']);
1700
+ $service_schema_details['saswp_service_schema_image']['url'] = esc_url_raw($_POST['saswp_service_schema_image']['url']);
1701
+ $service_schema_details['saswp_service_schema_image']['width'] = sanitize_text_field($_POST['saswp_service_schema_image']['width']);
1702
  $service_schema_details['saswp_service_schema_image']['height'] = sanitize_text_field($_POST['saswp_service_schema_image']['height']);
1703
  }
1704
  if ( isset( $_POST['saswp_service_schema_locality'] ) ){
1723
  $service_schema_details['saswp_service_schema_service_offer'] = sanitize_textarea_field($_POST['saswp_service_schema_service_offer']);
1724
  }
1725
 
1726
+ if ( isset( $_POST['saswp_service_schema_enable_rating'] ) ){
1727
  $service_schema_details['saswp_service_schema_enable_rating'] = sanitize_text_field($_POST['saswp_service_schema_enable_rating']);
1728
  }
1729
  if ( isset( $_POST['saswp_service_schema_rating'] ) ){
1743
  }
1744
 
1745
  $item = sanitize_text_field($_POST['saswp_review_schema_item_type']);
1746
+ $meta_fields = saswp_item_reviewed_fields($item);
1747
 
1748
  foreach ( $meta_fields as $meta_field ) {
1749
 
1810
  $product_schema_details['saswp_product_schema_description'] = sanitize_textarea_field($_POST['saswp_product_schema_description']);
1811
  }
1812
  if ( isset( $_POST['saswp_product_schema_image'] ) ){
1813
+ $product_schema_details['saswp_product_schema_image']['id'] = sanitize_text_field($_POST['saswp_product_schema_image']['id']);
1814
+ $product_schema_details['saswp_product_schema_image']['url'] = esc_url_raw($_POST['saswp_product_schema_image']['url']);
1815
+ $product_schema_details['saswp_product_schema_image']['width'] = sanitize_text_field($_POST['saswp_product_schema_image']['width']);
1816
+ $product_schema_details['saswp_product_schema_image']['height'] = sanitize_text_field($_POST['saswp_product_schema_image']['height']);
1817
  }
1818
 
1819
  if ( isset( $_POST['saswp_product_schema_brand_name'] ) ){
1863
 
1864
  }
1865
 
1866
+ if($schema_type == 'AudioObject' ){
1867
 
1868
+ if ( isset( $_POST['saswp_audio_schema_name'] ) ){
1869
  $audio_schema_details['saswp_audio_schema_name'] = sanitize_text_field($_POST['saswp_audio_schema_name']);
1870
  }
1871
  if ( isset( $_POST['saswp_audio_schema_description'] ) ){
1886
 
1887
  }
1888
 
1889
+ if($schema_type == 'SoftwareApplication'){
1890
 
1891
  if ( isset( $_POST['saswp_software_schema_name'] ) ){
1892
  $software_schema_details['saswp_software_schema_name'] = sanitize_text_field($_POST['saswp_software_schema_name']);
1984
  }
1985
 
1986
  if ( isset( $_POST['saswp_event_schema_image'] ) ){
1987
+
1988
+ $event_schema_details['saswp_event_schema_image']['id'] = sanitize_text_field($_POST['saswp_event_schema_image']['id']);
1989
+ $event_schema_details['saswp_event_schema_image']['url'] = esc_url_raw($_POST['saswp_event_schema_image']['url']);
1990
+ $event_schema_details['saswp_event_schema_image']['width'] = sanitize_text_field($_POST['saswp_event_schema_image']['width']);
1991
  $event_schema_details['saswp_event_schema_image']['height'] = sanitize_text_field($_POST['saswp_event_schema_image']['height']);
1992
  }
1993