Schema & Structured Data for WP & AMP - Version 1.9.87

Version Description

(23 Oct 2021) =

  • Fixed: Invalid object type for field author #1552
  • Fixed: License link improvement #1539
  • Fixed: QandA Schema activation issue on SASWP #1547
  • Added: Support for All-in-Once SEO plugin v.4 fields #1528
  • Enhancement: Need add 'US' date format in reviews section. #1540
Download this release

Release Info

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

Code changes from version 1.9.86.1 to 1.9.87

admin_section/settings.php CHANGED
@@ -472,8 +472,12 @@ function saswp_admin_interface_render(){
472
 
473
  echo '<div id="saswp-tools-tabs" style="margin-top: 10px;">';
474
 
475
- echo '<a class="saswp-tools-tab-nav" href="#saswp-advanced-heading">'.saswp_t_string('Advanced').'</a> | <a href="#saswp-translation-heading" class="saswp-tools-tab-nav">'.saswp_t_string('Translation Panel').'</a> | <a class="saswp-tools-tab-nav" href="#saswp-migration-heading">'.saswp_t_string('Migration').'</a> | <a class="saswp-tools-tab-nav" href="#saswp-import-export-heading">'.saswp_t_string('Import / Export').'</a> | <a class="saswp-tools-tab-nav" href="#saswp-misc-heading">'.saswp_t_string('Misc').'</a> | <a class="saswp-tools-tab-nav" href="' . esc_url( admin_url( 'admin.php?page=structured_data_options&tab=premium_features' ) ) . '">' . saswp_t_string( 'License' ) . '</a>';
476
 
 
 
 
 
477
  echo'</div> ';
478
  // Status
479
 
@@ -1862,10 +1866,15 @@ if(is_array($translation_labels)){
1862
 
1863
  }
1864
  echo '</ul>';
1865
- $premium_feat_redirect = esc_url(admin_url().'admin.php?page=structured_data_options&tab=premium_features');
1866
- echo '<h2 id="saswp-license-heading">'.saswp_t_string('License').'</h2>
1867
- <p> This section has been shifted to <a href="'.$premium_feat_redirect.'">Premium Features Tab</a>';
1868
-
 
 
 
 
 
1869
  $add_on = array();
1870
 
1871
  if(is_plugin_active('1-click-indexing-api-integration-for-saswp/1-click-indexing-api-integration-for-saswp.php')){
472
 
473
  echo '<div id="saswp-tools-tabs" style="margin-top: 10px;">';
474
 
475
+ echo '<a class="saswp-tools-tab-nav" href="#saswp-advanced-heading">'.saswp_t_string('Advanced').'</a> | <a href="#saswp-translation-heading" class="saswp-tools-tab-nav">'.saswp_t_string('Translation Panel').'</a> | <a class="saswp-tools-tab-nav" href="#saswp-migration-heading">'.saswp_t_string('Migration').'</a> | <a class="saswp-tools-tab-nav" href="#saswp-import-export-heading">'.saswp_t_string('Import / Export').'</a> | <a class="saswp-tools-tab-nav" href="#saswp-misc-heading">'.saswp_t_string('Misc').'</a>';
476
 
477
+ if(saswp_ext_installed_status()){
478
+ echo ' | <a class="saswp-tools-tab-nav" href="' . esc_url( admin_url( 'admin.php?page=structured_data_options&tab=premium_features' ) ) . '">' . saswp_t_string( 'License' ) . '</a>';
479
+ }
480
+
481
  echo'</div> ';
482
  // Status
483
 
1866
 
1867
  }
1868
  echo '</ul>';
1869
+
1870
+ if(saswp_ext_installed_status()){
1871
+
1872
+ $premium_feat_redirect = esc_url(admin_url().'admin.php?page=structured_data_options&tab=premium_features');
1873
+ echo '<h2 id="saswp-license-heading">'.saswp_t_string('License').'</h2>
1874
+ <p> This section has been shifted to <a href="'.esc_url($premium_feat_redirect).'">Premium Features Tab</a></p>';
1875
+
1876
+ }
1877
+
1878
  $add_on = array();
1879
 
1880
  if(is_plugin_active('1-click-indexing-api-integration-for-saswp/1-click-indexing-api-integration-for-saswp.php')){
modules/reviews/reviews_setup.php CHANGED
@@ -203,9 +203,13 @@ function saswp_reviews_custom_columns_set( $column, $post_id ) {
203
  break;
204
  case 'saswp_review_date' :
205
 
206
- $name = get_post_meta( $post_id, $key='saswp_review_date', true);
207
- echo esc_attr($name);
208
-
 
 
 
 
209
  break;
210
  case 'saswp_review_place_id' :
211
 
203
  break;
204
  case 'saswp_review_date' :
205
 
206
+ $date = get_post_meta( $post_id, $key='saswp_review_date', true);
207
+
208
+ if($date){
209
+ $date = date('m-d-Y H:i:s', strtotime($date));
210
+ echo esc_attr($date);
211
+ }
212
+
213
  break;
214
  case 'saswp_review_place_id' :
215
 
output/markup.php CHANGED
@@ -1101,8 +1101,9 @@ function saswp_product_schema_markup($schema_id, $schema_post_id, $all_post_meta
1101
 
1102
  $review_fields = array();
1103
 
1104
- $review_fields['@type'] = 'Review';
1105
- $review_fields['author'] = esc_attr($review['saswp_product_reviews_reviewer_name']);
 
1106
 
1107
  if(isset($review['saswp_product_reviews_created_date'])){
1108
  $review_fields['datePublished'] = esc_html($review['saswp_product_reviews_created_date']);
@@ -1137,10 +1138,11 @@ function saswp_product_schema_markup($schema_id, $schema_post_id, $all_post_meta
1137
 
1138
  $review_fields = array();
1139
 
1140
- $review_fields['@type'] = 'Review';
1141
- $review_fields['author'] = esc_attr($review['author']);
1142
- $review_fields['datePublished'] = esc_html($review['datePublished']);
1143
- $review_fields['description'] = $review['description'];
 
1144
 
1145
  if(isset($review['reviewRating']) && $review['reviewRating'] !=''){
1146
 
@@ -3285,8 +3287,9 @@ function saswp_vehicle_schema_markup($schema_id, $schema_post_id, $all_post_meta
3285
 
3286
  $review_fields = array();
3287
 
3288
- $review_fields['@type'] = 'Review';
3289
- $review_fields['author'] = esc_attr($review['saswp_vehicle_reviews_reviewer_name']);
 
3290
 
3291
  if(isset($review['saswp_vehicle_reviews_created_date'])){
3292
  $review_fields['datePublished'] = esc_html($review['saswp_vehicle_reviews_created_date']);
@@ -3320,10 +3323,11 @@ function saswp_vehicle_schema_markup($schema_id, $schema_post_id, $all_post_meta
3320
 
3321
  $review_fields = array();
3322
 
3323
- $review_fields['@type'] = 'Review';
3324
- $review_fields['author'] = esc_attr($review['author']);
3325
- $review_fields['datePublished'] = esc_html($review['datePublished']);
3326
- $review_fields['description'] = $review['description'];
 
3327
 
3328
  if(isset($review['reviewRating']) && $review['reviewRating'] !=''){
3329
 
@@ -3442,8 +3446,9 @@ function saswp_car_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3442
 
3443
  $review_fields = array();
3444
 
3445
- $review_fields['@type'] = 'Review';
3446
- $review_fields['author'] = esc_attr($review['saswp_car_reviews_reviewer_name']);
 
3447
 
3448
  if(isset($review['saswp_car_reviews_created_date'])){
3449
  $review_fields['datePublished'] = esc_html($review['saswp_car_reviews_created_date']);
@@ -3477,10 +3482,11 @@ function saswp_car_schema_markup($schema_id, $schema_post_id, $all_post_meta){
3477
 
3478
  $review_fields = array();
3479
 
3480
- $review_fields['@type'] = 'Review';
3481
- $review_fields['author'] = esc_attr($review['author']);
3482
- $review_fields['datePublished'] = esc_html($review['datePublished']);
3483
- $review_fields['description'] = $review['description'];
 
3484
 
3485
  if(isset($review['reviewRating']) && $review['reviewRating'] !=''){
3486
 
1101
 
1102
  $review_fields = array();
1103
 
1104
+ $review_fields['@type'] = 'Review';
1105
+ $review_fields['author']['@type'] = 'Person';
1106
+ $review_fields['author'] = esc_attr($review['saswp_product_reviews_reviewer_name']);
1107
 
1108
  if(isset($review['saswp_product_reviews_created_date'])){
1109
  $review_fields['datePublished'] = esc_html($review['saswp_product_reviews_created_date']);
1138
 
1139
  $review_fields = array();
1140
 
1141
+ $review_fields['@type'] = 'Review';
1142
+ $review_fields['author']['@type'] = 'Person';
1143
+ $review_fields['author'] = esc_attr($review['author']);
1144
+ $review_fields['datePublished'] = esc_html($review['datePublished']);
1145
+ $review_fields['description'] = $review['description'];
1146
 
1147
  if(isset($review['reviewRating']) && $review['reviewRating'] !=''){
1148
 
3287
 
3288
  $review_fields = array();
3289
 
3290
+ $review_fields['@type'] = 'Review';
3291
+ $review_fields['author']['@type'] = 'Person';
3292
+ $review_fields['author'] = esc_attr($review['saswp_vehicle_reviews_reviewer_name']);
3293
 
3294
  if(isset($review['saswp_vehicle_reviews_created_date'])){
3295
  $review_fields['datePublished'] = esc_html($review['saswp_vehicle_reviews_created_date']);
3323
 
3324
  $review_fields = array();
3325
 
3326
+ $review_fields['@type'] = 'Review';
3327
+ $review_fields['author']['@type'] = 'Person';
3328
+ $review_fields['author'] = esc_attr($review['author']);
3329
+ $review_fields['datePublished'] = esc_html($review['datePublished']);
3330
+ $review_fields['description'] = $review['description'];
3331
 
3332
  if(isset($review['reviewRating']) && $review['reviewRating'] !=''){
3333
 
3446
 
3447
  $review_fields = array();
3448
 
3449
+ $review_fields['@type'] = 'Review';
3450
+ $review_fields['author']['@type'] = 'Person';
3451
+ $review_fields['author'] = esc_attr($review['saswp_car_reviews_reviewer_name']);
3452
 
3453
  if(isset($review['saswp_car_reviews_created_date'])){
3454
  $review_fields['datePublished'] = esc_html($review['saswp_car_reviews_created_date']);
3482
 
3483
  $review_fields = array();
3484
 
3485
+ $review_fields['@type'] = 'Review';
3486
+ $review_fields['author']['@type'] = 'Person';
3487
+ $review_fields['author'] = esc_attr($review['author']);
3488
+ $review_fields['datePublished'] = esc_html($review['datePublished']);
3489
+ $review_fields['description'] = $review['description'];
3490
 
3491
  if(isset($review['reviewRating']) && $review['reviewRating'] !=''){
3492
 
output/service.php CHANGED
@@ -257,19 +257,52 @@ Class saswp_output_service{
257
 
258
  case 'custom_field':
259
 
260
- $cus_field = get_post_meta($schema_post_id, 'saswp_custom_meta_field', true);
 
 
261
 
262
- if(strpos($cus_field[$key], "image") !== false){
263
- $response = get_post_meta($post->ID, $cus_field[$key], true);
264
- if(is_numeric($response)){
265
- $response = saswp_get_image_by_id($response);
266
- }else{
267
- $response = get_post_meta($post->ID, $cus_field[$key], true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  }
 
 
269
  }else{
270
- $response = get_post_meta($post->ID, $cus_field[$key], true);
 
 
 
 
 
 
 
 
 
 
 
271
  }
272
-
273
  break;
274
  case 'fixed_image':
275
 
@@ -4076,23 +4109,63 @@ Class saswp_output_service{
4076
  }
4077
 
4078
  $search_string = isset( $_POST['q'] ) ? sanitize_text_field( $_POST['q'] ) : '';
4079
- $data = array();
4080
- $result = array();
4081
 
4082
  global $wpdb;
4083
- $saswp_meta_array = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE '%{$search_string}%'", ARRAY_A ); // WPCS: unprepared SQL OK.
 
 
4084
  if ( isset( $saswp_meta_array ) && ! empty( $saswp_meta_array ) ) {
4085
 
4086
  foreach ( $saswp_meta_array as $value ) {
4087
- // if ( ! in_array( $value['meta_key'], $schema_post_meta_fields ) ) {
4088
  $data[] = array(
4089
  'id' => $value['meta_key'],
4090
  'text' => preg_replace( '/^_/', '', esc_html( str_replace( '_', ' ', $value['meta_key'] ) ) ),
4091
  );
4092
- //}
4093
  }
4094
 
4095
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4096
 
4097
  if ( is_array( $data ) && ! empty( $data ) ) {
4098
 
@@ -4998,7 +5071,7 @@ Class saswp_output_service{
4998
 
4999
  $reviews[] = array(
5000
  '@type' => 'Review',
5001
- 'author' => $review['author'] ? esc_attr($review['author']) : 'Anonymous',
5002
  'datePublished' => esc_html($review['datePublished']),
5003
  'description' => $review['description'],
5004
  'reviewRating' => array(
257
 
258
  case 'custom_field':
259
 
260
+ $cus_field = get_post_meta($schema_post_id, 'saswp_custom_meta_field', true);
261
+
262
+ if(strpos($cus_field[$key], "aioseo_posts_") !== false && function_exists('aioseo')){
263
 
264
+ $column_name = str_replace('aioseo_posts_', '', $cus_field[$key]);
265
+ $metaData = aioseo()->meta->metaData->getMetaData();
266
+
267
+ switch ($column_name) {
268
+
269
+ case 'title':
270
+ $response = aioseo()->meta->title->getTitle();
271
+ break;
272
+
273
+ case 'description':
274
+ $response = aioseo()->meta->description->getDescription();
275
+ break;
276
+
277
+ case 'keywords':
278
+ $response = aioseo()->meta->keywords->getKeywords();
279
+ break;
280
+
281
+ default:
282
+
283
+ if(isset($metaData->$column_name)){
284
+ $response = $metaData->$column_name;
285
+ }
286
+
287
+ break;
288
  }
289
+
290
+
291
  }else{
292
+
293
+ if(strpos($cus_field[$key], "image") !== false){
294
+ $response = get_post_meta($post->ID, $cus_field[$key], true);
295
+ if(is_numeric($response)){
296
+ $response = saswp_get_image_by_id($response);
297
+ }else{
298
+ $response = get_post_meta($post->ID, $cus_field[$key], true);
299
+ }
300
+ }else{
301
+ $response = get_post_meta($post->ID, $cus_field[$key], true);
302
+ }
303
+
304
  }
305
+
306
  break;
307
  case 'fixed_image':
308
 
4109
  }
4110
 
4111
  $search_string = isset( $_POST['q'] ) ? sanitize_text_field( $_POST['q'] ) : '';
4112
+ $data = array();
4113
+ $result = array();
4114
 
4115
  global $wpdb;
4116
+
4117
+ $saswp_meta_array = $wpdb->get_results( "SELECT DISTINCT meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE '%{$search_string}%'", ARRAY_A ); // WPCS: unprepared SQL OK.
4118
+
4119
  if ( isset( $saswp_meta_array ) && ! empty( $saswp_meta_array ) ) {
4120
 
4121
  foreach ( $saswp_meta_array as $value ) {
4122
+
4123
  $data[] = array(
4124
  'id' => $value['meta_key'],
4125
  'text' => preg_replace( '/^_/', '', esc_html( str_replace( '_', ' ', $value['meta_key'] ) ) ),
4126
  );
4127
+
4128
  }
4129
 
4130
  }
4131
+
4132
+ //aioseo wp_aioseo_posts support starts here
4133
+ $column_names = array();
4134
+
4135
+ $table_name = $wpdb->prefix . 'aioseo_posts';
4136
+ $columns_des = $wpdb->get_col( "DESC " . $table_name, 0 );
4137
+
4138
+ if($columns_des){
4139
+
4140
+ foreach ( $columns_des as $column_name ) {
4141
+ $column_names[] = 'aioseo_posts_'.$column_name;
4142
+ }
4143
+
4144
+ foreach ( $column_names as $string ) {
4145
+
4146
+ $preg_rep = preg_replace( '/^_/', '', esc_html( str_replace( '_', ' ', $string ) ) );
4147
+
4148
+ if ( strpos( $string, $search_string ) !== false ) {
4149
+
4150
+ $data[] = array(
4151
+ 'id' => $string,
4152
+ 'text' => $preg_rep
4153
+ );
4154
+ }
4155
+
4156
+ if ( strpos( $preg_rep, $search_string ) !== false ) {
4157
+
4158
+ $data[] = array(
4159
+ 'id' => $string,
4160
+ 'text' => $preg_rep
4161
+ );
4162
+ }
4163
+
4164
+ }
4165
+
4166
+ }
4167
+
4168
+ //aioseo wp_aioseo_posts support endss here
4169
 
4170
  if ( is_array( $data ) && ! empty( $data ) ) {
4171
 
5071
 
5072
  $reviews[] = array(
5073
  '@type' => 'Review',
5074
+ 'author' => array('@type' => 'Person', 'name' => $review['author'] ? esc_attr($review['author']) : 'Anonymous'),
5075
  'datePublished' => esc_html($review['datePublished']),
5076
  'description' => $review['description'],
5077
  'reviewRating' => array(
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.8
6
- Stable tag: 1.9.86.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -121,6 +121,15 @@ You can contact us from [here](http://structured-data-for-wp.com/contact-us/)
121
  == Changelog ==
122
 
123
 
 
 
 
 
 
 
 
 
 
124
  = 1.9.86.1 (20 Oct 2021) =
125
 
126
  * Fixed: Empty FAQPage schema #1549
3
  Tags: Schema, Structured Data, Google Snippets, Rich Snippets, Schema.org, SEO, AMP
4
  Requires at least: 3.0
5
  Tested up to: 5.8
6
+ Stable tag: 1.9.87
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
121
  == Changelog ==
122
 
123
 
124
+ = 1.9.87 (23 Oct 2021) =
125
+
126
+ * Fixed: Invalid object type for field “author” #1552
127
+ * Fixed: License link improvement #1539
128
+ * Fixed: QandA Schema activation issue on SASWP #1547
129
+ * Added: Support for All-in-Once SEO plugin v.4 fields #1528
130
+ * Enhancement: Need add 'US' date format in reviews section. #1540
131
+
132
+
133
  = 1.9.86.1 (20 Oct 2021) =
134
 
135
  * Fixed: Empty FAQPage schema #1549
structured-data-for-wp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
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.9.86.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.9.86.1');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));
2
  /*
3
  Plugin Name: Schema & Structured Data for WP & AMP
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.9.87
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.9.87');
17
  define('SASWP_DIR_NAME_FILE', __FILE__ );
18
  define('SASWP_DIR_NAME', dirname( __FILE__ ));
19
  define('SASWP_DIR_URI', plugin_dir_url(__FILE__));